Source of file TeamPage.php
Size: 1,918 Bytes - Last Modified: 2021-12-23T10:51:36+00:00
/var/www/docs.ssmods.com/process/src/code/Pages/TeamPage.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 | <?php class TeamPage extends Page { /** * Static vars * ----------------------------------*/ /** * Object vars * ----------------------------------*/ /** * Static methods * ----------------------------------*/ /** * Data model * ----------------------------------*/ private static $db = array ( ); private static $has_one = array ( ); private static $has_many = array ( ); /** * Common methods * ----------------------------------*/ /** * Accessor methods * ----------------------------------*/ /** * Controller actions * ----------------------------------*/ /** * Template accessors * ----------------------------------*/ public function TeamMembers() { $team = Member::get()->filterByCallback( function($item){ return $item->inGroup('team-member'); } ); return $team->count() ? $team : false; } /** * Object methods * ----------------------------------*/ } class TeamPage_Controller extends Page_Controller { private static $allowed_actions = array ( "show" ); public function init() { parent::init(); } public function getCurrentItem($itemID = null) { $params = $this->request->allParams(); $class = "Member"; if($itemID) { return $class::get()->byID($itemID); } elseif(isset($params['ID'])) { //Sanitize $URL = Convert::raw2sql($params['ID']); return $class::get()->filter("URLSegment", $URL)->first(); } } function show() { if(($item = $this->getCurrentItem())) { if ($this->getCurrentItem()->canView()) { $data = array( 'Item' => $item, 'BackLink' => base64_decode($this->request->getVar('backlink')) ); return $this->customise(new ArrayData($data)); } else { return Security::permissionFailure($this); } } else { return $this->httpError(404); } } } |