Source of file RecentDashlet.php
Size: 1,565 Bytes - Last Modified: 2021-12-23T10:31:31+00:00
/var/www/docs.ssmods.com/process/src/code/dashlets/RecentDashlet.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 | <?php /** * Recent Pages listing. * * @author Nathan Glasl <nathan@silverstripe.com.au> */ class RecentDashlet extends Dashlet { public static $title = "Recently Modified"; public static $cmsTitle = "Recently Modified Pages"; public static $description = "List Pages"; public static $db = array( 'ListType' => 'Varchar' ); public function getCMSFields() { $fields = parent::getCMSFields(); $types = ClassInfo::subclassesFor('Page'); $types = array_combine($types, $types); ksort($types); $fields->push(new DropdownField('ListType', _t('RecentDashlet.LIST_TYPE', 'List Items of Type'), $types)); return $fields; } public function getDashletFields() { $fields = parent::getDashletFields(); if (Permission::check('ADMIN')) { $types = ClassInfo::subclassesFor('Page'); $types = array_combine($types, $types); ksort($types); $fields->push(new DropdownField('ListType', _t('RecentDashlet.LIST_TYPE', 'List Items of Type'), $types)); } return $fields; } public function Items() { $type = 'Page'; if (Permission::check('ADMIN')) { $type = $this->ListType ? $this->ListType : 'Page'; } if ($type) { return singleton('DataService')->getAll($type, $filter = "", $sort = "LastEdited DESC", $join = "", $limit = "0, 10"); } } } class RecentDashlet_Controller extends Dashlet_Controller { } |