예제 #1
0
 /**
  * Get a list of modules which (a) provide a specific function and (b) we have permission to see.
  *
  * We cannot currently use auto-loading for modules, as there may be user-defined
  * modules about which the auto-loader knows nothing.
  *
  * @param Tree   $tree
  * @param string $component The type of module, such as "tab", "report" or "menu"
  *
  * @return AbstractModule[]
  */
 private static function getActiveModulesByComponent(Tree $tree, $component)
 {
     $module_names = Database::prepare("SELECT SQL_CACHE module_name" . " FROM `##module`" . " JOIN `##module_privacy` USING (module_name)" . " WHERE gedcom_id = :tree_id AND component = :component AND status = 'enabled' AND access_level >= :access_level" . " ORDER BY CASE component WHEN 'menu' THEN menu_order WHEN 'sidebar' THEN sidebar_order WHEN 'tab' THEN tab_order ELSE 0 END, module_name")->execute(array('tree_id' => $tree->getTreeId(), 'component' => $component, 'access_level' => Auth::accessLevel($tree)))->fetchOneColumn();
     $array = array();
     foreach ($module_names as $module_name) {
         $interface = '\\Fisharebest\\Webtrees\\Module\\Module' . ucfirst($component) . 'Interface';
         $module = self::getModuleByName($module_name);
         if ($module instanceof $interface) {
             $array[$module_name] = $module;
         }
     }
     // The order of menus/sidebars/tabs is defined in the database. Others are sorted by name.
     if ($component !== 'menu' && $component !== 'sidebar' && $component !== 'tab') {
         uasort($array, function (AbstractModule $x, AbstractModule $y) {
             return I18N::strcasecmp($x->getTitle(), $y->getTitle());
         });
     }
     return $array;
 }
예제 #2
0
 protected function access()
 {
     global $WT_TREE;
     if ($this->getSetting('FTV_PDF_ACCESS_LEVEL', '2') >= Auth::accessLevel($WT_TREE)) {
         return true;
     }
 }
예제 #3
0
 public function getMenu()
 {
     global $controller, $WT_TREE;
     $menu_titles = $this->getMenuList();
     $lang = '';
     $min_block = webtrees\Database::prepare("SELECT MIN(block_order) FROM `##block` WHERE module_name=?")->execute(array($this->getName()))->fetchOne();
     foreach ($menu_titles as $items) {
         $languages = $this->getBlockSetting($items->block_id, 'languages');
         if (in_array(WT_LOCALE, explode(',', $languages))) {
             $lang = WT_LOCALE;
         } else {
             $lang = '';
         }
     }
     $default_block = webtrees\Database::prepare("SELECT ##block.block_id FROM `##block`, `##block_setting` WHERE block_order=? AND module_name=? AND ##block.block_id = ##block_setting.block_id AND ##block_setting.setting_value LIKE ?")->execute(array($min_block, $this->getName(), '%' . $lang . '%'))->fetchOne();
     $main_menu_address = webtrees\Database::prepare("SELECT setting_value FROM `##block_setting` WHERE block_id=? AND setting_name=?")->execute(array($default_block, 'menu_address'))->fetchOne();
     if (count($menu_titles) > 1) {
         $main_menu_title = $this->getMenuTitle();
     } else {
         $main_menu_title = webtrees\Database::prepare("SELECT setting_value FROM `##block_setting` WHERE block_id=? AND setting_name=?")->execute(array($default_block, 'menu_title'))->fetchOne();
     }
     if (webtrees\Auth::isSearchEngine()) {
         return null;
     }
     if (file_exists(WT_MODULES_DIR . $this->getName() . '/themes/' . webtrees\Theme::theme()->themeId() . '/')) {
         echo '<link rel="stylesheet" href="' . WT_MODULES_DIR . $this->getName() . '/themes/' . webtrees\Theme::theme()->themeId() . '/style.css" type="text/css">';
     } else {
         echo '<link rel="stylesheet" href="' . WT_MODULES_DIR . $this->getName() . '/themes/webtrees/style.css" type="text/css">';
     }
     //-- main menu item
     $menu = new webtrees\Menu($main_menu_title, $main_menu_address, $this->getName());
     $menu->addClass('menuitem', 'menuitem_hover', '');
     foreach ($menu_titles as $items) {
         if (count($menu_titles) > 1) {
             $languages = $this->getBlockSetting($items->block_id, 'languages');
             if ((!$languages || in_array(WT_LOCALE, explode(',', $languages))) && $items->menu_access >= webtrees\Auth::accessLevel($WT_TREE)) {
                 $submenu = new webtrees\Menu(webtrees\I18N::translate($items->menu_title), $items->menu_address, $this->getName() . '-' . str_replace(' ', '', $items->menu_title));
                 $menu->addSubmenu($submenu);
             }
         }
     }
     if (webtrees\Auth::isAdmin()) {
         $submenu = new webtrees\Menu(webtrees\I18N::translate('Edit menus'), $this->getConfigLink(), $this->getName() . '-edit');
         $menu->addSubmenu($submenu);
     }
     return $menu;
 }
예제 #4
0
 /**
  * {@inhericDoc}
  * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\FactSourceTextExtenderInterface::hFactSourcePrepend()
  */
 public function hFactSourcePrepend($srec)
 {
     global $WT_TREE;
     $html = '';
     $sid = null;
     if ($this->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE)) {
         if (!$srec || strlen($srec) == 0) {
             return $html;
         }
         $certificate = null;
         $subrecords = explode("\n", $srec);
         $levelSOUR = substr($subrecords[0], 0, 1);
         $match = null;
         if (preg_match('~^' . $levelSOUR . ' SOUR @(' . WT_REGEX_XREF . ')@$~', $subrecords[0], $match)) {
             $sid = $match[1];
         }
         $nb_subrecords = count($subrecords);
         for ($i = 0; $i < $nb_subrecords; $i++) {
             $subrecords[$i] = trim($subrecords[$i]);
             $tag = substr($subrecords[$i], 2, 4);
             $text = substr($subrecords[$i], 7);
             if ($tag == '_ACT') {
                 $certificate = new Certificate($text, $WT_TREE, $this->getProvider());
             }
         }
         if ($certificate && $certificate->canShow()) {
             $html = $this->getDisplay_ACT($certificate, $sid);
         }
     }
     return $html;
 }
예제 #5
0
 /**
  * Print the facts
  */
 public function printFamilyFacts()
 {
     global $linkToID;
     $linkToID = $this->record->getXref();
     // -- Tell addmedia.php what to link to
     $indifacts = $this->record->getFacts();
     if ($indifacts) {
         Functions::sortFacts($indifacts);
         foreach ($indifacts as $fact) {
             FunctionsPrintFacts::printFact($fact, $this->record);
         }
     } else {
         echo '<tr><td class="messagebox" colspan="2">', I18N::translate('No facts exist for this family.'), '</td></tr>';
     }
     if (Auth::isEditor($this->record->getTree())) {
         FunctionsPrint::printAddNewFact($this->record->getXref(), $indifacts, 'FAM');
         echo '<tr><td class="descriptionbox">';
         echo I18N::translate('Note');
         echo '</td><td class="optionbox">';
         echo "<a href=\"#\" onclick=\"return add_new_record('" . $this->record->getXref() . "','NOTE');\">", I18N::translate('Add a note'), '</a>';
         echo '</td></tr>';
         echo '<tr><td class="descriptionbox">';
         echo I18N::translate('Shared note');
         echo '</td><td class="optionbox">';
         echo "<a href=\"#\" onclick=\"return add_new_record('" . $this->record->getXref() . "','SHARED_NOTE');\">", I18N::translate('Add a shared note'), '</a>';
         echo '</td></tr>';
         if ($this->record->getTree()->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($this->record->getTree())) {
             echo '<tr><td class="descriptionbox">';
             echo I18N::translate('Media object');
             echo '</td><td class="optionbox">';
             echo "<a href=\"#\" onclick=\"window.open('addmedia.php?action=showmediaform&amp;linktoid=" . $this->record->getXref() . "', '_blank', edit_window_specs); return false;\">", I18N::translate('Add a media object'), '</a>';
             echo FunctionsPrint::helpLink('OBJE');
             echo '<br>';
             echo "<a href=\"#\" onclick=\"window.open('inverselink.php?linktoid=" . $this->record->getXref() . "&amp;linkto=family', '_blank', find_window_specs); return false;\">", I18N::translate('Link to an existing media object'), '</a>';
             echo '</td></tr>';
         }
         echo '<tr><td class="descriptionbox">';
         echo I18N::translate('Source');
         echo '</td><td class="optionbox">';
         echo "<a href=\"#\" onclick=\"return add_new_record('" . $this->record->getXref() . "','SOUR');\">", I18N::translate('Add a source citation'), '</a>';
         echo '</td></tr>';
     }
 }
