@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * webtrees-lib: MyArtJaub library for webtrees |
|
| 4 | - * |
|
| 5 | - * @package MyArtJaub\Webtrees |
|
| 6 | - * @subpackage Hook |
|
| 7 | - * @author Jonathan Jaubart <[email protected]> |
|
| 8 | - * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
| 9 | - * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 10 | - */ |
|
| 3 | + * webtrees-lib: MyArtJaub library for webtrees |
|
| 4 | + * |
|
| 5 | + * @package MyArtJaub\Webtrees |
|
| 6 | + * @subpackage Hook |
|
| 7 | + * @author Jonathan Jaubart <[email protected]> |
|
| 8 | + * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
| 9 | + * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 10 | + */ |
|
| 11 | 11 | namespace MyArtJaub\Webtrees\Hook; |
| 12 | 12 | |
| 13 | 13 | use \Fisharebest\Webtrees as fw; |
@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * webtrees-lib: MyArtJaub library for webtrees |
|
| 4 | - * |
|
| 5 | - * @package MyArtJaub\Webtrees |
|
| 6 | - * @subpackage Hook |
|
| 7 | - * @author Jonathan Jaubart <[email protected]> |
|
| 8 | - * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
| 9 | - * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 10 | - */ |
|
| 3 | + * webtrees-lib: MyArtJaub library for webtrees |
|
| 4 | + * |
|
| 5 | + * @package MyArtJaub\Webtrees |
|
| 6 | + * @subpackage Hook |
|
| 7 | + * @author Jonathan Jaubart <[email protected]> |
|
| 8 | + * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
| 9 | + * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 10 | + */ |
|
| 11 | 11 | namespace MyArtJaub\Webtrees\Hook\HookInterfaces; |
| 12 | 12 | |
| 13 | 13 | /** |
@@ -15,12 +15,12 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | interface PageFooterExtender { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Get HTML code for extending the footer of a page. |
|
| 20 | - * |
|
| 21 | - * @return string HTML code extension |
|
| 22 | - */ |
|
| 23 | - public function hPrintFooter(); |
|
| 18 | + /** |
|
| 19 | + * Get HTML code for extending the footer of a page. |
|
| 20 | + * |
|
| 21 | + * @return string HTML code extension |
|
| 22 | + */ |
|
| 23 | + public function hPrintFooter(); |
|
| 24 | 24 | |
| 25 | 25 | } |
| 26 | 26 | |
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * webtrees-lib: MyArtJaub library for webtrees |
|
| 4 | - * |
|
| 5 | - * @package MyArtJaub\Webtrees |
|
| 6 | - * @subpackage Hook |
|
| 7 | - * @author Jonathan Jaubart <[email protected]> |
|
| 8 | - * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
| 9 | - * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 10 | - */ |
|
| 3 | + * webtrees-lib: MyArtJaub library for webtrees |
|
| 4 | + * |
|
| 5 | + * @package MyArtJaub\Webtrees |
|
| 6 | + * @subpackage Hook |
|
| 7 | + * @author Jonathan Jaubart <[email protected]> |
|
| 8 | + * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
| 9 | + * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 10 | + */ |
|
| 11 | 11 | namespace MyArtJaub\Webtrees\Hook; |
| 12 | 12 | |
| 13 | 13 | use \Fisharebest\Webtrees as fw; |
@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * webtrees-lib: MyArtJaub library for webtrees |
|
| 4 | - * |
|
| 5 | - * @package MyArtJaub\Webtrees |
|
| 6 | - * @subpackage Hook |
|
| 7 | - * @author Jonathan Jaubart <[email protected]> |
|
| 8 | - * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
| 9 | - * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 10 | - */ |
|
| 3 | + * webtrees-lib: MyArtJaub library for webtrees |
|
| 4 | + * |
|
| 5 | + * @package MyArtJaub\Webtrees |
|
| 6 | + * @subpackage Hook |
|
| 7 | + * @author Jonathan Jaubart <[email protected]> |
|
| 8 | + * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
| 9 | + * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 10 | + */ |
|
| 11 | 11 | namespace MyArtJaub\Webtrees\Hook\HookInterfaces; |
| 12 | 12 | |
| 13 | 13 | /** |
@@ -15,12 +15,12 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | interface PageHeaderExtender { |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Get HTML code for extending the header of a page. |
|
| 20 | - * |
|
| 21 | - * @return string HTML code extension |
|
| 22 | - */ |
|
| 23 | - public function hPrintHeader(); |
|
| 18 | + /** |
|
| 19 | + * Get HTML code for extending the header of a page. |
|
| 20 | + * |
|
| 21 | + * @return string HTML code extension |
|
| 22 | + */ |
|
| 23 | + public function hPrintHeader(); |
|
| 24 | 24 | |
| 25 | 25 | } |
| 26 | 26 | |
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * webtrees-lib: MyArtJaub library for webtrees |
|
| 4 | - * |
|
| 5 | - * @package MyArtJaub\Webtrees |
|
| 6 | - * @subpackage Hook |
|
| 7 | - * @author Jonathan Jaubart <[email protected]> |
|
| 8 | - * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
| 9 | - * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 10 | - */ |
|
| 3 | + * webtrees-lib: MyArtJaub library for webtrees |
|
| 4 | + * |
|
| 5 | + * @package MyArtJaub\Webtrees |
|
| 6 | + * @subpackage Hook |
|
| 7 | + * @author Jonathan Jaubart <[email protected]> |
|
| 8 | + * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
| 9 | + * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 10 | + */ |
|
| 11 | 11 | namespace MyArtJaub\Webtrees\Hook; |
| 12 | 12 | |
| 13 | 13 | use \Fisharebest\Webtrees as fw; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * @return string HTML code of the inserted flag |
| 80 | 80 | */ |
| 81 | 81 | public static function htmlPlaceIcon(\Fisharebest\Webtrees\Place $place, $icon_path , $size = 50) { |
| 82 | - return '<img class="flag_gm_h'. $size . '" src="' . $icon_path . '" title="' . $place->getGedcomName() . '" alt="' . $place->getGedcomName() . '" />'; |
|
| 82 | + return '<img class="flag_gm_h'. $size . '" src="' . $icon_path . '" title="' . $place->getGedcomName() . '" alt="' . $place->getGedcomName() . '" />'; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | * @return boolean |
| 356 | 356 | */ |
| 357 | 357 | public static function isDateWithinChartsRange(Date $date) { |
| 358 | - return $date->gregorianYear() >= 1550 && $date->gregorianYear() < 2030; |
|
| 358 | + return $date->gregorianYear() >= 1550 && $date->gregorianYear() < 2030; |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | if(!$this->gedcomrecord->canShow($access_level)) return false; |
| 93 | 93 | if($access_level === null ) |
| 94 | - $access_level = \Fisharebest\Webtrees\Auth::accessLevel($this->gedcomrecord->getTree()); |
|
| 94 | + $access_level = \Fisharebest\Webtrees\Auth::accessLevel($this->gedcomrecord->getTree()); |
|
| 95 | 95 | |
| 96 | 96 | if (isset($global_facts['SOUR'])) { |
| 97 | 97 | return $global_facts['SOUR'] >= $access_level; |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * @return int Level of sources |
| 130 | 130 | */ |
| 131 | 131 | public function isFactSourced($eventslist){ |
| 132 | - if(empty($eventslist)) return 0; |
|
| 132 | + if(empty($eventslist)) return 0; |
|
| 133 | 133 | $isSourced=0; |
| 134 | 134 | $facts = $this->gedcomrecord->getFacts($eventslist); |
| 135 | 135 | foreach($facts as $fact){ |
@@ -35,47 +35,47 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | class GeoAnalysisController extends MvcController |
| 37 | 37 | { |
| 38 | - /** |
|
| 39 | - * GeoAnalysis Provider |
|
| 40 | - * @var GeoAnalysisProvider $provider |
|
| 41 | - */ |
|
| 42 | - protected $provider; |
|
| 38 | + /** |
|
| 39 | + * GeoAnalysis Provider |
|
| 40 | + * @var GeoAnalysisProvider $provider |
|
| 41 | + */ |
|
| 42 | + protected $provider; |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * Constructor for GeoAnalysis controller |
|
| 46 | - * @param AbstractModule $module |
|
| 47 | - */ |
|
| 48 | - public function __construct(AbstractModule $module) { |
|
| 49 | - parent::__construct($module); |
|
| 44 | + /** |
|
| 45 | + * Constructor for GeoAnalysis controller |
|
| 46 | + * @param AbstractModule $module |
|
| 47 | + */ |
|
| 48 | + public function __construct(AbstractModule $module) { |
|
| 49 | + parent::__construct($module); |
|
| 50 | 50 | |
| 51 | - $this->provider = $this->module->getProvider(); |
|
| 52 | - } |
|
| 51 | + $this->provider = $this->module->getProvider(); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Pages |
|
| 56 | - */ |
|
| 54 | + /** |
|
| 55 | + * Pages |
|
| 56 | + */ |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * GeoAnalysis@index |
|
| 60 | - */ |
|
| 61 | - public function index() { |
|
| 58 | + /** |
|
| 59 | + * GeoAnalysis@index |
|
| 60 | + */ |
|
| 61 | + public function index() { |
|
| 62 | 62 | |
| 63 | - $controller = new PageController(); |
|
| 64 | - $controller->setPageTitle(I18N::translate('Sosa Geographical dispersion')); |
|
| 63 | + $controller = new PageController(); |
|
| 64 | + $controller->setPageTitle(I18N::translate('Sosa Geographical dispersion')); |
|
| 65 | 65 | |
| 66 | - $data = new ViewBag(); |
|
| 67 | - $data->set('title', $controller->getPageTitle()); |
|
| 68 | - $data->set('has_analysis', false); |
|
| 66 | + $data = new ViewBag(); |
|
| 67 | + $data->set('title', $controller->getPageTitle()); |
|
| 68 | + $data->set('has_analysis', false); |
|
| 69 | 69 | |
| 70 | - $ga_id = Filter::getInteger('ga_id'); |
|
| 70 | + $ga_id = Filter::getInteger('ga_id'); |
|
| 71 | 71 | |
| 72 | - if($ga_id && $ga = $this->provider->getGeoAnalysis($ga_id)) { |
|
| 73 | - $data->set('has_analysis', true); |
|
| 74 | - $data->set('geoanalysis', $ga); |
|
| 72 | + if($ga_id && $ga = $this->provider->getGeoAnalysis($ga_id)) { |
|
| 73 | + $data->set('has_analysis', true); |
|
| 74 | + $data->set('geoanalysis', $ga); |
|
| 75 | 75 | |
| 76 | - $controller |
|
| 77 | - ->addExternalJavascript(Constants::WT_RAPHAEL_JS_URL()) |
|
| 78 | - ->addInlineJavascript(' |
|
| 76 | + $controller |
|
| 77 | + ->addExternalJavascript(Constants::WT_RAPHAEL_JS_URL()) |
|
| 78 | + ->addInlineJavascript(' |
|
| 79 | 79 | jQuery("#geodispersion-tabs").tabs(); |
| 80 | 80 | jQuery("#geodispersion-tabs").css("visibility", "visible"); |
| 81 | 81 | |
@@ -96,133 +96,133 @@ discard block |
||
| 96 | 96 | "json" |
| 97 | 97 | ); |
| 98 | 98 | '); |
| 99 | - } |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | - ViewFactory::make('GeoAnalysis', $this, $controller, $data)->render(); |
|
| 102 | - } |
|
| 101 | + ViewFactory::make('GeoAnalysis', $this, $controller, $data)->render(); |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - /** |
|
| 105 | - * GeoAnalysis@listAll |
|
| 106 | - */ |
|
| 107 | - public function listAll() { |
|
| 104 | + /** |
|
| 105 | + * GeoAnalysis@listAll |
|
| 106 | + */ |
|
| 107 | + public function listAll() { |
|
| 108 | 108 | |
| 109 | - $controller = new PageController(); |
|
| 110 | - $controller->setPageTitle(I18N::translate('Sosa Geographical dispersion')); |
|
| 109 | + $controller = new PageController(); |
|
| 110 | + $controller->setPageTitle(I18N::translate('Sosa Geographical dispersion')); |
|
| 111 | 111 | |
| 112 | - $data = new ViewBag(); |
|
| 113 | - $data->set('title', $controller->getPageTitle()); |
|
| 114 | - $data->set('has_list', false); |
|
| 112 | + $data = new ViewBag(); |
|
| 113 | + $data->set('title', $controller->getPageTitle()); |
|
| 114 | + $data->set('has_list', false); |
|
| 115 | 115 | |
| 116 | - $ga_list = $this->provider->getGeoAnalysisList(); |
|
| 117 | - if(count($ga_list) > 0 ) { |
|
| 118 | - $data->set('has_list', true); |
|
| 119 | - $data->set('geoanalysislist', $ga_list); |
|
| 120 | - } |
|
| 116 | + $ga_list = $this->provider->getGeoAnalysisList(); |
|
| 117 | + if(count($ga_list) > 0 ) { |
|
| 118 | + $data->set('has_list', true); |
|
| 119 | + $data->set('geoanalysislist', $ga_list); |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - ViewFactory::make('GeoAnalysisList', $this, $controller, $data)->render(); |
|
| 123 | - } |
|
| 122 | + ViewFactory::make('GeoAnalysisList', $this, $controller, $data)->render(); |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | 125 | /** |
| 126 | 126 | * GeoAnalysis@setStatus |
| 127 | 127 | */ |
| 128 | - public function setStatus() { |
|
| 129 | - global $WT_TREE; |
|
| 128 | + public function setStatus() { |
|
| 129 | + global $WT_TREE; |
|
| 130 | 130 | |
| 131 | - $controller = new JsonController(); |
|
| 131 | + $controller = new JsonController(); |
|
| 132 | 132 | |
| 133 | - $ga_id = Filter::getInteger('ga_id'); |
|
| 134 | - $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 133 | + $ga_id = Filter::getInteger('ga_id'); |
|
| 134 | + $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 135 | 135 | |
| 136 | - $controller->restrictAccess( |
|
| 137 | - true // Filter::checkCsrf() -- Cannot use CSRF on a GET request (modules can only work with GET requests) |
|
| 138 | - && Auth::isManager($WT_TREE) |
|
| 139 | - && $ga !== null |
|
| 140 | - ); |
|
| 136 | + $controller->restrictAccess( |
|
| 137 | + true // Filter::checkCsrf() -- Cannot use CSRF on a GET request (modules can only work with GET requests) |
|
| 138 | + && Auth::isManager($WT_TREE) |
|
| 139 | + && $ga !== null |
|
| 140 | + ); |
|
| 141 | 141 | |
| 142 | - $status = Filter::getBool('status'); |
|
| 143 | - $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
| 144 | - try{ |
|
| 145 | - $this->provider->setGeoAnalysisStatus($ga, $status); |
|
| 146 | - $res['status'] = $status; |
|
| 142 | + $status = Filter::getBool('status'); |
|
| 143 | + $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
| 144 | + try{ |
|
| 145 | + $this->provider->setGeoAnalysisStatus($ga, $status); |
|
| 146 | + $res['status'] = $status; |
|
| 147 | 147 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been '. ($status ? 'enabled' : 'disabled') .'.'); |
| 148 | - } |
|
| 149 | - catch (\Exception $ex) { |
|
| 150 | - $res['error'] = $ex->getMessage(); |
|
| 148 | + } |
|
| 149 | + catch (\Exception $ex) { |
|
| 150 | + $res['error'] = $ex->getMessage(); |
|
| 151 | 151 | Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage()); |
| 152 | - } |
|
| 152 | + } |
|
| 153 | 153 | |
| 154 | - $controller->pageHeader(); |
|
| 155 | - if($res['error']) http_response_code(500); |
|
| 154 | + $controller->pageHeader(); |
|
| 155 | + if($res['error']) http_response_code(500); |
|
| 156 | 156 | |
| 157 | - echo \Zend_Json::encode($res); |
|
| 158 | - } |
|
| 157 | + echo \Zend_Json::encode($res); |
|
| 158 | + } |
|
| 159 | 159 | |
| 160 | 160 | /** |
| 161 | - * GeoAnalysis@delete |
|
| 162 | - */ |
|
| 163 | - public function delete() { |
|
| 164 | - global $WT_TREE; |
|
| 161 | + * GeoAnalysis@delete |
|
| 162 | + */ |
|
| 163 | + public function delete() { |
|
| 164 | + global $WT_TREE; |
|
| 165 | 165 | |
| 166 | - $controller = new JsonController(); |
|
| 166 | + $controller = new JsonController(); |
|
| 167 | 167 | |
| 168 | - $ga_id = Filter::getInteger('ga_id'); |
|
| 169 | - $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 168 | + $ga_id = Filter::getInteger('ga_id'); |
|
| 169 | + $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 170 | 170 | |
| 171 | - $controller->restrictAccess( |
|
| 172 | - true // Filter::checkCsrf() -- Cannot use CSRF on a GET request (modules can only work with GET requests) |
|
| 173 | - && Auth::isManager($WT_TREE) |
|
| 174 | - && $ga |
|
| 175 | - ); |
|
| 171 | + $controller->restrictAccess( |
|
| 172 | + true // Filter::checkCsrf() -- Cannot use CSRF on a GET request (modules can only work with GET requests) |
|
| 173 | + && Auth::isManager($WT_TREE) |
|
| 174 | + && $ga |
|
| 175 | + ); |
|
| 176 | 176 | |
| 177 | - $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
| 178 | - try{ |
|
| 179 | - $this->provider->deleteGeoAnalysis($ga); |
|
| 177 | + $res = array('geoanalysis' => $ga->getId() , 'error' => null); |
|
| 178 | + try{ |
|
| 179 | + $this->provider->deleteGeoAnalysis($ga); |
|
| 180 | 180 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" has been deleted.'); |
| 181 | - } |
|
| 182 | - catch (\Exception $ex) { |
|
| 183 | - $res['error'] = $ex->getMessage(); |
|
| 181 | + } |
|
| 182 | + catch (\Exception $ex) { |
|
| 183 | + $res['error'] = $ex->getMessage(); |
|
| 184 | 184 | Log::addErrorLog('Module '.$this->module->getName().' : Geo Analysis ID "'.$ga->getId().'" could not be deleted. Error: '. $ex->getMessage()); |
| 185 | - } |
|
| 185 | + } |
|
| 186 | 186 | |
| 187 | - $controller->pageHeader(); |
|
| 188 | - if($res['error']) http_response_code(500); |
|
| 187 | + $controller->pageHeader(); |
|
| 188 | + if($res['error']) http_response_code(500); |
|
| 189 | 189 | |
| 190 | - echo \Zend_Json::encode($res); |
|
| 191 | - } |
|
| 190 | + echo \Zend_Json::encode($res); |
|
| 191 | + } |
|
| 192 | 192 | |
| 193 | - /** |
|
| 194 | - * GeoAnalysis@dataTabs |
|
| 195 | - */ |
|
| 196 | - public function dataTabs() { |
|
| 197 | - global $WT_TREE; |
|
| 193 | + /** |
|
| 194 | + * GeoAnalysis@dataTabs |
|
| 195 | + */ |
|
| 196 | + public function dataTabs() { |
|
| 197 | + global $WT_TREE; |
|
| 198 | 198 | |
| 199 | - $controller = new JsonController(); |
|
| 199 | + $controller = new JsonController(); |
|
| 200 | 200 | |
| 201 | - $ga_id = Filter::getInteger('ga_id'); |
|
| 202 | - $ga = $this->provider->getGeoAnalysis($ga_id); |
|
| 203 | - $sosa_provider = new SosaProvider($WT_TREE, Auth::user()); |
|
| 201 | + $ga_id = Filter::getInteger('ga_id'); |
|
| 202 | + $ga = $this->provider->getGeoAnalysis($ga_id); |
|
| 203 | + $sosa_provider = new SosaProvider($WT_TREE, Auth::user()); |
|
| 204 | 204 | |
| 205 | - $controller |
|
| 206 | - ->restrictAccess($ga && $sosa_provider->isSetup()) |
|
| 207 | - ->pageHeader(); |
|
| 205 | + $controller |
|
| 206 | + ->restrictAccess($ga && $sosa_provider->isSetup()) |
|
| 207 | + ->pageHeader(); |
|
| 208 | 208 | |
| 209 | - $jsonArray = array(); |
|
| 209 | + $jsonArray = array(); |
|
| 210 | 210 | |
| 211 | - list($placesDispGeneral, $placesDispGenerations) = $ga->getAnalysisResults($sosa_provider->getAllSosaWithGenerations()); |
|
| 211 | + list($placesDispGeneral, $placesDispGenerations) = $ga->getAnalysisResults($sosa_provider->getAllSosaWithGenerations()); |
|
| 212 | 212 | |
| 213 | - $flags = array(); |
|
| 214 | - if($placesDispGeneral && $ga->getOptions() && $ga->getOptions()->isUsingFlags()) { |
|
| 215 | - $mapProvider = new GoogleMapsProvider(); |
|
| 216 | - foreach($placesDispGeneral['places'] as $place => $count) { |
|
| 217 | - $flags[$place] = $mapProvider->getPlaceIcon(new Place($place, $WT_TREE)); |
|
| 218 | - } |
|
| 219 | - } |
|
| 213 | + $flags = array(); |
|
| 214 | + if($placesDispGeneral && $ga->getOptions() && $ga->getOptions()->isUsingFlags()) { |
|
| 215 | + $mapProvider = new GoogleMapsProvider(); |
|
| 216 | + foreach($placesDispGeneral['places'] as $place => $count) { |
|
| 217 | + $flags[$place] = $mapProvider->getPlaceIcon(new Place($place, $WT_TREE)); |
|
| 218 | + } |
|
| 219 | + } |
|
| 220 | 220 | |
| 221 | - $jsonArray['generaltab'] = $this->htmlPlacesAnalysisGeneralTab($ga, $placesDispGeneral, $flags); |
|
| 222 | - $jsonArray['generationstab'] = $this->htmlPlacesAnalysisGenerationsTab($ga, $placesDispGenerations, $flags); |
|
| 221 | + $jsonArray['generaltab'] = $this->htmlPlacesAnalysisGeneralTab($ga, $placesDispGeneral, $flags); |
|
| 222 | + $jsonArray['generationstab'] = $this->htmlPlacesAnalysisGenerationsTab($ga, $placesDispGenerations, $flags); |
|
| 223 | 223 | |
| 224 | - echo \Zend_Json::encode($jsonArray); |
|
| 225 | - } |
|
| 224 | + echo \Zend_Json::encode($jsonArray); |
|
| 225 | + } |
|
| 226 | 226 | |
| 227 | 227 | /** |
| 228 | 228 | * Returns HTML code for the GeoAnalysis general tab (can be either a map or a table). |
@@ -232,70 +232,70 @@ discard block |
||
| 232 | 232 | * @param (null|array) $flags Array of flags |
| 233 | 233 | * @return string HTML code for the general tab |
| 234 | 234 | */ |
| 235 | - protected function htmlPlacesAnalysisGeneralTab(GeoAnalysis $ga, $placesGeneralResults, $flags= null) { |
|
| 236 | - global $WT_TREE; |
|
| 235 | + protected function htmlPlacesAnalysisGeneralTab(GeoAnalysis $ga, $placesGeneralResults, $flags= null) { |
|
| 236 | + global $WT_TREE; |
|
| 237 | 237 | |
| 238 | - if(!empty($placesGeneralResults)){ |
|
| 239 | - $data = new ViewBag(); |
|
| 238 | + if(!empty($placesGeneralResults)){ |
|
| 239 | + $data = new ViewBag(); |
|
| 240 | 240 | |
| 241 | - $nb_found = $placesGeneralResults['knownsum']; |
|
| 242 | - $nb_other = 0; |
|
| 243 | - if(isset($placesGeneralResults['other'])) $nb_other =$placesGeneralResults['other']; |
|
| 244 | - $nb_unknown = $placesGeneralResults['unknown']; |
|
| 241 | + $nb_found = $placesGeneralResults['knownsum']; |
|
| 242 | + $nb_other = 0; |
|
| 243 | + if(isset($placesGeneralResults['other'])) $nb_other =$placesGeneralResults['other']; |
|
| 244 | + $nb_unknown = $placesGeneralResults['unknown']; |
|
| 245 | 245 | |
| 246 | - $data->set('stats_gen_nb_found', $nb_found); |
|
| 247 | - $data->set('stats_gen_nb_other', $nb_other); |
|
| 248 | - $data->set('stats_gen_nb_unknown', $nb_unknown); |
|
| 246 | + $data->set('stats_gen_nb_found', $nb_found); |
|
| 247 | + $data->set('stats_gen_nb_other', $nb_other); |
|
| 248 | + $data->set('stats_gen_nb_unknown', $nb_unknown); |
|
| 249 | 249 | |
| 250 | - $data->set('use_flags', $ga->getOptions() && $ga->getOptions()->isUsingFlags()); |
|
| 250 | + $data->set('use_flags', $ga->getOptions() && $ga->getOptions()->isUsingFlags()); |
|
| 251 | 251 | |
| 252 | - if($ga->hasMap()) { |
|
| 253 | - $max = $placesGeneralResults['max']; |
|
| 254 | - $map = $ga->getOptions()->getMap(); |
|
| 255 | - $results_by_subdivs = $map->getSubdivisions(); |
|
| 256 | - $places_mappings = $map->getPlacesMappings(); |
|
| 257 | - foreach ($placesGeneralResults['places'] as $location => $count) { |
|
| 258 | - $levelvalues = array_reverse(array_map('trim',explode(',', $location))); |
|
| 259 | - $level_map = $ga->getAnalysisLevel() - $ga->getOptions()->getMapLevel(); |
|
| 260 | - if($level_map >= 0 && $level_map < count($levelvalues)) { |
|
| 261 | - $levelref = $levelvalues[0] . '@' . $levelvalues[$level_map]; |
|
| 262 | - if(!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; } |
|
| 263 | - } |
|
| 264 | - else { |
|
| 265 | - $levelref = $levelvalues[0]; |
|
| 266 | - } |
|
| 267 | - if(isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref]; |
|
| 268 | - if(isset($results_by_subdivs[$levelref])) { |
|
| 269 | - $count_subd = isset($results_by_subdivs[$levelref]['count']) ? $results_by_subdivs[$levelref]['count'] : 0; |
|
| 270 | - $count_subd += $count; |
|
| 271 | - $results_by_subdivs[$levelref]['count'] = $count_subd; |
|
| 272 | - $results_by_subdivs[$levelref]['transparency'] = Functions::safeDivision($count_subd, $max); |
|
| 273 | - if($ga->getOptions()->isUsingFlags() && $flags) { |
|
| 274 | - $results_by_subdivs[$levelref]['place'] = new Place($location, $WT_TREE); |
|
| 275 | - $results_by_subdivs[$levelref]['flag'] = $flags[$location]; |
|
| 276 | - } |
|
| 277 | - } |
|
| 278 | - } |
|
| 252 | + if($ga->hasMap()) { |
|
| 253 | + $max = $placesGeneralResults['max']; |
|
| 254 | + $map = $ga->getOptions()->getMap(); |
|
| 255 | + $results_by_subdivs = $map->getSubdivisions(); |
|
| 256 | + $places_mappings = $map->getPlacesMappings(); |
|
| 257 | + foreach ($placesGeneralResults['places'] as $location => $count) { |
|
| 258 | + $levelvalues = array_reverse(array_map('trim',explode(',', $location))); |
|
| 259 | + $level_map = $ga->getAnalysisLevel() - $ga->getOptions()->getMapLevel(); |
|
| 260 | + if($level_map >= 0 && $level_map < count($levelvalues)) { |
|
| 261 | + $levelref = $levelvalues[0] . '@' . $levelvalues[$level_map]; |
|
| 262 | + if(!isset($results_by_subdivs[$levelref])) { $levelref = $levelvalues[0]; } |
|
| 263 | + } |
|
| 264 | + else { |
|
| 265 | + $levelref = $levelvalues[0]; |
|
| 266 | + } |
|
| 267 | + if(isset($places_mappings[$levelref])) $levelref = $places_mappings[$levelref]; |
|
| 268 | + if(isset($results_by_subdivs[$levelref])) { |
|
| 269 | + $count_subd = isset($results_by_subdivs[$levelref]['count']) ? $results_by_subdivs[$levelref]['count'] : 0; |
|
| 270 | + $count_subd += $count; |
|
| 271 | + $results_by_subdivs[$levelref]['count'] = $count_subd; |
|
| 272 | + $results_by_subdivs[$levelref]['transparency'] = Functions::safeDivision($count_subd, $max); |
|
| 273 | + if($ga->getOptions()->isUsingFlags() && $flags) { |
|
| 274 | + $results_by_subdivs[$levelref]['place'] = new Place($location, $WT_TREE); |
|
| 275 | + $results_by_subdivs[$levelref]['flag'] = $flags[$location]; |
|
| 276 | + } |
|
| 277 | + } |
|
| 278 | + } |
|
| 279 | 279 | |
| 280 | - $data->set('map', $ga->getOptions()->getMap()); |
|
| 281 | - $data->set('results_by_subdivisions', $results_by_subdivs); |
|
| 280 | + $data->set('map', $ga->getOptions()->getMap()); |
|
| 281 | + $data->set('results_by_subdivisions', $results_by_subdivs); |
|
| 282 | 282 | |
| 283 | - $html = ViewFactory::make('GeoAnalysisTabGeneralMap', $this, new BaseController(), $data)->getHtmlPartial(); |
|
| 284 | - } |
|
| 285 | - else { |
|
| 286 | - $results = $placesGeneralResults['places']; |
|
| 287 | - arsort($results); |
|
| 288 | - $data->set('results', $results); |
|
| 289 | - $data->set('analysis_level', $ga->getAnalysisLevel()); |
|
| 283 | + $html = ViewFactory::make('GeoAnalysisTabGeneralMap', $this, new BaseController(), $data)->getHtmlPartial(); |
|
| 284 | + } |
|
| 285 | + else { |
|
| 286 | + $results = $placesGeneralResults['places']; |
|
| 287 | + arsort($results); |
|
| 288 | + $data->set('results', $results); |
|
| 289 | + $data->set('analysis_level', $ga->getAnalysisLevel()); |
|
| 290 | 290 | |
| 291 | - $html = ViewFactory::make('GeoAnalysisTabGeneralTable', $this, new BaseController(), $data)->getHtmlPartial(); |
|
| 292 | - } |
|
| 293 | - } |
|
| 294 | - else { |
|
| 295 | - $html = '<p class="warning">' . I18N::translate('No data is available for the general analysis.') . '</p>'; |
|
| 296 | - } |
|
| 297 | - return $html; |
|
| 298 | - } |
|
| 291 | + $html = ViewFactory::make('GeoAnalysisTabGeneralTable', $this, new BaseController(), $data)->getHtmlPartial(); |
|
| 292 | + } |
|
| 293 | + } |
|
| 294 | + else { |
|
| 295 | + $html = '<p class="warning">' . I18N::translate('No data is available for the general analysis.') . '</p>'; |
|
| 296 | + } |
|
| 297 | + return $html; |
|
| 298 | + } |
|
| 299 | 299 | |
| 300 | 300 | /** |
| 301 | 301 | * Returns HTML code for the GeoAnalysis generations tab. |
@@ -305,68 +305,68 @@ discard block |
||
| 305 | 305 | * @param (null|array) $flags Array of flags |
| 306 | 306 | * @return string HTML code for the generations tab |
| 307 | 307 | */ |
| 308 | - protected function htmlPlacesAnalysisGenerationsTab(GeoAnalysis $ga, $placesGenerationsResults, $flags = null) { |
|
| 309 | - global $WT_TREE; |
|
| 308 | + protected function htmlPlacesAnalysisGenerationsTab(GeoAnalysis $ga, $placesGenerationsResults, $flags = null) { |
|
| 309 | + global $WT_TREE; |
|
| 310 | 310 | |
| 311 | - if(!empty($placesGenerationsResults) && $ga->getOptions()){ |
|
| 312 | - $data = new ViewBag(); |
|
| 311 | + if(!empty($placesGenerationsResults) && $ga->getOptions()){ |
|
| 312 | + $data = new ViewBag(); |
|
| 313 | 313 | |
| 314 | - ksort($placesGenerationsResults); |
|
| 314 | + ksort($placesGenerationsResults); |
|
| 315 | 315 | |
| 316 | - $detailslevel = $ga->getOptions()->getMaxDetailsInGen(); |
|
| 317 | - $data->set('max_details_gen', $detailslevel); |
|
| 318 | - $data->set('use_flags', $ga->getOptions()->isUsingFlags()); |
|
| 319 | - $data->set('analysis_level', $ga->getAnalysisLevel()); |
|
| 320 | - $display_all_places = !is_null($detailslevel) && $detailslevel == 0; |
|
| 321 | - $data->set('display_all_places', $display_all_places); |
|
| 316 | + $detailslevel = $ga->getOptions()->getMaxDetailsInGen(); |
|
| 317 | + $data->set('max_details_gen', $detailslevel); |
|
| 318 | + $data->set('use_flags', $ga->getOptions()->isUsingFlags()); |
|
| 319 | + $data->set('analysis_level', $ga->getAnalysisLevel()); |
|
| 320 | + $display_all_places = !is_null($detailslevel) && $detailslevel == 0; |
|
| 321 | + $data->set('display_all_places', $display_all_places); |
|
| 322 | 322 | |
| 323 | - $results_by_gen = array(); |
|
| 324 | - foreach($placesGenerationsResults as $gen => $genData){ |
|
| 325 | - $sum = 0; |
|
| 326 | - $other = 0; |
|
| 327 | - $unknown = 0; |
|
| 328 | - if(isset($genData['sum'])) $sum = $genData['sum']; |
|
| 329 | - if(isset($genData['other'])) $other = $genData['other']; |
|
| 330 | - if(isset($genData['unknown'])) $unknown = $genData['unknown']; |
|
| 323 | + $results_by_gen = array(); |
|
| 324 | + foreach($placesGenerationsResults as $gen => $genData){ |
|
| 325 | + $sum = 0; |
|
| 326 | + $other = 0; |
|
| 327 | + $unknown = 0; |
|
| 328 | + if(isset($genData['sum'])) $sum = $genData['sum']; |
|
| 329 | + if(isset($genData['other'])) $other = $genData['other']; |
|
| 330 | + if(isset($genData['unknown'])) $unknown = $genData['unknown']; |
|
| 331 | 331 | |
| 332 | - if($sum > 0) { |
|
| 333 | - $results_by_gen[$gen]['sum'] = $sum; |
|
| 334 | - $results_by_gen[$gen]['other'] = $other; |
|
| 335 | - $results_by_gen[$gen]['unknown'] = $unknown; |
|
| 336 | - $results_by_gen[$gen]['places'] = array(); |
|
| 337 | - arsort($genData['places']); |
|
| 332 | + if($sum > 0) { |
|
| 333 | + $results_by_gen[$gen]['sum'] = $sum; |
|
| 334 | + $results_by_gen[$gen]['other'] = $other; |
|
| 335 | + $results_by_gen[$gen]['unknown'] = $unknown; |
|
| 336 | + $results_by_gen[$gen]['places'] = array(); |
|
| 337 | + arsort($genData['places']); |
|
| 338 | 338 | |
| 339 | - if($display_all_places){ |
|
| 340 | - foreach($genData['places'] as $placename=> $count){ |
|
| 341 | - $results_by_gen[$gen]['places'][$placename]['count'] = $count; |
|
| 339 | + if($display_all_places){ |
|
| 340 | + foreach($genData['places'] as $placename=> $count){ |
|
| 341 | + $results_by_gen[$gen]['places'][$placename]['count'] = $count; |
|
| 342 | 342 | |
| 343 | - if($ga->getOptions() && $ga->getOptions()->isUsingFlags() && ($flag = $flags[$placename]) != ''){ |
|
| 344 | - $results_by_gen[$gen]['places'][$placename]['place'] = new Place($placename, $WT_TREE); |
|
| 345 | - $results_by_gen[$gen]['places'][$placename]['flag'] = $flag; |
|
| 346 | - } |
|
| 347 | - } |
|
| 348 | - } |
|
| 349 | - else { |
|
| 350 | - $tmp = $genData['places']; |
|
| 351 | - if($other > 0) { |
|
| 352 | - $tmp = array_slice($tmp, 0, 5, true); |
|
| 353 | - $tmp['other'] = $other; |
|
| 354 | - arsort($tmp); |
|
| 355 | - } |
|
| 356 | - $results_by_gen[$gen]['places'] = array_slice($tmp, 0, 5, true); |
|
| 357 | - } |
|
| 358 | - } |
|
| 359 | - } |
|
| 343 | + if($ga->getOptions() && $ga->getOptions()->isUsingFlags() && ($flag = $flags[$placename]) != ''){ |
|
| 344 | + $results_by_gen[$gen]['places'][$placename]['place'] = new Place($placename, $WT_TREE); |
|
| 345 | + $results_by_gen[$gen]['places'][$placename]['flag'] = $flag; |
|
| 346 | + } |
|
| 347 | + } |
|
| 348 | + } |
|
| 349 | + else { |
|
| 350 | + $tmp = $genData['places']; |
|
| 351 | + if($other > 0) { |
|
| 352 | + $tmp = array_slice($tmp, 0, 5, true); |
|
| 353 | + $tmp['other'] = $other; |
|
| 354 | + arsort($tmp); |
|
| 355 | + } |
|
| 356 | + $results_by_gen[$gen]['places'] = array_slice($tmp, 0, 5, true); |
|
| 357 | + } |
|
| 358 | + } |
|
| 359 | + } |
|
| 360 | 360 | |
| 361 | - $data->set('results_by_generations', $results_by_gen); |
|
| 361 | + $data->set('results_by_generations', $results_by_gen); |
|
| 362 | 362 | |
| 363 | - $html = ViewFactory::make('GeoAnalysisTabGenerations', $this, new BaseController(), $data)->getHtmlPartial(); |
|
| 363 | + $html = ViewFactory::make('GeoAnalysisTabGenerations', $this, new BaseController(), $data)->getHtmlPartial(); |
|
| 364 | 364 | |
| 365 | - } |
|
| 366 | - else { |
|
| 367 | - $html = '<p class="warning">' . I18N::translate('No data is available for the generations analysis.') . '</p>'; |
|
| 368 | - } |
|
| 369 | - return $html; |
|
| 370 | - } |
|
| 365 | + } |
|
| 366 | + else { |
|
| 367 | + $html = '<p class="warning">' . I18N::translate('No data is available for the generations analysis.') . '</p>'; |
|
| 368 | + } |
|
| 369 | + return $html; |
|
| 370 | + } |
|
| 371 | 371 | |
| 372 | 372 | } |
| 373 | 373 | \ No newline at end of file |
@@ -32,158 +32,158 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | class CertificateController extends MvcController |
| 34 | 34 | { |
| 35 | - /** |
|
| 36 | - * Certificate Provider |
|
| 37 | - * @var CertificateProviderInterface $provider |
|
| 38 | - */ |
|
| 39 | - protected $provider; |
|
| 35 | + /** |
|
| 36 | + * Certificate Provider |
|
| 37 | + * @var CertificateProviderInterface $provider |
|
| 38 | + */ |
|
| 39 | + protected $provider; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Constructor for Certificate controller |
|
| 43 | - * @param AbstractModule $module |
|
| 44 | - */ |
|
| 45 | - public function __construct(AbstractModule $module) { |
|
| 46 | - parent::__construct($module); |
|
| 47 | - |
|
| 48 | - $this->provider = $this->module->getProvider(); |
|
| 49 | - } |
|
| 41 | + /** |
|
| 42 | + * Constructor for Certificate controller |
|
| 43 | + * @param AbstractModule $module |
|
| 44 | + */ |
|
| 45 | + public function __construct(AbstractModule $module) { |
|
| 46 | + parent::__construct($module); |
|
| 47 | + |
|
| 48 | + $this->provider = $this->module->getProvider(); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Pages |
|
| 54 | - */ |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * Certificate@index |
|
| 58 | - */ |
|
| 59 | - public function index() { |
|
| 60 | - global $WT_TREE; |
|
| 61 | - |
|
| 62 | - $controller = new PageController(); |
|
| 63 | - $controller |
|
| 64 | - ->setPageTitle(I18N::translate('Certificate')) |
|
| 65 | - ->restrictAccess( |
|
| 66 | - $this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE) |
|
| 67 | - ); |
|
| 68 | - |
|
| 69 | - $cid = Filter::get('cid'); |
|
| 70 | - |
|
| 71 | - $certificate = null; |
|
| 72 | - if(!empty($cid) && strlen($cid) > 22){ |
|
| 73 | - $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - $data = new ViewBag(); |
|
| 77 | - $data->set('title', $controller->getPageTitle()); |
|
| 78 | - |
|
| 79 | - $data->set('has_certif', false); |
|
| 80 | - if($certificate) { |
|
| 81 | - $controller->restrictAccess($certificate->canShow()); |
|
| 82 | - $data->set('title', $certificate->getTitle()); |
|
| 83 | - $data->set('has_certif', true); |
|
| 84 | - $data->set('certificate', $certificate); |
|
| 52 | + /** |
|
| 53 | + * Pages |
|
| 54 | + */ |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * Certificate@index |
|
| 58 | + */ |
|
| 59 | + public function index() { |
|
| 60 | + global $WT_TREE; |
|
| 61 | + |
|
| 62 | + $controller = new PageController(); |
|
| 63 | + $controller |
|
| 64 | + ->setPageTitle(I18N::translate('Certificate')) |
|
| 65 | + ->restrictAccess( |
|
| 66 | + $this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE) |
|
| 67 | + ); |
|
| 68 | + |
|
| 69 | + $cid = Filter::get('cid'); |
|
| 70 | + |
|
| 71 | + $certificate = null; |
|
| 72 | + if(!empty($cid) && strlen($cid) > 22){ |
|
| 73 | + $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + $data = new ViewBag(); |
|
| 77 | + $data->set('title', $controller->getPageTitle()); |
|
| 78 | + |
|
| 79 | + $data->set('has_certif', false); |
|
| 80 | + if($certificate) { |
|
| 81 | + $controller->restrictAccess($certificate->canShow()); |
|
| 82 | + $data->set('title', $certificate->getTitle()); |
|
| 83 | + $data->set('has_certif', true); |
|
| 84 | + $data->set('certificate', $certificate); |
|
| 85 | 85 | |
| 86 | - $data->set( |
|
| 87 | - 'url_certif_city', |
|
| 88 | - 'module.php?mod=' . Constants::MODULE_MAJ_CERTIF_NAME . |
|
| 89 | - '&mod_action=Certificate@listAll' . |
|
| 90 | - '&ged=' . $WT_TREE->getNameUrl() . |
|
| 91 | - '&city=' . Functions::encryptToSafeBase64($certificate->getCity()) |
|
| 92 | - ); |
|
| 86 | + $data->set( |
|
| 87 | + 'url_certif_city', |
|
| 88 | + 'module.php?mod=' . Constants::MODULE_MAJ_CERTIF_NAME . |
|
| 89 | + '&mod_action=Certificate@listAll' . |
|
| 90 | + '&ged=' . $WT_TREE->getNameUrl() . |
|
| 91 | + '&city=' . Functions::encryptToSafeBase64($certificate->getCity()) |
|
| 92 | + ); |
|
| 93 | 93 | |
| 94 | - $controller->addInlineJavascript(' |
|
| 94 | + $controller->addInlineJavascript(' |
|
| 95 | 95 | jQuery("#certificate-tabs").tabs(); |
| 96 | 96 | jQuery("#certificate-tabs").css("visibility", "visible"); |
| 97 | 97 | '); |
| 98 | 98 | |
| 99 | - $data->set('has_linked_indis', false); |
|
| 100 | - $data->set('has_linked_fams', false); |
|
| 99 | + $data->set('has_linked_indis', false); |
|
| 100 | + $data->set('has_linked_fams', false); |
|
| 101 | 101 | |
| 102 | - $linked_indis = $certificate->linkedIndividuals(); |
|
| 103 | - $linked_fams = $certificate->linkedFamilies(); |
|
| 102 | + $linked_indis = $certificate->linkedIndividuals(); |
|
| 103 | + $linked_fams = $certificate->linkedFamilies(); |
|
| 104 | 104 | |
| 105 | - if($linked_indis && count($linked_indis) > 0) { |
|
| 106 | - $data->set('has_linked_indis', true); |
|
| 107 | - $data->set('linked_indis', $linked_indis); |
|
| 108 | - } |
|
| 105 | + if($linked_indis && count($linked_indis) > 0) { |
|
| 106 | + $data->set('has_linked_indis', true); |
|
| 107 | + $data->set('linked_indis', $linked_indis); |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | - if(!empty($linked_fams)) { |
|
| 111 | - $data->set('has_linked_fams', true); |
|
| 112 | - $data->set('linked_fams', $linked_fams); |
|
| 113 | - } |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - ViewFactory::make('Certificate', $this, $controller, $data)->render(); |
|
| 117 | - } |
|
| 110 | + if(!empty($linked_fams)) { |
|
| 111 | + $data->set('has_linked_fams', true); |
|
| 112 | + $data->set('linked_fams', $linked_fams); |
|
| 113 | + } |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + ViewFactory::make('Certificate', $this, $controller, $data)->render(); |
|
| 117 | + } |
|
| 118 | 118 | |
| 119 | - /** |
|
| 120 | - * Certificate@image |
|
| 121 | - */ |
|
| 122 | - public function image() { |
|
| 123 | - global $WT_TREE; |
|
| 119 | + /** |
|
| 120 | + * Certificate@image |
|
| 121 | + */ |
|
| 122 | + public function image() { |
|
| 123 | + global $WT_TREE; |
|
| 124 | 124 | |
| 125 | - $cid = Filter::get('cid'); |
|
| 126 | - $certificate = null; |
|
| 127 | - if(!empty($cid)) $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
| 125 | + $cid = Filter::get('cid'); |
|
| 126 | + $certificate = null; |
|
| 127 | + if(!empty($cid)) $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
| 128 | 128 | |
| 129 | - $imageBuilder = new ImageBuilder($certificate); |
|
| 129 | + $imageBuilder = new ImageBuilder($certificate); |
|
| 130 | 130 | |
| 131 | - if (!empty(Filter::get('cb'))) { |
|
| 132 | - $imageBuilder->setExpireOffset($imageBuilder->getExpireOffset() * 7); |
|
| 133 | - } |
|
| 131 | + if (!empty(Filter::get('cb'))) { |
|
| 132 | + $imageBuilder->setExpireOffset($imageBuilder->getExpireOffset() * 7); |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | - $imageBuilder |
|
| 136 | - ->setShowWatermark(Auth::accessLevel($WT_TREE) >= $this->module->getSetting('MAJ_SHOW_NO_WATERMARK', Auth::PRIV_HIDE)) |
|
| 137 | - ->setFontMaxSize($this->module->getSetting('MAJ_WM_FONT_MAXSIZE', 18)) |
|
| 138 | - ->setFontColor($this->module->getSetting('MAJ_WM_FONT_COLOR', '#4D6DF3')) |
|
| 139 | - ; |
|
| 135 | + $imageBuilder |
|
| 136 | + ->setShowWatermark(Auth::accessLevel($WT_TREE) >= $this->module->getSetting('MAJ_SHOW_NO_WATERMARK', Auth::PRIV_HIDE)) |
|
| 137 | + ->setFontMaxSize($this->module->getSetting('MAJ_WM_FONT_MAXSIZE', 18)) |
|
| 138 | + ->setFontColor($this->module->getSetting('MAJ_WM_FONT_COLOR', '#4D6DF3')) |
|
| 139 | + ; |
|
| 140 | 140 | |
| 141 | - $imageBuilder->render(); |
|
| 141 | + $imageBuilder->render(); |
|
| 142 | 142 | |
| 143 | - } |
|
| 143 | + } |
|
| 144 | 144 | |
| 145 | - /** |
|
| 146 | - * Certificate@listAll |
|
| 147 | - */ |
|
| 148 | - public function listAll() { |
|
| 149 | - global $WT_TREE; |
|
| 150 | - |
|
| 151 | - $controller = new PageController(); |
|
| 152 | - $controller |
|
| 153 | - ->setPageTitle(I18N::translate('Certificates')) |
|
| 154 | - ->restrictAccess( |
|
| 155 | - $this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE) |
|
| 156 | - ); |
|
| 157 | - |
|
| 158 | - $city = Filter::get('city'); |
|
| 159 | - |
|
| 160 | - if(!empty($city) && strlen($city) > 22){ |
|
| 161 | - $city = Functions::decryptFromSafeBase64($city); |
|
| 162 | - $controller->setPageTitle(I18N::translate('Certificates for %s', $city)); |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - $data = new ViewBag(); |
|
| 166 | - $data->set('title', $controller->getPageTitle()); |
|
| 167 | - $data->set('url_module', $this->module->getName()); |
|
| 168 | - $data->set('url_action', 'Certificate@listAll'); |
|
| 169 | - $data->set('url_ged', $WT_TREE->getNameUrl()); |
|
| 170 | - |
|
| 171 | - $data->set('cities', $this->provider->getCitiesList()); |
|
| 172 | - $data->set('selected_city', $city); |
|
| 173 | - |
|
| 174 | - $data->set('has_list', false); |
|
| 175 | - if(!empty($city)) { |
|
| 176 | - $table_id = 'table-certiflist-' . Uuid::uuid4(); |
|
| 145 | + /** |
|
| 146 | + * Certificate@listAll |
|
| 147 | + */ |
|
| 148 | + public function listAll() { |
|
| 149 | + global $WT_TREE; |
|
| 150 | + |
|
| 151 | + $controller = new PageController(); |
|
| 152 | + $controller |
|
| 153 | + ->setPageTitle(I18N::translate('Certificates')) |
|
| 154 | + ->restrictAccess( |
|
| 155 | + $this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE) |
|
| 156 | + ); |
|
| 157 | + |
|
| 158 | + $city = Filter::get('city'); |
|
| 159 | + |
|
| 160 | + if(!empty($city) && strlen($city) > 22){ |
|
| 161 | + $city = Functions::decryptFromSafeBase64($city); |
|
| 162 | + $controller->setPageTitle(I18N::translate('Certificates for %s', $city)); |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + $data = new ViewBag(); |
|
| 166 | + $data->set('title', $controller->getPageTitle()); |
|
| 167 | + $data->set('url_module', $this->module->getName()); |
|
| 168 | + $data->set('url_action', 'Certificate@listAll'); |
|
| 169 | + $data->set('url_ged', $WT_TREE->getNameUrl()); |
|
| 170 | + |
|
| 171 | + $data->set('cities', $this->provider->getCitiesList()); |
|
| 172 | + $data->set('selected_city', $city); |
|
| 173 | + |
|
| 174 | + $data->set('has_list', false); |
|
| 175 | + if(!empty($city)) { |
|
| 176 | + $table_id = 'table-certiflist-' . Uuid::uuid4(); |
|
| 177 | 177 | |
| 178 | - $certif_list = $this->provider->getCertificatesList($city); |
|
| 179 | - if(!empty($certif_list)) { |
|
| 180 | - $data->set('has_list', true); |
|
| 181 | - $data->set('table_id', $table_id); |
|
| 182 | - $data->set('certificate_list', $certif_list); |
|
| 178 | + $certif_list = $this->provider->getCertificatesList($city); |
|
| 179 | + if(!empty($certif_list)) { |
|
| 180 | + $data->set('has_list', true); |
|
| 181 | + $data->set('table_id', $table_id); |
|
| 182 | + $data->set('certificate_list', $certif_list); |
|
| 183 | 183 | |
| 184 | - $controller |
|
| 185 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 186 | - ->addInlineJavascript(' |
|
| 184 | + $controller |
|
| 185 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 186 | + ->addInlineJavascript(' |
|
| 187 | 187 | /* Initialise datatables */ |
| 188 | 188 | jQuery.fn.dataTableExt.oSort["unicode-asc" ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))}; |
| 189 | 189 | jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))}; |
@@ -210,29 +210,29 @@ discard block |
||
| 210 | 210 | jQuery(".certificate-list").css("visibility", "visible"); |
| 211 | 211 | jQuery(".loading-image").css("display", "none"); |
| 212 | 212 | '); |
| 213 | - } |
|
| 214 | - } |
|
| 213 | + } |
|
| 214 | + } |
|
| 215 | 215 | |
| 216 | - ViewFactory::make('CertificatesList', $this, $controller, $data)->render(); |
|
| 216 | + ViewFactory::make('CertificatesList', $this, $controller, $data)->render(); |
|
| 217 | 217 | |
| 218 | - } |
|
| 218 | + } |
|
| 219 | 219 | |
| 220 | - /** |
|
| 221 | - * Certificate@autocomplete |
|
| 222 | - */ |
|
| 223 | - public function autocomplete() { |
|
| 224 | - global $WT_TREE; |
|
| 220 | + /** |
|
| 221 | + * Certificate@autocomplete |
|
| 222 | + */ |
|
| 223 | + public function autocomplete() { |
|
| 224 | + global $WT_TREE; |
|
| 225 | 225 | |
| 226 | - $controller = new JsonController(); |
|
| 226 | + $controller = new JsonController(); |
|
| 227 | 227 | |
| 228 | - $city = Filter::get('city'); |
|
| 229 | - $contains = Filter::get('term'); |
|
| 228 | + $city = Filter::get('city'); |
|
| 229 | + $contains = Filter::get('term'); |
|
| 230 | 230 | |
| 231 | - $controller |
|
| 232 | - ->restrictAccess(Auth::isEditor($WT_TREE) && !empty($city) && !empty($contains)) |
|
| 233 | - ->pageHeader(); |
|
| 231 | + $controller |
|
| 232 | + ->restrictAccess(Auth::isEditor($WT_TREE) && !empty($city) && !empty($contains)) |
|
| 233 | + ->pageHeader(); |
|
| 234 | 234 | |
| 235 | - $listCert = $this->provider->getCertificatesListBeginWith($city, $contains); |
|
| 236 | - echo \Zend_Json::encode($listCert); |
|
| 237 | - } |
|
| 235 | + $listCert = $this->provider->getCertificatesListBeginWith($city, $contains); |
|
| 236 | + echo \Zend_Json::encode($listCert); |
|
| 237 | + } |
|
| 238 | 238 | } |
| 239 | 239 | \ No newline at end of file |