@@ -42,7 +42,6 @@ |
||
42 | 42 | * Get all the data from the bag for a given key. |
43 | 43 | * |
44 | 44 | * @param string $key |
45 | - * @param string $format |
|
46 | 45 | * @return unknown |
47 | 46 | */ |
48 | 47 | public function get($key, $default = null) |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * @param bool $override |
74 | 74 | */ |
75 | 75 | public function set($key, $value, $override = true) { |
76 | - if(is_null($key)) return; |
|
77 | - if(!$override && array_key_exists($key, $this->data)) return; |
|
76 | + if (is_null($key)) return; |
|
77 | + if (!$override && array_key_exists($key, $this->data)) return; |
|
78 | 78 | $this->data[$key] = $value; |
79 | 79 | } |
80 | 80 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @param string $key |
108 | 108 | */ |
109 | 109 | public function __unset($key) { |
110 | - unset($this->data[$key]);; |
|
110 | + unset($this->data[$key]); ; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | } |
@@ -73,8 +73,12 @@ |
||
73 | 73 | * @param bool $override |
74 | 74 | */ |
75 | 75 | public function set($key, $value, $override = true) { |
76 | - if(is_null($key)) return; |
|
77 | - if(!$override && array_key_exists($key, $this->data)) return; |
|
76 | + if(is_null($key)) { |
|
77 | + return; |
|
78 | + } |
|
79 | + if(!$override && array_key_exists($key, $this->data)) { |
|
80 | + return; |
|
81 | + } |
|
78 | 82 | $this->data[$key] = $value; |
79 | 83 | } |
80 | 84 |
@@ -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 |
@@ -26,7 +26,7 @@ |
||
26 | 26 | /** |
27 | 27 | * Contructor for the decorator |
28 | 28 | * |
29 | - * @param \Fisharebest\Webtrees\Place $place_in The Place to extend |
|
29 | + * @param \Fisharebest\Webtrees\Place $place The Place to extend |
|
30 | 30 | */ |
31 | 31 | public function __construct(\Fisharebest\Webtrees\Place $place){ |
32 | 32 | $this->_place = $place; |
@@ -77,8 +77,7 @@ |
||
77 | 77 | $index = str_replace('%', '', $match2); |
78 | 78 | if(is_numeric($index) && $index >0 && $index <= $nbLevels){ |
79 | 79 | $displayPlace = str_replace($match2, $levels[$index-1] , $displayPlace); |
80 | - } |
|
81 | - else{ |
|
80 | + } else{ |
|
82 | 81 | $displayPlace = str_replace($match2, '' , $displayPlace); |
83 | 82 | } |
84 | 83 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @param \Fisharebest\Webtrees\Place $place_in The Place to extend |
29 | 29 | */ |
30 | - public function __construct(\Fisharebest\Webtrees\Place $place){ |
|
30 | + public function __construct(\Fisharebest\Webtrees\Place $place) { |
|
31 | 31 | $this->place = $place; |
32 | 32 | } |
33 | 33 | |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | * @param \Fisharebest\Webtrees\Tree $tree |
40 | 40 | * @return \MyArtJaub\Webtrees\Place|null Instance of \MyArtJaub\Webtrees\Place, if relevant |
41 | 41 | */ |
42 | - public static function getIntance($place_str, Tree $tree){ |
|
42 | + public static function getIntance($place_str, Tree $tree) { |
|
43 | 43 | $dplace = null; |
44 | - if(is_string($place_str) && strlen($place_str) > 0){ |
|
44 | + if (is_string($place_str) && strlen($place_str) > 0) { |
|
45 | 45 | $dplace = new Place(new \Fisharebest\Webtrees\Place($place_str, $tree)); |
46 | 46 | } |
47 | 47 | return $dplace; |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return \Fisharebest\Webtrees\Place Embedded place record |
54 | 54 | */ |
55 | - public function getDerivedPlace(){ |
|
55 | + public function getDerivedPlace() { |
|
56 | 56 | return $this->place; |
57 | 57 | } |
58 | 58 | |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | * @param bool $anchor Option to print a link to placelist |
66 | 66 | * @return string HTML code for formatted place |
67 | 67 | */ |
68 | - public function htmlFormattedName($format, $anchor = false){ |
|
69 | - $html=''; |
|
68 | + public function htmlFormattedName($format, $anchor = false) { |
|
69 | + $html = ''; |
|
70 | 70 | |
71 | 71 | $levels = array_map('trim', explode(',', $this->place->getGedcomName())); |
72 | 72 | $nbLevels = count($levels); |
@@ -74,15 +74,15 @@ discard block |
||
74 | 74 | preg_match_all('/%[^%]/', $displayPlace, $matches); |
75 | 75 | foreach ($matches[0] as $match2) { |
76 | 76 | $index = str_replace('%', '', $match2); |
77 | - if(is_numeric($index) && $index >0 && $index <= $nbLevels){ |
|
78 | - $displayPlace = str_replace($match2, $levels[$index-1] , $displayPlace); |
|
77 | + if (is_numeric($index) && $index > 0 && $index <= $nbLevels) { |
|
78 | + $displayPlace = str_replace($match2, $levels[$index - 1], $displayPlace); |
|
79 | 79 | } |
80 | - else{ |
|
81 | - $displayPlace = str_replace($match2, '' , $displayPlace); |
|
80 | + else { |
|
81 | + $displayPlace = str_replace($match2, '', $displayPlace); |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | if ($anchor && !Auth::isSearchEngine()) { |
85 | - $html .='<a href="' . $this->place->getURL() . '">' . $displayPlace . '</a>'; |
|
85 | + $html .= '<a href="'.$this->place->getURL().'">'.$displayPlace.'</a>'; |
|
86 | 86 | } else { |
87 | 87 | $html .= $displayPlace; |
88 | 88 | } |
@@ -23,6 +23,6 @@ |
||
23 | 23 | define('WT_REGEX_INTEGER', '-?\d+'); |
24 | 24 | define('WT_REGEX_BYTES', '[0-9]+[bBkKmMgG]?'); |
25 | 25 | define('WT_REGEX_IPV4', '\d{1,3}(\.\d{1,3}){3}'); |
26 | -define('WT_REGEX_PASSWORD', '.{' . WT_MINIMUM_PASSWORD_LENGTH . ',}'); |
|
26 | +define('WT_REGEX_PASSWORD', '.{'.WT_MINIMUM_PASSWORD_LENGTH.',}'); |
|
27 | 27 | |
28 | 28 | I18N::init('en-US'); |
29 | 29 | \ No newline at end of file |
@@ -14,17 +14,17 @@ discard block |
||
14 | 14 | */ |
15 | 15 | class Constants { |
16 | 16 | |
17 | - const LIB_NAMESPACE = __NAMESPACE__; |
|
17 | + const LIB_NAMESPACE = __NAMESPACE__; |
|
18 | 18 | |
19 | - /** Internal name of the Certificates Module |
|
20 | - * @var string |
|
21 | - */ |
|
22 | - const MODULE_MAJ_CERTIF_NAME = 'myartjaub_certificates'; |
|
19 | + /** Internal name of the Certificates Module |
|
20 | + * @var string |
|
21 | + */ |
|
22 | + const MODULE_MAJ_CERTIF_NAME = 'myartjaub_certificates'; |
|
23 | 23 | |
24 | - /** Internal name of the GeoDispersion Module |
|
25 | - * @var string |
|
26 | - */ |
|
27 | - const MODULE_MAJ_GEODISP_NAME = 'myartjaub_geodispersion'; |
|
24 | + /** Internal name of the GeoDispersion Module |
|
25 | + * @var string |
|
26 | + */ |
|
27 | + const MODULE_MAJ_GEODISP_NAME = 'myartjaub_geodispersion'; |
|
28 | 28 | |
29 | 29 | /** Internal name of the Hooks Module |
30 | 30 | * @var string |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @return string $WT_RAPHAEL_JS_URL |
62 | 62 | */ |
63 | 63 | public static function WT_RAPHAEL_JS_URL() { |
64 | - return WT_STATIC_URL . 'packages/raphael-2.1.4/raphael-min.js'; |
|
64 | + return WT_STATIC_URL . 'packages/raphael-2.1.4/raphael-min.js'; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | } |
68 | 68 | \ No newline at end of file |
@@ -61,7 +61,7 @@ |
||
61 | 61 | * @return string $WT_RAPHAEL_JS_URL |
62 | 62 | */ |
63 | 63 | public static function WT_RAPHAEL_JS_URL() { |
64 | - return WT_STATIC_URL . 'packages/raphael-2.1.4/raphael-min.js'; |
|
64 | + return WT_STATIC_URL.'packages/raphael-2.1.4/raphael-min.js'; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | } |
68 | 68 | \ No newline at end of file |
@@ -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; |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | * @see \MyArtJaub\Webtrees\Map\MapProviderInterface::getProviderPlaceId() |
26 | 26 | */ |
27 | 27 | public function getProviderPlaceId(\Fisharebest\Webtrees\Place $place) { |
28 | - if(!$place->isEmpty()) { |
|
29 | - $parent = explode (',', $place->getGedcomName()); |
|
28 | + if (!$place->isEmpty()) { |
|
29 | + $parent = explode(',', $place->getGedcomName()); |
|
30 | 30 | $place_id = 0; |
31 | 31 | $nb_levels = count($parent); |
32 | - for ($i=0; $i < $nb_levels; $i++) { |
|
32 | + for ($i = 0; $i < $nb_levels; $i++) { |
|
33 | 33 | $parent[$i] = trim($parent[$i]); |
34 | - if (empty($parent[$i])) $parent[$i]='unknown';// GoogleMap module uses "unknown" while GEDCOM uses , , |
|
35 | - $pl_id=Database::prepare('SELECT pl_id FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place') |
|
34 | + if (empty($parent[$i])) $parent[$i] = 'unknown'; // GoogleMap module uses "unknown" while GEDCOM uses , , |
|
35 | + $pl_id = Database::prepare('SELECT pl_id FROM `##placelocation` WHERE pl_level=? AND pl_parent_id=? AND pl_place LIKE ? ORDER BY pl_place') |
|
36 | 36 | ->execute(array($i, $place_id, $parent[$i])) |
37 | 37 | ->fetchOne(); |
38 | 38 | if (empty($pl_id)) break; |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | * @see \MyArtJaub\Webtrees\Map\MapProviderInterface::getPlaceIcon() |
49 | 49 | */ |
50 | 50 | public function getPlaceIcon(\Fisharebest\Webtrees\Place $place) { |
51 | - if(!$place->isEmpty()){ |
|
51 | + if (!$place->isEmpty()) { |
|
52 | 52 | $place_details = |
53 | 53 | Database::prepare("SELECT SQL_CACHE pl_icon FROM `##placelocation` WHERE pl_id=? ORDER BY pl_place") |
54 | 54 | ->execute(array($this->getProviderPlaceId($place))) |
55 | 55 | ->fetchOneRow(); |
56 | - if($place_details){ |
|
56 | + if ($place_details) { |
|
57 | 57 | return WT_MODULES_DIR.'googlemap/'.$place_details->pl_icon; |
58 | 58 | } |
59 | 59 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtender::hExtendIndiHeaderIcons() |
62 | 62 | */ |
63 | 63 | public function hExtendIndiHeaderIcons(IndividualController $ctrlIndi) { |
64 | - if($ctrlIndi){ |
|
64 | + if ($ctrlIndi) { |
|
65 | 65 | $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
66 | 66 | if ($dindi->canDisplayIsSourced()) |
67 | 67 | return FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'large'); |
@@ -85,19 +85,19 @@ discard block |
||
85 | 85 | * {@inheritDoc} |
86 | 86 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtender::hRecordNamePrepend() |
87 | 87 | */ |
88 | - public function hRecordNamePrepend(GedcomRecord $grec){ } |
|
88 | + public function hRecordNamePrepend(GedcomRecord $grec) { } |
|
89 | 89 | |
90 | 90 | /** |
91 | 91 | * {@inheritDoc} |
92 | 92 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtender::hRecordNameAppend() |
93 | 93 | */ |
94 | - public function hRecordNameAppend(GedcomRecord $grec){ |
|
94 | + public function hRecordNameAppend(GedcomRecord $grec) { |
|
95 | 95 | $html = ''; |
96 | - if($grec instanceof \Fisharebest\Webtrees\Individual){ |
|
96 | + if ($grec instanceof \Fisharebest\Webtrees\Individual) { |
|
97 | 97 | $dindi = new Individual($grec); |
98 | 98 | $html .= FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'small'); |
99 | 99 | $html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isBirthSourced(), 'BIRT', 1, 'small'); |
100 | - if($grec->isDead()) |
|
100 | + if ($grec->isDead()) |
|
101 | 101 | $html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isDeathSourced(), 'DEAT', 1, 'small'); |
102 | 102 | } |
103 | 103 | return $html; |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | * {@inheritDoc} |
116 | 116 | * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::hasSidebarContent() |
117 | 117 | */ |
118 | - public function hasSidebarContent(){ |
|
118 | + public function hasSidebarContent() { |
|
119 | 119 | return true; |
120 | 120 | } |
121 | 121 | |
@@ -145,24 +145,24 @@ discard block |
||
145 | 145 | echo ' |
146 | 146 | <table class="issourcedtable"> |
147 | 147 | <tr> |
148 | - <td class="slabel"> ' . GedcomTag::getLabel('INDI') . '</td> |
|
148 | + <td class="slabel"> ' . GedcomTag::getLabel('INDI').'</td> |
|
149 | 149 | <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1).'</td> |
150 | 150 | </tr> |
151 | 151 | <tr> |
152 | - <td class="slabel">' . GedcomTag::getLabel('BIRT') . '</td> |
|
152 | + <td class="slabel">' . GedcomTag::getLabel('BIRT').'</td> |
|
153 | 153 | <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dindi->isBirthSourced(), 'BIRT', 1).'</td> |
154 | 154 | </tr>'; |
155 | 155 | |
156 | 156 | $fams = $root->getSpouseFamilies(); |
157 | - ($ct = count($fams)) > 1 ? $nb=1 : $nb=' '; |
|
158 | - foreach($fams as $fam){ |
|
157 | + ($ct = count($fams)) > 1 ? $nb = 1 : $nb = ' '; |
|
158 | + foreach ($fams as $fam) { |
|
159 | 159 | $dfam = new Family($fam); |
160 | 160 | echo ' |
161 | 161 | <tr> |
162 | 162 | <td class="slabel right"> |
163 | - <a href="' . $fam->getHtmlUrl() . '"> '. GedcomTag::getLabel('MARR'); |
|
164 | - if($ct > 1){ |
|
165 | - echo ' ',$nb; |
|
163 | + <a href="' . $fam->getHtmlUrl().'"> '.GedcomTag::getLabel('MARR'); |
|
164 | + if ($ct > 1) { |
|
165 | + echo ' ', $nb; |
|
166 | 166 | $nb++; |
167 | 167 | } |
168 | 168 | echo ' </a> |
@@ -171,10 +171,10 @@ discard block |
||
171 | 171 | </tr>'; |
172 | 172 | } |
173 | 173 | |
174 | - if( $root->isDead() ) |
|
174 | + if ($root->isDead()) |
|
175 | 175 | echo ' |
176 | 176 | <tr> |
177 | - <td class="slabel">' . GedcomTag::getLabel('DEAT') . '</td> |
|
177 | + <td class="slabel">' . GedcomTag::getLabel('DEAT').'</td> |
|
178 | 178 | <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dindi->isDeathSourced(), 'DEAT', 1).'</td> |
179 | 179 | </tr>'; |
180 | 180 |
@@ -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 | } |
@@ -28,29 +28,29 @@ discard block |
||
28 | 28 | class IsSourcedModule extends AbstractModule |
29 | 29 | implements ModuleSidebarInterface, HookSubscriberInterface, IndividualHeaderExtenderInterface, RecordNameTextExtenderInterface |
30 | 30 | { |
31 | - /** @var string For custom modules - link for support, upgrades, etc. */ |
|
32 | - const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
31 | + /** @var string For custom modules - link for support, upgrades, etc. */ |
|
32 | + const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
33 | 33 | |
34 | - /** |
|
35 | - * {@inheritDoc} |
|
36 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::getTitle() |
|
37 | - */ |
|
38 | - public function getTitle() { |
|
39 | - return I18N::translate('Sourced events'); |
|
40 | - } |
|
34 | + /** |
|
35 | + * {@inheritDoc} |
|
36 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::getTitle() |
|
37 | + */ |
|
38 | + public function getTitle() { |
|
39 | + return I18N::translate('Sourced events'); |
|
40 | + } |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * {@inheritDoc} |
44 | 44 | * @see \Fisharebest\Webtrees\Module\AbstractModule::getDescription() |
45 | 45 | */ |
46 | - public function getDescription() { |
|
47 | - return I18N::translate('Indicate if events related to an record are sourced.'); |
|
48 | - } |
|
46 | + public function getDescription() { |
|
47 | + return I18N::translate('Indicate if events related to an record are sourced.'); |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * {@inheritDoc} |
|
52 | - * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks() |
|
53 | - */ |
|
50 | + /** |
|
51 | + * {@inheritDoc} |
|
52 | + * @see \MyArtJaub\Webtrees\Hook\HookSubscriberInterface::getSubscribedHooks() |
|
53 | + */ |
|
54 | 54 | public function getSubscribedHooks() { |
55 | 55 | return array( |
56 | 56 | 'hExtendIndiHeaderIcons' => 10, |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\IndividualHeaderExtenderInterface::hExtendIndiHeaderIcons() |
64 | 64 | */ |
65 | 65 | public function hExtendIndiHeaderIcons(IndividualController $ctrlIndi) { |
66 | - if($ctrlIndi){ |
|
67 | - $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
|
68 | - if ($dindi->canDisplayIsSourced()) |
|
69 | - return FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'large'); |
|
70 | - } |
|
71 | - return ''; |
|
66 | + if($ctrlIndi){ |
|
67 | + $dindi = new Individual($ctrlIndi->getSignificantIndividual()); |
|
68 | + if ($dindi->canDisplayIsSourced()) |
|
69 | + return FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'large'); |
|
70 | + } |
|
71 | + return ''; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | /** |
@@ -94,15 +94,15 @@ discard block |
||
94 | 94 | * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\RecordNameTextExtenderInterface::hRecordNameAppend() |
95 | 95 | */ |
96 | 96 | public function hRecordNameAppend(GedcomRecord $grec){ |
97 | - $html = ''; |
|
98 | - if($grec instanceof \Fisharebest\Webtrees\Individual){ |
|
99 | - $dindi = new Individual($grec); |
|
100 | - $html .= FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'small'); |
|
101 | - $html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isBirthSourced(), 'BIRT', 1, 'small'); |
|
102 | - if($grec->isDead()) |
|
103 | - $html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isDeathSourced(), 'DEAT', 1, 'small'); |
|
104 | - } |
|
105 | - return $html; |
|
97 | + $html = ''; |
|
98 | + if($grec instanceof \Fisharebest\Webtrees\Individual){ |
|
99 | + $dindi = new Individual($grec); |
|
100 | + $html .= FunctionsPrint::formatIsSourcedIcon('R', $dindi->isSourced(), 'INDI', 1, 'small'); |
|
101 | + $html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isBirthSourced(), 'BIRT', 1, 'small'); |
|
102 | + if($grec->isDead()) |
|
103 | + $html .= FunctionsPrint::formatIsSourcedIcon('E', $dindi->isDeathSourced(), 'DEAT', 1, 'small'); |
|
104 | + } |
|
105 | + return $html; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::defaultSidebarOrder() |
111 | 111 | */ |
112 | 112 | public function defaultSidebarOrder() { |
113 | - return 15; |
|
113 | + return 15; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::hasSidebarContent() |
119 | 119 | */ |
120 | 120 | public function hasSidebarContent(){ |
121 | - return true; |
|
121 | + return true; |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::getSidebarAjaxContent() |
127 | 127 | */ |
128 | 128 | public function getSidebarAjaxContent() { |
129 | - return ''; |
|
129 | + return ''; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -134,17 +134,17 @@ discard block |
||
134 | 134 | * @see \Fisharebest\Webtrees\Module\ModuleSidebarInterface::getSidebarContent() |
135 | 135 | */ |
136 | 136 | public function getSidebarContent() { |
137 | - global $controller; |
|
137 | + global $controller; |
|
138 | 138 | |
139 | - ob_start(); |
|
140 | - $root = $controller->getSignificantIndividual(); |
|
141 | - if ($root) { |
|
142 | - $dindi = new Individual($root); |
|
139 | + ob_start(); |
|
140 | + $root = $controller->getSignificantIndividual(); |
|
141 | + if ($root) { |
|
142 | + $dindi = new Individual($root); |
|
143 | 143 | |
144 | - if (!$dindi->canDisplayIsSourced()) { |
|
145 | - echo '<div class="error">', I18N::translate('This information is private and cannot be shown.'), '</div>'; |
|
146 | - } else { |
|
147 | - echo ' |
|
144 | + if (!$dindi->canDisplayIsSourced()) { |
|
145 | + echo '<div class="error">', I18N::translate('This information is private and cannot be shown.'), '</div>'; |
|
146 | + } else { |
|
147 | + echo ' |
|
148 | 148 | <table class="issourcedtable"> |
149 | 149 | <tr> |
150 | 150 | <td class="slabel"> ' . GedcomTag::getLabel('INDI') . '</td> |
@@ -155,35 +155,35 @@ discard block |
||
155 | 155 | <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dindi->isBirthSourced(), 'BIRT', 1).'</td> |
156 | 156 | </tr>'; |
157 | 157 | |
158 | - $fams = $root->getSpouseFamilies(); |
|
159 | - ($ct = count($fams)) > 1 ? $nb=1 : $nb=' '; |
|
160 | - foreach($fams as $fam){ |
|
161 | - $dfam = new Family($fam); |
|
162 | - echo ' |
|
158 | + $fams = $root->getSpouseFamilies(); |
|
159 | + ($ct = count($fams)) > 1 ? $nb=1 : $nb=' '; |
|
160 | + foreach($fams as $fam){ |
|
161 | + $dfam = new Family($fam); |
|
162 | + echo ' |
|
163 | 163 | <tr> |
164 | 164 | <td class="slabel right"> |
165 | 165 | <a href="' . $fam->getHtmlUrl() . '"> '. GedcomTag::getLabel('MARR'); |
166 | - if($ct > 1){ |
|
167 | - echo ' ',$nb; |
|
168 | - $nb++; |
|
169 | - } |
|
170 | - echo ' </a> |
|
166 | + if($ct > 1){ |
|
167 | + echo ' ',$nb; |
|
168 | + $nb++; |
|
169 | + } |
|
170 | + echo ' </a> |
|
171 | 171 | </td> |
172 | 172 | <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dfam->isMarriageSourced(), 'MARR', 1).'</td> |
173 | 173 | </tr>'; |
174 | - } |
|
174 | + } |
|
175 | 175 | |
176 | - if( $root->isDead() ) |
|
177 | - echo ' |
|
176 | + if( $root->isDead() ) |
|
177 | + echo ' |
|
178 | 178 | <tr> |
179 | 179 | <td class="slabel">' . GedcomTag::getLabel('DEAT') . '</td> |
180 | 180 | <td class="svalue">' . FunctionsPrint::formatIsSourcedIcon('E', $dindi->isDeathSourced(), 'DEAT', 1).'</td> |
181 | 181 | </tr>'; |
182 | 182 | |
183 | - echo '</table>'; |
|
184 | - } |
|
185 | - } |
|
186 | - return ob_get_clean(); |
|
183 | + echo '</table>'; |
|
184 | + } |
|
185 | + } |
|
186 | + return ob_get_clean(); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 |
@@ -15,11 +15,11 @@ |
||
15 | 15 | */ |
16 | 16 | interface ModuleMenuItemInterface |
17 | 17 | { |
18 | - /** |
|
19 | - * Returns a menu item for the module. |
|
20 | - * |
|
21 | - * @param \Fisharebest\Webtrees\Tree|null $tree |
|
22 | - * @param mixed $reference |
|
23 | - */ |
|
24 | - public function getMenu(\Fisharebest\Webtrees\Tree $tree, $reference); |
|
18 | + /** |
|
19 | + * Returns a menu item for the module. |
|
20 | + * |
|
21 | + * @param \Fisharebest\Webtrees\Tree|null $tree |
|
22 | + * @param mixed $reference |
|
23 | + */ |
|
24 | + public function getMenu(\Fisharebest\Webtrees\Tree $tree, $reference); |
|
25 | 25 | } |
26 | 26 | \ No newline at end of file |
@@ -35,25 +35,25 @@ discard block |
||
35 | 35 | */ |
36 | 36 | class TaskController extends MvcController |
37 | 37 | { |
38 | - /** |
|
39 | - * Tasks Provider |
|
40 | - * @var TaskProviderInterface $provider |
|
41 | - */ |
|
42 | - protected $provider; |
|
38 | + /** |
|
39 | + * Tasks Provider |
|
40 | + * @var TaskProviderInterface $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 | 58 | /** |
59 | 59 | * Task@trigger |
@@ -77,35 +77,35 @@ discard block |
||
77 | 77 | /** |
78 | 78 | * Task@setStatus |
79 | 79 | */ |
80 | - public function setStatus() { |
|
81 | - $controller = new JsonController(); |
|
80 | + public function setStatus() { |
|
81 | + $controller = new JsonController(); |
|
82 | 82 | |
83 | - $task_name = Filter::get('task'); |
|
84 | - $task = $this->provider->getTask($task_name, false); |
|
83 | + $task_name = Filter::get('task'); |
|
84 | + $task = $this->provider->getTask($task_name, false); |
|
85 | 85 | |
86 | - $controller->restrictAccess( |
|
87 | - true // Filter::checkCsrf() -- Cannot use CSRF on a GET request (modules can only work with GET requests) |
|
88 | - && Auth::isAdmin() |
|
89 | - && $task |
|
90 | - ); |
|
86 | + $controller->restrictAccess( |
|
87 | + true // Filter::checkCsrf() -- Cannot use CSRF on a GET request (modules can only work with GET requests) |
|
88 | + && Auth::isAdmin() |
|
89 | + && $task |
|
90 | + ); |
|
91 | 91 | |
92 | - $status = Filter::getBool('status'); |
|
93 | - $res = array('task' => $task->getName() , 'error' => null); |
|
94 | - try{ |
|
95 | - $this->provider->setTaskStatus($task, $status); |
|
96 | - $res['status'] = $status; |
|
92 | + $status = Filter::getBool('status'); |
|
93 | + $res = array('task' => $task->getName() , 'error' => null); |
|
94 | + try{ |
|
95 | + $this->provider->setTaskStatus($task, $status); |
|
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) { |
|
100 | - $res['error'] = $ex->getMessage(); |
|
98 | + } |
|
99 | + catch (\Exception $ex) { |
|
100 | + $res['error'] = $ex->getMessage(); |
|
101 | 101 | Log::addErrorLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage()); |
102 | - } |
|
102 | + } |
|
103 | 103 | |
104 | - $controller->pageHeader(); |
|
105 | - if($res['error']) http_response_code(500); |
|
104 | + $controller->pageHeader(); |
|
105 | + if($res['error']) http_response_code(500); |
|
106 | 106 | |
107 | - echo \Zend_Json::encode($res); |
|
108 | - } |
|
107 | + echo \Zend_Json::encode($res); |
|
108 | + } |
|
109 | 109 | |
110 | 110 | /** |
111 | 111 | * Task@edit |
@@ -113,15 +113,15 @@ discard block |
||
113 | 113 | public function edit() { |
114 | 114 | global $WT_TREE; |
115 | 115 | |
116 | - $task_name = Filter::get('task'); |
|
117 | - $task = $this->provider->getTask($task_name, false); |
|
116 | + $task_name = Filter::get('task'); |
|
117 | + $task = $this->provider->getTask($task_name, false); |
|
118 | 118 | |
119 | - Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
120 | - $controller = new PageController(); |
|
121 | - $controller |
|
122 | - ->restrictAccess(Auth::isAdmin() && $task) |
|
119 | + Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
120 | + $controller = new PageController(); |
|
121 | + $controller |
|
122 | + ->restrictAccess(Auth::isAdmin() && $task) |
|
123 | 123 | ->setPageTitle(I18N::translate('Edit the administrative task')) |
124 | - ->addInlineJavascript(' |
|
124 | + ->addInlineJavascript(' |
|
125 | 125 | function toggleRemainingOccurrences() { |
126 | 126 | if($("input:radio[name=\'is_limited\']:checked").val() == 1) { |
127 | 127 | $("#nb_occurences").show(); |
@@ -134,39 +134,39 @@ discard block |
||
134 | 134 | $("[name=\'is_limited\']").on("change", toggleRemainingOccurrences); |
135 | 135 | toggleRemainingOccurrences(); |
136 | 136 | ') |
137 | - ; |
|
137 | + ; |
|
138 | 138 | |
139 | 139 | |
140 | - $data = new ViewBag(); |
|
141 | - $data->set('title', $controller->getPageTitle()); |
|
140 | + $data = new ViewBag(); |
|
141 | + $data->set('title', $controller->getPageTitle()); |
|
142 | 142 | $data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl()); |
143 | - $data->set('module_title', $this->module->getTitle()); |
|
143 | + $data->set('module_title', $this->module->getTitle()); |
|
144 | 144 | $data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=Task@save&ged=' . $WT_TREE->getNameUrl()); |
145 | 145 | $data->set('task', $task); |
146 | 146 | |
147 | - ViewFactory::make('TaskEdit', $this, $controller, $data)->render(); |
|
147 | + ViewFactory::make('TaskEdit', $this, $controller, $data)->render(); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
151 | 151 | * Task@save |
152 | 152 | */ |
153 | 153 | public function save() { |
154 | - $tmp_contrl = new PageController(); |
|
154 | + $tmp_contrl = new PageController(); |
|
155 | 155 | |
156 | - $tmp_contrl->restrictAccess( |
|
157 | - Auth::isAdmin() |
|
158 | - && Filter::checkCsrf() |
|
159 | - ); |
|
156 | + $tmp_contrl->restrictAccess( |
|
157 | + Auth::isAdmin() |
|
158 | + && Filter::checkCsrf() |
|
159 | + ); |
|
160 | 160 | |
161 | 161 | $task_name = Filter::post('task'); |
162 | - $frequency = Filter::postInteger('frequency'); |
|
163 | - $is_limited = Filter::postInteger('is_limited', 0, 1); |
|
164 | - $nb_occur = Filter::postInteger('nb_occur'); |
|
162 | + $frequency = Filter::postInteger('frequency'); |
|
163 | + $is_limited = Filter::postInteger('is_limited', 0, 1); |
|
164 | + $nb_occur = Filter::postInteger('nb_occur'); |
|
165 | 165 | |
166 | 166 | $task = $this->provider->getTask($task_name, false); |
167 | 167 | |
168 | - $success = false; |
|
169 | - if($task) { |
|
168 | + $success = false; |
|
169 | + if($task) { |
|
170 | 170 | $task->setFrequency($frequency); |
171 | 171 | if($is_limited == 1) { |
172 | 172 | $task->setRemainingOccurrences($nb_occur); |
@@ -198,13 +198,13 @@ discard block |
||
198 | 198 | Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'. $task->getName() .'” could not be updated. See error log.'); |
199 | 199 | } |
200 | 200 | |
201 | - } |
|
201 | + } |
|
202 | 202 | |
203 | - $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig'; |
|
204 | - if(!$success) { |
|
203 | + $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig'; |
|
204 | + if(!$success) { |
|
205 | 205 | $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=Task@edit&task='. $task->getName(); |
206 | - } |
|
207 | - header('Location: ' . WT_BASE_URL . $redirection_url); |
|
206 | + } |
|
207 | + header('Location: ' . WT_BASE_URL . $redirection_url); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | } |
211 | 211 | \ No newline at end of file |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | $tasks = $this->provider->getTasksToRun($token == $token_submitted, $task_name); |
71 | 71 | |
72 | - foreach($tasks as $task) { |
|
72 | + foreach ($tasks as $task) { |
|
73 | 73 | $task->execute(); |
74 | 74 | } |
75 | 75 | } |
@@ -90,19 +90,19 @@ discard block |
||
90 | 90 | ); |
91 | 91 | |
92 | 92 | $status = Filter::getBool('status'); |
93 | - $res = array('task' => $task->getName() , 'error' => null); |
|
94 | - try{ |
|
93 | + $res = array('task' => $task->getName(), 'error' => null); |
|
94 | + try { |
|
95 | 95 | $this->provider->setTaskStatus($task, $status); |
96 | 96 | $res['status'] = $status; |
97 | - Log::addConfigurationLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" has been '. ($status ? 'enabled' : 'disabled') .'.'); |
|
97 | + Log::addConfigurationLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" has been '.($status ? 'enabled' : 'disabled').'.'); |
|
98 | 98 | } |
99 | 99 | catch (\Exception $ex) { |
100 | 100 | $res['error'] = $ex->getMessage(); |
101 | - Log::addErrorLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" could not be ' . ($status ? 'enabled' : 'disabled') .'. Error: '. $ex->getMessage()); |
|
101 | + Log::addErrorLog('Module '.$this->module->getName().' : Admin Task "'.$task->getName().'" could not be '.($status ? 'enabled' : 'disabled').'. Error: '.$ex->getMessage()); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | $controller->pageHeader(); |
105 | - if($res['error']) http_response_code(500); |
|
105 | + if ($res['error']) http_response_code(500); |
|
106 | 106 | |
107 | 107 | echo \Zend_Json::encode($res); |
108 | 108 | } |
@@ -139,9 +139,9 @@ discard block |
||
139 | 139 | |
140 | 140 | $data = new ViewBag(); |
141 | 141 | $data->set('title', $controller->getPageTitle()); |
142 | - $data->set('admin_config_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig&ged=' . $WT_TREE->getNameUrl()); |
|
142 | + $data->set('admin_config_url', 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig&ged='.$WT_TREE->getNameUrl()); |
|
143 | 143 | $data->set('module_title', $this->module->getTitle()); |
144 | - $data->set('save_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=Task@save&ged=' . $WT_TREE->getNameUrl()); |
|
144 | + $data->set('save_url', 'module.php?mod='.$this->module->getName().'&mod_action=Task@save&ged='.$WT_TREE->getNameUrl()); |
|
145 | 145 | $data->set('task', $task); |
146 | 146 | |
147 | 147 | ViewFactory::make('TaskEdit', $this, $controller, $data)->render(); |
@@ -158,17 +158,17 @@ discard block |
||
158 | 158 | && Filter::checkCsrf() |
159 | 159 | ); |
160 | 160 | |
161 | - $task_name = Filter::post('task'); |
|
162 | - $frequency = Filter::postInteger('frequency'); |
|
163 | - $is_limited = Filter::postInteger('is_limited', 0, 1); |
|
164 | - $nb_occur = Filter::postInteger('nb_occur'); |
|
161 | + $task_name = Filter::post('task'); |
|
162 | + $frequency = Filter::postInteger('frequency'); |
|
163 | + $is_limited = Filter::postInteger('is_limited', 0, 1); |
|
164 | + $nb_occur = Filter::postInteger('nb_occur'); |
|
165 | 165 | |
166 | 166 | $task = $this->provider->getTask($task_name, false); |
167 | 167 | |
168 | 168 | $success = false; |
169 | - if($task) { |
|
169 | + if ($task) { |
|
170 | 170 | $task->setFrequency($frequency); |
171 | - if($is_limited == 1) { |
|
171 | + if ($is_limited == 1) { |
|
172 | 172 | $task->setRemainingOccurrences($nb_occur); |
173 | 173 | } |
174 | 174 | else { |
@@ -177,34 +177,34 @@ discard block |
||
177 | 177 | |
178 | 178 | $res = $task->save(); |
179 | 179 | |
180 | - if($res) { |
|
181 | - if($task instanceof MyArtJaub\Webtrees\Module\AdminTasks\Model\ConfigurableTaskInterface) { |
|
180 | + if ($res) { |
|
181 | + if ($task instanceof MyArtJaub\Webtrees\Module\AdminTasks\Model\ConfigurableTaskInterface) { |
|
182 | 182 | $res = $task->saveConfig(); |
183 | 183 | |
184 | - if(!$res) { |
|
184 | + if (!$res) { |
|
185 | 185 | FlashMessages::addMessage(I18N::translate('An error occured while updating the specific settings of administrative task “%s”', $task->getTitle()), 'danger'); |
186 | - Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'. $task->getName() .'” specific settings could not be updated. See error log.'); |
|
186 | + Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'.$task->getName().'” specific settings could not be updated. See error log.'); |
|
187 | 187 | } |
188 | 188 | } |
189 | 189 | |
190 | - if($res) { |
|
190 | + if ($res) { |
|
191 | 191 | FlashMessages::addMessage(I18N::translate('The administrative task “%s” has been successfully updated', $task->getTitle()), 'success'); |
192 | - Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'.$task->getName() .'” has been updated.'); |
|
192 | + Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'.$task->getName().'” has been updated.'); |
|
193 | 193 | $success = true; |
194 | 194 | } |
195 | 195 | } |
196 | 196 | else { |
197 | 197 | FlashMessages::addMessage(I18N::translate('An error occured while updating the administrative task “%s”', $task->getTitle()), 'danger'); |
198 | - Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'. $task->getName() .'” could not be updated. See error log.'); |
|
198 | + Log::addConfigurationLog('Module '.$this->module->getName().' : AdminTask “'.$task->getName().'” could not be updated. See error log.'); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | } |
202 | 202 | |
203 | - $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig'; |
|
204 | - if(!$success) { |
|
205 | - $redirection_url = 'module.php?mod=' . $this->module->getName() . '&mod_action=Task@edit&task='. $task->getName(); |
|
203 | + $redirection_url = 'module.php?mod='.$this->module->getName().'&mod_action=AdminConfig'; |
|
204 | + if (!$success) { |
|
205 | + $redirection_url = 'module.php?mod='.$this->module->getName().'&mod_action=Task@edit&task='.$task->getName(); |
|
206 | 206 | } |
207 | - header('Location: ' . WT_BASE_URL . $redirection_url); |
|
207 | + header('Location: '.WT_BASE_URL.$redirection_url); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | } |
211 | 211 | \ No newline at end of file |
@@ -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 | } |
@@ -15,11 +15,11 @@ |
||
15 | 15 | */ |
16 | 16 | interface ConfigurableTaskInterface { |
17 | 17 | |
18 | - /** |
|
19 | - * Returns the HTML code to display the specific task configuration. |
|
20 | - * |
|
21 | - * @return string HTML code |
|
22 | - */ |
|
18 | + /** |
|
19 | + * Returns the HTML code to display the specific task configuration. |
|
20 | + * |
|
21 | + * @return string HTML code |
|
22 | + */ |
|
23 | 23 | function htmlConfigForm(); |
24 | 24 | |
25 | 25 | /** |