示例#1
0
 /**
  * {@inhericDoc}
  * @see \MyArtJaub\Webtrees\Module\ModuleMenuItemInterface::getMenu()
  */
 public function getMenu(Tree $tree, $reference = null)
 {
     $tree_url = $tree ? $tree->getNameUrl() : '';
     return new Menu($this->getTitle(), 'module.php?mod=' . $this->getName() . '&mod_action=Certificate@listAll&ged=' . $tree_url, 'menu-maj-list-certificate', array('rel' => 'nofollow'));
 }
示例#2
0
 /**
  * Initialise the theme. We cannot pass these in a constructor, as the construction
  * happens in a theme file, and we need to be able to change it.
  *
  * @param Tree|null $tree The current tree (if there is one).
  */
 public final function init(Tree $tree = null)
 {
     $this->tree = $tree;
     $this->tree_url = $tree ? 'ged=' . $tree->getNameUrl() : '';
     $this->hookAfterInit();
 }
 /** 
  * {@inhericDoc}
  * @see \MyArtJaub\Webtrees\Module\ModuleMenuItemInterface::getMenu()
  */
 public function getMenu(fw\Tree $tree, $reference)
 {
     $tree_url = $tree ? $tree->getNameUrl() : '';
     $surname = $reference && is_string($reference) ? $reference : '';
     return new fw\Menu($this->getTitle(), 'module.php?mod=' . $this->getName() . '&mod_action=Lineage&ged=' . $tree_url . '&surname=' . $surname, 'menu-maj-list-lineage', array('rel' => 'nofollow'));
 }
 /**
  * Print a list of surnames.
  *
  * @param string[][] $surnames array (of SURN, of array of SPFX_SURN, of array of PID)
  * @param int $style 1=bullet list, 2=semicolon-separated list, 3=tabulated list with up to 4 columns
  * @param bool $totals show totals after each name
  * @param string $script indilist or famlist
  * @param Tree $tree Link back to the individual list in this tree
  *
  * @return string
  */
 public static function surnameList($surnames, $style, $totals, $script, Tree $tree)
 {
     $html = array();
     foreach ($surnames as $surn => $surns) {
         // Each surname links back to the indilist
         if ($surn) {
             $url = $script . '?surname=' . urlencode($surn) . '&ged=' . $tree->getNameUrl();
         } else {
             $url = $script . '?alpha=,&ged=' . $tree->getNameUrl();
         }
         // If all the surnames are just case variants, then merge them into one
         // Comment out this block if you want SMITH listed separately from Smith
         $first_spfxsurn = null;
         foreach ($surns as $spfxsurn => $indis) {
             if ($first_spfxsurn) {
                 if (I18N::strtoupper($spfxsurn) == I18N::strtoupper($first_spfxsurn)) {
                     $surns[$first_spfxsurn] = array_merge($surns[$first_spfxsurn], $surns[$spfxsurn]);
                     unset($surns[$spfxsurn]);
                 }
             } else {
                 $first_spfxsurn = $spfxsurn;
             }
         }
         $subhtml = '<a href="' . $url . '" dir="auto">' . Filter::escapeHtml(implode(I18N::$list_separator, array_keys($surns))) . '</a>';
         if ($totals) {
             $subtotal = 0;
             foreach ($surns as $indis) {
                 $subtotal += count($indis);
             }
             $subhtml .= '&nbsp;(' . I18N::number($subtotal) . ')';
         }
         $html[] = $subhtml;
     }
     switch ($style) {
         case 1:
             return '<ul><li>' . implode('</li><li>', $html) . '</li></ul>';
         case 2:
             return implode(I18N::$list_separator, $html);
         case 3:
             $i = 0;
             $count = count($html);
             if ($count > 36) {
                 $col = 4;
             } elseif ($count > 18) {
                 $col = 3;
             } elseif ($count > 6) {
                 $col = 2;
             } else {
                 $col = 1;
             }
             $newcol = ceil($count / $col);
             $html2 = '<table class="list_table"><tr>';
             $html2 .= '<td class="list_value" style="padding: 14px;">';
             foreach ($html as $surns) {
                 $html2 .= $surns . '<br>';
                 $i++;
                 if ($i == $newcol && $i < $count) {
                     $html2 .= '</td><td class="list_value" style="padding: 14px;">';
                     $newcol = $i + ceil($count / $col);
                 }
             }
             $html2 .= '</td></tr></table>';
             return $html2;
     }
 }
示例#5
0
 /**
  * Get the URL for the GeoAnalysis.
  *
  * @return string
  */
 public function getHtmlUrl()
 {
     return 'module.php?mod=' . Constants::MODULE_MAJ_GEODISP_NAME . '&mod_action=GeoAnalysis&ga_id=' . $this->getId() . '&ged=' . $this->tree->getNameUrl();
 }