Source of file StaffCategory.php
Size: 1,239 Bytes - Last Modified: 2022-02-21T10:01:40+00:00
/var/www/docs.ssmods.com/process/src/code/StaffCategory.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 | <?php class StaffCategory extends DataObject { private static $db = array( 'SortID' => 'Int', 'Title' => 'Varchar(75)', 'Description' => 'HTMLText' ); private static $has_many = array( "Staff" => "Staff" ); private static $summary_fields = array( 'Title' => 'Title', 'DescriptionExcerpt' => 'Description' ); public function canCreate($Member = null) { return true; } public function canEdit($Member = null) { return true; } public function canView($Member = null) { return true; } public function canDelete($Member = null) { return true; } private static $default_sort = 'SortID Asc'; public function getCMSFields() { return new FieldList( TextField::create("Title"), HTMLEditorField::create("Description") ); } public function DescriptionExcerpt($length = 300) { $text = strip_tags($this->Description); $length = abs((int)$length); if (strlen($text) > $length) { $text = preg_replace("/^(.{1,$length})(\s.*|$)/s", '\\1...', $text); } return $text; } } |