예제 #6
0
파일: Fact.php 프로젝트: tunandras/webtrees
 /**
  * Do the privacy rules allow us to display this fact to the current user
  *
  * @param int|null $access_level
  *
  * @return bool
  */
 public function canShow($access_level = null)
 {
     if ($access_level === null) {
         $access_level = Auth::accessLevel($this->getParent()->getTree());
     }
     // Does this record have an explicit RESN?
     if (strpos($this->gedcom, "\n2 RESN confidential")) {
         return Auth::PRIV_NONE >= $access_level;
     }
     if (strpos($this->gedcom, "\n2 RESN privacy")) {
         return Auth::PRIV_USER >= $access_level;
     }
     if (strpos($this->gedcom, "\n2 RESN none")) {
         return true;
     }
     // Does this record have a default RESN?
     $xref = $this->parent->getXref();
     $fact_privacy = $this->parent->getTree()->getFactPrivacy();
     $individual_fact_privacy = $this->parent->getTree()->getIndividualFactPrivacy();
     if (isset($individual_fact_privacy[$xref][$this->tag])) {
         return $individual_fact_privacy[$xref][$this->tag] >= $access_level;
     }
     if (isset($fact_privacy[$this->tag])) {
         return $fact_privacy[$this->tag] >= $access_level;
     }
     // No restrictions - it must be public
     return true;
 }
예제 #7
0
 /**
  * Create the tracking code for Google Analytics.
  *
  * See https://developers.google.com/analytics/devguides/collection/analyticsjs/advanced
  *
  * @param string $analytics_id
  *
  * @return string
  */
 protected function analyticsGoogleTracker($analytics_id)
 {
     if ($analytics_id) {
         // Add extra dimensions (i.e. filtering categories)
         $dimensions = (object) array('dimension1' => $this->tree ? $this->tree->getName() : '-', 'dimension2' => $this->tree ? Auth::accessLevel($this->tree) : '-');
         return '<script async src="https://www.google-analytics.com/analytics.js"></script>' . '<script>' . 'window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;' . 'ga("create","' . $analytics_id . '","auto");' . 'ga("send", "pageview", ' . json_encode($dimensions) . ');' . '</script>';
     } else {
         return '';
     }
 }
예제 #8
0
 /**
  * Certificate@listAll
  */
 public function listAll()
 {
     global $WT_TREE;
     $controller = new PageController();
     $controller->setPageTitle(I18N::translate('Certificates'))->restrictAccess($this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE));
     $city = Filter::get('city');
     if (!empty($city) && strlen($city) > 22) {
         $city = Functions::decryptFromSafeBase64($city);
         $controller->setPageTitle(I18N::translate('Certificates for %s', $city));
     }
     $data = new ViewBag();
     $data->set('title', $controller->getPageTitle());
     $data->set('url_module', $this->module->getName());
     $data->set('url_action', 'Certificate@listAll');
     $data->set('url_ged', $WT_TREE->getNameUrl());
     $data->set('cities', $this->provider->getCitiesList());
     $data->set('selected_city', $city);
     $data->set('has_list', false);
     if (!empty($city)) {
         $table_id = 'table-certiflist-' . Uuid::uuid4();
         $certif_list = $this->provider->getCertificatesList($city);
         if (!empty($certif_list)) {
             $data->set('has_list', true);
             $data->set('table_id', $table_id);
             $data->set('certificate_list', $certif_list);
             $controller->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addInlineJavascript('
                     /* Initialise datatables */
     				jQuery.fn.dataTableExt.oSort["unicode-asc"  ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))};
     				jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))};
     				jQuery.fn.dataTableExt.oSort["num-html-asc" ]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a<b) ? -1 : (a>b ? 1 : 0);};
     				jQuery.fn.dataTableExt.oSort["num-html-desc"]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a>b) ? -1 : (a<b ? 1 : 0);};
                     
                     jQuery("#' . $table_id . '").dataTable( {
     					dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\',
 					    ' . I18N::datatablesI18N() . ',
 					    jQueryUI: true,
     					autoWidth: false,
     					processing: true,
     					columns: [
     		                    /* 0-Date */  			{ dataSort: 1, width: "15%", class: "center" },
     							/* 1-DateSort */		{ type: "unicode", visible : false },
     		                    /* 2-Type */ 			{ width: "5%", searchable: false, class: "center"},
     		                    /* 3-CertificateSort */ { type: "unicode", visible : false },
     		                    /* 4-Certificate */     { dataSort: 3, class: "left" }
     		                ],
     		            sorting: [[0,"asc"], [2,"asc"]],
     					displayLength: 20,
     					pagingType: "full_numbers"
     			   });
     				jQuery(".certificate-list").css("visibility", "visible");
     				jQuery(".loading-image").css("display", "none");
                 ');
         }
     }
     ViewFactory::make('CertificatesList', $this, $controller, $data)->render();
 }
예제 #9
0
파일: theme.php 프로젝트: bxbroze/justlight
 protected function menuMedia()
 {
     $resns = $this->tree->getFactPrivacy();
     if (isset($resns['OBJE'])) {
         $resn = $resns['OBJE'];
     } else {
         $resn = Auth::PRIV_PRIVATE;
     }
     if ($resn >= Auth::accessLevel($this->tree)) {
         $MEDIA_DIRECTORY = $this->tree->getPreference('MEDIA_DIRECTORY');
         $folders = $this->themeOption('mediafolders');
         $show_subfolders = $this->themeOption('show_subfolders') ? '&amp;subdirs=on' : '';
         if (count($folders) > 1) {
             $menu = new Menu(I18N::translate('Media'), '', 'menu-media');
             $submenu = new Menu(I18N::translate('Media'), 'medialist.php?' . $this->tree_url . '&amp;action=filter&amp;search=no&amp;folder=&amp;sortby=title' . $show_subfolders . '&amp;max=20&amp;columns=2&amp;action=submit', 'menu-media-all');
             $menu->addSubmenu($submenu);
             // divider
             $divider = new Menu('', '#', 'menu-media-divider divider');
             $menu->addSubmenu($divider);
             foreach ($folders as $key => $folder) {
                 if ($key !== $MEDIA_DIRECTORY) {
                     $submenu = new Menu(ucfirst($folder), 'medialist.php?' . $this->tree_url . '&amp;action=filter&amp;search=no&amp;folder=' . Filter::escapeUrl($key) . '&amp;sortby=title' . $show_subfolders . '&amp;max=20&amp;columns=2&amp;action=submit', 'menu-media-' . preg_replace('/[^A-Za-z0-9\\. -]/', '', str_replace(" ", "-", $folder)));
                     $menu->addSubmenu($submenu);
                 }
             }
         } else {
             // fallback if we don't have any subfolders added to the list
             $menu = new Menu(I18N::translate('Media'), 'medialist.php?' . $this->tree_url . '&amp;sortby=title&amp;max=20&amp;columns=2&amp;action=submit', 'menu-media');
         }
         return $menu;
     }
 }
