@@ -54,30 +54,30 @@ discard block |
||
54 | 54 | public function buildLineages() { |
55 | 55 | $indis = \Fisharebest\Webtrees\Query\QueryName::individuals($this->tree, $this->surname, null, null, false, false); |
56 | 56 | |
57 | - if(count($indis) == 0) return null; |
|
57 | + if (count($indis) == 0) return null; |
|
58 | 58 | |
59 | 59 | $root_lineages = array(); |
60 | 60 | |
61 | - foreach($indis as $indi) { |
|
61 | + foreach ($indis as $indi) { |
|
62 | 62 | $pid = $indi->getXref(); |
63 | - if(!isset($this->used_indis[$pid])){ |
|
63 | + if (!isset($this->used_indis[$pid])) { |
|
64 | 64 | //Find the root of the lineage |
65 | 65 | /** @var Fisharebest\Webtrees\Individual $indiFirst */ |
66 | - $indiFirst= $this->getLineageRootIndividual($indi); |
|
67 | - if($indiFirst){ |
|
66 | + $indiFirst = $this->getLineageRootIndividual($indi); |
|
67 | + if ($indiFirst) { |
|
68 | 68 | $this->used_indis[$indiFirst->getXref()] = true; |
69 | - if($indiFirst->canShow()){ |
|
69 | + if ($indiFirst->canShow()) { |
|
70 | 70 | //Check if the root individual has brothers and sisters, without parents |
71 | 71 | $indiChildFamily = $indiFirst->getPrimaryChildFamily(); |
72 | - if($indiChildFamily !== null){ |
|
72 | + if ($indiChildFamily !== null) { |
|
73 | 73 | $root_node = new LineageRootNode(null); |
74 | 74 | $root_node->addFamily($indiChildFamily); |
75 | 75 | } |
76 | - else{ |
|
76 | + else { |
|
77 | 77 | $root_node = new LineageRootNode($indiFirst); |
78 | 78 | } |
79 | 79 | $root_node = $this->buildLineage($root_node); |
80 | - if($root_node) $root_lineages[] = $root_node; |
|
80 | + if ($root_node) $root_lineages[] = $root_node; |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | } |
@@ -94,45 +94,45 @@ discard block |
||
94 | 94 | * @return (Individual|null) Root individual |
95 | 95 | */ |
96 | 96 | protected function getLineageRootIndividual(Individual $indi) { |
97 | - $is_first=false; |
|
97 | + $is_first = false; |
|
98 | 98 | $dindi = new \MyArtJaub\Webtrees\Individual($indi); |
99 | - $indi_surname=$dindi->getUnprotectedPrimarySurname(); |
|
99 | + $indi_surname = $dindi->getUnprotectedPrimarySurname(); |
|
100 | 100 | $resIndi = $indi; |
101 | - while(!$is_first){ |
|
101 | + while (!$is_first) { |
|
102 | 102 | //Get the individual parents family |
103 | - $fam=$resIndi->getPrimaryChildFamily(); |
|
104 | - if($fam){ |
|
105 | - $husb=$fam->getHusband(); |
|
106 | - $wife=$fam->getWife(); |
|
103 | + $fam = $resIndi->getPrimaryChildFamily(); |
|
104 | + if ($fam) { |
|
105 | + $husb = $fam->getHusband(); |
|
106 | + $wife = $fam->getWife(); |
|
107 | 107 | //If the father exists, take him |
108 | - if($husb){ |
|
108 | + if ($husb) { |
|
109 | 109 | $dhusb = new \MyArtJaub\Webtrees\Individual($husb); |
110 | - $dhusb->isNewAddition() ? $is_first = true : $resIndi=$husb; |
|
110 | + $dhusb->isNewAddition() ? $is_first = true : $resIndi = $husb; |
|
111 | 111 | } |
112 | 112 | //If only a mother exists |
113 | - else if($wife){ |
|
113 | + else if ($wife) { |
|
114 | 114 | $dwife = new \MyArtJaub\Webtrees\Individual($wife); |
115 | - $wife_surname=$dwife->getUnprotectedPrimarySurname(); |
|
115 | + $wife_surname = $dwife->getUnprotectedPrimarySurname(); |
|
116 | 116 | //Check if the child is a natural child of the mother (based on the surname - Warning : surname must be identical) |
117 | - if(!$dwife->isNewAddition() && I18N::strcasecmp($wife_surname, $indi_surname) == 0){ |
|
118 | - $resIndi=$wife; |
|
117 | + if (!$dwife->isNewAddition() && I18N::strcasecmp($wife_surname, $indi_surname) == 0) { |
|
118 | + $resIndi = $wife; |
|
119 | 119 | } |
120 | - else{ |
|
121 | - $is_first=true; |
|
120 | + else { |
|
121 | + $is_first = true; |
|
122 | 122 | } |
123 | 123 | } |
124 | - else{ |
|
125 | - $is_first=true; |
|
124 | + else { |
|
125 | + $is_first = true; |
|
126 | 126 | } |
127 | 127 | } |
128 | - else{ |
|
129 | - $is_first=true; |
|
128 | + else { |
|
129 | + $is_first = true; |
|
130 | 130 | } |
131 | 131 | } |
132 | - if(isset($this->used_indis[$resIndi->getXref()])){ |
|
132 | + if (isset($this->used_indis[$resIndi->getXref()])) { |
|
133 | 133 | return null; |
134 | 134 | } |
135 | - else{ |
|
135 | + else { |
|
136 | 136 | return $resIndi; |
137 | 137 | } |
138 | 138 | } |
@@ -145,15 +145,15 @@ discard block |
||
145 | 145 | * @return LineageNode Computed lineage |
146 | 146 | */ |
147 | 147 | protected function buildLineage(LineageNode $node) { |
148 | - if($node === null) return; |
|
148 | + if ($node === null) return; |
|
149 | 149 | |
150 | 150 | $indi_surname = null; |
151 | 151 | |
152 | 152 | $indi_node = $node->getIndividual(); |
153 | - if($indi_node) { |
|
154 | - if(count($node->getFamiliesNodes()) == 0) { |
|
153 | + if ($indi_node) { |
|
154 | + if (count($node->getFamiliesNodes()) == 0) { |
|
155 | 155 | $indiSpouseFamilies = $indi_node->getSpouseFamilies(); |
156 | - foreach($indiSpouseFamilies as $indiSpouseFamily) { |
|
156 | + foreach ($indiSpouseFamilies as $indiSpouseFamily) { |
|
157 | 157 | $node->addFamily($indiSpouseFamily); |
158 | 158 | } |
159 | 159 | } |
@@ -162,62 +162,62 @@ discard block |
||
162 | 162 | $indi_surname = $dindi_node->getUnprotectedPrimarySurname(); |
163 | 163 | |
164 | 164 | //Get the estimated birth place and put it in the place table |
165 | - $place=$dindi_node->getEstimatedBirthPlace(false); |
|
166 | - if($place && strlen($place) > 0){ |
|
167 | - $place=trim($place); |
|
165 | + $place = $dindi_node->getEstimatedBirthPlace(false); |
|
166 | + if ($place && strlen($place) > 0) { |
|
167 | + $place = trim($place); |
|
168 | 168 | $node->getRootNode()->addPlace(new Place($place, $this->tree)); |
169 | 169 | } |
170 | 170 | |
171 | 171 | //Tag the individual as used |
172 | - $this->used_indis[$indi_node->getXref()]=true; |
|
172 | + $this->used_indis[$indi_node->getXref()] = true; |
|
173 | 173 | } |
174 | 174 | |
175 | - foreach($node->getFamiliesNodes() as $family) { |
|
175 | + foreach ($node->getFamiliesNodes() as $family) { |
|
176 | 176 | $spouse_surname = null; |
177 | - if($indi_node && $spouse = $family->getSpouse($indi_node)) { |
|
177 | + if ($indi_node && $spouse = $family->getSpouse($indi_node)) { |
|
178 | 178 | $dspouse = new \MyArtJaub\Webtrees\Individual($spouse); |
179 | - $spouse_surname=$dspouse->getUnprotectedPrimarySurname(); |
|
179 | + $spouse_surname = $dspouse->getUnprotectedPrimarySurname(); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | $children = $family->getChildren(); |
183 | 183 | |
184 | - $nbChildren=0; |
|
185 | - $nbNatural=0; |
|
184 | + $nbChildren = 0; |
|
185 | + $nbNatural = 0; |
|
186 | 186 | |
187 | - foreach($children as $child){ |
|
187 | + foreach ($children as $child) { |
|
188 | 188 | $dchild = new \MyArtJaub\Webtrees\Individual($child); |
189 | - $child_surname=$dchild->getUnprotectedPrimarySurname(); |
|
189 | + $child_surname = $dchild->getUnprotectedPrimarySurname(); |
|
190 | 190 | |
191 | - if(!$dchild->isNewAddition()) { |
|
191 | + if (!$dchild->isNewAddition()) { |
|
192 | 192 | $nbChildren++; |
193 | 193 | //If the root individual is the mother |
194 | - if($indi_node && I18N::strcasecmp($indi_node->getSex(), 'F') == 0) { |
|
194 | + if ($indi_node && I18N::strcasecmp($indi_node->getSex(), 'F') == 0) { |
|
195 | 195 | //Print only lineages of children with the same surname as their mother (supposing they are natural children) |
196 | - if(!$spouse || ($spouse_surname && I18N::strcasecmp($child_surname, $spouse_surname) != 0)){ |
|
197 | - if(I18N::strcasecmp($child_surname, $indi_surname) == 0){ |
|
196 | + if (!$spouse || ($spouse_surname && I18N::strcasecmp($child_surname, $spouse_surname) != 0)) { |
|
197 | + if (I18N::strcasecmp($child_surname, $indi_surname) == 0) { |
|
198 | 198 | $nbNatural++; |
199 | 199 | $node_child = new LineageNode($child, $node->getRootNode()); |
200 | 200 | $node_child = $this->buildLineage($node_child); |
201 | - if($node_child) $node->addChild($family, $node_child); |
|
201 | + if ($node_child) $node->addChild($family, $node_child); |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | } |
205 | 205 | //If the root individual is the father |
206 | 206 | else { |
207 | 207 | //Print if the children does not bear the same name as his mother (and different from his father) |
208 | - if( strlen($child_surname) == 0 || strlen($indi_surname) == 0 || strlen($spouse_surname) == 0 || |
|
208 | + if (strlen($child_surname) == 0 || strlen($indi_surname) == 0 || strlen($spouse_surname) == 0 || |
|
209 | 209 | I18N::strcasecmp($child_surname, $indi_surname) == 0 || |
210 | - I18N::strcasecmp($child_surname, $spouse_surname) != 0 ) |
|
210 | + I18N::strcasecmp($child_surname, $spouse_surname) != 0) |
|
211 | 211 | { |
212 | 212 | $nbNatural++; |
213 | 213 | $node_child = new LineageNode($child, $node->getRootNode()); |
214 | 214 | $node_child = $this->buildLineage($node_child); |
215 | - if($node_child) $node->addChild($family, $node_child); |
|
215 | + if ($node_child) $node->addChild($family, $node_child); |
|
216 | 216 | } |
217 | 217 | else { |
218 | 218 | $nbNatural++; |
219 | 219 | $node_child = new LineageNode($child, $node->getRootNode(), $child_surname); |
220 | - if($node_child) $node->addChild($family, $node_child); |
|
220 | + if ($node_child) $node->addChild($family, $node_child); |
|
221 | 221 | } |
222 | 222 | } |
223 | 223 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | |
226 | 226 | |
227 | 227 | //Do not print other children |
228 | - if(($nbChildren-$nbNatural)>0){ |
|
228 | + if (($nbChildren - $nbNatural) > 0) { |
|
229 | 229 | $node->addChild($family, null); |
230 | 230 | } |
231 | 231 | } |
@@ -54,7 +54,9 @@ discard block |
||
54 | 54 | public function buildLineages() { |
55 | 55 | $indis = \Fisharebest\Webtrees\Query\QueryName::individuals($this->tree, $this->surname, null, null, false, false); |
56 | 56 | |
57 | - if(count($indis) == 0) return null; |
|
57 | + if(count($indis) == 0) { |
|
58 | + return null; |
|
59 | + } |
|
58 | 60 | |
59 | 61 | $root_lineages = array(); |
60 | 62 | |
@@ -72,12 +74,13 @@ discard block |
||
72 | 74 | if($indiChildFamily !== null){ |
73 | 75 | $root_node = new LineageRootNode(null); |
74 | 76 | $root_node->addFamily($indiChildFamily); |
75 | - } |
|
76 | - else{ |
|
77 | + } else{ |
|
77 | 78 | $root_node = new LineageRootNode($indiFirst); |
78 | 79 | } |
79 | 80 | $root_node = $this->buildLineage($root_node); |
80 | - if($root_node) $root_lineages[] = $root_node; |
|
81 | + if($root_node) { |
|
82 | + $root_lineages[] = $root_node; |
|
83 | + } |
|
81 | 84 | } |
82 | 85 | } |
83 | 86 | } |
@@ -116,23 +119,19 @@ discard block |
||
116 | 119 | //Check if the child is a natural child of the mother (based on the surname - Warning : surname must be identical) |
117 | 120 | if(!$dwife->isNewAddition() && I18N::strcasecmp($wife_surname, $indi_surname) == 0){ |
118 | 121 | $resIndi=$wife; |
119 | - } |
|
120 | - else{ |
|
122 | + } else{ |
|
121 | 123 | $is_first=true; |
122 | 124 | } |
123 | - } |
|
124 | - else{ |
|
125 | + } else{ |
|
125 | 126 | $is_first=true; |
126 | 127 | } |
127 | - } |
|
128 | - else{ |
|
128 | + } else{ |
|
129 | 129 | $is_first=true; |
130 | 130 | } |
131 | 131 | } |
132 | 132 | if(isset($this->used_indis[$resIndi->getXref()])){ |
133 | 133 | return null; |
134 | - } |
|
135 | - else{ |
|
134 | + } else{ |
|
136 | 135 | return $resIndi; |
137 | 136 | } |
138 | 137 | } |
@@ -145,7 +144,9 @@ discard block |
||
145 | 144 | * @return LineageNode Computed lineage |
146 | 145 | */ |
147 | 146 | protected function buildLineage(LineageNode $node) { |
148 | - if($node === null) return; |
|
147 | + if($node === null) { |
|
148 | + return; |
|
149 | + } |
|
149 | 150 | |
150 | 151 | $indi_surname = null; |
151 | 152 | |
@@ -198,7 +199,9 @@ discard block |
||
198 | 199 | $nbNatural++; |
199 | 200 | $node_child = new LineageNode($child, $node->getRootNode()); |
200 | 201 | $node_child = $this->buildLineage($node_child); |
201 | - if($node_child) $node->addChild($family, $node_child); |
|
202 | + if($node_child) { |
|
203 | + $node->addChild($family, $node_child); |
|
204 | + } |
|
202 | 205 | } |
203 | 206 | } |
204 | 207 | } |
@@ -212,12 +215,15 @@ discard block |
||
212 | 215 | $nbNatural++; |
213 | 216 | $node_child = new LineageNode($child, $node->getRootNode()); |
214 | 217 | $node_child = $this->buildLineage($node_child); |
215 | - if($node_child) $node->addChild($family, $node_child); |
|
216 | - } |
|
217 | - else { |
|
218 | + if($node_child) { |
|
219 | + $node->addChild($family, $node_child); |
|
220 | + } |
|
221 | + } else { |
|
218 | 222 | $nbNatural++; |
219 | 223 | $node_child = new LineageNode($child, $node->getRootNode(), $child_surname); |
220 | - if($node_child) $node->addChild($family, $node_child); |
|
224 | + if($node_child) { |
|
225 | + $node->addChild($family, $node_child); |
|
226 | + } |
|
221 | 227 | } |
222 | 228 | } |
223 | 229 | } |
@@ -20,111 +20,111 @@ |
||
20 | 20 | */ |
21 | 21 | class CertificateFileProvider implements CertificateProviderInterface { |
22 | 22 | |
23 | - /** |
|
24 | - * Relative path to the root certificate folder |
|
25 | - * @var string $root_path |
|
26 | - */ |
|
27 | - protected $root_path; |
|
23 | + /** |
|
24 | + * Relative path to the root certificate folder |
|
25 | + * @var string $root_path |
|
26 | + */ |
|
27 | + protected $root_path; |
|
28 | 28 | |
29 | - /** |
|
30 | - * Reference tree |
|
31 | - * @var Tree $tree |
|
32 | - */ |
|
33 | - protected $tree; |
|
29 | + /** |
|
30 | + * Reference tree |
|
31 | + * @var Tree $tree |
|
32 | + */ |
|
33 | + protected $tree; |
|
34 | 34 | |
35 | - /** |
|
36 | - * Cached list of certificates' cities. |
|
37 | - * @var (null|array) $cities_list |
|
38 | - */ |
|
39 | - protected $cities_list = null; |
|
35 | + /** |
|
36 | + * Cached list of certificates' cities. |
|
37 | + * @var (null|array) $cities_list |
|
38 | + */ |
|
39 | + protected $cities_list = null; |
|
40 | 40 | |
41 | - /** |
|
42 | - * Constructor for the File Provider |
|
43 | - * @param string $root_path |
|
44 | - * @param Tree $tree |
|
45 | - */ |
|
46 | - public function __construct($root_path, Tree $tree) { |
|
47 | - $this->root_path = $root_path; |
|
48 | - $this->tree = $tree; |
|
49 | - } |
|
41 | + /** |
|
42 | + * Constructor for the File Provider |
|
43 | + * @param string $root_path |
|
44 | + * @param Tree $tree |
|
45 | + */ |
|
46 | + public function __construct($root_path, Tree $tree) { |
|
47 | + $this->root_path = $root_path; |
|
48 | + $this->tree = $tree; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * {@inhericDoc} |
|
53 | - * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getRealCertificatesDirectory() |
|
54 | - */ |
|
55 | - public function getRealCertificatesDirectory(){ |
|
56 | - return WT_DATA_DIR . $this->root_path; |
|
57 | - } |
|
51 | + /** |
|
52 | + * {@inhericDoc} |
|
53 | + * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getRealCertificatesDirectory() |
|
54 | + */ |
|
55 | + public function getRealCertificatesDirectory(){ |
|
56 | + return WT_DATA_DIR . $this->root_path; |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * {@inhericDoc} |
|
61 | - * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCitiesList() |
|
62 | - */ |
|
63 | - public function getCitiesList(){ |
|
64 | - if(!isset($this->cities_list) || is_null($this->cities_list)){ |
|
65 | - $certdir = $this->getRealCertificatesDirectory(); |
|
66 | - $this->cities_list = array(); |
|
59 | + /** |
|
60 | + * {@inhericDoc} |
|
61 | + * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCitiesList() |
|
62 | + */ |
|
63 | + public function getCitiesList(){ |
|
64 | + if(!isset($this->cities_list) || is_null($this->cities_list)){ |
|
65 | + $certdir = $this->getRealCertificatesDirectory(); |
|
66 | + $this->cities_list = array(); |
|
67 | 67 | |
68 | - $dir = opendir($certdir); |
|
68 | + $dir = opendir($certdir); |
|
69 | 69 | |
70 | - while($entry = readdir($dir)){ |
|
71 | - if($entry != '.' && $entry != '..' && is_dir($certdir.$entry)){ |
|
72 | - $this->cities_list[]= Functions::encodeFileSystemToUtf8($entry); |
|
73 | - } |
|
74 | - } |
|
75 | - sort($this->cities_list); |
|
76 | - } |
|
77 | - return $this->cities_list; |
|
78 | - } |
|
70 | + while($entry = readdir($dir)){ |
|
71 | + if($entry != '.' && $entry != '..' && is_dir($certdir.$entry)){ |
|
72 | + $this->cities_list[]= Functions::encodeFileSystemToUtf8($entry); |
|
73 | + } |
|
74 | + } |
|
75 | + sort($this->cities_list); |
|
76 | + } |
|
77 | + return $this->cities_list; |
|
78 | + } |
|
79 | 79 | |
80 | - /** |
|
81 | - * {@inhericDoc} |
|
82 | - * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesList() |
|
83 | - */ |
|
84 | - public function getCertificatesList($selCity){ |
|
80 | + /** |
|
81 | + * {@inhericDoc} |
|
82 | + * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesList() |
|
83 | + */ |
|
84 | + public function getCertificatesList($selCity){ |
|
85 | 85 | |
86 | - $selCity = Functions::encodeUtf8ToFileSystem($selCity); |
|
86 | + $selCity = Functions::encodeUtf8ToFileSystem($selCity); |
|
87 | 87 | |
88 | - $certdir = $this->getRealCertificatesDirectory(); |
|
89 | - $tabCertif= array(); |
|
88 | + $certdir = $this->getRealCertificatesDirectory(); |
|
89 | + $tabCertif= array(); |
|
90 | 90 | |
91 | - if(is_dir($certdir.$selCity)){ |
|
92 | - $dir=opendir($certdir.$selCity); |
|
93 | - while($entry = readdir($dir)){ |
|
94 | - if($entry!='.' && $entry!='..' && !is_dir($certdir.$entry.'/')){ |
|
95 | - $path = Functions::encodeFileSystemToUtf8($selCity.'/'.$entry); |
|
96 | - $certificate = new Certificate($path, $this->tree, $this); |
|
97 | - if(Functions::isImageTypeSupported($certificate->extension())){ |
|
98 | - $tabCertif[] = $certificate; |
|
99 | - } |
|
100 | - } |
|
101 | - } |
|
102 | - } |
|
103 | - return $tabCertif; |
|
104 | - } |
|
91 | + if(is_dir($certdir.$selCity)){ |
|
92 | + $dir=opendir($certdir.$selCity); |
|
93 | + while($entry = readdir($dir)){ |
|
94 | + if($entry!='.' && $entry!='..' && !is_dir($certdir.$entry.'/')){ |
|
95 | + $path = Functions::encodeFileSystemToUtf8($selCity.'/'.$entry); |
|
96 | + $certificate = new Certificate($path, $this->tree, $this); |
|
97 | + if(Functions::isImageTypeSupported($certificate->extension())){ |
|
98 | + $tabCertif[] = $certificate; |
|
99 | + } |
|
100 | + } |
|
101 | + } |
|
102 | + } |
|
103 | + return $tabCertif; |
|
104 | + } |
|
105 | 105 | |
106 | - /** |
|
107 | - * {@inhericDoc} |
|
108 | - * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesListBeginWith() |
|
109 | - */ |
|
110 | - public function getCertificatesListBeginWith($city, $contains, $limit= 9999){ |
|
111 | - $tabFiles= array(); |
|
112 | - $dirPath= $this->getRealCertificatesDirectory() . Functions::encodeUtf8ToFileSystem($city).'/'; |
|
113 | - $contains = utf8_decode($contains); |
|
114 | - $nbCert = 0; |
|
106 | + /** |
|
107 | + * {@inhericDoc} |
|
108 | + * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesListBeginWith() |
|
109 | + */ |
|
110 | + public function getCertificatesListBeginWith($city, $contains, $limit= 9999){ |
|
111 | + $tabFiles= array(); |
|
112 | + $dirPath= $this->getRealCertificatesDirectory() . Functions::encodeUtf8ToFileSystem($city).'/'; |
|
113 | + $contains = utf8_decode($contains); |
|
114 | + $nbCert = 0; |
|
115 | 115 | |
116 | - if(is_dir($dirPath)){ |
|
117 | - $dir=opendir($dirPath); |
|
118 | - while(($entry = readdir($dir)) && $nbCert < $limit){ |
|
119 | - if($entry!='.' && $entry!='..' && $entry!='Thumbs.db' &&!is_dir($dirPath.$entry.'/') && stripos($entry, $contains)!== false){ |
|
120 | - $tabFiles[]= Functions::encodeFileSystemToUtf8($entry); |
|
121 | - $nbCert++; |
|
122 | - } |
|
123 | - } |
|
124 | - } |
|
125 | - sort($tabFiles); |
|
126 | - return $tabFiles; |
|
127 | - } |
|
116 | + if(is_dir($dirPath)){ |
|
117 | + $dir=opendir($dirPath); |
|
118 | + while(($entry = readdir($dir)) && $nbCert < $limit){ |
|
119 | + if($entry!='.' && $entry!='..' && $entry!='Thumbs.db' &&!is_dir($dirPath.$entry.'/') && stripos($entry, $contains)!== false){ |
|
120 | + $tabFiles[]= Functions::encodeFileSystemToUtf8($entry); |
|
121 | + $nbCert++; |
|
122 | + } |
|
123 | + } |
|
124 | + } |
|
125 | + sort($tabFiles); |
|
126 | + return $tabFiles; |
|
127 | + } |
|
128 | 128 | |
129 | 129 | } |
130 | 130 |
@@ -52,24 +52,24 @@ discard block |
||
52 | 52 | * {@inhericDoc} |
53 | 53 | * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getRealCertificatesDirectory() |
54 | 54 | */ |
55 | - public function getRealCertificatesDirectory(){ |
|
56 | - return WT_DATA_DIR . $this->root_path; |
|
55 | + public function getRealCertificatesDirectory() { |
|
56 | + return WT_DATA_DIR.$this->root_path; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
60 | 60 | * {@inhericDoc} |
61 | 61 | * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCitiesList() |
62 | 62 | */ |
63 | - public function getCitiesList(){ |
|
64 | - if(!isset($this->cities_list) || is_null($this->cities_list)){ |
|
63 | + public function getCitiesList() { |
|
64 | + if (!isset($this->cities_list) || is_null($this->cities_list)) { |
|
65 | 65 | $certdir = $this->getRealCertificatesDirectory(); |
66 | 66 | $this->cities_list = array(); |
67 | 67 | |
68 | 68 | $dir = opendir($certdir); |
69 | 69 | |
70 | - while($entry = readdir($dir)){ |
|
71 | - if($entry != '.' && $entry != '..' && is_dir($certdir.$entry)){ |
|
72 | - $this->cities_list[]= Functions::encodeFileSystemToUtf8($entry); |
|
70 | + while ($entry = readdir($dir)) { |
|
71 | + if ($entry != '.' && $entry != '..' && is_dir($certdir.$entry)) { |
|
72 | + $this->cities_list[] = Functions::encodeFileSystemToUtf8($entry); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | sort($this->cities_list); |
@@ -81,21 +81,21 @@ discard block |
||
81 | 81 | * {@inhericDoc} |
82 | 82 | * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesList() |
83 | 83 | */ |
84 | - public function getCertificatesList($selCity){ |
|
84 | + public function getCertificatesList($selCity) { |
|
85 | 85 | |
86 | 86 | $selCity = Functions::encodeUtf8ToFileSystem($selCity); |
87 | 87 | |
88 | 88 | $certdir = $this->getRealCertificatesDirectory(); |
89 | - $tabCertif= array(); |
|
89 | + $tabCertif = array(); |
|
90 | 90 | |
91 | - if(is_dir($certdir.$selCity)){ |
|
92 | - $dir=opendir($certdir.$selCity); |
|
93 | - while($entry = readdir($dir)){ |
|
94 | - if($entry!='.' && $entry!='..' && !is_dir($certdir.$entry.'/')){ |
|
91 | + if (is_dir($certdir.$selCity)) { |
|
92 | + $dir = opendir($certdir.$selCity); |
|
93 | + while ($entry = readdir($dir)) { |
|
94 | + if ($entry != '.' && $entry != '..' && !is_dir($certdir.$entry.'/')) { |
|
95 | 95 | $path = Functions::encodeFileSystemToUtf8($selCity.'/'.$entry); |
96 | 96 | $certificate = new Certificate($path, $this->tree, $this); |
97 | - if(Functions::isImageTypeSupported($certificate->extension())){ |
|
98 | - $tabCertif[] = $certificate; |
|
97 | + if (Functions::isImageTypeSupported($certificate->extension())) { |
|
98 | + $tabCertif[] = $certificate; |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
@@ -107,17 +107,17 @@ discard block |
||
107 | 107 | * {@inhericDoc} |
108 | 108 | * @see \MyArtJaub\Webtrees\Module\Certificates\Model\CertificateProviderInterface::getCertificatesListBeginWith() |
109 | 109 | */ |
110 | - public function getCertificatesListBeginWith($city, $contains, $limit= 9999){ |
|
111 | - $tabFiles= array(); |
|
112 | - $dirPath= $this->getRealCertificatesDirectory() . Functions::encodeUtf8ToFileSystem($city).'/'; |
|
110 | + public function getCertificatesListBeginWith($city, $contains, $limit = 9999) { |
|
111 | + $tabFiles = array(); |
|
112 | + $dirPath = $this->getRealCertificatesDirectory().Functions::encodeUtf8ToFileSystem($city).'/'; |
|
113 | 113 | $contains = utf8_decode($contains); |
114 | 114 | $nbCert = 0; |
115 | 115 | |
116 | - if(is_dir($dirPath)){ |
|
117 | - $dir=opendir($dirPath); |
|
118 | - while(($entry = readdir($dir)) && $nbCert < $limit){ |
|
119 | - if($entry!='.' && $entry!='..' && $entry!='Thumbs.db' &&!is_dir($dirPath.$entry.'/') && stripos($entry, $contains)!== false){ |
|
120 | - $tabFiles[]= Functions::encodeFileSystemToUtf8($entry); |
|
116 | + if (is_dir($dirPath)) { |
|
117 | + $dir = opendir($dirPath); |
|
118 | + while (($entry = readdir($dir)) && $nbCert < $limit) { |
|
119 | + if ($entry != '.' && $entry != '..' && $entry != 'Thumbs.db' && !is_dir($dirPath.$entry.'/') && stripos($entry, $contains) !== false) { |
|
120 | + $tabFiles[] = Functions::encodeFileSystemToUtf8($entry); |
|
121 | 121 | $nbCert++; |
122 | 122 | } |
123 | 123 | } |
@@ -19,76 +19,76 @@ |
||
19 | 19 | * Welcome Block Module. |
20 | 20 | */ |
21 | 21 | class WelcomeBlockModule extends AbstractModule |
22 | - implements ModuleBlockInterface |
|
22 | + implements ModuleBlockInterface |
|
23 | 23 | { |
24 | - /** @var string For custom modules - link for support, upgrades, etc. */ |
|
25 | - const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
24 | + /** @var string For custom modules - link for support, upgrades, etc. */ |
|
25 | + const CUSTOM_WEBSITE = 'https://github.com/jon48/webtrees-lib'; |
|
26 | 26 | |
27 | - /** |
|
28 | - * {@inhericDoc} |
|
29 | - */ |
|
30 | - public function getTitle() { |
|
31 | - return /* I18N: Name of the “WelcomeBlock” module */ I18N::translate('MyArtJaub Welcome Block'); |
|
32 | - } |
|
27 | + /** |
|
28 | + * {@inhericDoc} |
|
29 | + */ |
|
30 | + public function getTitle() { |
|
31 | + return /* I18N: Name of the “WelcomeBlock” module */ I18N::translate('MyArtJaub Welcome Block'); |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * {@inhericDoc} |
|
36 | - */ |
|
37 | - public function getDescription() { |
|
38 | - return /* I18N: Description of the “WelcomeBlock” module */ I18N::translate('The MyArtJaub Welcome block welcomes the visitor to the site, allows a quick login to the site, and displays statistics on visits.'); |
|
39 | - } |
|
34 | + /** |
|
35 | + * {@inhericDoc} |
|
36 | + */ |
|
37 | + public function getDescription() { |
|
38 | + return /* I18N: Description of the “WelcomeBlock” module */ I18N::translate('The MyArtJaub Welcome block welcomes the visitor to the site, allows a quick login to the site, and displays statistics on visits.'); |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * {@inhericDoc} |
|
43 | - */ |
|
44 | - public function modAction($mod_action) { |
|
45 | - \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
46 | - } |
|
41 | + /** |
|
42 | + * {@inhericDoc} |
|
43 | + */ |
|
44 | + public function modAction($mod_action) { |
|
45 | + \MyArtJaub\Webtrees\Mvc\Dispatcher::getInstance()->handle($this, $mod_action); |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * {@inhericDoc} |
|
50 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock() |
|
51 | - */ |
|
48 | + /** |
|
49 | + * {@inhericDoc} |
|
50 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::getBlock() |
|
51 | + */ |
|
52 | 52 | public function getBlock($block_id, $template = true, $cfg = array()) { |
53 | - global $controller, $WT_TREE; |
|
53 | + global $controller, $WT_TREE; |
|
54 | 54 | |
55 | - $wb_controller = new WelcomeBlockController($this); |
|
56 | - return $wb_controller->index($controller, $WT_TREE, $block_id, $template); |
|
57 | - } |
|
55 | + $wb_controller = new WelcomeBlockController($this); |
|
56 | + return $wb_controller->index($controller, $WT_TREE, $block_id, $template); |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * {@inhericDoc} |
|
61 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::loadAjax() |
|
62 | - */ |
|
63 | - public function loadAjax() { |
|
64 | - return false; |
|
65 | - } |
|
59 | + /** |
|
60 | + * {@inhericDoc} |
|
61 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::loadAjax() |
|
62 | + */ |
|
63 | + public function loadAjax() { |
|
64 | + return false; |
|
65 | + } |
|
66 | 66 | |
67 | - /** |
|
68 | - * {@inhericDoc} |
|
69 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isUserBlock() |
|
70 | - */ |
|
71 | - public function isUserBlock() { |
|
72 | - return false; |
|
73 | - } |
|
67 | + /** |
|
68 | + * {@inhericDoc} |
|
69 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isUserBlock() |
|
70 | + */ |
|
71 | + public function isUserBlock() { |
|
72 | + return false; |
|
73 | + } |
|
74 | 74 | |
75 | - /** |
|
76 | - * {@inhericDoc} |
|
77 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isGedcomBlock() |
|
78 | - */ |
|
79 | - public function isGedcomBlock() { |
|
80 | - return true; |
|
81 | - } |
|
75 | + /** |
|
76 | + * {@inhericDoc} |
|
77 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::isGedcomBlock() |
|
78 | + */ |
|
79 | + public function isGedcomBlock() { |
|
80 | + return true; |
|
81 | + } |
|
82 | 82 | |
83 | - /** |
|
84 | - * {@inhericDoc} |
|
85 | - * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::configureBlock() |
|
86 | - */ |
|
87 | - public function configureBlock($block_id) { |
|
83 | + /** |
|
84 | + * {@inhericDoc} |
|
85 | + * @see \Fisharebest\Webtrees\Module\ModuleBlockInterface::configureBlock() |
|
86 | + */ |
|
87 | + public function configureBlock($block_id) { |
|
88 | 88 | |
89 | - $wb_controller = new WelcomeBlockController($this); |
|
90 | - return $wb_controller->config($block_id); |
|
91 | - } |
|
89 | + $wb_controller = new WelcomeBlockController($this); |
|
90 | + return $wb_controller->config($block_id); |
|
91 | + } |
|
92 | 92 | |
93 | 93 | } |
94 | 94 | |
95 | 95 | \ No newline at end of file |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * webtrees-lib: MyArtJaub library for webtrees |
|
4 | - * |
|
5 | - * @package MyArtJaub\Webtrees |
|
6 | - * @subpackage Hook |
|
7 | - * @author Jonathan Jaubart <[email protected]> |
|
8 | - * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
9 | - * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
10 | - */ |
|
3 | + * webtrees-lib: MyArtJaub library for webtrees |
|
4 | + * |
|
5 | + * @package MyArtJaub\Webtrees |
|
6 | + * @subpackage Hook |
|
7 | + * @author Jonathan Jaubart <[email protected]> |
|
8 | + * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
9 | + * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
10 | + */ |
|
11 | 11 | namespace MyArtJaub\Webtrees\Hook\HookInterfaces; |
12 | 12 | |
13 | 13 | /** |
@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | */ |
16 | 16 | interface PageFooterExtender { |
17 | 17 | |
18 | - /** |
|
19 | - * Get HTML code for extending the footer of a page. |
|
20 | - * |
|
21 | - * @return string HTML code extension |
|
22 | - */ |
|
23 | - public function hPrintFooter(); |
|
18 | + /** |
|
19 | + * Get HTML code for extending the footer of a page. |
|
20 | + * |
|
21 | + * @return string HTML code extension |
|
22 | + */ |
|
23 | + public function hPrintFooter(); |
|
24 | 24 | |
25 | 25 | } |
26 | 26 |
@@ -1,13 +1,13 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * webtrees-lib: MyArtJaub library for webtrees |
|
4 | - * |
|
5 | - * @package MyArtJaub\Webtrees |
|
6 | - * @subpackage Hook |
|
7 | - * @author Jonathan Jaubart <[email protected]> |
|
8 | - * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
9 | - * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
10 | - */ |
|
3 | + * webtrees-lib: MyArtJaub library for webtrees |
|
4 | + * |
|
5 | + * @package MyArtJaub\Webtrees |
|
6 | + * @subpackage Hook |
|
7 | + * @author Jonathan Jaubart <[email protected]> |
|
8 | + * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
9 | + * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
10 | + */ |
|
11 | 11 | namespace MyArtJaub\Webtrees\Hook\HookInterfaces; |
12 | 12 | |
13 | 13 | /** |
@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | */ |
16 | 16 | interface PageHeaderExtender { |
17 | 17 | |
18 | - /** |
|
19 | - * Get HTML code for extending the header of a page. |
|
20 | - * |
|
21 | - * @return string HTML code extension |
|
22 | - */ |
|
23 | - public function hPrintHeader(); |
|
18 | + /** |
|
19 | + * Get HTML code for extending the header of a page. |
|
20 | + * |
|
21 | + * @return string HTML code extension |
|
22 | + */ |
|
23 | + public function hPrintHeader(); |
|
24 | 24 | |
25 | 25 | } |
26 | 26 |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * webtrees-lib: MyArtJaub library for webtrees |
|
4 | - * |
|
5 | - * @package MyArtJaub\Webtrees |
|
6 | - * @subpackage Hook |
|
7 | - * @author Jonathan Jaubart <[email protected]> |
|
8 | - * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
9 | - * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
10 | - */ |
|
3 | + * webtrees-lib: MyArtJaub library for webtrees |
|
4 | + * |
|
5 | + * @package MyArtJaub\Webtrees |
|
6 | + * @subpackage Hook |
|
7 | + * @author Jonathan Jaubart <[email protected]> |
|
8 | + * @copyright Copyright (c) 2011-2016, Jonathan Jaubart |
|
9 | + * @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
|
10 | + */ |
|
11 | 11 | namespace MyArtJaub\Webtrees\Hook; |
12 | 12 | |
13 | 13 | use \Fisharebest\Webtrees as fw; |
@@ -32,158 +32,158 @@ discard block |
||
32 | 32 | */ |
33 | 33 | class CertificateController extends MvcController |
34 | 34 | { |
35 | - /** |
|
36 | - * Certificate Provider |
|
37 | - * @var CertificateProviderInterface $provider |
|
38 | - */ |
|
39 | - protected $provider; |
|
35 | + /** |
|
36 | + * Certificate Provider |
|
37 | + * @var CertificateProviderInterface $provider |
|
38 | + */ |
|
39 | + protected $provider; |
|
40 | 40 | |
41 | - /** |
|
42 | - * Constructor for Certificate controller |
|
43 | - * @param AbstractModule $module |
|
44 | - */ |
|
45 | - public function __construct(AbstractModule $module) { |
|
46 | - parent::__construct($module); |
|
47 | - |
|
48 | - $this->provider = $this->module->getProvider(); |
|
49 | - } |
|
41 | + /** |
|
42 | + * Constructor for Certificate controller |
|
43 | + * @param AbstractModule $module |
|
44 | + */ |
|
45 | + public function __construct(AbstractModule $module) { |
|
46 | + parent::__construct($module); |
|
47 | + |
|
48 | + $this->provider = $this->module->getProvider(); |
|
49 | + } |
|
50 | 50 | |
51 | 51 | |
52 | - /** |
|
53 | - * Pages |
|
54 | - */ |
|
55 | - |
|
56 | - /** |
|
57 | - * Certificate@index |
|
58 | - */ |
|
59 | - public function index() { |
|
60 | - global $WT_TREE; |
|
61 | - |
|
62 | - $controller = new PageController(); |
|
63 | - $controller |
|
64 | - ->setPageTitle(I18N::translate('Certificate')) |
|
65 | - ->restrictAccess( |
|
66 | - $this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE) |
|
67 | - ); |
|
68 | - |
|
69 | - $cid = Filter::get('cid'); |
|
70 | - |
|
71 | - $certificate = null; |
|
72 | - if(!empty($cid) && strlen($cid) > 22){ |
|
73 | - $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
74 | - } |
|
75 | - |
|
76 | - $data = new ViewBag(); |
|
77 | - $data->set('title', $controller->getPageTitle()); |
|
78 | - |
|
79 | - $data->set('has_certif', false); |
|
80 | - if($certificate) { |
|
81 | - $controller->restrictAccess($certificate->canShow()); |
|
82 | - $data->set('title', $certificate->getTitle()); |
|
83 | - $data->set('has_certif', true); |
|
84 | - $data->set('certificate', $certificate); |
|
52 | + /** |
|
53 | + * Pages |
|
54 | + */ |
|
55 | + |
|
56 | + /** |
|
57 | + * Certificate@index |
|
58 | + */ |
|
59 | + public function index() { |
|
60 | + global $WT_TREE; |
|
61 | + |
|
62 | + $controller = new PageController(); |
|
63 | + $controller |
|
64 | + ->setPageTitle(I18N::translate('Certificate')) |
|
65 | + ->restrictAccess( |
|
66 | + $this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE) |
|
67 | + ); |
|
68 | + |
|
69 | + $cid = Filter::get('cid'); |
|
70 | + |
|
71 | + $certificate = null; |
|
72 | + if(!empty($cid) && strlen($cid) > 22){ |
|
73 | + $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
74 | + } |
|
75 | + |
|
76 | + $data = new ViewBag(); |
|
77 | + $data->set('title', $controller->getPageTitle()); |
|
78 | + |
|
79 | + $data->set('has_certif', false); |
|
80 | + if($certificate) { |
|
81 | + $controller->restrictAccess($certificate->canShow()); |
|
82 | + $data->set('title', $certificate->getTitle()); |
|
83 | + $data->set('has_certif', true); |
|
84 | + $data->set('certificate', $certificate); |
|
85 | 85 | |
86 | - $data->set( |
|
87 | - 'url_certif_city', |
|
88 | - 'module.php?mod=' . Constants::MODULE_MAJ_CERTIF_NAME . |
|
89 | - '&mod_action=Certificate@listAll' . |
|
90 | - '&ged=' . $WT_TREE->getNameUrl() . |
|
91 | - '&city=' . Functions::encryptToSafeBase64($certificate->getCity()) |
|
92 | - ); |
|
86 | + $data->set( |
|
87 | + 'url_certif_city', |
|
88 | + 'module.php?mod=' . Constants::MODULE_MAJ_CERTIF_NAME . |
|
89 | + '&mod_action=Certificate@listAll' . |
|
90 | + '&ged=' . $WT_TREE->getNameUrl() . |
|
91 | + '&city=' . Functions::encryptToSafeBase64($certificate->getCity()) |
|
92 | + ); |
|
93 | 93 | |
94 | - $controller->addInlineJavascript(' |
|
94 | + $controller->addInlineJavascript(' |
|
95 | 95 | jQuery("#certificate-tabs").tabs(); |
96 | 96 | jQuery("#certificate-tabs").css("visibility", "visible"); |
97 | 97 | '); |
98 | 98 | |
99 | - $data->set('has_linked_indis', false); |
|
100 | - $data->set('has_linked_fams', false); |
|
99 | + $data->set('has_linked_indis', false); |
|
100 | + $data->set('has_linked_fams', false); |
|
101 | 101 | |
102 | - $linked_indis = $certificate->linkedIndividuals(); |
|
103 | - $linked_fams = $certificate->linkedFamilies(); |
|
102 | + $linked_indis = $certificate->linkedIndividuals(); |
|
103 | + $linked_fams = $certificate->linkedFamilies(); |
|
104 | 104 | |
105 | - if($linked_indis && count($linked_indis) > 0) { |
|
106 | - $data->set('has_linked_indis', true); |
|
107 | - $data->set('linked_indis', $linked_indis); |
|
108 | - } |
|
105 | + if($linked_indis && count($linked_indis) > 0) { |
|
106 | + $data->set('has_linked_indis', true); |
|
107 | + $data->set('linked_indis', $linked_indis); |
|
108 | + } |
|
109 | 109 | |
110 | - if(!empty($linked_fams)) { |
|
111 | - $data->set('has_linked_fams', true); |
|
112 | - $data->set('linked_fams', $linked_fams); |
|
113 | - } |
|
114 | - } |
|
115 | - |
|
116 | - ViewFactory::make('Certificate', $this, $controller, $data)->render(); |
|
117 | - } |
|
110 | + if(!empty($linked_fams)) { |
|
111 | + $data->set('has_linked_fams', true); |
|
112 | + $data->set('linked_fams', $linked_fams); |
|
113 | + } |
|
114 | + } |
|
115 | + |
|
116 | + ViewFactory::make('Certificate', $this, $controller, $data)->render(); |
|
117 | + } |
|
118 | 118 | |
119 | - /** |
|
120 | - * Certificate@image |
|
121 | - */ |
|
122 | - public function image() { |
|
123 | - global $WT_TREE; |
|
119 | + /** |
|
120 | + * Certificate@image |
|
121 | + */ |
|
122 | + public function image() { |
|
123 | + global $WT_TREE; |
|
124 | 124 | |
125 | - $cid = Filter::get('cid'); |
|
126 | - $certificate = null; |
|
127 | - if(!empty($cid)) $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
125 | + $cid = Filter::get('cid'); |
|
126 | + $certificate = null; |
|
127 | + if(!empty($cid)) $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
128 | 128 | |
129 | - $imageBuilder = new ImageBuilder($certificate); |
|
129 | + $imageBuilder = new ImageBuilder($certificate); |
|
130 | 130 | |
131 | - if (!empty(Filter::get('cb'))) { |
|
132 | - $imageBuilder->setExpireOffset($imageBuilder->getExpireOffset() * 7); |
|
133 | - } |
|
131 | + if (!empty(Filter::get('cb'))) { |
|
132 | + $imageBuilder->setExpireOffset($imageBuilder->getExpireOffset() * 7); |
|
133 | + } |
|
134 | 134 | |
135 | - $imageBuilder |
|
136 | - ->setShowWatermark(Auth::accessLevel($WT_TREE) >= $this->module->getSetting('MAJ_SHOW_NO_WATERMARK', Auth::PRIV_HIDE)) |
|
137 | - ->setFontMaxSize($this->module->getSetting('MAJ_WM_FONT_MAXSIZE', 18)) |
|
138 | - ->setFontColor($this->module->getSetting('MAJ_WM_FONT_COLOR', '#4D6DF3')) |
|
139 | - ; |
|
135 | + $imageBuilder |
|
136 | + ->setShowWatermark(Auth::accessLevel($WT_TREE) >= $this->module->getSetting('MAJ_SHOW_NO_WATERMARK', Auth::PRIV_HIDE)) |
|
137 | + ->setFontMaxSize($this->module->getSetting('MAJ_WM_FONT_MAXSIZE', 18)) |
|
138 | + ->setFontColor($this->module->getSetting('MAJ_WM_FONT_COLOR', '#4D6DF3')) |
|
139 | + ; |
|
140 | 140 | |
141 | - $imageBuilder->render(); |
|
141 | + $imageBuilder->render(); |
|
142 | 142 | |
143 | - } |
|
143 | + } |
|
144 | 144 | |
145 | - /** |
|
146 | - * Certificate@listAll |
|
147 | - */ |
|
148 | - public function listAll() { |
|
149 | - global $WT_TREE; |
|
150 | - |
|
151 | - $controller = new PageController(); |
|
152 | - $controller |
|
153 | - ->setPageTitle(I18N::translate('Certificates')) |
|
154 | - ->restrictAccess( |
|
155 | - $this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE) |
|
156 | - ); |
|
157 | - |
|
158 | - $city = Filter::get('city'); |
|
159 | - |
|
160 | - if(!empty($city) && strlen($city) > 22){ |
|
161 | - $city = Functions::decryptFromSafeBase64($city); |
|
162 | - $controller->setPageTitle(I18N::translate('Certificates for %s', $city)); |
|
163 | - } |
|
164 | - |
|
165 | - $data = new ViewBag(); |
|
166 | - $data->set('title', $controller->getPageTitle()); |
|
167 | - $data->set('url_module', $this->module->getName()); |
|
168 | - $data->set('url_action', 'Certificate@listAll'); |
|
169 | - $data->set('url_ged', $WT_TREE->getNameUrl()); |
|
170 | - |
|
171 | - $data->set('cities', $this->provider->getCitiesList()); |
|
172 | - $data->set('selected_city', $city); |
|
173 | - |
|
174 | - $data->set('has_list', false); |
|
175 | - if(!empty($city)) { |
|
176 | - $table_id = 'table-certiflist-' . Uuid::uuid4(); |
|
145 | + /** |
|
146 | + * Certificate@listAll |
|
147 | + */ |
|
148 | + public function listAll() { |
|
149 | + global $WT_TREE; |
|
150 | + |
|
151 | + $controller = new PageController(); |
|
152 | + $controller |
|
153 | + ->setPageTitle(I18N::translate('Certificates')) |
|
154 | + ->restrictAccess( |
|
155 | + $this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE) |
|
156 | + ); |
|
157 | + |
|
158 | + $city = Filter::get('city'); |
|
159 | + |
|
160 | + if(!empty($city) && strlen($city) > 22){ |
|
161 | + $city = Functions::decryptFromSafeBase64($city); |
|
162 | + $controller->setPageTitle(I18N::translate('Certificates for %s', $city)); |
|
163 | + } |
|
164 | + |
|
165 | + $data = new ViewBag(); |
|
166 | + $data->set('title', $controller->getPageTitle()); |
|
167 | + $data->set('url_module', $this->module->getName()); |
|
168 | + $data->set('url_action', 'Certificate@listAll'); |
|
169 | + $data->set('url_ged', $WT_TREE->getNameUrl()); |
|
170 | + |
|
171 | + $data->set('cities', $this->provider->getCitiesList()); |
|
172 | + $data->set('selected_city', $city); |
|
173 | + |
|
174 | + $data->set('has_list', false); |
|
175 | + if(!empty($city)) { |
|
176 | + $table_id = 'table-certiflist-' . Uuid::uuid4(); |
|
177 | 177 | |
178 | - $certif_list = $this->provider->getCertificatesList($city); |
|
179 | - if(!empty($certif_list)) { |
|
180 | - $data->set('has_list', true); |
|
181 | - $data->set('table_id', $table_id); |
|
182 | - $data->set('certificate_list', $certif_list); |
|
178 | + $certif_list = $this->provider->getCertificatesList($city); |
|
179 | + if(!empty($certif_list)) { |
|
180 | + $data->set('has_list', true); |
|
181 | + $data->set('table_id', $table_id); |
|
182 | + $data->set('certificate_list', $certif_list); |
|
183 | 183 | |
184 | - $controller |
|
185 | - ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
186 | - ->addInlineJavascript(' |
|
184 | + $controller |
|
185 | + ->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL) |
|
186 | + ->addInlineJavascript(' |
|
187 | 187 | /* Initialise datatables */ |
188 | 188 | jQuery.fn.dataTableExt.oSort["unicode-asc" ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))}; |
189 | 189 | jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))}; |
@@ -210,29 +210,29 @@ discard block |
||
210 | 210 | jQuery(".certificate-list").css("visibility", "visible"); |
211 | 211 | jQuery(".loading-image").css("display", "none"); |
212 | 212 | '); |
213 | - } |
|
214 | - } |
|
213 | + } |
|
214 | + } |
|
215 | 215 | |
216 | - ViewFactory::make('CertificatesList', $this, $controller, $data)->render(); |
|
216 | + ViewFactory::make('CertificatesList', $this, $controller, $data)->render(); |
|
217 | 217 | |
218 | - } |
|
218 | + } |
|
219 | 219 | |
220 | - /** |
|
221 | - * Certificate@autocomplete |
|
222 | - */ |
|
223 | - public function autocomplete() { |
|
224 | - global $WT_TREE; |
|
220 | + /** |
|
221 | + * Certificate@autocomplete |
|
222 | + */ |
|
223 | + public function autocomplete() { |
|
224 | + global $WT_TREE; |
|
225 | 225 | |
226 | - $controller = new JsonController(); |
|
226 | + $controller = new JsonController(); |
|
227 | 227 | |
228 | - $city = Filter::get('city'); |
|
229 | - $contains = Filter::get('term'); |
|
228 | + $city = Filter::get('city'); |
|
229 | + $contains = Filter::get('term'); |
|
230 | 230 | |
231 | - $controller |
|
232 | - ->restrictAccess(Auth::isEditor($WT_TREE) && !empty($city) && !empty($contains)) |
|
233 | - ->pageHeader(); |
|
231 | + $controller |
|
232 | + ->restrictAccess(Auth::isEditor($WT_TREE) && !empty($city) && !empty($contains)) |
|
233 | + ->pageHeader(); |
|
234 | 234 | |
235 | - $listCert = $this->provider->getCertificatesListBeginWith($city, $contains); |
|
236 | - echo \Zend_Json::encode($listCert); |
|
237 | - } |
|
235 | + $listCert = $this->provider->getCertificatesListBeginWith($city, $contains); |
|
236 | + echo \Zend_Json::encode($listCert); |
|
237 | + } |
|
238 | 238 | } |
239 | 239 | \ No newline at end of file |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $cid = Filter::get('cid'); |
70 | 70 | |
71 | 71 | $certificate = null; |
72 | - if(!empty($cid) && strlen($cid) > 22){ |
|
72 | + if (!empty($cid) && strlen($cid) > 22) { |
|
73 | 73 | $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
74 | 74 | } |
75 | 75 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $data->set('title', $controller->getPageTitle()); |
78 | 78 | |
79 | 79 | $data->set('has_certif', false); |
80 | - if($certificate) { |
|
80 | + if ($certificate) { |
|
81 | 81 | $controller->restrictAccess($certificate->canShow()); |
82 | 82 | $data->set('title', $certificate->getTitle()); |
83 | 83 | $data->set('has_certif', true); |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | |
86 | 86 | $data->set( |
87 | 87 | 'url_certif_city', |
88 | - 'module.php?mod=' . Constants::MODULE_MAJ_CERTIF_NAME . |
|
89 | - '&mod_action=Certificate@listAll' . |
|
90 | - '&ged=' . $WT_TREE->getNameUrl() . |
|
91 | - '&city=' . Functions::encryptToSafeBase64($certificate->getCity()) |
|
88 | + 'module.php?mod='.Constants::MODULE_MAJ_CERTIF_NAME. |
|
89 | + '&mod_action=Certificate@listAll'. |
|
90 | + '&ged='.$WT_TREE->getNameUrl(). |
|
91 | + '&city='.Functions::encryptToSafeBase64($certificate->getCity()) |
|
92 | 92 | ); |
93 | 93 | |
94 | 94 | $controller->addInlineJavascript(' |
@@ -102,12 +102,12 @@ discard block |
||
102 | 102 | $linked_indis = $certificate->linkedIndividuals(); |
103 | 103 | $linked_fams = $certificate->linkedFamilies(); |
104 | 104 | |
105 | - if($linked_indis && count($linked_indis) > 0) { |
|
105 | + if ($linked_indis && count($linked_indis) > 0) { |
|
106 | 106 | $data->set('has_linked_indis', true); |
107 | 107 | $data->set('linked_indis', $linked_indis); |
108 | 108 | } |
109 | 109 | |
110 | - if(!empty($linked_fams)) { |
|
110 | + if (!empty($linked_fams)) { |
|
111 | 111 | $data->set('has_linked_fams', true); |
112 | 112 | $data->set('linked_fams', $linked_fams); |
113 | 113 | } |
@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | public function image() { |
123 | 123 | global $WT_TREE; |
124 | 124 | |
125 | - $cid = Filter::get('cid'); |
|
125 | + $cid = Filter::get('cid'); |
|
126 | 126 | $certificate = null; |
127 | - if(!empty($cid)) $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
127 | + if (!empty($cid)) $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
128 | 128 | |
129 | 129 | $imageBuilder = new ImageBuilder($certificate); |
130 | 130 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | |
158 | 158 | $city = Filter::get('city'); |
159 | 159 | |
160 | - if(!empty($city) && strlen($city) > 22){ |
|
160 | + if (!empty($city) && strlen($city) > 22) { |
|
161 | 161 | $city = Functions::decryptFromSafeBase64($city); |
162 | 162 | $controller->setPageTitle(I18N::translate('Certificates for %s', $city)); |
163 | 163 | } |
@@ -172,11 +172,11 @@ discard block |
||
172 | 172 | $data->set('selected_city', $city); |
173 | 173 | |
174 | 174 | $data->set('has_list', false); |
175 | - if(!empty($city)) { |
|
176 | - $table_id = 'table-certiflist-' . Uuid::uuid4(); |
|
175 | + if (!empty($city)) { |
|
176 | + $table_id = 'table-certiflist-'.Uuid::uuid4(); |
|
177 | 177 | |
178 | 178 | $certif_list = $this->provider->getCertificatesList($city); |
179 | - if(!empty($certif_list)) { |
|
179 | + if (!empty($certif_list)) { |
|
180 | 180 | $data->set('has_list', true); |
181 | 181 | $data->set('table_id', $table_id); |
182 | 182 | $data->set('certificate_list', $certif_list); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | jQuery.fn.dataTableExt.oSort["num-html-desc"]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a>b) ? -1 : (a<b ? 1 : 0);}; |
192 | 192 | |
193 | 193 | jQuery("#'.$table_id.'").dataTable( { |
194 | - dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', |
|
194 | + dom: \'<"H"<"filtersH_' . $table_id.'">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_'.$table_id.'">>\', |
|
195 | 195 | '.I18N::datatablesI18N().', |
196 | 196 | jQueryUI: true, |
197 | 197 | autoWidth: false, |
@@ -124,7 +124,9 @@ |
||
124 | 124 | |
125 | 125 | $cid = Filter::get('cid'); |
126 | 126 | $certificate = null; |
127 | - if(!empty($cid)) $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
127 | + if(!empty($cid)) { |
|
128 | + $certificate = Certificate::getInstance($cid, $WT_TREE, null, $this->provider); |
|
129 | + } |
|
128 | 130 | |
129 | 131 | $imageBuilder = new ImageBuilder($certificate); |
130 | 132 |
@@ -16,51 +16,51 @@ |
||
16 | 16 | */ |
17 | 17 | interface HookProviderInterface { |
18 | 18 | |
19 | - /** |
|
20 | - * Return an instance of the hook linked to the specifed function / context |
|
21 | - * |
|
22 | - * @param string $hook_function |
|
23 | - * @param string $hook_context |
|
24 | - * @return Hook |
|
25 | - */ |
|
26 | - public function get($hook_function, $hook_context = null); |
|
19 | + /** |
|
20 | + * Return an instance of the hook linked to the specifed function / context |
|
21 | + * |
|
22 | + * @param string $hook_function |
|
23 | + * @param string $hook_context |
|
24 | + * @return Hook |
|
25 | + */ |
|
26 | + public function get($hook_function, $hook_context = null); |
|
27 | 27 | |
28 | - /** |
|
29 | - * Return whether the Hook module is active and the table has been created. |
|
30 | - * |
|
31 | - * @uses \MyArtJaub\Webtrees\Module\ModuleManager to check if the module is operational |
|
32 | - * @return bool True if module active and table created, false otherwise |
|
33 | - */ |
|
34 | - public function isModuleOperational(); |
|
28 | + /** |
|
29 | + * Return whether the Hook module is active and the table has been created. |
|
30 | + * |
|
31 | + * @uses \MyArtJaub\Webtrees\Module\ModuleManager to check if the module is operational |
|
32 | + * @return bool True if module active and table created, false otherwise |
|
33 | + */ |
|
34 | + public function isModuleOperational(); |
|
35 | 35 | |
36 | - /** |
|
37 | - * Get the list of possible hooks in the list of modules files. |
|
38 | - * A hook will be registered: |
|
39 | - * - for all modules already registered in Webtrees |
|
40 | - * - if the module implements HookSubscriberInterface |
|
41 | - * - if the method exist within the module |
|
42 | - * |
|
43 | - * @return Array List of possible hooks, with the priority |
|
44 | - */ |
|
45 | - public function getPossibleHooks(); |
|
36 | + /** |
|
37 | + * Get the list of possible hooks in the list of modules files. |
|
38 | + * A hook will be registered: |
|
39 | + * - for all modules already registered in Webtrees |
|
40 | + * - if the module implements HookSubscriberInterface |
|
41 | + * - if the method exist within the module |
|
42 | + * |
|
43 | + * @return Array List of possible hooks, with the priority |
|
44 | + */ |
|
45 | + public function getPossibleHooks(); |
|
46 | 46 | |
47 | - /** |
|
48 | - * Get the list of hooks intalled in webtrees, with their id, status and priority. |
|
49 | - * |
|
50 | - * @return array List of installed hooks |
|
51 | - */ |
|
52 | - public function getRawInstalledHooks(); |
|
47 | + /** |
|
48 | + * Get the list of hooks intalled in webtrees, with their id, status and priority. |
|
49 | + * |
|
50 | + * @return array List of installed hooks |
|
51 | + */ |
|
52 | + public function getRawInstalledHooks(); |
|
53 | 53 | |
54 | - /** |
|
55 | - * Get the list of hooks intalled in webtrees, with their id, status and priority. |
|
56 | - * |
|
57 | - * @return Array List of installed hooks, with id, status and priority |
|
58 | - */ |
|
59 | - public function getInstalledHooks(); |
|
54 | + /** |
|
55 | + * Get the list of hooks intalled in webtrees, with their id, status and priority. |
|
56 | + * |
|
57 | + * @return Array List of installed hooks, with id, status and priority |
|
58 | + */ |
|
59 | + public function getInstalledHooks(); |
|
60 | 60 | |
61 | - /** |
|
62 | - * Update the list of hooks, identifying missing ones and removed ones. |
|
63 | - */ |
|
64 | - public function updateHooks(); |
|
61 | + /** |
|
62 | + * Update the list of hooks, identifying missing ones and removed ones. |
|
63 | + */ |
|
64 | + public function updateHooks(); |
|
65 | 65 | |
66 | 66 | } |
67 | 67 | \ No newline at end of file |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @param \Fisharebest\Webtrees\Controller\IndividualController $ctrl_individual_in The Individual Controller to extend |
34 | 34 | */ |
35 | - public function __construct(fw\Controller\IndividualController $ctrl_individual_in){ |
|
35 | + public function __construct(fw\Controller\IndividualController $ctrl_individual_in) { |
|
36 | 36 | $this->ctrl_individual = $ctrl_individual_in; |
37 | 37 | $this->dindi = new mw\Individual($this->ctrl_individual->getSignificantIndividual()); |
38 | 38 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * |
44 | 44 | * @uses \MyArtJaub\Webtrees\Hook\Hook |
45 | 45 | */ |
46 | - public function printHeaderExtensions(){ |
|
46 | + public function printHeaderExtensions() { |
|
47 | 47 | $hook_extend_indi_header_left = new mw\Hook\Hook('hExtendIndiHeaderLeft'); |
48 | 48 | $hook_extend_indi_header_right = new mw\Hook\Hook('hExtendIndiHeaderRight'); |
49 | 49 | $hook_extend_indi_header_left = $hook_extend_indi_header_left->execute($this->ctrl_individual); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | echo '<div id="indi_perso_header">', |
53 | 53 | '<div id="indi_perso_header_left">'; |
54 | 54 | foreach ($hook_extend_indi_header_left as $div) { |
55 | - if(count($div)==2){ |
|
55 | + if (count($div) == 2) { |
|
56 | 56 | echo '<div id="', $div[0], '" class="indi_perso_header_left_div">', |
57 | 57 | $div[1], '</div>'; |
58 | 58 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | echo '</div>', |
61 | 61 | '<div id="indi_perso_header_right">'; |
62 | 62 | foreach ($hook_extend_indi_header_right as $div) { |
63 | - if(count($div)==2){ |
|
63 | + if (count($div) == 2) { |
|
64 | 64 | echo '<div id="', $div[0], '" class="indi_perso_header_right_div">', |
65 | 65 | $div[1], '</div>'; |
66 | 66 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @uses \MyArtJaub\Webtrees\Hook\Hook |
77 | 77 | */ |
78 | - public function printHeaderExtraIcons(){ |
|
78 | + public function printHeaderExtraIcons() { |
|
79 | 79 | $hook_extend_indi_header_icons = new Hook('hExtendIndiHeaderIcons'); |
80 | 80 | $hook_extend_indi_header_icons = $hook_extend_indi_header_icons->execute($this->ctrl_individual); |
81 | 81 |