@@ -23,51 +23,51 @@ |
||
23 | 23 | * {@inhericDoc} |
24 | 24 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
25 | 25 | */ |
26 | - protected function renderContent() { |
|
26 | + protected function renderContent() { |
|
27 | 27 | |
28 | - return ' |
|
28 | + return ' |
|
29 | 29 | <tr> |
30 | 30 | <td class="descriptionbox wrap width33">' . |
31 | - I18N::translate('Enable Piwik Statistics') . |
|
32 | - // Ideally, would like to add helpLink, but this does not work for modules... |
|
33 | - // FunctionsPrint::helpLink('piwik_enabled', $this->getName()); |
|
34 | - '</td> |
|
31 | + I18N::translate('Enable Piwik Statistics') . |
|
32 | + // Ideally, would like to add helpLink, but this does not work for modules... |
|
33 | + // FunctionsPrint::helpLink('piwik_enabled', $this->getName()); |
|
34 | + '</td> |
|
35 | 35 | <td class="optionbox">' . |
36 | - FunctionsEdit::editFieldYesNo('piwik_enabled', $this->data->get('piwik_enabled', '0')) . |
|
37 | - '</td> |
|
36 | + FunctionsEdit::editFieldYesNo('piwik_enabled', $this->data->get('piwik_enabled', '0')) . |
|
37 | + '</td> |
|
38 | 38 | </tr>' . |
39 | 39 | |
40 | - '<tr> |
|
40 | + '<tr> |
|
41 | 41 | <td class="descriptionbox wrap width33">' . |
42 | - I18N::translate('Piwik URL') . |
|
43 | - '</td> |
|
42 | + I18N::translate('Piwik URL') . |
|
43 | + '</td> |
|
44 | 44 | <td class="optionbox"> |
45 | 45 | <input type="text" name="piwik_url" size="45" value="' . |
46 | - $this->data->get('piwik_url', '') . '" /> |
|
46 | + $this->data->get('piwik_url', '') . '" /> |
|
47 | 47 | </td> |
48 | 48 | </tr>' . |
49 | 49 | |
50 | - '<tr> |
|
50 | + '<tr> |
|
51 | 51 | <td class="descriptionbox wrap width33">' . |
52 | - I18N::translate('Piwik Token') . |
|
53 | - '</td> |
|
52 | + I18N::translate('Piwik Token') . |
|
53 | + '</td> |
|
54 | 54 | <td class="optionbox"> |
55 | 55 | <input type="text" name="piwik_token" size="45" value="' . |
56 | - $this->data->get('piwik_token', '') . '" /> |
|
56 | + $this->data->get('piwik_token', '') . '" /> |
|
57 | 57 | </td> |
58 | 58 | </tr>' . |
59 | 59 | |
60 | - '<tr> |
|
60 | + '<tr> |
|
61 | 61 | <td class="descriptionbox wrap width33">' . |
62 | - I18N::translate('Piwik Site ID') . |
|
63 | - '</td> |
|
62 | + I18N::translate('Piwik Site ID') . |
|
63 | + '</td> |
|
64 | 64 | <td class="optionbox"> |
65 | 65 | <input type="text" name="piwik_siteid" size="4" value="' . |
66 | - $this->data->get('piwik_siteid', '') . '" /> |
|
66 | + $this->data->get('piwik_siteid', '') . '" /> |
|
67 | 67 | </td> |
68 | 68 | </tr>' ; |
69 | 69 | |
70 | - } |
|
70 | + } |
|
71 | 71 | |
72 | 72 | |
73 | 73 | } |
@@ -15,12 +15,12 @@ |
||
15 | 15 | */ |
16 | 16 | interface MvcControllerInterface { |
17 | 17 | |
18 | - /** |
|
19 | - * Return the module attached to this controller. |
|
20 | - * |
|
21 | - * @return \Fisharebest\Webtrees\Module\AbstractModule |
|
22 | - */ |
|
23 | - function getModule(); |
|
18 | + /** |
|
19 | + * Return the module attached to this controller. |
|
20 | + * |
|
21 | + * @return \Fisharebest\Webtrees\Module\AbstractModule |
|
22 | + */ |
|
23 | + function getModule(); |
|
24 | 24 | |
25 | 25 | } |
26 | 26 | |
27 | 27 | \ No newline at end of file |
@@ -17,28 +17,28 @@ |
||
17 | 17 | */ |
18 | 18 | class MvcController implements MvcControllerInterface |
19 | 19 | { |
20 | - /** |
|
21 | - * Reference module |
|
22 | - * @var Fisharebest\Webtrees\Module\AbstractModule $module |
|
23 | - */ |
|
24 | - protected $module; |
|
20 | + /** |
|
21 | + * Reference module |
|
22 | + * @var Fisharebest\Webtrees\Module\AbstractModule $module |
|
23 | + */ |
|
24 | + protected $module; |
|
25 | 25 | |
26 | - /** |
|
27 | - * Constructor for MvcController |
|
28 | - * |
|
29 | - * @param AbstractModule $module |
|
30 | - */ |
|
31 | - public function __construct(AbstractModule $module) { |
|
32 | - $this->module = $module; |
|
33 | - } |
|
26 | + /** |
|
27 | + * Constructor for MvcController |
|
28 | + * |
|
29 | + * @param AbstractModule $module |
|
30 | + */ |
|
31 | + public function __construct(AbstractModule $module) { |
|
32 | + $this->module = $module; |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * {@inheritDoc} |
|
37 | - * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface::getModule() |
|
38 | - */ |
|
39 | - public function getModule() { |
|
40 | - return $this->module; |
|
41 | - } |
|
35 | + /** |
|
36 | + * {@inheritDoc} |
|
37 | + * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcControllerInterface::getModule() |
|
38 | + */ |
|
39 | + public function getModule() { |
|
40 | + return $this->module; |
|
41 | + } |
|
42 | 42 | |
43 | 43 | } |
44 | 44 | |
45 | 45 | \ No newline at end of file |
@@ -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 |