@@ -21,7 +21,7 @@ |
||
| 21 | 21 | * @param \Fisharebest\Webtrees\Module\AbstractModule $module |
| 22 | 22 | * @param string $request |
| 23 | 23 | */ |
| 24 | - public function handle(\Fisharebest\Webtrees\Module\AbstractModule $module, $request); |
|
| 24 | + public function handle(\Fisharebest\Webtrees\Module\AbstractModule $module, $request); |
|
| 25 | 25 | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | \ No newline at end of file |
@@ -17,87 +17,87 @@ |
||
| 17 | 17 | */ |
| 18 | 18 | class ViewFactory { |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @var ViewFactory $instance Singleton pattern instance |
|
| 22 | - */ |
|
| 23 | - private static $instance = null; |
|
| 20 | + /** |
|
| 21 | + * @var ViewFactory $instance Singleton pattern instance |
|
| 22 | + */ |
|
| 23 | + private static $instance = null; |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Returns the *ViewFactory* instance of this class. |
|
| 27 | - * |
|
| 28 | - * @return ViewFactory The *Singleton* instance. |
|
| 29 | - */ |
|
| 30 | - public static function getInstance() |
|
| 31 | - { |
|
| 32 | - if (null === static::$instance) { |
|
| 33 | - static::$instance = new static(); |
|
| 34 | - } |
|
| 25 | + /** |
|
| 26 | + * Returns the *ViewFactory* instance of this class. |
|
| 27 | + * |
|
| 28 | + * @return ViewFactory The *Singleton* instance. |
|
| 29 | + */ |
|
| 30 | + public static function getInstance() |
|
| 31 | + { |
|
| 32 | + if (null === static::$instance) { |
|
| 33 | + static::$instance = new static(); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - return static::$instance; |
|
| 37 | - } |
|
| 36 | + return static::$instance; |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Protected constructor |
|
| 41 | - */ |
|
| 42 | - protected function __construct() {} |
|
| 39 | + /** |
|
| 40 | + * Protected constructor |
|
| 41 | + */ |
|
| 42 | + protected function __construct() {} |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Return the view specified by the controller and view name, using data from the ViewBag |
|
| 46 | - * |
|
| 47 | - * @param string $view_name |
|
| 48 | - * @param \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface $mvc_ctrl |
|
| 49 | - * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl |
|
| 50 | - * @param \MyArtJaub\Webtrees\Mvc\View\ViewBag $data |
|
| 51 | - * @return \MyArtJaub\Webtrees\Mvc\View\AbstractView View |
|
| 52 | - * @throws \Exception |
|
| 53 | - */ |
|
| 54 | - public function makeView($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) |
|
| 55 | - { |
|
| 56 | - if(!$mvc_ctrl) throw new \Exception('Mvc Controller not defined'); |
|
| 57 | - if(!$ctrl) throw new \Exception('Base Controller not defined'); |
|
| 58 | - if(!$view_name) throw new \Exception('View not defined'); |
|
| 44 | + /** |
|
| 45 | + * Return the view specified by the controller and view name, using data from the ViewBag |
|
| 46 | + * |
|
| 47 | + * @param string $view_name |
|
| 48 | + * @param \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface $mvc_ctrl |
|
| 49 | + * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl |
|
| 50 | + * @param \MyArtJaub\Webtrees\Mvc\View\ViewBag $data |
|
| 51 | + * @return \MyArtJaub\Webtrees\Mvc\View\AbstractView View |
|
| 52 | + * @throws \Exception |
|
| 53 | + */ |
|
| 54 | + public function makeView($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) |
|
| 55 | + { |
|
| 56 | + if(!$mvc_ctrl) throw new \Exception('Mvc Controller not defined'); |
|
| 57 | + if(!$ctrl) throw new \Exception('Base Controller not defined'); |
|
| 58 | + if(!$view_name) throw new \Exception('View not defined'); |
|
| 59 | 59 | |
| 60 | - $mvc_ctrl_refl = new \ReflectionObject($mvc_ctrl); |
|
| 61 | - $view_class = $mvc_ctrl_refl->getNamespaceName() . '\\Views\\' . $view_name . 'View'; |
|
| 62 | - if(!class_exists($view_class)) throw new \Exception('View does not exist'); |
|
| 60 | + $mvc_ctrl_refl = new \ReflectionObject($mvc_ctrl); |
|
| 61 | + $view_class = $mvc_ctrl_refl->getNamespaceName() . '\\Views\\' . $view_name . 'View'; |
|
| 62 | + if(!class_exists($view_class)) throw new \Exception('View does not exist'); |
|
| 63 | 63 | |
| 64 | - return new $view_class($ctrl, $data); |
|
| 65 | - } |
|
| 64 | + return new $view_class($ctrl, $data); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * Static invocation of the makeView method |
|
| 69 | - * |
|
| 70 | - * @param string $view_name |
|
| 71 | - * @param \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface $mvc_ctrl |
|
| 72 | - * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl |
|
| 73 | - * @param \MyArtJaub\Webtrees\Mvc\View\ViewBag $data |
|
| 74 | - * @return \MyArtJaub\Webtrees\Mvc\View\AbstractView View |
|
| 75 | - * @see \MyArtJaub\Webtrees\Mvc\View\ViewFactory::handle() |
|
| 76 | - */ |
|
| 77 | - public static function make($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) |
|
| 78 | - { |
|
| 79 | - return self::getInstance()->makeView($view_name, $mvc_ctrl, $ctrl, $data); |
|
| 80 | - } |
|
| 67 | + /** |
|
| 68 | + * Static invocation of the makeView method |
|
| 69 | + * |
|
| 70 | + * @param string $view_name |
|
| 71 | + * @param \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface $mvc_ctrl |
|
| 72 | + * @param \Fisharebest\Webtrees\Controller\BaseController $ctrl |
|
| 73 | + * @param \MyArtJaub\Webtrees\Mvc\View\ViewBag $data |
|
| 74 | + * @return \MyArtJaub\Webtrees\Mvc\View\AbstractView View |
|
| 75 | + * @see \MyArtJaub\Webtrees\Mvc\View\ViewFactory::handle() |
|
| 76 | + */ |
|
| 77 | + public static function make($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) |
|
| 78 | + { |
|
| 79 | + return self::getInstance()->makeView($view_name, $mvc_ctrl, $ctrl, $data); |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * Private clone method to prevent cloning of the instance of the |
|
| 84 | - * *Dispatcher* instance. |
|
| 85 | - * |
|
| 86 | - * @return void |
|
| 87 | - */ |
|
| 88 | - private function __clone() |
|
| 89 | - { |
|
| 90 | - } |
|
| 82 | + /** |
|
| 83 | + * Private clone method to prevent cloning of the instance of the |
|
| 84 | + * *Dispatcher* instance. |
|
| 85 | + * |
|
| 86 | + * @return void |
|
| 87 | + */ |
|
| 88 | + private function __clone() |
|
| 89 | + { |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * Private unserialize method to prevent unserializing of the *Dispatcher* |
|
| 94 | - * instance. |
|
| 95 | - * |
|
| 96 | - * @return void |
|
| 97 | - */ |
|
| 98 | - private function __wakeup() |
|
| 99 | - { |
|
| 100 | - } |
|
| 92 | + /** |
|
| 93 | + * Private unserialize method to prevent unserializing of the *Dispatcher* |
|
| 94 | + * instance. |
|
| 95 | + * |
|
| 96 | + * @return void |
|
| 97 | + */ |
|
| 98 | + private function __wakeup() |
|
| 99 | + { |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | \ No newline at end of file |
@@ -15,13 +15,13 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | interface HookSubscriberInterface { |
| 17 | 17 | |
| 18 | - /** |
|
| 18 | + /** |
|
| 19 | 19 | * Return the list of functions implementented in the class which needs to be registered as hooks. |
| 20 | 20 | * The format is either { function1, function 2,...} in which case the priority is the default one |
| 21 | 21 | * or { function1 => priority1, function2 => priority2, ...} |
| 22 | 22 | * |
| 23 | 23 | * @return array Array of hooks |
| 24 | 24 | */ |
| 25 | - public function getSubscribedHooks(); |
|
| 25 | + public function getSubscribedHooks(); |
|
| 26 | 26 | |
| 27 | 27 | } |
| 28 | 28 | \ No newline at end of file |
@@ -31,161 +31,161 @@ discard block |
||
| 31 | 31 | * {@inhericDoc} |
| 32 | 32 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
| 33 | 33 | */ |
| 34 | - protected function renderContent() { |
|
| 34 | + protected function renderContent() { |
|
| 35 | 35 | |
| 36 | - /** @var \Fisharebest\Webtrees\Tree $tree */ |
|
| 37 | - $tree = $this->data->get('tree'); |
|
| 36 | + /** @var \Fisharebest\Webtrees\Tree $tree */ |
|
| 37 | + $tree = $this->data->get('tree'); |
|
| 38 | 38 | |
| 39 | - echo '<h2 class="center">', $this->data->get('title') , '</h2>'; |
|
| 40 | - echo '<p class="center alpha_index">', implode(' | ', $this->getInitialLettersList()), '</p>'; |
|
| 39 | + echo '<h2 class="center">', $this->data->get('title') , '</h2>'; |
|
| 40 | + echo '<p class="center alpha_index">', implode(' | ', $this->getInitialLettersList()), '</p>'; |
|
| 41 | 41 | |
| 42 | - if($this->data->get('issurnames', false)) { |
|
| 43 | - $surns = $this->data->get('surnameslist', array()); |
|
| 44 | - $extra_params = array ('mod' => Constants::MODULE_MAJ_PATROLIN_NAME, 'mod_action' => 'Lineage'); |
|
| 45 | - // Show the surname list |
|
| 46 | - switch ($tree->getPreference('SURNAME_LIST_STYLE')) { |
|
| 47 | - case 'style1': |
|
| 42 | + if($this->data->get('issurnames', false)) { |
|
| 43 | + $surns = $this->data->get('surnameslist', array()); |
|
| 44 | + $extra_params = array ('mod' => Constants::MODULE_MAJ_PATROLIN_NAME, 'mod_action' => 'Lineage'); |
|
| 45 | + // Show the surname list |
|
| 46 | + switch ($tree->getPreference('SURNAME_LIST_STYLE')) { |
|
| 47 | + case 'style1': |
|
| 48 | 48 | echo FunctionsPrintLists::surnameList($surns, 3, true, WT_SCRIPT_NAME, $tree, $extra_params); |
| 49 | 49 | break; |
| 50 | - case 'style3': |
|
| 51 | - echo FunctionsPrintLists::surnameTagCloud($surns, WT_SCRIPT_NAME, true, $tree, $extra_params); |
|
| 52 | - break; |
|
| 53 | - case 'style2': |
|
| 54 | - default: |
|
| 55 | - echo FunctionsPrintLists::surnameTable($surns, WT_SCRIPT_NAME, $tree, $extra_params); |
|
| 56 | - break; |
|
| 57 | - } |
|
| 58 | - } |
|
| 59 | - else if ($this->data->get('islineages', false)) { |
|
| 60 | - //Link to indilist |
|
| 61 | - echo '<p class="center"><strong>'. |
|
| 62 | - '<a href="indilist.php?ged=' . $tree->getNameUrl() . '&surname=' . rawurlencode($this->data->get('surname')) .'">'. |
|
| 63 | - I18N::translate('Go to the list of individuals with surname %s', $this->data->get('legend')). |
|
| 64 | - '</a></strong></p>'; |
|
| 50 | + case 'style3': |
|
| 51 | + echo FunctionsPrintLists::surnameTagCloud($surns, WT_SCRIPT_NAME, true, $tree, $extra_params); |
|
| 52 | + break; |
|
| 53 | + case 'style2': |
|
| 54 | + default: |
|
| 55 | + echo FunctionsPrintLists::surnameTable($surns, WT_SCRIPT_NAME, $tree, $extra_params); |
|
| 56 | + break; |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | + else if ($this->data->get('islineages', false)) { |
|
| 60 | + //Link to indilist |
|
| 61 | + echo '<p class="center"><strong>'. |
|
| 62 | + '<a href="indilist.php?ged=' . $tree->getNameUrl() . '&surname=' . rawurlencode($this->data->get('surname')) .'">'. |
|
| 63 | + I18N::translate('Go to the list of individuals with surname %s', $this->data->get('legend')). |
|
| 64 | + '</a></strong></p>'; |
|
| 65 | 65 | |
| 66 | - $lineages = $this->data->get('lineages', null); |
|
| 67 | - $nb_lineages = count($lineages); |
|
| 68 | - if(is_null($lineages) || $nb_lineages == 0) { |
|
| 69 | - echo '<p class="center"><span class="warning">', |
|
| 70 | - I18N::translate('No individuals with surname %s has been found. Please try another name.', |
|
| 71 | - '<span dir="auto">' . $this->data->get('legend') . '</span>'), |
|
| 72 | - '</span></p>'; |
|
| 73 | - } else { |
|
| 66 | + $lineages = $this->data->get('lineages', null); |
|
| 67 | + $nb_lineages = count($lineages); |
|
| 68 | + if(is_null($lineages) || $nb_lineages == 0) { |
|
| 69 | + echo '<p class="center"><span class="warning">', |
|
| 70 | + I18N::translate('No individuals with surname %s has been found. Please try another name.', |
|
| 71 | + '<span dir="auto">' . $this->data->get('legend') . '</span>'), |
|
| 72 | + '</span></p>'; |
|
| 73 | + } else { |
|
| 74 | 74 | |
| 75 | - echo '<div id="patronymiclineages">'. |
|
| 76 | - '<div class="list_label">', |
|
| 77 | - $this->data->get('table_title'), |
|
| 78 | - '</div>'; |
|
| 75 | + echo '<div id="patronymiclineages">'. |
|
| 76 | + '<div class="list_label">', |
|
| 77 | + $this->data->get('table_title'), |
|
| 78 | + '</div>'; |
|
| 79 | 79 | |
| 80 | - echo '<div class="list_value_wrap">'; |
|
| 80 | + echo '<div class="list_value_wrap">'; |
|
| 81 | 81 | |
| 82 | - foreach($lineages as $i => $lineage) { |
|
| 83 | - $this->printRootLineage($lineage); |
|
| 84 | - if($i < $nb_lineages - 1) echo '<hr />'; |
|
| 85 | - } |
|
| 82 | + foreach($lineages as $i => $lineage) { |
|
| 83 | + $this->printRootLineage($lineage); |
|
| 84 | + if($i < $nb_lineages - 1) echo '<hr />'; |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - echo '</div>'; |
|
| 87 | + echo '</div>'; |
|
| 88 | 88 | |
| 89 | - echo '<div class="list_label">', |
|
| 90 | - I18N::translate('%s lineages found', $nb_lineages), |
|
| 91 | - '</div>'. |
|
| 92 | - '</div>'; |
|
| 89 | + echo '<div class="list_label">', |
|
| 90 | + I18N::translate('%s lineages found', $nb_lineages), |
|
| 91 | + '</div>'. |
|
| 92 | + '</div>'; |
|
| 93 | 93 | |
| 94 | - } |
|
| 95 | - } |
|
| 96 | - } |
|
| 94 | + } |
|
| 95 | + } |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * Get the list of initial letters |
|
| 100 | - * |
|
| 101 | - * @return string[] |
|
| 102 | - */ |
|
| 103 | - private function getInitialLettersList() { |
|
| 104 | - $list = array(); |
|
| 105 | - /** @var \Fisharebest\Webtrees\Tree $tree */ |
|
| 106 | - $tree = $this->data->get('tree'); |
|
| 98 | + /** |
|
| 99 | + * Get the list of initial letters |
|
| 100 | + * |
|
| 101 | + * @return string[] |
|
| 102 | + */ |
|
| 103 | + private function getInitialLettersList() { |
|
| 104 | + $list = array(); |
|
| 105 | + /** @var \Fisharebest\Webtrees\Tree $tree */ |
|
| 106 | + $tree = $this->data->get('tree'); |
|
| 107 | 107 | $script_base_url = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage'; |
| 108 | 108 | |
| 109 | - foreach (QueryName::surnameAlpha($tree, false, false) as $letter => $count) { |
|
| 110 | - switch ($letter) { |
|
| 111 | - case '@': |
|
| 112 | - $html = I18N::translateContext('Unknown surname', '…'); |
|
| 113 | - break; |
|
| 114 | - case ',': |
|
| 115 | - $html = I18N::translate('None'); |
|
| 116 | - break; |
|
| 117 | - default: |
|
| 118 | - $html = Filter::escapeHtml($letter); |
|
| 119 | - break; |
|
| 120 | - } |
|
| 121 | - if ($count) { |
|
| 122 | - if ($letter == $this->data->get('alpha')) { |
|
| 123 | - $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" class="warning" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
| 124 | - } else { |
|
| 125 | - $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
| 126 | - } |
|
| 127 | - } else { |
|
| 128 | - $list[] = $html; |
|
| 129 | - } |
|
| 130 | - } |
|
| 109 | + foreach (QueryName::surnameAlpha($tree, false, false) as $letter => $count) { |
|
| 110 | + switch ($letter) { |
|
| 111 | + case '@': |
|
| 112 | + $html = I18N::translateContext('Unknown surname', '…'); |
|
| 113 | + break; |
|
| 114 | + case ',': |
|
| 115 | + $html = I18N::translate('None'); |
|
| 116 | + break; |
|
| 117 | + default: |
|
| 118 | + $html = Filter::escapeHtml($letter); |
|
| 119 | + break; |
|
| 120 | + } |
|
| 121 | + if ($count) { |
|
| 122 | + if ($letter == $this->data->get('alpha')) { |
|
| 123 | + $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" class="warning" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
| 124 | + } else { |
|
| 125 | + $list[] = '<a href="' . $script_base_url . '&alpha=' . rawurlencode($letter) . '&ged=' . $tree->getNameUrl() . '" title="' . I18N::number($count) . '">' . $html . '</a>'; |
|
| 126 | + } |
|
| 127 | + } else { |
|
| 128 | + $list[] = $html; |
|
| 129 | + } |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | - // Search spiders don't get the "show all" option as the other links give them everything. |
|
| 133 | - if (!Auth::isSearchEngine()) { |
|
| 134 | - if ($this->data->get('show_all') === 'yes') { |
|
| 135 | - $list[] = '<span class="warning">' . I18N::translate('All') . '</span>'; |
|
| 136 | - } else { |
|
| 137 | - $list[] = '<a href="' . $script_base_url . '&show_all=yes' . '&ged=' . $tree->getNameUrl() . '">' . I18N::translate('All') . '</a>'; |
|
| 138 | - } |
|
| 139 | - } |
|
| 132 | + // Search spiders don't get the "show all" option as the other links give them everything. |
|
| 133 | + if (!Auth::isSearchEngine()) { |
|
| 134 | + if ($this->data->get('show_all') === 'yes') { |
|
| 135 | + $list[] = '<span class="warning">' . I18N::translate('All') . '</span>'; |
|
| 136 | + } else { |
|
| 137 | + $list[] = '<a href="' . $script_base_url . '&show_all=yes' . '&ged=' . $tree->getNameUrl() . '">' . I18N::translate('All') . '</a>'; |
|
| 138 | + } |
|
| 139 | + } |
|
| 140 | 140 | |
| 141 | - return $list; |
|
| 142 | - } |
|
| 141 | + return $list; |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | - /** |
|
| 145 | - * Print a root lineage node |
|
| 146 | - * @param LineageRootNode $node |
|
| 147 | - */ |
|
| 148 | - private function printRootLineage(LineageRootNode $node) { |
|
| 149 | - print '<div class="patrolin_tree">'; |
|
| 150 | - if($node->getIndividual() === null) { |
|
| 151 | - $fam_nodes = $node->getFamiliesNodes(); |
|
| 152 | - foreach($fam_nodes as $fam){ |
|
| 153 | - foreach($fam_nodes[$fam] as $child_node) { |
|
| 154 | - if($child_node) { |
|
| 155 | - $this->printLineage($child_node); |
|
| 156 | - } |
|
| 157 | - } |
|
| 158 | - } |
|
| 159 | - } |
|
| 160 | - else { |
|
| 161 | - $this->printLineage($node); |
|
| 162 | - } |
|
| 163 | - echo '</div>'; |
|
| 144 | + /** |
|
| 145 | + * Print a root lineage node |
|
| 146 | + * @param LineageRootNode $node |
|
| 147 | + */ |
|
| 148 | + private function printRootLineage(LineageRootNode $node) { |
|
| 149 | + print '<div class="patrolin_tree">'; |
|
| 150 | + if($node->getIndividual() === null) { |
|
| 151 | + $fam_nodes = $node->getFamiliesNodes(); |
|
| 152 | + foreach($fam_nodes as $fam){ |
|
| 153 | + foreach($fam_nodes[$fam] as $child_node) { |
|
| 154 | + if($child_node) { |
|
| 155 | + $this->printLineage($child_node); |
|
| 156 | + } |
|
| 157 | + } |
|
| 158 | + } |
|
| 159 | + } |
|
| 160 | + else { |
|
| 161 | + $this->printLineage($node); |
|
| 162 | + } |
|
| 163 | + echo '</div>'; |
|
| 164 | 164 | |
| 165 | - $places = $node->getPlaces(); |
|
| 166 | - if($places && count($places)>0){ |
|
| 167 | - echo '<div class="patrolin_places">'; |
|
| 168 | - echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlPlacesCloud($places, false, $this->data->get('tree')); |
|
| 169 | - echo '</div>'; |
|
| 170 | - } |
|
| 171 | - } |
|
| 165 | + $places = $node->getPlaces(); |
|
| 166 | + if($places && count($places)>0){ |
|
| 167 | + echo '<div class="patrolin_places">'; |
|
| 168 | + echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlPlacesCloud($places, false, $this->data->get('tree')); |
|
| 169 | + echo '</div>'; |
|
| 170 | + } |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | - /** |
|
| 174 | - * Print a lineage node, recursively. |
|
| 175 | - * @param LineageNode $node |
|
| 176 | - */ |
|
| 177 | - private function printLineage(LineageNode $node) { |
|
| 173 | + /** |
|
| 174 | + * Print a lineage node, recursively. |
|
| 175 | + * @param LineageNode $node |
|
| 176 | + */ |
|
| 177 | + private function printLineage(LineageNode $node) { |
|
| 178 | 178 | |
| 179 | - echo '<ul>'; |
|
| 180 | - $fam_nodes = $node->getFamiliesNodes(); |
|
| 181 | - if(count($fam_nodes) > 0) { |
|
| 182 | - $is_first_family = true; |
|
| 183 | - foreach($fam_nodes as $fam) { |
|
| 184 | - $node_indi = $node->getIndividual(); |
|
| 185 | - echo '<li>'; |
|
| 186 | - if($is_first_family){ |
|
| 187 | - echo FunctionsPrint::htmlIndividualForList($node_indi); |
|
| 188 | - } |
|
| 179 | + echo '<ul>'; |
|
| 180 | + $fam_nodes = $node->getFamiliesNodes(); |
|
| 181 | + if(count($fam_nodes) > 0) { |
|
| 182 | + $is_first_family = true; |
|
| 183 | + foreach($fam_nodes as $fam) { |
|
| 184 | + $node_indi = $node->getIndividual(); |
|
| 185 | + echo '<li>'; |
|
| 186 | + if($is_first_family){ |
|
| 187 | + echo FunctionsPrint::htmlIndividualForList($node_indi); |
|
| 188 | + } |
|
| 189 | 189 | else{ |
| 190 | 190 | echo FunctionsPrint::htmlIndividualForList($node_indi, false); |
| 191 | 191 | } |
@@ -204,32 +204,32 @@ discard block |
||
| 204 | 204 | echo '<span class="details1" title="'.$marrdate.'"><i class="icon-rings"></i>'.$marryear.'</span></a> '; |
| 205 | 205 | echo FunctionsPrint::htmlIndividualForList($spouse); |
| 206 | 206 | } |
| 207 | - foreach($fam_nodes[$fam] as $child_node) { |
|
| 208 | - if($child_node) { |
|
| 209 | - $this->printLineage($child_node); |
|
| 210 | - } |
|
| 211 | - else { |
|
| 212 | - echo '<ul><li><strong>…</strong></li></ul>'; |
|
| 213 | - } |
|
| 214 | - } |
|
| 215 | - $is_first_family = false; |
|
| 216 | - } |
|
| 217 | - } |
|
| 218 | - else { |
|
| 219 | - echo '<li>'; |
|
| 220 | - echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlIndividualForList($node->getIndividual()); |
|
| 221 | - if($node->hasFollowUpSurname()) { |
|
| 222 | - $url_base = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage'; |
|
| 223 | - echo ' '. |
|
| 224 | - '<a href="' . $url_base . '&surname=' . rawurlencode($node->getFollowUpSurname()) . '&ged=' . $this->data->get('tree')->getNameUrl() . '">'. |
|
| 225 | - '('.I18N::translate('Go to %s lineages', $node->getFollowUpSurname()).')'. |
|
| 226 | - '</a>'; |
|
| 227 | - } |
|
| 228 | - echo '</li>'; |
|
| 229 | - } |
|
| 230 | - echo '</ul>'; |
|
| 207 | + foreach($fam_nodes[$fam] as $child_node) { |
|
| 208 | + if($child_node) { |
|
| 209 | + $this->printLineage($child_node); |
|
| 210 | + } |
|
| 211 | + else { |
|
| 212 | + echo '<ul><li><strong>…</strong></li></ul>'; |
|
| 213 | + } |
|
| 214 | + } |
|
| 215 | + $is_first_family = false; |
|
| 216 | + } |
|
| 217 | + } |
|
| 218 | + else { |
|
| 219 | + echo '<li>'; |
|
| 220 | + echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlIndividualForList($node->getIndividual()); |
|
| 221 | + if($node->hasFollowUpSurname()) { |
|
| 222 | + $url_base = WT_SCRIPT_NAME . '?mod=' . \MyArtJaub\Webtrees\Constants::MODULE_MAJ_PATROLIN_NAME . '&mod_action=Lineage'; |
|
| 223 | + echo ' '. |
|
| 224 | + '<a href="' . $url_base . '&surname=' . rawurlencode($node->getFollowUpSurname()) . '&ged=' . $this->data->get('tree')->getNameUrl() . '">'. |
|
| 225 | + '('.I18N::translate('Go to %s lineages', $node->getFollowUpSurname()).')'. |
|
| 226 | + '</a>'; |
|
| 227 | + } |
|
| 228 | + echo '</li>'; |
|
| 229 | + } |
|
| 230 | + echo '</ul>'; |
|
| 231 | 231 | |
| 232 | - } |
|
| 232 | + } |
|
| 233 | 233 | |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | \ No newline at end of file |
@@ -20,111 +20,111 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class CertificateFileProvider implements CertificateProviderInterface { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Relative path to the root certificate folder |
|
| 25 | - * @var string $root_path |
|
| 26 | - */ |
|
| 27 | - protected $root_path; |
|
| 23 | + /** |
|
| 24 | + * Relative path to the root certificate folder |
|
| 25 | + * @var string $root_path |
|
| 26 | + */ |
|
| 27 | + protected $root_path; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Reference tree |
|
| 31 | - * @var Tree $tree |
|
| 32 | - */ |
|
| 33 | - protected $tree; |
|
| 29 | + /** |
|
| 30 | + * Reference tree |
|
| 31 | + * @var Tree $tree |
|
| 32 | + */ |
|
| 33 | + protected $tree; |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Cached list of certificates' cities. |
|
| 37 | - * @var (null|array) $cities_list |
|
| 38 | - */ |
|
| 39 | - protected $cities_list = null; |
|
| 35 | + /** |
|
| 36 | + * Cached list of certificates' cities. |
|
| 37 | + * @var (null|array) $cities_list |
|
| 38 | + */ |
|
| 39 | + protected $cities_list = null; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Constructor for the File Provider |
|
| 43 | - * @param string $root_path |
|
| 44 | - * @param Tree $tree |
|
| 45 | - */ |
|
| 46 | - public function __construct($root_path, Tree $tree) { |
|
| 47 | - $this->root_path = $root_path; |
|
| 48 | - $this->tree = $tree; |
|
| 49 | - } |
|
| 41 | + /** |
|
| 42 | + * Constructor for the File Provider |
|
| 43 | + * @param string $root_path |
|
| 44 | + * @param Tree $tree |
|
| 45 | + */ |
|
| 46 | + public function __construct($root_path, Tree $tree) { |
|
| 47 | + $this->root_path = $root_path; |
|
| 48 | + $this->tree = $tree; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * {@inhericDoc} |
|
| 53 | - * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getRealCertificatesDirectory() |
|
| 54 | - */ |
|
| 55 | - public function getRealCertificatesDirectory(){ |
|
| 56 | - return WT_DATA_DIR . $this->root_path; |
|
| 57 | - } |
|
| 51 | + /** |
|
| 52 | + * {@inhericDoc} |
|
| 53 | + * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getRealCertificatesDirectory() |
|
| 54 | + */ |
|
| 55 | + public function getRealCertificatesDirectory(){ |
|
| 56 | + return WT_DATA_DIR . $this->root_path; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * {@inhericDoc} |
|
| 61 | - * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCitiesList() |
|
| 62 | - */ |
|
| 63 | - public function getCitiesList(){ |
|
| 64 | - if(!isset($this->cities_list) || is_null($this->cities_list)){ |
|
| 65 | - $certdir = $this->getRealCertificatesDirectory(); |
|
| 66 | - $this->cities_list = array(); |
|
| 59 | + /** |
|
| 60 | + * {@inhericDoc} |
|
| 61 | + * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCitiesList() |
|
| 62 | + */ |
|
| 63 | + public function getCitiesList(){ |
|
| 64 | + if(!isset($this->cities_list) || is_null($this->cities_list)){ |
|
| 65 | + $certdir = $this->getRealCertificatesDirectory(); |
|
| 66 | + $this->cities_list = array(); |
|
| 67 | 67 | |
| 68 | - $dir = opendir($certdir); |
|
| 68 | + $dir = opendir($certdir); |
|
| 69 | 69 | |
| 70 | - while($entry = readdir($dir)){ |
|
| 71 | - if($entry != '.' && $entry != '..' && is_dir($certdir.$entry)){ |
|
| 72 | - $this->cities_list[]= Functions::encodeFileSystemToUtf8($entry); |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - sort($this->cities_list); |
|
| 76 | - } |
|
| 77 | - return $this->cities_list; |
|
| 78 | - } |
|
| 70 | + while($entry = readdir($dir)){ |
|
| 71 | + if($entry != '.' && $entry != '..' && is_dir($certdir.$entry)){ |
|
| 72 | + $this->cities_list[]= Functions::encodeFileSystemToUtf8($entry); |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + sort($this->cities_list); |
|
| 76 | + } |
|
| 77 | + return $this->cities_list; |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * {@inhericDoc} |
|
| 82 | - * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesList() |
|
| 83 | - */ |
|
| 84 | - public function getCertificatesList($selCity){ |
|
| 80 | + /** |
|
| 81 | + * {@inhericDoc} |
|
| 82 | + * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesList() |
|
| 83 | + */ |
|
| 84 | + public function getCertificatesList($selCity){ |
|
| 85 | 85 | |
| 86 | - $selCity = Functions::encodeUtf8ToFileSystem($selCity); |
|
| 86 | + $selCity = Functions::encodeUtf8ToFileSystem($selCity); |
|
| 87 | 87 | |
| 88 | - $certdir = $this->getRealCertificatesDirectory(); |
|
| 89 | - $tabCertif= array(); |
|
| 88 | + $certdir = $this->getRealCertificatesDirectory(); |
|
| 89 | + $tabCertif= array(); |
|
| 90 | 90 | |
| 91 | - if(is_dir($certdir.$selCity)){ |
|
| 92 | - $dir=opendir($certdir.$selCity); |
|
| 93 | - while($entry = readdir($dir)){ |
|
| 94 | - if($entry!='.' && $entry!='..' && !is_dir($certdir.$entry.'/')){ |
|
| 95 | - $path = Functions::encodeFileSystemToUtf8($selCity.'/'.$entry); |
|
| 96 | - $certificate = new Certificate($path, $this->tree, $this); |
|
| 97 | - if(Functions::isImageTypeSupported($certificate->extension())){ |
|
| 98 | - $tabCertif[] = $certificate; |
|
| 99 | - } |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | - } |
|
| 103 | - return $tabCertif; |
|
| 104 | - } |
|
| 91 | + if(is_dir($certdir.$selCity)){ |
|
| 92 | + $dir=opendir($certdir.$selCity); |
|
| 93 | + while($entry = readdir($dir)){ |
|
| 94 | + if($entry!='.' && $entry!='..' && !is_dir($certdir.$entry.'/')){ |
|
| 95 | + $path = Functions::encodeFileSystemToUtf8($selCity.'/'.$entry); |
|
| 96 | + $certificate = new Certificate($path, $this->tree, $this); |
|
| 97 | + if(Functions::isImageTypeSupported($certificate->extension())){ |
|
| 98 | + $tabCertif[] = $certificate; |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | + } |
|
| 103 | + return $tabCertif; |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | - /** |
|
| 107 | - * {@inhericDoc} |
|
| 108 | - * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesListBeginWith() |
|
| 109 | - */ |
|
| 110 | - public function getCertificatesListBeginWith($city, $contains, $limit= 9999){ |
|
| 111 | - $tabFiles= array(); |
|
| 112 | - $dirPath= $this->getRealCertificatesDirectory() . Functions::encodeUtf8ToFileSystem($city).'/'; |
|
| 113 | - $contains = utf8_decode($contains); |
|
| 114 | - $nbCert = 0; |
|
| 106 | + /** |
|
| 107 | + * {@inhericDoc} |
|
| 108 | + * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesListBeginWith() |
|
| 109 | + */ |
|
| 110 | + public function getCertificatesListBeginWith($city, $contains, $limit= 9999){ |
|
| 111 | + $tabFiles= array(); |
|
| 112 | + $dirPath= $this->getRealCertificatesDirectory() . Functions::encodeUtf8ToFileSystem($city).'/'; |
|
| 113 | + $contains = utf8_decode($contains); |
|
| 114 | + $nbCert = 0; |
|
| 115 | 115 | |
| 116 | - if(is_dir($dirPath)){ |
|
| 117 | - $dir=opendir($dirPath); |
|
| 118 | - while(($entry = readdir($dir)) && $nbCert < $limit){ |
|
| 119 | - if($entry!='.' && $entry!='..' && $entry!='Thumbs.db' &&!is_dir($dirPath.$entry.'/') && stripos($entry, $contains)!== false){ |
|
| 120 | - $tabFiles[]= Functions::encodeFileSystemToUtf8($entry); |
|
| 121 | - $nbCert++; |
|
| 122 | - } |
|
| 123 | - } |
|
| 124 | - } |
|
| 125 | - sort($tabFiles); |
|
| 126 | - return $tabFiles; |
|
| 127 | - } |
|
| 116 | + if(is_dir($dirPath)){ |
|
| 117 | + $dir=opendir($dirPath); |
|
| 118 | + while(($entry = readdir($dir)) && $nbCert < $limit){ |
|
| 119 | + if($entry!='.' && $entry!='..' && $entry!='Thumbs.db' &&!is_dir($dirPath.$entry.'/') && stripos($entry, $contains)!== false){ |
|
| 120 | + $tabFiles[]= Functions::encodeFileSystemToUtf8($entry); |
|
| 121 | + $nbCert++; |
|
| 122 | + } |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | + sort($tabFiles); |
|
| 126 | + return $tabFiles; |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | 129 | } |
| 130 | 130 | |
@@ -18,40 +18,40 @@ |
||
| 18 | 18 | * Patronymic Lineage Module. |
| 19 | 19 | */ |
| 20 | 20 | class PatronymicLineageModule extends fw\Module\AbstractModule |
| 21 | - implements ModuleMenuItemInterface |
|
| 21 | + implements ModuleMenuItemInterface |
|
| 22 | 22 | {
|
| 23 | - /** @var string For custom modules - link for support, upgrades, etc. */ |
|
| 24 | - const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
| 23 | + /** @var string For custom modules - link for support, upgrades, etc. */ |
|
| 24 | + const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * {@inhericDoc}
|
|
| 28 | - */ |
|
| 29 | - public function getTitle() {
|
|
| 30 | - return /* I18N: Name of the “Patronymic lineage” module */ I18N::translate('Patronymic Lineages');
|
|
| 31 | - } |
|
| 26 | + /** |
|
| 27 | + * {@inhericDoc}
|
|
| 28 | + */ |
|
| 29 | + public function getTitle() {
|
|
| 30 | + return /* I18N: Name of the “Patronymic lineage” module */ I18N::translate('Patronymic Lineages');
|
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * {@inhericDoc}
|
|
| 35 | - */ |
|
| 36 | - public function getDescription() {
|
|
| 37 | - return /* I18N: Description of the “Patronymic lineage” module */ I18N::translate('Display lineages of people holding the same surname.');
|
|
| 38 | - } |
|
| 33 | + /** |
|
| 34 | + * {@inhericDoc}
|
|
| 35 | + */ |
|
| 36 | + public function getDescription() {
|
|
| 37 | + return /* I18N: Description of the “Patronymic lineage” module */ I18N::translate('Display lineages of people holding the same surname.');
|
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * {@inhericDoc}
|
|
| 42 | - */ |
|
| 43 | - public function modAction($mod_action) {
|
|
| 44 | - \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
| 45 | - } |
|
| 46 | - /** |
|
| 47 | - * {@inhericDoc}
|
|
| 48 | - * @see \MyArtJaub\Webtrees\Module\ModuleMenuItemInterface::getMenu() |
|
| 49 | - */ |
|
| 50 | - public function getMenu(fw\Tree $tree, $reference) {
|
|
| 51 | - $tree_url = $tree ? $tree->getNameUrl() : ''; |
|
| 52 | - $surname = $reference && is_string($reference) ? $reference : ''; |
|
| 53 | - 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'));
|
|
| 54 | - } |
|
| 40 | + /** |
|
| 41 | + * {@inhericDoc}
|
|
| 42 | + */ |
|
| 43 | + public function modAction($mod_action) {
|
|
| 44 | + \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
| 45 | + } |
|
| 46 | + /** |
|
| 47 | + * {@inhericDoc}
|
|
| 48 | + * @see \MyArtJaub\Webtrees\Module\ModuleMenuItemInterface::getMenu() |
|
| 49 | + */ |
|
| 50 | + public function getMenu(fw\Tree $tree, $reference) {
|
|
| 51 | + $tree_url = $tree ? $tree->getNameUrl() : ''; |
|
| 52 | + $surname = $reference && is_string($reference) ? $reference : ''; |
|
| 53 | + 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'));
|
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | \ No newline at end of file |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * @return string HTML code of the inserted flag |
| 80 | 80 | */ |
| 81 | 81 | public static function htmlPlaceIcon(\Fisharebest\Webtrees\Place $place, $icon_path , $size = 50) { |
| 82 | - return '<img class="flag_gm_h'. $size . '" src="' . $icon_path . '" title="' . $place->getGedcomName() . '" alt="' . $place->getGedcomName() . '" />'; |
|
| 82 | + return '<img class="flag_gm_h'. $size . '" src="' . $icon_path . '" title="' . $place->getGedcomName() . '" alt="' . $place->getGedcomName() . '" />'; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | * @return boolean |
| 356 | 356 | */ |
| 357 | 357 | public static function isDateWithinChartsRange(Date $date) { |
| 358 | - return $date->gregorianYear() >= 1550 && $date->gregorianYear() < 2030; |
|
| 358 | + return $date->gregorianYear() >= 1550 && $date->gregorianYear() < 2030; |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | } |
@@ -18,97 +18,97 @@ |
||
| 18 | 18 | /** |
| 19 | 19 | * @var array $data Container for data |
| 20 | 20 | */ |
| 21 | - protected $data = array(); |
|
| 21 | + protected $data = array(); |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Constructor for ViewBag |
|
| 25 | - * @param array $data_in |
|
| 26 | - */ |
|
| 27 | - public function __construct(array $data_in = array()) { |
|
| 28 | - $this->data = $data_in; |
|
| 29 | - } |
|
| 23 | + /** |
|
| 24 | + * Constructor for ViewBag |
|
| 25 | + * @param array $data_in |
|
| 26 | + */ |
|
| 27 | + public function __construct(array $data_in = array()) { |
|
| 28 | + $this->data = $data_in; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Get the keys present in the view bag. |
|
| 33 | - * |
|
| 34 | - * @return array |
|
| 35 | - */ |
|
| 36 | - public function keys() |
|
| 37 | - { |
|
| 38 | - return array_keys($this->data); |
|
| 39 | - } |
|
| 31 | + /** |
|
| 32 | + * Get the keys present in the view bag. |
|
| 33 | + * |
|
| 34 | + * @return array |
|
| 35 | + */ |
|
| 36 | + public function keys() |
|
| 37 | + { |
|
| 38 | + return array_keys($this->data); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Get all the data from the bag for a given key. |
|
| 43 | - * |
|
| 44 | - * @param string $key |
|
| 45 | - * @param string $format |
|
| 46 | - * @return unknown |
|
| 47 | - */ |
|
| 48 | - public function get($key, $default = null) |
|
| 49 | - { |
|
| 50 | - if (array_key_exists($key, $this->data)) { |
|
| 51 | - return $this->data[$key]; |
|
| 52 | - } |
|
| 53 | - return $default; |
|
| 54 | - } |
|
| 41 | + /** |
|
| 42 | + * Get all the data from the bag for a given key. |
|
| 43 | + * |
|
| 44 | + * @param string $key |
|
| 45 | + * @param string $format |
|
| 46 | + * @return unknown |
|
| 47 | + */ |
|
| 48 | + public function get($key, $default = null) |
|
| 49 | + { |
|
| 50 | + if (array_key_exists($key, $this->data)) { |
|
| 51 | + return $this->data[$key]; |
|
| 52 | + } |
|
| 53 | + return $default; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Magic getter. |
|
| 58 | - * Returns the value associated with the key. |
|
| 59 | - * |
|
| 60 | - * @param string $key |
|
| 61 | - * @return unknown |
|
| 62 | - */ |
|
| 63 | - public function __get($key) { |
|
| 64 | - return $this->get($key, null); |
|
| 65 | - } |
|
| 56 | + /** |
|
| 57 | + * Magic getter. |
|
| 58 | + * Returns the value associated with the key. |
|
| 59 | + * |
|
| 60 | + * @param string $key |
|
| 61 | + * @return unknown |
|
| 62 | + */ |
|
| 63 | + public function __get($key) { |
|
| 64 | + return $this->get($key, null); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * Set the value for the specified key. |
|
| 69 | - * Can define whether to override an existing value; |
|
| 70 | - * |
|
| 71 | - * @param string $key |
|
| 72 | - * @param mixed $value |
|
| 73 | - * @param bool $override |
|
| 74 | - */ |
|
| 75 | - public function set($key, $value, $override = true) { |
|
| 76 | - if(is_null($key)) return; |
|
| 77 | - if(!$override && array_key_exists($key, $this->data)) return; |
|
| 78 | - $this->data[$key] = $value; |
|
| 79 | - } |
|
| 67 | + /** |
|
| 68 | + * Set the value for the specified key. |
|
| 69 | + * Can define whether to override an existing value; |
|
| 70 | + * |
|
| 71 | + * @param string $key |
|
| 72 | + * @param mixed $value |
|
| 73 | + * @param bool $override |
|
| 74 | + */ |
|
| 75 | + public function set($key, $value, $override = true) { |
|
| 76 | + if(is_null($key)) return; |
|
| 77 | + if(!$override && array_key_exists($key, $this->data)) return; |
|
| 78 | + $this->data[$key] = $value; |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Magic setter. |
|
| 83 | - * Set the value for the specified key. |
|
| 84 | - * |
|
| 85 | - * @param string $key |
|
| 86 | - * @param mixed $value |
|
| 87 | - */ |
|
| 88 | - public function __set($key, $value) { |
|
| 89 | - $this->set($key, $value); |
|
| 90 | - } |
|
| 81 | + /** |
|
| 82 | + * Magic setter. |
|
| 83 | + * Set the value for the specified key. |
|
| 84 | + * |
|
| 85 | + * @param string $key |
|
| 86 | + * @param mixed $value |
|
| 87 | + */ |
|
| 88 | + public function __set($key, $value) { |
|
| 89 | + $this->set($key, $value); |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * Magic isset |
|
| 94 | - * Checks whether the ViewBag contains the specified key |
|
| 95 | - * |
|
| 96 | - * @param string $key |
|
| 97 | - * @return bool |
|
| 98 | - */ |
|
| 99 | - public function __isset($key) { |
|
| 100 | - return isset($this->data[$key]); |
|
| 101 | - } |
|
| 92 | + /** |
|
| 93 | + * Magic isset |
|
| 94 | + * Checks whether the ViewBag contains the specified key |
|
| 95 | + * |
|
| 96 | + * @param string $key |
|
| 97 | + * @return bool |
|
| 98 | + */ |
|
| 99 | + public function __isset($key) { |
|
| 100 | + return isset($this->data[$key]); |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - /** |
|
| 104 | - * Magic unset |
|
| 105 | - * Unset the specified key from the ViewBag |
|
| 106 | - * |
|
| 107 | - * @param string $key |
|
| 108 | - */ |
|
| 109 | - public function __unset($key) { |
|
| 110 | - unset($this->data[$key]);; |
|
| 111 | - } |
|
| 103 | + /** |
|
| 104 | + * Magic unset |
|
| 105 | + * Unset the specified key from the ViewBag |
|
| 106 | + * |
|
| 107 | + * @param string $key |
|
| 108 | + */ |
|
| 109 | + public function __unset($key) { |
|
| 110 | + unset($this->data[$key]);; |
|
| 111 | + } |
|
| 112 | 112 | |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | \ No newline at end of file |
@@ -113,29 +113,29 @@ discard block |
||
| 113 | 113 | * @return string|array Estimated birth place if found, null otherwise |
| 114 | 114 | */ |
| 115 | 115 | public function getSignificantPlace(){ |
| 116 | - if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
| 117 | - return $bplace; |
|
| 118 | - } |
|
| 116 | + if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
| 117 | + return $bplace; |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | - foreach ($this->gedcomrecord->getAllEventPlaces('RESI') as $rplace) { |
|
| 121 | - if ($rplace) { |
|
| 122 | - return $rplace; |
|
| 123 | - } |
|
| 124 | - } |
|
| 120 | + foreach ($this->gedcomrecord->getAllEventPlaces('RESI') as $rplace) { |
|
| 121 | + if ($rplace) { |
|
| 122 | + return $rplace; |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | - if($dplace = $this->gedcomrecord->getDeathPlace()){ |
|
| 127 | - return $dplace; |
|
| 128 | - } |
|
| 126 | + if($dplace = $this->gedcomrecord->getDeathPlace()){ |
|
| 127 | + return $dplace; |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | - foreach($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
| 131 | - foreach ($fams->getAllEventPlaces('RESI') as $rplace) { |
|
| 132 | - if ($rplace) { |
|
| 133 | - return $rplace; |
|
| 134 | - } |
|
| 135 | - } |
|
| 136 | - } |
|
| 130 | + foreach($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
| 131 | + foreach ($fams->getAllEventPlaces('RESI') as $rplace) { |
|
| 132 | + if ($rplace) { |
|
| 133 | + return $rplace; |
|
| 134 | + } |
|
| 135 | + } |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | - return null; |
|
| 138 | + return null; |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * @return boolean Is the individual a Sosa ancestor |
| 145 | 145 | */ |
| 146 | 146 | public function isSosa(){ |
| 147 | - return count($this->getSosaNumbers()) > 0; |
|
| 147 | + return count($this->getSosaNumbers()) > 0; |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -155,11 +155,11 @@ discard block |
||
| 155 | 155 | * @return array List of Sosa numbers |
| 156 | 156 | */ |
| 157 | 157 | public function getSosaNumbers(){ |
| 158 | - if($this->sosa === null) { |
|
| 159 | - $provider = new SosaProvider($this->gedcomrecord->getTree()); |
|
| 160 | - $this->sosa = $provider->getSosaNumbers($this->gedcomrecord); |
|
| 161 | - } |
|
| 162 | - return $this->sosa; |
|
| 158 | + if($this->sosa === null) { |
|
| 159 | + $provider = new SosaProvider($this->gedcomrecord->getTree()); |
|
| 160 | + $this->sosa = $provider->getSosaNumbers($this->gedcomrecord); |
|
| 161 | + } |
|
| 162 | + return $this->sosa; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -174,10 +174,10 @@ discard block |
||
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | /** |
| 177 | - * Check if this individual's death is sourced |
|
| 178 | - * |
|
| 179 | - * @return int Level of sources |
|
| 180 | - * */ |
|
| 177 | + * Check if this individual's death is sourced |
|
| 178 | + * |
|
| 179 | + * @return int Level of sources |
|
| 180 | + * */ |
|
| 181 | 181 | public function isDeathSourced(){ |
| 182 | 182 | if($this->is_death_sourced !== null) return $this->is_death_sourced; |
| 183 | 183 | $this->is_death_sourced = $this->isFactSourced(WT_EVENTS_DEAT); |