예제 #10
0
 /**
  * {@inheritDoc}
  * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\PageFooterExtenderInterface::hPrintFooter()
  */
 public function hPrintFooter()
 {
     global $WT_TREE;
     $html = '';
     if ($this->getSetting('MAJ_DISPLAY_CNIL', 0) == 1) {
         $html .= '<br/>';
         $html .= '<div class="center">';
         $cnil_ref = $this->getSetting('MAJ_CNIL_REFERENCE', '');
         if ($cnil_ref != '') {
             $html .= I18N::translate('This site has been notified to the French National Commission for Data protection (CNIL) and registered under number %s. ', $cnil_ref);
         }
         $html .= I18N::translate('In accordance with the French Data protection Act (<em>Loi Informatique et Libertés</em>) of January 6th, 1978, you have the right to access, modify, rectify and delete personal information that pertains to you. To exercice this right, please contact %s, and provide your name, address and a proof of your identity.', Theme::theme()->contactLink(User::find($WT_TREE->getPreference('WEBMASTER_USER_ID'))));
         $html .= '</div>';
     }
     if ($this->getSetting('MAJ_ADD_HTML_FOOTER', 0) == 1) {
         if (Auth::accessLevel($WT_TREE) >= $this->getSetting('MAJ_SHOW_HTML_FOOTER', Auth::PRIV_HIDE) && !Filter::getBool('nofooter')) {
             $html .= $this->getSetting('MAJ_HTML_FOOTER', '');
         }
     }
     return $html;
 }
예제 #11
0
$filetimeHeader = gmdate('D, d M Y H:i:s', $filetime) . ' GMT';
$expireOffset = 3600 * 24;
// tell browser to cache this image for 24 hours
if (Filter::get('cb')) {
    $expireOffset = $expireOffset * 7;
}
// if cb parameter was sent, cache for 7 days
$expireHeader = gmdate('D, d M Y H:i:s', WT_TIMESTAMP + $expireOffset) . ' GMT';
$type = isImageTypeSupported($imgsize['ext']);
$usewatermark = false;
// if this image supports watermarks and the watermark module is intalled...
if ($type) {
    // if this is not a thumbnail, or WATERMARK_THUMB is true
    if ($which === 'main' || $WT_TREE->getPreference('WATERMARK_THUMB')) {
        // if the user’s priv’s justify it...
        if (Auth::accessLevel($WT_TREE) > $WT_TREE->getPreference('SHOW_NO_WATERMARK')) {
            // add a watermark
            $usewatermark = true;
        }
    }
}
// determine whether we have enough memory to watermark this image
if ($usewatermark) {
    if (!FunctionsMedia::hasMemoryForImage($serverFilename)) {
        // not enough memory to watermark this file
        $usewatermark = false;
    }
}
$watermarkfile = '';
$generatewatermark = false;
if ($usewatermark) {
예제 #12
0
 /**
  * Get the blocks for the specified tree
  *
  * @param int $gedcom_id
  *
  * @return string[][]
  */
 public static function getTreeBlocks($gedcom_id)
 {
     if ($gedcom_id < 0) {
         $access_level = Auth::PRIV_NONE;
     } else {
         $access_level = Auth::accessLevel(Tree::findById($gedcom_id));
     }
     $blocks = array('main' => array(), 'side' => array());
     $rows = Database::prepare("SELECT SQL_CACHE location, block_id, module_name" . " FROM  `##block`" . " JOIN  `##module` USING (module_name)" . " JOIN  `##module_privacy` USING (module_name, gedcom_id)" . " WHERE gedcom_id = :tree_id" . " AND   status='enabled'" . " AND   access_level >= :access_level" . " ORDER BY location, block_order")->execute(array('tree_id' => $gedcom_id, 'access_level' => $access_level))->fetchAll();
     foreach ($rows as $row) {
         $blocks[$row->location][$row->block_id] = $row->module_name;
     }
     return $blocks;
 }
예제 #13
0
?>
		</ul>

		<div id="media-edit">
			<table class="facts_table">
			<tr>
				<td style="text-align:center; width:150px;">
				<?php 
// When we have a pending edit, $controller->record shows the *old* data.
// As a temporary kludge, fetch a "normal" version of the record - which includes pending changes
// Perhaps check both, and use RED/BLUE boxes.
$tmp = Media::getInstance($controller->record->getXref(), $WT_TREE);
echo $tmp->displayImage();
if (!$tmp->isExternal()) {
    if ($tmp->fileExists('main')) {
        if ($WT_TREE->getPreference('SHOW_MEDIA_DOWNLOAD') >= Auth::accessLevel($WT_TREE)) {
            echo '<p><a href="' . $tmp->getHtmlUrlDirect('main', true) . '">' . I18N::translate('Download file') . '</a></p>';
        }
    } else {
        echo '<p class="ui-state-error">' . I18N::translate('The file “%s” does not exist.', $tmp->getFilename()) . '</p>';
    }
}
?>
					</td>
					<td>
						<table class="facts_table">
							<?php 
foreach ($facts as $fact) {
    FunctionsPrintFacts::printFact($fact, $controller->record);
}
?>
예제 #14
0
 /**
  * Check if the IsSourced information can be displayed
  *
  * @param int $access_level
  * @return boolean
  */
 public function canDisplayIsSourced($access_level = null)
 {
     global $global_facts;
     if (!$this->gedcomrecord->canShow($access_level)) {
         return false;
     }
     if ($access_level === null) {
         $access_level = \Fisharebest\Webtrees\Auth::accessLevel($this->gedcomrecord->getTree());
     }
     if (isset($global_facts['SOUR'])) {
         return $global_facts['SOUR'] >= $access_level;
     }
     return true;
 }
예제 #15
0
                } else {
                    $action = 'setup';
                }
                break;
            case 'FAM':
                $record = Family::getInstance($var, $WT_TREE);
                if ($record && $record->canShowName()) {
                    $newvars[$name]['gedcom'] = $record->privatizeGedcom(Auth::accessLevel($WT_TREE));
                } else {
                    $action = 'setup';
                }
                break;
            case 'SOUR':
                $record = Source::getInstance($var, $WT_TREE);
                if ($record && $record->canShowName()) {
                    $newvars[$name]['gedcom'] = $record->privatizeGedcom(Auth::accessLevel($WT_TREE));
                } else {
                    $action = 'setup';
                }
                break;
            default:
                break;
        }
    }
}
$vars = $newvars;
foreach ($varnames as $name) {
    if (!isset($vars[$name])) {
        $vars[$name]['id'] = '';
    }
}
예제 #16
0
파일: module.php 프로젝트: bxbroze/webtrees
 /** {@inheritdoc} */
 public function getMenu()
 {
     global $controller;
     if (!Auth::isSearchEngine()) {
         Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION);
         static $menu;
         // Function has already run
         if ($menu !== null && count($menu->getSubmenus()) > 0) {
             return $menu;
         }
         $FTV_SETTINGS = unserialize($this->getSetting('FTV_SETTINGS'));
         if (!empty($FTV_SETTINGS)) {
             foreach ($FTV_SETTINGS as $FTV_ITEM) {
                 if ($FTV_ITEM['TREE'] == $this->tree_id && !empty($FTV_ITEM['PID']) && $FTV_ITEM['ACCESS_LEVEL'] >= Auth::accessLevel($this->tree)) {
                     $FTV_GED_SETTINGS[] = $FTV_ITEM;
                 }
             }
             if (!empty($FTV_GED_SETTINGS)) {
                 if (Theme::theme()->themeId() !== '_administration') {
                     // load the module stylesheets
                     echo $this->module()->getStylesheet();
                     // add javascript files and scripts
                     $this->module()->includeJs($controller, 'menu');
                     if (WT_SCRIPT_NAME === 'individual.php') {
                         $this->module()->includeJs($controller, 'tab');
                     }
                 }
                 $tree_name = Filter::escapeUrl($this->tree->getName());
                 $menu = new Menu(I18N::translate('Family tree overview'), 'module.php?mod=' . $this->getName() . '&amp;mod_action=page&amp;rootid=' . $FTV_GED_SETTINGS[0]['PID'] . '&amp;ged=' . $tree_name, 'menu-fancy_treeview');
                 foreach ($FTV_GED_SETTINGS as $FTV_ITEM) {
                     $record = Individual::getInstance($FTV_ITEM['PID'], $this->tree);
                     if ($record && $record->canShowName()) {
                         if ($this->module()->options('use_fullname') == true) {
                             $submenu = new Menu(I18N::translate('Descendants of %s', $record->getFullName()), 'module.php?mod=' . $this->getName() . '&amp;mod_action=page&amp;rootid=' . $FTV_ITEM['PID'] . '&amp;ged=' . $tree_name, 'menu-fancy_treeview-' . $FTV_ITEM['PID']);
                         } else {
                             $submenu = new Menu(I18N::translate('Descendants of the %s family', $FTV_ITEM['SURNAME']), 'module.php?mod=' . $this->getName() . '&amp;mod_action=page&amp;rootid=' . $FTV_ITEM['PID'] . '&amp;ged=' . $tree_name, 'menu-fancy_treeview-' . $FTV_ITEM['PID']);
                         }
                         $menu->addSubmenu($submenu);
                     }
                 }
                 if (count($menu->getSubmenus()) > 0) {
                     return $menu;
                 }
             }
         }
     }
 }
