@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | class Individual extends GedcomRecord { |
23 | 23 | |
24 | 24 | /** @var array|null List of titles the individal holds */ |
25 | - protected $_titles=null; |
|
25 | + protected $_titles = null; |
|
26 | 26 | |
27 | 27 | /** @var string|null Individual's primary surname, without any privacy applied to it */ |
28 | 28 | protected $_unprotectedPrimarySurname = null; |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | * @param null|string $gedcom |
45 | 45 | * @return null|Individual |
46 | 46 | */ |
47 | - public static function getIntance($xref, Tree $tree, $gedcom = null){ |
|
47 | + public static function getIntance($xref, Tree $tree, $gedcom = null) { |
|
48 | 48 | $indi = \Fisharebest\Webtrees\Individual::getInstance($xref, $tree, $gedcom); |
49 | - if($indi){ |
|
49 | + if ($indi) { |
|
50 | 50 | return new Individual($indi); |
51 | 51 | } |
52 | 52 | return null; |
@@ -57,18 +57,18 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @return array Array of titles |
59 | 59 | */ |
60 | - public function getTitles(){ |
|
61 | - if(is_null($this->_titles) && $module = Module::getModuleByName(Constants::MODULE_MAJ_MISC_NAME)){ |
|
60 | + public function getTitles() { |
|
61 | + if (is_null($this->_titles) && $module = Module::getModuleByName(Constants::MODULE_MAJ_MISC_NAME)) { |
|
62 | 62 | $pattern = '/(.*) (('.$module->getSetting('MAJ_TITLE_PREFIX', '').')(.*))/'; |
63 | - $this->_titles=array(); |
|
63 | + $this->_titles = array(); |
|
64 | 64 | $titlefacts = $this->gedcomrecord->getFacts('TITL'); |
65 | - foreach($titlefacts as $titlefact){ |
|
65 | + foreach ($titlefacts as $titlefact) { |
|
66 | 66 | $ct2 = preg_match_all($pattern, $titlefact->getValue(), $match2); |
67 | - if($ct2>0){ |
|
68 | - $this->_titles[$match2[1][0]][]= trim($match2[2][0]); |
|
67 | + if ($ct2 > 0) { |
|
68 | + $this->_titles[$match2[1][0]][] = trim($match2[2][0]); |
|
69 | 69 | } |
70 | - else{ |
|
71 | - $this->_titles[$titlefact->getValue()][]=''; |
|
70 | + else { |
|
71 | + $this->_titles[$titlefact->getValue()][] = ''; |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | } |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | * @return string Primary surname |
83 | 83 | */ |
84 | 84 | public function getUnprotectedPrimarySurname() { |
85 | - if(!$this->_unprotectedPrimarySurname){ |
|
86 | - $tmp=$this->gedcomrecord->getAllNames(); |
|
85 | + if (!$this->_unprotectedPrimarySurname) { |
|
86 | + $tmp = $this->gedcomrecord->getAllNames(); |
|
87 | 87 | $this->_unprotectedPrimarySurname = $tmp[$this->gedcomrecord->getPrimaryName()]['surname']; |
88 | 88 | } |
89 | 89 | return $this->_unprotectedPrimarySurname; |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | * @param boolean $perc Should the coefficient of reliability be returned |
96 | 96 | * @return string|array Estimated birth place if found, null otherwise |
97 | 97 | */ |
98 | - public function getEstimatedBirthPlace($perc=false){ |
|
99 | - if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
100 | - if($perc){ |
|
101 | - return array ($bplace, 1); |
|
98 | + public function getEstimatedBirthPlace($perc = false) { |
|
99 | + if ($bplace = $this->gedcomrecord->getBirthPlace()) { |
|
100 | + if ($perc) { |
|
101 | + return array($bplace, 1); |
|
102 | 102 | } |
103 | - else{ |
|
103 | + else { |
|
104 | 104 | return $bplace; |
105 | 105 | } |
106 | 106 | } |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | * @param boolean $perc Should the coefficient of reliability be returned |
114 | 114 | * @return string|array Estimated birth place if found, null otherwise |
115 | 115 | */ |
116 | - public function getSignificantPlace(){ |
|
117 | - if($bplace = $this->gedcomrecord->getBirthPlace()){ |
|
116 | + public function getSignificantPlace() { |
|
117 | + if ($bplace = $this->gedcomrecord->getBirthPlace()) { |
|
118 | 118 | return $bplace; |
119 | 119 | } |
120 | 120 | |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | - if($dplace = $this->gedcomrecord->getDeathPlace()){ |
|
127 | + if ($dplace = $this->gedcomrecord->getDeathPlace()) { |
|
128 | 128 | return $dplace; |
129 | 129 | } |
130 | 130 | |
131 | - foreach($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
131 | + foreach ($this->gedcomrecord->getSpouseFamilies() as $fams) { |
|
132 | 132 | foreach ($fams->getAllEventPlaces('RESI') as $rplace) { |
133 | 133 | if ($rplace) { |
134 | 134 | return $rplace; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * |
145 | 145 | * @return boolean Is the individual a Sosa ancestor |
146 | 146 | */ |
147 | - public function isSosa(){ |
|
147 | + public function isSosa() { |
|
148 | 148 | return count($this->getSosaNumbers()) > 0; |
149 | 149 | } |
150 | 150 | |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | * @uses \MyArtJaub\Webtrees\Functions\ModuleManager |
156 | 156 | * @return array List of Sosa numbers |
157 | 157 | */ |
158 | - public function getSosaNumbers(){ |
|
159 | - if($this->_sosa === null) { |
|
158 | + public function getSosaNumbers() { |
|
159 | + if ($this->_sosa === null) { |
|
160 | 160 | $provider = new SosaProvider($this->gedcomrecord->getTree()); |
161 | 161 | $this->_sosa = $provider->getSosaNumbers($this->gedcomrecord); |
162 | 162 | } |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | * |
169 | 169 | * @return int Level of sources |
170 | 170 | * */ |
171 | - public function isBirthSourced(){ |
|
172 | - if($this->_isbirthsourced !== null) return $this->_isbirthsourced; |
|
171 | + public function isBirthSourced() { |
|
172 | + if ($this->_isbirthsourced !== null) return $this->_isbirthsourced; |
|
173 | 173 | $this->_isbirthsourced = $this->isFactSourced(WT_EVENTS_BIRT); |
174 | 174 | return $this->_isbirthsourced; |
175 | 175 | } |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | * |
180 | 180 | * @return int Level of sources |
181 | 181 | * */ |
182 | - public function isDeathSourced(){ |
|
183 | - if($this->_isdeathsourced !== null) return $this->_isdeathsourced; |
|
182 | + public function isDeathSourced() { |
|
183 | + if ($this->_isdeathsourced !== null) return $this->_isdeathsourced; |
|
184 | 184 | $this->_isdeathsourced = $this->isFactSourced(WT_EVENTS_DEAT); |
185 | 185 | return $this->_isdeathsourced; |
186 | 186 | } |
@@ -66,8 +66,7 @@ discard block |
||
66 | 66 | $ct2 = preg_match_all($pattern, $titlefact->getValue(), $match2); |
67 | 67 | if($ct2>0){ |
68 | 68 | $this->_titles[$match2[1][0]][]= trim($match2[2][0]); |
69 | - } |
|
70 | - else{ |
|
69 | + } else{ |
|
71 | 70 | $this->_titles[$titlefact->getValue()][]=''; |
72 | 71 | } |
73 | 72 | } |
@@ -99,8 +98,7 @@ discard block |
||
99 | 98 | if($bplace = $this->gedcomrecord->getBirthPlace()){ |
100 | 99 | if($perc){ |
101 | 100 | return array ($bplace, 1); |
102 | - } |
|
103 | - else{ |
|
101 | + } else{ |
|
104 | 102 | return $bplace; |
105 | 103 | } |
106 | 104 | } |
@@ -169,7 +167,9 @@ discard block |
||
169 | 167 | * @return int Level of sources |
170 | 168 | * */ |
171 | 169 | public function isBirthSourced(){ |
172 | - if($this->_isbirthsourced !== null) return $this->_isbirthsourced; |
|
170 | + if($this->_isbirthsourced !== null) { |
|
171 | + return $this->_isbirthsourced; |
|
172 | + } |
|
173 | 173 | $this->_isbirthsourced = $this->isFactSourced(WT_EVENTS_BIRT); |
174 | 174 | return $this->_isbirthsourced; |
175 | 175 | } |
@@ -180,7 +180,9 @@ discard block |
||
180 | 180 | * @return int Level of sources |
181 | 181 | * */ |
182 | 182 | public function isDeathSourced(){ |
183 | - if($this->_isdeathsourced !== null) return $this->_isdeathsourced; |
|
183 | + if($this->_isdeathsourced !== null) { |
|
184 | + return $this->_isdeathsourced; |
|
185 | + } |
|
184 | 186 | $this->_isdeathsourced = $this->isFactSourced(WT_EVENTS_DEAT); |
185 | 187 | return $this->_isdeathsourced; |
186 | 188 | } |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * Cache component to speed up some potential data retrievals |
16 | 16 | */ |
17 | -class Cache{ |
|
17 | +class Cache { |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Underlying Zend Cache object |
21 | 21 | * @var \Zend_Cache_Core|\Zend_Cache_FrontEnd $cache |
22 | 22 | */ |
23 | - protected $cache=null; |
|
23 | + protected $cache = null; |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Defines whether the cache has been initialised |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | protected function init() { |
56 | 56 | // The translation libraries only work with a cache. |
57 | - $cache_options=array('automatic_serialization'=>true); |
|
57 | + $cache_options = array('automatic_serialization'=>true); |
|
58 | 58 | |
59 | 59 | if (ini_get('apc.enabled')) { |
60 | 60 | $this->cache = \Zend_Cache::factory('Core', 'Apc', $cache_options, array()); |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | * Initiliase the Cache if not done. |
80 | 80 | * |
81 | 81 | */ |
82 | - protected function checkInit(){ |
|
83 | - if(!$this->is_init) $this->init(); |
|
82 | + protected function checkInit() { |
|
83 | + if (!$this->is_init) $this->init(); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | * @param AbstractModule $mod Calling module |
91 | 91 | * @return string Cached key name |
92 | 92 | */ |
93 | - protected function getKeyName($value, AbstractModule $mod = null){ |
|
93 | + protected function getKeyName($value, AbstractModule $mod = null) { |
|
94 | 94 | $this->checkInit(); |
95 | 95 | $mod_name = 'myartjaub'; |
96 | - if($mod !== null) $mod_name = $mod->getName(); |
|
96 | + if ($mod !== null) $mod_name = $mod->getName(); |
|
97 | 97 | return $mod_name.'_'.$value; |
98 | 98 | } |
99 | 99 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @param AbstractModule $mod Calling module |
128 | 128 | * @return unknown_type Cached value |
129 | 129 | */ |
130 | - public function getI($value, AbstractModule $mod = null){ |
|
130 | + public function getI($value, AbstractModule $mod = null) { |
|
131 | 131 | $this->checkInit(); |
132 | 132 | return $this->cache->load($this->getKeyName($value, $mod)); |
133 | 133 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * @param AbstractModule $mod Calling module |
140 | 140 | * @return unknown_type Cached value |
141 | 141 | */ |
142 | - public static function get($value, AbstractModule $mod = null){ |
|
142 | + public static function get($value, AbstractModule $mod = null) { |
|
143 | 143 | self::getInstance()->getI($value, $mod); |
144 | 144 | } |
145 | 145 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @param AbstractModule $mod Calling module |
152 | 152 | * @return unknown_type Cached value |
153 | 153 | */ |
154 | - public function saveI($value, $data, AbstractModule $mod = null){ |
|
154 | + public function saveI($value, $data, AbstractModule $mod = null) { |
|
155 | 155 | $this->checkInit(); |
156 | 156 | $this->cache->save($data, $this->getKeyName($value, $mod)); |
157 | 157 | return $this->get($value, $mod); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | * @param AbstractModule $mod Calling module |
166 | 166 | * @return unknown_type Cached value |
167 | 167 | */ |
168 | - public static function save($value, $data, AbstractModule $mod = null){ |
|
168 | + public static function save($value, $data, AbstractModule $mod = null) { |
|
169 | 169 | self::getInstance()->saveI($value, $data, $mod); |
170 | 170 | } |
171 | 171 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * Clean the cache |
174 | 174 | * |
175 | 175 | */ |
176 | - public function cleanI(){ |
|
176 | + public function cleanI() { |
|
177 | 177 | $this->checkInit(); |
178 | 178 | $this->cache->clean(); |
179 | 179 | } |
@@ -80,7 +80,9 @@ discard block |
||
80 | 80 | * |
81 | 81 | */ |
82 | 82 | protected function checkInit(){ |
83 | - if(!$this->is_init) $this->init(); |
|
83 | + if(!$this->is_init) { |
|
84 | + $this->init(); |
|
85 | + } |
|
84 | 86 | } |
85 | 87 | |
86 | 88 | /** |
@@ -93,7 +95,9 @@ discard block |
||
93 | 95 | protected function getKeyName($value, AbstractModule $mod = null){ |
94 | 96 | $this->checkInit(); |
95 | 97 | $mod_name = 'myartjaub'; |
96 | - if($mod !== null) $mod_name = $mod->getName(); |
|
98 | + if($mod !== null) { |
|
99 | + $mod_name = $mod->getName(); |
|
100 | + } |
|
97 | 101 | return $mod_name.'_'.$value; |
98 | 102 | } |
99 | 103 |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | * @param unknown_type $data Data to identify the individual |
30 | 30 | * @return \MyArtJaub\Webtrees\Family|null \MyArtJaub\Webtrees\Family instance |
31 | 31 | */ |
32 | - public static function getIntance($data){ |
|
32 | + public static function getIntance($data) { |
|
33 | 33 | $dfam = null; |
34 | 34 | $fam = fw\Family::getInstance($data); |
35 | - if($fam){ |
|
35 | + if ($fam) { |
|
36 | 36 | $dfam = new Family($fam); |
37 | 37 | } |
38 | 38 | return $dfam; |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @return int Level of sources |
45 | 45 | * */ |
46 | - function isMarriageSourced(){ |
|
47 | - if($this->_ismarriagesourced !== null) return $this->_ismarriagesourced; |
|
46 | + function isMarriageSourced() { |
|
47 | + if ($this->_ismarriagesourced !== null) return $this->_ismarriagesourced; |
|
48 | 48 | $this->_ismarriagesourced = $this->isFactSourced(WT_EVENTS_MARR.'|MARC'); |
49 | 49 | return $this->_ismarriagesourced; |
50 | 50 | } |
@@ -44,7 +44,9 @@ |
||
44 | 44 | * @return int Level of sources |
45 | 45 | * */ |
46 | 46 | function isMarriageSourced(){ |
47 | - if($this->_ismarriagesourced !== null) return $this->_ismarriagesourced; |
|
47 | + if($this->_ismarriagesourced !== null) { |
|
48 | + return $this->_ismarriagesourced; |
|
49 | + } |
|
48 | 50 | $this->_ismarriagesourced = $this->isFactSourced(WT_EVENTS_MARR.'|MARC'); |
49 | 51 | return $this->_ismarriagesourced; |
50 | 52 | } |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | protected $gedcomrecord; |
24 | 24 | |
25 | 25 | /** @var bool Is the GedcomRecord sourced (cache) */ |
26 | - protected $_issourced=null; |
|
26 | + protected $_issourced = null; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Contructor for the decorator |
30 | 30 | * |
31 | 31 | * @param \Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in The GedcomRecord to extend |
32 | 32 | */ |
33 | - public function __construct(\Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in){ |
|
33 | + public function __construct(\Fisharebest\Webtrees\GedcomRecord $gedcomrecord_in) { |
|
34 | 34 | $this->gedcomrecord = $gedcomrecord_in; |
35 | 35 | } |
36 | 36 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @return \Fisharebest\Webtrees\GedcomRecord Embedded gedcom record |
41 | 41 | */ |
42 | - public function getDerivedRecord(){ |
|
42 | + public function getDerivedRecord() { |
|
43 | 43 | return $this->gedcomrecord; |
44 | 44 | } |
45 | 45 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | if (($fact->getDate() || $fact->getPlace()) && $fact->canShow()) { |
86 | 86 | switch ($style) { |
87 | 87 | case 10: |
88 | - return '<i>'.$fact->getLabel().' '. mw\Functions\FunctionsPrint::formatFactDateShort($fact) .' '. mw\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1') .'</i>'; |
|
88 | + return '<i>'.$fact->getLabel().' '.mw\Functions\FunctionsPrint::formatFactDateShort($fact).' '.mw\Functions\FunctionsPrint::formatFactPlaceShort($fact, '%1').'</i>'; |
|
89 | 89 | break; |
90 | 90 | default: |
91 | 91 | return $this->gedcomrecord->formatFirstMajorFact($facts, $style); |
@@ -101,11 +101,11 @@ discard block |
||
101 | 101 | * @param int $access_level |
102 | 102 | * @return boolean |
103 | 103 | */ |
104 | - public function canDisplayIsSourced($access_level = null){ |
|
104 | + public function canDisplayIsSourced($access_level = null) { |
|
105 | 105 | global $global_facts; |
106 | 106 | |
107 | - if(!$this->gedcomrecord->canShow($access_level)) return false; |
|
108 | - if($access_level === null ) |
|
107 | + if (!$this->gedcomrecord->canShow($access_level)) return false; |
|
108 | + if ($access_level === null) |
|
109 | 109 | $access_level = \Fisharebest\Webtrees\Auth::accessLevel($this->gedcomrecord->getTree()); |
110 | 110 | |
111 | 111 | if (isset($global_facts['SOUR'])) { |
@@ -124,14 +124,14 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return int Level of sources |
126 | 126 | */ |
127 | - public function isSourced(){ |
|
128 | - if($this->_issourced !== null) return $this->_issourced; |
|
129 | - $this->_issourced=-1; |
|
127 | + public function isSourced() { |
|
128 | + if ($this->_issourced !== null) return $this->_issourced; |
|
129 | + $this->_issourced = -1; |
|
130 | 130 | $sourcesfacts = $this->gedcomrecord->getFacts('SOUR'); |
131 | - foreach($sourcesfacts as $sourcefact){ |
|
132 | - $this->_issourced=max($this->_issourced, 1); |
|
133 | - if($sourcefact->getAttribute('_ACT')){ |
|
134 | - $this->_issourced=max($this->_issourced, 2); |
|
131 | + foreach ($sourcesfacts as $sourcefact) { |
|
132 | + $this->_issourced = max($this->_issourced, 1); |
|
133 | + if ($sourcefact->getAttribute('_ACT')) { |
|
134 | + $this->_issourced = max($this->_issourced, 2); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | return $this->_issourced; |
@@ -143,19 +143,19 @@ discard block |
||
143 | 143 | * @param string $eventslist |
144 | 144 | * @return int Level of sources |
145 | 145 | */ |
146 | - public function isFactSourced($eventslist){ |
|
147 | - if(empty($eventslist)) return 0; |
|
148 | - $isSourced=0; |
|
146 | + public function isFactSourced($eventslist) { |
|
147 | + if (empty($eventslist)) return 0; |
|
148 | + $isSourced = 0; |
|
149 | 149 | $facts = $this->gedcomrecord->getFacts($eventslist); |
150 | - foreach($facts as $fact){ |
|
151 | - if($isSourced < Fact::MAX_IS_SOURCED_LEVEL){ |
|
150 | + foreach ($facts as $fact) { |
|
151 | + if ($isSourced < Fact::MAX_IS_SOURCED_LEVEL) { |
|
152 | 152 | $dfact = new Fact($fact); |
153 | 153 | $tmpIsSourced = $dfact->isSourced(); |
154 | - if($tmpIsSourced != 0) { |
|
155 | - if($isSourced==0) { |
|
156 | - $isSourced = $tmpIsSourced; |
|
154 | + if ($tmpIsSourced != 0) { |
|
155 | + if ($isSourced == 0) { |
|
156 | + $isSourced = $tmpIsSourced; |
|
157 | 157 | } |
158 | - else{ |
|
158 | + else { |
|
159 | 159 | $isSourced = max($isSourced, $tmpIsSourced); |
160 | 160 | } |
161 | 161 | } |
@@ -104,9 +104,12 @@ discard block |
||
104 | 104 | public function canDisplayIsSourced($access_level = null){ |
105 | 105 | global $global_facts; |
106 | 106 | |
107 | - if(!$this->gedcomrecord->canShow($access_level)) return false; |
|
108 | - if($access_level === null ) |
|
109 | - $access_level = \Fisharebest\Webtrees\Auth::accessLevel($this->gedcomrecord->getTree()); |
|
107 | + if(!$this->gedcomrecord->canShow($access_level)) { |
|
108 | + return false; |
|
109 | + } |
|
110 | + if($access_level === null ) { |
|
111 | + $access_level = \Fisharebest\Webtrees\Auth::accessLevel($this->gedcomrecord->getTree()); |
|
112 | + } |
|
110 | 113 | |
111 | 114 | if (isset($global_facts['SOUR'])) { |
112 | 115 | return $global_facts['SOUR'] >= $access_level; |
@@ -125,7 +128,9 @@ discard block |
||
125 | 128 | * @return int Level of sources |
126 | 129 | */ |
127 | 130 | public function isSourced(){ |
128 | - if($this->_issourced !== null) return $this->_issourced; |
|
131 | + if($this->_issourced !== null) { |
|
132 | + return $this->_issourced; |
|
133 | + } |
|
129 | 134 | $this->_issourced=-1; |
130 | 135 | $sourcesfacts = $this->gedcomrecord->getFacts('SOUR'); |
131 | 136 | foreach($sourcesfacts as $sourcefact){ |
@@ -144,7 +149,9 @@ discard block |
||
144 | 149 | * @return int Level of sources |
145 | 150 | */ |
146 | 151 | public function isFactSourced($eventslist){ |
147 | - if(empty($eventslist)) return 0; |
|
152 | + if(empty($eventslist)) { |
|
153 | + return 0; |
|
154 | + } |
|
148 | 155 | $isSourced=0; |
149 | 156 | $facts = $this->gedcomrecord->getFacts($eventslist); |
150 | 157 | foreach($facts as $fact){ |
@@ -154,8 +161,7 @@ discard block |
||
154 | 161 | if($tmpIsSourced != 0) { |
155 | 162 | if($isSourced==0) { |
156 | 163 | $isSourced = $tmpIsSourced; |
157 | - } |
|
158 | - else{ |
|
164 | + } else{ |
|
159 | 165 | $isSourced = max($isSourced, $tmpIsSourced); |
160 | 166 | } |
161 | 167 | } |
@@ -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 |
@@ -24,82 +24,82 @@ |
||
24 | 24 | class GeoDispersionModule extends AbstractModule implements ModuleConfigInterface, DependentInterface { |
25 | 25 | |
26 | 26 | // How to update the database schema for this module |
27 | - const SCHEMA_TARGET_VERSION = 1; |
|
28 | - const SCHEMA_SETTING_NAME = 'MAJ_GEODISP_SCHEMA_VERSION'; |
|
29 | - const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\GeoDispersion\Schema'; |
|
27 | + const SCHEMA_TARGET_VERSION = 1; |
|
28 | + const SCHEMA_SETTING_NAME = 'MAJ_GEODISP_SCHEMA_VERSION'; |
|
29 | + const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\GeoDispersion\Schema'; |
|
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 | - * GeoDispersion analysis provider |
|
36 | - * @var \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysisProvider $provider |
|
37 | - */ |
|
38 | - protected $provider; |
|
34 | + /** |
|
35 | + * GeoDispersion analysis provider |
|
36 | + * @var \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysisProvider $provider |
|
37 | + */ |
|
38 | + protected $provider; |
|
39 | 39 | |
40 | - /** |
|
41 | - * {@inhericDoc} |
|
42 | - */ |
|
43 | - public function getTitle() { |
|
44 | - return /* I18N: Name of the “Hooks” module */ I18N::translate('Geographical Dispersion'); |
|
45 | - } |
|
40 | + /** |
|
41 | + * {@inhericDoc} |
|
42 | + */ |
|
43 | + public function getTitle() { |
|
44 | + return /* I18N: Name of the “Hooks” module */ I18N::translate('Geographical Dispersion'); |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * {@inhericDoc} |
|
49 | - */ |
|
50 | - public function getDescription() { |
|
51 | - return /* I18N: Description of the “Hooks” module */ I18N::translate('Display the geographical dispersion of the root person’s Sosa ancestors.'); |
|
52 | - } |
|
47 | + /** |
|
48 | + * {@inhericDoc} |
|
49 | + */ |
|
50 | + public function getDescription() { |
|
51 | + return /* I18N: Description of the “Hooks” module */ I18N::translate('Display the geographical dispersion of the root person’s Sosa ancestors.'); |
|
52 | + } |
|
53 | 53 | |
54 | - /** |
|
55 | - * {@inhericDoc} |
|
56 | - */ |
|
57 | - public function modAction($mod_action) { |
|
58 | - Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
54 | + /** |
|
55 | + * {@inhericDoc} |
|
56 | + */ |
|
57 | + public function modAction($mod_action) { |
|
58 | + Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
59 | 59 | |
60 | - \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
61 | - } |
|
60 | + \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * {@inhericDoc} |
|
65 | - * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
66 | - */ |
|
67 | - public function getConfigLink() { |
|
68 | - Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
63 | + /** |
|
64 | + * {@inhericDoc} |
|
65 | + * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
66 | + */ |
|
67 | + public function getConfigLink() { |
|
68 | + Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
69 | 69 | |
70 | - return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
71 | - } |
|
70 | + return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * {@inhericDoc} |
|
75 | - * @see \MyArtJaub\Webtrees\Module\DependentInterface::validatePrerequisites() |
|
76 | - */ |
|
77 | - public function validatePrerequisites() { |
|
78 | - return !is_null(Module::getModuleByName(Constants::MODULE_MAJ_SOSA_NAME)); |
|
79 | - } |
|
73 | + /** |
|
74 | + * {@inhericDoc} |
|
75 | + * @see \MyArtJaub\Webtrees\Module\DependentInterface::validatePrerequisites() |
|
76 | + */ |
|
77 | + public function validatePrerequisites() { |
|
78 | + return !is_null(Module::getModuleByName(Constants::MODULE_MAJ_SOSA_NAME)); |
|
79 | + } |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Get the GeoAnalysis Provider (initialise it if not done yet). |
83 | 83 | * |
84 | 84 | * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysisProvider |
85 | 85 | */ |
86 | - public function getProvider() { |
|
87 | - global $WT_TREE; |
|
86 | + public function getProvider() { |
|
87 | + global $WT_TREE; |
|
88 | 88 | |
89 | - if(!$this->provider) { |
|
90 | - $this->provider = new GeoAnalysisProvider($WT_TREE); |
|
91 | - } |
|
92 | - return $this->provider; |
|
93 | - } |
|
89 | + if(!$this->provider) { |
|
90 | + $this->provider = new GeoAnalysisProvider($WT_TREE); |
|
91 | + } |
|
92 | + return $this->provider; |
|
93 | + } |
|
94 | 94 | |
95 | 95 | /** |
96 | 96 | * Set the GeoAnalysis Provider. |
97 | 97 | * |
98 | 98 | * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\GeoAnalysisProvider |
99 | 99 | */ |
100 | - public function setProvider(GeoAnalysisProvider $provider) { |
|
101 | - $this->provider = $provider; |
|
102 | - } |
|
100 | + public function setProvider(GeoAnalysisProvider $provider) { |
|
101 | + $this->provider = $provider; |
|
102 | + } |
|
103 | 103 | |
104 | 104 | |
105 | 105 | } |
@@ -23,64 +23,64 @@ discard block |
||
23 | 23 | class AdminTasksModule extends AbstractModule |
24 | 24 | implements ModuleConfigInterface, ModuleBlockInterface |
25 | 25 | { |
26 | - // How to update the database schema for this module |
|
27 | - const SCHEMA_TARGET_VERSION = 1; |
|
28 | - const SCHEMA_SETTING_NAME = 'MAJ_ADMTASKS_SCHEMA_VERSION'; |
|
29 | - const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\AdminTasks\Schema'; |
|
26 | + // How to update the database schema for this module |
|
27 | + const SCHEMA_TARGET_VERSION = 1; |
|
28 | + const SCHEMA_SETTING_NAME = 'MAJ_ADMTASKS_SCHEMA_VERSION'; |
|
29 | + const SCHEMA_MIGRATION_PREFIX = '\MyArtJaub\Webtrees\Module\AdminTasks\Schema'; |
|
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 | - * Admin Task provider |
|
36 | - * @var \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface $provider |
|
37 | - */ |
|
38 | - protected $provider; |
|
34 | + /** |
|
35 | + * Admin Task provider |
|
36 | + * @var \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface $provider |
|
37 | + */ |
|
38 | + protected $provider; |
|
39 | 39 | |
40 | - /** |
|
41 | - * {@inheritDoc} |
|
42 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::getTitle() |
|
43 | - */ |
|
44 | - public function getTitle() { |
|
45 | - return I18N::translate('Administration Tasks'); |
|
46 | - } |
|
40 | + /** |
|
41 | + * {@inheritDoc} |
|
42 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::getTitle() |
|
43 | + */ |
|
44 | + public function getTitle() { |
|
45 | + return I18N::translate('Administration Tasks'); |
|
46 | + } |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * {@inheritDoc} |
50 | 50 | * @see \Fisharebest\Webtrees\Module\AbstractModule::getDescription() |
51 | 51 | */ |
52 | - public function getDescription() { |
|
53 | - return I18N::translate('Manage and run nearly-scheduled administration tasks.'); |
|
54 | - } |
|
52 | + public function getDescription() { |
|
53 | + return I18N::translate('Manage and run nearly-scheduled administration tasks.'); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * {@inheritDoc} |
|
58 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::modAction() |
|
59 | - */ |
|
60 | - public function modAction($mod_action) { |
|
61 | - Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
56 | + /** |
|
57 | + * {@inheritDoc} |
|
58 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::modAction() |
|
59 | + */ |
|
60 | + public function modAction($mod_action) { |
|
61 | + Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
62 | 62 | |
63 | - \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
64 | - } |
|
63 | + \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * {@inheritDoc} |
|
68 | - * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
69 | - */ |
|
70 | - public function getConfigLink() { |
|
71 | - Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
66 | + /** |
|
67 | + * {@inheritDoc} |
|
68 | + * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
69 | + */ |
|
70 | + public function getConfigLink() { |
|
71 | + Database::updateSchema(self::SCHEMA_MIGRATION_PREFIX, self::SCHEMA_SETTING_NAME, self::SCHEMA_TARGET_VERSION); |
|
72 | 72 | |
73 | - return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
74 | - } |
|
73 | + return 'module.php?mod=' . $this->getName() . '&mod_action=AdminConfig'; |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * {@inheritDoc} |
|
78 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock() |
|
79 | - */ |
|
80 | - public function getBlock($block_id, $template = true, $cfg = array()) { |
|
81 | - global $controller; |
|
76 | + /** |
|
77 | + * {@inheritDoc} |
|
78 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock() |
|
79 | + */ |
|
80 | + public function getBlock($block_id, $template = true, $cfg = array()) { |
|
81 | + global $controller; |
|
82 | 82 | |
83 | - $controller->addInlineJavascript(' |
|
83 | + $controller->addInlineJavascript(' |
|
84 | 84 | $(document).ready(function(){ |
85 | 85 | $.ajax({ |
86 | 86 | url: "module.php", |
@@ -91,60 +91,60 @@ discard block |
||
91 | 91 | }); |
92 | 92 | }); |
93 | 93 | '); |
94 | - return ''; |
|
95 | - } |
|
94 | + return ''; |
|
95 | + } |
|
96 | 96 | |
97 | - /** |
|
98 | - * {@inheritDoc} |
|
99 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::loadAjax() |
|
100 | - */ |
|
101 | - public function loadAjax() { |
|
102 | - return false; |
|
103 | - } |
|
97 | + /** |
|
98 | + * {@inheritDoc} |
|
99 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::loadAjax() |
|
100 | + */ |
|
101 | + public function loadAjax() { |
|
102 | + return false; |
|
103 | + } |
|
104 | 104 | |
105 | - /** |
|
106 | - * {@inheritDoc} |
|
107 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isGedcomBlock() |
|
108 | - */ |
|
109 | - public function isGedcomBlock() { |
|
110 | - return true; |
|
111 | - } |
|
105 | + /** |
|
106 | + * {@inheritDoc} |
|
107 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isGedcomBlock() |
|
108 | + */ |
|
109 | + public function isGedcomBlock() { |
|
110 | + return true; |
|
111 | + } |
|
112 | 112 | |
113 | - /** |
|
114 | - * {@inheritDoc} |
|
115 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isUserBlock() |
|
116 | - */ |
|
117 | - public function isUserBlock() { |
|
118 | - return false; |
|
119 | - } |
|
113 | + /** |
|
114 | + * {@inheritDoc} |
|
115 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isUserBlock() |
|
116 | + */ |
|
117 | + public function isUserBlock() { |
|
118 | + return false; |
|
119 | + } |
|
120 | 120 | |
121 | - /** |
|
122 | - * {@inheritDoc} |
|
123 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::configureBlock() |
|
124 | - */ |
|
125 | - public function configureBlock($block_id) { |
|
121 | + /** |
|
122 | + * {@inheritDoc} |
|
123 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::configureBlock() |
|
124 | + */ |
|
125 | + public function configureBlock($block_id) { |
|
126 | 126 | |
127 | - } |
|
127 | + } |
|
128 | 128 | |
129 | 129 | /** |
130 | - * Get the Admin Tasks Provider (initialise it if not done yet). |
|
131 | - * |
|
132 | - * @return \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface |
|
133 | - */ |
|
134 | - public function getProvider() { |
|
135 | - if(!$this->provider) { |
|
136 | - $this->provider = new TaskProvider(WT_ROOT.WT_MODULES_DIR.$this->getName().'/tasks/'); |
|
137 | - } |
|
138 | - return $this->provider; |
|
139 | - } |
|
130 | + * Get the Admin Tasks Provider (initialise it if not done yet). |
|
131 | + * |
|
132 | + * @return \MyArtJaub\Webtrees\Module\AdminTasks\Model\TaskProviderInterface |
|
133 | + */ |
|
134 | + public function getProvider() { |
|
135 | + if(!$this->provider) { |
|
136 | + $this->provider = new TaskProvider(WT_ROOT.WT_MODULES_DIR.$this->getName().'/tasks/'); |
|
137 | + } |
|
138 | + return $this->provider; |
|
139 | + } |
|
140 | 140 | |
141 | 141 | /** |
142 | 142 | * Set the Admin Tasks Provider. |
143 | 143 | * |
144 | 144 | * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\TaskProviderInterface |
145 | 145 | */ |
146 | - public function setProvider(TaskProviderInterface $provider) { |
|
147 | - $this->provider = $provider; |
|
148 | - } |
|
146 | + public function setProvider(TaskProviderInterface $provider) { |
|
147 | + $this->provider = $provider; |
|
148 | + } |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | \ No newline at end of file |
@@ -34,37 +34,37 @@ discard block |
||
34 | 34 | */ |
35 | 35 | class AdminConfigController extends MvcController |
36 | 36 | { |
37 | - /** |
|
38 | - * Tasks Provider |
|
39 | - * @var TaskProviderInterface $provider |
|
40 | - */ |
|
41 | - protected $provider; |
|
37 | + /** |
|
38 | + * Tasks Provider |
|
39 | + * @var TaskProviderInterface $provider |
|
40 | + */ |
|
41 | + protected $provider; |
|
42 | 42 | |
43 | - /** |
|
44 | - * Constructor for Admin Config controller |
|
45 | - * @param \Fisharebest\Webtrees\Module\AbstractModule $module |
|
46 | - */ |
|
47 | - public function __construct(AbstractModule $module) { |
|
48 | - parent::__construct($module); |
|
43 | + /** |
|
44 | + * Constructor for Admin Config controller |
|
45 | + * @param \Fisharebest\Webtrees\Module\AbstractModule $module |
|
46 | + */ |
|
47 | + public function __construct(AbstractModule $module) { |
|
48 | + parent::__construct($module); |
|
49 | 49 | |
50 | - $this->provider = $this->module->getProvider(); |
|
51 | - } |
|
50 | + $this->provider = $this->module->getProvider(); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Pages |
|
55 | - */ |
|
53 | + /** |
|
54 | + * Pages |
|
55 | + */ |
|
56 | 56 | |
57 | - /** |
|
58 | - * AdminConfig@index |
|
59 | - */ |
|
60 | - public function index() { |
|
61 | - global $WT_TREE; |
|
57 | + /** |
|
58 | + * AdminConfig@index |
|
59 | + */ |
|
60 | + public function index() { |
|
61 | + global $WT_TREE; |
|
62 | 62 | |
63 | - Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
64 | - $controller = new PageController(); |
|
65 | - $controller |
|
66 | - ->restrictAccess(Auth::isAdmin()) |
|
67 | - ->setPageTitle($this->module->getTitle()); |
|
63 | + Theme::theme(new AdministrationTheme)->init($WT_TREE); |
|
64 | + $controller = new PageController(); |
|
65 | + $controller |
|
66 | + ->restrictAccess(Auth::isAdmin()) |
|
67 | + ->setPageTitle($this->module->getTitle()); |
|
68 | 68 | |
69 | 69 | $token = $this->module->getSetting('MAJ_AT_FORCE_EXEC_TOKEN'); |
70 | 70 | if(is_null($token)) { |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | $this->module->setSetting('PAT_FORCE_EXEC_TOKEN', $token); |
73 | 73 | } |
74 | 74 | |
75 | - $data = new ViewBag(); |
|
76 | - $data->set('title', $controller->getPageTitle()); |
|
75 | + $data = new ViewBag(); |
|
76 | + $data->set('title', $controller->getPageTitle()); |
|
77 | 77 | |
78 | - $table_id = 'table-admintasks-' . Uuid::uuid4(); |
|
79 | - $data->set('table_id', $table_id); |
|
78 | + $table_id = 'table-admintasks-' . Uuid::uuid4(); |
|
79 | + $data->set('table_id', $table_id); |
|
80 | 80 | |
81 | 81 | $data->set('trigger_url_root', WT_BASE_URL.'module.php?mod='.$this->module->getName().'&mod_action=Task@trigger'); |
82 | 82 | $token = $this->module->getSetting('MAJ_AT_FORCE_EXEC_TOKEN'); |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | $this->provider->getInstalledTasks(); |
90 | 90 | |
91 | 91 | $controller |
92 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
93 | - ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL) |
|
94 | - ->addInlineJavascript(' |
|
92 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
93 | + ->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL) |
|
94 | + ->addInlineJavascript(' |
|
95 | 95 | //Datatable initialisation |
96 | 96 | jQuery.fn.dataTableExt.oSort["unicode-asc" ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))}; |
97 | 97 | jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))}; |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | }); |
124 | 124 | |
125 | 125 | ') |
126 | - ->addInlineJavascript(' |
|
126 | + ->addInlineJavascript(' |
|
127 | 127 | function generate_force_token() { |
128 | 128 | jQuery("#bt_genforcetoken").attr("disabled", "disabled"); |
129 | 129 | jQuery("#bt_tokentext").empty().html("<i class=\"fa fa-spinner fa-pulse fa-fw\"></i>"); |
@@ -171,56 +171,56 @@ discard block |
||
171 | 171 | } |
172 | 172 | '); |
173 | 173 | |
174 | - ViewFactory::make('AdminConfig', $this, $controller, $data)->render(); |
|
175 | - } |
|
174 | + ViewFactory::make('AdminConfig', $this, $controller, $data)->render(); |
|
175 | + } |
|
176 | 176 | |
177 | - /** |
|
178 | - * AdminConfig@jsonTasksList |
|
179 | - */ |
|
180 | - public function jsonTasksList() { |
|
181 | - global $WT_TREE; |
|
177 | + /** |
|
178 | + * AdminConfig@jsonTasksList |
|
179 | + */ |
|
180 | + public function jsonTasksList() { |
|
181 | + global $WT_TREE; |
|
182 | 182 | |
183 | - $controller = new JsonController(); |
|
184 | - $controller |
|
185 | - ->restrictAccess(Auth::isAdmin()); |
|
183 | + $controller = new JsonController(); |
|
184 | + $controller |
|
185 | + ->restrictAccess(Auth::isAdmin()); |
|
186 | 186 | |
187 | - // Generate an AJAX/JSON response for datatables to load a block of rows |
|
188 | - $search = Filter::postArray('search'); |
|
189 | - if($search) $search = $search['value']; |
|
190 | - $start = Filter::postInteger('start'); |
|
191 | - $length = Filter::postInteger('length'); |
|
192 | - $order = Filter::postArray('order'); |
|
187 | + // Generate an AJAX/JSON response for datatables to load a block of rows |
|
188 | + $search = Filter::postArray('search'); |
|
189 | + if($search) $search = $search['value']; |
|
190 | + $start = Filter::postInteger('start'); |
|
191 | + $length = Filter::postInteger('length'); |
|
192 | + $order = Filter::postArray('order'); |
|
193 | 193 | |
194 | 194 | $order_by_name = false; |
195 | - foreach($order as $key => &$value) { |
|
196 | - switch($value['column']) { |
|
197 | - case 3: |
|
195 | + foreach($order as $key => &$value) { |
|
196 | + switch($value['column']) { |
|
197 | + case 3: |
|
198 | 198 | $order_by_name = true; |
199 | - unset($order[$key]); |
|
200 | - break; |
|
201 | - case 4; |
|
199 | + unset($order[$key]); |
|
200 | + break; |
|
201 | + case 4; |
|
202 | 202 | $value['column'] = 'majat_last_run'; |
203 | 203 | break; |
204 | 204 | case 4; |
205 | 205 | $value['column'] = 'majat_last_result'; |
206 | 206 | break; |
207 | - default: |
|
208 | - unset($order[$key]); |
|
209 | - } |
|
210 | - } |
|
207 | + default: |
|
208 | + unset($order[$key]); |
|
209 | + } |
|
210 | + } |
|
211 | 211 | |
212 | - $list = $this->provider->getFilteredTasksList($search, $order, $start, $length); |
|
212 | + $list = $this->provider->getFilteredTasksList($search, $order, $start, $length); |
|
213 | 213 | if($order_by_name) { |
214 | 214 | usort($list, function(AbstractTask $a, AbstractTask $b) { return I18N::strcasecmp($a->getTitle(), $b->getTitle()); }); |
215 | 215 | } |
216 | - $recordsFiltered = count($list); |
|
217 | - $recordsTotal = $this->provider->getTasksCount(); |
|
216 | + $recordsFiltered = count($list); |
|
217 | + $recordsTotal = $this->provider->getTasksCount(); |
|
218 | 218 | |
219 | - $data = array(); |
|
220 | - foreach($list as $task) { |
|
221 | - $datum = array(); |
|
219 | + $data = array(); |
|
220 | + foreach($list as $task) { |
|
221 | + $datum = array(); |
|
222 | 222 | |
223 | - $datum[0] = ' |
|
223 | + $datum[0] = ' |
|
224 | 224 | <div class="btn-group"> |
225 | 225 | <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> |
226 | 226 | <i class="fa fa-pencil"></i><span class="caret"></span> |
@@ -238,50 +238,50 @@ discard block |
||
238 | 238 | </li> |
239 | 239 | </ul> |
240 | 240 | </div>'; |
241 | - $datum[1] = $task->getName(); |
|
242 | - $datum[2] = $task->isEnabled() ? |
|
241 | + $datum[1] = $task->getName(); |
|
242 | + $datum[2] = $task->isEnabled() ? |
|
243 | 243 | '<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Enabled').'</span>' : |
244 | 244 | '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Disabled').'</span>'; |
245 | - $datum[3] = $task->getTitle(); |
|
246 | - $date_format = str_replace('%', '', I18N::dateFormat()) . ' H:i:s'; |
|
245 | + $datum[3] = $task->getTitle(); |
|
246 | + $date_format = str_replace('%', '', I18N::dateFormat()) . ' H:i:s'; |
|
247 | 247 | $datum[4] = $task->getLastUpdated()->format($date_format); |
248 | - $datum[5] = $task->isLastRunSuccess() ? |
|
248 | + $datum[5] = $task->isLastRunSuccess() ? |
|
249 | 249 | '<i class="fa fa-check"></i><span class="sr-only">'.I18N::translate('Yes').'</span>' : |
250 | 250 | '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('No').'</span>'; |
251 | - $dtF = new \DateTime('@0'); |
|
252 | - $dtT = new \DateTime('@' . ($task->getFrequency() * 60)); |
|
253 | - $datum[6] = $dtF->diff($dtT)->format(I18N::translate('%a d %h h %i m')); |
|
251 | + $dtF = new \DateTime('@0'); |
|
252 | + $dtT = new \DateTime('@' . ($task->getFrequency() * 60)); |
|
253 | + $datum[6] = $dtF->diff($dtT)->format(I18N::translate('%a d %h h %i m')); |
|
254 | 254 | $datum[7] = $task->getRemainingOccurrences() > 0 ? I18N::number($task->getRemainingOccurrences()) : I18N::translate('Unlimited'); |
255 | 255 | $datum[8] = $task->isRunning() ? |
256 | 256 | '<i class="fa fa-cog fa-spin fa-fw"></i><span class="sr-only">'.I18N::translate('Running').'</span>' : |
257 | 257 | '<i class="fa fa-times"></i><span class="sr-only">'.I18N::translate('Not running').'</span>'; |
258 | 258 | if($task->isEnabled() && !$task->isRunning()) { |
259 | - $datum[9] = ' |
|
259 | + $datum[9] = ' |
|
260 | 260 | <button id="bt_runtask_'. $task->getName() .'" class="btn btn-primary" href="#" onclick="return run_admintask(\''. $task->getName() .'\')"> |
261 | 261 | <div id="bt_runtasktext_'. $task->getName() .'"><i class="fa fa-cog fa-fw" ></i>' . I18N::translate('Run') . '</div> |
262 | 262 | </button>'; |
263 | 263 | } |
264 | 264 | else { |
265 | - $datum[9] = ''; |
|
265 | + $datum[9] = ''; |
|
266 | 266 | } |
267 | 267 | |
268 | - $data[] = $datum; |
|
269 | - } |
|
268 | + $data[] = $datum; |
|
269 | + } |
|
270 | 270 | |
271 | - $controller->pageHeader(); |
|
271 | + $controller->pageHeader(); |
|
272 | 272 | |
273 | - echo \Zend_Json::encode(array( |
|
274 | - 'draw' => Filter::getInteger('draw'), |
|
275 | - 'recordsTotal' => $recordsTotal, |
|
276 | - 'recordsFiltered' => $recordsFiltered, |
|
277 | - 'data' => $data |
|
278 | - )); |
|
273 | + echo \Zend_Json::encode(array( |
|
274 | + 'draw' => Filter::getInteger('draw'), |
|
275 | + 'recordsTotal' => $recordsTotal, |
|
276 | + 'recordsFiltered' => $recordsFiltered, |
|
277 | + 'data' => $data |
|
278 | + )); |
|
279 | 279 | |
280 | - } |
|
280 | + } |
|
281 | 281 | |
282 | 282 | /** |
283 | 283 | * AdminConfig@generateToken |
284 | - * |
|
284 | + * |
|
285 | 285 | * Ajax call to generate a new token. Display the token, if generated. |
286 | 286 | * Tokens call only be generated by a site administrator. |
287 | 287 | * |
@@ -26,166 +26,166 @@ |
||
26 | 26 | class LineageController extends MvcController |
27 | 27 | { |
28 | 28 | |
29 | - /** |
|
30 | - * Generate the patronymic lineage for this surname |
|
31 | - * @var string $surname Reference surname |
|
32 | - */ |
|
33 | - private $surname; |
|
29 | + /** |
|
30 | + * Generate the patronymic lineage for this surname |
|
31 | + * @var string $surname Reference surname |
|
32 | + */ |
|
33 | + private $surname; |
|
34 | 34 | |
35 | - /** |
|
36 | - * Initial letter |
|
37 | - * @var string $alpha |
|
38 | - */ |
|
39 | - private $alpha; |
|
35 | + /** |
|
36 | + * Initial letter |
|
37 | + * @var string $alpha |
|
38 | + */ |
|
39 | + private $alpha; |
|
40 | 40 | |
41 | - /** |
|
42 | - * Show all names (values: yes|no) |
|
43 | - * @var bool $show |
|
44 | - */ |
|
45 | - private $show_all; |
|
41 | + /** |
|
42 | + * Show all names (values: yes|no) |
|
43 | + * @var bool $show |
|
44 | + */ |
|
45 | + private $show_all; |
|
46 | 46 | |
47 | - /** |
|
48 | - * Page to display (values: surn|lineage) |
|
49 | - * @var unknown $show |
|
50 | - */ |
|
51 | - private $show; |
|
47 | + /** |
|
48 | + * Page to display (values: surn|lineage) |
|
49 | + * @var unknown $show |
|
50 | + */ |
|
51 | + private $show; |
|
52 | 52 | |
53 | - /** |
|
54 | - * Page title |
|
55 | - * @var string $legend |
|
56 | - */ |
|
57 | - private $legend; |
|
53 | + /** |
|
54 | + * Page title |
|
55 | + * @var string $legend |
|
56 | + */ |
|
57 | + private $legend; |
|
58 | 58 | |
59 | - /** |
|
60 | - * {@inheritDoc} |
|
61 | - * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module) |
|
62 | - */ |
|
63 | - public function __construct(AbstractModule $module) { |
|
64 | - global $WT_TREE; |
|
59 | + /** |
|
60 | + * {@inheritDoc} |
|
61 | + * @see \MyArtJaub\Webtrees\Mvc\Controller\MvcController::__construct(AbstractModule $module) |
|
62 | + */ |
|
63 | + public function __construct(AbstractModule $module) { |
|
64 | + global $WT_TREE; |
|
65 | 65 | |
66 | - parent::__construct($module); |
|
66 | + parent::__construct($module); |
|
67 | 67 | |
68 | - $this->surname = Filter::get('surname'); |
|
69 | - $this->alpha = Filter::get('alpha'); // All surnames beginning with this letter where "@"=unknown and ","=none |
|
70 | - $this->show_all = Filter::get('show_all', 'no|yes', 'no'); // All indis |
|
71 | - // Make sure selections are consistent. |
|
72 | - // i.e. can’t specify show_all and surname at the same time. |
|
73 | - if ($this->show_all === 'yes') { |
|
74 | - $this->alpha = ''; |
|
75 | - $this->surname = ''; |
|
76 | - $this->legend = I18N::translate('All'); |
|
77 | - $this->show = Filter::get('show', 'surn|lineage', 'surn'); |
|
78 | - } elseif ($this->surname) { |
|
79 | - $this->alpha = QueryName::initialLetter($this->surname); // so we can highlight the initial letter |
|
80 | - $this->show_all = 'no'; |
|
81 | - if ($this->surname === '@N.N.') { |
|
82 | - $this->legend = I18N::translateContext('Unknown surname', '…'); |
|
83 | - } else { |
|
84 | - $this->legend = Filter::escapeHtml($this->surname); |
|
85 | - // The surname parameter is a root/canonical form. |
|
86 | - // Display it as the actual surname |
|
87 | - foreach (QueryName::surnames($WT_TREE, $this->surname, $this->alpha, false, false) as $details) { |
|
88 | - $this->legend = implode('/', array_keys($details)); |
|
89 | - } |
|
90 | - } |
|
91 | - $this->show = 'lineage'; // SURN list makes no sense here |
|
92 | - } elseif ($this->alpha === '@') { |
|
93 | - $this->show_all = 'no'; |
|
94 | - $this->legend = I18N::translateContext('Unknown surname', '…'); |
|
95 | - $this->show = 'lineage'; // SURN list makes no sense here |
|
96 | - } elseif ($this->alpha === ',') { |
|
97 | - $this->show_all = 'no'; |
|
98 | - $this->legend = I18N::translate('None'); |
|
99 | - $this->show = 'lineage'; // SURN list makes no sense here |
|
100 | - } elseif ($this->alpha) { |
|
101 | - $this->show_all = 'no'; |
|
102 | - $this->legend = Filter::escapeHtml($this->alpha) . '…'; |
|
103 | - $this->show = Filter::get('show', 'surn|lineage', 'surn'); |
|
104 | - } else { |
|
105 | - $this->show_all = 'no'; |
|
106 | - $this->legend = '…'; |
|
107 | - $this->show = 'none'; // Don't show lists until something is chosen |
|
108 | - } |
|
109 | - $this->legend = '<span dir="auto">' . $this->legend . '</span>'; |
|
68 | + $this->surname = Filter::get('surname'); |
|
69 | + $this->alpha = Filter::get('alpha'); // All surnames beginning with this letter where "@"=unknown and ","=none |
|
70 | + $this->show_all = Filter::get('show_all', 'no|yes', 'no'); // All indis |
|
71 | + // Make sure selections are consistent. |
|
72 | + // i.e. can’t specify show_all and surname at the same time. |
|
73 | + if ($this->show_all === 'yes') { |
|
74 | + $this->alpha = ''; |
|
75 | + $this->surname = ''; |
|
76 | + $this->legend = I18N::translate('All'); |
|
77 | + $this->show = Filter::get('show', 'surn|lineage', 'surn'); |
|
78 | + } elseif ($this->surname) { |
|
79 | + $this->alpha = QueryName::initialLetter($this->surname); // so we can highlight the initial letter |
|
80 | + $this->show_all = 'no'; |
|
81 | + if ($this->surname === '@N.N.') { |
|
82 | + $this->legend = I18N::translateContext('Unknown surname', '…'); |
|
83 | + } else { |
|
84 | + $this->legend = Filter::escapeHtml($this->surname); |
|
85 | + // The surname parameter is a root/canonical form. |
|
86 | + // Display it as the actual surname |
|
87 | + foreach (QueryName::surnames($WT_TREE, $this->surname, $this->alpha, false, false) as $details) { |
|
88 | + $this->legend = implode('/', array_keys($details)); |
|
89 | + } |
|
90 | + } |
|
91 | + $this->show = 'lineage'; // SURN list makes no sense here |
|
92 | + } elseif ($this->alpha === '@') { |
|
93 | + $this->show_all = 'no'; |
|
94 | + $this->legend = I18N::translateContext('Unknown surname', '…'); |
|
95 | + $this->show = 'lineage'; // SURN list makes no sense here |
|
96 | + } elseif ($this->alpha === ',') { |
|
97 | + $this->show_all = 'no'; |
|
98 | + $this->legend = I18N::translate('None'); |
|
99 | + $this->show = 'lineage'; // SURN list makes no sense here |
|
100 | + } elseif ($this->alpha) { |
|
101 | + $this->show_all = 'no'; |
|
102 | + $this->legend = Filter::escapeHtml($this->alpha) . '…'; |
|
103 | + $this->show = Filter::get('show', 'surn|lineage', 'surn'); |
|
104 | + } else { |
|
105 | + $this->show_all = 'no'; |
|
106 | + $this->legend = '…'; |
|
107 | + $this->show = 'none'; // Don't show lists until something is chosen |
|
108 | + } |
|
109 | + $this->legend = '<span dir="auto">' . $this->legend . '</span>'; |
|
110 | 110 | |
111 | - } |
|
111 | + } |
|
112 | 112 | |
113 | - /** |
|
114 | - * Indicates whether the list of surname should be displayed |
|
115 | - * @return bool |
|
116 | - */ |
|
117 | - protected function isShowingSurnames() { |
|
118 | - return $this->show === 'surn'; |
|
119 | - } |
|
113 | + /** |
|
114 | + * Indicates whether the list of surname should be displayed |
|
115 | + * @return bool |
|
116 | + */ |
|
117 | + protected function isShowingSurnames() { |
|
118 | + return $this->show === 'surn'; |
|
119 | + } |
|
120 | 120 | |
121 | - /** |
|
122 | - * Indicates whether the lineages should be displayed |
|
123 | - * @return bool |
|
124 | - */ |
|
125 | - protected function isShowingLineages() { |
|
126 | - return $this->show === 'lineage'; |
|
127 | - } |
|
121 | + /** |
|
122 | + * Indicates whether the lineages should be displayed |
|
123 | + * @return bool |
|
124 | + */ |
|
125 | + protected function isShowingLineages() { |
|
126 | + return $this->show === 'lineage'; |
|
127 | + } |
|
128 | 128 | |
129 | - /** |
|
130 | - * Get list of surnames, starting with the specified initial |
|
131 | - * @return array |
|
132 | - */ |
|
133 | - protected function getSurnamesList() { |
|
134 | - global $WT_TREE; |
|
129 | + /** |
|
130 | + * Get list of surnames, starting with the specified initial |
|
131 | + * @return array |
|
132 | + */ |
|
133 | + protected function getSurnamesList() { |
|
134 | + global $WT_TREE; |
|
135 | 135 | |
136 | - return QueryName::surnames($WT_TREE, $this->surname, $this->alpha, false, false); |
|
137 | - } |
|
136 | + return QueryName::surnames($WT_TREE, $this->surname, $this->alpha, false, false); |
|
137 | + } |
|
138 | 138 | |
139 | - /** |
|
140 | - * Get the lineages for the controller's specified surname |
|
141 | - */ |
|
142 | - protected function getLineages() { |
|
139 | + /** |
|
140 | + * Get the lineages for the controller's specified surname |
|
141 | + */ |
|
142 | + protected function getLineages() { |
|
143 | 143 | global $WT_TREE; |
144 | 144 | |
145 | 145 | $builder = new LineageBuilder($this->surname, $WT_TREE); |
146 | 146 | $lineages = $builder->buildLineages(); |
147 | 147 | |
148 | - return $lineages; |
|
149 | - } |
|
148 | + return $lineages; |
|
149 | + } |
|
150 | 150 | |
151 | - /** |
|
152 | - * Pages |
|
153 | - */ |
|
151 | + /** |
|
152 | + * Pages |
|
153 | + */ |
|
154 | 154 | |
155 | - /** |
|
156 | - * Lineage@index |
|
157 | - */ |
|
158 | - public function index() { |
|
159 | - global $WT_TREE; |
|
155 | + /** |
|
156 | + * Lineage@index |
|
157 | + */ |
|
158 | + public function index() { |
|
159 | + global $WT_TREE; |
|
160 | 160 | |
161 | - $controller = new PageController(); |
|
162 | - $controller->setPageTitle(I18N::translate('Patronymic Lineages') . ' : ' . $this->legend); |
|
161 | + $controller = new PageController(); |
|
162 | + $controller->setPageTitle(I18N::translate('Patronymic Lineages') . ' : ' . $this->legend); |
|
163 | 163 | |
164 | - $view_bag = new ViewBag(); |
|
165 | - $view_bag->set('title', $controller->getPageTitle()); |
|
166 | - $view_bag->set('tree', $WT_TREE); |
|
167 | - $view_bag->set('alpha', $this->alpha); |
|
168 | - $view_bag->set('surname', $this->surname); |
|
169 | - $view_bag->set('legend', $this->legend); |
|
170 | - $view_bag->set('show_all', $this->show_all); |
|
171 | - if($this->isShowingSurnames()) { |
|
172 | - $view_bag->set('issurnames', true); |
|
173 | - $view_bag->set('surnameslist', $this->getSurnamesList()); |
|
174 | - } |
|
175 | - if($this->isShowingLineages()) { |
|
176 | - $view_bag->set('islineages', true); |
|
177 | - $view_bag->set('lineages', $this->getLineages()); |
|
164 | + $view_bag = new ViewBag(); |
|
165 | + $view_bag->set('title', $controller->getPageTitle()); |
|
166 | + $view_bag->set('tree', $WT_TREE); |
|
167 | + $view_bag->set('alpha', $this->alpha); |
|
168 | + $view_bag->set('surname', $this->surname); |
|
169 | + $view_bag->set('legend', $this->legend); |
|
170 | + $view_bag->set('show_all', $this->show_all); |
|
171 | + if($this->isShowingSurnames()) { |
|
172 | + $view_bag->set('issurnames', true); |
|
173 | + $view_bag->set('surnameslist', $this->getSurnamesList()); |
|
174 | + } |
|
175 | + if($this->isShowingLineages()) { |
|
176 | + $view_bag->set('islineages', true); |
|
177 | + $view_bag->set('lineages', $this->getLineages()); |
|
178 | 178 | |
179 | - if ($this->show_all==='no') { |
|
180 | - $view_bag->set('table_title', I18N::translate('Individuals in %s lineages', $this->legend)); |
|
181 | - } |
|
182 | - else { |
|
183 | - $view_bag->set('table_title', I18N::translate('All lineages')); |
|
184 | - } |
|
185 | - } |
|
179 | + if ($this->show_all==='no') { |
|
180 | + $view_bag->set('table_title', I18N::translate('Individuals in %s lineages', $this->legend)); |
|
181 | + } |
|
182 | + else { |
|
183 | + $view_bag->set('table_title', I18N::translate('All lineages')); |
|
184 | + } |
|
185 | + } |
|
186 | 186 | |
187 | - ViewFactory::make('Lineage', $this, $controller, $view_bag)->render(); |
|
188 | - } |
|
187 | + ViewFactory::make('Lineage', $this, $controller, $view_bag)->render(); |
|
188 | + } |
|
189 | 189 | |
190 | 190 | |
191 | 191 |