Source of file HomePage_Controller.php
Size: 2,804 Bytes - Last Modified: 2021-12-23T10:09:55+00:00
/var/www/docs.ssmods.com/process/src/code/controller/HomePage_Controller.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 | <?php /** * Homepage - code/extensions/Homepage.php * * @link http://github.com/zucchi/Silverstripe-ScoutDistrict for the canonical source repository * @copyright Copyright (c) 2005-2013 Zucchi Limited. (http://zucchi.co.uk) * @license http://zucchi.co.uk/legals/bsd-license New BSD License */ /** * Homepage Controller * * Controller to display Homepage * * @author Matt Cockayne <matt@zucchi.co.uk> */ class HomePage_Controller extends Page_Controller { public function TagLink() { if ($this->TagLink) { return DataObject::get_by_id('SiteTree', $this->TagLink)->Link(); } return false; } /** * Get the next event or return false if there is none. * * @return bool|Event */ public function NextEvent() { if ($id = $this->dataRecord->Calendar) { if ($calendar = DataObject::get_by_id('Calendar', $id)) { $entries = $calendar->UpcomingEvents(1); return $entries->first(); } } return false; } /** * Get the upcoming event after the next event * or return false if there is none. * * @return bool|Event */ public function UpcomingEvent() { if ($id = $this->dataRecord->Calendar) { if ($calendar =DataObject::get_by_id('Calendar', $id)) { $entries = $calendar->UpcomingEvents(2); return $entries[1]; } } return false; } /** * Get the upcoming event after the next event * or return false if there is none. * * @return bool|ArrayList */ public function CalendarEvents() { if ($id = $this->dataRecord->Calendar) { if ($calendar = DataObject::get_by_id('Calendar', $id)) { $entries = $calendar->UpcomingEvents(5); return $entries; } } return false; } /** * Get the upcoming event after the next event * or return false if there is none. * * @return bool|BlogEntry */ public function LatestNews() { if ($id = $this->dataRecord->BlogHolder) { if ($holder = DataObject::get_by_id('SiteTree', $id)) { $entries = $holder->Entries(3); return $entries; } } return false; } /** * Get the upcoming event after the next event * or return false if there is none. * * @return bool|BlogEntry */ public function InfoPanelPage() { if ($id = $this->dataRecord->InfoPanelPage) { if ($page = DataObject::get_by_id('SiteTree', $id)) { return $page; } } return false; } } |