예제 #17
0
 /**
  * The facts and events for this record.
  *
  * @param string    $filter
  * @param bool      $sort
  * @param int|null  $access_level
  * @param bool      $override     Include private records, to allow us to implement $SHOW_PRIVATE_RELATIONSHIPS and $SHOW_LIVING_NAMES.
  *
  * @return Fact[]
  */
 public function getFacts($filter = null, $sort = false, $access_level = null, $override = false)
 {
     if ($access_level === null) {
         $access_level = Auth::accessLevel($this->tree);
     }
     $facts = array();
     if ($this->canShow($access_level) || $override) {
         foreach ($this->facts as $fact) {
             if (($filter === null || preg_match('/^' . $filter . '$/', $fact->getTag())) && $fact->canShow($access_level)) {
                 $facts[] = $fact;
             }
         }
     }
     if ($sort) {
         Functions::sortFacts($facts);
     }
     return $facts;
 }
예제 #18
0
 /**
  * Prints collapsable fields to add ASSO/RELA, SOUR, OBJE, etc.
  *
  * @param string $tag
  * @param int $level
  * @param string $parent_tag
  */
 public static function printAddLayer($tag, $level = 2, $parent_tag = '')
 {
     global $WT_TREE;
     switch ($tag) {
         case 'SOUR':
             echo '<a href="#" onclick="return expand_layer(\'newsource\');"><i id="newsource_img" class="icon-plus"></i> ', I18N::translate('Add a new source citation'), '</a>';
             echo '<br>';
             echo '<div id="newsource" style="display: none;">';
             echo '<table class="facts_table">';
             // 2 SOUR
             self::addSimpleTag($level . ' SOUR @');
             // 3 PAGE
             self::addSimpleTag($level + 1 . ' PAGE');
             // 3 DATA
             // 4 TEXT
             self::addSimpleTag($level + 2 . ' TEXT');
             if ($WT_TREE->getPreference('FULL_SOURCES')) {
                 // 4 DATE
                 self::addSimpleTag($level + 2 . ' DATE', '', GedcomTag::getLabel('DATA:DATE'));
                 // 3 QUAY
                 self::addSimpleTag($level + 1 . ' QUAY');
             }
             // 3 OBJE
             self::addSimpleTag($level + 1 . ' OBJE');
             // 3 SHARED_NOTE
             self::addSimpleTag($level + 1 . ' SHARED_NOTE');
             echo '</table></div>';
             break;
         case 'ASSO':
         case 'ASSO2':
             //-- Add a new ASSOciate
             if ($tag === 'ASSO') {
                 echo "<a href=\"#\" onclick=\"return expand_layer('newasso');\"><i id=\"newasso_img\" class=\"icon-plus\"></i> ", I18N::translate('Add a new associate'), '</a>';
                 echo '<br>';
                 echo '<div id="newasso" style="display: none;">';
             } else {
                 echo "<a href=\"#\" onclick=\"return expand_layer('newasso2');\"><i id=\"newasso2_img\" class=\"icon-plus\"></i> ", I18N::translate('Add a new associate'), '</a>';
                 echo '<br>';
                 echo '<div id="newasso2" style="display: none;">';
             }
             echo '<table class="facts_table">';
             // 2 ASSO
             self::addSimpleTag($level . ' _ASSO @');
             // 3 RELA
             self::addSimpleTag($level + 1 . ' RELA');
             // 3 NOTE
             self::addSimpleTag($level + 1 . ' NOTE');
             // 3 SHARED_NOTE
             self::addSimpleTag($level + 1 . ' SHARED_NOTE');
             echo '</table></div>';
             break;
         case 'NOTE':
             //-- Retrieve existing note or add new note to fact
             echo "<a href=\"#\" onclick=\"return expand_layer('newnote');\"><i id=\"newnote_img\" class=\"icon-plus\"></i> ", I18N::translate('Add a new note'), '</a>';
             echo '<br>';
             echo '<div id="newnote" style="display: none;">';
             echo '<table class="facts_table">';
             // 2 NOTE
             self::addSimpleTag($level . ' NOTE');
             echo '</table></div>';
             break;
         case 'SHARED_NOTE':
             echo "<a href=\"#\" onclick=\"return expand_layer('newshared_note');\"><i id=\"newshared_note_img\" class=\"icon-plus\"></i> ", I18N::translate('Add a new shared note'), '</a>';
             echo '<br>';
             echo '<div id="newshared_note" style="display: none;">';
             echo '<table class="facts_table">';
             // 2 SHARED NOTE
             self::addSimpleTag($level . ' SHARED_NOTE', $parent_tag);
             echo '</table></div>';
             break;
         case 'OBJE':
             if ($WT_TREE->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($WT_TREE)) {
                 echo "<a href=\"#\" onclick=\"return expand_layer('newobje');\"><i id=\"newobje_img\" class=\"icon-plus\"></i> ", I18N::translate('Add a new media object'), '</a>';
                 echo '<br>';
                 echo '<div id="newobje" style="display: none;">';
                 echo '<table class="facts_table">';
                 self::addSimpleTag($level . ' OBJE');
                 echo '</table></div>';
             }
             break;
         case 'RESN':
             echo "<a href=\"#\" onclick=\"return expand_layer('newresn');\"><i id=\"newresn_img\" class=\"icon-plus\"></i> ", I18N::translate('Add a new restriction'), '</a>';
             echo '<br>';
             echo '<div id="newresn" style="display: none;">';
             echo '<table class="facts_table">';
             // 2 RESN
             self::addSimpleTag($level . ' RESN');
             echo '</table></div>';
             break;
     }
 }
예제 #19
0
// Fetch the facts
$facts = $controller->record->getFacts();
// Sort the facts
usort($facts, function (Fact $x, Fact $y) {
    static $order = array('TITL' => 0, 'ABBR' => 1, 'AUTH' => 2, 'DATA' => 3, 'PUBL' => 4, 'TEXT' => 5, 'NOTE' => 6, 'OBJE' => 7, 'REFN' => 8, 'RIN' => 9, '_UID' => 10, 'CHAN' => 11);
    return (array_key_exists($x->getTag(), $order) ? $order[$x->getTag()] : PHP_INT_MAX) - (array_key_exists($y->getTag(), $order) ? $order[$y->getTag()] : PHP_INT_MAX);
});
// Print the facts
foreach ($facts as $fact) {
    FunctionsPrintFacts::printFact($fact, $controller->record);
}
// new fact link
if ($controller->record->canEdit()) {
    FunctionsPrint::printAddNewFact($controller->record->getXref(), $facts, 'SOUR');
    // new media
    if ($controller->record->getTree()->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($WT_TREE)) {
        echo '<tr><td class="descriptionbox">';
        echo GedcomTag::getLabel('OBJE');
        echo '</td><td class="optionbox">';
        echo '<a href="#" onclick="window.open(\'addmedia.php?action=showmediaform&amp;linktoid=', $controller->record->getXref(), '\', \'_blank\', edit_window_specs); return false;">', I18N::translate('Add a new media object'), '</a>';
        echo FunctionsPrint::helpLink('OBJE');
        echo '<br>';
        echo '<a href="#" onclick="window.open(\'inverselink.php?linktoid=', $controller->record->getXref(), '&amp;linkto=source\', \'_blank\', find_window_specs); return false;">', I18N::translate('Link to an existing media object'), '</a>';
        echo '</td></tr>';
    }
}
echo '</table>
	</div>';
