summaryrefslogtreecommitdiff
path: root/modules/lightbox/module.php
diff options
context:
space:
mode:
authorVeit Olschinski <veit@olschinski.de>2010-04-11 20:09:32 +0000
committerVeit Olschinski <veit@olschinski.de>2010-04-11 20:09:32 +0000
commit4c79906db68ae413dd50f024921678afb128b3a8 (patch)
treeaf787dc81d57e2fe26eb693a4763877229f7cea5 /modules/lightbox/module.php
parent49d2b04b97ec1b50d41134700009fd6ec6a7ad62 (diff)
downloadwebtrees-4c79906db68ae413dd50f024921678afb128b3a8.tar.gz
webtrees-4c79906db68ae413dd50f024921678afb128b3a8.tar.bz2
webtrees-4c79906db68ae413dd50f024921678afb128b3a8.zip
Rename pgv_module.php to module.php
Diffstat (limited to 'modules/lightbox/module.php')
-rw-r--r--modules/lightbox/module.php135
1 files changed, 135 insertions, 0 deletions
diff --git a/modules/lightbox/module.php b/modules/lightbox/module.php
new file mode 100644
index 0000000000..53f17b8513
--- /dev/null
+++ b/modules/lightbox/module.php
@@ -0,0 +1,135 @@
+<?php
+/**
+ * Classes and libraries for module system
+ *
+ * webtrees: Web based Family History software
+ * Copyright (C) 2010 webtrees development team.
+ *
+ * Derived from PhpGedView
+ * Copyright (C) 2009 John Finlay
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @package webtrees
+ * @subpackage Modules
+ * @version $Id: class_media.php 5451 2009-05-05 22:15:34Z fisharebest $
+ */
+
+if (!defined('WT_WEBTREES')) {
+ header('HTTP/1.0 403 Forbidden');
+ exit;
+}
+
+require_once WT_ROOT.'includes/classes/class_module.php';
+require_once WT_ROOT.'modules/lightbox/lb_defaultconfig.php';
+
+class lightbox_WT_Module extends WT_Module implements WT_Module_Config, WT_Module_Tab {
+ // Extend WT_Module
+ public function getTitle() {
+ return i18n::translate('Album');
+ }
+
+ // Extend WT_Module
+ public function getDescription() {
+ return i18n::translate('Adds a tab (Album) to the individual page which an alternate way to view and work with media.');
+ }
+
+ // Implement WT_Module_Config
+ public function getConfigLink() {
+ return 'module.php?mod=lightbox&pgvaction=lb_editconfig';
+ }
+
+ // Implement WT_Module_Tab
+ public function defaultTabOrder() {
+ return 60;
+ }
+
+ // Implement WT_Module_Tab
+ public function hasTabContent() {
+ global $MULTI_MEDIA;
+ return $MULTI_MEDIA && $this->get_media_count()>0;
+ }
+
+ // Implement WT_Module_Tab
+ public function getTabContent() {
+ global $MULTI_MEDIA, $SHOW_ID_NUMBERS, $MEDIA_EXTERNAL;
+ global $pgv_changes;
+ global $GEDCOM, $MEDIATYPE, $pgv_changes;
+ global $WORD_WRAPPED_NOTES, $MEDIA_DIRECTORY, $WT_IMAGE_DIR, $WT_IMAGES, $TEXT_DIRECTION, $is_media;
+ global $cntm1, $cntm2, $cntm3, $cntm4, $t, $mgedrec ;
+ global $edit ;
+ global $CONTACT_EMAIL, $pid, $tabno;
+ global $Fam_Navigator, $NAV_ALBUM;
+
+ ob_start();
+ $mediacnt = $this->get_media_count();
+ require_once 'modules/lightbox/functions/lb_head.php';
+ echo "<div id=\"lightbox2_content\">";
+
+ $media_found = false;
+ if (!$this->controller->indi->canDisplayDetails()) {
+ print "<table class=\"facts_table\" cellpadding=\"0\">\n";
+ print "<tr><td class=\"facts_value\">";
+ print_privacy_error($CONTACT_EMAIL);
+ print "</td></tr>";
+ print "</table>";
+ }else{
+ if (file_exists("modules/lightbox/album.php")) {
+ include_once('modules/lightbox/album.php');
+ }
+ }
+ echo "</div>";
+
+ $out .= ob_get_contents();
+ ob_end_clean();
+ $out .= "</div>";
+ return $out;
+ }
+
+ // Implement WT_Module_Tab
+ public function canLoadAjax() {
+ return true;
+ }
+
+ // Implement WT_Module_Tab
+ public function getPreLoadContent() {
+ ob_start();
+ require_once WT_ROOT.'modules/lightbox/functions/lb_call_js.php';
+ return ob_get_clean();
+ }
+
+ // Implement WT_Module_Tab
+ public function getJSCallbackAllTabs() {
+ return 'CB_Init();';
+ }
+
+ // Implement WT_Module_Tab
+ public function getJSCallback() {
+ return '';
+ }
+
+ protected $mediaCount = null;
+
+ private function get_media_count() {
+ if ($this->mediaCount===null) {
+ $ct = preg_match("/\d OBJE/", $this->controller->indi->getGedcomRecord());
+ foreach ($this->controller->indi->getSpouseFamilies() as $k=>$sfam)
+ $ct += preg_match("/\d OBJE/", $sfam->getGedcomRecord());
+ $this->mediaCount = $ct;
+ }
+ return $this->mediaCount;
+ }
+
+}