@@ -34,25 +34,25 @@ discard block |
||
34 | 34 | */ |
35 | 35 | class TaskController extends MvcController |
36 | 36 | { |
37 | - /** |
|
38 | - * Tasks Provider |
|
39 | - * @var TaskProviderInterface $provider |
|
40 | - */ |
|
41 | - protected $provider; |
|
37 | + /** |
|
38 | + * Tasks Provider |
|
39 | + * @var TaskProviderInterface $provider |
|
40 | + */ |
|
41 | + protected $provider; |
|
42 | 42 | |
43 | - /** |
|
44 | - * Constructor for Admin Config controller |
|
45 | - * @param AbstractModule $module |
|
46 | - */ |
|
47 | - public function __construct(AbstractModule $module) { |
|
48 | - parent::__construct($module); |
|
43 | + /** |
|
44 | + * Constructor for Admin Config controller |
|
45 | + * @param AbstractModule $module |
|
46 | + */ |
|
47 | + public function __construct(AbstractModule $module) { |
|
48 | + parent::__construct($module); |
|
49 | 49 | |
50 | - $this->provider = $this->module->getProvider(); |
|
51 | - } |
|
50 | + $this->provider = $this->module->getProvider(); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Pages |
|
55 | - */ |
|
53 | + /** |
|
54 | + * Pages |
|
55 | + */ |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * Task@trigger |
@@ -76,35 +76,35 @@ discard block |
||
76 | 76 | /** |
77 | 77 | * Task@setStatus |
78 | 78 | */ |
79 | - public function setStatus() { |
|
80 | - $controller = new JsonController(); |
|
79 | + public function setStatus() { |
|
80 | + $controller = new JsonController(); |
|
81 | 81 | |
82 | - $task_name = Filter::get('task'); |
|
83 | - $task = $this->provider->getTask($task_name, false); |
|
82 | + $task_name = Filter::get('task'); |
|
83 | + $task = $this->provider->getTask($task_name, false); |
|
84 | 84 | |
85 | - $controller->restrictAccess( |
|
86 | - true // Filter::checkCsrf() -- Cannot use CSRF on a GET request (modules can only work with GET requests) |
|
87 | - && Auth::isAdmin() |
|
88 | - && $task |
|
89 | - ); |
|
85 | + $controller->restrictAccess( |
|
86 | + true // Filter::checkCsrf() -- Cannot use CSRF on a GET request (modules can only work with GET requests) |
|
87 | + && Auth::isAdmin() |
|
88 | + && $task |
|
89 | + ); |
|
90 | 90 | |
91 | - $status = Filter::getBool('status'); |
|
92 | - $res = array('task' => $task->getName() , 'error' => null); |
|
93 | - try{ |
|
94 | - $this->provider->setTaskStatus($task, $status); |
|
95 | - $res['status'] = $status; |
|
91 | + $status = Filter::getBool('status'); |
|
92 | + $res = array('task' => $task->getName() , 'error' => null); |
|
93 | + try{ |
|
94 | + $this->provider->setTaskStatus($task, $status); |
|
95 | + $res['status'] = $status; |
|
96 | 96 | Log::addConfigurationLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" has been '. ($status ? 'enabled' : 'disabled') .'.'); |
97 | - } |
|
98 | - catch (\Exception $ex) { |
|
99 | - $res['error'] = $ex->getMessage(); |
|
97 | + } |
|
98 | + catch (\Exception $ex) { |
|
99 | + $res['error'] = $ex->getMessage(); |
|
100 | 100 | Log::addErrorLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage()); |
101 | - } |
|
101 | + } |
|
102 | 102 | |
103 | - $controller->pageHeader(); |
|
104 | - if($res['error']) http_response_code(500); |
|
103 | + $controller->pageHeader(); |
|
104 | + if($res['error']) http_response_code(500); |
|
105 | 105 | |
106 | - $controller->encode($res); |
|
107 | - } |
|
106 | + $controller->encode($res); |
|
107 | + } |
|
108 | 108 | |
109 | 109 | /** |
110 | 110 | * Task@edit |
@@ -112,15 +112,15 @@ discard block |
||
112 | 112 | public function edit() { |
113 | 113 | global $WT_TREE; |
114 | 114 | |
115 | - $task_name = Filter::get('task'); |
|
116 | - $task = $this->provider->getTask($task_name, false); |
|
115 | + $task_name = Filter::get('task'); |
|
116 | + $task = $this->provider->getTask($task_name, false); |
|
117 | 117 | |
118 | - Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
119 | - $controller = new PageController(); |
|
120 | - $controller |
|
121 | - ->restrictAccess(Auth::isAdmin() && $task) |
|
118 | + Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
119 | + $controller = new PageController(); |
|
120 | + $controller |
|
121 | + ->restrictAccess(Auth::isAdmin() && $task) |
|
122 | 122 | ->setPageTitle(I18N::translate('Edit the administrative task')) |
123 | - ->addInlineJavascript(' |
|
123 | + ->addInlineJavascript(' |
|
124 | 124 | function toggleRemainingOccurrences() { |
125 | 125 | if($("input:radio[name=\'is_limited\']:checked").val() == 1) { |
126 | 126 | $("#nb_occurences").show(); |
@@ -133,39 +133,39 @@ discard block |
||
133 | 133 | $("[name=\'is_limited\']").on("change", toggleRemainingOccurrences); |
134 | 134 | toggleRemainingOccurrences(); |
135 | 135 | ') |
136 | - ; |
|
136 | + ; |
|
137 | 137 | |
138 | 138 | |
139 | - $data = new ViewBag(); |
|
140 | - $data->set('title', $controller->getPageTitle()); |
|
139 | + $data = new ViewBag(); |
|
140 | + $data->set('title', $controller->getPageTitle()); |
|
141 | 141 | $data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl()); |
142 | - $data->set('module_title', $this->module->getTitle()); |
|
142 | + $data->set('module_title', $this->module->getTitle()); |
|
143 | 143 | $data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=Task@save&ged=' . $WT_TREE->getNameUrl()); |
144 | 144 | $data->set('task', $task); |
145 | 145 | |
146 | - ViewFactory::make('TaskEdit', $this, $controller, $data)->render(); |
|
146 | + ViewFactory::make('TaskEdit', $this, $controller, $data)->render(); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
150 | 150 | * Task@save |
151 | 151 | */ |
152 | 152 | public function save() { |
153 | - $tmp_contrl = new PageController(); |
|
153 | + $tmp_contrl = new PageController(); |
|
154 | 154 | |
155 | - $tmp_contrl->restrictAccess( |
|
156 | - Auth::isAdmin() |
|
157 | - && Filter::checkCsrf() |
|
158 | - ); |
|
155 | + $tmp_contrl->restrictAccess( |
|
156 | + Auth::isAdmin() |
|
157 | + && Filter::checkCsrf() |
|
158 | + ); |
|
159 | 159 | |
160 | 160 | $task_name = Filter::post('task'); |
161 | - $frequency = Filter::postInteger('frequency'); |
|
162 | - $is_limited = Filter::postInteger('is_limited', 0, 1); |
|
163 | - $nb_occur = Filter::postInteger('nb_occur'); |
|
161 | + $frequency = Filter::postInteger('frequency'); |
|
162 | + $is_limited = Filter::postInteger('is_limited', 0, 1); |
|
163 | + $nb_occur = Filter::postInteger('nb_occur'); |
|
164 | 164 | |
165 | 165 | $task = $this->provider->getTask($task_name, false); |
166 | 166 | |
167 | - $success = false; |
|
168 | - if($task) { |
|
167 | + $success = false; |
|
168 | + if($task) { |
|
169 | 169 | $task->setFrequency($frequency); |
170 | 170 | if($is_limited == 1) { |
171 | 171 | $task->setRemainingOccurrences($nb_occur); |
@@ -197,13 +197,13 @@ discard block |
||
197 | 197 | Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'. $task->getName() .'” could not be updated. See error log.'); |
198 | 198 | } |
199 | 199 | |
200 | - } |
|
200 | + } |
|
201 | 201 | |
202 | - $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig'; |
|
203 | - if(!$success) { |
|
202 | + $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig'; |
|
203 | + if(!$success) { |
|
204 | 204 | $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=Task@edit&task='. $task->getName(); |
205 | - } |
|
206 | - header('Location: ' . WT_BASE_URL . $redirection_url); |
|
205 | + } |
|
206 | + header('Location: ' . WT_BASE_URL . $redirection_url); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | } |
210 | 210 | \ No newline at end of file |
@@ -29,30 +29,30 @@ discard block |
||
29 | 29 | class WelcomeBlockController extends MvcController |
30 | 30 | { |
31 | 31 | |
32 | - /** |
|
33 | - * Pages |
|
34 | - */ |
|
32 | + /** |
|
33 | + * Pages |
|
34 | + */ |
|
35 | 35 | |
36 | - /** |
|
37 | - * WelcomeBlock@index |
|
38 | - * |
|
39 | - * @param PageController $parent_controller |
|
40 | - * @param Tree $tree |
|
41 | - * @param string $block_id |
|
42 | - * @param string $template |
|
43 | - * @return $string |
|
44 | - */ |
|
45 | - public function index(PageController $parent_controller, Tree $tree, $block_id, $template) { |
|
46 | - $view_bag = new ViewBag(); |
|
36 | + /** |
|
37 | + * WelcomeBlock@index |
|
38 | + * |
|
39 | + * @param PageController $parent_controller |
|
40 | + * @param Tree $tree |
|
41 | + * @param string $block_id |
|
42 | + * @param string $template |
|
43 | + * @return $string |
|
44 | + */ |
|
45 | + public function index(PageController $parent_controller, Tree $tree, $block_id, $template) { |
|
46 | + $view_bag = new ViewBag(); |
|
47 | 47 | |
48 | - if($parent_controller && $tree) { |
|
48 | + if($parent_controller && $tree) { |
|
49 | 49 | |
50 | - $view_bag->set('tree', $tree); |
|
51 | - $view_bag->set('indi', $parent_controller->getSignificantIndividual()); |
|
50 | + $view_bag->set('tree', $tree); |
|
51 | + $view_bag->set('indi', $parent_controller->getSignificantIndividual()); |
|
52 | 52 | |
53 | - $id = $this->module->getName().$block_id; |
|
54 | - $class = $this->module->getName().'_block'; |
|
55 | - $parent_controller->addInlineJavascript(' |
|
53 | + $id = $this->module->getName().$block_id; |
|
54 | + $class = $this->module->getName().'_block'; |
|
55 | + $parent_controller->addInlineJavascript(' |
|
56 | 56 | jQuery("#maj-new_passwd").hide(); |
57 | 57 | jQuery("#maj-passwd_click").click(function() |
58 | 58 | { |
@@ -63,63 +63,63 @@ discard block |
||
63 | 63 | }); |
64 | 64 | '); |
65 | 65 | |
66 | - if (Auth::isAdmin()) { |
|
67 | - $title='<a class="icon-admin" title="'.I18N::translate('Configure').'" href="block_edit.php?block_id='.$block_id.'&ged=' . $tree->getNameHtml() . '&ctype=gedcom"></a>'; |
|
68 | - } else { |
|
69 | - $title=''; |
|
70 | - } |
|
71 | - $title .='<span dir="auto">'.$tree->getTitleHtml().'</span>'; |
|
66 | + if (Auth::isAdmin()) { |
|
67 | + $title='<a class="icon-admin" title="'.I18N::translate('Configure').'" href="block_edit.php?block_id='.$block_id.'&ged=' . $tree->getNameHtml() . '&ctype=gedcom"></a>'; |
|
68 | + } else { |
|
69 | + $title=''; |
|
70 | + } |
|
71 | + $title .='<span dir="auto">'.$tree->getTitleHtml().'</span>'; |
|
72 | 72 | |
73 | - $piwik_enabled = $this->module->getBlockSetting($block_id, 'piwik_enabled', false); |
|
74 | - $view_bag->set('piwik_enabled', $piwik_enabled); |
|
75 | - if($piwik_enabled) { |
|
76 | - $parent_controller->addInlineJavascript( |
|
77 | - '$("#piwik_stats") |
|
73 | + $piwik_enabled = $this->module->getBlockSetting($block_id, 'piwik_enabled', false); |
|
74 | + $view_bag->set('piwik_enabled', $piwik_enabled); |
|
75 | + if($piwik_enabled) { |
|
76 | + $parent_controller->addInlineJavascript( |
|
77 | + '$("#piwik_stats") |
|
78 | 78 | .load("module.php?mod='.$this->module->getName().'&mod_action=Piwik&block_id='.$block_id.'");' |
79 | - ); |
|
80 | - } |
|
79 | + ); |
|
80 | + } |
|
81 | 81 | |
82 | - $content = ViewFactory::make('WelcomeBlock', $this, new BaseController(), $view_bag)->getHtmlPartial(); |
|
82 | + $content = ViewFactory::make('WelcomeBlock', $this, new BaseController(), $view_bag)->getHtmlPartial(); |
|
83 | 83 | |
84 | - if ($template) { |
|
85 | - return Theme::theme()->formatBlock($id, $title, $class, $content); |
|
86 | - } else { |
|
87 | - return $content; |
|
88 | - } |
|
89 | - } |
|
90 | - } |
|
84 | + if ($template) { |
|
85 | + return Theme::theme()->formatBlock($id, $title, $class, $content); |
|
86 | + } else { |
|
87 | + return $content; |
|
88 | + } |
|
89 | + } |
|
90 | + } |
|
91 | 91 | |
92 | 92 | |
93 | 93 | |
94 | - /** |
|
95 | - * WelcomeBlock@config |
|
96 | - * |
|
97 | - * @param string $block_id |
|
98 | - */ |
|
99 | - public function config($block_id) { |
|
94 | + /** |
|
95 | + * WelcomeBlock@config |
|
96 | + * |
|
97 | + * @param string $block_id |
|
98 | + */ |
|
99 | + public function config($block_id) { |
|
100 | 100 | |
101 | - if (Filter::postBool('save') && Filter::checkCsrf()) { |
|
102 | - $this->module->setBlockSetting($block_id, 'piwik_enabled', Filter::postBool('piwik_enabled')); |
|
103 | - $this->module->setBlockSetting($block_id, 'piwik_url', trim(Filter::postUrl('piwik_url'))); |
|
104 | - $this->module->setBlockSetting($block_id, 'piwik_siteid', trim(Filter::post('piwik_siteid'))); |
|
105 | - $this->module->setBlockSetting($block_id, 'piwik_token', trim(Filter::post('piwik_token'))); |
|
106 | - Cache::delete('piwikCountYear', $this->module); |
|
107 | - throw new MvcException(200); // Use this instead of exit |
|
108 | - } |
|
101 | + if (Filter::postBool('save') && Filter::checkCsrf()) { |
|
102 | + $this->module->setBlockSetting($block_id, 'piwik_enabled', Filter::postBool('piwik_enabled')); |
|
103 | + $this->module->setBlockSetting($block_id, 'piwik_url', trim(Filter::postUrl('piwik_url'))); |
|
104 | + $this->module->setBlockSetting($block_id, 'piwik_siteid', trim(Filter::post('piwik_siteid'))); |
|
105 | + $this->module->setBlockSetting($block_id, 'piwik_token', trim(Filter::post('piwik_token'))); |
|
106 | + Cache::delete('piwikCountYear', $this->module); |
|
107 | + throw new MvcException(200); // Use this instead of exit |
|
108 | + } |
|
109 | 109 | |
110 | - $view_bag = new ViewBag(); |
|
110 | + $view_bag = new ViewBag(); |
|
111 | 111 | |
112 | - // Is Piwik Statistic Enabled ? |
|
113 | - $view_bag->set('piwik_enabled', $this->module->getBlockSetting($block_id, 'piwik_enabled', '0')); |
|
114 | - //Piwik Root Url |
|
115 | - $view_bag->set('piwik_url', $this->module->getBlockSetting($block_id, 'piwik_url', '')); |
|
116 | - // Piwik token |
|
117 | - $view_bag->set('piwik_token', $this->module->getBlockSetting($block_id, 'piwik_token', '')); |
|
118 | - // Piwik side id |
|
119 | - $view_bag->set('piwik_siteid', $this->module->getBlockSetting($block_id, 'piwik_siteid', '')); |
|
112 | + // Is Piwik Statistic Enabled ? |
|
113 | + $view_bag->set('piwik_enabled', $this->module->getBlockSetting($block_id, 'piwik_enabled', '0')); |
|
114 | + //Piwik Root Url |
|
115 | + $view_bag->set('piwik_url', $this->module->getBlockSetting($block_id, 'piwik_url', '')); |
|
116 | + // Piwik token |
|
117 | + $view_bag->set('piwik_token', $this->module->getBlockSetting($block_id, 'piwik_token', '')); |
|
118 | + // Piwik side id |
|
119 | + $view_bag->set('piwik_siteid', $this->module->getBlockSetting($block_id, 'piwik_siteid', '')); |
|
120 | 120 | |
121 | - ViewFactory::make('WelcomeBlockConfig', $this, new BaseController(), $view_bag)->renderPartial(); |
|
122 | - } |
|
121 | + ViewFactory::make('WelcomeBlockConfig', $this, new BaseController(), $view_bag)->renderPartial(); |
|
122 | + } |
|
123 | 123 | |
124 | 124 | |
125 | 125 |
@@ -23,74 +23,74 @@ |
||
23 | 23 | */ |
24 | 24 | class PiwikController extends MvcController |
25 | 25 | { |
26 | - /** |
|
27 | - * Retrieve the number of visitors from Piwik, for a given period. |
|
28 | - * |
|
29 | - * @param string $block_id |
|
30 | - * @param string $period |
|
31 | - * @param (null|int) Number of visits |
|
32 | - */ |
|
33 | - private function getNumberOfVisitsPiwik($block_id, $period='year'){ |
|
26 | + /** |
|
27 | + * Retrieve the number of visitors from Piwik, for a given period. |
|
28 | + * |
|
29 | + * @param string $block_id |
|
30 | + * @param string $period |
|
31 | + * @param (null|int) Number of visits |
|
32 | + */ |
|
33 | + private function getNumberOfVisitsPiwik($block_id, $period='year'){ |
|
34 | 34 | |
35 | - $piwik_url = $this->module->getBlockSetting($block_id, 'piwik_url'); |
|
36 | - $piwik_siteid = $this->module->getBlockSetting($block_id, 'piwik_siteid'); |
|
37 | - $piwik_token = $this->module->getBlockSetting($block_id, 'piwik_token'); |
|
35 | + $piwik_url = $this->module->getBlockSetting($block_id, 'piwik_url'); |
|
36 | + $piwik_siteid = $this->module->getBlockSetting($block_id, 'piwik_siteid'); |
|
37 | + $piwik_token = $this->module->getBlockSetting($block_id, 'piwik_token'); |
|
38 | 38 | |
39 | - if($piwik_url && strlen($piwik_url) > 0 && |
|
40 | - $piwik_siteid && strlen($piwik_siteid) > 0 && |
|
41 | - $piwik_token && strlen($piwik_token) |
|
42 | - ) |
|
43 | - { |
|
44 | - // calling Piwik REST API |
|
45 | - $url = $piwik_url; |
|
46 | - $url .= '?module=API&method=VisitsSummary.getVisits'; |
|
47 | - $url .= '&idSite='.$piwik_siteid.'&period='.$period.'&date=today'; |
|
48 | - $url .= '&format=PHP'; |
|
49 | - $url .= '&token_auth='.$piwik_token; |
|
39 | + if($piwik_url && strlen($piwik_url) > 0 && |
|
40 | + $piwik_siteid && strlen($piwik_siteid) > 0 && |
|
41 | + $piwik_token && strlen($piwik_token) |
|
42 | + ) |
|
43 | + { |
|
44 | + // calling Piwik REST API |
|
45 | + $url = $piwik_url; |
|
46 | + $url .= '?module=API&method=VisitsSummary.getVisits'; |
|
47 | + $url .= '&idSite='.$piwik_siteid.'&period='.$period.'&date=today'; |
|
48 | + $url .= '&format=PHP'; |
|
49 | + $url .= '&token_auth='.$piwik_token; |
|
50 | 50 | |
51 | - if($fetched = File::fetchUrl($url)) { |
|
52 | - $content = @unserialize($fetched); |
|
53 | - if(is_numeric($content)) return $content; |
|
54 | - } |
|
55 | - } |
|
51 | + if($fetched = File::fetchUrl($url)) { |
|
52 | + $content = @unserialize($fetched); |
|
53 | + if(is_numeric($content)) return $content; |
|
54 | + } |
|
55 | + } |
|
56 | 56 | |
57 | - return null; |
|
58 | - } |
|
57 | + return null; |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * Pages |
|
62 | - */ |
|
60 | + /** |
|
61 | + * Pages |
|
62 | + */ |
|
63 | 63 | |
64 | - /** |
|
65 | - * Piwik@index |
|
66 | - */ |
|
67 | - public function index() { |
|
64 | + /** |
|
65 | + * Piwik@index |
|
66 | + */ |
|
67 | + public function index() { |
|
68 | 68 | |
69 | - $ctrl = new AjaxController(); |
|
69 | + $ctrl = new AjaxController(); |
|
70 | 70 | |
71 | - $data = new ViewBag(); |
|
72 | - $data->set('has_stats', false); |
|
71 | + $data = new ViewBag(); |
|
72 | + $data->set('has_stats', false); |
|
73 | 73 | |
74 | - $block_id = Filter::get('block_id'); |
|
75 | - if($block_id){ |
|
76 | - $cached_item = Cache::get('piwikCountYear', $this->module); |
|
77 | - $visitCountYear = $cached_item->get(); |
|
78 | - if(!$cached_item->isHit()) { |
|
79 | - $visitCountYear = $this->getNumberOfVisitsPiwik($block_id); |
|
80 | - Cache::save($cached_item, $visitCountYear); |
|
81 | - } |
|
74 | + $block_id = Filter::get('block_id'); |
|
75 | + if($block_id){ |
|
76 | + $cached_item = Cache::get('piwikCountYear', $this->module); |
|
77 | + $visitCountYear = $cached_item->get(); |
|
78 | + if(!$cached_item->isHit()) { |
|
79 | + $visitCountYear = $this->getNumberOfVisitsPiwik($block_id); |
|
80 | + Cache::save($cached_item, $visitCountYear); |
|
81 | + } |
|
82 | 82 | |
83 | - if($visitCountYear){ |
|
84 | - $visitCountToday = max(0, $this->getNumberOfVisitsPiwik($block_id, 'day')); |
|
85 | - $visitCountYear = max( 0, $visitCountYear); |
|
83 | + if($visitCountYear){ |
|
84 | + $visitCountToday = max(0, $this->getNumberOfVisitsPiwik($block_id, 'day')); |
|
85 | + $visitCountYear = max( 0, $visitCountYear); |
|
86 | 86 | |
87 | - $data->set('has_stats', true); |
|
88 | - $data->set('visits_today', $visitCountToday); |
|
89 | - $data->set('visits_year', $visitCountYear + $visitCountToday); |
|
90 | - } |
|
91 | - } |
|
87 | + $data->set('has_stats', true); |
|
88 | + $data->set('visits_today', $visitCountToday); |
|
89 | + $data->set('visits_year', $visitCountYear + $visitCountToday); |
|
90 | + } |
|
91 | + } |
|
92 | 92 | |
93 | - ViewFactory::make('PiwikStats', $this, $ctrl, $data)->render(); |
|
94 | - } |
|
93 | + ViewFactory::make('PiwikStats', $this, $ctrl, $data)->render(); |
|
94 | + } |
|
95 | 95 | |
96 | 96 | } |
97 | 97 | \ No newline at end of file |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | */ |
23 | 23 | class Cache{ |
24 | 24 | |
25 | - /** |
|
26 | - * Underlying Cache object |
|
27 | - * @var CacheItemPoolInterface $cache |
|
28 | - */ |
|
25 | + /** |
|
26 | + * Underlying Cache object |
|
27 | + * @var CacheItemPoolInterface $cache |
|
28 | + */ |
|
29 | 29 | protected $cache=null; |
30 | 30 | |
31 | 31 | /** |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | */ |
48 | 48 | protected static function getInstance() |
49 | 49 | { |
50 | - if (null === static::$instance) { |
|
51 | - static::$instance = new static(); |
|
52 | - } |
|
50 | + if (null === static::$instance) { |
|
51 | + static::$instance = new static(); |
|
52 | + } |
|
53 | 53 | |
54 | - return static::$instance; |
|
54 | + return static::$instance; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | * |
60 | 60 | */ |
61 | 61 | protected function init() { |
62 | - if(Apc::isAvailable()) { |
|
63 | - $driver = new Apc(); |
|
62 | + if(Apc::isAvailable()) { |
|
63 | + $driver = new Apc(); |
|
64 | 64 | } else { |
65 | 65 | if (!is_dir(WT_DATA_DIR.DIRECTORY_SEPARATOR.'cache')) { |
66 | 66 | // We may not have permission - especially during setup, before we instruct |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | @mkdir(WT_DATA_DIR.DIRECTORY_SEPARATOR.'cache'); |
69 | 69 | } |
70 | 70 | if (is_dir(WT_DATA_DIR.DIRECTORY_SEPARATOR.'cache')) { |
71 | - $driver = new FileSystem(array('path' => WT_DATA_DIR.DIRECTORY_SEPARATOR.'cache')); |
|
71 | + $driver = new FileSystem(array('path' => WT_DATA_DIR.DIRECTORY_SEPARATOR.'cache')); |
|
72 | 72 | } else { |
73 | 73 | // No cache available, let's just use a basic one :-( |
74 | 74 | $driver = new Ephemeral(); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @return string Cached key name |
96 | 96 | */ |
97 | 97 | protected function getKeyName($value, AbstractModule $mod = null){ |
98 | - $this->checkInit(); |
|
98 | + $this->checkInit(); |
|
99 | 99 | $mod_name = 'myartjaub'; |
100 | 100 | if($mod !== null) $mod_name = $mod->getName(); |
101 | 101 | return $mod_name.'_'.$value; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @return \Psr\Cache\CacheItemInterface |
110 | 110 | */ |
111 | 111 | public function getI($value, AbstractModule $mod = null){ |
112 | - $this->checkInit(); |
|
112 | + $this->checkInit(); |
|
113 | 113 | return $this->cache->getItem($this->getKeyName($value, $mod)); |
114 | 114 | } |
115 | 115 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * @return \Psr\Cache\CacheItemInterface |
122 | 122 | */ |
123 | 123 | public static function get($value, AbstractModule $mod = null){ |
124 | - return self::getInstance()->getI($value, $mod); |
|
124 | + return self::getInstance()->getI($value, $mod); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | |
137 | 137 | $item = $value; |
138 | 138 | if(!($value instanceof CacheItemInterface)) { |
139 | - $item = new \Stash\Item(); |
|
140 | - $item->setKey($this->getKeyName($value, $mod)); |
|
139 | + $item = new \Stash\Item(); |
|
140 | + $item->setKey($this->getKeyName($value, $mod)); |
|
141 | 141 | } |
142 | 142 | $item->set($data); |
143 | 143 | $this->cache->save($item); |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @param AbstractModule $mod Calling module |
152 | 152 | */ |
153 | 153 | public static function save($value, $data, AbstractModule $mod = null){ |
154 | - self::getInstance()->saveI($value, $data, $mod); |
|
154 | + self::getInstance()->saveI($value, $data, $mod); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | * @return bool Deletion successful? |
163 | 163 | */ |
164 | 164 | public function deleteI($value, AbstractModule $mod = null){ |
165 | - $this->checkInit(); |
|
166 | - return $this->cache->deleteItem($this->getKeyName($value, $mod)); |
|
165 | + $this->checkInit(); |
|
166 | + return $this->cache->deleteItem($this->getKeyName($value, $mod)); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @return bool Deletion successful? |
175 | 175 | */ |
176 | 176 | public static function delete($value, AbstractModule $mod = null){ |
177 | - return self::getInstance()->deleteI($value, $mod); |
|
177 | + return self::getInstance()->deleteI($value, $mod); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * |
183 | 183 | */ |
184 | 184 | public function cleanI(){ |
185 | - $this->checkInit(); |
|
185 | + $this->checkInit(); |
|
186 | 186 | $this->cache->clear(); |
187 | 187 | } |
188 | 188 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | * Static invocation of the *clean* method. |
191 | 191 | */ |
192 | 192 | public static function clean() { |
193 | - self::getInstance()->cleanI(); |
|
193 | + self::getInstance()->cleanI(); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | } |
197 | 197 | \ No newline at end of file |
@@ -17,27 +17,27 @@ |
||
17 | 17 | */ |
18 | 18 | class FunctionsPrintLists { |
19 | 19 | |
20 | - /** |
|
21 | - * Copy of core function, which is not public. |
|
22 | - * |
|
23 | - * @param Individual $individual |
|
24 | - * |
|
25 | - * @return string[] |
|
26 | - * @see \Fisharebest\Webtrees\Functions\FunctionsPrintLists |
|
27 | - */ |
|
28 | - public static function sortableNames(Individual $individual) { |
|
29 | - $names = $individual->getAllNames(); |
|
30 | - $primary = $individual->getPrimaryName(); |
|
20 | + /** |
|
21 | + * Copy of core function, which is not public. |
|
22 | + * |
|
23 | + * @param Individual $individual |
|
24 | + * |
|
25 | + * @return string[] |
|
26 | + * @see \Fisharebest\Webtrees\Functions\FunctionsPrintLists |
|
27 | + */ |
|
28 | + public static function sortableNames(Individual $individual) { |
|
29 | + $names = $individual->getAllNames(); |
|
30 | + $primary = $individual->getPrimaryName(); |
|
31 | 31 | |
32 | - list($surn, $givn) = explode(',', $names[$primary]['sort']); |
|
32 | + list($surn, $givn) = explode(',', $names[$primary]['sort']); |
|
33 | 33 | |
34 | - $givn = str_replace('@P.N.', 'AAAA', $givn); |
|
35 | - $surn = str_replace('@N.N.', 'AAAA', $surn); |
|
34 | + $givn = str_replace('@P.N.', 'AAAA', $givn); |
|
35 | + $surn = str_replace('@N.N.', 'AAAA', $surn); |
|
36 | 36 | |
37 | - return array( |
|
38 | - $surn . 'AAAA' . $givn, |
|
39 | - $givn . 'AAAA' . $surn, |
|
40 | - ); |
|
41 | - } |
|
37 | + return array( |
|
38 | + $surn . 'AAAA' . $givn, |
|
39 | + $givn . 'AAAA' . $surn, |
|
40 | + ); |
|
41 | + } |
|
42 | 42 | |
43 | 43 | } |
44 | 44 | \ No newline at end of file |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | * {@inhericDoc} |
33 | 33 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
34 | 34 | */ |
35 | - protected function renderContent() { |
|
35 | + protected function renderContent() { |
|
36 | 36 | |
37 | - if($this->data->get('has_sosa', false)) { |
|
38 | - $table_id = $this->data->get('table_id'); |
|
39 | - ?> |
|
37 | + if($this->data->get('has_sosa', false)) { |
|
38 | + $table_id = $this->data->get('table_id'); |
|
39 | + ?> |
|
40 | 40 | |
41 | 41 | <div id="sosa-fam-list" class="sosa-list"> |
42 | 42 | <table id="<?php echo $table_id; ?>"> |
@@ -176,58 +176,58 @@ discard block |
||
176 | 176 | <tbody> |
177 | 177 | |
178 | 178 | <?php foreach($this->data->get('sosa_list') as $sosa => $family) { |
179 | - /** @var \Fisharebest\Webtrees\Family $person */ |
|
179 | + /** @var \Fisharebest\Webtrees\Family $person */ |
|
180 | 180 | |
181 | - //PERSO Create decorator for Family |
|
182 | - $dfamily = new Family($family); |
|
181 | + //PERSO Create decorator for Family |
|
182 | + $dfamily = new Family($family); |
|
183 | 183 | |
184 | - $husb = $family->getHusband(); |
|
185 | - if (is_null($husb)) { |
|
186 | - $husb = new Individual('H', '0 @H@ INDI', null, $family->getTree()); |
|
187 | - } |
|
188 | - $dhusb = new \MyArtJaub\Webtrees\Individual($husb); |
|
189 | - $wife = $family->getWife(); |
|
190 | - if (is_null($wife)) { |
|
191 | - $wife = new Individual('W', '0 @W@ INDI', null, $family->getTree()); |
|
192 | - } |
|
193 | - $dwife = new \MyArtJaub\Webtrees\Individual($wife); |
|
184 | + $husb = $family->getHusband(); |
|
185 | + if (is_null($husb)) { |
|
186 | + $husb = new Individual('H', '0 @H@ INDI', null, $family->getTree()); |
|
187 | + } |
|
188 | + $dhusb = new \MyArtJaub\Webtrees\Individual($husb); |
|
189 | + $wife = $family->getWife(); |
|
190 | + if (is_null($wife)) { |
|
191 | + $wife = new Individual('W', '0 @W@ INDI', null, $family->getTree()); |
|
192 | + } |
|
193 | + $dwife = new \MyArtJaub\Webtrees\Individual($wife); |
|
194 | 194 | |
195 | - $mdate=$family->getMarriageDate(); |
|
195 | + $mdate=$family->getMarriageDate(); |
|
196 | 196 | |
197 | - if ($family->isPendingAddtion()) { |
|
198 | - $class = ' class="new"'; |
|
199 | - } elseif ($family->isPendingDeletion()) { |
|
200 | - $class = ' class="old"'; |
|
201 | - } else { |
|
202 | - $class = ''; |
|
203 | - } |
|
204 | - ?> |
|
197 | + if ($family->isPendingAddtion()) { |
|
198 | + $class = ' class="new"'; |
|
199 | + } elseif ($family->isPendingDeletion()) { |
|
200 | + $class = ' class="old"'; |
|
201 | + } else { |
|
202 | + $class = ''; |
|
203 | + } |
|
204 | + ?> |
|
205 | 205 | <tr <?= $class ?>> |
206 | 206 | <td class="transparent" data-sort="<?= $sosa ?>"><?= I18N::translate('%1$d/%2$d', $sosa, ($sosa + 1) % 10) ?></td> |
207 | 207 | <!-- HUSBAND --> |
208 | 208 | <?php list($surn_givn, $givn_surn) = FunctionsPrintLists::sortableNames($husb); ?> |
209 | 209 | <td colspan="2" data-sort="<?= Filter::escapeHtml($givn_surn) ?>"> |
210 | 210 | <?php foreach ($husb->getAllNames() as $num=>$name) { |
211 | - if ($name['type']=='NAME') { |
|
212 | - $title=''; |
|
213 | - } else { |
|
214 | - $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $husb)).'"'; |
|
215 | - } |
|
216 | - if ($num==$husb->getPrimaryName()) { |
|
217 | - $class=' class="name2"'; |
|
218 | - $sex_image=$husb->getSexImage(); |
|
219 | - } else { |
|
220 | - $class=''; |
|
221 | - $sex_image=''; |
|
222 | - } ?> |
|
211 | + if ($name['type']=='NAME') { |
|
212 | + $title=''; |
|
213 | + } else { |
|
214 | + $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $husb)).'"'; |
|
215 | + } |
|
216 | + if ($num==$husb->getPrimaryName()) { |
|
217 | + $class=' class="name2"'; |
|
218 | + $sex_image=$husb->getSexImage(); |
|
219 | + } else { |
|
220 | + $class=''; |
|
221 | + $sex_image=''; |
|
222 | + } ?> |
|
223 | 223 | <a <?php echo $title.' '.$class; ?> href="<?php echo $husb->getHtmlUrl(); ?>"> |
224 | 224 | <?php echo \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']); ?> |
225 | 225 | </a> |
226 | 226 | <?php echo $sex_image.FunctionsPrint::formatSosaNumbers($dhusb->getSosaNumbers(), 1, 'smaller'); ?> |
227 | 227 | <br/> |
228 | 228 | <?php } |
229 | - echo $husb->getPrimaryParentsNames('parents details1', 'none'); |
|
230 | - ?> |
|
229 | + echo $husb->getPrimaryParentsNames('parents details1', 'none'); |
|
230 | + ?> |
|
231 | 231 | </td> |
232 | 232 | <td hidden data-sort="<?= Filter::escapeHtml($surn_givn) ?>"></td> |
233 | 233 | <?php $hdate=$husb->getBirthDate(); ?> |
@@ -236,55 +236,55 @@ discard block |
||
236 | 236 | <?php list($surn_givn, $givn_surn) = FunctionsPrintLists::sortableNames($wife); ?> |
237 | 237 | <td colspan="2"> |
238 | 238 | <?php foreach ($wife->getAllNames() as $num=>$name) { |
239 | - if ($name['type']=='NAME') { |
|
240 | - $title=''; |
|
241 | - } else { |
|
242 | - $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $wife)).'"'; |
|
243 | - } |
|
244 | - if ($num==$wife->getPrimaryName()) { |
|
245 | - $class=' class="name2"'; |
|
246 | - $sex_image=$wife->getSexImage(); |
|
247 | - } else { |
|
248 | - $class=''; |
|
249 | - $sex_image=''; |
|
250 | - } ?> |
|
239 | + if ($name['type']=='NAME') { |
|
240 | + $title=''; |
|
241 | + } else { |
|
242 | + $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $wife)).'"'; |
|
243 | + } |
|
244 | + if ($num==$wife->getPrimaryName()) { |
|
245 | + $class=' class="name2"'; |
|
246 | + $sex_image=$wife->getSexImage(); |
|
247 | + } else { |
|
248 | + $class=''; |
|
249 | + $sex_image=''; |
|
250 | + } ?> |
|
251 | 251 | <a <?= $title.' '.$class ?> href="<?= $wife->getHtmlUrl() ?>"> |
252 | 252 | <?= \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']) ?> |
253 | 253 | </a> |
254 | 254 | <?= $sex_image.FunctionsPrint::formatSosaNumbers($dwife->getSosaNumbers(), 1, 'smaller') ?> |
255 | 255 | <br/> |
256 | 256 | <?php } |
257 | - echo $wife->getPrimaryParentsNames('parents details1', 'none'); |
|
258 | - ?> |
|
257 | + echo $wife->getPrimaryParentsNames('parents details1', 'none'); |
|
258 | + ?> |
|
259 | 259 | </td> |
260 | 260 | <td hidden data-sort="<?= Filter::escapeHtml($surn_givn) ?>"></td> |
261 | 261 | <?php $wdate=$wife->getBirthDate(); ?> |
262 | 262 | <td class="center" data-sort="<?= Date::getAge($wdate, $mdate, 1) ?>"><?= Date::getAge($wdate, $mdate, 2) ?></td> |
263 | 263 | <td data-sort="<?= $mdate->julianDay() ?>"><?php |
264 | - if ($marriage_dates = $family->getAllMarriageDates()) { |
|
265 | - foreach ($marriage_dates as $n => $marriage_date) { |
|
266 | - if ($n) { echo '<br>'; } ?> |
|
264 | + if ($marriage_dates = $family->getAllMarriageDates()) { |
|
265 | + foreach ($marriage_dates as $n => $marriage_date) { |
|
266 | + if ($n) { echo '<br>'; } ?> |
|
267 | 267 | <div><?= $marriage_date->display(true) ?></div> |
268 | 268 | <?php } |
269 | - } elseif ($family->getFacts('_NMR')) { |
|
270 | - echo I18N::translate('no'); |
|
271 | - } elseif ($family->getFacts('MARR')) { |
|
272 | - echo I18N::translate('yes'); |
|
273 | - } else { |
|
274 | - echo ' '; |
|
275 | - } ?> |
|
269 | + } elseif ($family->getFacts('_NMR')) { |
|
270 | + echo I18N::translate('no'); |
|
271 | + } elseif ($family->getFacts('MARR')) { |
|
272 | + echo I18N::translate('yes'); |
|
273 | + } else { |
|
274 | + echo ' '; |
|
275 | + } ?> |
|
276 | 276 | </td> |
277 | 277 | <td><?php |
278 | - foreach ($family->getAllMarriagePlaces() as $n => $marriage_place) { |
|
279 | - $tmp = new Place($marriage_place, $family->getTree()); |
|
280 | - if ($n) { ?><br><?php } ?> |
|
278 | + foreach ($family->getAllMarriagePlaces() as $n => $marriage_place) { |
|
279 | + $tmp = new Place($marriage_place, $family->getTree()); |
|
280 | + if ($n) { ?><br><?php } ?> |
|
281 | 281 | <a href="'<?= $tmp->getURL() ?>" title="<?= strip_tags($tmp->getFullName()) ?>"> |
282 | 282 | <?= \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName()) ?> |
283 | 283 | </a> |
284 | 284 | <?php } ?> |
285 | 285 | </td> |
286 | 286 | <?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) { |
287 | - $isMSourced = $dfamily->isMarriageSourced(); ?> |
|
287 | + $isMSourced = $dfamily->isMarriageSourced(); ?> |
|
288 | 288 | <td data-sort=<?= $isMSourced ?>><?= FunctionsPrint::formatIsSourcedIcon('E', $isMSourced, 'MARR', 1, 'medium') ?></td> |
289 | 289 | <?php } else { ?> |
290 | 290 | <td> </td> |
@@ -295,30 +295,30 @@ discard block |
||
295 | 295 | <td hidden><?php |
296 | 296 | if (!$mdate->isOK()) { echo 'U'; } |
297 | 297 | else { |
298 | - if (Date::compare($mdate, new Date(date('Y') - 100)) > 0) { echo 'Y100'; } |
|
299 | - else { echo 'YES'; } |
|
298 | + if (Date::compare($mdate, new Date(date('Y') - 100)) > 0) { echo 'Y100'; } |
|
299 | + else { echo 'YES'; } |
|
300 | 300 | } |
301 | 301 | if ($family->getFacts(WT_EVENTS_DIV)) { echo 'D'; } |
302 | 302 | if (count($husb->getSpouseFamilies()) > 1 || count($wife->getSpouseFamilies()) > 1) { |
303 | - echo 'M'; |
|
303 | + echo 'M'; |
|
304 | 304 | } ?> |
305 | 305 | </td> |
306 | 306 | <td hidden><?php |
307 | - if ($husb->isDead() && $wife->isDead()) { echo 'Y'; } |
|
308 | - if ($husb->isDead() && !$wife->isDead()) { |
|
309 | - if ($wife->getSex() == 'F') { echo 'H'; } |
|
310 | - if ($wife->getSex() == 'M') { echo 'W'; } // male partners |
|
311 | - } |
|
312 | - if (!$husb->isDead() && $wife->isDead()) { |
|
313 | - if ($husb->getSex() == 'M') { echo 'W'; } |
|
314 | - if ($husb->getSex() == 'F') { echo 'H'; } // female partners |
|
315 | - } |
|
316 | - if (!$husb->isDead() && !$wife->isDead()) { echo 'N'; } ?> |
|
307 | + if ($husb->isDead() && $wife->isDead()) { echo 'Y'; } |
|
308 | + if ($husb->isDead() && !$wife->isDead()) { |
|
309 | + if ($wife->getSex() == 'F') { echo 'H'; } |
|
310 | + if ($wife->getSex() == 'M') { echo 'W'; } // male partners |
|
311 | + } |
|
312 | + if (!$husb->isDead() && $wife->isDead()) { |
|
313 | + if ($husb->getSex() == 'M') { echo 'W'; } |
|
314 | + if ($husb->getSex() == 'F') { echo 'H'; } // female partners |
|
315 | + } |
|
316 | + if (!$husb->isDead() && !$wife->isDead()) { echo 'N'; } ?> |
|
317 | 317 | </td> |
318 | 318 | <td hidden><?php |
319 | - if (!$husb->getChildFamilies() && !$wife->getChildFamilies()) { echo 'R'; } |
|
320 | - elseif (!$husb->isDead() && !$wife->isDead() && $family->getNumberOfChildren() < 1) { echo 'L'; } |
|
321 | - else { echo ' '; } ?> |
|
319 | + if (!$husb->getChildFamilies() && !$wife->getChildFamilies()) { echo 'R'; } |
|
320 | + elseif (!$husb->isDead() && !$wife->isDead() && $family->getNumberOfChildren() < 1) { echo 'L'; } |
|
321 | + else { echo ' '; } ?> |
|
322 | 322 | </td> |
323 | 323 | </tr> |
324 | 324 | <?php } ?> |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | <p class="warning"><?= I18N::translate('No family has been found for generation %d', $this->data->get('generation')) ?></p> |
357 | 357 | <?php |
358 | 358 | } |
359 | - } |
|
359 | + } |
|
360 | 360 | |
361 | 361 | } |
362 | 362 | |
363 | 363 | \ No newline at end of file |
@@ -31,11 +31,11 @@ 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 | - if($this->data->get('has_sosa', false)) { |
|
37 | - $table_id = $this->data->get('table_id'); |
|
38 | - ?> |
|
36 | + if($this->data->get('has_sosa', false)) { |
|
37 | + $table_id = $this->data->get('table_id'); |
|
38 | + ?> |
|
39 | 39 | |
40 | 40 | <div id="sosa-indi-list" class="sosa-list"> |
41 | 41 | <table id="<?= $table_id ?>"> |
@@ -177,62 +177,62 @@ discard block |
||
177 | 177 | <tbody> |
178 | 178 | |
179 | 179 | <?php foreach($this->data->get('sosa_list') as $sosa => $person) { |
180 | - /** @var \Fisharebest\Webtrees\Individual $person */ |
|
181 | - if ($person->isPendingAddtion()) { |
|
182 | - $class = ' class="new"'; |
|
183 | - } elseif ($person->isPendingDeletion()) { |
|
184 | - $class = ' class="old"'; |
|
185 | - } else { |
|
186 | - $class = ''; |
|
187 | - } |
|
188 | - $dperson = new \MyArtJaub\Webtrees\Individual($person); |
|
189 | - ?> |
|
180 | + /** @var \Fisharebest\Webtrees\Individual $person */ |
|
181 | + if ($person->isPendingAddtion()) { |
|
182 | + $class = ' class="new"'; |
|
183 | + } elseif ($person->isPendingDeletion()) { |
|
184 | + $class = ' class="old"'; |
|
185 | + } else { |
|
186 | + $class = ''; |
|
187 | + } |
|
188 | + $dperson = new \MyArtJaub\Webtrees\Individual($person); |
|
189 | + ?> |
|
190 | 190 | <tr <?= $class ?>> |
191 | 191 | <td class="transparent"><?= $sosa ?></td> |
192 | 192 | <td hidden><?= $person->getXref() ?></td> |
193 | 193 | <?php list($surn_givn, $givn_surn) = FunctionsPrintLists::sortableNames($person); ?> |
194 | 194 | <td colspan="2" data-sort="<?= Filter::escapeHtml($givn_surn) ?>"> |
195 | 195 | <?php foreach ($person->getAllNames() as $num=>$name) { |
196 | - if ($name['type']=='NAME') { |
|
197 | - $title=''; |
|
198 | - } else { |
|
199 | - $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
200 | - } |
|
201 | - if ($num==$person->getPrimaryName()) { |
|
202 | - $class=' class="name2"'; |
|
203 | - $sex_image=$person->getSexImage(); |
|
204 | - } else { |
|
205 | - $class=''; |
|
206 | - $sex_image=''; |
|
207 | - } ?> |
|
196 | + if ($name['type']=='NAME') { |
|
197 | + $title=''; |
|
198 | + } else { |
|
199 | + $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
200 | + } |
|
201 | + if ($num==$person->getPrimaryName()) { |
|
202 | + $class=' class="name2"'; |
|
203 | + $sex_image=$person->getSexImage(); |
|
204 | + } else { |
|
205 | + $class=''; |
|
206 | + $sex_image=''; |
|
207 | + } ?> |
|
208 | 208 | <a <?= $title.' '.$class; ?> href="<?= $person->getHtmlUrl() ?>"> |
209 | 209 | <?= \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']) ?> |
210 | 210 | </a> |
211 | 211 | <?= $sex_image.FunctionsPrint::formatSosaNumbers($dperson->getSosaNumbers(), 1, 'smaller') ?> |
212 | 212 | <br/> |
213 | 213 | <?php } |
214 | - echo $person->getPrimaryParentsNames('parents details1', 'none'); |
|
215 | - ?> |
|
214 | + echo $person->getPrimaryParentsNames('parents details1', 'none'); |
|
215 | + ?> |
|
216 | 216 | </td> |
217 | 217 | <td hidden data-sort="<?= Filter::escapeHtml($surn_givn) ?>"></td> |
218 | 218 | <?php $birth_dates = $person->getAllBirthDates(); ?> |
219 | 219 | <td data-sort="<?= $person->getEstimatedBirthDate()->julianDay() ?>"> |
220 | 220 | <?php foreach ($birth_dates as $n => $birth_date) { |
221 | - if ($n > 0) { ?><br/><?php } ?> |
|
221 | + if ($n > 0) { ?><br/><?php } ?> |
|
222 | 222 | <?php echo $birth_date->display(true); |
223 | - } ?> |
|
223 | + } ?> |
|
224 | 224 | </td> |
225 | 225 | <td> |
226 | 226 | <?php foreach ($person->getAllBirthPlaces() as $n => $birth_place) { |
227 | - $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree()); |
|
228 | - if ($n > 0) { ?><br><?php } ?> |
|
227 | + $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree()); |
|
228 | + if ($n > 0) { ?><br><?php } ?> |
|
229 | 229 | <a href="'<?= $tmp->getURL() ?>" title="<?= strip_tags($tmp->getFullName()) ?>"> |
230 | 230 | <?= \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName()) ?> |
231 | 231 | </a> |
232 | 232 | <?php } ?> |
233 | 233 | </td> |
234 | 234 | <?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) { |
235 | - $isBSourced = $dperson->isBirthSourced(); ?> |
|
235 | + $isBSourced = $dperson->isBirthSourced(); ?> |
|
236 | 236 | <td data-sort="<?= $isBSourced ?>"><?= FunctionsPrint::formatIsSourcedIcon('E', $isBSourced, 'BIRT', 1, 'medium') ?></td> |
237 | 237 | <?php } else { ?> |
238 | 238 | <td> </td> |
@@ -240,63 +240,63 @@ discard block |
||
240 | 240 | <?php $death_dates = $person->getAllDeathDates(); ?> |
241 | 241 | <td data-sort="<?= $person->getEstimatedDeathDate()->julianDay() ?>"> |
242 | 242 | <?php foreach ($death_dates as $num => $death_date) { |
243 | - if ($num) { ?><br/><?php } ?> |
|
243 | + if ($num) { ?><br/><?php } ?> |
|
244 | 244 | <?php echo $death_date->display(true); |
245 | - } ?> |
|
245 | + } ?> |
|
246 | 246 | </td> |
247 | 247 | <?php if (isset($birth_dates[0]) && isset($death_dates[0])) { |
248 | - $age_at_death = Date::getAge($birth_dates[0], $death_dates[0], 0); |
|
249 | - $age_at_death_sort = Date::getAge($birth_dates[0], $death_dates[0], 2); |
|
250 | - } else { |
|
251 | - $age_at_death = ''; |
|
252 | - $age_at_death_sort = PHP_INT_MAX; |
|
253 | - } ?> |
|
248 | + $age_at_death = Date::getAge($birth_dates[0], $death_dates[0], 0); |
|
249 | + $age_at_death_sort = Date::getAge($birth_dates[0], $death_dates[0], 2); |
|
250 | + } else { |
|
251 | + $age_at_death = ''; |
|
252 | + $age_at_death_sort = PHP_INT_MAX; |
|
253 | + } ?> |
|
254 | 254 | <td class="center" data-sort="<?= $age_at_death_sort ?>"><?= $age_at_death ?></td> |
255 | 255 | <td> |
256 | 256 | <?php foreach ($person->getAllDeathPlaces() as $n => $death_place) { |
257 | - $tmp = new Place($death_place, $person->getTree()); |
|
258 | - if ($n) { ?><br><?php } ?> |
|
257 | + $tmp = new Place($death_place, $person->getTree()); |
|
258 | + if ($n) { ?><br><?php } ?> |
|
259 | 259 | <a href="'<?= $tmp->getURL() ?>" title="<?= strip_tags($tmp->getFullName()) ?>"> |
260 | 260 | <?= \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName()) ?> |
261 | 261 | </a> |
262 | 262 | <?php } ?> |
263 | 263 | </td> |
264 | 264 | <?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) { |
265 | - if($person->isDead()) { |
|
266 | - $isDSourced = $dperson->isDeathSourced(); ?> |
|
265 | + if($person->isDead()) { |
|
266 | + $isDSourced = $dperson->isDeathSourced(); ?> |
|
267 | 267 | <td data-sort=<?= $isDSourced ?>><?= FunctionsPrint::formatIsSourcedIcon('E', $isDSourced, 'DEAT', 1, 'medium') ?></td> |
268 | 268 | <?php } else { ?> |
269 | 269 | <td data-sort="-99"> </td> |
270 | 270 | <?php } |
271 | - } else { ?> |
|
271 | + } else { ?> |
|
272 | 272 | <td> </td> |
273 | 273 | <?php } ?> |
274 | 274 | <td hidden><?= $person->getSex() ?></td> |
275 | 275 | <td hidden> |
276 | 276 | <?php if (!$person->canShow() || Date::compare($person->getEstimatedBirthDate(), new Date(date('Y') - 100)) > 0) { |
277 | - echo 'Y100'; |
|
278 | - } else { |
|
279 | - echo 'YES'; |
|
280 | - } ?> |
|
277 | + echo 'Y100'; |
|
278 | + } else { |
|
279 | + echo 'YES'; |
|
280 | + } ?> |
|
281 | 281 | </td> |
282 | 282 | <td hidden> |
283 | 283 | <?php if (isset($death_dates[0]) && Date::compare($death_dates[0], new Date(date('Y') - 100)) > 0) { |
284 | - echo 'Y100'; |
|
285 | - } elseif ($person->isDead()) { |
|
286 | - echo 'YES'; |
|
287 | - } else { |
|
288 | - echo 'N'; |
|
289 | - } ?> |
|
284 | + echo 'Y100'; |
|
285 | + } elseif ($person->isDead()) { |
|
286 | + echo 'YES'; |
|
287 | + } else { |
|
288 | + echo 'N'; |
|
289 | + } ?> |
|
290 | 290 | </td> |
291 | 291 | <td hidden> |
292 | 292 | <?php if (!$person->getChildFamilies()) { |
293 | - echo 'R'; |
|
293 | + echo 'R'; |
|
294 | 294 | } // roots |
295 | 295 | elseif (!$person->isDead() && $person->getNumberOfChildren() < 1) { |
296 | - echo 'L'; |
|
296 | + echo 'L'; |
|
297 | 297 | } // leaves |
298 | 298 | else { |
299 | - echo ' '; |
|
299 | + echo ' '; |
|
300 | 300 | } ?> |
301 | 301 | </td> |
302 | 302 | </tr> |
@@ -307,12 +307,12 @@ discard block |
||
307 | 307 | <th class="ui-state-default" colspan="15"> |
308 | 308 | <div class="center"> |
309 | 309 | <?= I18N::translate('Number of Sosa ancestors: %1$s known / %2$s theoretical (%3$s)', |
310 | - I18N::number($this->data->get('sosa_count')), |
|
311 | - I18N::number($this->data->get('sosa_theo')), |
|
312 | - I18N::percentage($this->data->get('sosa_ratio'),2) |
|
313 | - ) ?> |
|
310 | + I18N::number($this->data->get('sosa_count')), |
|
311 | + I18N::number($this->data->get('sosa_theo')), |
|
312 | + I18N::percentage($this->data->get('sosa_ratio'),2) |
|
313 | + ) ?> |
|
314 | 314 | <?php if($this->data->get('sosa_hidden') > 0) { |
315 | - echo '['. I18N::translate('%s hidden', I18N::number($this->data->get('sosa_hidden'))).']'; |
|
315 | + echo '['. I18N::translate('%s hidden', I18N::number($this->data->get('sosa_hidden'))).']'; |
|
316 | 316 | } ?> |
317 | 317 | </div> |
318 | 318 | </th> |
@@ -346,8 +346,8 @@ discard block |
||
346 | 346 | </div> |
347 | 347 | </div> |
348 | 348 | <?php |
349 | - } |
|
350 | - } |
|
349 | + } |
|
350 | + } |
|
351 | 351 | |
352 | 352 | } |
353 | 353 | |
354 | 354 | \ No newline at end of file |
@@ -30,16 +30,16 @@ discard block |
||
30 | 30 | * {@inhericDoc} |
31 | 31 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
32 | 32 | */ |
33 | - protected function renderContent() { |
|
34 | - ?> |
|
33 | + protected function renderContent() { |
|
34 | + ?> |
|
35 | 35 | <div id="maj-sosa-missing-page" class="center"> |
36 | 36 | <h2><?= $this->data->get('title') ?></h2> |
37 | 37 | |
38 | 38 | <?php if($this->data->get('is_setup')) { |
39 | - $this->renderSosaHeader(); |
|
40 | - if($this->data->get('has_missing', false)) { |
|
41 | - $table_id = $this->data->get('table_id'); |
|
42 | - ?> |
|
39 | + $this->renderSosaHeader(); |
|
40 | + if($this->data->get('has_missing', false)) { |
|
41 | + $table_id = $this->data->get('table_id'); |
|
42 | + ?> |
|
43 | 43 | <div id="sosa-indi-missing" class="smissing-list"> |
44 | 44 | <table id="<?= $table_id ?>"> |
45 | 45 | <thead> |
@@ -103,48 +103,48 @@ discard block |
||
103 | 103 | <tbody> |
104 | 104 | |
105 | 105 | <?php foreach($this->data->get('missing_list') as $missing_tab) { |
106 | - $person = $missing_tab['indi']; |
|
106 | + $person = $missing_tab['indi']; |
|
107 | 107 | |
108 | - /** @var \Fisharebest\Webtrees\Individual $person */ |
|
109 | - if ($person->isPendingAddtion()) { |
|
110 | - $class = ' class="new"'; |
|
111 | - } elseif ($person->isPendingDeletion()) { |
|
112 | - $class = ' class="old"'; |
|
113 | - } else { |
|
114 | - $class = ''; |
|
115 | - } |
|
116 | - $dperson = new \MyArtJaub\Webtrees\Individual($person); |
|
117 | - list($surn_givn, $givn_surn) = FunctionsPrintLists::sortableNames($person); |
|
118 | - ?> |
|
108 | + /** @var \Fisharebest\Webtrees\Individual $person */ |
|
109 | + if ($person->isPendingAddtion()) { |
|
110 | + $class = ' class="new"'; |
|
111 | + } elseif ($person->isPendingDeletion()) { |
|
112 | + $class = ' class="old"'; |
|
113 | + } else { |
|
114 | + $class = ''; |
|
115 | + } |
|
116 | + $dperson = new \MyArtJaub\Webtrees\Individual($person); |
|
117 | + list($surn_givn, $givn_surn) = FunctionsPrintLists::sortableNames($person); |
|
118 | + ?> |
|
119 | 119 | <tr <?= $class ?>> |
120 | 120 | <td class="transparent"><?= $missing_tab['sosa'] ?></td> |
121 | 121 | <td class="transparent"><?= $person->getXref() ?></td> |
122 | 122 | <td colspan="2" data-sort="<?= Filter::escapeHtml($givn_surn) ?>"> |
123 | 123 | <?php foreach ($person->getAllNames() as $num=>$name) { |
124 | - if ($name['type']=='NAME') { |
|
125 | - $title=''; |
|
126 | - } else { |
|
127 | - $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
128 | - } |
|
129 | - if ($num==$person->getPrimaryName()) { |
|
130 | - $class=' class="name2"'; |
|
131 | - $sex_image=$person->getSexImage(); |
|
132 | - } else { |
|
133 | - $class=''; |
|
134 | - $sex_image=''; |
|
135 | - } ?> |
|
124 | + if ($name['type']=='NAME') { |
|
125 | + $title=''; |
|
126 | + } else { |
|
127 | + $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
128 | + } |
|
129 | + if ($num==$person->getPrimaryName()) { |
|
130 | + $class=' class="name2"'; |
|
131 | + $sex_image=$person->getSexImage(); |
|
132 | + } else { |
|
133 | + $class=''; |
|
134 | + $sex_image=''; |
|
135 | + } ?> |
|
136 | 136 | <a <?= $title.' '.$class ?> href="<?= $person->getHtmlUrl() ?>"> |
137 | 137 | <?= \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']) ?> |
138 | 138 | </a> |
139 | 139 | <?= $sex_image.FunctionsPrint::formatSosaNumbers($dperson->getSosaNumbers(), 1, 'smaller') ?> |
140 | 140 | <br/> |
141 | 141 | <?php } |
142 | - echo $person->getPrimaryParentsNames('parents details1', 'none'); |
|
143 | - ?> |
|
142 | + echo $person->getPrimaryParentsNames('parents details1', 'none'); |
|
143 | + ?> |
|
144 | 144 | </td> |
145 | 145 | <td hidden data-sort="<?= Filter::escapeHtml($surn_givn) ?>"></td> |
146 | 146 | <?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) { |
147 | - $isISourced = $dperson->isSourced(); ?> |
|
147 | + $isISourced = $dperson->isSourced(); ?> |
|
148 | 148 | <td data-sort="<?= $isISourced ?>"><?= FunctionsPrint::formatIsSourcedIcon('R', $isISourced, 'INDI', 1, 'medium') ?></td> |
149 | 149 | <?php } else { ?> |
150 | 150 | <td> </td> |
@@ -154,23 +154,23 @@ discard block |
||
154 | 154 | <?php $birth_dates = $person->getAllBirthDates(); ?> |
155 | 155 | <td data-sort="<?= $person->getEstimatedBirthDate()->julianDay() ?>"> |
156 | 156 | <?php |
157 | - foreach ($birth_dates as $n => $birth_date) { |
|
158 | - if ($n > 0) { ?> <br> <?php } |
|
159 | - echo $birth_date->display(true); |
|
160 | - } |
|
161 | - ?> |
|
157 | + foreach ($birth_dates as $n => $birth_date) { |
|
158 | + if ($n > 0) { ?> <br> <?php } |
|
159 | + echo $birth_date->display(true); |
|
160 | + } |
|
161 | + ?> |
|
162 | 162 | </td> |
163 | 163 | <td> |
164 | 164 | <?php foreach ($person->getAllBirthPlaces() as $n => $birth_place) { |
165 | - $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree()); |
|
166 | - if ($n > 0) { ?><br><?php } ?> |
|
165 | + $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree()); |
|
166 | + if ($n > 0) { ?><br><?php } ?> |
|
167 | 167 | <a href="'<?= $tmp->getURL(); ?>" title="<?= strip_tags($tmp->getFullName()) ?>"> |
168 | 168 | <?= \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName()) ?> |
169 | 169 | </a> |
170 | 170 | <?php } ?> |
171 | 171 | </td> |
172 | 172 | <?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) { |
173 | - $isBSourced = $dperson->isBirthSourced(); ?> |
|
173 | + $isBSourced = $dperson->isBirthSourced(); ?> |
|
174 | 174 | <td data-sort="<?= $isBSourced ?>"><?= FunctionsPrint::formatIsSourcedIcon('E', $isBSourced, 'BIRT', 1, 'medium') ?></td> |
175 | 175 | <?php } else { ?> |
176 | 176 | <td> </td> |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | <?php } else if ($this->data->get('generation', 0) > 0) { ?> |
196 | 196 | <p><?= I18N::translate('No ancestors are missing for this generation. Generation complete at %s.', I18N::percentage($this->data->get('perc_sosa'), 2)) ?></p> |
197 | 197 | <?php } |
198 | - } else { ?> |
|
198 | + } else { ?> |
|
199 | 199 | <p class="warning"><?= I18N::translate('The list could not be displayed. Reasons might be:') ?><br/> |
200 | 200 | <ul> |
201 | 201 | <li><?= I18N::translate('No Sosa root individual has been defined.') ?></li> |
@@ -206,6 +206,6 @@ discard block |
||
206 | 206 | <?php } ?> |
207 | 207 | </div> |
208 | 208 | <?php |
209 | - } |
|
209 | + } |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | \ No newline at end of file |
@@ -36,70 +36,70 @@ discard block |
||
36 | 36 | */ |
37 | 37 | class SosaListController extends MvcController |
38 | 38 | { |
39 | - /** |
|
40 | - * Sosa Provider for the controller |
|
41 | - * @var SosaProvider $sosa_provider |
|
42 | - */ |
|
43 | - protected $sosa_provider; |
|
39 | + /** |
|
40 | + * Sosa Provider for the controller |
|
41 | + * @var SosaProvider $sosa_provider |
|
42 | + */ |
|
43 | + protected $sosa_provider; |
|
44 | 44 | |
45 | - /** |
|
46 | - * Generation used for the controller |
|
47 | - * @var int $generation |
|
48 | - */ |
|
49 | - protected $generation; |
|
45 | + /** |
|
46 | + * Generation used for the controller |
|
47 | + * @var int $generation |
|
48 | + */ |
|
49 | + protected $generation; |
|
50 | 50 | |
51 | - /** |
|
52 | - * ViewBag to hold data for the controller |
|
53 | - * @var ViewBag $view_bag |
|
54 | - */ |
|
55 | - protected $view_bag; |
|
51 | + /** |
|
52 | + * ViewBag to hold data for the controller |
|
53 | + * @var ViewBag $view_bag |
|
54 | + */ |
|
55 | + protected $view_bag; |
|
56 | 56 | |
57 | - /** |
|
58 | - * {@inheritDoc} |
|
59 | - * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module) |
|
60 | - */ |
|
61 | - public function __construct(AbstractModule $module) { |
|
62 | - global $WT_TREE; |
|
57 | + /** |
|
58 | + * {@inheritDoc} |
|
59 | + * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module) |
|
60 | + */ |
|
61 | + public function __construct(AbstractModule $module) { |
|
62 | + global $WT_TREE; |
|
63 | 63 | |
64 | - parent::__construct($module); |
|
64 | + parent::__construct($module); |
|
65 | 65 | |
66 | - $this->sosa_provider = new SosaProvider($WT_TREE, Auth::user()); |
|
66 | + $this->sosa_provider = new SosaProvider($WT_TREE, Auth::user()); |
|
67 | 67 | |
68 | - $this->generation = Filter::getInteger('gen'); |
|
68 | + $this->generation = Filter::getInteger('gen'); |
|
69 | 69 | |
70 | - $this->view_bag = new ViewBag(); |
|
71 | - $this->view_bag->set('generation', $this->generation); |
|
72 | - $this->view_bag->set('max_gen', $this->sosa_provider->getLastGeneration()); |
|
73 | - $this->view_bag->set('is_setup', $this->sosa_provider->isSetup() && $this->view_bag->get('max_gen', 0)> 0); |
|
70 | + $this->view_bag = new ViewBag(); |
|
71 | + $this->view_bag->set('generation', $this->generation); |
|
72 | + $this->view_bag->set('max_gen', $this->sosa_provider->getLastGeneration()); |
|
73 | + $this->view_bag->set('is_setup', $this->sosa_provider->isSetup() && $this->view_bag->get('max_gen', 0)> 0); |
|
74 | 74 | |
75 | - } |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * Pages |
|
80 | - */ |
|
78 | + /** |
|
79 | + * Pages |
|
80 | + */ |
|
81 | 81 | |
82 | - /** |
|
83 | - * SosaList@index |
|
84 | - */ |
|
85 | - public function index() { |
|
86 | - global $WT_TREE; |
|
82 | + /** |
|
83 | + * SosaList@index |
|
84 | + */ |
|
85 | + public function index() { |
|
86 | + global $WT_TREE; |
|
87 | 87 | |
88 | - $controller = new PageController(); |
|
89 | - $controller |
|
90 | - ->setPageTitle(I18N::translate('Sosa Ancestors')); |
|
88 | + $controller = new PageController(); |
|
89 | + $controller |
|
90 | + ->setPageTitle(I18N::translate('Sosa Ancestors')); |
|
91 | 91 | |
92 | - $this->view_bag->set('title', $controller->getPageTitle()); |
|
92 | + $this->view_bag->set('title', $controller->getPageTitle()); |
|
93 | 93 | |
94 | - if($this->view_bag->get('is_setup', false)) { |
|
95 | - $this->view_bag->set('has_sosa', $this->generation > 0 && $this->sosa_provider->getSosaCountAtGeneration($this->generation) > 0); |
|
96 | - $this->view_bag->set('url_module', $this->module->getName()); |
|
97 | - $this->view_bag->set('url_action', 'SosaList'); |
|
98 | - $this->view_bag->set('url_ged', $WT_TREE->getNameUrl()); |
|
99 | - $this->view_bag->set('min_gen', 1); |
|
94 | + if($this->view_bag->get('is_setup', false)) { |
|
95 | + $this->view_bag->set('has_sosa', $this->generation > 0 && $this->sosa_provider->getSosaCountAtGeneration($this->generation) > 0); |
|
96 | + $this->view_bag->set('url_module', $this->module->getName()); |
|
97 | + $this->view_bag->set('url_action', 'SosaList'); |
|
98 | + $this->view_bag->set('url_ged', $WT_TREE->getNameUrl()); |
|
99 | + $this->view_bag->set('min_gen', 1); |
|
100 | 100 | |
101 | - if($this->view_bag->get('has_sosa', false)) { |
|
102 | - $controller->addInlineJavascript(' |
|
101 | + if($this->view_bag->get('has_sosa', false)) { |
|
102 | + $controller->addInlineJavascript(' |
|
103 | 103 | jQuery("#sosalist-tabs").tabs(); |
104 | 104 | jQuery("#sosalist-tabs").css("visibility", "visible"); |
105 | 105 | |
@@ -153,44 +153,44 @@ discard block |
||
153 | 153 | ); |
154 | 154 | |
155 | 155 | '); |
156 | - } |
|
157 | - } |
|
156 | + } |
|
157 | + } |
|
158 | 158 | |
159 | - ViewFactory::make('SosaList', $this, $controller, $this->view_bag)->render(); |
|
160 | - } |
|
159 | + ViewFactory::make('SosaList', $this, $controller, $this->view_bag)->render(); |
|
160 | + } |
|
161 | 161 | |
162 | 162 | |
163 | - /** |
|
164 | - * SosaList@missing |
|
165 | - */ |
|
166 | - public function missing() { |
|
167 | - global $WT_TREE; |
|
163 | + /** |
|
164 | + * SosaList@missing |
|
165 | + */ |
|
166 | + public function missing() { |
|
167 | + global $WT_TREE; |
|
168 | 168 | |
169 | - $controller = new PageController(); |
|
170 | - $controller |
|
171 | - ->setPageTitle(I18N::translate('Missing Ancestors')); |
|
169 | + $controller = new PageController(); |
|
170 | + $controller |
|
171 | + ->setPageTitle(I18N::translate('Missing Ancestors')); |
|
172 | 172 | |
173 | - $this->view_bag->set('title', $controller->getPageTitle()); |
|
173 | + $this->view_bag->set('title', $controller->getPageTitle()); |
|
174 | 174 | |
175 | - if($this->view_bag->get('is_setup', false)) { |
|
176 | - $this->view_bag->set('url_module', $this->module->getName()); |
|
177 | - $this->view_bag->set('url_action', 'SosaList@missing'); |
|
178 | - $this->view_bag->set('url_ged', $WT_TREE->getNameUrl()); |
|
179 | - $this->view_bag->set('min_gen', 2); |
|
175 | + if($this->view_bag->get('is_setup', false)) { |
|
176 | + $this->view_bag->set('url_module', $this->module->getName()); |
|
177 | + $this->view_bag->set('url_action', 'SosaList@missing'); |
|
178 | + $this->view_bag->set('url_ged', $WT_TREE->getNameUrl()); |
|
179 | + $this->view_bag->set('min_gen', 2); |
|
180 | 180 | |
181 | - $missing_list = $this->sosa_provider->getMissingSosaListAtGeneration($this->generation); |
|
182 | - $this->view_bag->set('has_missing', $this->generation > 0 && count($missing_list) > 0); |
|
181 | + $missing_list = $this->sosa_provider->getMissingSosaListAtGeneration($this->generation); |
|
182 | + $this->view_bag->set('has_missing', $this->generation > 0 && count($missing_list) > 0); |
|
183 | 183 | |
184 | - $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation -1)); |
|
185 | - $this->view_bag->set('perc_sosa', $perc_sosa); |
|
184 | + $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation -1)); |
|
185 | + $this->view_bag->set('perc_sosa', $perc_sosa); |
|
186 | 186 | |
187 | - if($this->view_bag->get('has_missing', false)) { |
|
188 | - $table_id = 'table-sosa-missing-' . Uuid::uuid4(); |
|
189 | - $this->view_bag->set('table_id', $table_id); |
|
187 | + if($this->view_bag->get('has_missing', false)) { |
|
188 | + $table_id = 'table-sosa-missing-' . Uuid::uuid4(); |
|
189 | + $this->view_bag->set('table_id', $table_id); |
|
190 | 190 | |
191 | - $controller |
|
192 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
193 | - ->addInlineJavascript(' |
|
191 | + $controller |
|
192 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
193 | + ->addInlineJavascript(' |
|
194 | 194 | jQuery.fn.dataTableExt.oSort["text-asc"] = textCompareAsc; |
195 | 195 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
196 | 196 | |
@@ -242,77 +242,77 @@ discard block |
||
242 | 242 | jQuery(".loading-image").css("display", "none"); |
243 | 243 | '); |
244 | 244 | |
245 | - $unique_indis = array(); |
|
246 | - $sum_missing_different = 0; |
|
247 | - $sum_missing_different_without_hidden = 0; |
|
248 | - foreach($missing_list as $num => $missing_tab) { |
|
249 | - if(isset($unique_indis[$missing_tab['indi']])) { |
|
250 | - unset($missing_list[$num]); |
|
251 | - continue; |
|
252 | - } |
|
253 | - $sum_missing_different += !$missing_tab['has_father'] + !$missing_tab['has_mother']; |
|
254 | - $person = Individual::getInstance($missing_tab['indi'], $WT_TREE); |
|
255 | - if (!$person || !$person->canShowName()) { |
|
256 | - unset($missing_list[$num]); |
|
257 | - continue; |
|
258 | - } |
|
259 | - $sum_missing_different_without_hidden += !$missing_tab['has_father'] + !$missing_tab['has_mother']; |
|
260 | - $unique_indis[$person->getXref()] = true; |
|
261 | - $missing_tab['indi'] = $person; |
|
262 | - $missing_list[$num] = $missing_tab; |
|
263 | - } |
|
264 | - $this->view_bag->set('missing_list', $missing_list); |
|
265 | - $this->view_bag->set('missing_diff_count', $sum_missing_different); |
|
266 | - $this->view_bag->set('missing_hidden', $sum_missing_different - $sum_missing_different_without_hidden); |
|
267 | - $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation-2)); |
|
268 | - $this->view_bag->set('perc_sosa_potential', $perc_sosa_potential); |
|
269 | - } |
|
270 | - } |
|
245 | + $unique_indis = array(); |
|
246 | + $sum_missing_different = 0; |
|
247 | + $sum_missing_different_without_hidden = 0; |
|
248 | + foreach($missing_list as $num => $missing_tab) { |
|
249 | + if(isset($unique_indis[$missing_tab['indi']])) { |
|
250 | + unset($missing_list[$num]); |
|
251 | + continue; |
|
252 | + } |
|
253 | + $sum_missing_different += !$missing_tab['has_father'] + !$missing_tab['has_mother']; |
|
254 | + $person = Individual::getInstance($missing_tab['indi'], $WT_TREE); |
|
255 | + if (!$person || !$person->canShowName()) { |
|
256 | + unset($missing_list[$num]); |
|
257 | + continue; |
|
258 | + } |
|
259 | + $sum_missing_different_without_hidden += !$missing_tab['has_father'] + !$missing_tab['has_mother']; |
|
260 | + $unique_indis[$person->getXref()] = true; |
|
261 | + $missing_tab['indi'] = $person; |
|
262 | + $missing_list[$num] = $missing_tab; |
|
263 | + } |
|
264 | + $this->view_bag->set('missing_list', $missing_list); |
|
265 | + $this->view_bag->set('missing_diff_count', $sum_missing_different); |
|
266 | + $this->view_bag->set('missing_hidden', $sum_missing_different - $sum_missing_different_without_hidden); |
|
267 | + $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation-2)); |
|
268 | + $this->view_bag->set('perc_sosa_potential', $perc_sosa_potential); |
|
269 | + } |
|
270 | + } |
|
271 | 271 | |
272 | - ViewFactory::make('SosaListMissing', $this, $controller, $this->view_bag)->render(); |
|
273 | - } |
|
272 | + ViewFactory::make('SosaListMissing', $this, $controller, $this->view_bag)->render(); |
|
273 | + } |
|
274 | 274 | |
275 | - /** |
|
276 | - * SosaList@sosalist |
|
277 | - */ |
|
278 | - public function sosalist() { |
|
275 | + /** |
|
276 | + * SosaList@sosalist |
|
277 | + */ |
|
278 | + public function sosalist() { |
|
279 | 279 | |
280 | - $type = Filter::get('type', 'indi|fam', null); |
|
280 | + $type = Filter::get('type', 'indi|fam', null); |
|
281 | 281 | |
282 | - $controller = new AjaxController(); |
|
283 | - $controller->restrictAccess($this->generation > 0 || !is_null($type)); |
|
282 | + $controller = new AjaxController(); |
|
283 | + $controller->restrictAccess($this->generation > 0 || !is_null($type)); |
|
284 | 284 | |
285 | - switch ($type){ |
|
286 | - case 'indi': |
|
287 | - $this->renderSosaListIndi($controller); |
|
288 | - break; |
|
289 | - case 'fam': |
|
290 | - $this->renderFamSosaListIndi($controller); |
|
291 | - break; |
|
292 | - default: |
|
293 | - break; |
|
294 | - } |
|
285 | + switch ($type){ |
|
286 | + case 'indi': |
|
287 | + $this->renderSosaListIndi($controller); |
|
288 | + break; |
|
289 | + case 'fam': |
|
290 | + $this->renderFamSosaListIndi($controller); |
|
291 | + break; |
|
292 | + default: |
|
293 | + break; |
|
294 | + } |
|
295 | 295 | |
296 | - } |
|
296 | + } |
|
297 | 297 | |
298 | - /** |
|
299 | - * Render the Ajax response for the sortable table of Sosa individuals |
|
300 | - * @param AjaxController $controller |
|
301 | - */ |
|
302 | - protected function renderSosaListIndi(AjaxController $controller) { |
|
303 | - global $WT_TREE; |
|
298 | + /** |
|
299 | + * Render the Ajax response for the sortable table of Sosa individuals |
|
300 | + * @param AjaxController $controller |
|
301 | + */ |
|
302 | + protected function renderSosaListIndi(AjaxController $controller) { |
|
303 | + global $WT_TREE; |
|
304 | 304 | |
305 | - $listSosa = $this->sosa_provider->getSosaListAtGeneration($this->generation); |
|
306 | - $this->view_bag->set('has_sosa', false); |
|
305 | + $listSosa = $this->sosa_provider->getSosaListAtGeneration($this->generation); |
|
306 | + $this->view_bag->set('has_sosa', false); |
|
307 | 307 | |
308 | - if(count($listSosa) > 0) { |
|
309 | - $this->view_bag->set('has_sosa', true); |
|
310 | - $table_id = 'table-sosa-indi-' . Uuid::uuid4(); |
|
311 | - $this->view_bag->set('table_id', $table_id); |
|
308 | + if(count($listSosa) > 0) { |
|
309 | + $this->view_bag->set('has_sosa', true); |
|
310 | + $table_id = 'table-sosa-indi-' . Uuid::uuid4(); |
|
311 | + $this->view_bag->set('table_id', $table_id); |
|
312 | 312 | |
313 | - $controller |
|
314 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
315 | - ->addInlineJavascript(' |
|
313 | + $controller |
|
314 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
315 | + ->addInlineJavascript(' |
|
316 | 316 | jQuery.fn.dataTableExt.oSort["text-asc"] = textCompareAsc; |
317 | 317 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
318 | 318 | |
@@ -379,96 +379,96 @@ discard block |
||
379 | 379 | jQuery("#btn-toggle-statistics-'.$table_id.'").click(); |
380 | 380 | '); |
381 | 381 | |
382 | - $stats = new Stats($WT_TREE); |
|
382 | + $stats = new Stats($WT_TREE); |
|
383 | 383 | |
384 | - // Bad data can cause "longest life" to be huge, blowing memory limits |
|
385 | - $max_age = min($WT_TREE->getPreference('MAX_ALIVE_AGE'), $stats->LongestLifeAge()) + 1; |
|
386 | - // Inititialise chart data |
|
387 | - $deat_by_age = array(); |
|
388 | - for ($age = 0; $age <= $max_age; $age++) { |
|
389 | - $deat_by_age[$age] = ''; |
|
390 | - } |
|
391 | - $birt_by_decade = array(); |
|
392 | - $deat_by_decade = array(); |
|
393 | - for ($year = 1550; $year < 2030; $year += 10) { |
|
394 | - $birt_by_decade[$year] = ''; |
|
395 | - $deat_by_decade[$year] = ''; |
|
396 | - } |
|
384 | + // Bad data can cause "longest life" to be huge, blowing memory limits |
|
385 | + $max_age = min($WT_TREE->getPreference('MAX_ALIVE_AGE'), $stats->LongestLifeAge()) + 1; |
|
386 | + // Inititialise chart data |
|
387 | + $deat_by_age = array(); |
|
388 | + for ($age = 0; $age <= $max_age; $age++) { |
|
389 | + $deat_by_age[$age] = ''; |
|
390 | + } |
|
391 | + $birt_by_decade = array(); |
|
392 | + $deat_by_decade = array(); |
|
393 | + for ($year = 1550; $year < 2030; $year += 10) { |
|
394 | + $birt_by_decade[$year] = ''; |
|
395 | + $deat_by_decade[$year] = ''; |
|
396 | + } |
|
397 | 397 | |
398 | - $unique_indis = array(); // Don't double-count indis with multiple names. |
|
399 | - $nb_displayed = 0; |
|
398 | + $unique_indis = array(); // Don't double-count indis with multiple names. |
|
399 | + $nb_displayed = 0; |
|
400 | 400 | |
401 | - Individual::load($WT_TREE, $listSosa); |
|
402 | - foreach($listSosa as $sosa => $pid) { |
|
403 | - $person = Individual::getInstance($pid, $WT_TREE); |
|
404 | - if (!$person || !$person->canShowName()) { |
|
405 | - unset($listSosa[$sosa]); |
|
406 | - continue; |
|
407 | - } |
|
408 | - $nb_displayed++; |
|
409 | - if ($birth_dates=$person->getAllBirthDates()) { |
|
410 | - if ( |
|
411 | - FunctionsPrint::isDateWithinChartsRange($birth_dates[0]) && |
|
412 | - !isset($unique_indis[$person->getXref()]) |
|
413 | - ) { |
|
414 | - $birt_by_decade[(int)($birth_dates[0]->gregorianYear()/10)*10] .= $person->getSex(); |
|
415 | - } |
|
416 | - } |
|
417 | - else { |
|
418 | - $birth_dates[0]=new Date(''); |
|
419 | - } |
|
420 | - if ($death_dates = $person->getAllDeathDates()) { |
|
421 | - if ( |
|
422 | - FunctionsPrint::isDateWithinChartsRange($death_dates[0]) && |
|
423 | - !isset($unique_indis[$person->getXref()]) |
|
424 | - ) { |
|
425 | - $deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
426 | - } |
|
427 | - } |
|
428 | - else { |
|
429 | - $death_dates[0] = new Date(''); |
|
430 | - } |
|
431 | - $age = Date::getAge($birth_dates[0], $death_dates[0], 0); |
|
432 | - if (!isset($unique_indis[$person->getXref()]) && $age >= 0 && $age <= $max_age) { |
|
433 | - $deat_by_age[$age] .= $person->getSex(); |
|
434 | - } |
|
435 | - $listSosa[$sosa] = $person; |
|
436 | - $unique_indis[$person->getXref()] = true; |
|
437 | - } |
|
438 | - $this->view_bag->set('sosa_list', $listSosa); |
|
401 | + Individual::load($WT_TREE, $listSosa); |
|
402 | + foreach($listSosa as $sosa => $pid) { |
|
403 | + $person = Individual::getInstance($pid, $WT_TREE); |
|
404 | + if (!$person || !$person->canShowName()) { |
|
405 | + unset($listSosa[$sosa]); |
|
406 | + continue; |
|
407 | + } |
|
408 | + $nb_displayed++; |
|
409 | + if ($birth_dates=$person->getAllBirthDates()) { |
|
410 | + if ( |
|
411 | + FunctionsPrint::isDateWithinChartsRange($birth_dates[0]) && |
|
412 | + !isset($unique_indis[$person->getXref()]) |
|
413 | + ) { |
|
414 | + $birt_by_decade[(int)($birth_dates[0]->gregorianYear()/10)*10] .= $person->getSex(); |
|
415 | + } |
|
416 | + } |
|
417 | + else { |
|
418 | + $birth_dates[0]=new Date(''); |
|
419 | + } |
|
420 | + if ($death_dates = $person->getAllDeathDates()) { |
|
421 | + if ( |
|
422 | + FunctionsPrint::isDateWithinChartsRange($death_dates[0]) && |
|
423 | + !isset($unique_indis[$person->getXref()]) |
|
424 | + ) { |
|
425 | + $deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
426 | + } |
|
427 | + } |
|
428 | + else { |
|
429 | + $death_dates[0] = new Date(''); |
|
430 | + } |
|
431 | + $age = Date::getAge($birth_dates[0], $death_dates[0], 0); |
|
432 | + if (!isset($unique_indis[$person->getXref()]) && $age >= 0 && $age <= $max_age) { |
|
433 | + $deat_by_age[$age] .= $person->getSex(); |
|
434 | + } |
|
435 | + $listSosa[$sosa] = $person; |
|
436 | + $unique_indis[$person->getXref()] = true; |
|
437 | + } |
|
438 | + $this->view_bag->set('sosa_list', $listSosa); |
|
439 | 439 | |
440 | - $this->view_bag->set('sosa_count', count($listSosa)); |
|
441 | - $this->view_bag->set('sosa_theo', pow(2, $this->generation-1)); |
|
442 | - $this->view_bag->set('sosa_ratio', Functions::safeDivision($this->view_bag->get('sosa_count'), $this->view_bag->get('sosa_theo'))); |
|
440 | + $this->view_bag->set('sosa_count', count($listSosa)); |
|
441 | + $this->view_bag->set('sosa_theo', pow(2, $this->generation-1)); |
|
442 | + $this->view_bag->set('sosa_ratio', Functions::safeDivision($this->view_bag->get('sosa_count'), $this->view_bag->get('sosa_theo'))); |
|
443 | 443 | |
444 | - $this->view_bag->set('sosa_hidden', $this->view_bag->get('sosa_count') - $nb_displayed); |
|
444 | + $this->view_bag->set('sosa_hidden', $this->view_bag->get('sosa_count') - $nb_displayed); |
|
445 | 445 | |
446 | - $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth'))); |
|
447 | - $this->view_bag->set('chart_deaths', FunctionsPrintLists::chartByDecade($deat_by_decade, I18N::translate('Decade of death'))); |
|
448 | - $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($deat_by_age, I18N::translate('Age related to death year'))); |
|
449 | - } |
|
446 | + $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth'))); |
|
447 | + $this->view_bag->set('chart_deaths', FunctionsPrintLists::chartByDecade($deat_by_decade, I18N::translate('Decade of death'))); |
|
448 | + $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($deat_by_age, I18N::translate('Age related to death year'))); |
|
449 | + } |
|
450 | 450 | |
451 | - ViewFactory::make('SosaListIndi', $this, $controller, $this->view_bag)->render(); |
|
452 | - } |
|
451 | + ViewFactory::make('SosaListIndi', $this, $controller, $this->view_bag)->render(); |
|
452 | + } |
|
453 | 453 | |
454 | - /** |
|
455 | - * Render the Ajax response for the sortable table of Sosa family |
|
456 | - * @param AjaxController $controller |
|
457 | - */ |
|
458 | - protected function renderFamSosaListIndi(AjaxController $controller) { |
|
459 | - global $WT_TREE; |
|
454 | + /** |
|
455 | + * Render the Ajax response for the sortable table of Sosa family |
|
456 | + * @param AjaxController $controller |
|
457 | + */ |
|
458 | + protected function renderFamSosaListIndi(AjaxController $controller) { |
|
459 | + global $WT_TREE; |
|
460 | 460 | |
461 | - $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation);; |
|
462 | - $this->view_bag->set('has_sosa', false); |
|
461 | + $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation);; |
|
462 | + $this->view_bag->set('has_sosa', false); |
|
463 | 463 | |
464 | - if(count($listFamSosa) > 0) { |
|
465 | - $this->view_bag->set('has_sosa', true); |
|
466 | - $table_id = 'table-sosa-fam-' . Uuid::uuid4(); |
|
467 | - $this->view_bag->set('table_id', $table_id); |
|
464 | + if(count($listFamSosa) > 0) { |
|
465 | + $this->view_bag->set('has_sosa', true); |
|
466 | + $table_id = 'table-sosa-fam-' . Uuid::uuid4(); |
|
467 | + $this->view_bag->set('table_id', $table_id); |
|
468 | 468 | |
469 | - $controller |
|
470 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
471 | - ->addInlineJavascript(' |
|
469 | + $controller |
|
470 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
471 | + ->addInlineJavascript(' |
|
472 | 472 | jQuery.fn.dataTableExt.oSort["text-asc"] = textCompareAsc; |
473 | 473 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
474 | 474 | |
@@ -532,67 +532,67 @@ discard block |
||
532 | 532 | jQuery("#btn-toggle-statistics-'.$table_id.'").click(); |
533 | 533 | '); |
534 | 534 | |
535 | - $stats = new Stats($WT_TREE); |
|
536 | - $max_age = max($stats->oldestMarriageMaleAge(), $stats->oldestMarriageFemaleAge()) + 1; |
|
535 | + $stats = new Stats($WT_TREE); |
|
536 | + $max_age = max($stats->oldestMarriageMaleAge(), $stats->oldestMarriageFemaleAge()) + 1; |
|
537 | 537 | |
538 | - //-- init chart data |
|
539 | - $marr_by_age = array(); |
|
540 | - for ($age=0; $age<=$max_age; $age++) { |
|
541 | - $marr_by_age[$age] = ''; |
|
542 | - } |
|
543 | - $birt_by_decade = array(); |
|
544 | - $marr_by_decade = array(); |
|
545 | - for ($year=1550; $year<2030; $year+=10) { |
|
546 | - $birt_by_decade[$year] = ''; |
|
547 | - $marr_by_decade[$year] = ''; |
|
548 | - } |
|
538 | + //-- init chart data |
|
539 | + $marr_by_age = array(); |
|
540 | + for ($age=0; $age<=$max_age; $age++) { |
|
541 | + $marr_by_age[$age] = ''; |
|
542 | + } |
|
543 | + $birt_by_decade = array(); |
|
544 | + $marr_by_decade = array(); |
|
545 | + for ($year=1550; $year<2030; $year+=10) { |
|
546 | + $birt_by_decade[$year] = ''; |
|
547 | + $marr_by_decade[$year] = ''; |
|
548 | + } |
|
549 | 549 | |
550 | - foreach($listFamSosa as $sosa => $fid) { |
|
551 | - $sfamily = Family::getInstance($fid, $WT_TREE); |
|
552 | - if(!$sfamily || !$sfamily->canShow()) { |
|
553 | - unset($listFamSosa[$sosa]); |
|
554 | - continue; |
|
555 | - } |
|
556 | - $mdate=$sfamily->getMarriageDate(); |
|
550 | + foreach($listFamSosa as $sosa => $fid) { |
|
551 | + $sfamily = Family::getInstance($fid, $WT_TREE); |
|
552 | + if(!$sfamily || !$sfamily->canShow()) { |
|
553 | + unset($listFamSosa[$sosa]); |
|
554 | + continue; |
|
555 | + } |
|
556 | + $mdate=$sfamily->getMarriageDate(); |
|
557 | 557 | |
558 | - if( ($husb = $sfamily->getHusband()) && |
|
559 | - ($hdate = $husb->getBirthDate()) && |
|
560 | - $hdate->isOK() && $mdate->isOK()) { |
|
561 | - if (FunctionsPrint::isDateWithinChartsRange($hdate)) { |
|
562 | - $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
563 | - } |
|
564 | - $hage = Date::getAge($hdate, $mdate, 0); |
|
565 | - if ($hage >= 0 && $hage <= $max_age) { |
|
566 | - $marr_by_age[$hage] .= $husb->getSex(); |
|
567 | - } |
|
568 | - } |
|
558 | + if( ($husb = $sfamily->getHusband()) && |
|
559 | + ($hdate = $husb->getBirthDate()) && |
|
560 | + $hdate->isOK() && $mdate->isOK()) { |
|
561 | + if (FunctionsPrint::isDateWithinChartsRange($hdate)) { |
|
562 | + $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
563 | + } |
|
564 | + $hage = Date::getAge($hdate, $mdate, 0); |
|
565 | + if ($hage >= 0 && $hage <= $max_age) { |
|
566 | + $marr_by_age[$hage] .= $husb->getSex(); |
|
567 | + } |
|
568 | + } |
|
569 | 569 | |
570 | - if(($wife = $sfamily->getWife()) && |
|
571 | - ($wdate=$wife->getBirthDate()) && |
|
572 | - $wdate->isOK() && $mdate->isOK()) { |
|
573 | - if (FunctionsPrint::isDateWithinChartsRange($wdate)) { |
|
574 | - $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
575 | - } |
|
576 | - $wage = Date::getAge($wdate, $mdate, 0); |
|
577 | - if ($wage >= 0 && $wage <= $max_age) { |
|
578 | - $marr_by_age[$wage] .= $wife->getSex(); |
|
579 | - } |
|
580 | - } |
|
570 | + if(($wife = $sfamily->getWife()) && |
|
571 | + ($wdate=$wife->getBirthDate()) && |
|
572 | + $wdate->isOK() && $mdate->isOK()) { |
|
573 | + if (FunctionsPrint::isDateWithinChartsRange($wdate)) { |
|
574 | + $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
575 | + } |
|
576 | + $wage = Date::getAge($wdate, $mdate, 0); |
|
577 | + if ($wage >= 0 && $wage <= $max_age) { |
|
578 | + $marr_by_age[$wage] .= $wife->getSex(); |
|
579 | + } |
|
580 | + } |
|
581 | 581 | |
582 | - if ($mdate->isOK() && FunctionsPrint::isDateWithinChartsRange($mdate) && $husb && $wife) { |
|
583 | - $marr_by_decade[(int) ($mdate->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex(); |
|
584 | - } |
|
582 | + if ($mdate->isOK() && FunctionsPrint::isDateWithinChartsRange($mdate) && $husb && $wife) { |
|
583 | + $marr_by_decade[(int) ($mdate->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex(); |
|
584 | + } |
|
585 | 585 | |
586 | - $listFamSosa[$sosa] = $sfamily; |
|
587 | - } |
|
588 | - $this->view_bag->set('sosa_list', $listFamSosa); |
|
586 | + $listFamSosa[$sosa] = $sfamily; |
|
587 | + } |
|
588 | + $this->view_bag->set('sosa_list', $listFamSosa); |
|
589 | 589 | |
590 | - $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth'))); |
|
591 | - $this->view_bag->set('chart_marriages', FunctionsPrintLists::chartByDecade($marr_by_decade, I18N::translate('Decade of marriage'))); |
|
592 | - $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($marr_by_age, I18N::translate('Age in year of marriage'))); |
|
593 | - } |
|
590 | + $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth'))); |
|
591 | + $this->view_bag->set('chart_marriages', FunctionsPrintLists::chartByDecade($marr_by_decade, I18N::translate('Decade of marriage'))); |
|
592 | + $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($marr_by_age, I18N::translate('Age in year of marriage'))); |
|
593 | + } |
|
594 | 594 | |
595 | - ViewFactory::make('SosaListFam', $this, $controller, $this->view_bag)->render(); |
|
596 | - } |
|
595 | + ViewFactory::make('SosaListFam', $this, $controller, $this->view_bag)->render(); |
|
596 | + } |
|
597 | 597 | |
598 | 598 | } |
599 | 599 | \ No newline at end of file |