@@ -15,13 +15,13 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | interface HookSubscriberInterface { |
| 17 | 17 | |
| 18 | - /** |
|
| 18 | + /** |
|
| 19 | 19 | * Return the list of functions implementented in the class which needs to be registered as hooks. |
| 20 | 20 | * The format is either { function1, function 2,...} in which case the priority is the default one |
| 21 | 21 | * or { function1 => priority1, function2 => priority2, ...} |
| 22 | 22 | * |
| 23 | 23 | * @return array Array of hooks |
| 24 | 24 | */ |
| 25 | - public function getSubscribedHooks(); |
|
| 25 | + public function getSubscribedHooks(); |
|
| 26 | 26 | |
| 27 | 27 | } |
| 28 | 28 | \ No newline at end of file |
@@ -20,111 +20,111 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | class CertificateFileProvider implements CertificateProviderInterface { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Relative path to the root certificate folder |
|
| 25 | - * @var string $root_path |
|
| 26 | - */ |
|
| 27 | - protected $root_path; |
|
| 23 | + /** |
|
| 24 | + * Relative path to the root certificate folder |
|
| 25 | + * @var string $root_path |
|
| 26 | + */ |
|
| 27 | + protected $root_path; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Reference tree |
|
| 31 | - * @var Tree $tree |
|
| 32 | - */ |
|
| 33 | - protected $tree; |
|
| 29 | + /** |
|
| 30 | + * Reference tree |
|
| 31 | + * @var Tree $tree |
|
| 32 | + */ |
|
| 33 | + protected $tree; |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Cached list of certificates' cities. |
|
| 37 | - * @var (null|array) $cities_list |
|
| 38 | - */ |
|
| 39 | - protected $cities_list = null; |
|
| 35 | + /** |
|
| 36 | + * Cached list of certificates' cities. |
|
| 37 | + * @var (null|array) $cities_list |
|
| 38 | + */ |
|
| 39 | + protected $cities_list = null; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Constructor for the File Provider |
|
| 43 | - * @param string $root_path |
|
| 44 | - * @param Tree $tree |
|
| 45 | - */ |
|
| 46 | - public function __construct($root_path, Tree $tree) { |
|
| 47 | - $this->root_path = $root_path; |
|
| 48 | - $this->tree = $tree; |
|
| 49 | - } |
|
| 41 | + /** |
|
| 42 | + * Constructor for the File Provider |
|
| 43 | + * @param string $root_path |
|
| 44 | + * @param Tree $tree |
|
| 45 | + */ |
|
| 46 | + public function __construct($root_path, Tree $tree) { |
|
| 47 | + $this->root_path = $root_path; |
|
| 48 | + $this->tree = $tree; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * {@inhericDoc} |
|
| 53 | - * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getRealCertificatesDirectory() |
|
| 54 | - */ |
|
| 55 | - public function getRealCertificatesDirectory(){ |
|
| 56 | - return WT_DATA_DIR . $this->root_path; |
|
| 57 | - } |
|
| 51 | + /** |
|
| 52 | + * {@inhericDoc} |
|
| 53 | + * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getRealCertificatesDirectory() |
|
| 54 | + */ |
|
| 55 | + public function getRealCertificatesDirectory(){ |
|
| 56 | + return WT_DATA_DIR . $this->root_path; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * {@inhericDoc} |
|
| 61 | - * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCitiesList() |
|
| 62 | - */ |
|
| 63 | - public function getCitiesList(){ |
|
| 64 | - if(!isset($this->cities_list) || is_null($this->cities_list)){ |
|
| 65 | - $certdir = $this->getRealCertificatesDirectory(); |
|
| 66 | - $this->cities_list = array(); |
|
| 59 | + /** |
|
| 60 | + * {@inhericDoc} |
|
| 61 | + * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCitiesList() |
|
| 62 | + */ |
|
| 63 | + public function getCitiesList(){ |
|
| 64 | + if(!isset($this->cities_list) || is_null($this->cities_list)){ |
|
| 65 | + $certdir = $this->getRealCertificatesDirectory(); |
|
| 66 | + $this->cities_list = array(); |
|
| 67 | 67 | |
| 68 | - $dir = opendir($certdir); |
|
| 68 | + $dir = opendir($certdir); |
|
| 69 | 69 | |
| 70 | - while($entry = readdir($dir)){ |
|
| 71 | - if($entry != '.' && $entry != '..' && is_dir($certdir.$entry)){ |
|
| 72 | - $this->cities_list[]= Functions::encodeFileSystemToUtf8($entry); |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - sort($this->cities_list); |
|
| 76 | - } |
|
| 77 | - return $this->cities_list; |
|
| 78 | - } |
|
| 70 | + while($entry = readdir($dir)){ |
|
| 71 | + if($entry != '.' && $entry != '..' && is_dir($certdir.$entry)){ |
|
| 72 | + $this->cities_list[]= Functions::encodeFileSystemToUtf8($entry); |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + sort($this->cities_list); |
|
| 76 | + } |
|
| 77 | + return $this->cities_list; |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * {@inhericDoc} |
|
| 82 | - * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesList() |
|
| 83 | - */ |
|
| 84 | - public function getCertificatesList($selCity){ |
|
| 80 | + /** |
|
| 81 | + * {@inhericDoc} |
|
| 82 | + * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesList() |
|
| 83 | + */ |
|
| 84 | + public function getCertificatesList($selCity){ |
|
| 85 | 85 | |
| 86 | - $selCity = Functions::encodeUtf8ToFileSystem($selCity); |
|
| 86 | + $selCity = Functions::encodeUtf8ToFileSystem($selCity); |
|
| 87 | 87 | |
| 88 | - $certdir = $this->getRealCertificatesDirectory(); |
|
| 89 | - $tabCertif= array(); |
|
| 88 | + $certdir = $this->getRealCertificatesDirectory(); |
|
| 89 | + $tabCertif= array(); |
|
| 90 | 90 | |
| 91 | - if(is_dir($certdir.$selCity)){ |
|
| 92 | - $dir=opendir($certdir.$selCity); |
|
| 93 | - while($entry = readdir($dir)){ |
|
| 94 | - if($entry!='.' && $entry!='..' && !is_dir($certdir.$entry.'/')){ |
|
| 95 | - $path = Functions::encodeFileSystemToUtf8($selCity.'/'.$entry); |
|
| 96 | - $certificate = new Certificate($path, $this->tree, $this); |
|
| 97 | - if(Functions::isImageTypeSupported($certificate->extension())){ |
|
| 98 | - $tabCertif[] = $certificate; |
|
| 99 | - } |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | - } |
|
| 103 | - return $tabCertif; |
|
| 104 | - } |
|
| 91 | + if(is_dir($certdir.$selCity)){ |
|
| 92 | + $dir=opendir($certdir.$selCity); |
|
| 93 | + while($entry = readdir($dir)){ |
|
| 94 | + if($entry!='.' && $entry!='..' && !is_dir($certdir.$entry.'/')){ |
|
| 95 | + $path = Functions::encodeFileSystemToUtf8($selCity.'/'.$entry); |
|
| 96 | + $certificate = new Certificate($path, $this->tree, $this); |
|
| 97 | + if(Functions::isImageTypeSupported($certificate->extension())){ |
|
| 98 | + $tabCertif[] = $certificate; |
|
| 99 | + } |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | + } |
|
| 103 | + return $tabCertif; |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | - /** |
|
| 107 | - * {@inhericDoc} |
|
| 108 | - * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesListBeginWith() |
|
| 109 | - */ |
|
| 110 | - public function getCertificatesListBeginWith($city, $contains, $limit= 9999){ |
|
| 111 | - $tabFiles= array(); |
|
| 112 | - $dirPath= $this->getRealCertificatesDirectory() . Functions::encodeUtf8ToFileSystem($city).'/'; |
|
| 113 | - $contains = utf8_decode($contains); |
|
| 114 | - $nbCert = 0; |
|
| 106 | + /** |
|
| 107 | + * {@inhericDoc} |
|
| 108 | + * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesListBeginWith() |
|
| 109 | + */ |
|
| 110 | + public function getCertificatesListBeginWith($city, $contains, $limit= 9999){ |
|
| 111 | + $tabFiles= array(); |
|
| 112 | + $dirPath= $this->getRealCertificatesDirectory() . Functions::encodeUtf8ToFileSystem($city).'/'; |
|
| 113 | + $contains = utf8_decode($contains); |
|
| 114 | + $nbCert = 0; |
|
| 115 | 115 | |
| 116 | - if(is_dir($dirPath)){ |
|
| 117 | - $dir=opendir($dirPath); |
|
| 118 | - while(($entry = readdir($dir)) && $nbCert < $limit){ |
|
| 119 | - if($entry!='.' && $entry!='..' && $entry!='Thumbs.db' &&!is_dir($dirPath.$entry.'/') && stripos($entry, $contains)!== false){ |
|
| 120 | - $tabFiles[]= Functions::encodeFileSystemToUtf8($entry); |
|
| 121 | - $nbCert++; |
|
| 122 | - } |
|
| 123 | - } |
|
| 124 | - } |
|
| 125 | - sort($tabFiles); |
|
| 126 | - return $tabFiles; |
|
| 127 | - } |
|
| 116 | + if(is_dir($dirPath)){ |
|
| 117 | + $dir=opendir($dirPath); |
|
| 118 | + while(($entry = readdir($dir)) && $nbCert < $limit){ |
|
| 119 | + if($entry!='.' && $entry!='..' && $entry!='Thumbs.db' &&!is_dir($dirPath.$entry.'/') && stripos($entry, $contains)!== false){ |
|
| 120 | + $tabFiles[]= Functions::encodeFileSystemToUtf8($entry); |
|
| 121 | + $nbCert++; |
|
| 122 | + } |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | + sort($tabFiles); |
|
| 126 | + return $tabFiles; |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | 129 | } |
| 130 | 130 | |
@@ -18,40 +18,40 @@ |
||
| 18 | 18 | * Patronymic Lineage Module. |
| 19 | 19 | */ |
| 20 | 20 | class PatronymicLineageModule extends fw\Module\AbstractModule |
| 21 | - implements ModuleMenuItemInterface |
|
| 21 | + implements ModuleMenuItemInterface |
|
| 22 | 22 | {
|
| 23 | - /** @var string For custom modules - link for support, upgrades, etc. */ |
|
| 24 | - const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
| 23 | + /** @var string For custom modules - link for support, upgrades, etc. */ |
|
| 24 | + const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * {@inhericDoc}
|
|
| 28 | - */ |
|
| 29 | - public function getTitle() {
|
|
| 30 | - return /* I18N: Name of the “Patronymic lineage” module */ I18N::translate('Patronymic Lineages');
|
|
| 31 | - } |
|
| 26 | + /** |
|
| 27 | + * {@inhericDoc}
|
|
| 28 | + */ |
|
| 29 | + public function getTitle() {
|
|
| 30 | + return /* I18N: Name of the “Patronymic lineage” module */ I18N::translate('Patronymic Lineages');
|
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * {@inhericDoc}
|
|
| 35 | - */ |
|
| 36 | - public function getDescription() {
|
|
| 37 | - return /* I18N: Description of the “Patronymic lineage” module */ I18N::translate('Display lineages of people holding the same surname.');
|
|
| 38 | - } |
|
| 33 | + /** |
|
| 34 | + * {@inhericDoc}
|
|
| 35 | + */ |
|
| 36 | + public function getDescription() {
|
|
| 37 | + return /* I18N: Description of the “Patronymic lineage” module */ I18N::translate('Display lineages of people holding the same surname.');
|
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * {@inhericDoc}
|
|
| 42 | - */ |
|
| 43 | - public function modAction($mod_action) {
|
|
| 44 | - \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
| 45 | - } |
|
| 46 | - /** |
|
| 47 | - * {@inhericDoc}
|
|
| 48 | - * @see \MyArtJaub\Webtrees\Module\ModuleMenuItemInterface::getMenu() |
|
| 49 | - */ |
|
| 50 | - public function getMenu(fw\Tree $tree, $reference) {
|
|
| 51 | - $tree_url = $tree ? $tree->getNameUrl() : ''; |
|
| 52 | - $surname = $reference && is_string($reference) ? $reference : ''; |
|
| 53 | - return new fw\Menu($this->getTitle(), 'module.php?mod=' . $this->getName() . '&mod_action=Lineage&ged=' . $tree_url . '&surname=' . $surname , 'menu-maj-list-lineage', array('rel' => 'nofollow'));
|
|
| 54 | - } |
|
| 40 | + /** |
|
| 41 | + * {@inhericDoc}
|
|
| 42 | + */ |
|
| 43 | + public function modAction($mod_action) {
|
|
| 44 | + \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
| 45 | + } |
|
| 46 | + /** |
|
| 47 | + * {@inhericDoc}
|
|
| 48 | + * @see \MyArtJaub\Webtrees\Module\ModuleMenuItemInterface::getMenu() |
|
| 49 | + */ |
|
| 50 | + public function getMenu(fw\Tree $tree, $reference) {
|
|
| 51 | + $tree_url = $tree ? $tree->getNameUrl() : ''; |
|
| 52 | + $surname = $reference && is_string($reference) ? $reference : ''; |
|
| 53 | + return new fw\Menu($this->getTitle(), 'module.php?mod=' . $this->getName() . '&mod_action=Lineage&ged=' . $tree_url . '&surname=' . $surname , 'menu-maj-list-lineage', array('rel' => 'nofollow'));
|
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | \ No newline at end of file |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * @return string HTML code of the inserted flag |
| 80 | 80 | */ |
| 81 | 81 | public static function htmlPlaceIcon(\Fisharebest\Webtrees\Place $place, $icon_path , $size = 50) { |
| 82 | - return '<img class="flag_gm_h'. $size . '" src="' . $icon_path . '" title="' . $place->getGedcomName() . '" alt="' . $place->getGedcomName() . '" />'; |
|
| 82 | + return '<img class="flag_gm_h'. $size . '" src="' . $icon_path . '" title="' . $place->getGedcomName() . '" alt="' . $place->getGedcomName() . '" />'; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | * @return boolean |
| 356 | 356 | */ |
| 357 | 357 | public static function isDateWithinChartsRange(Date $date) { |
| 358 | - return $date->gregorianYear() >= 1550 && $date->gregorianYear() < 2030; |
|
| 358 | + return $date->gregorianYear() >= 1550 && $date->gregorianYear() < 2030; |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | } |
@@ -18,97 +18,97 @@ |
||
| 18 | 18 | /** |
| 19 | 19 | * @var array $data Container for data |
| 20 | 20 | */ |
| 21 | - protected $data = array(); |
|
| 21 | + protected $data = array(); |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Constructor for ViewBag |
|
| 25 | - * @param array $data_in |
|
| 26 | - */ |
|
| 27 | - public function __construct(array $data_in = array()) { |
|
| 28 | - $this->data = $data_in; |
|
| 29 | - } |
|
| 23 | + /** |
|
| 24 | + * Constructor for ViewBag |
|
| 25 | + * @param array $data_in |
|
| 26 | + */ |
|
| 27 | + public function __construct(array $data_in = array()) { |
|
| 28 | + $this->data = $data_in; |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Get the keys present in the view bag. |
|
| 33 | - * |
|
| 34 | - * @return array |
|
| 35 | - */ |
|
| 36 | - public function keys() |
|
| 37 | - { |
|
| 38 | - return array_keys($this->data); |
|
| 39 | - } |
|
| 31 | + /** |
|
| 32 | + * Get the keys present in the view bag. |
|
| 33 | + * |
|
| 34 | + * @return array |
|
| 35 | + */ |
|
| 36 | + public function keys() |
|
| 37 | + { |
|
| 38 | + return array_keys($this->data); |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Get all the data from the bag for a given key. |
|
| 43 | - * |
|
| 44 | - * @param string $key |
|
| 45 | - * @param string $format |
|
| 46 | - * @return unknown |
|
| 47 | - */ |
|
| 48 | - public function get($key, $default = null) |
|
| 49 | - { |
|
| 50 | - if (array_key_exists($key, $this->data)) { |
|
| 51 | - return $this->data[$key]; |
|
| 52 | - } |
|
| 53 | - return $default; |
|
| 54 | - } |
|
| 41 | + /** |
|
| 42 | + * Get all the data from the bag for a given key. |
|
| 43 | + * |
|
| 44 | + * @param string $key |
|
| 45 | + * @param string $format |
|
| 46 | + * @return unknown |
|
| 47 | + */ |
|
| 48 | + public function get($key, $default = null) |
|
| 49 | + { |
|
| 50 | + if (array_key_exists($key, $this->data)) { |
|
| 51 | + return $this->data[$key]; |
|
| 52 | + } |
|
| 53 | + return $default; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Magic getter. |
|
| 58 | - * Returns the value associated with the key. |
|
| 59 | - * |
|
| 60 | - * @param string $key |
|
| 61 | - * @return unknown |
|
| 62 | - */ |
|
| 63 | - public function __get($key) { |
|
| 64 | - return $this->get($key, null); |
|
| 65 | - } |
|
| 56 | + /** |
|
| 57 | + * Magic getter. |
|
| 58 | + * Returns the value associated with the key. |
|
| 59 | + * |
|
| 60 | + * @param string $key |
|
| 61 | + * @return unknown |
|
| 62 | + */ |
|
| 63 | + public function __get($key) { |
|
| 64 | + return $this->get($key, null); |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - /** |
|
| 68 | - * Set the value for the specified key. |
|
| 69 | - * Can define whether to override an existing value; |
|
| 70 | - * |
|
| 71 | - * @param string $key |
|
| 72 | - * @param mixed $value |
|
| 73 | - * @param bool $override |
|
| 74 | - */ |
|
| 75 | - public function set($key, $value, $override = true) { |
|
| 76 | - if(is_null($key)) return; |
|
| 77 | - if(!$override && array_key_exists($key, $this->data)) return; |
|
| 78 | - $this->data[$key] = $value; |
|
| 79 | - } |
|
| 67 | + /** |
|
| 68 | + * Set the value for the specified key. |
|
| 69 | + * Can define whether to override an existing value; |
|
| 70 | + * |
|
| 71 | + * @param string $key |
|
| 72 | + * @param mixed $value |
|
| 73 | + * @param bool $override |
|
| 74 | + */ |
|
| 75 | + public function set($key, $value, $override = true) { |
|
| 76 | + if(is_null($key)) return; |
|
| 77 | + if(!$override && array_key_exists($key, $this->data)) return; |
|
| 78 | + $this->data[$key] = $value; |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Magic setter. |
|
| 83 | - * Set the value for the specified key. |
|
| 84 | - * |
|
| 85 | - * @param string $key |
|
| 86 | - * @param mixed $value |
|
| 87 | - */ |
|
| 88 | - public function __set($key, $value) { |
|
| 89 | - $this->set($key, $value); |
|
| 90 | - } |
|
| 81 | + /** |
|
| 82 | + * Magic setter. |
|
| 83 | + * Set the value for the specified key. |
|
| 84 | + * |
|
| 85 | + * @param string $key |
|
| 86 | + * @param mixed $value |
|
| 87 | + */ |
|
| 88 | + public function __set($key, $value) { |
|
| 89 | + $this->set($key, $value); |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - /** |
|
| 93 | - * Magic isset |
|
| 94 | - * Checks whether the ViewBag contains the specified key |
|
| 95 | - * |
|
| 96 | - * @param string $key |
|
| 97 | - * @return bool |
|
| 98 | - */ |
|
| 99 | - public function __isset($key) { |
|
| 100 | - return isset($this->data[$key]); |
|
| 101 | - } |
|
| 92 | + /** |
|
| 93 | + * Magic isset |
|
| 94 | + * Checks whether the ViewBag contains the specified key |
|
| 95 | + * |
|
| 96 | + * @param string $key |
|
| 97 | + * @return bool |
|
| 98 | + */ |
|
| 99 | + public function __isset($key) { |
|
| 100 | + return isset($this->data[$key]); |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - /** |
|
| 104 | - * Magic unset |
|
| 105 | - * Unset the specified key from the ViewBag |
|
| 106 | - * |
|
| 107 | - * @param string $key |
|
| 108 | - */ |
|
| 109 | - public function __unset($key) { |
|
| 110 | - unset($this->data[$key]);; |
|
| 111 | - } |
|
| 103 | + /** |
|
| 104 | + * Magic unset |
|
| 105 | + * Unset the specified key from the ViewBag |
|
| 106 | + * |
|
| 107 | + * @param string $key |
|
| 108 | + */ |
|
| 109 | + public function __unset($key) { |
|
| 110 | + unset($this->data[$key]);; |
|
| 111 | + } |
|
| 112 | 112 | |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | \ No newline at end of file |
@@ -113,29 +113,29 @@ discard block |
||
| 113 | 113 | * @return string|array Estimated birth place if found, null otherwise |
| 114 | 114 | */ |
| 115 | 115 | public function getSignificantPlace(){ |
| 116 | - if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
| 117 | - return $bplace; |
|
| 118 | - } |
|
| 116 | + if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
| 117 | + return $bplace; |
|
| 118 | + } |
|
| 119 | 119 | |
| 120 | - foreach ($this->gedcomrecord->getAllEventPlaces('RESI') as $rplace) { |
|
| 121 | - if ($rplace) { |
|
| 122 | - return $rplace; |
|
| 123 | - } |
|
| 124 | - } |
|
| 120 | + foreach ($this->gedcomrecord->getAllEventPlaces('RESI') as $rplace) { |
|
| 121 | + if ($rplace) { |
|
| 122 | + return $rplace; |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | - if($dplace = $this->gedcomrecord->getDeathPlace()){ |
|
| 127 | - return $dplace; |
|
| 128 | - } |
|
| 126 | + if($dplace = $this->gedcomrecord->getDeathPlace()){ |
|
| 127 | + return $dplace; |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | - foreach($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
| 131 | - foreach ($fams->getAllEventPlaces('RESI') as $rplace) { |
|
| 132 | - if ($rplace) { |
|
| 133 | - return $rplace; |
|
| 134 | - } |
|
| 135 | - } |
|
| 136 | - } |
|
| 130 | + foreach($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
| 131 | + foreach ($fams->getAllEventPlaces('RESI') as $rplace) { |
|
| 132 | + if ($rplace) { |
|
| 133 | + return $rplace; |
|
| 134 | + } |
|
| 135 | + } |
|
| 136 | + } |
|
| 137 | 137 | |
| 138 | - return null; |
|
| 138 | + return null; |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * @return boolean Is the individual a Sosa ancestor |
| 145 | 145 | */ |
| 146 | 146 | public function isSosa(){ |
| 147 | - return count($this->getSosaNumbers()) > 0; |
|
| 147 | + return count($this->getSosaNumbers()) > 0; |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /** |
@@ -155,11 +155,11 @@ discard block |
||
| 155 | 155 | * @return array List of Sosa numbers |
| 156 | 156 | */ |
| 157 | 157 | public function getSosaNumbers(){ |
| 158 | - if($this->sosa === null) { |
|
| 159 | - $provider = new SosaProvider($this->gedcomrecord->getTree()); |
|
| 160 | - $this->sosa = $provider->getSosaNumbers($this->gedcomrecord); |
|
| 161 | - } |
|
| 162 | - return $this->sosa; |
|
| 158 | + if($this->sosa === null) { |
|
| 159 | + $provider = new SosaProvider($this->gedcomrecord->getTree()); |
|
| 160 | + $this->sosa = $provider->getSosaNumbers($this->gedcomrecord); |
|
| 161 | + } |
|
| 162 | + return $this->sosa; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | /** |
@@ -174,10 +174,10 @@ discard block |
||
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | /** |
| 177 | - * Check if this individual's death is sourced |
|
| 178 | - * |
|
| 179 | - * @return int Level of sources |
|
| 180 | - * */ |
|
| 177 | + * Check if this individual's death is sourced |
|
| 178 | + * |
|
| 179 | + * @return int Level of sources |
|
| 180 | + * */ |
|
| 181 | 181 | public function isDeathSourced(){ |
| 182 | 182 | if($this->is_death_sourced !== null) return $this->is_death_sourced; |
| 183 | 183 | $this->is_death_sourced = $this->isFactSourced(WT_EVENTS_DEAT); |
@@ -15,58 +15,58 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | class GeoDisplayOptions { |
| 17 | 17 | |
| 18 | - /** |
|
| 18 | + /** |
|
| 19 | 19 | * Outline map to be used for diaplay |
| 20 | - * @var (null|OutlineMap) $map |
|
| 21 | - */ |
|
| 22 | - protected $map; |
|
| 20 | + * @var (null|OutlineMap) $map |
|
| 21 | + */ |
|
| 22 | + protected $map; |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * Level in the Gedcom hierarchy of the parent level of the outline map. |
| 26 | 26 | * @var int $map_level |
| 27 | 27 | */ |
| 28 | - protected $map_level; |
|
| 28 | + protected $map_level; |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * Option to use flags in places display, instead of or in addition to the name. |
| 32 | 32 | * @var bool $use_flags |
| 33 | 33 | */ |
| 34 | - protected $use_flags; |
|
| 34 | + protected $use_flags; |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * Option to define the number of top places to display in the generation view. |
| 38 | 38 | * @var int $max_details_in_gen |
| 39 | 39 | */ |
| 40 | - protected $max_details_in_gen; |
|
| 40 | + protected $max_details_in_gen; |
|
| 41 | 41 | |
| 42 | - /** |
|
| 42 | + /** |
|
| 43 | 43 | * Get the outline map to use for display. |
| 44 | 44 | * |
| 45 | - * @return (OutlineMap|null) |
|
| 46 | - */ |
|
| 47 | - public function getMap(){ |
|
| 48 | - return $this->map; |
|
| 49 | - } |
|
| 45 | + * @return (OutlineMap|null) |
|
| 46 | + */ |
|
| 47 | + public function getMap(){ |
|
| 48 | + return $this->map; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * Set the outline map to use for display. |
| 53 | 53 | * |
| 54 | - * @param (OutlineMap|null) $map |
|
| 54 | + * @param (OutlineMap|null) $map |
|
| 55 | 55 | * @return self Enable method-chaining |
| 56 | - */ |
|
| 57 | - public function setMap(OutlineMap $map = null) { |
|
| 58 | - $this->map = $map; |
|
| 59 | - return $this; |
|
| 60 | - } |
|
| 56 | + */ |
|
| 57 | + public function setMap(OutlineMap $map = null) { |
|
| 58 | + $this->map = $map; |
|
| 59 | + return $this; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * Get the level of the map parent place |
| 64 | 64 | * |
| 65 | 65 | * @return int |
| 66 | 66 | */ |
| 67 | - public function getMapLevel(){ |
|
| 68 | - return $this->map_level; |
|
| 69 | - } |
|
| 67 | + public function getMapLevel(){ |
|
| 68 | + return $this->map_level; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | 71 | /** |
| 72 | 72 | * Set the level of the map parent place |
@@ -74,19 +74,19 @@ discard block |
||
| 74 | 74 | * @param int $maplevel |
| 75 | 75 | * @return self Enable method-chaining |
| 76 | 76 | */ |
| 77 | - public function setMapLevel($maplevel) { |
|
| 78 | - $this->map_level = $maplevel; |
|
| 79 | - return $this; |
|
| 80 | - } |
|
| 77 | + public function setMapLevel($maplevel) { |
|
| 78 | + $this->map_level = $maplevel; |
|
| 79 | + return $this; |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | 83 | * Get whether flags should be used in places display |
| 84 | 84 | * |
| 85 | 85 | * @return bool |
| 86 | 86 | */ |
| 87 | - public function isUsingFlags(){ |
|
| 88 | - return $this->use_flags; |
|
| 89 | - } |
|
| 87 | + public function isUsingFlags(){ |
|
| 88 | + return $this->use_flags; |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * Set whether flags should be used in places display |
@@ -94,19 +94,19 @@ discard block |
||
| 94 | 94 | * @param bool $use_flags |
| 95 | 95 | * @return self Enable method-chaining |
| 96 | 96 | */ |
| 97 | - public function setUsingFlags($use_flags) { |
|
| 98 | - $this->use_flags = $use_flags; |
|
| 99 | - return $this; |
|
| 100 | - } |
|
| 97 | + public function setUsingFlags($use_flags) { |
|
| 98 | + $this->use_flags = $use_flags; |
|
| 99 | + return $this; |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | 103 | * Get the number of Top Places in the generation view |
| 104 | 104 | * |
| 105 | 105 | * @return int |
| 106 | 106 | */ |
| 107 | - public function getMaxDetailsInGen(){ |
|
| 108 | - return $this->max_details_in_gen; |
|
| 109 | - } |
|
| 107 | + public function getMaxDetailsInGen(){ |
|
| 108 | + return $this->max_details_in_gen; |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | 111 | /** |
| 112 | 112 | * Set the number of Top Places in the generation view |
@@ -114,10 +114,10 @@ discard block |
||
| 114 | 114 | * @param int $max_details_in_gen |
| 115 | 115 | * @return self Enable method-chaining |
| 116 | 116 | */ |
| 117 | - public function setMaxDetailsInGen($max_details_in_gen) { |
|
| 118 | - $this->max_details_in_gen = $max_details_in_gen; |
|
| 119 | - return $this; |
|
| 120 | - } |
|
| 117 | + public function setMaxDetailsInGen($max_details_in_gen) { |
|
| 118 | + $this->max_details_in_gen = $max_details_in_gen; |
|
| 119 | + return $this; |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | \ No newline at end of file |
@@ -20,253 +20,253 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | abstract class AbstractTask { |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Time out for runnign tasks, in seconds. Default 5 min |
|
| 25 | - * @var int TASK_TIME_OUT |
|
| 26 | - */ |
|
| 27 | - const TASK_TIME_OUT = 300; |
|
| 23 | + /** |
|
| 24 | + * Time out for runnign tasks, in seconds. Default 5 min |
|
| 25 | + * @var int TASK_TIME_OUT |
|
| 26 | + */ |
|
| 27 | + const TASK_TIME_OUT = 300; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Task provider |
|
| 31 | - * @var TaskProviderInterface $provider |
|
| 32 | - */ |
|
| 29 | + /** |
|
| 30 | + * Task provider |
|
| 31 | + * @var TaskProviderInterface $provider |
|
| 32 | + */ |
|
| 33 | 33 | protected $provider; |
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * Task name |
| 37 | 37 | * @var string $name |
| 38 | 38 | */ |
| 39 | - protected $name; |
|
| 39 | + protected $name; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Status of the task |
|
| 43 | - * @var bool $is_enabled |
|
| 44 | - */ |
|
| 45 | - protected $is_enabled; |
|
| 41 | + /** |
|
| 42 | + * Status of the task |
|
| 43 | + * @var bool $is_enabled |
|
| 44 | + */ |
|
| 45 | + protected $is_enabled; |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Last updated date |
|
| 49 | - * @var \DateTime $last_updated |
|
| 50 | - */ |
|
| 51 | - protected $last_updated; |
|
| 47 | + /** |
|
| 48 | + * Last updated date |
|
| 49 | + * @var \DateTime $last_updated |
|
| 50 | + */ |
|
| 51 | + protected $last_updated; |
|
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * Last run result |
|
| 55 | - * @var bool $last_result |
|
| 56 | - */ |
|
| 57 | - protected $last_result; |
|
| 53 | + /** |
|
| 54 | + * Last run result |
|
| 55 | + * @var bool $last_result |
|
| 56 | + */ |
|
| 57 | + protected $last_result; |
|
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Task run frequency |
|
| 61 | - * @var int $frequency |
|
| 62 | - */ |
|
| 63 | - protected $frequency; |
|
| 59 | + /** |
|
| 60 | + * Task run frequency |
|
| 61 | + * @var int $frequency |
|
| 62 | + */ |
|
| 63 | + protected $frequency; |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * Task remaining runs |
|
| 67 | - * @var int $nb_occurrences |
|
| 68 | - */ |
|
| 69 | - protected $nb_occurrences; |
|
| 65 | + /** |
|
| 66 | + * Task remaining runs |
|
| 67 | + * @var int $nb_occurrences |
|
| 68 | + */ |
|
| 69 | + protected $nb_occurrences; |
|
| 70 | 70 | |
| 71 | - /** |
|
| 72 | - * Current running status of the task |
|
| 73 | - * @var bool $is_running |
|
| 74 | - */ |
|
| 75 | - protected $is_running; |
|
| 71 | + /** |
|
| 72 | + * Current running status of the task |
|
| 73 | + * @var bool $is_running |
|
| 74 | + */ |
|
| 75 | + protected $is_running; |
|
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * Constructor for the Admin task class |
|
| 77 | + /** |
|
| 78 | + * Constructor for the Admin task class |
|
| 79 | 79 | * |
| 80 | 80 | * @param string $file Filename containing the task object |
| 81 | 81 | * @param TaskProviderInterface $provider Provider for tasks |
| 82 | - */ |
|
| 83 | - public function __construct($file, TaskProviderInterface $provider = null){ |
|
| 84 | - $this->name = trim(basename($file, '.php')); |
|
| 82 | + */ |
|
| 83 | + public function __construct($file, TaskProviderInterface $provider = null){ |
|
| 84 | + $this->name = trim(basename($file, '.php')); |
|
| 85 | 85 | $this->provider = $provider; |
| 86 | - } |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | - /** |
|
| 89 | - * Get the provider. |
|
| 90 | - * |
|
| 91 | - * @return TaskProviderInterface |
|
| 92 | - */ |
|
| 93 | - public function getProvider(){ |
|
| 94 | - return $this->provider; |
|
| 95 | - } |
|
| 88 | + /** |
|
| 89 | + * Get the provider. |
|
| 90 | + * |
|
| 91 | + * @return TaskProviderInterface |
|
| 92 | + */ |
|
| 93 | + public function getProvider(){ |
|
| 94 | + return $this->provider; |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * Set the provider. |
|
| 99 | - * |
|
| 100 | - * @param TaskProviderInterface $provider |
|
| 101 | - * @return self Enable method-chaining |
|
| 102 | - */ |
|
| 103 | - public function setProvider(TaskProviderInterface $provider){ |
|
| 104 | - $this->provider = $provider; |
|
| 105 | - return $this; |
|
| 106 | - } |
|
| 97 | + /** |
|
| 98 | + * Set the provider. |
|
| 99 | + * |
|
| 100 | + * @param TaskProviderInterface $provider |
|
| 101 | + * @return self Enable method-chaining |
|
| 102 | + */ |
|
| 103 | + public function setProvider(TaskProviderInterface $provider){ |
|
| 104 | + $this->provider = $provider; |
|
| 105 | + return $this; |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * Set parameters of the Task |
|
| 110 | - * |
|
| 111 | - * @param bool $is_enabled Status of the task |
|
| 112 | - * @param \DateTime $lastupdated Time of the last task run |
|
| 113 | - * @param bool $last_result Result of the last run, true for success, false for failure |
|
| 114 | - * @param int $frequency Frequency of execution in minutes |
|
| 115 | - * @param int $nb_occur Number of remaining occurrences, 0 for tasks not limited |
|
| 116 | - * @param bool $is_running Indicates if the task is currently running |
|
| 117 | - */ |
|
| 118 | - public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running){ |
|
| 119 | - $this->is_enabled = $is_enabled; |
|
| 120 | - $this->last_updated = $last_updated; |
|
| 121 | - $this->last_result = $last_result; |
|
| 122 | - $this->frequency = $frequency; |
|
| 123 | - $this->nb_occurrences = $nb_occur; |
|
| 124 | - $this->is_running = $is_running; |
|
| 125 | - } |
|
| 108 | + /** |
|
| 109 | + * Set parameters of the Task |
|
| 110 | + * |
|
| 111 | + * @param bool $is_enabled Status of the task |
|
| 112 | + * @param \DateTime $lastupdated Time of the last task run |
|
| 113 | + * @param bool $last_result Result of the last run, true for success, false for failure |
|
| 114 | + * @param int $frequency Frequency of execution in minutes |
|
| 115 | + * @param int $nb_occur Number of remaining occurrences, 0 for tasks not limited |
|
| 116 | + * @param bool $is_running Indicates if the task is currently running |
|
| 117 | + */ |
|
| 118 | + public function setParameters($is_enabled, \DateTime $last_updated, $last_result, $frequency, $nb_occur, $is_running){ |
|
| 119 | + $this->is_enabled = $is_enabled; |
|
| 120 | + $this->last_updated = $last_updated; |
|
| 121 | + $this->last_result = $last_result; |
|
| 122 | + $this->frequency = $frequency; |
|
| 123 | + $this->nb_occurrences = $nb_occur; |
|
| 124 | + $this->is_running = $is_running; |
|
| 125 | + } |
|
| 126 | 126 | |
| 127 | - /** |
|
| 128 | - * Get the name of the task |
|
| 129 | - * |
|
| 130 | - * @return string |
|
| 131 | - */ |
|
| 132 | - public function getName(){ |
|
| 133 | - return $this->name; |
|
| 134 | - } |
|
| 127 | + /** |
|
| 128 | + * Get the name of the task |
|
| 129 | + * |
|
| 130 | + * @return string |
|
| 131 | + */ |
|
| 132 | + public function getName(){ |
|
| 133 | + return $this->name; |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | 136 | |
| 137 | - /** |
|
| 138 | - * Return the status of the task in a boolean way |
|
| 139 | - * |
|
| 140 | - * @return boolean True if enabled |
|
| 141 | - */ |
|
| 142 | - public function isEnabled(){ |
|
| 143 | - return $this->is_enabled; |
|
| 144 | - } |
|
| 137 | + /** |
|
| 138 | + * Return the status of the task in a boolean way |
|
| 139 | + * |
|
| 140 | + * @return boolean True if enabled |
|
| 141 | + */ |
|
| 142 | + public function isEnabled(){ |
|
| 143 | + return $this->is_enabled; |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | - /** |
|
| 147 | - * Get the last updated time. |
|
| 148 | - * |
|
| 149 | - * @return \DateTime |
|
| 150 | - */ |
|
| 151 | - public function getLastUpdated(){ |
|
| 152 | - return $this->last_updated; |
|
| 153 | - } |
|
| 146 | + /** |
|
| 147 | + * Get the last updated time. |
|
| 148 | + * |
|
| 149 | + * @return \DateTime |
|
| 150 | + */ |
|
| 151 | + public function getLastUpdated(){ |
|
| 152 | + return $this->last_updated; |
|
| 153 | + } |
|
| 154 | 154 | |
| 155 | - /** |
|
| 156 | - * Check if the last result has been successful. |
|
| 157 | - * |
|
| 158 | - * @return bool |
|
| 159 | - */ |
|
| 160 | - public function isLastRunSuccess(){ |
|
| 161 | - return $this->last_result; |
|
| 162 | - } |
|
| 155 | + /** |
|
| 156 | + * Check if the last result has been successful. |
|
| 157 | + * |
|
| 158 | + * @return bool |
|
| 159 | + */ |
|
| 160 | + public function isLastRunSuccess(){ |
|
| 161 | + return $this->last_result; |
|
| 162 | + } |
|
| 163 | 163 | |
| 164 | - /** |
|
| 165 | - * Get the task frequency. |
|
| 166 | - * |
|
| 167 | - * @return int |
|
| 168 | - */ |
|
| 169 | - public function getFrequency(){ |
|
| 170 | - return $this->frequency; |
|
| 171 | - } |
|
| 164 | + /** |
|
| 165 | + * Get the task frequency. |
|
| 166 | + * |
|
| 167 | + * @return int |
|
| 168 | + */ |
|
| 169 | + public function getFrequency(){ |
|
| 170 | + return $this->frequency; |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | 173 | /** |
| 174 | - * Set the task frequency. |
|
| 175 | - * |
|
| 174 | + * Set the task frequency. |
|
| 175 | + * |
|
| 176 | 176 | * @param int $frequency |
| 177 | - * @return self Enable method-chaining |
|
| 178 | - */ |
|
| 179 | - public function setFrequency($frequency){ |
|
| 180 | - $this->frequency = $frequency; |
|
| 177 | + * @return self Enable method-chaining |
|
| 178 | + */ |
|
| 179 | + public function setFrequency($frequency){ |
|
| 180 | + $this->frequency = $frequency; |
|
| 181 | 181 | return $this; |
| 182 | - } |
|
| 182 | + } |
|
| 183 | 183 | |
| 184 | - /** |
|
| 185 | - * Get the number of remaining occurrences. |
|
| 186 | - * |
|
| 187 | - * @return int |
|
| 188 | - */ |
|
| 189 | - public function getRemainingOccurrences(){ |
|
| 190 | - return $this->nb_occurrences; |
|
| 191 | - } |
|
| 184 | + /** |
|
| 185 | + * Get the number of remaining occurrences. |
|
| 186 | + * |
|
| 187 | + * @return int |
|
| 188 | + */ |
|
| 189 | + public function getRemainingOccurrences(){ |
|
| 190 | + return $this->nb_occurrences; |
|
| 191 | + } |
|
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | - * Set the number of remaining occurrences. |
|
| 195 | - * |
|
| 194 | + * Set the number of remaining occurrences. |
|
| 195 | + * |
|
| 196 | 196 | * @param int $nb_occur |
| 197 | - * @return self Enable method-chaining |
|
| 198 | - */ |
|
| 199 | - public function setRemainingOccurrences($nb_occur){ |
|
| 200 | - $this->nb_occurrences = $nb_occur; |
|
| 197 | + * @return self Enable method-chaining |
|
| 198 | + */ |
|
| 199 | + public function setRemainingOccurrences($nb_occur){ |
|
| 200 | + $this->nb_occurrences = $nb_occur; |
|
| 201 | 201 | return $this; |
| 202 | - } |
|
| 202 | + } |
|
| 203 | 203 | |
| 204 | - /** |
|
| 205 | - * Check if the task if running. |
|
| 206 | - * |
|
| 207 | - * @return bool |
|
| 208 | - */ |
|
| 209 | - public function isRunning(){ |
|
| 210 | - return $this->is_running; |
|
| 211 | - } |
|
| 204 | + /** |
|
| 205 | + * Check if the task if running. |
|
| 206 | + * |
|
| 207 | + * @return bool |
|
| 208 | + */ |
|
| 209 | + public function isRunning(){ |
|
| 210 | + return $this->is_running; |
|
| 211 | + } |
|
| 212 | 212 | |
| 213 | 213 | |
| 214 | - /** |
|
| 215 | - * Return the name to display for the task |
|
| 216 | - * |
|
| 217 | - * @return string Title for the task |
|
| 218 | - */ |
|
| 219 | - abstract public function getTitle(); |
|
| 214 | + /** |
|
| 215 | + * Return the name to display for the task |
|
| 216 | + * |
|
| 217 | + * @return string Title for the task |
|
| 218 | + */ |
|
| 219 | + abstract public function getTitle(); |
|
| 220 | 220 | |
| 221 | - /** |
|
| 222 | - * Return the default frequency for the execution of the task |
|
| 223 | - * |
|
| 224 | - * @return int Frequency for the execution of the task |
|
| 225 | - */ |
|
| 226 | - abstract public function getDefaultFrequency(); |
|
| 221 | + /** |
|
| 222 | + * Return the default frequency for the execution of the task |
|
| 223 | + * |
|
| 224 | + * @return int Frequency for the execution of the task |
|
| 225 | + */ |
|
| 226 | + abstract public function getDefaultFrequency(); |
|
| 227 | 227 | |
| 228 | - /** |
|
| 229 | - * Execute the task's actions |
|
| 230 | - */ |
|
| 231 | - abstract protected function executeSteps(); |
|
| 228 | + /** |
|
| 229 | + * Execute the task's actions |
|
| 230 | + */ |
|
| 231 | + abstract protected function executeSteps(); |
|
| 232 | 232 | |
| 233 | 233 | /** |
| 234 | 234 | * Persist task state into database. |
| 235 | 235 | * @return bool |
| 236 | 236 | */ |
| 237 | 237 | public function save() { |
| 238 | - if(!$this->provider) throw new \Exception('The task has not been initialised with a provider.'); |
|
| 238 | + if(!$this->provider) throw new \Exception('The task has not been initialised with a provider.'); |
|
| 239 | 239 | return $this->provider->updateTask($this); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - /** |
|
| 243 | - * Execute the task, default skeleton |
|
| 244 | - * |
|
| 245 | - */ |
|
| 246 | - public function execute(){ |
|
| 242 | + /** |
|
| 243 | + * Execute the task, default skeleton |
|
| 244 | + * |
|
| 245 | + */ |
|
| 246 | + public function execute(){ |
|
| 247 | 247 | |
| 248 | - if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime()) |
|
| 249 | - $this->is_running = false; |
|
| 248 | + if($this->last_updated->add(new \DateInterval('PT'.self::TASK_TIME_OUT.'S')) < new \DateTime()) |
|
| 249 | + $this->is_running = false; |
|
| 250 | 250 | |
| 251 | - if(!$this->is_running){ |
|
| 252 | - $this->last_result = false; |
|
| 253 | - $this->is_running = true; |
|
| 254 | - $this->save(); |
|
| 251 | + if(!$this->is_running){ |
|
| 252 | + $this->last_result = false; |
|
| 253 | + $this->is_running = true; |
|
| 254 | + $this->save(); |
|
| 255 | 255 | |
| 256 | - Log::addDebugLog('Start execution of Admin task: '.$this->getTitle()); |
|
| 257 | - $this->last_result = $this->executeSteps(); |
|
| 258 | - if($this->last_result){ |
|
| 259 | - $this->last_updated = new \DateTime(); |
|
| 260 | - if($this->nb_occurrences > 0){ |
|
| 261 | - $this->nb_occurrences--; |
|
| 262 | - if($this->nb_occurrences == 0) $this->is_enabled = false; |
|
| 263 | - } |
|
| 264 | - } |
|
| 265 | - $this->is_running = false; |
|
| 266 | - $this->save(); |
|
| 267 | - Log::addDebugLog('Execution completed for Admin task: '.$this->getTitle().' - '.($this->last_result ? 'Success' : 'Failure')); |
|
| 268 | - } |
|
| 269 | - } |
|
| 256 | + Log::addDebugLog('Start execution of Admin task: '.$this->getTitle()); |
|
| 257 | + $this->last_result = $this->executeSteps(); |
|
| 258 | + if($this->last_result){ |
|
| 259 | + $this->last_updated = new \DateTime(); |
|
| 260 | + if($this->nb_occurrences > 0){ |
|
| 261 | + $this->nb_occurrences--; |
|
| 262 | + if($this->nb_occurrences == 0) $this->is_enabled = false; |
|
| 263 | + } |
|
| 264 | + } |
|
| 265 | + $this->is_running = false; |
|
| 266 | + $this->save(); |
|
| 267 | + Log::addDebugLog('Execution completed for Admin task: '.$this->getTitle().' - '.($this->last_result ? 'Success' : 'Failure')); |
|
| 268 | + } |
|
| 269 | + } |
|
| 270 | 270 | |
| 271 | 271 | |
| 272 | 272 | } |
@@ -16,51 +16,51 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | interface HookProviderInterface { |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Return an instance of the hook linked to the specifed function / context |
|
| 21 | - * |
|
| 22 | - * @param string $hook_function |
|
| 23 | - * @param string $hook_context |
|
| 24 | - * @return Hook |
|
| 25 | - */ |
|
| 26 | - public function get($hook_function, $hook_context = null); |
|
| 19 | + /** |
|
| 20 | + * Return an instance of the hook linked to the specifed function / context |
|
| 21 | + * |
|
| 22 | + * @param string $hook_function |
|
| 23 | + * @param string $hook_context |
|
| 24 | + * @return Hook |
|
| 25 | + */ |
|
| 26 | + public function get($hook_function, $hook_context = null); |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Return whether the Hook module is active and the table has been created. |
|
| 30 | - * |
|
| 31 | - * @uses \MyArtJaub\Webtrees\Module\ModuleManager to check if the module is operational |
|
| 32 | - * @return bool True if module active and table created, false otherwise |
|
| 33 | - */ |
|
| 34 | - public function isModuleOperational(); |
|
| 28 | + /** |
|
| 29 | + * Return whether the Hook module is active and the table has been created. |
|
| 30 | + * |
|
| 31 | + * @uses \MyArtJaub\Webtrees\Module\ModuleManager to check if the module is operational |
|
| 32 | + * @return bool True if module active and table created, false otherwise |
|
| 33 | + */ |
|
| 34 | + public function isModuleOperational(); |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Get the list of possible hooks in the list of modules files. |
|
| 38 | - * A hook will be registered: |
|
| 39 | - * - for all modules already registered in Webtrees |
|
| 40 | - * - if the module implements HookSubscriberInterface |
|
| 41 | - * - if the method exist within the module |
|
| 42 | - * |
|
| 43 | - * @return Array List of possible hooks, with the priority |
|
| 44 | - */ |
|
| 45 | - public function getPossibleHooks(); |
|
| 36 | + /** |
|
| 37 | + * Get the list of possible hooks in the list of modules files. |
|
| 38 | + * A hook will be registered: |
|
| 39 | + * - for all modules already registered in Webtrees |
|
| 40 | + * - if the module implements HookSubscriberInterface |
|
| 41 | + * - if the method exist within the module |
|
| 42 | + * |
|
| 43 | + * @return Array List of possible hooks, with the priority |
|
| 44 | + */ |
|
| 45 | + public function getPossibleHooks(); |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Get the list of hooks intalled in webtrees, with their id, status and priority. |
|
| 49 | - * |
|
| 50 | - * @return array List of installed hooks |
|
| 51 | - */ |
|
| 52 | - public function getRawInstalledHooks(); |
|
| 47 | + /** |
|
| 48 | + * Get the list of hooks intalled in webtrees, with their id, status and priority. |
|
| 49 | + * |
|
| 50 | + * @return array List of installed hooks |
|
| 51 | + */ |
|
| 52 | + public function getRawInstalledHooks(); |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Get the list of hooks intalled in webtrees, with their id, status and priority. |
|
| 56 | - * |
|
| 57 | - * @return Array List of installed hooks, with id, status and priority |
|
| 58 | - */ |
|
| 59 | - public function getInstalledHooks(); |
|
| 54 | + /** |
|
| 55 | + * Get the list of hooks intalled in webtrees, with their id, status and priority. |
|
| 56 | + * |
|
| 57 | + * @return Array List of installed hooks, with id, status and priority |
|
| 58 | + */ |
|
| 59 | + public function getInstalledHooks(); |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * Update the list of hooks, identifying missing ones and removed ones. |
|
| 63 | - */ |
|
| 64 | - public function updateHooks(); |
|
| 61 | + /** |
|
| 62 | + * Update the list of hooks, identifying missing ones and removed ones. |
|
| 63 | + */ |
|
| 64 | + public function updateHooks(); |
|
| 65 | 65 | |
| 66 | 66 | } |
| 67 | 67 | \ No newline at end of file |