@@ -30,11 +30,16 @@ |
||
| 30 | 30 | $place_id = 0; |
| 31 | 31 | for ($i=0; $i<count($parent); $i++) { |
| 32 | 32 | $parent[$i] = trim($parent[$i]); |
| 33 | - if (empty($parent[$i])) $parent[$i]='unknown';// GoogleMap module uses "unknown" while GEDCOM uses , , |
|
| 33 | + if (empty($parent[$i])) { |
|
| 34 | + $parent[$i]='unknown'; |
|
| 35 | + } |
|
| 36 | + // GoogleMap module uses "unknown" while GEDCOM uses , , |
|
| 34 | 37 | $pl_id=Database::prepare('SELECT pl_id FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place') |
| 35 | 38 | ->execute(array($i, $place_id, $parent[$i])) |
| 36 | 39 | ->fetchOne(); |
| 37 | - if (empty($pl_id)) break; |
|
| 40 | + if (empty($pl_id)) { |
|
| 41 | + break; |
|
| 42 | + } |
|
| 38 | 43 | $place_id = $pl_id; |
| 39 | 44 | } |
| 40 | 45 | return $place_id; |
@@ -63,8 +63,9 @@ discard block |
||
| 63 | 63 | public function hExtendIndiHeaderIcons(IndividualController $ctrlIndi) { |
| 64 | 64 | if($ctrlIndi){ |
| 65 | 65 | $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
| 66 | - if ($dindi->canDisplayIsSourced()) |
|
| 67 | - return FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'large'); |
|
| 66 | + if ($dindi->canDisplayIsSourced()) { |
|
| 67 | + return FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'large'); |
|
| 68 | + } |
|
| 68 | 69 | } |
| 69 | 70 | return ''; |
| 70 | 71 | } |
@@ -97,8 +98,9 @@ discard block |
||
| 97 | 98 | $dindi = new Individual($grec); |
| 98 | 99 | $html .= FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'small'); |
| 99 | 100 | $html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isBirthSourced(), 'BIRT', 1, 'small'); |
| 100 | - if($grec->isDead()) |
|
| 101 | - $html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isDeathSourced(), 'DEAT', 1, 'small'); |
|
| 101 | + if($grec->isDead()) { |
|
| 102 | + $html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isDeathSourced(), 'DEAT', 1, 'small'); |
|
| 103 | + } |
|
| 102 | 104 | } |
| 103 | 105 | return $html; |
| 104 | 106 | } |
@@ -171,12 +173,13 @@ discard block |
||
| 171 | 173 | </tr>'; |
| 172 | 174 | } |
| 173 | 175 | |
| 174 | - if( $root->isDead() ) |
|
| 175 | - echo ' |
|
| 176 | + if( $root->isDead() ) { |
|
| 177 | + echo ' |
|
| 176 | 178 | <tr> |
| 177 | 179 | <td class="slabel">' . GedcomTag::getLabel('DEAT') . '</td> |
| 178 | 180 | <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dindi->isDeathSourced(), 'DEAT', 1).'</td> |
| 179 | 181 | </tr>'; |
| 182 | + } |
|
| 180 | 183 | |
| 181 | 184 | echo '</table>'; |
| 182 | 185 | } |
@@ -95,14 +95,15 @@ discard block |
||
| 95 | 95 | $this->provider->setTaskStatus($task, $status); |
| 96 | 96 | $res['status'] = $status; |
| 97 | 97 | Log::addConfigurationLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" has been '. ($status ? 'enabled' : 'disabled') .'.'); |
| 98 | - } |
|
| 99 | - catch (\Exception $ex) { |
|
| 98 | + } catch (\Exception $ex) { |
|
| 100 | 99 | $res['error'] = $ex->getMessage(); |
| 101 | 100 | Log::addErrorLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage()); |
| 102 | 101 | } |
| 103 | 102 | |
| 104 | 103 | $controller->pageHeader(); |
| 105 | - if($res['error']) http_response_code(500); |
|
| 104 | + if($res['error']) { |
|
| 105 | + http_response_code(500); |
|
| 106 | + } |
|
| 106 | 107 | |
| 107 | 108 | echo \Zend_Json::encode($res); |
| 108 | 109 | } |
@@ -170,8 +171,7 @@ discard block |
||
| 170 | 171 | $task->setFrequency($frequency); |
| 171 | 172 | if($is_limited == 1) { |
| 172 | 173 | $task->setRemainingOccurrences($nb_occur); |
| 173 | - } |
|
| 174 | - else { |
|
| 174 | + } else { |
|
| 175 | 175 | $task->setRemainingOccurrences(0); |
| 176 | 176 | } |
| 177 | 177 | |
@@ -192,8 +192,7 @@ discard block |
||
| 192 | 192 | Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'.$task->getName() .'” has been updated.'); |
| 193 | 193 | $success = true; |
| 194 | 194 | } |
| 195 | - } |
|
| 196 | - else { |
|
| 195 | + } else { |
|
| 197 | 196 | FlashMessages::addMessage(I18N::translate('An error occured while updating the administrative task “%s”', $task->getTitle()), 'danger'); |
| 198 | 197 | Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'. $task->getName() .'” could not be updated. See error log.'); |
| 199 | 198 | } |
@@ -236,7 +236,9 @@ discard block |
||
| 236 | 236 | * @return bool |
| 237 | 237 | */ |
| 238 | 238 | public function save() { |
| 239 | - if(!$this->provider) throw new \Exception('The task has not been initialised with a provider.'); |
|
| 239 | + if(!$this->provider) { |
|
| 240 | + throw new \Exception('The task has not been initialised with a provider.'); |
|
| 241 | + } |
|
| 240 | 242 | return $this->provider->updateTask($this); |
| 241 | 243 | } |
| 242 | 244 | |
@@ -246,8 +248,9 @@ discard block |
||
| 246 | 248 | */ |
| 247 | 249 | public function execute(){ |
| 248 | 250 | |
| 249 | - if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime()) |
|
| 250 | - $this->is_running = false; |
|
| 251 | + if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime()) { |
|
| 252 | + $this->is_running = false; |
|
| 253 | + } |
|
| 251 | 254 | |
| 252 | 255 | if(!$this->is_running){ //TODO put in place a time_out for running... |
| 253 | 256 | //TODO Log the executions in the logs |
@@ -261,7 +264,9 @@ discard block |
||
| 261 | 264 | $this->last_updated = new \DateTime(); |
| 262 | 265 | if($this->nb_occurrences > 0){ |
| 263 | 266 | $this->nb_occurrences--; |
| 264 | - if($this->nb_occurrences == 0) $this->is_enabled = false; |
|
| 267 | + if($this->nb_occurrences == 0) { |
|
| 268 | + $this->is_enabled = false; |
|
| 269 | + } |
|
| 265 | 270 | } |
| 266 | 271 | } |
| 267 | 272 | $this->is_running = false; |
@@ -49,8 +49,7 @@ discard block |
||
| 49 | 49 | return $task; |
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | - } |
|
| 53 | - catch(\Exception $ex) { } |
|
| 52 | + } catch(\Exception $ex) { } |
|
| 54 | 53 | |
| 55 | 54 | return null; |
| 56 | 55 | } |
@@ -83,8 +82,7 @@ discard block |
||
| 83 | 82 | ); |
| 84 | 83 | |
| 85 | 84 | return $task; |
| 86 | - } |
|
| 87 | - else { |
|
| 85 | + } else { |
|
| 88 | 86 | $this->deleteTask($row['majat_name']); |
| 89 | 87 | } |
| 90 | 88 | return null; |
@@ -156,8 +154,7 @@ discard block |
||
| 156 | 154 | 'is_running' => $task->isRunning() ? 1 : 0 |
| 157 | 155 | )); |
| 158 | 156 | return true; |
| 159 | - } |
|
| 160 | - catch (\Exception $ex) { |
|
| 157 | + } catch (\Exception $ex) { |
|
| 161 | 158 | Log::addErrorLog(sprintf('Error while updating the Admin Task %s. Exception: %s', $task->getName(), $ex->getMessage())); |
| 162 | 159 | return false; |
| 163 | 160 | } |
@@ -279,7 +276,9 @@ discard block |
||
| 279 | 276 | $dir=opendir($this->root_path); |
| 280 | 277 | while (($file=readdir($dir))!==false){ |
| 281 | 278 | try { |
| 282 | - if($file == '.' || $file == '..') continue; |
|
| 279 | + if($file == '.' || $file == '..') { |
|
| 280 | + continue; |
|
| 281 | + } |
|
| 283 | 282 | $task = include $this->root_path . $file; |
| 284 | 283 | if($task ) { |
| 285 | 284 | $task->setProvider($this); |
@@ -294,12 +293,10 @@ discard block |
||
| 294 | 293 | )); |
| 295 | 294 | |
| 296 | 295 | $tasks[] = $task; |
| 297 | - } |
|
| 298 | - else { |
|
| 296 | + } else { |
|
| 299 | 297 | throw new \Exception; |
| 300 | 298 | } |
| 301 | - } |
|
| 302 | - catch (\Exception $ex) { |
|
| 299 | + } catch (\Exception $ex) { |
|
| 303 | 300 | Log::addErrorLog('An error occured while trying to load the task in file ' . $file . '. Exception: ' . $ex->getMessage()); |
| 304 | 301 | } |
| 305 | 302 | } |
@@ -325,8 +322,7 @@ discard block |
||
| 325 | 322 | Log::addConfigurationLog('Admin Task '.$task_name.' has been deleted from disk - deleting it from DB'); |
| 326 | 323 | |
| 327 | 324 | return true; |
| 328 | - } |
|
| 329 | - catch(\Exception $ex) { |
|
| 325 | + } catch(\Exception $ex) { |
|
| 330 | 326 | Database::rollback(); |
| 331 | 327 | |
| 332 | 328 | Log::addErrorLog('An error occurred while deleting Admin Task '.$task_name.'. Exception: '. $ex->getMessage()); |
@@ -185,8 +185,7 @@ discard block |
||
| 185 | 185 | I18N::translate('Error').Mail::EOL. |
| 186 | 186 | str_repeat('-', $nb_char_count_title)."\t".str_repeat('-', $nb_char_type)."\t".str_repeat('-', 20)."\t".str_repeat('-', strlen(I18N::translate('Error'))).Mail::EOL. |
| 187 | 187 | $tmp_message.Mail::EOL; |
| 188 | - } |
|
| 189 | - else{ |
|
| 188 | + } else{ |
|
| 190 | 189 | $message .= I18N::translate('No errors', $nb_errors).Mail::EOL.Mail::EOL; |
| 191 | 190 | } |
| 192 | 191 | |
@@ -251,8 +250,7 @@ discard block |
||
| 251 | 250 | } |
| 252 | 251 | } |
| 253 | 252 | return true; |
| 254 | - } |
|
| 255 | - catch (\Exception $ex) { |
|
| 253 | + } catch (\Exception $ex) { |
|
| 256 | 254 | Log::addErrorLog(sprintf('Error while updating the Admin Task "%s". Exception: %s', $this->getName(), $ex->getMessage())); |
| 257 | 255 | return false; |
| 258 | 256 | } |
@@ -187,7 +187,9 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | // Generate an AJAX/JSON response for datatables to load a block of rows |
| 189 | 189 | $search = Filter::postArray('search'); |
| 190 | - if($search) $search = $search['value']; |
|
| 190 | + if($search) { |
|
| 191 | + $search = $search['value']; |
|
| 192 | + } |
|
| 191 | 193 | $start = Filter::postInteger('start'); |
| 192 | 194 | $length = Filter::postInteger('length'); |
| 193 | 195 | $order = Filter::postArray('order'); |
@@ -261,8 +263,7 @@ discard block |
||
| 261 | 263 | <button id="bt_runtask_'. $task->getName() .'" class="btn btn-primary" href="#" onclick="return run_admintask(\''. $task->getName() .'\')"> |
| 262 | 264 | <div id="bt_runtasktext_'. $task->getName() .'"><i class="fa fa-cog fa-fw" ></i>' . I18N::translate('Run') . '</div> |
| 263 | 265 | </button>'; |
| 264 | - } |
|
| 265 | - else { |
|
| 266 | + } else { |
|
| 266 | 267 | $datum[9] = ''; |
| 267 | 268 | } |
| 268 | 269 | |
@@ -106,7 +106,9 @@ discard block |
||
| 106 | 106 | }'); |
| 107 | 107 | |
| 108 | 108 | $action = Filter::post('action'); |
| 109 | - if($action === 'update') $this->update($controller); |
|
| 109 | + if($action === 'update') { |
|
| 110 | + $this->update($controller); |
|
| 111 | + } |
|
| 110 | 112 | |
| 111 | 113 | $view_bag = new ViewBag(); |
| 112 | 114 | $view_bag->set('title', $controller->getPageTitle()); |
@@ -153,7 +155,9 @@ discard block |
||
| 153 | 155 | $user = User::find(Filter::getInteger('userid', -1)); |
| 154 | 156 | if($user) { |
| 155 | 157 | $calculator = new SosaCalculator($WT_TREE, $user); |
| 156 | - if($calculator->computeAll()) $view_bag->set('is_success', true); |
|
| 158 | + if($calculator->computeAll()) { |
|
| 159 | + $view_bag->set('is_success', true); |
|
| 160 | + } |
|
| 157 | 161 | } |
| 158 | 162 | ViewFactory::make('SosaComputeResult', $this, $controller, $view_bag)->render(); |
| 159 | 163 | } |
@@ -175,9 +179,10 @@ discard block |
||
| 175 | 179 | |
| 176 | 180 | if($user && $indi) { |
| 177 | 181 | $calculator = new SosaCalculator($WT_TREE, $user); |
| 178 | - if($calculator->computeFromIndividual($indi)) $view_bag->set('is_success', true); |
|
| 179 | - } |
|
| 180 | - else { |
|
| 182 | + if($calculator->computeFromIndividual($indi)) { |
|
| 183 | + $view_bag->set('is_success', true); |
|
| 184 | + } |
|
| 185 | + } else { |
|
| 181 | 186 | $view_bag->set('error', I18N::translate('Non existing individual')); |
| 182 | 187 | } |
| 183 | 188 | |
@@ -114,8 +114,12 @@ |
||
| 114 | 114 | $this->flushTmpSosaTable(); |
| 115 | 115 | |
| 116 | 116 | if($fam = $indi->getPrimaryChildFamily()) { |
| 117 | - if($husb = $fam->getHusband()) $this->addNode($husb, 2 * $sosa); |
|
| 118 | - if($wife = $fam->getWife()) $this->addNode($wife, 2 * $sosa + 1); |
|
| 117 | + if($husb = $fam->getHusband()) { |
|
| 118 | + $this->addNode($husb, 2 * $sosa); |
|
| 119 | + } |
|
| 120 | + if($wife = $fam->getWife()) { |
|
| 121 | + $this->addNode($wife, 2 * $sosa + 1); |
|
| 122 | + } |
|
| 119 | 123 | } |
| 120 | 124 | } |
| 121 | 125 | |