diff options
| author | Greg Roach <fisharebest@gmail.com> | 2017-03-07 12:02:25 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2017-06-17 16:17:44 +0100 |
| commit | 15d603e7c7c15d20f055d3d9c38d6b133453c5be (patch) | |
| tree | 14cd348cd8d2cbb465626429334a9558c0bf5a43 /app/Census/AbstractCensusColumn.php | |
| parent | 95664b44addad5559917902d85518988a3ea7bc4 (diff) | |
| download | webtrees-15d603e7c7c15d20f055d3d9c38d6b133453c5be.tar.gz webtrees-15d603e7c7c15d20f055d3d9c38d6b133453c5be.tar.bz2 webtrees-15d603e7c7c15d20f055d3d9c38d6b133453c5be.zip | |
jQuery-3, Bootstrap-4, FontAwesome-4.7, Select2-4, remove popup windows
Diffstat (limited to 'app/Census/AbstractCensusColumn.php')
| -rw-r--r-- | app/Census/AbstractCensusColumn.php | 101 |
1 files changed, 52 insertions, 49 deletions
diff --git a/app/Census/AbstractCensusColumn.php b/app/Census/AbstractCensusColumn.php index 90434fcf5e..8cf36fe303 100644 --- a/app/Census/AbstractCensusColumn.php +++ b/app/Census/AbstractCensusColumn.php @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + namespace Fisharebest\Webtrees\Census; use Fisharebest\Webtrees\Date; @@ -55,28 +56,6 @@ class AbstractCensusColumn { } /** - * Extract the country (last part) of a place name. - * - * @param string $place - e.g. "London, England" - * - * @return string - e.g. "England" - */ - protected function lastPartOfPlace($place) { - $place = explode(', ', $place); - - return end($place); - } - - /** - * When did this census occur - * - * @return Date - */ - public function date() { - return new Date($this->census->censusDate()); - } - - /** * Find the father of an individual * * @param Individual $individual @@ -111,32 +90,6 @@ class AbstractCensusColumn { } /** - * Remove the country of a place name, where it is the same as the census place - * - * @param string $place - e.g. "London, England" - * - * @return string - e.g. "London" (for census of England) and "London, England" elsewhere - */ - protected function notCountry($place) { - $parts = explode(', ', $place); - - if (end($parts) === $this->place()) { - return implode(', ', array_slice($parts, 0, -1)); - } else { - return $place; - } - } - - /** - * Where did this census occur - * - * @return string - */ - public function place() { - return $this->census->censusPlace(); - } - - /** * Find the current spouse family of an individual * * @param Individual $individual @@ -155,13 +108,24 @@ class AbstractCensusColumn { if (empty($families)) { return null; } else { - usort($families, function (Family $x, Family $y) { return Date::compare($x->getMarriageDate(), $y->getMarriageDate()); }); + usort($families, function (Family $x, Family $y) { + return Date::compare($x->getMarriageDate(), $y->getMarriageDate()); + }); return end($families); } } /** + * When did this census occur + * + * @return Date + */ + public function date() { + return new Date($this->census->censusDate()); + } + + /** * The full version of the column's name. * * @return string @@ -169,4 +133,43 @@ class AbstractCensusColumn { public function title() { return $this->title; } + + /** + * Extract the country (last part) of a place name. + * + * @param string $place - e.g. "London, England" + * + * @return string - e.g. "England" + */ + protected function lastPartOfPlace($place) { + $place = explode(', ', $place); + + return end($place); + } + + /** + * Remove the country of a place name, where it is the same as the census place + * + * @param string $place - e.g. "London, England" + * + * @return string - e.g. "London" (for census of England) and "London, England" elsewhere + */ + protected function notCountry($place) { + $parts = explode(', ', $place); + + if (end($parts) === $this->place()) { + return implode(', ', array_slice($parts, 0, -1)); + } else { + return $place; + } + } + + /** + * Where did this census occur + * + * @return string + */ + public function place() { + return $this->census->censusPlace(); + } } |