// Individuals linked to this source
if ($linked_indi) {
    echo '<div id="indi-sources">', FunctionsPrintLists::individualTable($linked_indi), '</div>';
예제 #20
0
 private function show()
 {
     global $controller, $WT_TREE;
     $items_header_description = '<img src="data/magaziny/Global-Network-icon-128.png" align="left" height="96" id="obrazek-odkazy"><p><br />Zde je nashromážděna sbírka odkazů, které mohou být užitečné nebo zajímavé jak pro členy Naší rodiny, tak pro jiné badatele v rodinné historii. Mnohé z nich používáme pravidelně. Jejich obsahová úroveň je proměnlivá, jak se dá očekávat u tak rozsáhlého výběru, a za jejich obsah neručíme.</p><p>Odkazy čas od času testujeme - ale odkazy měnívají adresu nebo mizí. Pokud narazíte na neplatný odkaz, dejte nám vědět na adresu technické podpory na stránce vespod.</p>';
     //Add your own header here.
     $items_id = webtrees\Filter::get('pages_id');
     $controller = new webtrees\Controller\PageController();
     $controller->setPageTitle(webtrees\I18N::translate('Odkazy do okolního světa'))->pageHeader();
     // HTML common to all pages
     $html = '<div id="pages-container">' . '<h2>' . $controller->getPageTitle() . '</h2>' . $items_header_description . '<div style="clear:both;"></div>' . '<div id="pages_tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">' . '<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">';
     $items_list = $this->getPagesList();
     foreach ($items_list as $items) {
         $languages = $this->getBlockSetting($items->block_id, 'languages');
         if ((!$languages || in_array(WT_LOCALE, explode(',', $languages))) && $items->pages_access >= webtrees\Auth::accessLevel($WT_TREE)) {
             $html .= '<li class="ui-state-default ui-corner-top' . ($items_id == $items->block_id ? ' ui-tabs-selected ui-state-active' : '') . '">' . '<a href="module.php?mod=' . $this->getName() . '&amp;mod_action=show&amp;pages_id=' . $items->block_id . '">' . '<span title="' . str_replace("{@PERC@}", "%", webtrees\I18N::translate(str_replace("%", "{@PERC@}", $items->pages_title))) . '">' . str_replace("{@PERC@}", "%", webtrees\I18N::translate(str_replace("%", "{@PERC@}", $items->pages_title))) . '</span></a></li>';
         }
     }
     $html .= '</ul>';
     $html .= '<div id="outer_pages_container" style="padding: 1em;">';
     foreach ($items_list as $items) {
         $languages = $this->getBlockSetting($items->block_id, 'languages');
         if ((!$languages || in_array(WT_LOCALE, explode(',', $languages))) && $items_id == $items->block_id && $items->pages_access >= webtrees\Auth::accessLevel($WT_TREE)) {
             $items_content = str_replace("{@PERC@}", "%", webtrees\I18N::translate(str_replace("%", "{@PERC@}", $items->pages_content)));
         }
     }
     if (isset($items_content)) {
         $html .= $items_content;
     } else {
         $html .= webtrees\I18N::translate('No content found for current access level and language');
     }
     $html .= '</div>';
     //close outer_pages_container
     $html .= '</div>';
     //close pages_tabs
     $html .= '</div>';
     //close pages-container
     $html .= '<script>document.onreadystatechange = function () {if (document.readyState == "complete") {$(".pages-accordion").accordion({heightStyle: "content", collapsible: true});}}</script>';
     echo $html;
 }
예제 #21
0
    /** {@inheritdoc} */
    public function getTabContent()
    {
        global $WT_TREE, $controller;
        ob_start();
        echo '<table class="facts_table">';
        foreach ($this->getFactsWithMedia() as $fact) {
            if ($fact->getTag() == 'OBJE') {
                FunctionsPrintFacts::printMainMedia($fact, 1);
            } else {
                for ($i = 2; $i < 4; ++$i) {
                    FunctionsPrintFacts::printMainMedia($fact, $i);
                }
            }
        }
        if (!$this->getFactsWithMedia()) {
            echo '<tr><td id="no_tab4" colspan="2" class="facts_value">', I18N::translate('There are no media objects for this individual.'), '</td></tr>';
        }
        // New media link
        if ($controller->record->canEdit() && $WT_TREE->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($controller->record->getTree())) {
            ?>
			<tr>
				<td class="facts_label">
					<?php 
            echo GedcomTag::getLabel('OBJE');
            ?>
				</td>
				<td class="facts_value">
					<a href="#" onclick="window.open('addmedia.php?action=showmediaform&amp;linktoid=<?php 
            echo $controller->record->getXref();
            ?>
&amp;ged=<?php 
            echo $controller->record->getTree()->getNameUrl();
            ?>
', '_blank', edit_window_specs); return false;">
						<?php 
            echo I18N::translate('Add a new media object');
            ?>
					</a>
					<?php 
            echo FunctionsPrint::helpLink('OBJE');
            ?>
					<br>
					<a href="#" onclick="window.open('inverselink.php?linktoid=<?php 
            echo $controller->record->getXref();
            ?>
&amp;ged=<?php 
            echo $WT_TREE->getNameUrl();
            ?>
&amp;linkto=person', '_blank', find_window_specs); return false;">
						<?php 
            echo I18N::translate('Link to an existing media object');
            ?>
					</a>
				</td>
			</tr>
		<?php 
        }
        ?>
		</table>
		<?php 
        return '<div id="' . $this->getName() . '_content">' . ob_get_clean() . '</div>';
    }
예제 #22
0
    private function pageBody(PageController $controller)
    {
        ?>
		<!-- FANCY TREEVIEW PAGE -->
		<div id="fancy_treeview-page">
			<div id="page-header">
				<h2><?php 
        echo $controller->getPageTitle();
        ?>
</h2>
				<?php 
        if ($this->pdf()) {
            echo $this->pdf()->getPdfIcon();
        }
        ?>
			</div>
			<div id="page-body">
				<?php 
        if ($this->pdf()) {
            echo $this->pdf()->getPdfWaitingMessage();
        }
        ?>
				<?php 
        if ($this->options('show_userform') >= Auth::accessLevel($this->tree())) {
            ?>
					
					<form id="change_root">
						<label class="label"><?php 
            echo I18N::translate('Change root person');
            ?>
</label>
						<input
							data-autocomplete-type="INDI"
							id="new_rootid"
							name="new_rootid"
							placeholder="<?php 
            echo I18N::translate('Search ID by name');
            ?>
"
							type="text"
							>
						<input
							id="btn_go"
							class="btn btn-primary btn-sm"
							name="btn_go"
							type="submit"
							value="<?php 
            echo I18N::translate('Go');
            ?>
"
							>
					</form>
					<div id="error"></div>
				<?php 
        }
        ?>
				<ol id="fancy_treeview"><?php 
        echo $this->printPage($this->options('numblocks'));
        ?>
</ol>
				<div id="btn_next">
					<input
						class="btn btn-primary"
						type="button"
						name="next"
						value="<?php 
        echo I18N::translate('next');
        ?>
"
						>
				</div>
			</div>
		</div>
		<?php 
    }
예제 #23
0
 /**
  * Extract names from the GEDCOM record.
  */
 public function extractNames()
 {
     $this->extractNamesFromFacts(1, 'NAME', $this->getFacts('NAME', false, Auth::accessLevel($this->tree), $this->canShowName()));
 }
예제 #24
0
    private function pageBody(PageController $controller)
    {
        ?>
		<!-- FANCY TREEVIEW PAGE -->
		<div id="fancy_treeview-page">
			<div id="page-header">
				<h2><?php 
        echo $controller->getPageTitle();
        ?>
</h2>
				<?php 
        if ($this->options('show_pdf_icon') >= Auth::accessLevel($this->tree)) {
            ?>
					<div id="dialog-confirm" title="<?php 
            echo I18N::translate('Generate PDF');
            ?>
" style="display:none">
						<p><?php 
            echo I18N::translate('The pdf contains only visible generation blocks.');
            ?>
</p>
					</div>
					<a id="pdf" href="#"><i class="icon-mime-application-pdf"></i></a>
				<?php 
        }
        ?>
			</div>
			<div id="page-body">
				<?php 
        if ($this->options('show_userform') >= Auth::accessLevel($this->tree)) {
            ?>
					<form id="change_root">
						<label class="label"><?php 
            echo I18N::translate('Change root person');
            ?>
</label>
						<input
							data-autocomplete-type="INDI"
							id="new_rootid"
							name="new_rootid"
							placeholder="<?php 
            echo I18N::translate('Search ID by name');
            ?>
"
							type="text"
							>
						<input
							id="btn_go"
							class="btn btn-primary btn-sm"
							name="btn_go"
							type="submit"
							value="<?php 
            echo I18N::translate('Go');
            ?>
"
							>
					</form>
					<div id="error"></div>
				<?php 
        }
        ?>
				<ol id="fancy_treeview"><?php 
        echo $this->printPage();
        ?>
</ol>
				<div id="btn_next">
					<input
						class="btn btn-primary"
						type="button"
						name="next"
						value="<?php 
        echo I18N::translate('next');
        ?>
"
						>
				</div>
			</div>
		</div>
		<?php 
    }
예제 #25
0
    /**
     * Determine which javascript file we need
     * 
     * @param type $controller
     * @param type $page
     * 
     * @return inline and/or external Javascript
     */
    protected function includeJs($controller, $page)
    {
        switch ($page) {
            case 'admin':
                $controller->addInlineJavascript('
				var ModuleDir			= "' . $this->directory . '";
				var ModuleName			= "' . $this->getName() . '";
				var ThemeID				= "' . Theme::theme()->themeId() . '";
			', BaseController::JS_PRIORITY_HIGH);
                $controller->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();')->addExternalJavascript($this->directory . '/js/admin.js');
                break;
            case 'menu':
                $controller->addInlineJavascript('
				var ModuleDir			= "' . $this->directory . '";
				var ModuleName			= "' . $this->getName() . '";
				var ThemeID				= "' . Theme::theme()->themeId() . '";
			', BaseController::JS_PRIORITY_HIGH);
                $controller->addInlineJavascript('jQuery(".fancy-treeview-script").remove();', BaseController::JS_PRIORITY_LOW);
                break;
            case 'page':
                $controller->addInlineJavascript('
				var PageTitle			= "' . urlencode(strip_tags($controller->getPageTitle())) . '";
				var RootID				= "' . $this->rootId() . '";
				var OptionsNumBlocks	= ' . $this->options('numblocks') . ';
				var TextFollow			= "' . I18N::translate('follow') . '";
				var TextOk				= "' . I18N::translate('ok') . '";
				var TextCancel			= "' . I18N::translate('cancel') . '";
			', BaseController::JS_PRIORITY_HIGH)->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();')->addExternalJavascript($this->directory . '/js/page.js');
                if ($this->options('show_pdf_icon') >= Auth::accessLevel($this->tree)) {
                    $controller->addExternalJavascript($this->directory . '/js/pdf.js');
                }
                // some files needs an extra js script
                if ($this->theme()) {
                    $js = $this->theme() . '/' . basename($this->theme()) . '.js';
                    if (file_exists($js)) {
                        $controller->addExternalJavascript($js);
                    }
                }
                if ($this->options('show_userform') >= Auth::accessLevel($this->tree)) {
                    $this->includeJsInline($controller);
                }
                break;
            case 'tab':
                $controller->addInlineJavascript('
					jQuery("a[href$=' . $this->getName() . ']").text("' . $this->getTabTitle() . '");
				');
                break;
        }
    }
예제 #26
0
 /**
  * XML </ Relatives>
  */
 private function relativesEndHandler()
 {
     global $report, $WT_TREE;
     $this->process_repeats--;
     if ($this->process_repeats > 0) {
         return;
     }
     // Check if there is any relatives
     if (count($this->list) > 0) {
         $lineoffset = 0;
         foreach ($this->repeats_stack as $rep) {
             $lineoffset += $rep[1];
         }
         //-- read the xml from the file
         $lines = file($report);
         while (strpos($lines[$lineoffset + $this->repeat_bytes], "<Relatives") === false && $lineoffset + $this->repeat_bytes > 0) {
             $lineoffset--;
         }
         $lineoffset++;
         $reportxml = "<tempdoc>\n";
         $line_nr = $lineoffset + $this->repeat_bytes;
         // Relatives Level counter
         $count = 1;
         while (0 < $count) {
             if (strpos($lines[$line_nr], "<Relatives") !== false) {
                 $count++;
             } elseif (strpos($lines[$line_nr], "</Relatives") !== false) {
                 $count--;
             }
             if (0 < $count) {
                 $reportxml .= $lines[$line_nr];
             }
             $line_nr++;
         }
         // No need to drag this
         unset($lines);
         $reportxml .= "</tempdoc>\n";
         // Save original values
         array_push($this->parser_stack, $this->parser);
         $oldgedrec = $this->gedrec;
         $this->list_total = count($this->list);
         $this->list_private = 0;
         foreach ($this->list as $key => $value) {
             if (isset($value->generation)) {
                 $this->generation = $value->generation;
             }
             $tmp = GedcomRecord::getInstance($key, $WT_TREE);
             $this->gedrec = $tmp->privatizeGedcom(Auth::accessLevel($WT_TREE));
             $repeat_parser = xml_parser_create();
             $this->parser = $repeat_parser;
             xml_parser_set_option($repeat_parser, XML_OPTION_CASE_FOLDING, false);
             xml_set_element_handler($repeat_parser, array($this, 'startElement'), array($this, 'endElement'));
             xml_set_character_data_handler($repeat_parser, array($this, 'characterData'));
             if (!xml_parse($repeat_parser, $reportxml, true)) {
                 throw new \DomainException(sprintf("RelativesEHandler XML error: %s at line %d", xml_error_string(xml_get_error_code($repeat_parser)), xml_get_current_line_number($repeat_parser)));
             }
             xml_parser_free($repeat_parser);
         }
         // Clean up the list array
         $this->list = array();
         $this->parser = array_pop($this->parser_stack);
         $this->gedrec = $oldgedrec;
     }
     list($this->repeats, $this->repeat_bytes) = array_pop($this->repeats_stack);
 }
예제 #27
0
파일: Media.php 프로젝트: jflash/webtrees
 /**
  * Generate an etag specific to this media item and the current user
  *
  * @param string $which - specify either 'main' or 'thumb'
  *
  * @return string
  */
 public function getEtag($which = 'main')
 {
     if ($this->isExternal()) {
         // etag not really defined for external media
         return '';
     }
     $etag_string = basename($this->getServerFilename($which)) . $this->getFiletime($which) . $this->tree->getName() . Auth::accessLevel($this->tree) . $this->tree->getPreference('SHOW_NO_WATERMARK');
     $etag_string = dechex(crc32($etag_string));
     return $etag_string;
 }
예제 #28
0
    /**
     * Print a family group.
     *
     * @param Family $family
     * @param string $type
     * @param string $label
     */
    private function printFamily(Family $family, $type, $label)
    {
        global $controller;
        if ($family->getTree()->getPreference('SHOW_PRIVATE_RELATIONSHIPS')) {
            $access_level = Auth::PRIV_HIDE;
        } else {
            $access_level = Auth::accessLevel($family->getTree());
        }
        ?>
		<table>
			<tr>
				<td>
					<i class="icon-cfamily"></i>
				</td>
				<td>
					<span class="subheaders"> <?php 
        echo $label;
        ?>
</span>
					<a class="noprint" href="<?php 
        echo $family->getHtmlUrl();
        ?>
"> - <?php 
        echo I18N::translate('View this family');
        ?>
</a>
				</td>
			</tr>
		</table>
		<table class="facts_table">
		<?php 
        ///// HUSB /////
        $found = false;
        foreach ($family->getFacts('HUSB', false, $access_level) as $fact) {
            $found |= !$fact->isPendingDeletion();
            $person = $fact->getTarget();
            if ($person instanceof Individual) {
                if ($fact->isPendingAddition()) {
                    $class = 'facts_label new';
                } elseif ($fact->isPendingDeletion()) {
                    $class = 'facts_label old';
                } else {
                    $class = 'facts_label';
                }
                ?>
					<tr>
					<td class="<?php 
                echo $class;
                ?>
">
						<?php 
                echo Functions::getCloseRelationshipName($controller->record, $person);
                ?>
					</td>
					<td class="<?php 
                echo $controller->getPersonStyle($person);
                ?>
">
						<?php 
                echo Theme::theme()->individualBoxLarge($person);
                ?>
					</td>
					</tr>
				<?php 
            }
        }
        if (!$found && $family->canEdit()) {
            ?>
			<tr>
				<td class="facts_label"></td>
				<td class="facts_value"><a href="#" onclick="return add_spouse_to_family('<?php 
            echo $family->getXref();
            ?>
', 'HUSB');"><?php 
            echo I18N::translate('Add a husband to this family');
            ?>
</a></td>
			</tr>
			<?php 
        }
        ///// WIFE /////
        $found = false;
        foreach ($family->getFacts('WIFE', false, $access_level) as $fact) {
            $person = $fact->getTarget();
            if ($person instanceof Individual) {
                $found |= !$fact->isPendingDeletion();
                if ($fact->isPendingAddition()) {
                    $class = 'facts_label new';
                } elseif ($fact->isPendingDeletion()) {
                    $class = 'facts_label old';
                } else {
                    $class = 'facts_label';
                }
                ?>
				<tr>
					<td class="<?php 
                echo $class;
                ?>
">
						<?php 
                echo Functions::getCloseRelationshipName($controller->record, $person);
                ?>
					</td>
					<td class="<?php 
                echo $controller->getPersonStyle($person);
                ?>
">
						<?php 
                echo Theme::theme()->individualBoxLarge($person);
                ?>
					</td>
				</tr>
				<?php 
            }
        }
        if (!$found && $family->canEdit()) {
            ?>
			<tr>
				<td class="facts_label"></td>
				<td class="facts_value"><a href="#" onclick="return add_spouse_to_family('<?php 
            echo $family->getXref();
            ?>
', 'WIFE');"><?php 
            echo I18N::translate('Add a wife to this family');
            ?>
</a></td>
			</tr>
			<?php 
        }
        ///// MARR /////
        $found = false;
        $prev = new Date('');
        foreach ($family->getFacts(WT_EVENTS_MARR . '|' . WT_EVENTS_DIV, true) as $fact) {
            $found |= !$fact->isPendingDeletion();
            if ($fact->isPendingAddition()) {
                $class = ' new';
            } elseif ($fact->isPendingDeletion()) {
                $class = ' old';
            } else {
                $class = '';
            }
            ?>
			<tr>
				<td class="facts_label">
				</td>
				<td class="facts_value<?php 
            echo $class;
            ?>
">
					<?php 
            echo GedcomTag::getLabelValue($fact->getTag(), $fact->getDate()->display() . ' — ' . $fact->getPlace()->getFullName());
            ?>
				</td>
			</tr>
			<?php 
            if (!$prev->isOK() && $fact->getDate()->isOK()) {
                $prev = $fact->getDate();
            }
        }
        if (!$found && $family->canShow() && $family->canEdit()) {
            // Add a new marriage
            ?>
			<tr>
				<td class="facts_label">
				</td>
				<td class="facts_value">
					<a href="#" onclick="return add_new_record('<?php 
            echo $family->getXref();
            ?>
', 'MARR');">
						<?php 
            echo I18N::translate('Add marriage details');
            ?>
					</a>
				</td>
			</tr>
			<?php 
        }
        ///// CHIL /////
        $child_number = 0;
        foreach ($family->getFacts('CHIL', false, $access_level) as $fact) {
            $person = $fact->getTarget();
            if ($person instanceof Individual) {
                if ($fact->isPendingAddition()) {
                    $child_number++;
                    $class = 'facts_label new';
                } elseif ($fact->isPendingDeletion()) {
                    $class = 'facts_label old';
                } else {
                    $child_number++;
                    $class = 'facts_label';
                }
                $next = new Date('');
                foreach ($person->getFacts(WT_EVENTS_BIRT, true) as $bfact) {
                    if ($bfact->getDate()->isOK()) {
                        $next = $bfact->getDate();
                        break;
                    }
                }
                ?>
				<tr>
					<td class="<?php 
                echo $class;
                ?>
">
						<?php 
                echo self::ageDifference($prev, $next, $child_number);
                ?>
						<?php 
                echo Functions::getCloseRelationshipName($controller->record, $person);
                ?>
					</td>
					<td class="<?php 
                echo $controller->getPersonStyle($person);
                ?>
">
						<?php 
                echo Theme::theme()->individualBoxLarge($person);
                ?>
					</td>
				</tr>
				<?php 
                $prev = $next;
            }
        }
        // Re-order children / add a new child
        if ($family->canEdit()) {
            if ($type == 'FAMS') {
                $add_child_text = I18N::translate('Add a son or daughter');
            } else {
                $add_child_text = I18N::translate('Add a brother or sister');
            }
            ?>
			<tr class="noprint">
				<td class="facts_label">
					<?php 
            if (count($family->getChildren()) > 1) {
                ?>
					<a href="#" onclick="reorder_children('<?php 
                echo $family->getXref();
                ?>
');tabswitch(5);"><i class="icon-media-shuffle"></i> <?php 
                echo I18N::translate('Re-order children');
                ?>
</a>
					<?php 
            }
            ?>
				</td>
				<td class="facts_value">
					<a href="#" onclick="return add_child_to_family('<?php 
            echo $family->getXref();
            ?>
');"><?php 
            echo $add_child_text;
            ?>
</a>
					<span style='white-space:nowrap;'>
						<a href="#" class="icon-sex_m_15x15" onclick="return add_child_to_family('<?php 
            echo $family->getXref();
            ?>
','M');"></a>
						<a href="#" class="icon-sex_f_15x15" onclick="return add_child_to_family('<?php 
            echo $family->getXref();
            ?>
','F');"></a>
					</span>
				</td>
			</tr>
			<?php 
        }
        echo '</table>';
        return;
    }
예제 #29
0
 /**
  * Generate the HTML content of this tab.
  *
  * @return string
  */
 public function getTabContent()
 {
     global $WT_TREE, $controller;
     $html = '<div id="' . $this->getName() . '_content">';
     //Show Lightbox-Album header Links
     if (Auth::isEditor($WT_TREE)) {
         $html .= '<table class="facts_table"><tr><td class="descriptionbox rela">';
         // Add a new media object
         if ($WT_TREE->getPreference('MEDIA_UPLOAD') >= Auth::accessLevel($WT_TREE)) {
             $html .= '<span><a href="#" onclick="window.open(\'addmedia.php?action=showmediaform&linktoid=' . $controller->record->getXref() . '\', \'_blank\', \'resizable=1,scrollbars=1,top=50,height=780,width=600\');return false;">';
             $html .= '<img src="' . Theme::theme()->assetUrl() . 'images/image_add.png" id="head_icon" class="icon" title="' . I18N::translate('Add a new media object') . '" alt="' . I18N::translate('Add a new media object') . '">';
             $html .= I18N::translate('Add a new media object');
             $html .= '</a></span>';
             // Link to an existing item
             $html .= '<span><a href="#" onclick="window.open(\'inverselink.php?linktoid=' . $controller->record->getXref() . '&linkto=person\', \'_blank\', \'resizable=1,scrollbars=1,top=50,height=300,width=450\');">';
             $html .= '<img src="' . Theme::theme()->assetUrl() . 'images/image_link.png" id="head_icon" class="icon" title="' . I18N::translate('Link to an existing media object') . '" alt="' . I18N::translate('Link to an existing media object') . '">';
             $html .= I18N::translate('Link to an existing media object');
             $html .= '</a></span>';
         }
         if (Auth::isManager($WT_TREE) && $this->getMedia()) {
             // Popup Reorder Media
             $html .= '<span><a href="#" onclick="reorder_media(\'' . $controller->record->getXref() . '\')">';
             $html .= '<img src="' . Theme::theme()->assetUrl() . 'images/images.png" id="head_icon" class="icon" title="' . I18N::translate('Re-order media') . '" alt="' . I18N::translate('Re-order media') . '">';
             $html .= I18N::translate('Re-order media');
             $html .= '</a></span>';
         }
         $html .= '</td></tr></table>';
     }
     // Used when sorting media on album tab page
     $html .= '<table class="facts_table"><tr><td class="facts_value">';
     // one-cell table - for presentation only
     $html .= '<ul class="album-list">';
     foreach ($this->getMedia() as $media) {
         //View Edit Menu ----------------------------------
         //Get media item Notes
         $haystack = $media->getGedcom();
         $needle = '1 NOTE';
         $before = substr($haystack, 0, strpos($haystack, $needle));
         $after = substr(strstr($haystack, $needle), strlen($needle));
         $notes = FunctionsPrint::printFactNotes($before . $needle . $after, 1, true);
         // Prepare Below Thumbnail  menu ----------------------------------------------------
         $menu = new Menu('<div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap">' . $media->getFullName() . '</div>');
         $menu->addClass('', 'submenu');
         // View Notes
         if (strpos($media->getGedcom(), "\n1 NOTE")) {
             $submenu = new Menu(I18N::translate('View notes'), '#', '', array('onclick' => 'modalNotes("' . Filter::escapeJs($notes) . '","' . I18N::translate('View notes') . '"); return false;'));
             $submenu->addClass("submenuitem");
             $menu->addSubmenu($submenu);
         }
         //View Details
         $submenu = new Menu(I18N::translate('View details'), $media->getHtmlUrl());
         $submenu->addClass("submenuitem");
         $menu->addSubmenu($submenu);
         //View Sources
         foreach ($media->getFacts('SOUR') as $source_fact) {
             $source = $source_fact->getTarget();
             if ($source && $source->canShow()) {
                 $submenu = new Menu(I18N::translate('Source') . ' – ' . $source->getFullName(), $source->getHtmlUrl());
                 $submenu->addClass('submenuitem');
                 $menu->addSubmenu($submenu);
             }
         }
         if (Auth::isEditor($media->getTree())) {
             // Edit Media
             $submenu = new Menu(I18N::translate('Edit media'), '#', '', array('onclick' => 'return window.open("addmedia.php?action=editmedia&pid=' . $media->getXref() . '", "_blank", edit_window_specs);'));
             $submenu->addClass("submenuitem");
             $menu->addSubmenu($submenu);
             if (Auth::isAdmin()) {
                 if (Module::getModuleByName('GEDFact_assistant')) {
                     $submenu = new Menu(I18N::translate('Manage links'), '#', '', array('onclick' => 'return window.open("inverselink.php?mediaid=' . $media->getXref() . '&linkto=manage", "_blank", find_window_specs);'));
                     $submenu->addClass("submenuitem");
                     $menu->addSubmenu($submenu);
                 } else {
                     $submenu = new Menu(I18N::translate('Link this media object to an individual'), '#', 'menu-obje-link-indi', array('onclick' => 'return ilinkitem("' . $media->getXref() . '","person");'));
                     $submenu->addClass('submenuitem');
                     $menu->addSubmenu($submenu);
                     $submenu = new Menu(I18N::translate('Link this media object to a family'), '#', 'menu-obje-link-fam', array('onclick' => 'return ilinkitem("' . $media->getXref() . '","family");'));
                     $submenu->addClass('submenuitem');
                     $menu->addSubmenu($submenu);
                     $submenu = new Menu(I18N::translate('Link this media object to a source'), '#', 'menu-obje-link-sour', array('onclick' => 'return ilinkitem("' . $media->getXref() . '","source");'));
                     $submenu->addClass('submenuitem');
                     $menu->addSubmenu($submenu);
                 }
                 $submenu = new Menu(I18N::translate('Unlink media'), '#', '', array('onclick' => 'return unlink_media("' . I18N::translate('Are you sure you want to remove links to this media object?') . '", "' . $controller->record->getXref() . '", "' . $media->getXref() . '");'));
                 $submenu->addClass("submenuitem");
                 $menu->addSubmenu($submenu);
             }
         }
         $html .= '<li class="album-list-item">';
         $html .= '<div class="album-image">' . $media->displayImage() . '</div>';
         $html .= '<div class="album-title">' . $menu->getMenu() . '</div>';
         $html .= '</li>';
     }
     $html .= '</ul>';
     $html .= '</td></tr></table>';
     return $html;
 }
예제 #30
0
 private function show()
 {
     global $controller, $WT_TREE;
     $items_header_description = '';
     //Add your own header here.
     $items_id = webtrees\Filter::get('pages_id');
     $controller = new webtrees\Controller\PageController();
     $controller->setPageTitle(webtrees\I18N::translate('Resource pages'))->pageHeader();
     // HTML common to all pages
     $html = '<div id="pages-container">' . '<h2>' . $controller->getPageTitle() . '</h2>' . $items_header_description . '<div style="clear:both;"></div>' . '<div id="pages_tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">' . '<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">';
     $items_list = $this->getPagesList();
     foreach ($items_list as $items) {
         $languages = $this->getBlockSetting($items->block_id, 'languages');
         if ((!$languages || in_array(WT_LOCALE, explode(',', $languages))) && $items->pages_access >= webtrees\Auth::accessLevel($WT_TREE)) {
             $html .= '<li class="ui-state-default ui-corner-top' . ($items_id == $items->block_id ? ' ui-tabs-selected ui-state-active' : '') . '">' . '<a href="module.php?mod=' . $this->getName() . '&amp;mod_action=show&amp;pages_id=' . $items->block_id . '">' . '<span title="' . str_replace("{@PERC@}", "%", webtrees\I18N::translate(str_replace("%", "{@PERC@}", $items->pages_title))) . '">' . str_replace("{@PERC@}", "%", webtrees\I18N::translate(str_replace("%", "{@PERC@}", $items->pages_title))) . '</span></a></li>';
         }
     }
     $html .= '</ul>';
     $html .= '<div id="outer_pages_container" style="padding: 1em;">';
     foreach ($items_list as $items) {
         $languages = $this->getBlockSetting($items->block_id, 'languages');
         if ((!$languages || in_array(WT_LOCALE, explode(',', $languages))) && $items_id == $items->block_id && $items->pages_access >= webtrees\Auth::accessLevel($WT_TREE)) {
             $items_content = str_replace("{@PERC@}", "%", webtrees\I18N::translate(str_replace("%", "{@PERC@}", $items->pages_content)));
         }
     }
     if (isset($items_content)) {
         $html .= $items_content;
     } else {
         $html .= webtrees\I18N::translate('No content found for current access level and language');
     }
     $html .= '</div>';
     //close outer_pages_container
     $html .= '</div>';
     //close pages_tabs
     $html .= '</div>';
     //close pages-container
     $html .= '<script>document.onreadystatechange = function () {if (document.readyState == "complete") {$(".pages-accordion").accordion({heightStyle: "content", collapsible: true});}}</script>';
     echo $html;
 }