@@ -48,7 +48,7 @@ |
||
| 48 | 48 | public function getMenu(fw\Tree $tree, $reference) {
|
| 49 | 49 | $tree_url = $tree ? $tree->getNameUrl() : ''; |
| 50 | 50 | $surname = $reference && is_string($reference) ? $reference : ''; |
| 51 | - return new fw\Menu($this->getTitle(), 'module.php?mod=' . $this->getName() . '&mod_action=Lineage&ged=' . $tree_url . '&surname=' . $surname , 'menu-maj-list-lineage', array('rel' => 'nofollow'));
|
|
| 51 | + return new fw\Menu($this->getTitle(), 'module.php?mod='.$this->getName().'&mod_action=Lineage&ged='.$tree_url.'&surname='.$surname, 'menu-maj-list-lineage', array('rel' => 'nofollow'));
|
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | } |
@@ -23,11 +23,11 @@ |
||
| 23 | 23 | * @see \MyArtJaub\Webtrees\Mvc\View\AbstractView::renderContent() |
| 24 | 24 | */ |
| 25 | 25 | protected function renderContent() { |
| 26 | - if($this->data->get('has_stats', false)) { |
|
| 27 | - $html = I18N::translate('%1$s visits since the beginning of %2$s<br>(%3$s today)' , |
|
| 28 | - '<span class="odometer">' . I18N::number($this->data->get('visits_year')) . '</span>', |
|
| 26 | + if ($this->data->get('has_stats', false)) { |
|
| 27 | + $html = I18N::translate('%1$s visits since the beginning of %2$s<br>(%3$s today)', |
|
| 28 | + '<span class="odometer">'.I18N::number($this->data->get('visits_year')).'</span>', |
|
| 29 | 29 | date('Y'), |
| 30 | - '<span class="odometer">' . I18N::number($this->data->get('visits_today')) . '</span>' |
|
| 30 | + '<span class="odometer">'.I18N::number($this->data->get('visits_today')).'</span>' |
|
| 31 | 31 | ); |
| 32 | 32 | } |
| 33 | 33 | else { |
@@ -28,42 +28,42 @@ |
||
| 28 | 28 | return ' |
| 29 | 29 | <tr> |
| 30 | 30 | <td class="descriptionbox wrap width33">' . |
| 31 | - I18N::translate('Enable Piwik Statistics') . |
|
| 31 | + I18N::translate('Enable Piwik Statistics'). |
|
| 32 | 32 | // Ideally, would like to add helpLink, but this does not work for modules... |
| 33 | 33 | // FunctionsPrint::helpLink('piwik_enabled', $this->getName()); |
| 34 | 34 | '</td> |
| 35 | 35 | <td class="optionbox">' . |
| 36 | - FunctionsEdit::editFieldYesNo('piwik_enabled', $this->data->get('piwik_enabled', '0')) . |
|
| 36 | + FunctionsEdit::editFieldYesNo('piwik_enabled', $this->data->get('piwik_enabled', '0')). |
|
| 37 | 37 | '</td> |
| 38 | 38 | </tr>' . |
| 39 | 39 | |
| 40 | 40 | '<tr> |
| 41 | 41 | <td class="descriptionbox wrap width33">' . |
| 42 | - I18N::translate('Piwik URL') . |
|
| 42 | + I18N::translate('Piwik URL'). |
|
| 43 | 43 | '</td> |
| 44 | 44 | <td class="optionbox"> |
| 45 | 45 | <input type="text" name="piwik_url" size="45" value="' . |
| 46 | - $this->data->get('piwik_url', '') . '" /> |
|
| 46 | + $this->data->get('piwik_url', '').'" /> |
|
| 47 | 47 | </td> |
| 48 | 48 | </tr>' . |
| 49 | 49 | |
| 50 | 50 | '<tr> |
| 51 | 51 | <td class="descriptionbox wrap width33">' . |
| 52 | - I18N::translate('Piwik Token') . |
|
| 52 | + I18N::translate('Piwik Token'). |
|
| 53 | 53 | '</td> |
| 54 | 54 | <td class="optionbox"> |
| 55 | 55 | <input type="text" name="piwik_token" size="45" value="' . |
| 56 | - $this->data->get('piwik_token', '') . '" /> |
|
| 56 | + $this->data->get('piwik_token', '').'" /> |
|
| 57 | 57 | </td> |
| 58 | 58 | </tr>' . |
| 59 | 59 | |
| 60 | 60 | '<tr> |
| 61 | 61 | <td class="descriptionbox wrap width33">' . |
| 62 | - I18N::translate('Piwik Site ID') . |
|
| 62 | + I18N::translate('Piwik Site ID'). |
|
| 63 | 63 | '</td> |
| 64 | 64 | <td class="optionbox"> |
| 65 | 65 | <input type="text" name="piwik_siteid" size="4" value="' . |
| 66 | - $this->data->get('piwik_siteid', '') . '" /> |
|
| 66 | + $this->data->get('piwik_siteid', '').'" /> |
|
| 67 | 67 | </td> |
| 68 | 68 | </tr>' ; |
| 69 | 69 | |
@@ -53,13 +53,13 @@ |
||
| 53 | 53 | */ |
| 54 | 54 | public function makeView($view_name, MvcController $mvc_ctrl, BaseController $ctrl, ViewBag $data) |
| 55 | 55 | { |
| 56 | - if(!$mvc_ctrl) throw new \Exception('Mvc Controller not defined'); |
|
| 57 | - if(!$ctrl) throw new \Exception('Base Controller not defined'); |
|
| 58 | - if(!$view_name) throw new \Exception('View not defined'); |
|
| 56 | + if (!$mvc_ctrl) throw new \Exception('Mvc Controller not defined'); |
|
| 57 | + if (!$ctrl) throw new \Exception('Base Controller not defined'); |
|
| 58 | + if (!$view_name) throw new \Exception('View not defined'); |
|
| 59 | 59 | |
| 60 | 60 | $mvc_ctrl_refl = new \ReflectionObject($mvc_ctrl); |
| 61 | - $view_class = $mvc_ctrl_refl->getNamespaceName() . '\\Views\\' . $view_name . 'View'; |
|
| 62 | - if(!class_exists($view_class)) throw new \Exception('View does not exist'); |
|
| 61 | + $view_class = $mvc_ctrl_refl->getNamespaceName().'\\Views\\'.$view_name.'View'; |
|
| 62 | + if (!class_exists($view_class)) throw new \Exception('View does not exist'); |
|
| 63 | 63 | |
| 64 | 64 | return new $view_class($ctrl, $data); |
| 65 | 65 | } |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | * @param bool $override |
| 74 | 74 | */ |
| 75 | 75 | public function set($key, $value, $override = true) { |
| 76 | - if(is_null($key)) return; |
|
| 77 | - if(!$override && array_key_exists($key, $this->data)) return; |
|
| 76 | + if (is_null($key)) return; |
|
| 77 | + if (!$override && array_key_exists($key, $this->data)) return; |
|
| 78 | 78 | $this->data[$key] = $value; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * @param string $key |
| 108 | 108 | */ |
| 109 | 109 | public function __unset($key) { |
| 110 | - unset($this->data[$key]);; |
|
| 110 | + unset($this->data[$key]); ; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | } |
@@ -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 | } |
@@ -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 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @param \Fisharebest\Webtrees\Place $place_in The Place to extend |
| 29 | 29 | */ |
| 30 | - public function __construct(\Fisharebest\Webtrees\Place $place){ |
|
| 30 | + public function __construct(\Fisharebest\Webtrees\Place $place) { |
|
| 31 | 31 | $this->place = $place; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | * @param \Fisharebest\Webtrees\Tree $tree |
| 40 | 40 | * @return \MyArtJaub\Webtrees\Place|null Instance of \MyArtJaub\Webtrees\Place, if relevant |
| 41 | 41 | */ |
| 42 | - public static function getIntance($place_str, Tree $tree){ |
|
| 42 | + public static function getIntance($place_str, Tree $tree) { |
|
| 43 | 43 | $dplace = null; |
| 44 | - if(is_string($place_str) && strlen($place_str) > 0){ |
|
| 44 | + if (is_string($place_str) && strlen($place_str) > 0) { |
|
| 45 | 45 | $dplace = new Place(new \Fisharebest\Webtrees\Place($place_str, $tree)); |
| 46 | 46 | } |
| 47 | 47 | return $dplace; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @return \Fisharebest\Webtrees\Place Embedded place record |
| 54 | 54 | */ |
| 55 | - public function getDerivedPlace(){ |
|
| 55 | + public function getDerivedPlace() { |
|
| 56 | 56 | return $this->place; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | * @param bool $anchor Option to print a link to placelist |
| 66 | 66 | * @return string HTML code for formatted place |
| 67 | 67 | */ |
| 68 | - public function htmlFormattedName($format, $anchor = false){ |
|
| 69 | - $html=''; |
|
| 68 | + public function htmlFormattedName($format, $anchor = false) { |
|
| 69 | + $html = ''; |
|
| 70 | 70 | |
| 71 | 71 | $levels = array_map('trim', explode(',', $this->place->getGedcomName())); |
| 72 | 72 | $nbLevels = count($levels); |
@@ -74,15 +74,15 @@ discard block |
||
| 74 | 74 | preg_match_all('/%[^%]/', $displayPlace, $matches); |
| 75 | 75 | foreach ($matches[0] as $match2) { |
| 76 | 76 | $index = str_replace('%', '', $match2); |
| 77 | - if(is_numeric($index) && $index >0 && $index <= $nbLevels){ |
|
| 78 | - $displayPlace = str_replace($match2, $levels[$index-1] , $displayPlace); |
|
| 77 | + if (is_numeric($index) && $index > 0 && $index <= $nbLevels) { |
|
| 78 | + $displayPlace = str_replace($match2, $levels[$index - 1], $displayPlace); |
|
| 79 | 79 | } |
| 80 | - else{ |
|
| 81 | - $displayPlace = str_replace($match2, '' , $displayPlace); |
|
| 80 | + else { |
|
| 81 | + $displayPlace = str_replace($match2, '', $displayPlace); |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | if ($anchor && !Auth::isSearchEngine()) { |
| 85 | - $html .='<a href="' . $this->place->getURL() . '">' . $displayPlace . '</a>'; |
|
| 85 | + $html .= '<a href="'.$this->place->getURL().'">'.$displayPlace.'</a>'; |
|
| 86 | 86 | } else { |
| 87 | 87 | $html .= $displayPlace; |
| 88 | 88 | } |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | * @param string $gedcom |
| 31 | 31 | * @return NULL|\MyArtJaub\Webtrees\Family |
| 32 | 32 | */ |
| 33 | - public static function getIntance($xref, Tree $tree, $gedcom = null){ |
|
| 33 | + public static function getIntance($xref, Tree $tree, $gedcom = null) { |
|
| 34 | 34 | $dfam = null; |
| 35 | 35 | $fam = fw\Family::getInstance($xref, $tree, $gedcom); |
| 36 | - if($fam){ |
|
| 36 | + if ($fam) { |
|
| 37 | 37 | $dfam = new Family($fam); |
| 38 | 38 | } |
| 39 | 39 | return $dfam; |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | * |
| 45 | 45 | * @return int Level of sources |
| 46 | 46 | * */ |
| 47 | - function isMarriageSourced(){ |
|
| 48 | - if($this->is_marriage_sourced !== null) return $this->is_marriage_sourced; |
|
| 47 | + function isMarriageSourced() { |
|
| 48 | + if ($this->is_marriage_sourced !== null) return $this->is_marriage_sourced; |
|
| 49 | 49 | $this->is_marriage_sourced = $this->isFactSourced(WT_EVENTS_MARR.'|MARC'); |
| 50 | 50 | return $this->is_marriage_sourced; |
| 51 | 51 | } |