/** * 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; }
/** * Format a family. * * @param Family $family * @param string $title */ private function drawFamily(Family $family, $title) { global $controller; ?> <tr> <td class="center" colspan="2"> <a class="famnav_title" href="<?php echo $family->getHtmlUrl(); ?> "> <?php echo $title; ?> </a> </td> </tr> <?php foreach ($family->getSpouses() as $spouse) { $menu = new Menu(Functions::getCloseRelationshipName($controller->record, $spouse)); $menu->addClass('', 'submenu flyout'); $menu->addSubmenu(new Menu($this->getParents($spouse))); ?> <tr> <td class="facts_label"> <?php echo $menu->getMenu(); ?> </td> <td class="center <?php echo $controller->getPersonStyle($spouse); ?> nam"> <a class="famnav_link" href="<?php echo $spouse->getHtmlUrl(); ?> "> <?php echo $spouse->getFullName(); ?> </a> <div class="font9"> <?php echo $spouse->getLifeSpan(); ?> </div> </td> </tr> <?php } foreach ($family->getChildren() as $child) { $menu = new Menu(Functions::getCloseRelationshipName($controller->record, $child)); $menu->addClass('', 'submenu flyout'); $menu->addSubmenu(new Menu($this->getFamily($child))); ?> <tr> <td class="facts_label"> <?php echo $menu->getMenu(); ?> </td> <td class="center <?php echo $controller->getPersonStyle($child); ?> nam"> <a class="famnav_link" href="<?php echo $child->getHtmlUrl(); ?> "> <?php echo $child->getFullName(); ?> </a> <div class="font9"> <?php echo $child->getLifeSpan(); ?> </div> </td> </tr> <?php } }
/** * Create a family on the census navigator. * * @param CensusInterface $census * @param Family $family * @param Individual $head * * @return string */ public static function censusNavigatorFamily(CensusInterface $census, Family $family, Individual $head) { $headImg2 = '<i class="icon-button_head" title="' . I18N::translate('Head of household') . '"></i>'; foreach ($family->getSpouses() as $spouse) { $menu = new Menu(Functions::getCloseRelationshipName($head, $spouse)); foreach ($spouse->getChildFamilies() as $grandparents) { foreach ($grandparents->getSpouses() as $grandparent) { $submenu = new Menu(Functions::getCloseRelationshipName($head, $grandparent) . ' - ' . $grandparent->getFullName(), '#', '', array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $grandparent, $head)) . '");')); $submenu->addClass('submenuitem', ''); $menu->addSubmenu($submenu); $menu->addClass('', 'submenu'); } } ?> <tr> <td class="optionbox"> <?php echo $menu->getMenu(); ?> </td> <td class="facts_value nowrap"> <a href="#" onclick="return appendCensusRow('<?php echo Filter::escapeJs(self::censusTableRow($census, $spouse, $head)); ?> ');"> <?php echo $spouse->getFullName(); ?> </a> </td> <td class="facts_value"> <?php if ($head !== $spouse) { ?> <a href="edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=<?php echo $spouse->getXref(); ?> &gedcom=<?php echo $spouse->getTree()->getNameUrl(); ?> &census=<?php echo get_class($census); ?> "> <?php echo $headImg2; ?> </a> <?php } ?> </td> </tr> <?php } foreach ($family->getChildren() as $child) { $menu = new Menu(Functions::getCloseRelationshipName($head, $child)); foreach ($child->getSpouseFamilies() as $spouse_family) { foreach ($spouse_family->getSpouses() as $spouse_family_spouse) { if ($spouse_family_spouse != $child) { $submenu = new Menu(Functions::getCloseRelationshipName($head, $spouse_family_spouse) . ' - ' . $spouse_family_spouse->getFullName(), '#', '', array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $spouse_family_spouse, $head)) . '");')); $submenu->addClass('submenuitem', ''); $menu->addSubmenu($submenu); $menu->addClass('', 'submenu'); } } foreach ($spouse_family->getChildren() as $spouse_family_child) { $submenu = new Menu(Functions::getCloseRelationshipName($head, $spouse_family_child) . ' - ' . $spouse_family_child->getFullName(), '#', '', array('onclick' => 'return appendCensusRow("' . Filter::escapeJs(self::censusTableRow($census, $spouse_family_child, $head)) . '");')); $submenu->addClass('submenuitem', ''); $menu->addSubmenu($submenu); $menu->addClass('', 'submenu'); } } ?> <tr> <td class="optionbox"> <?php echo $menu->getMenu(); ?> </td> <td class="facts_value"> <a href="#" onclick="return appendCensusRow('<?php echo Filter::escapeJs(self::censusTableRow($census, $child, $head)); ?> ');"> <?php echo $child->getFullName(); ?> </a> </td> <td class="facts_value"> <?php if ($head !== $child) { ?> <a href="edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=<?php echo $child->getXref(); ?> &gedcom=<?php echo $child->getTree()->getNameUrl(); ?> &census=<?php echo get_class($census); ?> "> <?php echo $headImg2; ?> </a> <?php } ?> </td> </tr> <?php } echo '<tr><td><br></td></tr>'; }
$fulmn = $fulln; foreach ($nam as $n) { if ($n['type'] === '_MARNM') { $fulmn = strip_tags($n['full']); } } $label = Functions::getCloseRelationshipName($person, $child); $menu = new Menu($label); print_pedigree_person_nav_cens($child->getXref(), $label, $censyear); $submenu = new Menu($spouselinks); $menu->addSubmenu($submenu); ?> <tr> <td align="left" class="linkcell optionbox"> <?php echo $menu->getMenu(); ?> </td> <td align="left" class="facts_value"> <?php echo "<a href=\"edit_interface.php?action=addnewnote_assisted&noteid=newnote&xref=" . $child->getXref() . "&gedcom=" . $child->getTree()->getNameUrl() . "\">"; echo $headImg2; echo "</a>"; ?> </td> <td align="left" class="facts_value nowrap"> <?php if ($child->canShow()) { ?> <a href='#' onclick='return insertRowToTable( "<?php