@@ -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 |
@@ -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 | /* Initialise datatables */ |
| 195 | 195 | jQuery.fn.dataTableExt.oSort["unicode-asc" ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))}; |
| 196 | 196 | jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))}; |
@@ -250,77 +250,77 @@ discard block |
||
| 250 | 250 | jQuery(".loading-image").css("display", "none"); |
| 251 | 251 | '); |
| 252 | 252 | |
| 253 | - $unique_indis = array(); |
|
| 254 | - $sum_missing_different = 0; |
|
| 255 | - $sum_missing_different_without_hidden = 0; |
|
| 256 | - foreach($missing_list as $num => $missing_tab) { |
|
| 257 | - if(isset($unique_indis[$missing_tab['indi']])) { |
|
| 258 | - unset($missing_list[$num]); |
|
| 259 | - continue; |
|
| 260 | - } |
|
| 261 | - $sum_missing_different += !$missing_tab['has_father'] + !$missing_tab['has_mother']; |
|
| 262 | - $person = Individual::getInstance($missing_tab['indi'], $WT_TREE); |
|
| 263 | - if (!$person || !$person->canShowName()) { |
|
| 264 | - unset($missing_list[$num]); |
|
| 265 | - continue; |
|
| 266 | - } |
|
| 267 | - $sum_missing_different_without_hidden += !$missing_tab['has_father'] + !$missing_tab['has_mother']; |
|
| 268 | - $unique_indis[$person->getXref()] = true; |
|
| 269 | - $missing_tab['indi'] = $person; |
|
| 270 | - $missing_list[$num] = $missing_tab; |
|
| 271 | - } |
|
| 272 | - $this->view_bag->set('missing_list', $missing_list); |
|
| 273 | - $this->view_bag->set('missing_diff_count', $sum_missing_different); |
|
| 274 | - $this->view_bag->set('missing_hidden', $sum_missing_different - $sum_missing_different_without_hidden); |
|
| 275 | - $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation-2)); |
|
| 276 | - $this->view_bag->set('perc_sosa_potential', $perc_sosa_potential); |
|
| 277 | - } |
|
| 278 | - } |
|
| 253 | + $unique_indis = array(); |
|
| 254 | + $sum_missing_different = 0; |
|
| 255 | + $sum_missing_different_without_hidden = 0; |
|
| 256 | + foreach($missing_list as $num => $missing_tab) { |
|
| 257 | + if(isset($unique_indis[$missing_tab['indi']])) { |
|
| 258 | + unset($missing_list[$num]); |
|
| 259 | + continue; |
|
| 260 | + } |
|
| 261 | + $sum_missing_different += !$missing_tab['has_father'] + !$missing_tab['has_mother']; |
|
| 262 | + $person = Individual::getInstance($missing_tab['indi'], $WT_TREE); |
|
| 263 | + if (!$person || !$person->canShowName()) { |
|
| 264 | + unset($missing_list[$num]); |
|
| 265 | + continue; |
|
| 266 | + } |
|
| 267 | + $sum_missing_different_without_hidden += !$missing_tab['has_father'] + !$missing_tab['has_mother']; |
|
| 268 | + $unique_indis[$person->getXref()] = true; |
|
| 269 | + $missing_tab['indi'] = $person; |
|
| 270 | + $missing_list[$num] = $missing_tab; |
|
| 271 | + } |
|
| 272 | + $this->view_bag->set('missing_list', $missing_list); |
|
| 273 | + $this->view_bag->set('missing_diff_count', $sum_missing_different); |
|
| 274 | + $this->view_bag->set('missing_hidden', $sum_missing_different - $sum_missing_different_without_hidden); |
|
| 275 | + $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation-2)); |
|
| 276 | + $this->view_bag->set('perc_sosa_potential', $perc_sosa_potential); |
|
| 277 | + } |
|
| 278 | + } |
|
| 279 | 279 | |
| 280 | - ViewFactory::make('SosaListMissing', $this, $controller, $this->view_bag)->render(); |
|
| 281 | - } |
|
| 280 | + ViewFactory::make('SosaListMissing', $this, $controller, $this->view_bag)->render(); |
|
| 281 | + } |
|
| 282 | 282 | |
| 283 | - /** |
|
| 284 | - * SosaList@sosalist |
|
| 285 | - */ |
|
| 286 | - public function sosalist() { |
|
| 283 | + /** |
|
| 284 | + * SosaList@sosalist |
|
| 285 | + */ |
|
| 286 | + public function sosalist() { |
|
| 287 | 287 | |
| 288 | - $type = Filter::get('type', 'indi|fam', null); |
|
| 288 | + $type = Filter::get('type', 'indi|fam', null); |
|
| 289 | 289 | |
| 290 | - $controller = new AjaxController(); |
|
| 291 | - $controller->restrictAccess($this->generation > 0 || !is_null($type)); |
|
| 290 | + $controller = new AjaxController(); |
|
| 291 | + $controller->restrictAccess($this->generation > 0 || !is_null($type)); |
|
| 292 | 292 | |
| 293 | - switch ($type){ |
|
| 294 | - case 'indi': |
|
| 295 | - $this->renderSosaListIndi($controller); |
|
| 296 | - break; |
|
| 297 | - case 'fam': |
|
| 298 | - $this->renderFamSosaListIndi($controller); |
|
| 299 | - break; |
|
| 300 | - default: |
|
| 301 | - break; |
|
| 302 | - } |
|
| 293 | + switch ($type){ |
|
| 294 | + case 'indi': |
|
| 295 | + $this->renderSosaListIndi($controller); |
|
| 296 | + break; |
|
| 297 | + case 'fam': |
|
| 298 | + $this->renderFamSosaListIndi($controller); |
|
| 299 | + break; |
|
| 300 | + default: |
|
| 301 | + break; |
|
| 302 | + } |
|
| 303 | 303 | |
| 304 | - } |
|
| 304 | + } |
|
| 305 | 305 | |
| 306 | - /** |
|
| 307 | - * Render the Ajax response for the sortable table of Sosa individuals |
|
| 308 | - * @param AjaxController $controller |
|
| 309 | - */ |
|
| 310 | - protected function renderSosaListIndi(AjaxController $controller) { |
|
| 311 | - global $WT_TREE; |
|
| 306 | + /** |
|
| 307 | + * Render the Ajax response for the sortable table of Sosa individuals |
|
| 308 | + * @param AjaxController $controller |
|
| 309 | + */ |
|
| 310 | + protected function renderSosaListIndi(AjaxController $controller) { |
|
| 311 | + global $WT_TREE; |
|
| 312 | 312 | |
| 313 | - $listSosa = $this->sosa_provider->getSosaListAtGeneration($this->generation); |
|
| 314 | - $this->view_bag->set('has_sosa', false); |
|
| 313 | + $listSosa = $this->sosa_provider->getSosaListAtGeneration($this->generation); |
|
| 314 | + $this->view_bag->set('has_sosa', false); |
|
| 315 | 315 | |
| 316 | - if(count($listSosa) > 0) { |
|
| 317 | - $this->view_bag->set('has_sosa', true); |
|
| 318 | - $table_id = 'table-sosa-indi-' . Uuid::uuid4(); |
|
| 319 | - $this->view_bag->set('table_id', $table_id); |
|
| 316 | + if(count($listSosa) > 0) { |
|
| 317 | + $this->view_bag->set('has_sosa', true); |
|
| 318 | + $table_id = 'table-sosa-indi-' . Uuid::uuid4(); |
|
| 319 | + $this->view_bag->set('table_id', $table_id); |
|
| 320 | 320 | |
| 321 | - $controller |
|
| 322 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 323 | - ->addInlineJavascript(' |
|
| 321 | + $controller |
|
| 322 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 323 | + ->addInlineJavascript(' |
|
| 324 | 324 | jQuery.fn.dataTableExt.oSort["unicode-asc" ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))}; |
| 325 | 325 | jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))}; |
| 326 | 326 | jQuery.fn.dataTableExt.oSort["num-html-asc" ]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a<b) ? -1 : (a>b ? 1 : 0);}; |
@@ -396,96 +396,96 @@ discard block |
||
| 396 | 396 | jQuery("#btn-toggle-statistics-'.$table_id.'").click(); |
| 397 | 397 | '); |
| 398 | 398 | |
| 399 | - $stats = new Stats($WT_TREE); |
|
| 399 | + $stats = new Stats($WT_TREE); |
|
| 400 | 400 | |
| 401 | - // Bad data can cause "longest life" to be huge, blowing memory limits |
|
| 402 | - $max_age = min($WT_TREE->getPreference('MAX_ALIVE_AGE'), $stats->LongestLifeAge()) + 1; |
|
| 403 | - // Inititialise chart data |
|
| 404 | - $deat_by_age = array(); |
|
| 405 | - for ($age = 0; $age <= $max_age; $age++) { |
|
| 406 | - $deat_by_age[$age] = ''; |
|
| 407 | - } |
|
| 408 | - $birt_by_decade = array(); |
|
| 409 | - $deat_by_decade = array(); |
|
| 410 | - for ($year = 1550; $year < 2030; $year += 10) { |
|
| 411 | - $birt_by_decade[$year] = ''; |
|
| 412 | - $deat_by_decade[$year] = ''; |
|
| 413 | - } |
|
| 401 | + // Bad data can cause "longest life" to be huge, blowing memory limits |
|
| 402 | + $max_age = min($WT_TREE->getPreference('MAX_ALIVE_AGE'), $stats->LongestLifeAge()) + 1; |
|
| 403 | + // Inititialise chart data |
|
| 404 | + $deat_by_age = array(); |
|
| 405 | + for ($age = 0; $age <= $max_age; $age++) { |
|
| 406 | + $deat_by_age[$age] = ''; |
|
| 407 | + } |
|
| 408 | + $birt_by_decade = array(); |
|
| 409 | + $deat_by_decade = array(); |
|
| 410 | + for ($year = 1550; $year < 2030; $year += 10) { |
|
| 411 | + $birt_by_decade[$year] = ''; |
|
| 412 | + $deat_by_decade[$year] = ''; |
|
| 413 | + } |
|
| 414 | 414 | |
| 415 | - $unique_indis = array(); // Don't double-count indis with multiple names. |
|
| 416 | - $nb_displayed = 0; |
|
| 415 | + $unique_indis = array(); // Don't double-count indis with multiple names. |
|
| 416 | + $nb_displayed = 0; |
|
| 417 | 417 | |
| 418 | - Individual::load($WT_TREE, $listSosa); |
|
| 419 | - foreach($listSosa as $sosa => $pid) { |
|
| 420 | - $person = Individual::getInstance($pid, $WT_TREE); |
|
| 421 | - if (!$person || !$person->canShowName()) { |
|
| 422 | - unset($listSosa[$sosa]); |
|
| 423 | - continue; |
|
| 424 | - } |
|
| 425 | - $nb_displayed++; |
|
| 426 | - if ($birth_dates=$person->getAllBirthDates()) { |
|
| 427 | - if ( |
|
| 428 | - FunctionsPrint::isDateWithinChartsRange($birth_dates[0]) && |
|
| 429 | - !isset($unique_indis[$person->getXref()]) |
|
| 430 | - ) { |
|
| 431 | - $birt_by_decade[(int)($birth_dates[0]->gregorianYear()/10)*10] .= $person->getSex(); |
|
| 432 | - } |
|
| 433 | - } |
|
| 434 | - else { |
|
| 435 | - $birth_dates[0]=new Date(''); |
|
| 436 | - } |
|
| 437 | - if ($death_dates = $person->getAllDeathDates()) { |
|
| 438 | - if ( |
|
| 439 | - FunctionsPrint::isDateWithinChartsRange($death_dates[0]) && |
|
| 440 | - !isset($unique_indis[$person->getXref()]) |
|
| 441 | - ) { |
|
| 442 | - $deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
| 443 | - } |
|
| 444 | - } |
|
| 445 | - else { |
|
| 446 | - $death_dates[0] = new Date(''); |
|
| 447 | - } |
|
| 448 | - $age = Date::getAge($birth_dates[0], $death_dates[0], 0); |
|
| 449 | - if (!isset($unique_indis[$person->getXref()]) && $age >= 0 && $age <= $max_age) { |
|
| 450 | - $deat_by_age[$age] .= $person->getSex(); |
|
| 451 | - } |
|
| 452 | - $listSosa[$sosa] = $person; |
|
| 453 | - $unique_indis[$person->getXref()] = true; |
|
| 454 | - } |
|
| 455 | - $this->view_bag->set('sosa_list', $listSosa); |
|
| 418 | + Individual::load($WT_TREE, $listSosa); |
|
| 419 | + foreach($listSosa as $sosa => $pid) { |
|
| 420 | + $person = Individual::getInstance($pid, $WT_TREE); |
|
| 421 | + if (!$person || !$person->canShowName()) { |
|
| 422 | + unset($listSosa[$sosa]); |
|
| 423 | + continue; |
|
| 424 | + } |
|
| 425 | + $nb_displayed++; |
|
| 426 | + if ($birth_dates=$person->getAllBirthDates()) { |
|
| 427 | + if ( |
|
| 428 | + FunctionsPrint::isDateWithinChartsRange($birth_dates[0]) && |
|
| 429 | + !isset($unique_indis[$person->getXref()]) |
|
| 430 | + ) { |
|
| 431 | + $birt_by_decade[(int)($birth_dates[0]->gregorianYear()/10)*10] .= $person->getSex(); |
|
| 432 | + } |
|
| 433 | + } |
|
| 434 | + else { |
|
| 435 | + $birth_dates[0]=new Date(''); |
|
| 436 | + } |
|
| 437 | + if ($death_dates = $person->getAllDeathDates()) { |
|
| 438 | + if ( |
|
| 439 | + FunctionsPrint::isDateWithinChartsRange($death_dates[0]) && |
|
| 440 | + !isset($unique_indis[$person->getXref()]) |
|
| 441 | + ) { |
|
| 442 | + $deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
| 443 | + } |
|
| 444 | + } |
|
| 445 | + else { |
|
| 446 | + $death_dates[0] = new Date(''); |
|
| 447 | + } |
|
| 448 | + $age = Date::getAge($birth_dates[0], $death_dates[0], 0); |
|
| 449 | + if (!isset($unique_indis[$person->getXref()]) && $age >= 0 && $age <= $max_age) { |
|
| 450 | + $deat_by_age[$age] .= $person->getSex(); |
|
| 451 | + } |
|
| 452 | + $listSosa[$sosa] = $person; |
|
| 453 | + $unique_indis[$person->getXref()] = true; |
|
| 454 | + } |
|
| 455 | + $this->view_bag->set('sosa_list', $listSosa); |
|
| 456 | 456 | |
| 457 | - $this->view_bag->set('sosa_count', count($listSosa)); |
|
| 458 | - $this->view_bag->set('sosa_theo', pow(2, $this->generation-1)); |
|
| 459 | - $this->view_bag->set('sosa_ratio', Functions::safeDivision($this->view_bag->get('sosa_count'), $this->view_bag->get('sosa_theo'))); |
|
| 457 | + $this->view_bag->set('sosa_count', count($listSosa)); |
|
| 458 | + $this->view_bag->set('sosa_theo', pow(2, $this->generation-1)); |
|
| 459 | + $this->view_bag->set('sosa_ratio', Functions::safeDivision($this->view_bag->get('sosa_count'), $this->view_bag->get('sosa_theo'))); |
|
| 460 | 460 | |
| 461 | - $this->view_bag->set('sosa_hidden', $this->view_bag->get('sosa_count') - $nb_displayed); |
|
| 461 | + $this->view_bag->set('sosa_hidden', $this->view_bag->get('sosa_count') - $nb_displayed); |
|
| 462 | 462 | |
| 463 | - $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth'))); |
|
| 464 | - $this->view_bag->set('chart_deaths', FunctionsPrintLists::chartByDecade($deat_by_decade, I18N::translate('Decade of death'))); |
|
| 465 | - $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($deat_by_age, I18N::translate('Age related to death year'))); |
|
| 466 | - } |
|
| 463 | + $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth'))); |
|
| 464 | + $this->view_bag->set('chart_deaths', FunctionsPrintLists::chartByDecade($deat_by_decade, I18N::translate('Decade of death'))); |
|
| 465 | + $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($deat_by_age, I18N::translate('Age related to death year'))); |
|
| 466 | + } |
|
| 467 | 467 | |
| 468 | - ViewFactory::make('SosaListIndi', $this, $controller, $this->view_bag)->render(); |
|
| 469 | - } |
|
| 468 | + ViewFactory::make('SosaListIndi', $this, $controller, $this->view_bag)->render(); |
|
| 469 | + } |
|
| 470 | 470 | |
| 471 | - /** |
|
| 472 | - * Render the Ajax response for the sortable table of Sosa family |
|
| 473 | - * @param AjaxController $controller |
|
| 474 | - */ |
|
| 475 | - protected function renderFamSosaListIndi(AjaxController $controller) { |
|
| 476 | - global $WT_TREE; |
|
| 471 | + /** |
|
| 472 | + * Render the Ajax response for the sortable table of Sosa family |
|
| 473 | + * @param AjaxController $controller |
|
| 474 | + */ |
|
| 475 | + protected function renderFamSosaListIndi(AjaxController $controller) { |
|
| 476 | + global $WT_TREE; |
|
| 477 | 477 | |
| 478 | - $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation);; |
|
| 479 | - $this->view_bag->set('has_sosa', false); |
|
| 478 | + $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation);; |
|
| 479 | + $this->view_bag->set('has_sosa', false); |
|
| 480 | 480 | |
| 481 | - if(count($listFamSosa) > 0) { |
|
| 482 | - $this->view_bag->set('has_sosa', true); |
|
| 483 | - $table_id = 'table-sosa-fam-' . Uuid::uuid4(); |
|
| 484 | - $this->view_bag->set('table_id', $table_id); |
|
| 481 | + if(count($listFamSosa) > 0) { |
|
| 482 | + $this->view_bag->set('has_sosa', true); |
|
| 483 | + $table_id = 'table-sosa-fam-' . Uuid::uuid4(); |
|
| 484 | + $this->view_bag->set('table_id', $table_id); |
|
| 485 | 485 | |
| 486 | - $controller |
|
| 487 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 488 | - ->addInlineJavascript(' |
|
| 486 | + $controller |
|
| 487 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 488 | + ->addInlineJavascript(' |
|
| 489 | 489 | jQuery.fn.dataTableExt.oSort["unicode-asc" ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))}; |
| 490 | 490 | jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))}; |
| 491 | 491 | jQuery.fn.dataTableExt.oSort["num-html-asc" ]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a<b) ? -1 : (a>b ? 1 : 0);}; |
@@ -561,67 +561,67 @@ discard block |
||
| 561 | 561 | jQuery("#btn-toggle-statistics-'.$table_id.'").click(); |
| 562 | 562 | '); |
| 563 | 563 | |
| 564 | - $stats = new Stats($WT_TREE); |
|
| 565 | - $max_age = max($stats->oldestMarriageMaleAge(), $stats->oldestMarriageFemaleAge()) + 1; |
|
| 564 | + $stats = new Stats($WT_TREE); |
|
| 565 | + $max_age = max($stats->oldestMarriageMaleAge(), $stats->oldestMarriageFemaleAge()) + 1; |
|
| 566 | 566 | |
| 567 | - //-- init chart data |
|
| 568 | - $marr_by_age = array(); |
|
| 569 | - for ($age=0; $age<=$max_age; $age++) { |
|
| 570 | - $marr_by_age[$age] = ''; |
|
| 571 | - } |
|
| 572 | - $birt_by_decade = array(); |
|
| 573 | - $marr_by_decade = array(); |
|
| 574 | - for ($year=1550; $year<2030; $year+=10) { |
|
| 575 | - $birt_by_decade[$year] = ''; |
|
| 576 | - $marr_by_decade[$year] = ''; |
|
| 577 | - } |
|
| 567 | + //-- init chart data |
|
| 568 | + $marr_by_age = array(); |
|
| 569 | + for ($age=0; $age<=$max_age; $age++) { |
|
| 570 | + $marr_by_age[$age] = ''; |
|
| 571 | + } |
|
| 572 | + $birt_by_decade = array(); |
|
| 573 | + $marr_by_decade = array(); |
|
| 574 | + for ($year=1550; $year<2030; $year+=10) { |
|
| 575 | + $birt_by_decade[$year] = ''; |
|
| 576 | + $marr_by_decade[$year] = ''; |
|
| 577 | + } |
|
| 578 | 578 | |
| 579 | - foreach($listFamSosa as $sosa => $fid) { |
|
| 580 | - $sfamily = Family::getInstance($fid, $WT_TREE); |
|
| 581 | - if(!$sfamily || !$sfamily->canShow()) { |
|
| 582 | - unset($sfamily[$sosa]); |
|
| 583 | - continue; |
|
| 584 | - } |
|
| 585 | - $mdate=$sfamily->getMarriageDate(); |
|
| 579 | + foreach($listFamSosa as $sosa => $fid) { |
|
| 580 | + $sfamily = Family::getInstance($fid, $WT_TREE); |
|
| 581 | + if(!$sfamily || !$sfamily->canShow()) { |
|
| 582 | + unset($sfamily[$sosa]); |
|
| 583 | + continue; |
|
| 584 | + } |
|
| 585 | + $mdate=$sfamily->getMarriageDate(); |
|
| 586 | 586 | |
| 587 | - if( ($husb = $sfamily->getHusband()) && |
|
| 588 | - ($hdate = $husb->getBirthDate()) && |
|
| 589 | - $hdate->isOK() && $mdate->isOK()) { |
|
| 590 | - if (FunctionsPrint::isDateWithinChartsRange($hdate)) { |
|
| 591 | - $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
| 592 | - } |
|
| 593 | - $hage = Date::getAge($hdate, $mdate, 0); |
|
| 594 | - if ($hage >= 0 && $hage <= $max_age) { |
|
| 595 | - $marr_by_age[$hage] .= $husb->getSex(); |
|
| 596 | - } |
|
| 597 | - } |
|
| 587 | + if( ($husb = $sfamily->getHusband()) && |
|
| 588 | + ($hdate = $husb->getBirthDate()) && |
|
| 589 | + $hdate->isOK() && $mdate->isOK()) { |
|
| 590 | + if (FunctionsPrint::isDateWithinChartsRange($hdate)) { |
|
| 591 | + $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
| 592 | + } |
|
| 593 | + $hage = Date::getAge($hdate, $mdate, 0); |
|
| 594 | + if ($hage >= 0 && $hage <= $max_age) { |
|
| 595 | + $marr_by_age[$hage] .= $husb->getSex(); |
|
| 596 | + } |
|
| 597 | + } |
|
| 598 | 598 | |
| 599 | - if(($wife = $sfamily->getWife()) && |
|
| 600 | - ($wdate=$wife->getBirthDate()) && |
|
| 601 | - $wdate->isOK() && $mdate->isOK()) { |
|
| 602 | - if (FunctionsPrint::isDateWithinChartsRange($wdate)) { |
|
| 603 | - $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
| 604 | - } |
|
| 605 | - $wage = Date::getAge($wdate, $mdate, 0); |
|
| 606 | - if ($wage >= 0 && $wage <= $max_age) { |
|
| 607 | - $marr_by_age[$wage] .= $wife->getSex(); |
|
| 608 | - } |
|
| 609 | - } |
|
| 599 | + if(($wife = $sfamily->getWife()) && |
|
| 600 | + ($wdate=$wife->getBirthDate()) && |
|
| 601 | + $wdate->isOK() && $mdate->isOK()) { |
|
| 602 | + if (FunctionsPrint::isDateWithinChartsRange($wdate)) { |
|
| 603 | + $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
| 604 | + } |
|
| 605 | + $wage = Date::getAge($wdate, $mdate, 0); |
|
| 606 | + if ($wage >= 0 && $wage <= $max_age) { |
|
| 607 | + $marr_by_age[$wage] .= $wife->getSex(); |
|
| 608 | + } |
|
| 609 | + } |
|
| 610 | 610 | |
| 611 | - if ($mdate->isOK() && FunctionsPrint::isDateWithinChartsRange($mdate) && $husb && $wife) { |
|
| 612 | - $marr_by_decade[(int) ($mdate->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex(); |
|
| 613 | - } |
|
| 611 | + if ($mdate->isOK() && FunctionsPrint::isDateWithinChartsRange($mdate) && $husb && $wife) { |
|
| 612 | + $marr_by_decade[(int) ($mdate->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex(); |
|
| 613 | + } |
|
| 614 | 614 | |
| 615 | - $listFamSosa[$sosa] = $sfamily; |
|
| 616 | - } |
|
| 617 | - $this->view_bag->set('sosa_list', $listFamSosa); |
|
| 615 | + $listFamSosa[$sosa] = $sfamily; |
|
| 616 | + } |
|
| 617 | + $this->view_bag->set('sosa_list', $listFamSosa); |
|
| 618 | 618 | |
| 619 | - $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth'))); |
|
| 620 | - $this->view_bag->set('chart_marriages', FunctionsPrintLists::chartByDecade($marr_by_decade, I18N::translate('Decade of marriage'))); |
|
| 621 | - $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($marr_by_age, I18N::translate('Age in year of marriage'))); |
|
| 622 | - } |
|
| 619 | + $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth'))); |
|
| 620 | + $this->view_bag->set('chart_marriages', FunctionsPrintLists::chartByDecade($marr_by_decade, I18N::translate('Decade of marriage'))); |
|
| 621 | + $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($marr_by_age, I18N::translate('Age in year of marriage'))); |
|
| 622 | + } |
|
| 623 | 623 | |
| 624 | - ViewFactory::make('SosaListFam', $this, $controller, $this->view_bag)->render(); |
|
| 625 | - } |
|
| 624 | + ViewFactory::make('SosaListFam', $this, $controller, $this->view_bag)->render(); |
|
| 625 | + } |
|
| 626 | 626 | |
| 627 | 627 | } |
| 628 | 628 | \ No newline at end of file |
@@ -18,97 +18,97 @@ |
||
| 18 | 18 | /** |
| 19 | 19 | * @var array $data Container for data |
| 20 | 20 | */ |
| 21 | - protected $data = array(); |
|
| 21 | + protected $data = array(); |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Constructor for ViewBag |
|
| 25 | - * @param array $data_in |
|
| 26 | - */ |
|
| 27 | - public function __construct(array $data_in = array()) { |
|
| 28 | - $this->data = $data_in; |
|
| 29 | - } |
|
| 23 | + /** |
|
| 24 | + * Constructor for ViewBag |
|
| 25 | + * @param array $data_in |
|
| 26 | + */ |
|
| 27 | + public function __construct(array $data_in = array()) { |
|
| 28 | + $this->data = $data_in; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Get the keys present in the view bag. |
|
| 33 | - * |
|
| 34 | - * @return array |
|
| 35 | - */ |
|
| 36 | - public function keys() |
|
| 37 | - { |
|
| 38 | - return array_keys($this->data); |
|
| 39 | - } |
|
| 31 | + /** |
|
| 32 | + * Get the keys present in the view bag. |
|
| 33 | + * |
|
| 34 | + * @return array |
|
| 35 | + */ |
|
| 36 | + public function keys() |
|
| 37 | + { |
|
| 38 | + return array_keys($this->data); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Get all the data from the bag for a given key. |
|
| 43 | - * |
|
| 44 | - * @param string $key |
|
| 45 | - * @param string $format |
|
| 46 | - * @return unknown |
|
| 47 | - */ |
|
| 48 | - public function get($key, $default = null) |
|
| 49 | - { |
|
| 50 | - if (array_key_exists($key, $this->data)) { |
|
| 51 | - return $this->data[$key]; |
|
| 52 | - } |
|
| 53 | - return $default; |
|
| 54 | - } |
|
| 41 | + /** |
|
| 42 | + * Get all the data from the bag for a given key. |
|
| 43 | + * |
|
| 44 | + * @param string $key |
|
| 45 | + * @param string $format |
|
| 46 | + * @return unknown |
|
| 47 | + */ |
|
| 48 | + public function get($key, $default = null) |
|
| 49 | + { |
|
| 50 | + if (array_key_exists($key, $this->data)) { |
|
| 51 | + return $this->data[$key]; |
|
| 52 | + } |
|
| 53 | + return $default; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Magic getter. |
|
| 58 | - * Returns the value associated with the key. |
|
| 59 | - * |
|
| 60 | - * @param string $key |
|
| 61 | - * @return unknown |
|
| 62 | - */ |
|
| 63 | - public function __get($key) { |
|
| 64 | - return $this->get($key, null); |
|
| 65 | - } |
|
| 56 | + /** |
|
| 57 | + * Magic getter. |
|
| 58 | + * Returns the value associated with the key. |
|
| 59 | + * |
|
| 60 | + * @param string $key |
|
| 61 | + * @return unknown |
|
| 62 | + */ |
|
| 63 | + public function __get($key) { |
|
| 64 | + return $this->get($key, null); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * Set the value for the specified key. |
|
| 69 | - * Can define whether to override an existing value; |
|
| 70 | - * |
|
| 71 | - * @param string $key |
|
| 72 | - * @param mixed $value |
|
| 73 | - * @param bool $override |
|
| 74 | - */ |
|
| 75 | - public function set($key, $value, $override = true) { |
|
| 76 | - if(is_null($key)) return; |
|
| 77 | - if(!$override && array_key_exists($key, $this->data)) return; |
|
| 78 | - $this->data[$key] = $value; |
|
| 79 | - } |
|
| 67 | + /** |
|
| 68 | + * Set the value for the specified key. |
|
| 69 | + * Can define whether to override an existing value; |
|
| 70 | + * |
|
| 71 | + * @param string $key |
|
| 72 | + * @param mixed $value |
|
| 73 | + * @param bool $override |
|
| 74 | + */ |
|
| 75 | + public function set($key, $value, $override = true) { |
|
| 76 | + if(is_null($key)) return; |
|
| 77 | + if(!$override && array_key_exists($key, $this->data)) return; |
|
| 78 | + $this->data[$key] = $value; |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Magic setter. |
|
| 83 | - * Set the value for the specified key. |
|
| 84 | - * |
|
| 85 | - * @param string $key |
|
| 86 | - * @param mixed $value |
|
| 87 | - */ |
|
| 88 | - public function __set($key, $value) { |
|
| 89 | - $this->set($key, $value); |
|
| 90 | - } |
|
| 81 | + /** |
|
| 82 | + * Magic setter. |
|
| 83 | + * Set the value for the specified key. |
|
| 84 | + * |
|
| 85 | + * @param string $key |
|
| 86 | + * @param mixed $value |
|
| 87 | + */ |
|
| 88 | + public function __set($key, $value) { |
|
| 89 | + $this->set($key, $value); |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * Magic isset |
|
| 94 | - * Checks whether the ViewBag contains the specified key |
|
| 95 | - * |
|
| 96 | - * @param string $key |
|
| 97 | - * @return bool |
|
| 98 | - */ |
|
| 99 | - public function __isset($key) { |
|
| 100 | - return isset($this->data[$key]); |
|
| 101 | - } |
|
| 92 | + /** |
|
| 93 | + * Magic isset |
|
| 94 | + * Checks whether the ViewBag contains the specified key |
|
| 95 | + * |
|
| 96 | + * @param string $key |
|
| 97 | + * @return bool |
|
| 98 | + */ |
|
| 99 | + public function __isset($key) { |
|
| 100 | + return isset($this->data[$key]); |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - /** |
|
| 104 | - * Magic unset |
|
| 105 | - * Unset the specified key from the ViewBag |
|
| 106 | - * |
|
| 107 | - * @param string $key |
|
| 108 | - */ |
|
| 109 | - public function __unset($key) { |
|
| 110 | - unset($this->data[$key]);; |
|
| 111 | - } |
|
| 103 | + /** |
|
| 104 | + * Magic unset |
|
| 105 | + * Unset the specified key from the ViewBag |
|
| 106 | + * |
|
| 107 | + * @param string $key |
|
| 108 | + */ |
|
| 109 | + public function __unset($key) { |
|
| 110 | + unset($this->data[$key]);; |
|
| 111 | + } |
|
| 112 | 112 | |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | \ No newline at end of file |
@@ -113,29 +113,29 @@ discard block |
||
| 113 | 113 | * @return string|array Estimated birth place if found, null otherwise |
| 114 | 114 | */ |
| 115 | 115 | public function getSignificantPlace(){ |
| 116 | - if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
| 117 | - return $bplace; |
|
| 118 | - } |
|
| 116 | + if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
| 117 | + return $bplace; |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | - foreach ($this->gedcomrecord->getAllEventPlaces('RESI') as $rplace) { |
|
| 121 | - if ($rplace) { |
|
| 122 | - return $rplace; |
|
| 123 | - } |
|
| 124 | - } |
|
| 120 | + foreach ($this->gedcomrecord->getAllEventPlaces('RESI') as $rplace) { |
|
| 121 | + if ($rplace) { |
|
| 122 | + return $rplace; |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | - if($dplace = $this->gedcomrecord->getDeathPlace()){ |
|
| 127 | - return $dplace; |
|
| 128 | - } |
|
| 126 | + if($dplace = $this->gedcomrecord->getDeathPlace()){ |
|
| 127 | + return $dplace; |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | - foreach($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
| 131 | - foreach ($fams->getAllEventPlaces('RESI') as $rplace) { |
|
| 132 | - if ($rplace) { |
|
| 133 | - return $rplace; |
|
| 134 | - } |
|
| 135 | - } |
|
| 136 | - } |
|
| 130 | + foreach($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
| 131 | + foreach ($fams->getAllEventPlaces('RESI') as $rplace) { |
|
| 132 | + if ($rplace) { |
|
| 133 | + return $rplace; |
|
| 134 | + } |
|
| 135 | + } |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | - return null; |
|
| 138 | + return null; |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * @return boolean Is the individual a Sosa ancestor |
| 145 | 145 | */ |
| 146 | 146 | public function isSosa(){ |
| 147 | - return count($this->getSosaNumbers()) > 0; |
|
| 147 | + return count($this->getSosaNumbers()) > 0; |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -155,11 +155,11 @@ discard block |
||
| 155 | 155 | * @return array List of Sosa numbers |
| 156 | 156 | */ |
| 157 | 157 | public function getSosaNumbers(){ |
| 158 | - if($this->sosa === null) { |
|
| 159 | - $provider = new SosaProvider($this->gedcomrecord->getTree()); |
|
| 160 | - $this->sosa = $provider->getSosaNumbers($this->gedcomrecord); |
|
| 161 | - } |
|
| 162 | - return $this->sosa; |
|
| 158 | + if($this->sosa === null) { |
|
| 159 | + $provider = new SosaProvider($this->gedcomrecord->getTree()); |
|
| 160 | + $this->sosa = $provider->getSosaNumbers($this->gedcomrecord); |
|
| 161 | + } |
|
| 162 | + return $this->sosa; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -174,10 +174,10 @@ discard block |
||
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | /** |
| 177 | - * Check if this individual's death is sourced |
|
| 178 | - * |
|
| 179 | - * @return int Level of sources |
|
| 180 | - * */ |
|
| 177 | + * Check if this individual's death is sourced |
|
| 178 | + * |
|
| 179 | + * @return int Level of sources |
|
| 180 | + * */ |
|
| 181 | 181 | public function isDeathSourced(){ |
| 182 | 182 | if($this->is_death_sourced !== null) return $this->is_death_sourced; |
| 183 | 183 | $this->is_death_sourced = $this->isFactSourced(WT_EVENTS_DEAT); |
@@ -35,59 +35,59 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | class AdminConfigController 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 Admin Config controller |
|
| 46 | - * @param AbstractModule $module |
|
| 47 | - */ |
|
| 48 | - public function __construct(AbstractModule $module) { |
|
| 49 | - parent::__construct($module); |
|
| 44 | + /** |
|
| 45 | + * Constructor for Admin Config 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 | - * AdminConfig@index |
|
| 60 | - */ |
|
| 61 | - public function index() { |
|
| 62 | - global $WT_TREE; |
|
| 58 | + /** |
|
| 59 | + * AdminConfig@index |
|
| 60 | + */ |
|
| 61 | + public function index() { |
|
| 62 | + global $WT_TREE; |
|
| 63 | 63 | |
| 64 | - Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
| 65 | - $controller = new PageController(); |
|
| 66 | - $controller |
|
| 67 | - ->restrictAccess(Auth::isManager($WT_TREE)) |
|
| 68 | - ->setPageTitle($this->module->getTitle()); |
|
| 64 | + Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
| 65 | + $controller = new PageController(); |
|
| 66 | + $controller |
|
| 67 | + ->restrictAccess(Auth::isManager($WT_TREE)) |
|
| 68 | + ->setPageTitle($this->module->getTitle()); |
|
| 69 | 69 | |
| 70 | - $data = new ViewBag(); |
|
| 71 | - $data->set('title', $controller->getPageTitle()); |
|
| 72 | - $data->set('tree', $WT_TREE); |
|
| 70 | + $data = new ViewBag(); |
|
| 71 | + $data->set('title', $controller->getPageTitle()); |
|
| 72 | + $data->set('tree', $WT_TREE); |
|
| 73 | 73 | |
| 74 | - $data->set('root_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig'); |
|
| 74 | + $data->set('root_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig'); |
|
| 75 | 75 | |
| 76 | - $table_id = 'table-geoanalysis-' . Uuid::uuid4(); |
|
| 77 | - $data->set('table_id', $table_id); |
|
| 76 | + $table_id = 'table-geoanalysis-' . Uuid::uuid4(); |
|
| 77 | + $data->set('table_id', $table_id); |
|
| 78 | 78 | |
| 79 | - $other_trees = array(); |
|
| 80 | - foreach (Tree::getAll() as $tree) { |
|
| 81 | - if($tree->getTreeId() != $WT_TREE->getTreeId()) $other_trees[] = $tree; |
|
| 82 | - } |
|
| 83 | - $data->set('other_trees', $other_trees); |
|
| 79 | + $other_trees = array(); |
|
| 80 | + foreach (Tree::getAll() as $tree) { |
|
| 81 | + if($tree->getTreeId() != $WT_TREE->getTreeId()) $other_trees[] = $tree; |
|
| 82 | + } |
|
| 83 | + $data->set('other_trees', $other_trees); |
|
| 84 | 84 | |
| 85 | - $data->set('places_hierarchy', $this->provider->getPlacesHierarchy()); |
|
| 85 | + $data->set('places_hierarchy', $this->provider->getPlacesHierarchy()); |
|
| 86 | 86 | |
| 87 | - $controller |
|
| 88 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 89 | - ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL) |
|
| 90 | - ->addInlineJavascript(' |
|
| 87 | + $controller |
|
| 88 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 89 | + ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL) |
|
| 90 | + ->addInlineJavascript(' |
|
| 91 | 91 | //Datatable initialisation |
| 92 | 92 | jQuery.fn.dataTableExt.oSort["unicode-asc" ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))}; |
| 93 | 93 | jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))}; |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | }); |
| 123 | 123 | |
| 124 | 124 | ') |
| 125 | - ->addInlineJavascript(' |
|
| 125 | + ->addInlineJavascript(' |
|
| 126 | 126 | function set_geoanalysis_status(ga_id, status, gedcom) { |
| 127 | 127 | jQuery.ajax({ |
| 128 | 128 | url: "module.php", |
@@ -166,55 +166,55 @@ discard block |
||
| 166 | 166 | '); |
| 167 | 167 | |
| 168 | 168 | |
| 169 | - ViewFactory::make('AdminConfig', $this, $controller, $data)->render(); |
|
| 170 | - } |
|
| 169 | + ViewFactory::make('AdminConfig', $this, $controller, $data)->render(); |
|
| 170 | + } |
|
| 171 | 171 | |
| 172 | - /** |
|
| 173 | - * AdminConfig@jsonGeoAnalysisList |
|
| 174 | - */ |
|
| 175 | - public function jsonGeoAnalysisList() { |
|
| 176 | - global $WT_TREE; |
|
| 172 | + /** |
|
| 173 | + * AdminConfig@jsonGeoAnalysisList |
|
| 174 | + */ |
|
| 175 | + public function jsonGeoAnalysisList() { |
|
| 176 | + global $WT_TREE; |
|
| 177 | 177 | |
| 178 | - $controller = new JsonController(); |
|
| 179 | - $controller |
|
| 180 | - ->restrictAccess(Auth::isManager($WT_TREE)); |
|
| 178 | + $controller = new JsonController(); |
|
| 179 | + $controller |
|
| 180 | + ->restrictAccess(Auth::isManager($WT_TREE)); |
|
| 181 | 181 | |
| 182 | - // Generate an AJAX/JSON response for datatables to load a block of rows |
|
| 183 | - $search = Filter::postArray('search'); |
|
| 184 | - if($search) $search = $search['value']; |
|
| 185 | - $start = Filter::postInteger('start'); |
|
| 186 | - $length = Filter::postInteger('length'); |
|
| 187 | - $order = Filter::postArray('order'); |
|
| 182 | + // Generate an AJAX/JSON response for datatables to load a block of rows |
|
| 183 | + $search = Filter::postArray('search'); |
|
| 184 | + if($search) $search = $search['value']; |
|
| 185 | + $start = Filter::postInteger('start'); |
|
| 186 | + $length = Filter::postInteger('length'); |
|
| 187 | + $order = Filter::postArray('order'); |
|
| 188 | 188 | |
| 189 | - foreach($order as $key => &$value) { |
|
| 190 | - switch($value['column']) { |
|
| 191 | - case 3: |
|
| 192 | - $value['column'] = 'majgd_descr'; |
|
| 193 | - break; |
|
| 194 | - case 5; |
|
| 195 | - $value['column'] = 'majgd_sublevel'; |
|
| 196 | - break; |
|
| 197 | - default: |
|
| 198 | - unset($order[$key]); |
|
| 199 | - } |
|
| 200 | - } |
|
| 189 | + foreach($order as $key => &$value) { |
|
| 190 | + switch($value['column']) { |
|
| 191 | + case 3: |
|
| 192 | + $value['column'] = 'majgd_descr'; |
|
| 193 | + break; |
|
| 194 | + case 5; |
|
| 195 | + $value['column'] = 'majgd_sublevel'; |
|
| 196 | + break; |
|
| 197 | + default: |
|
| 198 | + unset($order[$key]); |
|
| 199 | + } |
|
| 200 | + } |
|
| 201 | 201 | |
| 202 | - /** @var GeoAnalysisProvider $provider */ |
|
| 203 | - $provider = $this->module->getProvider(); |
|
| 202 | + /** @var GeoAnalysisProvider $provider */ |
|
| 203 | + $provider = $this->module->getProvider(); |
|
| 204 | 204 | |
| 205 | - $list = $provider->getFilteredGeoAnalysisList($search, $order, $start, $length); |
|
| 206 | - $recordsFiltered = count($list); |
|
| 207 | - $recordsTotal = $this->provider->getGeoAnalysisCount(); |
|
| 205 | + $list = $provider->getFilteredGeoAnalysisList($search, $order, $start, $length); |
|
| 206 | + $recordsFiltered = count($list); |
|
| 207 | + $recordsTotal = $this->provider->getGeoAnalysisCount(); |
|
| 208 | 208 | |
| 209 | - $data = array(); |
|
| 210 | - $place_hierarchy = $this->provider->getPlacesHierarchy(); |
|
| 211 | - foreach($list as $ga) { |
|
| 212 | - /** @var GeoAnalysis $ga */ |
|
| 209 | + $data = array(); |
|
| 210 | + $place_hierarchy = $this->provider->getPlacesHierarchy(); |
|
| 211 | + foreach($list as $ga) { |
|
| 212 | + /** @var GeoAnalysis $ga */ |
|
| 213 | 213 | |
| 214 | - $datum = array(); |
|
| 215 | - $options= $ga->getOptions(); |
|
| 214 | + $datum = array(); |
|
| 215 | + $options= $ga->getOptions(); |
|
| 216 | 216 | |
| 217 | - $datum[0] = ' |
|
| 217 | + $datum[0] = ' |
|
| 218 | 218 | <div class="btn-group"> |
| 219 | 219 | <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> |
| 220 | 220 | <i class="fa fa-pencil"></i><span class="caret"></span> |
@@ -238,108 +238,108 @@ discard block |
||
| 238 | 238 | </li> |
| 239 | 239 | </ul> |
| 240 | 240 | </div>'; |
| 241 | - $datum[1] = $ga->getId(); |
|
| 242 | - $datum[2] = $ga->isEnabled() ? |
|
| 241 | + $datum[1] = $ga->getId(); |
|
| 242 | + $datum[2] = $ga->isEnabled() ? |
|
| 243 | 243 | '<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : |
| 244 | 244 | '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>'; |
| 245 | - $datum[3] = $ga->getTitle(); |
|
| 246 | - $analysis_level = $ga->getAnalysisLevel(); |
|
| 247 | - if($place_hierarchy['type'] == 'header') { |
|
| 248 | - $datum[4] = $place_hierarchy['hierarchy'][$analysis_level - 1]; |
|
| 249 | - } else { |
|
| 250 | - $datum[4] = $analysis_level . '(' . $place_hierarchy['hierarchy'][$analysis_level - 1] . ')'; |
|
| 251 | - } |
|
| 252 | - $datum[5] = $ga->getAnalysisLevel(); |
|
| 253 | - $datum[6] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>'; |
|
| 254 | - $datum[7] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>'; |
|
| 255 | - if($ga->hasMap()) { |
|
| 256 | - $datum[6] = $options->getMap()->getDescription(); |
|
| 257 | - $datum[7] = '<span data-toggle="tooltip" title="' . $options->getMap()->getTopLevelName() . '" />'; |
|
| 258 | - $top_level = $options->getMapLevel(); |
|
| 259 | - if($place_hierarchy['type'] == 'header') { |
|
| 260 | - $datum[7] .= $place_hierarchy['hierarchy'][$top_level - 1]; |
|
| 261 | - } else { |
|
| 262 | - $datum[7] .= $top_level . '(' . $place_hierarchy['hierarchy'][$top_level - 1] . ')'; |
|
| 263 | - } |
|
| 264 | - $datum[7] .= '</span>'; |
|
| 265 | - } |
|
| 266 | - $datum[8] = $options->isUsingFlags() ? |
|
| 245 | + $datum[3] = $ga->getTitle(); |
|
| 246 | + $analysis_level = $ga->getAnalysisLevel(); |
|
| 247 | + if($place_hierarchy['type'] == 'header') { |
|
| 248 | + $datum[4] = $place_hierarchy['hierarchy'][$analysis_level - 1]; |
|
| 249 | + } else { |
|
| 250 | + $datum[4] = $analysis_level . '(' . $place_hierarchy['hierarchy'][$analysis_level - 1] . ')'; |
|
| 251 | + } |
|
| 252 | + $datum[5] = $ga->getAnalysisLevel(); |
|
| 253 | + $datum[6] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>'; |
|
| 254 | + $datum[7] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>'; |
|
| 255 | + if($ga->hasMap()) { |
|
| 256 | + $datum[6] = $options->getMap()->getDescription(); |
|
| 257 | + $datum[7] = '<span data-toggle="tooltip" title="' . $options->getMap()->getTopLevelName() . '" />'; |
|
| 258 | + $top_level = $options->getMapLevel(); |
|
| 259 | + if($place_hierarchy['type'] == 'header') { |
|
| 260 | + $datum[7] .= $place_hierarchy['hierarchy'][$top_level - 1]; |
|
| 261 | + } else { |
|
| 262 | + $datum[7] .= $top_level . '(' . $place_hierarchy['hierarchy'][$top_level - 1] . ')'; |
|
| 263 | + } |
|
| 264 | + $datum[7] .= '</span>'; |
|
| 265 | + } |
|
| 266 | + $datum[8] = $options->isUsingFlags() ? |
|
| 267 | 267 | '<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : |
| 268 | 268 | '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>'; |
| 269 | - $datum[9] = $options->getMaxDetailsInGen() > 0 ? $options->getMaxDetailsInGen() : I18N::translate('All'); |
|
| 269 | + $datum[9] = $options->getMaxDetailsInGen() > 0 ? $options->getMaxDetailsInGen() : I18N::translate('All'); |
|
| 270 | 270 | |
| 271 | - $data[] = $datum; |
|
| 272 | - } |
|
| 271 | + $data[] = $datum; |
|
| 272 | + } |
|
| 273 | 273 | |
| 274 | - $controller->pageHeader(); |
|
| 274 | + $controller->pageHeader(); |
|
| 275 | 275 | |
| 276 | - echo \Zend_Json::encode(array( |
|
| 277 | - 'draw' => Filter::getInteger('draw'), |
|
| 278 | - 'recordsTotal' => $recordsTotal, |
|
| 279 | - 'recordsFiltered' => $recordsFiltered, |
|
| 280 | - 'data' => $data |
|
| 281 | - )); |
|
| 276 | + echo \Zend_Json::encode(array( |
|
| 277 | + 'draw' => Filter::getInteger('draw'), |
|
| 278 | + 'recordsTotal' => $recordsTotal, |
|
| 279 | + 'recordsFiltered' => $recordsFiltered, |
|
| 280 | + 'data' => $data |
|
| 281 | + )); |
|
| 282 | 282 | |
| 283 | - } |
|
| 283 | + } |
|
| 284 | 284 | |
| 285 | - /** |
|
| 286 | - * AdminConfig@edit |
|
| 287 | - */ |
|
| 288 | - public function edit() { |
|
| 289 | - $ga_id = Filter::getInteger('ga_id'); |
|
| 290 | - $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 285 | + /** |
|
| 286 | + * AdminConfig@edit |
|
| 287 | + */ |
|
| 288 | + public function edit() { |
|
| 289 | + $ga_id = Filter::getInteger('ga_id'); |
|
| 290 | + $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 291 | 291 | |
| 292 | - $this->renderEdit($ga); |
|
| 293 | - } |
|
| 292 | + $this->renderEdit($ga); |
|
| 293 | + } |
|
| 294 | 294 | |
| 295 | - /** |
|
| 296 | - * AdminConfig@add |
|
| 297 | - */ |
|
| 298 | - public function add() { |
|
| 299 | - $this->renderEdit(null); |
|
| 300 | - } |
|
| 295 | + /** |
|
| 296 | + * AdminConfig@add |
|
| 297 | + */ |
|
| 298 | + public function add() { |
|
| 299 | + $this->renderEdit(null); |
|
| 300 | + } |
|
| 301 | 301 | |
| 302 | - /** |
|
| 303 | - * AdminConfig@save |
|
| 304 | - */ |
|
| 305 | - public function save() { |
|
| 306 | - global $WT_TREE; |
|
| 302 | + /** |
|
| 303 | + * AdminConfig@save |
|
| 304 | + */ |
|
| 305 | + public function save() { |
|
| 306 | + global $WT_TREE; |
|
| 307 | 307 | |
| 308 | - $tmp_contrl = new PageController(); |
|
| 309 | - $tmp_contrl->restrictAccess( |
|
| 310 | - Auth::isManager($WT_TREE) |
|
| 311 | - && Filter::checkCsrf() |
|
| 312 | - ); |
|
| 308 | + $tmp_contrl = new PageController(); |
|
| 309 | + $tmp_contrl->restrictAccess( |
|
| 310 | + Auth::isManager($WT_TREE) |
|
| 311 | + && Filter::checkCsrf() |
|
| 312 | + ); |
|
| 313 | 313 | |
| 314 | - $ga_id = Filter::postInteger('ga_id'); |
|
| 315 | - $description = Filter::post('description'); |
|
| 316 | - $analysislevel = Filter::postInteger('analysislevel'); |
|
| 317 | - $use_map = Filter::postBool('use_map'); |
|
| 318 | - if($use_map) { |
|
| 319 | - $map_file = base64_decode(Filter::post('map_file')); |
|
| 320 | - $map_top_level = Filter::postInteger('map_top_level'); |
|
| 321 | - } |
|
| 322 | - $use_flags = Filter::postBool('use_flags'); |
|
| 323 | - $gen_details = Filter::postInteger('gen_details'); |
|
| 314 | + $ga_id = Filter::postInteger('ga_id'); |
|
| 315 | + $description = Filter::post('description'); |
|
| 316 | + $analysislevel = Filter::postInteger('analysislevel'); |
|
| 317 | + $use_map = Filter::postBool('use_map'); |
|
| 318 | + if($use_map) { |
|
| 319 | + $map_file = base64_decode(Filter::post('map_file')); |
|
| 320 | + $map_top_level = Filter::postInteger('map_top_level'); |
|
| 321 | + } |
|
| 322 | + $use_flags = Filter::postBool('use_flags'); |
|
| 323 | + $gen_details = Filter::postInteger('gen_details'); |
|
| 324 | 324 | |
| 325 | - $success = false; |
|
| 326 | - if($ga_id) { |
|
| 327 | - $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 328 | - if($ga) { |
|
| 329 | - $ga->setTitle($description); |
|
| 330 | - $ga->setAnalysisLevel($analysislevel + 1); |
|
| 331 | - $options = $ga->getOptions(); |
|
| 332 | - if($options) { |
|
| 333 | - $options->setUsingFlags($use_flags); |
|
| 334 | - $options->setMaxDetailsInGen($gen_details); |
|
| 335 | - if($use_map) { |
|
| 336 | - $options->setMap(new OutlineMap($map_file)); |
|
| 337 | - $options->setMapLevel($map_top_level + 1); |
|
| 338 | - } |
|
| 339 | - else { |
|
| 340 | - $options->setMap(null); |
|
| 341 | - } |
|
| 342 | - } |
|
| 325 | + $success = false; |
|
| 326 | + if($ga_id) { |
|
| 327 | + $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 328 | + if($ga) { |
|
| 329 | + $ga->setTitle($description); |
|
| 330 | + $ga->setAnalysisLevel($analysislevel + 1); |
|
| 331 | + $options = $ga->getOptions(); |
|
| 332 | + if($options) { |
|
| 333 | + $options->setUsingFlags($use_flags); |
|
| 334 | + $options->setMaxDetailsInGen($gen_details); |
|
| 335 | + if($use_map) { |
|
| 336 | + $options->setMap(new OutlineMap($map_file)); |
|
| 337 | + $options->setMapLevel($map_top_level + 1); |
|
| 338 | + } |
|
| 339 | + else { |
|
| 340 | + $options->setMap(null); |
|
| 341 | + } |
|
| 342 | + } |
|
| 343 | 343 | |
| 344 | 344 | $res = $this->provider->updateGeoAnalysis($ga); |
| 345 | 345 | if($res) { |
@@ -352,8 +352,8 @@ discard block |
||
| 352 | 352 | FlashMessages::addMessage(I18N::translate('An error occured while updating the geographical dispersion analysis “%s”', $ga->getTitle()), 'danger'); |
| 353 | 353 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'. $ga->getId() .'” could not be updated. See error log.'); |
| 354 | 354 | } |
| 355 | - } |
|
| 356 | - } else { |
|
| 355 | + } |
|
| 356 | + } else { |
|
| 357 | 357 | $ga = $this->provider->createGeoAnalysis( |
| 358 | 358 | $description, |
| 359 | 359 | $analysislevel + 1, |
@@ -371,34 +371,34 @@ discard block |
||
| 371 | 371 | FlashMessages::addMessage(I18N::translate('An error occured while adding the geographical dispersion analysis “%s”', $description), 'danger'); |
| 372 | 372 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis “'.$description.'” could not be added. See error log.'); |
| 373 | 373 | } |
| 374 | - } |
|
| 374 | + } |
|
| 375 | 375 | |
| 376 | - $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl(); |
|
| 377 | - if(!$success) { |
|
| 378 | - if($ga) { |
|
| 379 | - $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@edit&ga_id='. $ga->getId() .'&ged=' . $WT_TREE->getNameUrl(); |
|
| 380 | - } |
|
| 381 | - else { |
|
| 382 | - $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@add&ged=' . $WT_TREE->getNameUrl(); |
|
| 383 | - } |
|
| 384 | - } |
|
| 385 | - header('Location: ' . WT_BASE_URL . $redirection_url); |
|
| 376 | + $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl(); |
|
| 377 | + if(!$success) { |
|
| 378 | + if($ga) { |
|
| 379 | + $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@edit&ga_id='. $ga->getId() .'&ged=' . $WT_TREE->getNameUrl(); |
|
| 380 | + } |
|
| 381 | + else { |
|
| 382 | + $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@add&ged=' . $WT_TREE->getNameUrl(); |
|
| 383 | + } |
|
| 384 | + } |
|
| 385 | + header('Location: ' . WT_BASE_URL . $redirection_url); |
|
| 386 | 386 | |
| 387 | - } |
|
| 387 | + } |
|
| 388 | 388 | |
| 389 | 389 | /** |
| 390 | 390 | * Renders the edit form, whether it is an edition of an existing GeoAnalysis, or the addition of a new one. |
| 391 | 391 | * |
| 392 | 392 | * @param (GeoAnalysis!null) $ga GeoAnalysis to edit |
| 393 | 393 | */ |
| 394 | - protected function renderEdit(GeoAnalysis $ga = null) { |
|
| 395 | - global $WT_TREE; |
|
| 394 | + protected function renderEdit(GeoAnalysis $ga = null) { |
|
| 395 | + global $WT_TREE; |
|
| 396 | 396 | |
| 397 | - Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
| 398 | - $controller = new PageController(); |
|
| 399 | - $controller |
|
| 400 | - ->restrictAccess(Auth::isManager($WT_TREE)) |
|
| 401 | - ->addInlineJavascript(' |
|
| 397 | + Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
| 398 | + $controller = new PageController(); |
|
| 399 | + $controller |
|
| 400 | + ->restrictAccess(Auth::isManager($WT_TREE)) |
|
| 401 | + ->addInlineJavascript(' |
|
| 402 | 402 | function toggleMapOptions() { |
| 403 | 403 | if($("input:radio[name=\'use_map\']:checked").val() == 1) { |
| 404 | 404 | $("#map_options").show(); |
@@ -412,34 +412,34 @@ discard block |
||
| 412 | 412 | toggleMapOptions(); |
| 413 | 413 | '); |
| 414 | 414 | |
| 415 | - $data = new ViewBag(); |
|
| 416 | - if($ga) { |
|
| 417 | - $controller->setPageTitle(I18N::translate('Edit the geographical dispersion analysis')); |
|
| 418 | - $data->set('geo_analysis', $ga); |
|
| 419 | - } else { |
|
| 420 | - $controller->setPageTitle(I18N::translate('Add a geographical dispersion analysis')); |
|
| 421 | - } |
|
| 415 | + $data = new ViewBag(); |
|
| 416 | + if($ga) { |
|
| 417 | + $controller->setPageTitle(I18N::translate('Edit the geographical dispersion analysis')); |
|
| 418 | + $data->set('geo_analysis', $ga); |
|
| 419 | + } else { |
|
| 420 | + $controller->setPageTitle(I18N::translate('Add a geographical dispersion analysis')); |
|
| 421 | + } |
|
| 422 | 422 | |
| 423 | - $data->set('title', $controller->getPageTitle()); |
|
| 424 | - $data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl()); |
|
| 425 | - $data->set('module_title', $this->module->getTitle()); |
|
| 426 | - $data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@save&ged=' . $WT_TREE->getNameUrl()); |
|
| 427 | - $data->set('places_hierarchy', $this->provider->getPlacesHierarchy()); |
|
| 423 | + $data->set('title', $controller->getPageTitle()); |
|
| 424 | + $data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl()); |
|
| 425 | + $data->set('module_title', $this->module->getTitle()); |
|
| 426 | + $data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@save&ged=' . $WT_TREE->getNameUrl()); |
|
| 427 | + $data->set('places_hierarchy', $this->provider->getPlacesHierarchy()); |
|
| 428 | 428 | |
| 429 | - $map_list = array_map( |
|
| 430 | - function(OutlineMap $map) { |
|
| 431 | - return $map->getDescription(); |
|
| 432 | - }, |
|
| 433 | - $this->provider->getOutlineMapsList() |
|
| 434 | - ); |
|
| 435 | - asort($map_list); |
|
| 436 | - $data->set('map_list', $map_list); |
|
| 429 | + $map_list = array_map( |
|
| 430 | + function(OutlineMap $map) { |
|
| 431 | + return $map->getDescription(); |
|
| 432 | + }, |
|
| 433 | + $this->provider->getOutlineMapsList() |
|
| 434 | + ); |
|
| 435 | + asort($map_list); |
|
| 436 | + $data->set('map_list', $map_list); |
|
| 437 | 437 | |
| 438 | - $gen_details = array(0 => I18N::translate('All')); |
|
| 439 | - for($i = 1; $i <= 10 ; $i++) $gen_details[$i] = $i; |
|
| 440 | - $data->set('generation_details', $gen_details); |
|
| 438 | + $gen_details = array(0 => I18N::translate('All')); |
|
| 439 | + for($i = 1; $i <= 10 ; $i++) $gen_details[$i] = $i; |
|
| 440 | + $data->set('generation_details', $gen_details); |
|
| 441 | 441 | |
| 442 | - ViewFactory::make('GeoAnalysisEdit', $this, $controller, $data)->render(); |
|
| 443 | - } |
|
| 442 | + ViewFactory::make('GeoAnalysisEdit', $this, $controller, $data)->render(); |
|
| 443 | + } |
|
| 444 | 444 | |
| 445 | 445 | } |
| 446 | 446 | \ No newline at end of file |
@@ -21,130 +21,130 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | class GeoAnalysisProvider { |
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Reference tree |
|
| 26 | - * @var Tree $tree |
|
| 27 | - */ |
|
| 28 | - protected $tree; |
|
| 24 | + /** |
|
| 25 | + * Reference tree |
|
| 26 | + * @var Tree $tree |
|
| 27 | + */ |
|
| 28 | + protected $tree; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Cached hierarchy of places in the Gedcom file. |
|
| 32 | - * |
|
| 33 | - * @var (array|null) $place_hierarchy |
|
| 34 | - */ |
|
| 35 | - protected $place_hierarchy; |
|
| 30 | + /** |
|
| 31 | + * Cached hierarchy of places in the Gedcom file. |
|
| 32 | + * |
|
| 33 | + * @var (array|null) $place_hierarchy |
|
| 34 | + */ |
|
| 35 | + protected $place_hierarchy; |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Constructor for GeoAnalysis Provider. |
|
| 39 | - * A provider is defined in relation to a specific tree. |
|
| 40 | - * |
|
| 41 | - * @param Tree $tree |
|
| 42 | - */ |
|
| 43 | - public function __construct(Tree $tree) { |
|
| 44 | - $this->tree = $tree; |
|
| 45 | - $this->place_hierarchy = null; |
|
| 46 | - } |
|
| 37 | + /** |
|
| 38 | + * Constructor for GeoAnalysis Provider. |
|
| 39 | + * A provider is defined in relation to a specific tree. |
|
| 40 | + * |
|
| 41 | + * @param Tree $tree |
|
| 42 | + */ |
|
| 43 | + public function __construct(Tree $tree) { |
|
| 44 | + $this->tree = $tree; |
|
| 45 | + $this->place_hierarchy = null; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Creates and returns a GeoAnalysis object from a data row. |
|
| 50 | - * The row data is expected to be an array with the indexes: |
|
| 51 | - * - majgd_id: geodispersion analysis ID |
|
| 52 | - * - majgd_descr: geodispersion analysis description/title |
|
| 53 | - * - majgd_sublevel: Analysis level |
|
| 54 | - * - majgd_useflagsgen: Use flags in places display |
|
| 55 | - * - majgd_detailsgen: Number of top places |
|
| 56 | - * - majgd_map: file name of the map |
|
| 57 | - * - majgd_toplevel: parent level for the map |
|
| 58 | - * |
|
| 59 | - * @param array $row |
|
| 60 | - * @return GeoAnalysis |
|
| 61 | - */ |
|
| 62 | - protected function loadGeoAnalysisFromRow($row) { |
|
| 63 | - $options = new GeoDisplayOptions(); |
|
| 64 | - $options |
|
| 65 | - ->setUsingFlags($row['majgd_useflagsgen'] == 'yes') |
|
| 66 | - ->setMaxDetailsInGen($row['majgd_detailsgen']); |
|
| 48 | + /** |
|
| 49 | + * Creates and returns a GeoAnalysis object from a data row. |
|
| 50 | + * The row data is expected to be an array with the indexes: |
|
| 51 | + * - majgd_id: geodispersion analysis ID |
|
| 52 | + * - majgd_descr: geodispersion analysis description/title |
|
| 53 | + * - majgd_sublevel: Analysis level |
|
| 54 | + * - majgd_useflagsgen: Use flags in places display |
|
| 55 | + * - majgd_detailsgen: Number of top places |
|
| 56 | + * - majgd_map: file name of the map |
|
| 57 | + * - majgd_toplevel: parent level for the map |
|
| 58 | + * |
|
| 59 | + * @param array $row |
|
| 60 | + * @return GeoAnalysis |
|
| 61 | + */ |
|
| 62 | + protected function loadGeoAnalysisFromRow($row) { |
|
| 63 | + $options = new GeoDisplayOptions(); |
|
| 64 | + $options |
|
| 65 | + ->setUsingFlags($row['majgd_useflagsgen'] == 'yes') |
|
| 66 | + ->setMaxDetailsInGen($row['majgd_detailsgen']); |
|
| 67 | 67 | |
| 68 | - if($row['majgd_map']) { |
|
| 69 | - $options |
|
| 70 | - ->setMap(new OutlineMap($row['majgd_map'])) |
|
| 71 | - ->setMapLevel($row['majgd_toplevel']); |
|
| 72 | - } |
|
| 68 | + if($row['majgd_map']) { |
|
| 69 | + $options |
|
| 70 | + ->setMap(new OutlineMap($row['majgd_map'])) |
|
| 71 | + ->setMapLevel($row['majgd_toplevel']); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - $enabled = true; |
|
| 75 | - if(isset($row['majgd_status']) && $row['majgd_status'] == 'disabled') { |
|
| 76 | - $enabled = false; |
|
| 77 | - } |
|
| 74 | + $enabled = true; |
|
| 75 | + if(isset($row['majgd_status']) && $row['majgd_status'] == 'disabled') { |
|
| 76 | + $enabled = false; |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - return new GeoAnalysis( |
|
| 80 | - $this->tree, |
|
| 81 | - $row['majgd_id'], |
|
| 82 | - $row['majgd_descr'], |
|
| 83 | - $row['majgd_sublevel'], |
|
| 84 | - $options, |
|
| 85 | - $enabled |
|
| 86 | - ); |
|
| 87 | - } |
|
| 79 | + return new GeoAnalysis( |
|
| 80 | + $this->tree, |
|
| 81 | + $row['majgd_id'], |
|
| 82 | + $row['majgd_descr'], |
|
| 83 | + $row['majgd_sublevel'], |
|
| 84 | + $options, |
|
| 85 | + $enabled |
|
| 86 | + ); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - /** |
|
| 90 | - * Returns the number of geographical analysis (active and inactive). |
|
| 91 | - * |
|
| 92 | - * @return int |
|
| 93 | - */ |
|
| 94 | - public function getGeoAnalysisCount() { |
|
| 95 | - return Database::prepare( |
|
| 96 | - 'SELECT COUNT(majgd_id)' . |
|
| 97 | - ' FROM `##maj_geodispersion`' . |
|
| 98 | - ' WHERE majgd_file = :gedcom_id' |
|
| 99 | - )->execute(array( |
|
| 100 | - 'gedcom_id' => $this->tree->getTreeId() |
|
| 101 | - ))->fetchOne(); |
|
| 102 | - } |
|
| 89 | + /** |
|
| 90 | + * Returns the number of geographical analysis (active and inactive). |
|
| 91 | + * |
|
| 92 | + * @return int |
|
| 93 | + */ |
|
| 94 | + public function getGeoAnalysisCount() { |
|
| 95 | + return Database::prepare( |
|
| 96 | + 'SELECT COUNT(majgd_id)' . |
|
| 97 | + ' FROM `##maj_geodispersion`' . |
|
| 98 | + ' WHERE majgd_file = :gedcom_id' |
|
| 99 | + )->execute(array( |
|
| 100 | + 'gedcom_id' => $this->tree->getTreeId() |
|
| 101 | + ))->fetchOne(); |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - /** |
|
| 105 | - * Get a geographical analysis by its ID. |
|
| 106 | - * The function can only search for only enabled analysis, or all. |
|
| 107 | - * |
|
| 108 | - * @param int $id geodispersion analysis ID |
|
| 109 | - * @param bool $only_enabled Search for only enabled geodispersion analysis |
|
| 110 | - * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis|NULL |
|
| 111 | - */ |
|
| 112 | - public function getGeoAnalysis($id, $only_enabled = true) { |
|
| 113 | - $args = array ( |
|
| 114 | - 'gedcom_id' => $this->tree->getTreeId(), |
|
| 115 | - 'ga_id' => $id |
|
| 116 | - ); |
|
| 104 | + /** |
|
| 105 | + * Get a geographical analysis by its ID. |
|
| 106 | + * The function can only search for only enabled analysis, or all. |
|
| 107 | + * |
|
| 108 | + * @param int $id geodispersion analysis ID |
|
| 109 | + * @param bool $only_enabled Search for only enabled geodispersion analysis |
|
| 110 | + * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis|NULL |
|
| 111 | + */ |
|
| 112 | + public function getGeoAnalysis($id, $only_enabled = true) { |
|
| 113 | + $args = array ( |
|
| 114 | + 'gedcom_id' => $this->tree->getTreeId(), |
|
| 115 | + 'ga_id' => $id |
|
| 116 | + ); |
|
| 117 | 117 | |
| 118 | - $sql = 'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status' . |
|
| 119 | - ' FROM `##maj_geodispersion`' . |
|
| 120 | - ' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id'; |
|
| 121 | - if($only_enabled) { |
|
| 122 | - $sql .= ' AND majgd_status = :status'; |
|
| 123 | - $args['status'] = 'enabled'; |
|
| 124 | - } |
|
| 125 | - $sql .= ' ORDER BY majgd_descr'; |
|
| 118 | + $sql = 'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status' . |
|
| 119 | + ' FROM `##maj_geodispersion`' . |
|
| 120 | + ' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id'; |
|
| 121 | + if($only_enabled) { |
|
| 122 | + $sql .= ' AND majgd_status = :status'; |
|
| 123 | + $args['status'] = 'enabled'; |
|
| 124 | + } |
|
| 125 | + $sql .= ' ORDER BY majgd_descr'; |
|
| 126 | 126 | |
| 127 | - $ga_array = Database::prepare($sql)->execute($args)->fetchOneRow(\PDO::FETCH_ASSOC); |
|
| 127 | + $ga_array = Database::prepare($sql)->execute($args)->fetchOneRow(\PDO::FETCH_ASSOC); |
|
| 128 | 128 | |
| 129 | - if($ga_array) { |
|
| 130 | - return $this->loadGeoAnalysisFromRow($ga_array); |
|
| 131 | - } |
|
| 129 | + if($ga_array) { |
|
| 130 | + return $this->loadGeoAnalysisFromRow($ga_array); |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | - return null; |
|
| 134 | - } |
|
| 133 | + return null; |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | - /** |
|
| 137 | - * Add a new geodispersion analysis in the database, in a transactional manner. |
|
| 138 | - * When successful, eturns the newly created GeoAnalysis object. |
|
| 139 | - * |
|
| 140 | - * @param string $description geodispersion analysis title |
|
| 141 | - * @param int $analysis_level Analysis level |
|
| 142 | - * @param string $map_file Filename of the map |
|
| 143 | - * @param int $map_top_level Parent level of the map |
|
| 144 | - * @param bool $use_flags Use flag in the place display |
|
| 145 | - * @param int $gen_details Number of top places to display |
|
| 146 | - * @return GeoAnalysis |
|
| 147 | - */ |
|
| 136 | + /** |
|
| 137 | + * Add a new geodispersion analysis in the database, in a transactional manner. |
|
| 138 | + * When successful, eturns the newly created GeoAnalysis object. |
|
| 139 | + * |
|
| 140 | + * @param string $description geodispersion analysis title |
|
| 141 | + * @param int $analysis_level Analysis level |
|
| 142 | + * @param string $map_file Filename of the map |
|
| 143 | + * @param int $map_top_level Parent level of the map |
|
| 144 | + * @param bool $use_flags Use flag in the place display |
|
| 145 | + * @param int $gen_details Number of top places to display |
|
| 146 | + * @return GeoAnalysis |
|
| 147 | + */ |
|
| 148 | 148 | public function createGeoAnalysis($description, $analysis_level, $map_file, $map_top_level, $use_flags, $gen_details) { |
| 149 | 149 | try{ |
| 150 | 150 | Database::beginTransaction(); |
@@ -174,17 +174,17 @@ discard block |
||
| 174 | 174 | Log::addErrorLog('A new Geo Analysis failed to be created. Transaction rollbacked. Parameters ['.$description.', '.$analysis_level.','.$map_file.','.$map_top_level.','.$use_flags.', '.$gen_details.']. Exception: '.$ex->getMessage()); |
| 175 | 175 | } |
| 176 | 176 | return $ga; |
| 177 | - } |
|
| 177 | + } |
|
| 178 | 178 | |
| 179 | - /** |
|
| 180 | - * Update a geodispersion analysis in the database, in transactional manner. |
|
| 181 | - * When successful, returns the updated GeoAnalysis object |
|
| 182 | - * |
|
| 183 | - * @param GeoAnalysis $ga |
|
| 184 | - * @return GeoAnalysis |
|
| 185 | - */ |
|
| 186 | - public function updateGeoAnalysis(GeoAnalysis $ga) { |
|
| 187 | - try { |
|
| 179 | + /** |
|
| 180 | + * Update a geodispersion analysis in the database, in transactional manner. |
|
| 181 | + * When successful, returns the updated GeoAnalysis object |
|
| 182 | + * |
|
| 183 | + * @param GeoAnalysis $ga |
|
| 184 | + * @return GeoAnalysis |
|
| 185 | + */ |
|
| 186 | + public function updateGeoAnalysis(GeoAnalysis $ga) { |
|
| 187 | + try { |
|
| 188 | 188 | Database::beginTransaction(); |
| 189 | 189 | |
| 190 | 190 | Database::prepare( |
@@ -217,238 +217,238 @@ discard block |
||
| 217 | 217 | $ga = null; |
| 218 | 218 | } |
| 219 | 219 | return $ga; |
| 220 | - } |
|
| 220 | + } |
|
| 221 | 221 | |
| 222 | - /** |
|
| 223 | - * Set the status of a specific analysis. |
|
| 224 | - * The status can be enabled (true), or disabled (false). |
|
| 225 | - * |
|
| 226 | - * @param GeoAnalysis $ga |
|
| 227 | - * @param bool $status |
|
| 228 | - */ |
|
| 229 | - public function setGeoAnalysisStatus(GeoAnalysis $ga, $status) { |
|
| 230 | - Database::prepare( |
|
| 231 | - 'UPDATE `##maj_geodispersion`'. |
|
| 232 | - ' SET majgd_status = :status'. |
|
| 233 | - ' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id' |
|
| 234 | - )->execute(array( |
|
| 235 | - 'gedcom_id' => $this->tree->getTreeId(), |
|
| 236 | - 'status' => $status ? 'enabled' : 'disabled', |
|
| 237 | - 'ga_id' => $ga->getId() |
|
| 238 | - )); |
|
| 239 | - } |
|
| 222 | + /** |
|
| 223 | + * Set the status of a specific analysis. |
|
| 224 | + * The status can be enabled (true), or disabled (false). |
|
| 225 | + * |
|
| 226 | + * @param GeoAnalysis $ga |
|
| 227 | + * @param bool $status |
|
| 228 | + */ |
|
| 229 | + public function setGeoAnalysisStatus(GeoAnalysis $ga, $status) { |
|
| 230 | + Database::prepare( |
|
| 231 | + 'UPDATE `##maj_geodispersion`'. |
|
| 232 | + ' SET majgd_status = :status'. |
|
| 233 | + ' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id' |
|
| 234 | + )->execute(array( |
|
| 235 | + 'gedcom_id' => $this->tree->getTreeId(), |
|
| 236 | + 'status' => $status ? 'enabled' : 'disabled', |
|
| 237 | + 'ga_id' => $ga->getId() |
|
| 238 | + )); |
|
| 239 | + } |
|
| 240 | 240 | |
| 241 | - /** |
|
| 242 | - * Delete a geodispersion analysis from the database. |
|
| 243 | - * |
|
| 244 | - * @param GeoAnalysis $ga |
|
| 245 | - */ |
|
| 246 | - public function deleteGeoAnalysis(GeoAnalysis $ga) { |
|
| 247 | - Database::prepare( |
|
| 248 | - 'DELETE FROM `##maj_geodispersion`'. |
|
| 249 | - ' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id' |
|
| 250 | - )->execute(array( |
|
| 251 | - 'gedcom_id' => $this->tree->getTreeId(), |
|
| 252 | - 'ga_id' => $ga->getId() |
|
| 253 | - )); |
|
| 254 | - } |
|
| 241 | + /** |
|
| 242 | + * Delete a geodispersion analysis from the database. |
|
| 243 | + * |
|
| 244 | + * @param GeoAnalysis $ga |
|
| 245 | + */ |
|
| 246 | + public function deleteGeoAnalysis(GeoAnalysis $ga) { |
|
| 247 | + Database::prepare( |
|
| 248 | + 'DELETE FROM `##maj_geodispersion`'. |
|
| 249 | + ' WHERE majgd_file = :gedcom_id AND majgd_id=:ga_id' |
|
| 250 | + )->execute(array( |
|
| 251 | + 'gedcom_id' => $this->tree->getTreeId(), |
|
| 252 | + 'ga_id' => $ga->getId() |
|
| 253 | + )); |
|
| 254 | + } |
|
| 255 | 255 | |
| 256 | - /** |
|
| 257 | - * Return the list of geodispersion analysis recorded and enabled for a specific GEDCOM |
|
| 258 | - * |
|
| 259 | - * @return array List of enabled maps |
|
| 260 | - */ |
|
| 261 | - public function getGeoAnalysisList(){ |
|
| 262 | - $res = array(); |
|
| 256 | + /** |
|
| 257 | + * Return the list of geodispersion analysis recorded and enabled for a specific GEDCOM |
|
| 258 | + * |
|
| 259 | + * @return array List of enabled maps |
|
| 260 | + */ |
|
| 261 | + public function getGeoAnalysisList(){ |
|
| 262 | + $res = array(); |
|
| 263 | 263 | |
| 264 | - $list = Database::prepare( |
|
| 265 | - 'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen' . |
|
| 266 | - ' FROM `##maj_geodispersion`' . |
|
| 267 | - ' WHERE majgd_file = :gedcom_id AND majgd_status = :status'. |
|
| 268 | - ' ORDER BY majgd_descr' |
|
| 269 | - )->execute(array( |
|
| 270 | - 'gedcom_id' => $this->tree->getTreeId(), |
|
| 271 | - 'status' => 'enabled' |
|
| 272 | - ))->fetchAll(\PDO::FETCH_ASSOC); |
|
| 264 | + $list = Database::prepare( |
|
| 265 | + 'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen' . |
|
| 266 | + ' FROM `##maj_geodispersion`' . |
|
| 267 | + ' WHERE majgd_file = :gedcom_id AND majgd_status = :status'. |
|
| 268 | + ' ORDER BY majgd_descr' |
|
| 269 | + )->execute(array( |
|
| 270 | + 'gedcom_id' => $this->tree->getTreeId(), |
|
| 271 | + 'status' => 'enabled' |
|
| 272 | + ))->fetchAll(\PDO::FETCH_ASSOC); |
|
| 273 | 273 | |
| 274 | - foreach($list as $ga) { |
|
| 275 | - $res[] = $this->loadGeoAnalysisFromRow($ga); |
|
| 276 | - } |
|
| 274 | + foreach($list as $ga) { |
|
| 275 | + $res[] = $this->loadGeoAnalysisFromRow($ga); |
|
| 276 | + } |
|
| 277 | 277 | |
| 278 | - return $res; |
|
| 279 | - } |
|
| 278 | + return $res; |
|
| 279 | + } |
|
| 280 | 280 | |
| 281 | - /** |
|
| 282 | - * Return the list of geodispersion analysis matching specified criterias. |
|
| 283 | - * |
|
| 284 | - * @param string $search Search criteria in analysis description |
|
| 285 | - * @param array $order_by Columns to order by |
|
| 286 | - * @param int $start Offset to start with (for pagination) |
|
| 287 | - * @param int|null $limit Max number of items to return (for pagination) |
|
| 288 | - * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis[] |
|
| 289 | - */ |
|
| 290 | - public function getFilteredGeoAnalysisList($search = null, $order_by = null, $start = 0, $limit = null){ |
|
| 291 | - $res = array(); |
|
| 281 | + /** |
|
| 282 | + * Return the list of geodispersion analysis matching specified criterias. |
|
| 283 | + * |
|
| 284 | + * @param string $search Search criteria in analysis description |
|
| 285 | + * @param array $order_by Columns to order by |
|
| 286 | + * @param int $start Offset to start with (for pagination) |
|
| 287 | + * @param int|null $limit Max number of items to return (for pagination) |
|
| 288 | + * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysis[] |
|
| 289 | + */ |
|
| 290 | + public function getFilteredGeoAnalysisList($search = null, $order_by = null, $start = 0, $limit = null){ |
|
| 291 | + $res = array(); |
|
| 292 | 292 | |
| 293 | - $sql = |
|
| 294 | - 'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status' . |
|
| 295 | - ' FROM `##maj_geodispersion`' . |
|
| 296 | - ' WHERE majgd_file = :gedcom_id'; |
|
| 293 | + $sql = |
|
| 294 | + 'SELECT majgd_id, majgd_descr, majgd_sublevel, majgd_map, majgd_toplevel, majgd_useflagsgen, majgd_detailsgen, majgd_status' . |
|
| 295 | + ' FROM `##maj_geodispersion`' . |
|
| 296 | + ' WHERE majgd_file = :gedcom_id'; |
|
| 297 | 297 | |
| 298 | - $args = array('gedcom_id'=> $this->tree->getTreeId()); |
|
| 298 | + $args = array('gedcom_id'=> $this->tree->getTreeId()); |
|
| 299 | 299 | |
| 300 | - if($search) { |
|
| 301 | - $sql .= ' AND majgd_descr LIKE CONCAT(\'%\', :search, \'%\')'; |
|
| 302 | - $args['search'] = $search; |
|
| 303 | - } |
|
| 300 | + if($search) { |
|
| 301 | + $sql .= ' AND majgd_descr LIKE CONCAT(\'%\', :search, \'%\')'; |
|
| 302 | + $args['search'] = $search; |
|
| 303 | + } |
|
| 304 | 304 | |
| 305 | - if ($order_by) { |
|
| 306 | - $sql .= ' ORDER BY '; |
|
| 307 | - foreach ($order_by as $key => $value) { |
|
| 308 | - if ($key > 0) { |
|
| 309 | - $sql .= ','; |
|
| 310 | - } |
|
| 305 | + if ($order_by) { |
|
| 306 | + $sql .= ' ORDER BY '; |
|
| 307 | + foreach ($order_by as $key => $value) { |
|
| 308 | + if ($key > 0) { |
|
| 309 | + $sql .= ','; |
|
| 310 | + } |
|
| 311 | 311 | |
| 312 | - switch ($value['dir']) { |
|
| 313 | - case 'asc': |
|
| 314 | - $sql .= $value['column'] . ' ASC '; |
|
| 315 | - break; |
|
| 316 | - case 'desc': |
|
| 317 | - $sql .= $value['column'] . ' DESC '; |
|
| 318 | - break; |
|
| 319 | - } |
|
| 320 | - } |
|
| 321 | - } else { |
|
| 322 | - $sql = " ORDER BY majgd_descr ASC"; |
|
| 323 | - } |
|
| 312 | + switch ($value['dir']) { |
|
| 313 | + case 'asc': |
|
| 314 | + $sql .= $value['column'] . ' ASC '; |
|
| 315 | + break; |
|
| 316 | + case 'desc': |
|
| 317 | + $sql .= $value['column'] . ' DESC '; |
|
| 318 | + break; |
|
| 319 | + } |
|
| 320 | + } |
|
| 321 | + } else { |
|
| 322 | + $sql = " ORDER BY majgd_descr ASC"; |
|
| 323 | + } |
|
| 324 | 324 | |
| 325 | - if ($limit) { |
|
| 326 | - $sql .= " LIMIT :limit OFFSET :offset"; |
|
| 327 | - $args['limit'] = $limit; |
|
| 328 | - $args['offset'] = $start; |
|
| 329 | - } |
|
| 325 | + if ($limit) { |
|
| 326 | + $sql .= " LIMIT :limit OFFSET :offset"; |
|
| 327 | + $args['limit'] = $limit; |
|
| 328 | + $args['offset'] = $start; |
|
| 329 | + } |
|
| 330 | 330 | |
| 331 | - $data = Database::prepare($sql)->execute($args)->fetchAll(\PDO::FETCH_ASSOC); |
|
| 331 | + $data = Database::prepare($sql)->execute($args)->fetchAll(\PDO::FETCH_ASSOC); |
|
| 332 | 332 | |
| 333 | - foreach($data as $ga) { |
|
| 334 | - $res[] = $this->loadGeoAnalysisFromRow($ga); |
|
| 335 | - } |
|
| 333 | + foreach($data as $ga) { |
|
| 334 | + $res[] = $this->loadGeoAnalysisFromRow($ga); |
|
| 335 | + } |
|
| 336 | 336 | |
| 337 | - return $res; |
|
| 338 | - } |
|
| 337 | + return $res; |
|
| 338 | + } |
|
| 339 | 339 | |
| 340 | - /** |
|
| 341 | - * Returns the infered place hierarchy, determined from the Gedcom data. |
|
| 342 | - * Depending on the data, it can be based on the Gedcom Header description, or from a place example. |
|
| 343 | - * This is returned as an associative array: |
|
| 344 | - * - type: describe the source of the data (<em>header<em> / <em>data</em>) |
|
| 345 | - * - hierarchy: an array of the place hierarchy (in reverse order of the gedcom) |
|
| 346 | - * |
|
| 347 | - * @return array |
|
| 348 | - */ |
|
| 349 | - public function getPlacesHierarchy() { |
|
| 350 | - if(!$this->place_hierarchy) { |
|
| 351 | - if($place_structure = $this->getPlacesHierarchyFromHeader()) { |
|
| 352 | - $this->place_hierarchy = array('type' => 'header', 'hierarchy' => $place_structure); |
|
| 353 | - } |
|
| 354 | - else { |
|
| 355 | - $this->place_hierarchy = array('type' => 'data', 'hierarchy' => $this->getPlacesHierarchyFromData()); |
|
| 356 | - } |
|
| 357 | - } |
|
| 358 | - return $this->place_hierarchy; |
|
| 359 | - } |
|
| 340 | + /** |
|
| 341 | + * Returns the infered place hierarchy, determined from the Gedcom data. |
|
| 342 | + * Depending on the data, it can be based on the Gedcom Header description, or from a place example. |
|
| 343 | + * This is returned as an associative array: |
|
| 344 | + * - type: describe the source of the data (<em>header<em> / <em>data</em>) |
|
| 345 | + * - hierarchy: an array of the place hierarchy (in reverse order of the gedcom) |
|
| 346 | + * |
|
| 347 | + * @return array |
|
| 348 | + */ |
|
| 349 | + public function getPlacesHierarchy() { |
|
| 350 | + if(!$this->place_hierarchy) { |
|
| 351 | + if($place_structure = $this->getPlacesHierarchyFromHeader()) { |
|
| 352 | + $this->place_hierarchy = array('type' => 'header', 'hierarchy' => $place_structure); |
|
| 353 | + } |
|
| 354 | + else { |
|
| 355 | + $this->place_hierarchy = array('type' => 'data', 'hierarchy' => $this->getPlacesHierarchyFromData()); |
|
| 356 | + } |
|
| 357 | + } |
|
| 358 | + return $this->place_hierarchy; |
|
| 359 | + } |
|
| 360 | 360 | |
| 361 | - /** |
|
| 362 | - * Returns an array of the place hierarchy, as defined in the GEDCOM header. |
|
| 363 | - * The places are reversed compared to normal GEDCOM structure. |
|
| 364 | - * |
|
| 365 | - * @return array|null |
|
| 366 | - */ |
|
| 367 | - protected function getPlacesHierarchyFromHeader() { |
|
| 368 | - $head = GedcomRecord::getInstance('HEAD', $this->tree); |
|
| 369 | - $head_place = $head->getFirstFact('PLAC'); |
|
| 370 | - if($head_place && $head_place_value = $head_place->getAttribute('FORM')){ |
|
| 371 | - return array_reverse(array_map('trim',explode(',', $head_place_value))); |
|
| 372 | - } |
|
| 373 | - return null; |
|
| 374 | - } |
|
| 361 | + /** |
|
| 362 | + * Returns an array of the place hierarchy, as defined in the GEDCOM header. |
|
| 363 | + * The places are reversed compared to normal GEDCOM structure. |
|
| 364 | + * |
|
| 365 | + * @return array|null |
|
| 366 | + */ |
|
| 367 | + protected function getPlacesHierarchyFromHeader() { |
|
| 368 | + $head = GedcomRecord::getInstance('HEAD', $this->tree); |
|
| 369 | + $head_place = $head->getFirstFact('PLAC'); |
|
| 370 | + if($head_place && $head_place_value = $head_place->getAttribute('FORM')){ |
|
| 371 | + return array_reverse(array_map('trim',explode(',', $head_place_value))); |
|
| 372 | + } |
|
| 373 | + return null; |
|
| 374 | + } |
|
| 375 | 375 | |
| 376 | - /** |
|
| 377 | - * Returns an array of the place hierarchy, based on a random example of place within the GEDCOM. |
|
| 378 | - * It will look for the longest hierarchy in the tree. |
|
| 379 | - * The places are reversed compared to normal GEDCOM structure. |
|
| 380 | - * |
|
| 381 | - * @return array |
|
| 382 | - */ |
|
| 383 | - protected function getPlacesHierarchyFromData() { |
|
| 384 | - $random_place = null; |
|
| 385 | - $nb_levels = 0; |
|
| 376 | + /** |
|
| 377 | + * Returns an array of the place hierarchy, based on a random example of place within the GEDCOM. |
|
| 378 | + * It will look for the longest hierarchy in the tree. |
|
| 379 | + * The places are reversed compared to normal GEDCOM structure. |
|
| 380 | + * |
|
| 381 | + * @return array |
|
| 382 | + */ |
|
| 383 | + protected function getPlacesHierarchyFromData() { |
|
| 384 | + $random_place = null; |
|
| 385 | + $nb_levels = 0; |
|
| 386 | 386 | |
| 387 | - //Select all '2 PLAC ' tags in the file and create array |
|
| 388 | - $places_list=array(); |
|
| 389 | - $ged_data = Database::prepare( |
|
| 390 | - 'SELECT i_gedcom AS gedcom'. |
|
| 391 | - ' FROM `##individuals`'. |
|
| 392 | - ' WHERE i_gedcom LIKE :gedcom AND i_file = :gedcom_id'. |
|
| 393 | - ' UNION ALL'. |
|
| 394 | - 'SELECT f_gedcom AS gedcom'. |
|
| 395 | - ' FROM `##families`'. |
|
| 396 | - ' WHERE f_gedcom LIKE :gedcom AND f_file = :gedcom_id' |
|
| 397 | - )->execute(array( |
|
| 398 | - 'gedcom' => '%\n2 PLAC %', |
|
| 399 | - 'gedcom_id' => $this->tree->getTreeId() |
|
| 400 | - ))->fetchOneColumn(); |
|
| 401 | - foreach ($ged_data as $ged_datum) { |
|
| 402 | - preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches); |
|
| 403 | - foreach ($matches[1] as $match) { |
|
| 404 | - $places_list[$match]=true; |
|
| 405 | - } |
|
| 406 | - } |
|
| 387 | + //Select all '2 PLAC ' tags in the file and create array |
|
| 388 | + $places_list=array(); |
|
| 389 | + $ged_data = Database::prepare( |
|
| 390 | + 'SELECT i_gedcom AS gedcom'. |
|
| 391 | + ' FROM `##individuals`'. |
|
| 392 | + ' WHERE i_gedcom LIKE :gedcom AND i_file = :gedcom_id'. |
|
| 393 | + ' UNION ALL'. |
|
| 394 | + 'SELECT f_gedcom AS gedcom'. |
|
| 395 | + ' FROM `##families`'. |
|
| 396 | + ' WHERE f_gedcom LIKE :gedcom AND f_file = :gedcom_id' |
|
| 397 | + )->execute(array( |
|
| 398 | + 'gedcom' => '%\n2 PLAC %', |
|
| 399 | + 'gedcom_id' => $this->tree->getTreeId() |
|
| 400 | + ))->fetchOneColumn(); |
|
| 401 | + foreach ($ged_data as $ged_datum) { |
|
| 402 | + preg_match_all('/\n2 PLAC (.+)/', $ged_datum, $matches); |
|
| 403 | + foreach ($matches[1] as $match) { |
|
| 404 | + $places_list[$match]=true; |
|
| 405 | + } |
|
| 406 | + } |
|
| 407 | 407 | |
| 408 | - // Unique list of places |
|
| 409 | - $places_list=array_keys($places_list); |
|
| 408 | + // Unique list of places |
|
| 409 | + $places_list=array_keys($places_list); |
|
| 410 | 410 | |
| 411 | - //sort the array, limit to unique values, and count them |
|
| 412 | - $places_parts=array(); |
|
| 413 | - usort($places_list, array('I18N', 'strcasecmp')); |
|
| 414 | - $nb_places = count($places_list); |
|
| 411 | + //sort the array, limit to unique values, and count them |
|
| 412 | + $places_parts=array(); |
|
| 413 | + usort($places_list, array('I18N', 'strcasecmp')); |
|
| 414 | + $nb_places = count($places_list); |
|
| 415 | 415 | |
| 416 | - //calculate maximum no. of levels to display |
|
| 417 | - $has_found_good_example = false; |
|
| 418 | - foreach($places_list as $place){ |
|
| 419 | - $levels = explode(",", $place); |
|
| 420 | - $parts = count($levels); |
|
| 421 | - if ($parts >= $nb_levels){ |
|
| 422 | - $nb_levels = $parts; |
|
| 423 | - if(!$has_found_good_example){ |
|
| 424 | - $random_place = $$place; |
|
| 425 | - if(min(array_map('strlen', $levels)) > 0){ |
|
| 426 | - $has_found_good_example = true; |
|
| 427 | - } |
|
| 428 | - } |
|
| 429 | - } |
|
| 430 | - } |
|
| 416 | + //calculate maximum no. of levels to display |
|
| 417 | + $has_found_good_example = false; |
|
| 418 | + foreach($places_list as $place){ |
|
| 419 | + $levels = explode(",", $place); |
|
| 420 | + $parts = count($levels); |
|
| 421 | + if ($parts >= $nb_levels){ |
|
| 422 | + $nb_levels = $parts; |
|
| 423 | + if(!$has_found_good_example){ |
|
| 424 | + $random_place = $$place; |
|
| 425 | + if(min(array_map('strlen', $levels)) > 0){ |
|
| 426 | + $has_found_good_example = true; |
|
| 427 | + } |
|
| 428 | + } |
|
| 429 | + } |
|
| 430 | + } |
|
| 431 | 431 | |
| 432 | - return array_reverse(array_map('trim',explode(',', $randomPlace))); |
|
| 433 | - } |
|
| 432 | + return array_reverse(array_map('trim',explode(',', $randomPlace))); |
|
| 433 | + } |
|
| 434 | 434 | |
| 435 | - /** |
|
| 436 | - * Returns the list of geodispersion maps available within the maps folder. |
|
| 437 | - * |
|
| 438 | - * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\OutlineMap[] |
|
| 439 | - */ |
|
| 440 | - public function getOutlineMapsList() { |
|
| 441 | - $res = array(); |
|
| 442 | - $root_path = WT_ROOT.WT_MODULES_DIR.Constants::MODULE_MAJ_GEODISP_NAME.'/maps/'; |
|
| 443 | - if(is_dir($root_path)){ |
|
| 444 | - $dir = opendir($root_path); |
|
| 445 | - while (($file=readdir($dir))!== false) { |
|
| 446 | - if (preg_match('/^[a-zA-Z0-9_]+.xml$/', $file)) { |
|
| 447 | - $res[base64_encode($file)] = new OutlineMap($file, true); |
|
| 448 | - } |
|
| 449 | - } |
|
| 450 | - } |
|
| 451 | - return $res; |
|
| 452 | - } |
|
| 435 | + /** |
|
| 436 | + * Returns the list of geodispersion maps available within the maps folder. |
|
| 437 | + * |
|
| 438 | + * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\OutlineMap[] |
|
| 439 | + */ |
|
| 440 | + public function getOutlineMapsList() { |
|
| 441 | + $res = array(); |
|
| 442 | + $root_path = WT_ROOT.WT_MODULES_DIR.Constants::MODULE_MAJ_GEODISP_NAME.'/maps/'; |
|
| 443 | + if(is_dir($root_path)){ |
|
| 444 | + $dir = opendir($root_path); |
|
| 445 | + while (($file=readdir($dir))!== false) { |
|
| 446 | + if (preg_match('/^[a-zA-Z0-9_]+.xml$/', $file)) { |
|
| 447 | + $res[base64_encode($file)] = new OutlineMap($file, true); |
|
| 448 | + } |
|
| 449 | + } |
|
| 450 | + } |
|
| 451 | + return $res; |
|
| 452 | + } |
|
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | \ No newline at end of file |
@@ -15,58 +15,58 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | class GeoDisplayOptions { |
| 17 | 17 | |
| 18 | - /** |
|
| 18 | + /** |
|
| 19 | 19 | * Outline map to be used for diaplay |
| 20 | - * @var (null|OutlineMap) $map |
|
| 21 | - */ |
|
| 22 | - protected $map; |
|
| 20 | + * @var (null|OutlineMap) $map |
|
| 21 | + */ |
|
| 22 | + protected $map; |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * Level in the Gedcom hierarchy of the parent level of the outline map. |
| 26 | 26 | * @var int $map_level |
| 27 | 27 | */ |
| 28 | - protected $map_level; |
|
| 28 | + protected $map_level; |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * Option to use flags in places display, instead of or in addition to the name. |
| 32 | 32 | * @var bool $use_flags |
| 33 | 33 | */ |
| 34 | - protected $use_flags; |
|
| 34 | + protected $use_flags; |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * Option to define the number of top places to display in the generation view. |
| 38 | 38 | * @var int $max_details_in_gen |
| 39 | 39 | */ |
| 40 | - protected $max_details_in_gen; |
|
| 40 | + protected $max_details_in_gen; |
|
| 41 | 41 | |
| 42 | - /** |
|
| 42 | + /** |
|
| 43 | 43 | * Get the outline map to use for display. |
| 44 | 44 | * |
| 45 | - * @return (OutlineMap|null) |
|
| 46 | - */ |
|
| 47 | - public function getMap(){ |
|
| 48 | - return $this->map; |
|
| 49 | - } |
|
| 45 | + * @return (OutlineMap|null) |
|
| 46 | + */ |
|
| 47 | + public function getMap(){ |
|
| 48 | + return $this->map; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * Set the outline map to use for display. |
| 53 | 53 | * |
| 54 | - * @param (OutlineMap|null) $map |
|
| 54 | + * @param (OutlineMap|null) $map |
|
| 55 | 55 | * @return self Enable method-chaining |
| 56 | - */ |
|
| 57 | - public function setMap(OutlineMap $map = null) { |
|
| 58 | - $this->map = $map; |
|
| 59 | - return $this; |
|
| 60 | - } |
|
| 56 | + */ |
|
| 57 | + public function setMap(OutlineMap $map = null) { |
|
| 58 | + $this->map = $map; |
|
| 59 | + return $this; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * Get the level of the map parent place |
| 64 | 64 | * |
| 65 | 65 | * @return int |
| 66 | 66 | */ |
| 67 | - public function getMapLevel(){ |
|
| 68 | - return $this->map_level; |
|
| 69 | - } |
|
| 67 | + public function getMapLevel(){ |
|
| 68 | + return $this->map_level; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * Set the level of the map parent place |
@@ -74,19 +74,19 @@ discard block |
||
| 74 | 74 | * @param int $maplevel |
| 75 | 75 | * @return self Enable method-chaining |
| 76 | 76 | */ |
| 77 | - public function setMapLevel($maplevel) { |
|
| 78 | - $this->map_level = $maplevel; |
|
| 79 | - return $this; |
|
| 80 | - } |
|
| 77 | + public function setMapLevel($maplevel) { |
|
| 78 | + $this->map_level = $maplevel; |
|
| 79 | + return $this; |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | 83 | * Get whether flags should be used in places display |
| 84 | 84 | * |
| 85 | 85 | * @return bool |
| 86 | 86 | */ |
| 87 | - public function isUsingFlags(){ |
|
| 88 | - return $this->use_flags; |
|
| 89 | - } |
|
| 87 | + public function isUsingFlags(){ |
|
| 88 | + return $this->use_flags; |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * Set whether flags should be used in places display |
@@ -94,19 +94,19 @@ discard block |
||
| 94 | 94 | * @param bool $use_flags |
| 95 | 95 | * @return self Enable method-chaining |
| 96 | 96 | */ |
| 97 | - public function setUsingFlags($use_flags) { |
|
| 98 | - $this->use_flags = $use_flags; |
|
| 99 | - return $this; |
|
| 100 | - } |
|
| 97 | + public function setUsingFlags($use_flags) { |
|
| 98 | + $this->use_flags = $use_flags; |
|
| 99 | + return $this; |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | 103 | * Get the number of Top Places in the generation view |
| 104 | 104 | * |
| 105 | 105 | * @return int |
| 106 | 106 | */ |
| 107 | - public function getMaxDetailsInGen(){ |
|
| 108 | - return $this->max_details_in_gen; |
|
| 109 | - } |
|
| 107 | + public function getMaxDetailsInGen(){ |
|
| 108 | + return $this->max_details_in_gen; |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | 111 | /** |
| 112 | 112 | * Set the number of Top Places in the generation view |
@@ -114,10 +114,10 @@ discard block |
||
| 114 | 114 | * @param int $max_details_in_gen |
| 115 | 115 | * @return self Enable method-chaining |
| 116 | 116 | */ |
| 117 | - public function setMaxDetailsInGen($max_details_in_gen) { |
|
| 118 | - $this->max_details_in_gen = $max_details_in_gen; |
|
| 119 | - return $this; |
|
| 120 | - } |
|
| 117 | + public function setMaxDetailsInGen($max_details_in_gen) { |
|
| 118 | + $this->max_details_in_gen = $max_details_in_gen; |
|
| 119 | + return $this; |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | \ No newline at end of file |
@@ -20,253 +20,253 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | abstract class AbstractTask { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Time out for runnign tasks, in seconds. Default 5 min |
|
| 25 | - * @var int TASK_TIME_OUT |
|
| 26 | - */ |
|
| 27 | - const TASK_TIME_OUT = 300; |
|
| 23 | + /** |
|
| 24 | + * Time out for runnign tasks, in seconds. Default 5 min |
|
| 25 | + * @var int TASK_TIME_OUT |
|
| 26 | + */ |
|
| 27 | + const TASK_TIME_OUT = 300; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Task provider |
|
| 31 | - * @var TaskProviderInterface $provider |
|
| 32 | - */ |
|
| 29 | + /** |
|
| 30 | + * Task provider |
|
| 31 | + * @var TaskProviderInterface $provider |
|
| 32 | + */ |
|
| 33 | 33 | protected $provider; |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * Task name |
| 37 | 37 | * @var string $name |
| 38 | 38 | */ |
| 39 | - protected $name; |
|
| 39 | + protected $name; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Status of the task |
|
| 43 | - * @var bool $is_enabled |
|
| 44 | - */ |
|
| 45 | - protected $is_enabled; |
|
| 41 | + /** |
|
| 42 | + * Status of the task |
|
| 43 | + * @var bool $is_enabled |
|
| 44 | + */ |
|
| 45 | + protected $is_enabled; |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Last updated date |
|
| 49 | - * @var \DateTime $last_updated |
|
| 50 | - */ |
|
| 51 | - protected $last_updated; |
|
| 47 | + /** |
|
| 48 | + * Last updated date |
|
| 49 | + * @var \DateTime $last_updated |
|
| 50 | + */ |
|
| 51 | + protected $last_updated; |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * Last run result |
|
| 55 | - * @var bool $last_result |
|
| 56 | - */ |
|
| 57 | - protected $last_result; |
|
| 53 | + /** |
|
| 54 | + * Last run result |
|
| 55 | + * @var bool $last_result |
|
| 56 | + */ |
|
| 57 | + protected $last_result; |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Task run frequency |
|
| 61 | - * @var int $frequency |
|
| 62 | - */ |
|
| 63 | - protected $frequency; |
|
| 59 | + /** |
|
| 60 | + * Task run frequency |
|
| 61 | + * @var int $frequency |
|
| 62 | + */ |
|
| 63 | + protected $frequency; |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * Task remaining runs |
|
| 67 | - * @var int $nb_occurrences |
|
| 68 | - */ |
|
| 69 | - protected $nb_occurrences; |
|
| 65 | + /** |
|
| 66 | + * Task remaining runs |
|
| 67 | + * @var int $nb_occurrences |
|
| 68 | + */ |
|
| 69 | + protected $nb_occurrences; |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * Current running status of the task |
|
| 73 | - * @var bool $is_running |
|
| 74 | - */ |
|
| 75 | - protected $is_running; |
|
| 71 | + /** |
|
| 72 | + * Current running status of the task |
|
| 73 | + * @var bool $is_running |
|
| 74 | + */ |
|
| 75 | + protected $is_running; |
|
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * Constructor for the Admin task class |
|
| 77 | + /** |
|
| 78 | + * Constructor for the Admin task class |
|
| 79 | 79 | * |
| 80 | 80 | * @param string $file Filename containing the task object |
| 81 | 81 | * @param TaskProviderInterface $provider Provider for tasks |
| 82 | - */ |
|
| 83 | - public function __construct($file, TaskProviderInterface $provider = null){ |
|
| 84 | - $this->name = trim(basename($file, '.php')); |
|
| 82 | + */ |
|
| 83 | + public function __construct($file, TaskProviderInterface $provider = null){ |
|
| 84 | + $this->name = trim(basename($file, '.php')); |
|
| 85 | 85 | $this->provider = $provider; |
| 86 | - } |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | - /** |
|
| 89 | - * Get the provider. |
|
| 90 | - * |
|
| 91 | - * @return TaskProviderInterface |
|
| 92 | - */ |
|
| 93 | - public function getProvider(){ |
|
| 94 | - return $this->provider; |
|
| 95 | - } |
|
| 88 | + /** |
|
| 89 | + * Get the provider. |
|
| 90 | + * |
|
| 91 | + * @return TaskProviderInterface |
|
| 92 | + */ |
|
| 93 | + public function getProvider(){ |
|
| 94 | + return $this->provider; |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * Set the provider. |
|
| 99 | - * |
|
| 100 | - * @param TaskProviderInterface $provider |
|
| 101 | - * @return self Enable method-chaining |
|
| 102 | - */ |
|
| 103 | - public function setProvider(TaskProviderInterface $provider){ |
|
| 104 | - $this->provider = $provider; |
|
| 105 | - return $this; |
|
| 106 | - } |
|
| 97 | + /** |
|
| 98 | + * Set the provider. |
|
| 99 | + * |
|
| 100 | + * @param TaskProviderInterface $provider |
|
| 101 | + * @return self Enable method-chaining |
|
| 102 | + */ |
|
| 103 | + public function setProvider(TaskProviderInterface $provider){ |
|
| 104 | + $this->provider = $provider; |
|
| 105 | + return $this; |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * Set parameters of the Task |
|
| 110 | - * |
|
| 111 | - * @param bool $is_enabled Status of the task |
|
| 112 | - * @param \DateTime $lastupdated Time of the last task run |
|
| 113 | - * @param bool $last_result Result of the last run, true for success, false for failure |
|
| 114 | - * @param int $frequency Frequency of execution in minutes |
|
| 115 | - * @param int $nb_occur Number of remaining occurrences, 0 for tasks not limited |
|
| 116 | - * @param bool $is_running Indicates if the task is currently running |
|
| 117 | - */ |
|
| 118 | - public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running){ |
|
| 119 | - $this->is_enabled = $is_enabled; |
|
| 120 | - $this->last_updated = $last_updated; |
|
| 121 | - $this->last_result = $last_result; |
|
| 122 | - $this->frequency = $frequency; |
|
| 123 | - $this->nb_occurrences = $nb_occur; |
|
| 124 | - $this->is_running = $is_running; |
|
| 125 | - } |
|
| 108 | + /** |
|
| 109 | + * Set parameters of the Task |
|
| 110 | + * |
|
| 111 | + * @param bool $is_enabled Status of the task |
|
| 112 | + * @param \DateTime $lastupdated Time of the last task run |
|
| 113 | + * @param bool $last_result Result of the last run, true for success, false for failure |
|
| 114 | + * @param int $frequency Frequency of execution in minutes |
|
| 115 | + * @param int $nb_occur Number of remaining occurrences, 0 for tasks not limited |
|
| 116 | + * @param bool $is_running Indicates if the task is currently running |
|
| 117 | + */ |
|
| 118 | + public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running){ |
|
| 119 | + $this->is_enabled = $is_enabled; |
|
| 120 | + $this->last_updated = $last_updated; |
|
| 121 | + $this->last_result = $last_result; |
|
| 122 | + $this->frequency = $frequency; |
|
| 123 | + $this->nb_occurrences = $nb_occur; |
|
| 124 | + $this->is_running = $is_running; |
|
| 125 | + } |
|
| 126 | 126 | |
| 127 | - /** |
|
| 128 | - * Get the name of the task |
|
| 129 | - * |
|
| 130 | - * @return string |
|
| 131 | - */ |
|
| 132 | - public function getName(){ |
|
| 133 | - return $this->name; |
|
| 134 | - } |
|
| 127 | + /** |
|
| 128 | + * Get the name of the task |
|
| 129 | + * |
|
| 130 | + * @return string |
|
| 131 | + */ |
|
| 132 | + public function getName(){ |
|
| 133 | + return $this->name; |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | 136 | |
| 137 | - /** |
|
| 138 | - * Return the status of the task in a boolean way |
|
| 139 | - * |
|
| 140 | - * @return boolean True if enabled |
|
| 141 | - */ |
|
| 142 | - public function isEnabled(){ |
|
| 143 | - return $this->is_enabled; |
|
| 144 | - } |
|
| 137 | + /** |
|
| 138 | + * Return the status of the task in a boolean way |
|
| 139 | + * |
|
| 140 | + * @return boolean True if enabled |
|
| 141 | + */ |
|
| 142 | + public function isEnabled(){ |
|
| 143 | + return $this->is_enabled; |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | - /** |
|
| 147 | - * Get the last updated time. |
|
| 148 | - * |
|
| 149 | - * @return \DateTime |
|
| 150 | - */ |
|
| 151 | - public function getLastUpdated(){ |
|
| 152 | - return $this->last_updated; |
|
| 153 | - } |
|
| 146 | + /** |
|
| 147 | + * Get the last updated time. |
|
| 148 | + * |
|
| 149 | + * @return \DateTime |
|
| 150 | + */ |
|
| 151 | + public function getLastUpdated(){ |
|
| 152 | + return $this->last_updated; |
|
| 153 | + } |
|
| 154 | 154 | |
| 155 | - /** |
|
| 156 | - * Check if the last result has been successful. |
|
| 157 | - * |
|
| 158 | - * @return bool |
|
| 159 | - */ |
|
| 160 | - public function isLastRunSuccess(){ |
|
| 161 | - return $this->last_result; |
|
| 162 | - } |
|
| 155 | + /** |
|
| 156 | + * Check if the last result has been successful. |
|
| 157 | + * |
|
| 158 | + * @return bool |
|
| 159 | + */ |
|
| 160 | + public function isLastRunSuccess(){ |
|
| 161 | + return $this->last_result; |
|
| 162 | + } |
|
| 163 | 163 | |
| 164 | - /** |
|
| 165 | - * Get the task frequency. |
|
| 166 | - * |
|
| 167 | - * @return int |
|
| 168 | - */ |
|
| 169 | - public function getFrequency(){ |
|
| 170 | - return $this->frequency; |
|
| 171 | - } |
|
| 164 | + /** |
|
| 165 | + * Get the task frequency. |
|
| 166 | + * |
|
| 167 | + * @return int |
|
| 168 | + */ |
|
| 169 | + public function getFrequency(){ |
|
| 170 | + return $this->frequency; |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | 173 | /** |
| 174 | - * Set the task frequency. |
|
| 175 | - * |
|
| 174 | + * Set the task frequency. |
|
| 175 | + * |
|
| 176 | 176 | * @param int $frequency |
| 177 | - * @return self Enable method-chaining |
|
| 178 | - */ |
|
| 179 | - public function setFrequency($frequency){ |
|
| 180 | - $this->frequency = $frequency; |
|
| 177 | + * @return self Enable method-chaining |
|
| 178 | + */ |
|
| 179 | + public function setFrequency($frequency){ |
|
| 180 | + $this->frequency = $frequency; |
|
| 181 | 181 | return $this; |
| 182 | - } |
|
| 182 | + } |
|
| 183 | 183 | |
| 184 | - /** |
|
| 185 | - * Get the number of remaining occurrences. |
|
| 186 | - * |
|
| 187 | - * @return int |
|
| 188 | - */ |
|
| 189 | - public function getRemainingOccurrences(){ |
|
| 190 | - return $this->nb_occurrences; |
|
| 191 | - } |
|
| 184 | + /** |
|
| 185 | + * Get the number of remaining occurrences. |
|
| 186 | + * |
|
| 187 | + * @return int |
|
| 188 | + */ |
|
| 189 | + public function getRemainingOccurrences(){ |
|
| 190 | + return $this->nb_occurrences; |
|
| 191 | + } |
|
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | - * Set the number of remaining occurrences. |
|
| 195 | - * |
|
| 194 | + * Set the number of remaining occurrences. |
|
| 195 | + * |
|
| 196 | 196 | * @param int $nb_occur |
| 197 | - * @return self Enable method-chaining |
|
| 198 | - */ |
|
| 199 | - public function setRemainingOccurrences($nb_occur){ |
|
| 200 | - $this->nb_occurrences = $nb_occur; |
|
| 197 | + * @return self Enable method-chaining |
|
| 198 | + */ |
|
| 199 | + public function setRemainingOccurrences($nb_occur){ |
|
| 200 | + $this->nb_occurrences = $nb_occur; |
|
| 201 | 201 | return $this; |
| 202 | - } |
|
| 202 | + } |
|
| 203 | 203 | |
| 204 | - /** |
|
| 205 | - * Check if the task if running. |
|
| 206 | - * |
|
| 207 | - * @return bool |
|
| 208 | - */ |
|
| 209 | - public function isRunning(){ |
|
| 210 | - return $this->is_running; |
|
| 211 | - } |
|
| 204 | + /** |
|
| 205 | + * Check if the task if running. |
|
| 206 | + * |
|
| 207 | + * @return bool |
|
| 208 | + */ |
|
| 209 | + public function isRunning(){ |
|
| 210 | + return $this->is_running; |
|
| 211 | + } |
|
| 212 | 212 | |
| 213 | 213 | |
| 214 | - /** |
|
| 215 | - * Return the name to display for the task |
|
| 216 | - * |
|
| 217 | - * @return string Title for the task |
|
| 218 | - */ |
|
| 219 | - abstract public function getTitle(); |
|
| 214 | + /** |
|
| 215 | + * Return the name to display for the task |
|
| 216 | + * |
|
| 217 | + * @return string Title for the task |
|
| 218 | + */ |
|
| 219 | + abstract public function getTitle(); |
|
| 220 | 220 | |
| 221 | - /** |
|
| 222 | - * Return the default frequency for the execution of the task |
|
| 223 | - * |
|
| 224 | - * @return int Frequency for the execution of the task |
|
| 225 | - */ |
|
| 226 | - abstract public function getDefaultFrequency(); |
|
| 221 | + /** |
|
| 222 | + * Return the default frequency for the execution of the task |
|
| 223 | + * |
|
| 224 | + * @return int Frequency for the execution of the task |
|
| 225 | + */ |
|
| 226 | + abstract public function getDefaultFrequency(); |
|
| 227 | 227 | |
| 228 | - /** |
|
| 229 | - * Execute the task's actions |
|
| 230 | - */ |
|
| 231 | - abstract protected function executeSteps(); |
|
| 228 | + /** |
|
| 229 | + * Execute the task's actions |
|
| 230 | + */ |
|
| 231 | + abstract protected function executeSteps(); |
|
| 232 | 232 | |
| 233 | 233 | /** |
| 234 | 234 | * Persist task state into database. |
| 235 | 235 | * @return bool |
| 236 | 236 | */ |
| 237 | 237 | public function save() { |
| 238 | - if(!$this->provider) throw new \Exception('The task has not been initialised with a provider.'); |
|
| 238 | + if(!$this->provider) throw new \Exception('The task has not been initialised with a provider.'); |
|
| 239 | 239 | return $this->provider->updateTask($this); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - /** |
|
| 243 | - * Execute the task, default skeleton |
|
| 244 | - * |
|
| 245 | - */ |
|
| 246 | - public function execute(){ |
|
| 242 | + /** |
|
| 243 | + * Execute the task, default skeleton |
|
| 244 | + * |
|
| 245 | + */ |
|
| 246 | + public function execute(){ |
|
| 247 | 247 | |
| 248 | - if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime()) |
|
| 249 | - $this->is_running = false; |
|
| 248 | + if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime()) |
|
| 249 | + $this->is_running = false; |
|
| 250 | 250 | |
| 251 | - if(!$this->is_running){ |
|
| 252 | - $this->last_result = false; |
|
| 253 | - $this->is_running = true; |
|
| 254 | - $this->save(); |
|
| 251 | + if(!$this->is_running){ |
|
| 252 | + $this->last_result = false; |
|
| 253 | + $this->is_running = true; |
|
| 254 | + $this->save(); |
|
| 255 | 255 | |
| 256 | - Log::addDebugLog('Start execution of Admin task: '.$this->getTitle()); |
|
| 257 | - $this->last_result = $this->executeSteps(); |
|
| 258 | - if($this->last_result){ |
|
| 259 | - $this->last_updated = new \DateTime(); |
|
| 260 | - if($this->nb_occurrences > 0){ |
|
| 261 | - $this->nb_occurrences--; |
|
| 262 | - if($this->nb_occurrences == 0) $this->is_enabled = false; |
|
| 263 | - } |
|
| 264 | - } |
|
| 265 | - $this->is_running = false; |
|
| 266 | - $this->save(); |
|
| 267 | - Log::addDebugLog('Execution completed for Admin task: '.$this->getTitle().' - '.($this->last_result ? 'Success' : 'Failure')); |
|
| 268 | - } |
|
| 269 | - } |
|
| 256 | + Log::addDebugLog('Start execution of Admin task: '.$this->getTitle()); |
|
| 257 | + $this->last_result = $this->executeSteps(); |
|
| 258 | + if($this->last_result){ |
|
| 259 | + $this->last_updated = new \DateTime(); |
|
| 260 | + if($this->nb_occurrences > 0){ |
|
| 261 | + $this->nb_occurrences--; |
|
| 262 | + if($this->nb_occurrences == 0) $this->is_enabled = false; |
|
| 263 | + } |
|
| 264 | + } |
|
| 265 | + $this->is_running = false; |
|
| 266 | + $this->save(); |
|
| 267 | + Log::addDebugLog('Execution completed for Admin task: '.$this->getTitle().' - '.($this->last_result ? 'Success' : 'Failure')); |
|
| 268 | + } |
|
| 269 | + } |
|
| 270 | 270 | |
| 271 | 271 | |
| 272 | 272 | } |
@@ -29,89 +29,89 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | class AdminConfigController extends MvcController |
| 31 | 31 | { |
| 32 | - /** |
|
| 33 | - * Manage updates sent from the AdminConfig@index form. |
|
| 34 | - */ |
|
| 35 | - protected function update() { |
|
| 36 | - if(Auth::isAdmin()){ |
|
| 37 | - $ihooks = HookProvider::getInstance()->getInstalledHooks(); |
|
| 32 | + /** |
|
| 33 | + * Manage updates sent from the AdminConfig@index form. |
|
| 34 | + */ |
|
| 35 | + protected function update() { |
|
| 36 | + if(Auth::isAdmin()){ |
|
| 37 | + $ihooks = HookProvider::getInstance()->getInstalledHooks(); |
|
| 38 | 38 | |
| 39 | - $module_names= Database::prepare( |
|
| 40 | - "SELECT module_name FROM `##module` WHERE status='disabled'" |
|
| 41 | - )->fetchOneColumn(); |
|
| 39 | + $module_names= Database::prepare( |
|
| 40 | + "SELECT module_name FROM `##module` WHERE status='disabled'" |
|
| 41 | + )->fetchOneColumn(); |
|
| 42 | 42 | |
| 43 | - if($ihooks !== null){ |
|
| 44 | - foreach ($ihooks as $ihook => $params) { |
|
| 45 | - if(Filter::post('hook-' . $params['id']) === 'yes') { |
|
| 46 | - $array_hook = explode('#', $ihook); |
|
| 47 | - //Update status |
|
| 48 | - $new_status= Filter::postBool('status-' . $params['id']); |
|
| 49 | - if(in_array($array_hook[0], $module_names)) $new_status = false; |
|
| 50 | - $previous_status = $params['status']; |
|
| 51 | - if ($new_status !== null) { |
|
| 52 | - $new_status= $new_status ? 'enabled' : 'disabled'; |
|
| 53 | - if($new_status != $previous_status){ |
|
| 54 | - $chook = new Hook($array_hook[1], $array_hook[2]); |
|
| 55 | - switch($new_status){ |
|
| 56 | - case 'enabled': |
|
| 57 | - $chook->enable($array_hook[0]); |
|
| 58 | - break; |
|
| 59 | - case 'disabled': |
|
| 60 | - $chook->disable($array_hook[0]); |
|
| 61 | - break; |
|
| 62 | - default: |
|
| 63 | - break; |
|
| 64 | - } |
|
| 65 | - } |
|
| 66 | - } |
|
| 43 | + if($ihooks !== null){ |
|
| 44 | + foreach ($ihooks as $ihook => $params) { |
|
| 45 | + if(Filter::post('hook-' . $params['id']) === 'yes') { |
|
| 46 | + $array_hook = explode('#', $ihook); |
|
| 47 | + //Update status |
|
| 48 | + $new_status= Filter::postBool('status-' . $params['id']); |
|
| 49 | + if(in_array($array_hook[0], $module_names)) $new_status = false; |
|
| 50 | + $previous_status = $params['status']; |
|
| 51 | + if ($new_status !== null) { |
|
| 52 | + $new_status= $new_status ? 'enabled' : 'disabled'; |
|
| 53 | + if($new_status != $previous_status){ |
|
| 54 | + $chook = new Hook($array_hook[1], $array_hook[2]); |
|
| 55 | + switch($new_status){ |
|
| 56 | + case 'enabled': |
|
| 57 | + $chook->enable($array_hook[0]); |
|
| 58 | + break; |
|
| 59 | + case 'disabled': |
|
| 60 | + $chook->disable($array_hook[0]); |
|
| 61 | + break; |
|
| 62 | + default: |
|
| 63 | + break; |
|
| 64 | + } |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - //Update priority |
|
| 69 | - $new_priority = Filter::postInteger("moduleorder-{$params['id']}"); |
|
| 70 | - $previous_priority = $params['priority']; |
|
| 71 | - if ($new_priority !== null) { |
|
| 72 | - if($new_priority != $previous_priority){ |
|
| 73 | - $chook = new Hook($array_hook[1], $array_hook[2]); |
|
| 74 | - $chook->setPriority($array_hook[0], $new_priority); |
|
| 75 | - } |
|
| 76 | - } |
|
| 77 | - } |
|
| 78 | - } |
|
| 79 | - } |
|
| 80 | - } |
|
| 81 | - } |
|
| 68 | + //Update priority |
|
| 69 | + $new_priority = Filter::postInteger("moduleorder-{$params['id']}"); |
|
| 70 | + $previous_priority = $params['priority']; |
|
| 71 | + if ($new_priority !== null) { |
|
| 72 | + if($new_priority != $previous_priority){ |
|
| 73 | + $chook = new Hook($array_hook[1], $array_hook[2]); |
|
| 74 | + $chook->setPriority($array_hook[0], $new_priority); |
|
| 75 | + } |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | + } |
|
| 80 | + } |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Pages |
|
| 85 | - */ |
|
| 83 | + /** |
|
| 84 | + * Pages |
|
| 85 | + */ |
|
| 86 | 86 | |
| 87 | - /** |
|
| 88 | - * AdminConfig@index |
|
| 89 | - */ |
|
| 90 | - public function index() { |
|
| 91 | - global $WT_TREE; |
|
| 87 | + /** |
|
| 88 | + * AdminConfig@index |
|
| 89 | + */ |
|
| 90 | + public function index() { |
|
| 91 | + global $WT_TREE; |
|
| 92 | 92 | |
| 93 | - HookProvider::getInstance()->updateHooks(); |
|
| 93 | + HookProvider::getInstance()->updateHooks(); |
|
| 94 | 94 | |
| 95 | - $action = Filter::post('action'); |
|
| 96 | - if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
| 95 | + $action = Filter::post('action'); |
|
| 96 | + if($action == 'update' && Filter::checkCsrf()) $this->update(); |
|
| 97 | 97 | |
| 98 | - Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
| 99 | - $ctrl = new PageController(); |
|
| 100 | - $ctrl |
|
| 101 | - ->restrictAccess(Auth::isAdmin()) |
|
| 102 | - ->setPageTitle($this->module->getTitle()); |
|
| 98 | + Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
| 99 | + $ctrl = new PageController(); |
|
| 100 | + $ctrl |
|
| 101 | + ->restrictAccess(Auth::isAdmin()) |
|
| 102 | + ->setPageTitle($this->module->getTitle()); |
|
| 103 | 103 | |
| 104 | - $table_id = 'table-installedhooks-' . Uuid::uuid4(); |
|
| 104 | + $table_id = 'table-installedhooks-' . Uuid::uuid4(); |
|
| 105 | 105 | |
| 106 | - $view_bag = new ViewBag(); |
|
| 107 | - $view_bag->set('title', $ctrl->getPageTitle()); |
|
| 108 | - $view_bag->set('table_id', $table_id); |
|
| 109 | - $view_bag->set('hook_list', HookProvider::getInstance()->getRawInstalledHooks()); |
|
| 106 | + $view_bag = new ViewBag(); |
|
| 107 | + $view_bag->set('title', $ctrl->getPageTitle()); |
|
| 108 | + $view_bag->set('table_id', $table_id); |
|
| 109 | + $view_bag->set('hook_list', HookProvider::getInstance()->getRawInstalledHooks()); |
|
| 110 | 110 | |
| 111 | - $ctrl |
|
| 112 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 113 | - ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL) |
|
| 114 | - ->addInlineJavascript(' |
|
| 111 | + $ctrl |
|
| 112 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 113 | + ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL) |
|
| 114 | + ->addInlineJavascript(' |
|
| 115 | 115 | jQuery(document).ready(function() { |
| 116 | 116 | jQuery("#'.$table_id.'").dataTable( { |
| 117 | 117 | '.I18N::datatablesI18N().', |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | }); |
| 132 | 132 | '); |
| 133 | 133 | |
| 134 | - ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render(); |
|
| 135 | - } |
|
| 134 | + ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render(); |
|
| 135 | + } |
|
| 136 | 136 | |
| 137 | 137 | } |
| 138 | 138 | \ No newline at end of file |