@@ -30,16 +30,16 @@ discard block |
||
| 30 | 30 | * {@inhericDoc} |
| 31 | 31 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
| 32 | 32 | */ |
| 33 | - protected function renderContent() { |
|
| 34 | - ?> |
|
| 33 | + protected function renderContent() { |
|
| 34 | + ?> |
|
| 35 | 35 | <div id="maj-sosa-missing-page" class="center"> |
| 36 | 36 | <h2><?= $this->data->get('title') ?></h2> |
| 37 | 37 | |
| 38 | 38 | <?php if($this->data->get('is_setup')) { |
| 39 | - $this->renderSosaHeader(); |
|
| 40 | - if($this->data->get('has_missing', false)) { |
|
| 41 | - $table_id = $this->data->get('table_id'); |
|
| 42 | - ?> |
|
| 39 | + $this->renderSosaHeader(); |
|
| 40 | + if($this->data->get('has_missing', false)) { |
|
| 41 | + $table_id = $this->data->get('table_id'); |
|
| 42 | + ?> |
|
| 43 | 43 | <div id="sosa-indi-missing" class="smissing-list"> |
| 44 | 44 | <table id="<?= $table_id ?>"> |
| 45 | 45 | <thead> |
@@ -103,48 +103,48 @@ discard block |
||
| 103 | 103 | <tbody> |
| 104 | 104 | |
| 105 | 105 | <?php foreach($this->data->get('missing_list') as $missing_tab) { |
| 106 | - $person = $missing_tab['indi']; |
|
| 106 | + $person = $missing_tab['indi']; |
|
| 107 | 107 | |
| 108 | - /** @var \Fisharebest\Webtrees\Individual $person */ |
|
| 109 | - if ($person->isPendingAddtion()) { |
|
| 110 | - $class = ' class="new"'; |
|
| 111 | - } elseif ($person->isPendingDeletion()) { |
|
| 112 | - $class = ' class="old"'; |
|
| 113 | - } else { |
|
| 114 | - $class = ''; |
|
| 115 | - } |
|
| 116 | - $dperson = new \MyArtJaub\Webtrees\Individual($person); |
|
| 117 | - list($surn_givn, $givn_surn) = FunctionsPrintLists::sortableNames($person); |
|
| 118 | - ?> |
|
| 108 | + /** @var \Fisharebest\Webtrees\Individual $person */ |
|
| 109 | + if ($person->isPendingAddtion()) { |
|
| 110 | + $class = ' class="new"'; |
|
| 111 | + } elseif ($person->isPendingDeletion()) { |
|
| 112 | + $class = ' class="old"'; |
|
| 113 | + } else { |
|
| 114 | + $class = ''; |
|
| 115 | + } |
|
| 116 | + $dperson = new \MyArtJaub\Webtrees\Individual($person); |
|
| 117 | + list($surn_givn, $givn_surn) = FunctionsPrintLists::sortableNames($person); |
|
| 118 | + ?> |
|
| 119 | 119 | <tr <?= $class ?>> |
| 120 | 120 | <td class="transparent"><?= $missing_tab['sosa'] ?></td> |
| 121 | 121 | <td class="transparent"><?= $person->getXref() ?></td> |
| 122 | 122 | <td colspan="2" data-sort="<?= Filter::escapeHtml($givn_surn) ?>"> |
| 123 | 123 | <?php foreach ($person->getAllNames() as $num=>$name) { |
| 124 | - if ($name['type']=='NAME') { |
|
| 125 | - $title=''; |
|
| 126 | - } else { |
|
| 127 | - $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
| 128 | - } |
|
| 129 | - if ($num==$person->getPrimaryName()) { |
|
| 130 | - $class=' class="name2"'; |
|
| 131 | - $sex_image=$person->getSexImage(); |
|
| 132 | - } else { |
|
| 133 | - $class=''; |
|
| 134 | - $sex_image=''; |
|
| 135 | - } ?> |
|
| 124 | + if ($name['type']=='NAME') { |
|
| 125 | + $title=''; |
|
| 126 | + } else { |
|
| 127 | + $title='title="'.strip_tags(GedcomTag::getLabel($name['type'], $person)).'"'; |
|
| 128 | + } |
|
| 129 | + if ($num==$person->getPrimaryName()) { |
|
| 130 | + $class=' class="name2"'; |
|
| 131 | + $sex_image=$person->getSexImage(); |
|
| 132 | + } else { |
|
| 133 | + $class=''; |
|
| 134 | + $sex_image=''; |
|
| 135 | + } ?> |
|
| 136 | 136 | <a <?= $title.' '.$class ?> href="<?= $person->getHtmlUrl() ?>"> |
| 137 | 137 | <?= \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($name['full']) ?> |
| 138 | 138 | </a> |
| 139 | 139 | <?= $sex_image.FunctionsPrint::formatSosaNumbers($dperson->getSosaNumbers(), 1, 'smaller') ?> |
| 140 | 140 | <br/> |
| 141 | 141 | <?php } |
| 142 | - echo $person->getPrimaryParentsNames('parents details1', 'none'); |
|
| 143 | - ?> |
|
| 142 | + echo $person->getPrimaryParentsNames('parents details1', 'none'); |
|
| 143 | + ?> |
|
| 144 | 144 | </td> |
| 145 | 145 | <td hidden data-sort="<?= Filter::escapeHtml($surn_givn) ?>"></td> |
| 146 | 146 | <?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) { |
| 147 | - $isISourced = $dperson->isSourced(); ?> |
|
| 147 | + $isISourced = $dperson->isSourced(); ?> |
|
| 148 | 148 | <td data-sort="<?= $isISourced ?>"><?= FunctionsPrint::formatIsSourcedIcon('R', $isISourced, 'INDI', 1, 'medium') ?></td> |
| 149 | 149 | <?php } else { ?> |
| 150 | 150 | <td> </td> |
@@ -154,23 +154,23 @@ discard block |
||
| 154 | 154 | <?php $birth_dates = $person->getAllBirthDates(); ?> |
| 155 | 155 | <td data-sort="<?= $person->getEstimatedBirthDate()->julianDay() ?>"> |
| 156 | 156 | <?php |
| 157 | - foreach ($birth_dates as $n => $birth_date) { |
|
| 158 | - if ($n > 0) { ?> <br> <?php } |
|
| 159 | - echo $birth_date->display(true); |
|
| 160 | - } |
|
| 161 | - ?> |
|
| 157 | + foreach ($birth_dates as $n => $birth_date) { |
|
| 158 | + if ($n > 0) { ?> <br> <?php } |
|
| 159 | + echo $birth_date->display(true); |
|
| 160 | + } |
|
| 161 | + ?> |
|
| 162 | 162 | </td> |
| 163 | 163 | <td> |
| 164 | 164 | <?php foreach ($person->getAllBirthPlaces() as $n => $birth_place) { |
| 165 | - $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree()); |
|
| 166 | - if ($n > 0) { ?><br><?php } ?> |
|
| 165 | + $tmp = new \Fisharebest\Webtrees\Place($birth_place, $person->getTree()); |
|
| 166 | + if ($n > 0) { ?><br><?php } ?> |
|
| 167 | 167 | <a href="'<?= $tmp->getURL(); ?>" title="<?= strip_tags($tmp->getFullName()) ?>"> |
| 168 | 168 | <?= \Fisharebest\Webtrees\Functions\FunctionsPrint::highlightSearchHits($tmp->getShortName()) ?> |
| 169 | 169 | </a> |
| 170 | 170 | <?php } ?> |
| 171 | 171 | </td> |
| 172 | 172 | <?php if (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME)) { |
| 173 | - $isBSourced = $dperson->isBirthSourced(); ?> |
|
| 173 | + $isBSourced = $dperson->isBirthSourced(); ?> |
|
| 174 | 174 | <td data-sort="<?= $isBSourced ?>"><?= FunctionsPrint::formatIsSourcedIcon('E', $isBSourced, 'BIRT', 1, 'medium') ?></td> |
| 175 | 175 | <?php } else { ?> |
| 176 | 176 | <td> </td> |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | <?php } else if ($this->data->get('generation', 0) > 0) { ?> |
| 196 | 196 | <p><?= I18N::translate('No ancestors are missing for this generation. Generation complete at %s.', I18N::percentage($this->data->get('perc_sosa'), 2)) ?></p> |
| 197 | 197 | <?php } |
| 198 | - } else { ?> |
|
| 198 | + } else { ?> |
|
| 199 | 199 | <p class="warning"><?= I18N::translate('The list could not be displayed. Reasons might be:') ?><br/> |
| 200 | 200 | <ul> |
| 201 | 201 | <li><?= I18N::translate('No Sosa root individual has been defined.') ?></li> |
@@ -206,6 +206,6 @@ discard block |
||
| 206 | 206 | <?php } ?> |
| 207 | 207 | </div> |
| 208 | 208 | <?php |
| 209 | - } |
|
| 209 | + } |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | \ No newline at end of file |
@@ -36,70 +36,70 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | class SosaListController extends MvcController |
| 38 | 38 | { |
| 39 | - /** |
|
| 40 | - * Sosa Provider for the controller |
|
| 41 | - * @var SosaProvider $sosa_provider |
|
| 42 | - */ |
|
| 43 | - protected $sosa_provider; |
|
| 39 | + /** |
|
| 40 | + * Sosa Provider for the controller |
|
| 41 | + * @var SosaProvider $sosa_provider |
|
| 42 | + */ |
|
| 43 | + protected $sosa_provider; |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Generation used for the controller |
|
| 47 | - * @var int $generation |
|
| 48 | - */ |
|
| 49 | - protected $generation; |
|
| 45 | + /** |
|
| 46 | + * Generation used for the controller |
|
| 47 | + * @var int $generation |
|
| 48 | + */ |
|
| 49 | + protected $generation; |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * ViewBag to hold data for the controller |
|
| 53 | - * @var ViewBag $view_bag |
|
| 54 | - */ |
|
| 55 | - protected $view_bag; |
|
| 51 | + /** |
|
| 52 | + * ViewBag to hold data for the controller |
|
| 53 | + * @var ViewBag $view_bag |
|
| 54 | + */ |
|
| 55 | + protected $view_bag; |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * {@inheritDoc} |
|
| 59 | - * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module) |
|
| 60 | - */ |
|
| 61 | - public function __construct(AbstractModule $module) { |
|
| 62 | - global $WT_TREE; |
|
| 57 | + /** |
|
| 58 | + * {@inheritDoc} |
|
| 59 | + * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module) |
|
| 60 | + */ |
|
| 61 | + public function __construct(AbstractModule $module) { |
|
| 62 | + global $WT_TREE; |
|
| 63 | 63 | |
| 64 | - parent::__construct($module); |
|
| 64 | + parent::__construct($module); |
|
| 65 | 65 | |
| 66 | - $this->sosa_provider = new SosaProvider($WT_TREE, Auth::user()); |
|
| 66 | + $this->sosa_provider = new SosaProvider($WT_TREE, Auth::user()); |
|
| 67 | 67 | |
| 68 | - $this->generation = Filter::getInteger('gen'); |
|
| 68 | + $this->generation = Filter::getInteger('gen'); |
|
| 69 | 69 | |
| 70 | - $this->view_bag = new ViewBag(); |
|
| 71 | - $this->view_bag->set('generation', $this->generation); |
|
| 72 | - $this->view_bag->set('max_gen', $this->sosa_provider->getLastGeneration()); |
|
| 73 | - $this->view_bag->set('is_setup', $this->sosa_provider->isSetup() && $this->view_bag->get('max_gen', 0)> 0); |
|
| 70 | + $this->view_bag = new ViewBag(); |
|
| 71 | + $this->view_bag->set('generation', $this->generation); |
|
| 72 | + $this->view_bag->set('max_gen', $this->sosa_provider->getLastGeneration()); |
|
| 73 | + $this->view_bag->set('is_setup', $this->sosa_provider->isSetup() && $this->view_bag->get('max_gen', 0)> 0); |
|
| 74 | 74 | |
| 75 | - } |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * Pages |
|
| 80 | - */ |
|
| 78 | + /** |
|
| 79 | + * Pages |
|
| 80 | + */ |
|
| 81 | 81 | |
| 82 | - /** |
|
| 83 | - * SosaList@index |
|
| 84 | - */ |
|
| 85 | - public function index() { |
|
| 86 | - global $WT_TREE; |
|
| 82 | + /** |
|
| 83 | + * SosaList@index |
|
| 84 | + */ |
|
| 85 | + public function index() { |
|
| 86 | + global $WT_TREE; |
|
| 87 | 87 | |
| 88 | - $controller = new PageController(); |
|
| 89 | - $controller |
|
| 90 | - ->setPageTitle(I18N::translate('Sosa Ancestors')); |
|
| 88 | + $controller = new PageController(); |
|
| 89 | + $controller |
|
| 90 | + ->setPageTitle(I18N::translate('Sosa Ancestors')); |
|
| 91 | 91 | |
| 92 | - $this->view_bag->set('title', $controller->getPageTitle()); |
|
| 92 | + $this->view_bag->set('title', $controller->getPageTitle()); |
|
| 93 | 93 | |
| 94 | - if($this->view_bag->get('is_setup', false)) { |
|
| 95 | - $this->view_bag->set('has_sosa', $this->generation > 0 && $this->sosa_provider->getSosaCountAtGeneration($this->generation) > 0); |
|
| 96 | - $this->view_bag->set('url_module', $this->module->getName()); |
|
| 97 | - $this->view_bag->set('url_action', 'SosaList'); |
|
| 98 | - $this->view_bag->set('url_ged', $WT_TREE->getNameUrl()); |
|
| 99 | - $this->view_bag->set('min_gen', 1); |
|
| 94 | + if($this->view_bag->get('is_setup', false)) { |
|
| 95 | + $this->view_bag->set('has_sosa', $this->generation > 0 && $this->sosa_provider->getSosaCountAtGeneration($this->generation) > 0); |
|
| 96 | + $this->view_bag->set('url_module', $this->module->getName()); |
|
| 97 | + $this->view_bag->set('url_action', 'SosaList'); |
|
| 98 | + $this->view_bag->set('url_ged', $WT_TREE->getNameUrl()); |
|
| 99 | + $this->view_bag->set('min_gen', 1); |
|
| 100 | 100 | |
| 101 | - if($this->view_bag->get('has_sosa', false)) { |
|
| 102 | - $controller->addInlineJavascript(' |
|
| 101 | + if($this->view_bag->get('has_sosa', false)) { |
|
| 102 | + $controller->addInlineJavascript(' |
|
| 103 | 103 | jQuery("#sosalist-tabs").tabs(); |
| 104 | 104 | jQuery("#sosalist-tabs").css("visibility", "visible"); |
| 105 | 105 | |
@@ -153,44 +153,44 @@ discard block |
||
| 153 | 153 | ); |
| 154 | 154 | |
| 155 | 155 | '); |
| 156 | - } |
|
| 157 | - } |
|
| 156 | + } |
|
| 157 | + } |
|
| 158 | 158 | |
| 159 | - ViewFactory::make('SosaList', $this, $controller, $this->view_bag)->render(); |
|
| 160 | - } |
|
| 159 | + ViewFactory::make('SosaList', $this, $controller, $this->view_bag)->render(); |
|
| 160 | + } |
|
| 161 | 161 | |
| 162 | 162 | |
| 163 | - /** |
|
| 164 | - * SosaList@missing |
|
| 165 | - */ |
|
| 166 | - public function missing() { |
|
| 167 | - global $WT_TREE; |
|
| 163 | + /** |
|
| 164 | + * SosaList@missing |
|
| 165 | + */ |
|
| 166 | + public function missing() { |
|
| 167 | + global $WT_TREE; |
|
| 168 | 168 | |
| 169 | - $controller = new PageController(); |
|
| 170 | - $controller |
|
| 171 | - ->setPageTitle(I18N::translate('Missing Ancestors')); |
|
| 169 | + $controller = new PageController(); |
|
| 170 | + $controller |
|
| 171 | + ->setPageTitle(I18N::translate('Missing Ancestors')); |
|
| 172 | 172 | |
| 173 | - $this->view_bag->set('title', $controller->getPageTitle()); |
|
| 173 | + $this->view_bag->set('title', $controller->getPageTitle()); |
|
| 174 | 174 | |
| 175 | - if($this->view_bag->get('is_setup', false)) { |
|
| 176 | - $this->view_bag->set('url_module', $this->module->getName()); |
|
| 177 | - $this->view_bag->set('url_action', 'SosaList@missing'); |
|
| 178 | - $this->view_bag->set('url_ged', $WT_TREE->getNameUrl()); |
|
| 179 | - $this->view_bag->set('min_gen', 2); |
|
| 175 | + if($this->view_bag->get('is_setup', false)) { |
|
| 176 | + $this->view_bag->set('url_module', $this->module->getName()); |
|
| 177 | + $this->view_bag->set('url_action', 'SosaList@missing'); |
|
| 178 | + $this->view_bag->set('url_ged', $WT_TREE->getNameUrl()); |
|
| 179 | + $this->view_bag->set('min_gen', 2); |
|
| 180 | 180 | |
| 181 | - $missing_list = $this->sosa_provider->getMissingSosaListAtGeneration($this->generation); |
|
| 182 | - $this->view_bag->set('has_missing', $this->generation > 0 && count($missing_list) > 0); |
|
| 181 | + $missing_list = $this->sosa_provider->getMissingSosaListAtGeneration($this->generation); |
|
| 182 | + $this->view_bag->set('has_missing', $this->generation > 0 && count($missing_list) > 0); |
|
| 183 | 183 | |
| 184 | - $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation -1)); |
|
| 185 | - $this->view_bag->set('perc_sosa', $perc_sosa); |
|
| 184 | + $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation -1)); |
|
| 185 | + $this->view_bag->set('perc_sosa', $perc_sosa); |
|
| 186 | 186 | |
| 187 | - if($this->view_bag->get('has_missing', false)) { |
|
| 188 | - $table_id = 'table-sosa-missing-' . Uuid::uuid4(); |
|
| 189 | - $this->view_bag->set('table_id', $table_id); |
|
| 187 | + if($this->view_bag->get('has_missing', false)) { |
|
| 188 | + $table_id = 'table-sosa-missing-' . Uuid::uuid4(); |
|
| 189 | + $this->view_bag->set('table_id', $table_id); |
|
| 190 | 190 | |
| 191 | - $controller |
|
| 192 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 193 | - ->addInlineJavascript(' |
|
| 191 | + $controller |
|
| 192 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 193 | + ->addInlineJavascript(' |
|
| 194 | 194 | jQuery.fn.dataTableExt.oSort["text-asc"] = textCompareAsc; |
| 195 | 195 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
| 196 | 196 | |
@@ -242,77 +242,77 @@ discard block |
||
| 242 | 242 | jQuery(".loading-image").css("display", "none"); |
| 243 | 243 | '); |
| 244 | 244 | |
| 245 | - $unique_indis = array(); |
|
| 246 | - $sum_missing_different = 0; |
|
| 247 | - $sum_missing_different_without_hidden = 0; |
|
| 248 | - foreach($missing_list as $num => $missing_tab) { |
|
| 249 | - if(isset($unique_indis[$missing_tab['indi']])) { |
|
| 250 | - unset($missing_list[$num]); |
|
| 251 | - continue; |
|
| 252 | - } |
|
| 253 | - $sum_missing_different += !$missing_tab['has_father'] + !$missing_tab['has_mother']; |
|
| 254 | - $person = Individual::getInstance($missing_tab['indi'], $WT_TREE); |
|
| 255 | - if (!$person || !$person->canShowName()) { |
|
| 256 | - unset($missing_list[$num]); |
|
| 257 | - continue; |
|
| 258 | - } |
|
| 259 | - $sum_missing_different_without_hidden += !$missing_tab['has_father'] + !$missing_tab['has_mother']; |
|
| 260 | - $unique_indis[$person->getXref()] = true; |
|
| 261 | - $missing_tab['indi'] = $person; |
|
| 262 | - $missing_list[$num] = $missing_tab; |
|
| 263 | - } |
|
| 264 | - $this->view_bag->set('missing_list', $missing_list); |
|
| 265 | - $this->view_bag->set('missing_diff_count', $sum_missing_different); |
|
| 266 | - $this->view_bag->set('missing_hidden', $sum_missing_different - $sum_missing_different_without_hidden); |
|
| 267 | - $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation-2)); |
|
| 268 | - $this->view_bag->set('perc_sosa_potential', $perc_sosa_potential); |
|
| 269 | - } |
|
| 270 | - } |
|
| 245 | + $unique_indis = array(); |
|
| 246 | + $sum_missing_different = 0; |
|
| 247 | + $sum_missing_different_without_hidden = 0; |
|
| 248 | + foreach($missing_list as $num => $missing_tab) { |
|
| 249 | + if(isset($unique_indis[$missing_tab['indi']])) { |
|
| 250 | + unset($missing_list[$num]); |
|
| 251 | + continue; |
|
| 252 | + } |
|
| 253 | + $sum_missing_different += !$missing_tab['has_father'] + !$missing_tab['has_mother']; |
|
| 254 | + $person = Individual::getInstance($missing_tab['indi'], $WT_TREE); |
|
| 255 | + if (!$person || !$person->canShowName()) { |
|
| 256 | + unset($missing_list[$num]); |
|
| 257 | + continue; |
|
| 258 | + } |
|
| 259 | + $sum_missing_different_without_hidden += !$missing_tab['has_father'] + !$missing_tab['has_mother']; |
|
| 260 | + $unique_indis[$person->getXref()] = true; |
|
| 261 | + $missing_tab['indi'] = $person; |
|
| 262 | + $missing_list[$num] = $missing_tab; |
|
| 263 | + } |
|
| 264 | + $this->view_bag->set('missing_list', $missing_list); |
|
| 265 | + $this->view_bag->set('missing_diff_count', $sum_missing_different); |
|
| 266 | + $this->view_bag->set('missing_hidden', $sum_missing_different - $sum_missing_different_without_hidden); |
|
| 267 | + $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation-2)); |
|
| 268 | + $this->view_bag->set('perc_sosa_potential', $perc_sosa_potential); |
|
| 269 | + } |
|
| 270 | + } |
|
| 271 | 271 | |
| 272 | - ViewFactory::make('SosaListMissing', $this, $controller, $this->view_bag)->render(); |
|
| 273 | - } |
|
| 272 | + ViewFactory::make('SosaListMissing', $this, $controller, $this->view_bag)->render(); |
|
| 273 | + } |
|
| 274 | 274 | |
| 275 | - /** |
|
| 276 | - * SosaList@sosalist |
|
| 277 | - */ |
|
| 278 | - public function sosalist() { |
|
| 275 | + /** |
|
| 276 | + * SosaList@sosalist |
|
| 277 | + */ |
|
| 278 | + public function sosalist() { |
|
| 279 | 279 | |
| 280 | - $type = Filter::get('type', 'indi|fam', null); |
|
| 280 | + $type = Filter::get('type', 'indi|fam', null); |
|
| 281 | 281 | |
| 282 | - $controller = new AjaxController(); |
|
| 283 | - $controller->restrictAccess($this->generation > 0 || !is_null($type)); |
|
| 282 | + $controller = new AjaxController(); |
|
| 283 | + $controller->restrictAccess($this->generation > 0 || !is_null($type)); |
|
| 284 | 284 | |
| 285 | - switch ($type){ |
|
| 286 | - case 'indi': |
|
| 287 | - $this->renderSosaListIndi($controller); |
|
| 288 | - break; |
|
| 289 | - case 'fam': |
|
| 290 | - $this->renderFamSosaListIndi($controller); |
|
| 291 | - break; |
|
| 292 | - default: |
|
| 293 | - break; |
|
| 294 | - } |
|
| 285 | + switch ($type){ |
|
| 286 | + case 'indi': |
|
| 287 | + $this->renderSosaListIndi($controller); |
|
| 288 | + break; |
|
| 289 | + case 'fam': |
|
| 290 | + $this->renderFamSosaListIndi($controller); |
|
| 291 | + break; |
|
| 292 | + default: |
|
| 293 | + break; |
|
| 294 | + } |
|
| 295 | 295 | |
| 296 | - } |
|
| 296 | + } |
|
| 297 | 297 | |
| 298 | - /** |
|
| 299 | - * Render the Ajax response for the sortable table of Sosa individuals |
|
| 300 | - * @param AjaxController $controller |
|
| 301 | - */ |
|
| 302 | - protected function renderSosaListIndi(AjaxController $controller) { |
|
| 303 | - global $WT_TREE; |
|
| 298 | + /** |
|
| 299 | + * Render the Ajax response for the sortable table of Sosa individuals |
|
| 300 | + * @param AjaxController $controller |
|
| 301 | + */ |
|
| 302 | + protected function renderSosaListIndi(AjaxController $controller) { |
|
| 303 | + global $WT_TREE; |
|
| 304 | 304 | |
| 305 | - $listSosa = $this->sosa_provider->getSosaListAtGeneration($this->generation); |
|
| 306 | - $this->view_bag->set('has_sosa', false); |
|
| 305 | + $listSosa = $this->sosa_provider->getSosaListAtGeneration($this->generation); |
|
| 306 | + $this->view_bag->set('has_sosa', false); |
|
| 307 | 307 | |
| 308 | - if(count($listSosa) > 0) { |
|
| 309 | - $this->view_bag->set('has_sosa', true); |
|
| 310 | - $table_id = 'table-sosa-indi-' . Uuid::uuid4(); |
|
| 311 | - $this->view_bag->set('table_id', $table_id); |
|
| 308 | + if(count($listSosa) > 0) { |
|
| 309 | + $this->view_bag->set('has_sosa', true); |
|
| 310 | + $table_id = 'table-sosa-indi-' . Uuid::uuid4(); |
|
| 311 | + $this->view_bag->set('table_id', $table_id); |
|
| 312 | 312 | |
| 313 | - $controller |
|
| 314 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 315 | - ->addInlineJavascript(' |
|
| 313 | + $controller |
|
| 314 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 315 | + ->addInlineJavascript(' |
|
| 316 | 316 | jQuery.fn.dataTableExt.oSort["text-asc"] = textCompareAsc; |
| 317 | 317 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
| 318 | 318 | |
@@ -379,96 +379,96 @@ discard block |
||
| 379 | 379 | jQuery("#btn-toggle-statistics-'.$table_id.'").click(); |
| 380 | 380 | '); |
| 381 | 381 | |
| 382 | - $stats = new Stats($WT_TREE); |
|
| 382 | + $stats = new Stats($WT_TREE); |
|
| 383 | 383 | |
| 384 | - // Bad data can cause "longest life" to be huge, blowing memory limits |
|
| 385 | - $max_age = min($WT_TREE->getPreference('MAX_ALIVE_AGE'), $stats->LongestLifeAge()) + 1; |
|
| 386 | - // Inititialise chart data |
|
| 387 | - $deat_by_age = array(); |
|
| 388 | - for ($age = 0; $age <= $max_age; $age++) { |
|
| 389 | - $deat_by_age[$age] = ''; |
|
| 390 | - } |
|
| 391 | - $birt_by_decade = array(); |
|
| 392 | - $deat_by_decade = array(); |
|
| 393 | - for ($year = 1550; $year < 2030; $year += 10) { |
|
| 394 | - $birt_by_decade[$year] = ''; |
|
| 395 | - $deat_by_decade[$year] = ''; |
|
| 396 | - } |
|
| 384 | + // Bad data can cause "longest life" to be huge, blowing memory limits |
|
| 385 | + $max_age = min($WT_TREE->getPreference('MAX_ALIVE_AGE'), $stats->LongestLifeAge()) + 1; |
|
| 386 | + // Inititialise chart data |
|
| 387 | + $deat_by_age = array(); |
|
| 388 | + for ($age = 0; $age <= $max_age; $age++) { |
|
| 389 | + $deat_by_age[$age] = ''; |
|
| 390 | + } |
|
| 391 | + $birt_by_decade = array(); |
|
| 392 | + $deat_by_decade = array(); |
|
| 393 | + for ($year = 1550; $year < 2030; $year += 10) { |
|
| 394 | + $birt_by_decade[$year] = ''; |
|
| 395 | + $deat_by_decade[$year] = ''; |
|
| 396 | + } |
|
| 397 | 397 | |
| 398 | - $unique_indis = array(); // Don't double-count indis with multiple names. |
|
| 399 | - $nb_displayed = 0; |
|
| 398 | + $unique_indis = array(); // Don't double-count indis with multiple names. |
|
| 399 | + $nb_displayed = 0; |
|
| 400 | 400 | |
| 401 | - Individual::load($WT_TREE, $listSosa); |
|
| 402 | - foreach($listSosa as $sosa => $pid) { |
|
| 403 | - $person = Individual::getInstance($pid, $WT_TREE); |
|
| 404 | - if (!$person || !$person->canShowName()) { |
|
| 405 | - unset($listSosa[$sosa]); |
|
| 406 | - continue; |
|
| 407 | - } |
|
| 408 | - $nb_displayed++; |
|
| 409 | - if ($birth_dates=$person->getAllBirthDates()) { |
|
| 410 | - if ( |
|
| 411 | - FunctionsPrint::isDateWithinChartsRange($birth_dates[0]) && |
|
| 412 | - !isset($unique_indis[$person->getXref()]) |
|
| 413 | - ) { |
|
| 414 | - $birt_by_decade[(int)($birth_dates[0]->gregorianYear()/10)*10] .= $person->getSex(); |
|
| 415 | - } |
|
| 416 | - } |
|
| 417 | - else { |
|
| 418 | - $birth_dates[0]=new Date(''); |
|
| 419 | - } |
|
| 420 | - if ($death_dates = $person->getAllDeathDates()) { |
|
| 421 | - if ( |
|
| 422 | - FunctionsPrint::isDateWithinChartsRange($death_dates[0]) && |
|
| 423 | - !isset($unique_indis[$person->getXref()]) |
|
| 424 | - ) { |
|
| 425 | - $deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
| 426 | - } |
|
| 427 | - } |
|
| 428 | - else { |
|
| 429 | - $death_dates[0] = new Date(''); |
|
| 430 | - } |
|
| 431 | - $age = Date::getAge($birth_dates[0], $death_dates[0], 0); |
|
| 432 | - if (!isset($unique_indis[$person->getXref()]) && $age >= 0 && $age <= $max_age) { |
|
| 433 | - $deat_by_age[$age] .= $person->getSex(); |
|
| 434 | - } |
|
| 435 | - $listSosa[$sosa] = $person; |
|
| 436 | - $unique_indis[$person->getXref()] = true; |
|
| 437 | - } |
|
| 438 | - $this->view_bag->set('sosa_list', $listSosa); |
|
| 401 | + Individual::load($WT_TREE, $listSosa); |
|
| 402 | + foreach($listSosa as $sosa => $pid) { |
|
| 403 | + $person = Individual::getInstance($pid, $WT_TREE); |
|
| 404 | + if (!$person || !$person->canShowName()) { |
|
| 405 | + unset($listSosa[$sosa]); |
|
| 406 | + continue; |
|
| 407 | + } |
|
| 408 | + $nb_displayed++; |
|
| 409 | + if ($birth_dates=$person->getAllBirthDates()) { |
|
| 410 | + if ( |
|
| 411 | + FunctionsPrint::isDateWithinChartsRange($birth_dates[0]) && |
|
| 412 | + !isset($unique_indis[$person->getXref()]) |
|
| 413 | + ) { |
|
| 414 | + $birt_by_decade[(int)($birth_dates[0]->gregorianYear()/10)*10] .= $person->getSex(); |
|
| 415 | + } |
|
| 416 | + } |
|
| 417 | + else { |
|
| 418 | + $birth_dates[0]=new Date(''); |
|
| 419 | + } |
|
| 420 | + if ($death_dates = $person->getAllDeathDates()) { |
|
| 421 | + if ( |
|
| 422 | + FunctionsPrint::isDateWithinChartsRange($death_dates[0]) && |
|
| 423 | + !isset($unique_indis[$person->getXref()]) |
|
| 424 | + ) { |
|
| 425 | + $deat_by_decade[(int) ($death_dates[0]->gregorianYear() / 10) * 10] .= $person->getSex(); |
|
| 426 | + } |
|
| 427 | + } |
|
| 428 | + else { |
|
| 429 | + $death_dates[0] = new Date(''); |
|
| 430 | + } |
|
| 431 | + $age = Date::getAge($birth_dates[0], $death_dates[0], 0); |
|
| 432 | + if (!isset($unique_indis[$person->getXref()]) && $age >= 0 && $age <= $max_age) { |
|
| 433 | + $deat_by_age[$age] .= $person->getSex(); |
|
| 434 | + } |
|
| 435 | + $listSosa[$sosa] = $person; |
|
| 436 | + $unique_indis[$person->getXref()] = true; |
|
| 437 | + } |
|
| 438 | + $this->view_bag->set('sosa_list', $listSosa); |
|
| 439 | 439 | |
| 440 | - $this->view_bag->set('sosa_count', count($listSosa)); |
|
| 441 | - $this->view_bag->set('sosa_theo', pow(2, $this->generation-1)); |
|
| 442 | - $this->view_bag->set('sosa_ratio', Functions::safeDivision($this->view_bag->get('sosa_count'), $this->view_bag->get('sosa_theo'))); |
|
| 440 | + $this->view_bag->set('sosa_count', count($listSosa)); |
|
| 441 | + $this->view_bag->set('sosa_theo', pow(2, $this->generation-1)); |
|
| 442 | + $this->view_bag->set('sosa_ratio', Functions::safeDivision($this->view_bag->get('sosa_count'), $this->view_bag->get('sosa_theo'))); |
|
| 443 | 443 | |
| 444 | - $this->view_bag->set('sosa_hidden', $this->view_bag->get('sosa_count') - $nb_displayed); |
|
| 444 | + $this->view_bag->set('sosa_hidden', $this->view_bag->get('sosa_count') - $nb_displayed); |
|
| 445 | 445 | |
| 446 | - $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth'))); |
|
| 447 | - $this->view_bag->set('chart_deaths', FunctionsPrintLists::chartByDecade($deat_by_decade, I18N::translate('Decade of death'))); |
|
| 448 | - $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($deat_by_age, I18N::translate('Age related to death year'))); |
|
| 449 | - } |
|
| 446 | + $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth'))); |
|
| 447 | + $this->view_bag->set('chart_deaths', FunctionsPrintLists::chartByDecade($deat_by_decade, I18N::translate('Decade of death'))); |
|
| 448 | + $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($deat_by_age, I18N::translate('Age related to death year'))); |
|
| 449 | + } |
|
| 450 | 450 | |
| 451 | - ViewFactory::make('SosaListIndi', $this, $controller, $this->view_bag)->render(); |
|
| 452 | - } |
|
| 451 | + ViewFactory::make('SosaListIndi', $this, $controller, $this->view_bag)->render(); |
|
| 452 | + } |
|
| 453 | 453 | |
| 454 | - /** |
|
| 455 | - * Render the Ajax response for the sortable table of Sosa family |
|
| 456 | - * @param AjaxController $controller |
|
| 457 | - */ |
|
| 458 | - protected function renderFamSosaListIndi(AjaxController $controller) { |
|
| 459 | - global $WT_TREE; |
|
| 454 | + /** |
|
| 455 | + * Render the Ajax response for the sortable table of Sosa family |
|
| 456 | + * @param AjaxController $controller |
|
| 457 | + */ |
|
| 458 | + protected function renderFamSosaListIndi(AjaxController $controller) { |
|
| 459 | + global $WT_TREE; |
|
| 460 | 460 | |
| 461 | - $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation);; |
|
| 462 | - $this->view_bag->set('has_sosa', false); |
|
| 461 | + $listFamSosa = $this->sosa_provider->getFamilySosaListAtGeneration($this->generation);; |
|
| 462 | + $this->view_bag->set('has_sosa', false); |
|
| 463 | 463 | |
| 464 | - if(count($listFamSosa) > 0) { |
|
| 465 | - $this->view_bag->set('has_sosa', true); |
|
| 466 | - $table_id = 'table-sosa-fam-' . Uuid::uuid4(); |
|
| 467 | - $this->view_bag->set('table_id', $table_id); |
|
| 464 | + if(count($listFamSosa) > 0) { |
|
| 465 | + $this->view_bag->set('has_sosa', true); |
|
| 466 | + $table_id = 'table-sosa-fam-' . Uuid::uuid4(); |
|
| 467 | + $this->view_bag->set('table_id', $table_id); |
|
| 468 | 468 | |
| 469 | - $controller |
|
| 470 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 471 | - ->addInlineJavascript(' |
|
| 469 | + $controller |
|
| 470 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 471 | + ->addInlineJavascript(' |
|
| 472 | 472 | jQuery.fn.dataTableExt.oSort["text-asc"] = textCompareAsc; |
| 473 | 473 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
| 474 | 474 | |
@@ -532,67 +532,67 @@ discard block |
||
| 532 | 532 | jQuery("#btn-toggle-statistics-'.$table_id.'").click(); |
| 533 | 533 | '); |
| 534 | 534 | |
| 535 | - $stats = new Stats($WT_TREE); |
|
| 536 | - $max_age = max($stats->oldestMarriageMaleAge(), $stats->oldestMarriageFemaleAge()) + 1; |
|
| 535 | + $stats = new Stats($WT_TREE); |
|
| 536 | + $max_age = max($stats->oldestMarriageMaleAge(), $stats->oldestMarriageFemaleAge()) + 1; |
|
| 537 | 537 | |
| 538 | - //-- init chart data |
|
| 539 | - $marr_by_age = array(); |
|
| 540 | - for ($age=0; $age<=$max_age; $age++) { |
|
| 541 | - $marr_by_age[$age] = ''; |
|
| 542 | - } |
|
| 543 | - $birt_by_decade = array(); |
|
| 544 | - $marr_by_decade = array(); |
|
| 545 | - for ($year=1550; $year<2030; $year+=10) { |
|
| 546 | - $birt_by_decade[$year] = ''; |
|
| 547 | - $marr_by_decade[$year] = ''; |
|
| 548 | - } |
|
| 538 | + //-- init chart data |
|
| 539 | + $marr_by_age = array(); |
|
| 540 | + for ($age=0; $age<=$max_age; $age++) { |
|
| 541 | + $marr_by_age[$age] = ''; |
|
| 542 | + } |
|
| 543 | + $birt_by_decade = array(); |
|
| 544 | + $marr_by_decade = array(); |
|
| 545 | + for ($year=1550; $year<2030; $year+=10) { |
|
| 546 | + $birt_by_decade[$year] = ''; |
|
| 547 | + $marr_by_decade[$year] = ''; |
|
| 548 | + } |
|
| 549 | 549 | |
| 550 | - foreach($listFamSosa as $sosa => $fid) { |
|
| 551 | - $sfamily = Family::getInstance($fid, $WT_TREE); |
|
| 552 | - if(!$sfamily || !$sfamily->canShow()) { |
|
| 553 | - unset($listFamSosa[$sosa]); |
|
| 554 | - continue; |
|
| 555 | - } |
|
| 556 | - $mdate=$sfamily->getMarriageDate(); |
|
| 550 | + foreach($listFamSosa as $sosa => $fid) { |
|
| 551 | + $sfamily = Family::getInstance($fid, $WT_TREE); |
|
| 552 | + if(!$sfamily || !$sfamily->canShow()) { |
|
| 553 | + unset($listFamSosa[$sosa]); |
|
| 554 | + continue; |
|
| 555 | + } |
|
| 556 | + $mdate=$sfamily->getMarriageDate(); |
|
| 557 | 557 | |
| 558 | - if( ($husb = $sfamily->getHusband()) && |
|
| 559 | - ($hdate = $husb->getBirthDate()) && |
|
| 560 | - $hdate->isOK() && $mdate->isOK()) { |
|
| 561 | - if (FunctionsPrint::isDateWithinChartsRange($hdate)) { |
|
| 562 | - $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
| 563 | - } |
|
| 564 | - $hage = Date::getAge($hdate, $mdate, 0); |
|
| 565 | - if ($hage >= 0 && $hage <= $max_age) { |
|
| 566 | - $marr_by_age[$hage] .= $husb->getSex(); |
|
| 567 | - } |
|
| 568 | - } |
|
| 558 | + if( ($husb = $sfamily->getHusband()) && |
|
| 559 | + ($hdate = $husb->getBirthDate()) && |
|
| 560 | + $hdate->isOK() && $mdate->isOK()) { |
|
| 561 | + if (FunctionsPrint::isDateWithinChartsRange($hdate)) { |
|
| 562 | + $birt_by_decade[(int) ($hdate->gregorianYear() / 10) * 10] .= $husb->getSex(); |
|
| 563 | + } |
|
| 564 | + $hage = Date::getAge($hdate, $mdate, 0); |
|
| 565 | + if ($hage >= 0 && $hage <= $max_age) { |
|
| 566 | + $marr_by_age[$hage] .= $husb->getSex(); |
|
| 567 | + } |
|
| 568 | + } |
|
| 569 | 569 | |
| 570 | - if(($wife = $sfamily->getWife()) && |
|
| 571 | - ($wdate=$wife->getBirthDate()) && |
|
| 572 | - $wdate->isOK() && $mdate->isOK()) { |
|
| 573 | - if (FunctionsPrint::isDateWithinChartsRange($wdate)) { |
|
| 574 | - $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
| 575 | - } |
|
| 576 | - $wage = Date::getAge($wdate, $mdate, 0); |
|
| 577 | - if ($wage >= 0 && $wage <= $max_age) { |
|
| 578 | - $marr_by_age[$wage] .= $wife->getSex(); |
|
| 579 | - } |
|
| 580 | - } |
|
| 570 | + if(($wife = $sfamily->getWife()) && |
|
| 571 | + ($wdate=$wife->getBirthDate()) && |
|
| 572 | + $wdate->isOK() && $mdate->isOK()) { |
|
| 573 | + if (FunctionsPrint::isDateWithinChartsRange($wdate)) { |
|
| 574 | + $birt_by_decade[(int) ($wdate->gregorianYear() / 10) * 10] .= $wife->getSex(); |
|
| 575 | + } |
|
| 576 | + $wage = Date::getAge($wdate, $mdate, 0); |
|
| 577 | + if ($wage >= 0 && $wage <= $max_age) { |
|
| 578 | + $marr_by_age[$wage] .= $wife->getSex(); |
|
| 579 | + } |
|
| 580 | + } |
|
| 581 | 581 | |
| 582 | - if ($mdate->isOK() && FunctionsPrint::isDateWithinChartsRange($mdate) && $husb && $wife) { |
|
| 583 | - $marr_by_decade[(int) ($mdate->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex(); |
|
| 584 | - } |
|
| 582 | + if ($mdate->isOK() && FunctionsPrint::isDateWithinChartsRange($mdate) && $husb && $wife) { |
|
| 583 | + $marr_by_decade[(int) ($mdate->gregorianYear() / 10) * 10] .= $husb->getSex() . $wife->getSex(); |
|
| 584 | + } |
|
| 585 | 585 | |
| 586 | - $listFamSosa[$sosa] = $sfamily; |
|
| 587 | - } |
|
| 588 | - $this->view_bag->set('sosa_list', $listFamSosa); |
|
| 586 | + $listFamSosa[$sosa] = $sfamily; |
|
| 587 | + } |
|
| 588 | + $this->view_bag->set('sosa_list', $listFamSosa); |
|
| 589 | 589 | |
| 590 | - $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth'))); |
|
| 591 | - $this->view_bag->set('chart_marriages', FunctionsPrintLists::chartByDecade($marr_by_decade, I18N::translate('Decade of marriage'))); |
|
| 592 | - $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($marr_by_age, I18N::translate('Age in year of marriage'))); |
|
| 593 | - } |
|
| 590 | + $this->view_bag->set('chart_births', FunctionsPrintLists::chartByDecade($birt_by_decade, I18N::translate('Decade of birth'))); |
|
| 591 | + $this->view_bag->set('chart_marriages', FunctionsPrintLists::chartByDecade($marr_by_decade, I18N::translate('Decade of marriage'))); |
|
| 592 | + $this->view_bag->set('chart_ages', FunctionsPrintLists::chartByAge($marr_by_age, I18N::translate('Age in year of marriage'))); |
|
| 593 | + } |
|
| 594 | 594 | |
| 595 | - ViewFactory::make('SosaListFam', $this, $controller, $this->view_bag)->render(); |
|
| 596 | - } |
|
| 595 | + ViewFactory::make('SosaListFam', $this, $controller, $this->view_bag)->render(); |
|
| 596 | + } |
|
| 597 | 597 | |
| 598 | 598 | } |
| 599 | 599 | \ No newline at end of file |
@@ -20,81 +20,81 @@ |
||
| 20 | 20 | * Welcome Block Module. |
| 21 | 21 | */ |
| 22 | 22 | class WelcomeBlockModule extends AbstractModule |
| 23 | - implements ModuleBlockInterface |
|
| 23 | + implements ModuleBlockInterface |
|
| 24 | 24 | { |
| 25 | - /** @var string For custom modules - link for support, upgrades, etc. */ |
|
| 26 | - const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
| 25 | + /** @var string For custom modules - link for support, upgrades, etc. */ |
|
| 26 | + const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * {@inhericDoc} |
|
| 30 | - */ |
|
| 31 | - public function getTitle() { |
|
| 32 | - return /* I18N: Name of the “WelcomeBlock” module */ I18N::translate('MyArtJaub Welcome Block'); |
|
| 33 | - } |
|
| 28 | + /** |
|
| 29 | + * {@inhericDoc} |
|
| 30 | + */ |
|
| 31 | + public function getTitle() { |
|
| 32 | + return /* I18N: Name of the “WelcomeBlock” module */ I18N::translate('MyArtJaub Welcome Block'); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * {@inhericDoc} |
|
| 37 | - */ |
|
| 38 | - public function getDescription() { |
|
| 39 | - return /* I18N: Description of the “WelcomeBlock” module */ I18N::translate('The MyArtJaub Welcome block welcomes the visitor to the site, allows a quick login to the site, and displays statistics on visits.'); |
|
| 40 | - } |
|
| 35 | + /** |
|
| 36 | + * {@inhericDoc} |
|
| 37 | + */ |
|
| 38 | + public function getDescription() { |
|
| 39 | + return /* I18N: Description of the “WelcomeBlock” module */ I18N::translate('The MyArtJaub Welcome block welcomes the visitor to the site, allows a quick login to the site, and displays statistics on visits.'); |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * {@inhericDoc} |
|
| 44 | - */ |
|
| 45 | - public function modAction($mod_action) { |
|
| 46 | - \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
| 47 | - } |
|
| 42 | + /** |
|
| 43 | + * {@inhericDoc} |
|
| 44 | + */ |
|
| 45 | + public function modAction($mod_action) { |
|
| 46 | + \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * {@inhericDoc} |
|
| 51 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock() |
|
| 52 | - */ |
|
| 49 | + /** |
|
| 50 | + * {@inhericDoc} |
|
| 51 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock() |
|
| 52 | + */ |
|
| 53 | 53 | public function getBlock($block_id, $template = true, $cfg = array()) { |
| 54 | - global $controller, $WT_TREE; |
|
| 54 | + global $controller, $WT_TREE; |
|
| 55 | 55 | |
| 56 | - $wb_controller = new WelcomeBlockController($this); |
|
| 57 | - return $wb_controller->index($controller, $WT_TREE, $block_id, $template); |
|
| 58 | - } |
|
| 56 | + $wb_controller = new WelcomeBlockController($this); |
|
| 57 | + return $wb_controller->index($controller, $WT_TREE, $block_id, $template); |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - /** |
|
| 61 | - * {@inhericDoc} |
|
| 62 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::loadAjax() |
|
| 63 | - */ |
|
| 64 | - public function loadAjax() { |
|
| 65 | - return false; |
|
| 66 | - } |
|
| 60 | + /** |
|
| 61 | + * {@inhericDoc} |
|
| 62 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::loadAjax() |
|
| 63 | + */ |
|
| 64 | + public function loadAjax() { |
|
| 65 | + return false; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * {@inhericDoc} |
|
| 70 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isUserBlock() |
|
| 71 | - */ |
|
| 72 | - public function isUserBlock() { |
|
| 73 | - return false; |
|
| 74 | - } |
|
| 68 | + /** |
|
| 69 | + * {@inhericDoc} |
|
| 70 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isUserBlock() |
|
| 71 | + */ |
|
| 72 | + public function isUserBlock() { |
|
| 73 | + return false; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * {@inhericDoc} |
|
| 78 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isGedcomBlock() |
|
| 79 | - */ |
|
| 80 | - public function isGedcomBlock() { |
|
| 81 | - return true; |
|
| 82 | - } |
|
| 76 | + /** |
|
| 77 | + * {@inhericDoc} |
|
| 78 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isGedcomBlock() |
|
| 79 | + */ |
|
| 80 | + public function isGedcomBlock() { |
|
| 81 | + return true; |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - /** |
|
| 85 | - * {@inhericDoc} |
|
| 86 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::configureBlock() |
|
| 87 | - */ |
|
| 88 | - public function configureBlock($block_id) { |
|
| 89 | - $wb_controller = new WelcomeBlockController($this); |
|
| 90 | - try { |
|
| 91 | - return $wb_controller->config($block_id); |
|
| 92 | - } |
|
| 93 | - catch (MvcException $ex) { |
|
| 94 | - if($ex->getHttpCode() != 200) throw $ex; |
|
| 95 | - return; |
|
| 96 | - } |
|
| 97 | - } |
|
| 84 | + /** |
|
| 85 | + * {@inhericDoc} |
|
| 86 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::configureBlock() |
|
| 87 | + */ |
|
| 88 | + public function configureBlock($block_id) { |
|
| 89 | + $wb_controller = new WelcomeBlockController($this); |
|
| 90 | + try { |
|
| 91 | + return $wb_controller->config($block_id); |
|
| 92 | + } |
|
| 93 | + catch (MvcException $ex) { |
|
| 94 | + if($ex->getHttpCode() != 200) throw $ex; |
|
| 95 | + return; |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | \ No newline at end of file |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | * {@inhericDoc} |
| 23 | 23 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
| 24 | 24 | */ |
| 25 | - protected function renderContent() { |
|
| 26 | - ?> |
|
| 25 | + protected function renderContent() { |
|
| 26 | + ?> |
|
| 27 | 27 | <div id="maj-sosa-stats-page"> |
| 28 | 28 | <h2><?php echo $this->data->get('title'); ?></h2> |
| 29 | 29 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | <?php } ?> |
| 36 | 36 | |
| 37 | 37 | <?php if($this->data->get('is_setup')) { |
| 38 | - $general_stats = $this->data->get('general_stats'); ?> |
|
| 38 | + $general_stats = $this->data->get('general_stats'); ?> |
|
| 39 | 39 | <h3><?php echo I18N::translate('General statistics'); ?></h3> |
| 40 | 40 | <div class="maj-table"> |
| 41 | 41 | <div class="maj-row"> |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | <?php } else { ?> |
| 141 | 141 | <div class="center warning"><?php echo I18N::translate('No Sosa root individual has been defined.'); ?></div> |
| 142 | 142 | <?php } |
| 143 | - } |
|
| 143 | + } |
|
| 144 | 144 | |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | \ No newline at end of file |
@@ -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 | jQuery.fn.dataTableExt.oSort["text-asc"] = textCompareAsc; |
| 92 | 92 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
| 93 | 93 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | }); |
| 120 | 120 | |
| 121 | 121 | ') |
| 122 | - ->addInlineJavascript(' |
|
| 122 | + ->addInlineJavascript(' |
|
| 123 | 123 | function set_geoanalysis_status(ga_id, status, gedcom) { |
| 124 | 124 | jQuery.ajax({ |
| 125 | 125 | url: "module.php", |
@@ -163,55 +163,55 @@ discard block |
||
| 163 | 163 | '); |
| 164 | 164 | |
| 165 | 165 | |
| 166 | - ViewFactory::make('AdminConfig', $this, $controller, $data)->render(); |
|
| 167 | - } |
|
| 166 | + ViewFactory::make('AdminConfig', $this, $controller, $data)->render(); |
|
| 167 | + } |
|
| 168 | 168 | |
| 169 | - /** |
|
| 170 | - * AdminConfig@jsonGeoAnalysisList |
|
| 171 | - */ |
|
| 172 | - public function jsonGeoAnalysisList() { |
|
| 173 | - global $WT_TREE; |
|
| 169 | + /** |
|
| 170 | + * AdminConfig@jsonGeoAnalysisList |
|
| 171 | + */ |
|
| 172 | + public function jsonGeoAnalysisList() { |
|
| 173 | + global $WT_TREE; |
|
| 174 | 174 | |
| 175 | - $controller = new JsonController(); |
|
| 176 | - $controller |
|
| 177 | - ->restrictAccess(Auth::isManager($WT_TREE)); |
|
| 175 | + $controller = new JsonController(); |
|
| 176 | + $controller |
|
| 177 | + ->restrictAccess(Auth::isManager($WT_TREE)); |
|
| 178 | 178 | |
| 179 | - // Generate an AJAX/JSON response for datatables to load a block of rows |
|
| 180 | - $search = Filter::postArray('search'); |
|
| 181 | - if($search) $search = $search['value']; |
|
| 182 | - $start = Filter::postInteger('start'); |
|
| 183 | - $length = Filter::postInteger('length'); |
|
| 184 | - $order = Filter::postArray('order'); |
|
| 179 | + // Generate an AJAX/JSON response for datatables to load a block of rows |
|
| 180 | + $search = Filter::postArray('search'); |
|
| 181 | + if($search) $search = $search['value']; |
|
| 182 | + $start = Filter::postInteger('start'); |
|
| 183 | + $length = Filter::postInteger('length'); |
|
| 184 | + $order = Filter::postArray('order'); |
|
| 185 | 185 | |
| 186 | - foreach($order as $key => &$value) { |
|
| 187 | - switch($value['column']) { |
|
| 188 | - case 3: |
|
| 189 | - $value['column'] = 'majgd_descr'; |
|
| 190 | - break; |
|
| 191 | - case 5; |
|
| 192 | - $value['column'] = 'majgd_sublevel'; |
|
| 193 | - break; |
|
| 194 | - default: |
|
| 195 | - unset($order[$key]); |
|
| 196 | - } |
|
| 197 | - } |
|
| 186 | + foreach($order as $key => &$value) { |
|
| 187 | + switch($value['column']) { |
|
| 188 | + case 3: |
|
| 189 | + $value['column'] = 'majgd_descr'; |
|
| 190 | + break; |
|
| 191 | + case 5; |
|
| 192 | + $value['column'] = 'majgd_sublevel'; |
|
| 193 | + break; |
|
| 194 | + default: |
|
| 195 | + unset($order[$key]); |
|
| 196 | + } |
|
| 197 | + } |
|
| 198 | 198 | |
| 199 | - /** @var GeoAnalysisProvider $provider */ |
|
| 200 | - $provider = $this->module->getProvider(); |
|
| 199 | + /** @var GeoAnalysisProvider $provider */ |
|
| 200 | + $provider = $this->module->getProvider(); |
|
| 201 | 201 | |
| 202 | - $list = $provider->getFilteredGeoAnalysisList($search, $order, $start, $length); |
|
| 203 | - $recordsFiltered = count($list); |
|
| 204 | - $recordsTotal = $this->provider->getGeoAnalysisCount(); |
|
| 202 | + $list = $provider->getFilteredGeoAnalysisList($search, $order, $start, $length); |
|
| 203 | + $recordsFiltered = count($list); |
|
| 204 | + $recordsTotal = $this->provider->getGeoAnalysisCount(); |
|
| 205 | 205 | |
| 206 | - $data = array(); |
|
| 207 | - $place_hierarchy = $this->provider->getPlacesHierarchy(); |
|
| 208 | - foreach($list as $ga) { |
|
| 209 | - /** @var GeoAnalysis $ga */ |
|
| 206 | + $data = array(); |
|
| 207 | + $place_hierarchy = $this->provider->getPlacesHierarchy(); |
|
| 208 | + foreach($list as $ga) { |
|
| 209 | + /** @var GeoAnalysis $ga */ |
|
| 210 | 210 | |
| 211 | - $datum = array(); |
|
| 212 | - $options= $ga->getOptions(); |
|
| 211 | + $datum = array(); |
|
| 212 | + $options= $ga->getOptions(); |
|
| 213 | 213 | |
| 214 | - $datum[0] = ' |
|
| 214 | + $datum[0] = ' |
|
| 215 | 215 | <div class="btn-group"> |
| 216 | 216 | <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> |
| 217 | 217 | <i class="fa fa-pencil"></i><span class="caret"></span> |
@@ -235,108 +235,108 @@ discard block |
||
| 235 | 235 | </li> |
| 236 | 236 | </ul> |
| 237 | 237 | </div>'; |
| 238 | - $datum[1] = $ga->getId(); |
|
| 239 | - $datum[2] = $ga->isEnabled() ? |
|
| 238 | + $datum[1] = $ga->getId(); |
|
| 239 | + $datum[2] = $ga->isEnabled() ? |
|
| 240 | 240 | '<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : |
| 241 | 241 | '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>'; |
| 242 | - $datum[3] = $ga->getTitle(); |
|
| 243 | - $analysis_level = $ga->getAnalysisLevel(); |
|
| 244 | - if($place_hierarchy['type'] == 'header') { |
|
| 245 | - $datum[4] = $place_hierarchy['hierarchy'][$analysis_level - 1]; |
|
| 246 | - } else { |
|
| 247 | - $datum[4] = $analysis_level . '(' . $place_hierarchy['hierarchy'][$analysis_level - 1] . ')'; |
|
| 248 | - } |
|
| 249 | - $datum[5] = $ga->getAnalysisLevel(); |
|
| 250 | - $datum[6] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>'; |
|
| 251 | - $datum[7] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>'; |
|
| 252 | - if($ga->hasMap()) { |
|
| 253 | - $datum[6] = $options->getMap()->getDescription(); |
|
| 254 | - $datum[7] = '<span data-toggle="tooltip" title="' . $options->getMap()->getTopLevelName() . '" />'; |
|
| 255 | - $top_level = $options->getMapLevel(); |
|
| 256 | - if($place_hierarchy['type'] == 'header') { |
|
| 257 | - $datum[7] .= $place_hierarchy['hierarchy'][$top_level - 1]; |
|
| 258 | - } else { |
|
| 259 | - $datum[7] .= $top_level . '(' . $place_hierarchy['hierarchy'][$top_level - 1] . ')'; |
|
| 260 | - } |
|
| 261 | - $datum[7] .= '</span>'; |
|
| 262 | - } |
|
| 263 | - $datum[8] = $options->isUsingFlags() ? |
|
| 242 | + $datum[3] = $ga->getTitle(); |
|
| 243 | + $analysis_level = $ga->getAnalysisLevel(); |
|
| 244 | + if($place_hierarchy['type'] == 'header') { |
|
| 245 | + $datum[4] = $place_hierarchy['hierarchy'][$analysis_level - 1]; |
|
| 246 | + } else { |
|
| 247 | + $datum[4] = $analysis_level . '(' . $place_hierarchy['hierarchy'][$analysis_level - 1] . ')'; |
|
| 248 | + } |
|
| 249 | + $datum[5] = $ga->getAnalysisLevel(); |
|
| 250 | + $datum[6] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>'; |
|
| 251 | + $datum[7] = '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('None').'</span>'; |
|
| 252 | + if($ga->hasMap()) { |
|
| 253 | + $datum[6] = $options->getMap()->getDescription(); |
|
| 254 | + $datum[7] = '<span data-toggle="tooltip" title="' . $options->getMap()->getTopLevelName() . '" />'; |
|
| 255 | + $top_level = $options->getMapLevel(); |
|
| 256 | + if($place_hierarchy['type'] == 'header') { |
|
| 257 | + $datum[7] .= $place_hierarchy['hierarchy'][$top_level - 1]; |
|
| 258 | + } else { |
|
| 259 | + $datum[7] .= $top_level . '(' . $place_hierarchy['hierarchy'][$top_level - 1] . ')'; |
|
| 260 | + } |
|
| 261 | + $datum[7] .= '</span>'; |
|
| 262 | + } |
|
| 263 | + $datum[8] = $options->isUsingFlags() ? |
|
| 264 | 264 | '<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : |
| 265 | 265 | '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>'; |
| 266 | - $datum[9] = $options->getMaxDetailsInGen() > 0 ? $options->getMaxDetailsInGen() : I18N::translate('All'); |
|
| 266 | + $datum[9] = $options->getMaxDetailsInGen() > 0 ? $options->getMaxDetailsInGen() : I18N::translate('All'); |
|
| 267 | 267 | |
| 268 | - $data[] = $datum; |
|
| 269 | - } |
|
| 268 | + $data[] = $datum; |
|
| 269 | + } |
|
| 270 | 270 | |
| 271 | - $controller->pageHeader(); |
|
| 271 | + $controller->pageHeader(); |
|
| 272 | 272 | |
| 273 | - $controller->encode(array( |
|
| 274 | - 'draw' => Filter::getInteger('draw'), |
|
| 275 | - 'recordsTotal' => $recordsTotal, |
|
| 276 | - 'recordsFiltered' => $recordsFiltered, |
|
| 277 | - 'data' => $data |
|
| 278 | - )); |
|
| 273 | + $controller->encode(array( |
|
| 274 | + 'draw' => Filter::getInteger('draw'), |
|
| 275 | + 'recordsTotal' => $recordsTotal, |
|
| 276 | + 'recordsFiltered' => $recordsFiltered, |
|
| 277 | + 'data' => $data |
|
| 278 | + )); |
|
| 279 | 279 | |
| 280 | - } |
|
| 280 | + } |
|
| 281 | 281 | |
| 282 | - /** |
|
| 283 | - * AdminConfig@edit |
|
| 284 | - */ |
|
| 285 | - public function edit() { |
|
| 286 | - $ga_id = Filter::getInteger('ga_id'); |
|
| 287 | - $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 282 | + /** |
|
| 283 | + * AdminConfig@edit |
|
| 284 | + */ |
|
| 285 | + public function edit() { |
|
| 286 | + $ga_id = Filter::getInteger('ga_id'); |
|
| 287 | + $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 288 | 288 | |
| 289 | - $this->renderEdit($ga); |
|
| 290 | - } |
|
| 289 | + $this->renderEdit($ga); |
|
| 290 | + } |
|
| 291 | 291 | |
| 292 | - /** |
|
| 293 | - * AdminConfig@add |
|
| 294 | - */ |
|
| 295 | - public function add() { |
|
| 296 | - $this->renderEdit(null); |
|
| 297 | - } |
|
| 292 | + /** |
|
| 293 | + * AdminConfig@add |
|
| 294 | + */ |
|
| 295 | + public function add() { |
|
| 296 | + $this->renderEdit(null); |
|
| 297 | + } |
|
| 298 | 298 | |
| 299 | - /** |
|
| 300 | - * AdminConfig@save |
|
| 301 | - */ |
|
| 302 | - public function save() { |
|
| 303 | - global $WT_TREE; |
|
| 299 | + /** |
|
| 300 | + * AdminConfig@save |
|
| 301 | + */ |
|
| 302 | + public function save() { |
|
| 303 | + global $WT_TREE; |
|
| 304 | 304 | |
| 305 | - $tmp_contrl = new PageController(); |
|
| 306 | - $tmp_contrl->restrictAccess( |
|
| 307 | - Auth::isManager($WT_TREE) |
|
| 308 | - && Filter::checkCsrf() |
|
| 309 | - ); |
|
| 305 | + $tmp_contrl = new PageController(); |
|
| 306 | + $tmp_contrl->restrictAccess( |
|
| 307 | + Auth::isManager($WT_TREE) |
|
| 308 | + && Filter::checkCsrf() |
|
| 309 | + ); |
|
| 310 | 310 | |
| 311 | - $ga_id = Filter::postInteger('ga_id'); |
|
| 312 | - $description = Filter::post('description'); |
|
| 313 | - $analysislevel = Filter::postInteger('analysislevel'); |
|
| 314 | - $use_map = Filter::postBool('use_map'); |
|
| 315 | - if($use_map) { |
|
| 316 | - $map_file = base64_decode(Filter::post('map_file')); |
|
| 317 | - $map_top_level = Filter::postInteger('map_top_level'); |
|
| 318 | - } |
|
| 319 | - $use_flags = Filter::postBool('use_flags'); |
|
| 320 | - $gen_details = Filter::postInteger('gen_details'); |
|
| 311 | + $ga_id = Filter::postInteger('ga_id'); |
|
| 312 | + $description = Filter::post('description'); |
|
| 313 | + $analysislevel = Filter::postInteger('analysislevel'); |
|
| 314 | + $use_map = Filter::postBool('use_map'); |
|
| 315 | + if($use_map) { |
|
| 316 | + $map_file = base64_decode(Filter::post('map_file')); |
|
| 317 | + $map_top_level = Filter::postInteger('map_top_level'); |
|
| 318 | + } |
|
| 319 | + $use_flags = Filter::postBool('use_flags'); |
|
| 320 | + $gen_details = Filter::postInteger('gen_details'); |
|
| 321 | 321 | |
| 322 | - $success = false; |
|
| 323 | - if($ga_id) { |
|
| 324 | - $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 325 | - if($ga) { |
|
| 326 | - $ga->setTitle($description); |
|
| 327 | - $ga->setAnalysisLevel($analysislevel + 1); |
|
| 328 | - $options = $ga->getOptions(); |
|
| 329 | - if($options) { |
|
| 330 | - $options->setUsingFlags($use_flags); |
|
| 331 | - $options->setMaxDetailsInGen($gen_details); |
|
| 332 | - if($use_map) { |
|
| 333 | - $options->setMap(new OutlineMap($map_file)); |
|
| 334 | - $options->setMapLevel($map_top_level + 1); |
|
| 335 | - } |
|
| 336 | - else { |
|
| 337 | - $options->setMap(null); |
|
| 338 | - } |
|
| 339 | - } |
|
| 322 | + $success = false; |
|
| 323 | + if($ga_id) { |
|
| 324 | + $ga = $this->provider->getGeoAnalysis($ga_id, false); |
|
| 325 | + if($ga) { |
|
| 326 | + $ga->setTitle($description); |
|
| 327 | + $ga->setAnalysisLevel($analysislevel + 1); |
|
| 328 | + $options = $ga->getOptions(); |
|
| 329 | + if($options) { |
|
| 330 | + $options->setUsingFlags($use_flags); |
|
| 331 | + $options->setMaxDetailsInGen($gen_details); |
|
| 332 | + if($use_map) { |
|
| 333 | + $options->setMap(new OutlineMap($map_file)); |
|
| 334 | + $options->setMapLevel($map_top_level + 1); |
|
| 335 | + } |
|
| 336 | + else { |
|
| 337 | + $options->setMap(null); |
|
| 338 | + } |
|
| 339 | + } |
|
| 340 | 340 | |
| 341 | 341 | $res = $this->provider->updateGeoAnalysis($ga); |
| 342 | 342 | if($res) { |
@@ -349,8 +349,8 @@ discard block |
||
| 349 | 349 | FlashMessages::addMessage(I18N::translate('An error occured while updating the geographical dispersion analysis “%s”', $ga->getTitle()), 'danger'); |
| 350 | 350 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis ID “'. $ga->getId() .'” could not be updated. See error log.'); |
| 351 | 351 | } |
| 352 | - } |
|
| 353 | - } else { |
|
| 352 | + } |
|
| 353 | + } else { |
|
| 354 | 354 | $ga = $this->provider->createGeoAnalysis( |
| 355 | 355 | $description, |
| 356 | 356 | $analysislevel + 1, |
@@ -368,34 +368,34 @@ discard block |
||
| 368 | 368 | FlashMessages::addMessage(I18N::translate('An error occured while adding the geographical dispersion analysis “%s”', $description), 'danger'); |
| 369 | 369 | Log::addConfigurationLog('Module '.$this->module->getName().' : Geo Analysis “'.$description.'” could not be added. See error log.'); |
| 370 | 370 | } |
| 371 | - } |
|
| 371 | + } |
|
| 372 | 372 | |
| 373 | - $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl(); |
|
| 374 | - if(!$success) { |
|
| 375 | - if($ga) { |
|
| 376 | - $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@edit&ga_id='. $ga->getId() .'&ged=' . $WT_TREE->getNameUrl(); |
|
| 377 | - } |
|
| 378 | - else { |
|
| 379 | - $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@add&ged=' . $WT_TREE->getNameUrl(); |
|
| 380 | - } |
|
| 381 | - } |
|
| 382 | - header('Location: ' . WT_BASE_URL . $redirection_url); |
|
| 373 | + $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl(); |
|
| 374 | + if(!$success) { |
|
| 375 | + if($ga) { |
|
| 376 | + $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@edit&ga_id='. $ga->getId() .'&ged=' . $WT_TREE->getNameUrl(); |
|
| 377 | + } |
|
| 378 | + else { |
|
| 379 | + $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@add&ged=' . $WT_TREE->getNameUrl(); |
|
| 380 | + } |
|
| 381 | + } |
|
| 382 | + header('Location: ' . WT_BASE_URL . $redirection_url); |
|
| 383 | 383 | |
| 384 | - } |
|
| 384 | + } |
|
| 385 | 385 | |
| 386 | 386 | /** |
| 387 | 387 | * Renders the edit form, whether it is an edition of an existing GeoAnalysis, or the addition of a new one. |
| 388 | 388 | * |
| 389 | 389 | * @param (GeoAnalysis!null) $ga GeoAnalysis to edit |
| 390 | 390 | */ |
| 391 | - protected function renderEdit(GeoAnalysis $ga = null) { |
|
| 392 | - global $WT_TREE; |
|
| 391 | + protected function renderEdit(GeoAnalysis $ga = null) { |
|
| 392 | + global $WT_TREE; |
|
| 393 | 393 | |
| 394 | - Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
| 395 | - $controller = new PageController(); |
|
| 396 | - $controller |
|
| 397 | - ->restrictAccess(Auth::isManager($WT_TREE)) |
|
| 398 | - ->addInlineJavascript(' |
|
| 394 | + Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
| 395 | + $controller = new PageController(); |
|
| 396 | + $controller |
|
| 397 | + ->restrictAccess(Auth::isManager($WT_TREE)) |
|
| 398 | + ->addInlineJavascript(' |
|
| 399 | 399 | function toggleMapOptions() { |
| 400 | 400 | if($("input:radio[name=\'use_map\']:checked").val() == 1) { |
| 401 | 401 | $("#map_options").show(); |
@@ -409,34 +409,34 @@ discard block |
||
| 409 | 409 | toggleMapOptions(); |
| 410 | 410 | '); |
| 411 | 411 | |
| 412 | - $data = new ViewBag(); |
|
| 413 | - if($ga) { |
|
| 414 | - $controller->setPageTitle(I18N::translate('Edit the geographical dispersion analysis')); |
|
| 415 | - $data->set('geo_analysis', $ga); |
|
| 416 | - } else { |
|
| 417 | - $controller->setPageTitle(I18N::translate('Add a geographical dispersion analysis')); |
|
| 418 | - } |
|
| 412 | + $data = new ViewBag(); |
|
| 413 | + if($ga) { |
|
| 414 | + $controller->setPageTitle(I18N::translate('Edit the geographical dispersion analysis')); |
|
| 415 | + $data->set('geo_analysis', $ga); |
|
| 416 | + } else { |
|
| 417 | + $controller->setPageTitle(I18N::translate('Add a geographical dispersion analysis')); |
|
| 418 | + } |
|
| 419 | 419 | |
| 420 | - $data->set('title', $controller->getPageTitle()); |
|
| 421 | - $data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl()); |
|
| 422 | - $data->set('module_title', $this->module->getTitle()); |
|
| 423 | - $data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@save&ged=' . $WT_TREE->getNameUrl()); |
|
| 424 | - $data->set('places_hierarchy', $this->provider->getPlacesHierarchy()); |
|
| 420 | + $data->set('title', $controller->getPageTitle()); |
|
| 421 | + $data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl()); |
|
| 422 | + $data->set('module_title', $this->module->getTitle()); |
|
| 423 | + $data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@save&ged=' . $WT_TREE->getNameUrl()); |
|
| 424 | + $data->set('places_hierarchy', $this->provider->getPlacesHierarchy()); |
|
| 425 | 425 | |
| 426 | - $map_list = array_map( |
|
| 427 | - function(OutlineMap $map) { |
|
| 428 | - return $map->getDescription(); |
|
| 429 | - }, |
|
| 430 | - $this->provider->getOutlineMapsList() |
|
| 431 | - ); |
|
| 432 | - asort($map_list); |
|
| 433 | - $data->set('map_list', $map_list); |
|
| 426 | + $map_list = array_map( |
|
| 427 | + function(OutlineMap $map) { |
|
| 428 | + return $map->getDescription(); |
|
| 429 | + }, |
|
| 430 | + $this->provider->getOutlineMapsList() |
|
| 431 | + ); |
|
| 432 | + asort($map_list); |
|
| 433 | + $data->set('map_list', $map_list); |
|
| 434 | 434 | |
| 435 | - $gen_details = array(0 => I18N::translate('All')); |
|
| 436 | - for($i = 1; $i <= 10 ; $i++) $gen_details[$i] = $i; |
|
| 437 | - $data->set('generation_details', $gen_details); |
|
| 435 | + $gen_details = array(0 => I18N::translate('All')); |
|
| 436 | + for($i = 1; $i <= 10 ; $i++) $gen_details[$i] = $i; |
|
| 437 | + $data->set('generation_details', $gen_details); |
|
| 438 | 438 | |
| 439 | - ViewFactory::make('GeoAnalysisEdit', $this, $controller, $data)->render(); |
|
| 440 | - } |
|
| 439 | + ViewFactory::make('GeoAnalysisEdit', $this, $controller, $data)->render(); |
|
| 440 | + } |
|
| 441 | 441 | |
| 442 | 442 | } |
| 443 | 443 | \ No newline at end of file |
@@ -32,158 +32,158 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | class CertificateController extends MvcController |
| 34 | 34 | { |
| 35 | - /** |
|
| 36 | - * Certificate Provider |
|
| 37 | - * @var CertificateProviderInterface $provider |
|
| 38 | - */ |
|
| 39 | - protected $provider; |
|
| 35 | + /** |
|
| 36 | + * Certificate Provider |
|
| 37 | + * @var CertificateProviderInterface $provider |
|
| 38 | + */ |
|
| 39 | + protected $provider; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Constructor for Certificate controller |
|
| 43 | - * @param AbstractModule $module |
|
| 44 | - */ |
|
| 45 | - public function __construct(AbstractModule $module) { |
|
| 46 | - parent::__construct($module); |
|
| 47 | - |
|
| 48 | - $this->provider = $this->module->getProvider(); |
|
| 49 | - } |
|
| 41 | + /** |
|
| 42 | + * Constructor for Certificate controller |
|
| 43 | + * @param AbstractModule $module |
|
| 44 | + */ |
|
| 45 | + public function __construct(AbstractModule $module) { |
|
| 46 | + parent::__construct($module); |
|
| 47 | + |
|
| 48 | + $this->provider = $this->module->getProvider(); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Pages |
|
| 54 | - */ |
|
| 55 | - |
|
| 56 | - /** |
|
| 57 | - * Certificate@index |
|
| 58 | - */ |
|
| 59 | - public function index() { |
|
| 60 | - global $WT_TREE; |
|
| 61 | - |
|
| 62 | - $controller = new PageController(); |
|
| 63 | - $controller |
|
| 64 | - ->setPageTitle(I18N::translate('Certificate')) |
|
| 65 | - ->restrictAccess( |
|
| 66 | - $this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE) |
|
| 67 | - ); |
|
| 68 | - |
|
| 69 | - $cid = Filter::get('cid'); |
|
| 70 | - |
|
| 71 | - $certificate = null; |
|
| 72 | - if(!empty($cid) && strlen($cid) > 22){ |
|
| 73 | - $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - $data = new ViewBag(); |
|
| 77 | - $data->set('title', $controller->getPageTitle()); |
|
| 78 | - |
|
| 79 | - $data->set('has_certif', false); |
|
| 80 | - if($certificate) { |
|
| 81 | - $controller->restrictAccess($certificate->canShow()); |
|
| 82 | - $data->set('title', $certificate->getTitle()); |
|
| 83 | - $data->set('has_certif', true); |
|
| 84 | - $data->set('certificate', $certificate); |
|
| 52 | + /** |
|
| 53 | + * Pages |
|
| 54 | + */ |
|
| 55 | + |
|
| 56 | + /** |
|
| 57 | + * Certificate@index |
|
| 58 | + */ |
|
| 59 | + public function index() { |
|
| 60 | + global $WT_TREE; |
|
| 61 | + |
|
| 62 | + $controller = new PageController(); |
|
| 63 | + $controller |
|
| 64 | + ->setPageTitle(I18N::translate('Certificate')) |
|
| 65 | + ->restrictAccess( |
|
| 66 | + $this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE) |
|
| 67 | + ); |
|
| 68 | + |
|
| 69 | + $cid = Filter::get('cid'); |
|
| 70 | + |
|
| 71 | + $certificate = null; |
|
| 72 | + if(!empty($cid) && strlen($cid) > 22){ |
|
| 73 | + $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + $data = new ViewBag(); |
|
| 77 | + $data->set('title', $controller->getPageTitle()); |
|
| 78 | + |
|
| 79 | + $data->set('has_certif', false); |
|
| 80 | + if($certificate) { |
|
| 81 | + $controller->restrictAccess($certificate->canShow()); |
|
| 82 | + $data->set('title', $certificate->getTitle()); |
|
| 83 | + $data->set('has_certif', true); |
|
| 84 | + $data->set('certificate', $certificate); |
|
| 85 | 85 | |
| 86 | - $data->set( |
|
| 87 | - 'url_certif_city', |
|
| 88 | - 'module.php?mod=' . Constants::MODULE_MAJ_CERTIF_NAME . |
|
| 89 | - '&mod_action=Certificate@listAll' . |
|
| 90 | - '&ged=' . $WT_TREE->getNameUrl() . |
|
| 91 | - '&city=' . Functions::encryptToSafeBase64($certificate->getCity()) |
|
| 92 | - ); |
|
| 86 | + $data->set( |
|
| 87 | + 'url_certif_city', |
|
| 88 | + 'module.php?mod=' . Constants::MODULE_MAJ_CERTIF_NAME . |
|
| 89 | + '&mod_action=Certificate@listAll' . |
|
| 90 | + '&ged=' . $WT_TREE->getNameUrl() . |
|
| 91 | + '&city=' . Functions::encryptToSafeBase64($certificate->getCity()) |
|
| 92 | + ); |
|
| 93 | 93 | |
| 94 | - $controller->addInlineJavascript(' |
|
| 94 | + $controller->addInlineJavascript(' |
|
| 95 | 95 | jQuery("#certificate-tabs").tabs(); |
| 96 | 96 | jQuery("#certificate-tabs").css("visibility", "visible"); |
| 97 | 97 | '); |
| 98 | 98 | |
| 99 | - $data->set('has_linked_indis', false); |
|
| 100 | - $data->set('has_linked_fams', false); |
|
| 99 | + $data->set('has_linked_indis', false); |
|
| 100 | + $data->set('has_linked_fams', false); |
|
| 101 | 101 | |
| 102 | - $linked_indis = $certificate->linkedIndividuals(); |
|
| 103 | - $linked_fams = $certificate->linkedFamilies(); |
|
| 102 | + $linked_indis = $certificate->linkedIndividuals(); |
|
| 103 | + $linked_fams = $certificate->linkedFamilies(); |
|
| 104 | 104 | |
| 105 | - if($linked_indis && count($linked_indis) > 0) { |
|
| 106 | - $data->set('has_linked_indis', true); |
|
| 107 | - $data->set('linked_indis', $linked_indis); |
|
| 108 | - } |
|
| 105 | + if($linked_indis && count($linked_indis) > 0) { |
|
| 106 | + $data->set('has_linked_indis', true); |
|
| 107 | + $data->set('linked_indis', $linked_indis); |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | - if(!empty($linked_fams)) { |
|
| 111 | - $data->set('has_linked_fams', true); |
|
| 112 | - $data->set('linked_fams', $linked_fams); |
|
| 113 | - } |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - ViewFactory::make('Certificate', $this, $controller, $data)->render(); |
|
| 117 | - } |
|
| 110 | + if(!empty($linked_fams)) { |
|
| 111 | + $data->set('has_linked_fams', true); |
|
| 112 | + $data->set('linked_fams', $linked_fams); |
|
| 113 | + } |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + ViewFactory::make('Certificate', $this, $controller, $data)->render(); |
|
| 117 | + } |
|
| 118 | 118 | |
| 119 | - /** |
|
| 120 | - * Certificate@image |
|
| 121 | - */ |
|
| 122 | - public function image() { |
|
| 123 | - global $WT_TREE; |
|
| 119 | + /** |
|
| 120 | + * Certificate@image |
|
| 121 | + */ |
|
| 122 | + public function image() { |
|
| 123 | + global $WT_TREE; |
|
| 124 | 124 | |
| 125 | - $cid = Filter::get('cid'); |
|
| 126 | - $certificate = null; |
|
| 127 | - if(!empty($cid)) $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
| 125 | + $cid = Filter::get('cid'); |
|
| 126 | + $certificate = null; |
|
| 127 | + if(!empty($cid)) $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
| 128 | 128 | |
| 129 | - $imageBuilder = new ImageBuilder($certificate); |
|
| 129 | + $imageBuilder = new ImageBuilder($certificate); |
|
| 130 | 130 | |
| 131 | - if (!empty(Filter::get('cb'))) { |
|
| 132 | - $imageBuilder->setExpireOffset($imageBuilder->getExpireOffset() * 7); |
|
| 133 | - } |
|
| 131 | + if (!empty(Filter::get('cb'))) { |
|
| 132 | + $imageBuilder->setExpireOffset($imageBuilder->getExpireOffset() * 7); |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | - $imageBuilder |
|
| 136 | - ->setShowWatermark(Auth::accessLevel($WT_TREE) >= $this->module->getSetting('MAJ_SHOW_NO_WATERMARK', Auth::PRIV_HIDE)) |
|
| 137 | - ->setFontMaxSize($this->module->getSetting('MAJ_WM_FONT_MAXSIZE', 18)) |
|
| 138 | - ->setFontColor($this->module->getSetting('MAJ_WM_FONT_COLOR', '#4D6DF3')) |
|
| 139 | - ; |
|
| 135 | + $imageBuilder |
|
| 136 | + ->setShowWatermark(Auth::accessLevel($WT_TREE) >= $this->module->getSetting('MAJ_SHOW_NO_WATERMARK', Auth::PRIV_HIDE)) |
|
| 137 | + ->setFontMaxSize($this->module->getSetting('MAJ_WM_FONT_MAXSIZE', 18)) |
|
| 138 | + ->setFontColor($this->module->getSetting('MAJ_WM_FONT_COLOR', '#4D6DF3')) |
|
| 139 | + ; |
|
| 140 | 140 | |
| 141 | - $imageBuilder->render(); |
|
| 141 | + $imageBuilder->render(); |
|
| 142 | 142 | |
| 143 | - } |
|
| 143 | + } |
|
| 144 | 144 | |
| 145 | - /** |
|
| 146 | - * Certificate@listAll |
|
| 147 | - */ |
|
| 148 | - public function listAll() { |
|
| 149 | - global $WT_TREE; |
|
| 150 | - |
|
| 151 | - $controller = new PageController(); |
|
| 152 | - $controller |
|
| 153 | - ->setPageTitle(I18N::translate('Certificates')) |
|
| 154 | - ->restrictAccess( |
|
| 155 | - $this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE) |
|
| 156 | - ); |
|
| 157 | - |
|
| 158 | - $city = Filter::get('city'); |
|
| 159 | - |
|
| 160 | - if(!empty($city) && strlen($city) > 22){ |
|
| 161 | - $city = Functions::decryptFromSafeBase64($city); |
|
| 162 | - $controller->setPageTitle(I18N::translate('Certificates for %s', $city)); |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - $data = new ViewBag(); |
|
| 166 | - $data->set('title', $controller->getPageTitle()); |
|
| 167 | - $data->set('url_module', $this->module->getName()); |
|
| 168 | - $data->set('url_action', 'Certificate@listAll'); |
|
| 169 | - $data->set('url_ged', $WT_TREE->getNameUrl()); |
|
| 170 | - |
|
| 171 | - $data->set('cities', $this->provider->getCitiesList()); |
|
| 172 | - $data->set('selected_city', $city); |
|
| 173 | - |
|
| 174 | - $data->set('has_list', false); |
|
| 175 | - if(!empty($city)) { |
|
| 176 | - $table_id = 'table-certiflist-' . Uuid::uuid4(); |
|
| 145 | + /** |
|
| 146 | + * Certificate@listAll |
|
| 147 | + */ |
|
| 148 | + public function listAll() { |
|
| 149 | + global $WT_TREE; |
|
| 150 | + |
|
| 151 | + $controller = new PageController(); |
|
| 152 | + $controller |
|
| 153 | + ->setPageTitle(I18N::translate('Certificates')) |
|
| 154 | + ->restrictAccess( |
|
| 155 | + $this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE) |
|
| 156 | + ); |
|
| 157 | + |
|
| 158 | + $city = Filter::get('city'); |
|
| 159 | + |
|
| 160 | + if(!empty($city) && strlen($city) > 22){ |
|
| 161 | + $city = Functions::decryptFromSafeBase64($city); |
|
| 162 | + $controller->setPageTitle(I18N::translate('Certificates for %s', $city)); |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + $data = new ViewBag(); |
|
| 166 | + $data->set('title', $controller->getPageTitle()); |
|
| 167 | + $data->set('url_module', $this->module->getName()); |
|
| 168 | + $data->set('url_action', 'Certificate@listAll'); |
|
| 169 | + $data->set('url_ged', $WT_TREE->getNameUrl()); |
|
| 170 | + |
|
| 171 | + $data->set('cities', $this->provider->getCitiesList()); |
|
| 172 | + $data->set('selected_city', $city); |
|
| 173 | + |
|
| 174 | + $data->set('has_list', false); |
|
| 175 | + if(!empty($city)) { |
|
| 176 | + $table_id = 'table-certiflist-' . Uuid::uuid4(); |
|
| 177 | 177 | |
| 178 | - $certif_list = $this->provider->getCertificatesList($city); |
|
| 179 | - if(!empty($certif_list)) { |
|
| 180 | - $data->set('has_list', true); |
|
| 181 | - $data->set('table_id', $table_id); |
|
| 182 | - $data->set('certificate_list', $certif_list); |
|
| 178 | + $certif_list = $this->provider->getCertificatesList($city); |
|
| 179 | + if(!empty($certif_list)) { |
|
| 180 | + $data->set('has_list', true); |
|
| 181 | + $data->set('table_id', $table_id); |
|
| 182 | + $data->set('certificate_list', $certif_list); |
|
| 183 | 183 | |
| 184 | - $controller |
|
| 185 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 186 | - ->addInlineJavascript(' |
|
| 184 | + $controller |
|
| 185 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
| 186 | + ->addInlineJavascript(' |
|
| 187 | 187 | jQuery.fn.dataTableExt.oSort["text-asc"] = textCompareAsc; |
| 188 | 188 | jQuery.fn.dataTableExt.oSort["text-desc"] = textCompareDesc; |
| 189 | 189 | |
@@ -205,29 +205,29 @@ discard block |
||
| 205 | 205 | jQuery(".certificate-list").css("visibility", "visible"); |
| 206 | 206 | jQuery(".loading-image").css("display", "none"); |
| 207 | 207 | '); |
| 208 | - } |
|
| 209 | - } |
|
| 208 | + } |
|
| 209 | + } |
|
| 210 | 210 | |
| 211 | - ViewFactory::make('CertificatesList', $this, $controller, $data)->render(); |
|
| 211 | + ViewFactory::make('CertificatesList', $this, $controller, $data)->render(); |
|
| 212 | 212 | |
| 213 | - } |
|
| 213 | + } |
|
| 214 | 214 | |
| 215 | - /** |
|
| 216 | - * Certificate@autocomplete |
|
| 217 | - */ |
|
| 218 | - public function autocomplete() { |
|
| 219 | - global $WT_TREE; |
|
| 215 | + /** |
|
| 216 | + * Certificate@autocomplete |
|
| 217 | + */ |
|
| 218 | + public function autocomplete() { |
|
| 219 | + global $WT_TREE; |
|
| 220 | 220 | |
| 221 | - $controller = new JsonController(); |
|
| 221 | + $controller = new JsonController(); |
|
| 222 | 222 | |
| 223 | - $city = Filter::get('city'); |
|
| 224 | - $contains = Filter::get('term'); |
|
| 223 | + $city = Filter::get('city'); |
|
| 224 | + $contains = Filter::get('term'); |
|
| 225 | 225 | |
| 226 | - $controller |
|
| 227 | - ->restrictAccess(Auth::isEditor($WT_TREE) && !empty($city) && !empty($contains)) |
|
| 228 | - ->pageHeader(); |
|
| 226 | + $controller |
|
| 227 | + ->restrictAccess(Auth::isEditor($WT_TREE) && !empty($city) && !empty($contains)) |
|
| 228 | + ->pageHeader(); |
|
| 229 | 229 | |
| 230 | - $listCert = $this->provider->getCertificatesListBeginWith($city, $contains); |
|
| 231 | - $controller->encode($listCert); |
|
| 232 | - } |
|
| 230 | + $listCert = $this->provider->getCertificatesListBeginWith($city, $contains); |
|
| 231 | + $controller->encode($listCert); |
|
| 232 | + } |
|
| 233 | 233 | } |
| 234 | 234 | \ No newline at end of file |
@@ -24,12 +24,12 @@ discard block |
||
| 24 | 24 | * {@inhericDoc} |
| 25 | 25 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
| 26 | 26 | */ |
| 27 | - protected function renderContent() { |
|
| 27 | + protected function renderContent() { |
|
| 28 | 28 | |
| 29 | - $cities = $this->data->get('cities'); |
|
| 30 | - $selected_city = $this->data->get('selected_city'); |
|
| 29 | + $cities = $this->data->get('cities'); |
|
| 30 | + $selected_city = $this->data->get('selected_city'); |
|
| 31 | 31 | |
| 32 | - ?> |
|
| 32 | + ?> |
|
| 33 | 33 | <div id="maj-cert-list-page" class="center"> |
| 34 | 34 | <h2><?= $this->data->get('title') ?></h2> |
| 35 | 35 | |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | </thead> |
| 59 | 59 | <tbody> |
| 60 | 60 | <?php foreach ($this->data->get('certificate_list') as $certificate) { |
| 61 | - /** @var \MyArtJaub\Webtrees\Module\Certificates\Model\Certificate $certificate */ |
|
| 62 | - ?> |
|
| 61 | + /** @var \MyArtJaub\Webtrees\Module\Certificates\Model\Certificate $certificate */ |
|
| 62 | + ?> |
|
| 63 | 63 | <tr> |
| 64 | 64 | <!-- Certificate date --> |
| 65 | 65 | <?php if($date = $certificate->getCertificateDate()) { ?> |
@@ -71,12 +71,12 @@ discard block |
||
| 71 | 71 | <td><?= Filter::escapeHtml($certificate->getCertificateType() ?: '') ?></td> |
| 72 | 72 | <!-- Certificate Name --> |
| 73 | 73 | <?php |
| 74 | - $name = $certificate->getCertificateDetails() ?: ''; |
|
| 75 | - $sortname = ""; |
|
| 76 | - $ct_names=preg_match("/([A-Z]{2,})/", $name, $match); |
|
| 77 | - if($ct_names > 0) $sortname = $match[1].'_'; |
|
| 78 | - $sortname .= $name; |
|
| 79 | - ?> |
|
| 74 | + $name = $certificate->getCertificateDetails() ?: ''; |
|
| 75 | + $sortname = ""; |
|
| 76 | + $ct_names=preg_match("/([A-Z]{2,})/", $name, $match); |
|
| 77 | + if($ct_names > 0) $sortname = $match[1].'_'; |
|
| 78 | + $sortname .= $name; |
|
| 79 | + ?> |
|
| 80 | 80 | <td data-sort="<?= Filter::escapeHtml($sortname) ?>"> |
| 81 | 81 | <a href="<?= $certificate->getHtmlUrl() ?>"><?= Filter::escapeHtml($name) ?></a> |
| 82 | 82 | </td> |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | </div> |
| 90 | 90 | |
| 91 | 91 | <?php |
| 92 | - } |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | \ No newline at end of file |
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * webtrees-lib: MyArtJaub library for webtrees |
|
| 4 | - * |
|
| 5 | - * @package MyArtJaub\Webtrees |
|
| 6 | - * @subpackage Hook |
|
| 7 | - * @author Jonathan Jaubart <[email protected]> |
|
| 8 | - * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
| 9 | - * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 10 | - */ |
|
| 3 | + * webtrees-lib: MyArtJaub library for webtrees |
|
| 4 | + * |
|
| 5 | + * @package MyArtJaub\Webtrees |
|
| 6 | + * @subpackage Hook |
|
| 7 | + * @author Jonathan Jaubart <[email protected]> |
|
| 8 | + * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
| 9 | + * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 10 | + */ |
|
| 11 | 11 | namespace MyArtJaub\Webtrees\Hook\HookInterfaces; |
| 12 | 12 | |
| 13 | 13 | use Fisharebest\Webtrees\GedcomRecord; |
@@ -1,13 +1,13 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * webtrees-lib: MyArtJaub library for webtrees |
|
| 4 | - * |
|
| 5 | - * @package MyArtJaub\Webtrees |
|
| 6 | - * @subpackage Hook |
|
| 7 | - * @author Jonathan Jaubart <[email protected]> |
|
| 8 | - * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
| 9 | - * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 10 | - */ |
|
| 3 | + * webtrees-lib: MyArtJaub library for webtrees |
|
| 4 | + * |
|
| 5 | + * @package MyArtJaub\Webtrees |
|
| 6 | + * @subpackage Hook |
|
| 7 | + * @author Jonathan Jaubart <[email protected]> |
|
| 8 | + * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
| 9 | + * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
| 10 | + */ |
|
| 11 | 11 | namespace MyArtJaub\Webtrees\Hook\HookInterfaces; |
| 12 | 12 | |
| 13 | 13 | /** |