Source of file FutureWorkflowTrigger.php
Size: 1,461 Bytes - Last Modified: 2021-12-23T10:48:18+00:00
/var/www/docs.ssmods.com/process/src/src/FutureWorkflowTrigger.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 | <?php namespace Symbiote\FutureWorkflow; use SilverStripe\ORM\DataObject; use SilverStripe\Security\Permission; /** * * * @author marcus */ class FutureWorkflowTrigger extends DataObject { private static $table_name = 'FutureWorkflowTrigger'; private static $db = [ 'EffectiveTime' => 'Datetime', ]; private static $has_one = [ 'BoundTo' => DataObject::class, 'Source' => FutureWorkflow::class, ]; private static $summary_fields = [ 'EffectiveTime', 'Source.Title', ]; public function onBeforeWrite() { parent::onBeforeWrite(); if (strtotime($this->EffectiveTime) <= time()) { $this->EffectiveTime = ''; } } public function canEdit($member = null) { $boundTo = $this->BoundTo(); if ($boundTo) { return $this->BoundTo()->canEdit($member); } return Permission::check('CMS_ACCESS_CMSMain'); } public function canDelete($member = null) { $boundTo = $this->BoundTo(); if ($boundTo) { return $this->BoundTo()->canDelete($member); } return Permission::check('CMS_ACCESS_CMSMain'); } public function canView($member = null) { $boundTo = $this->BoundTo(); if ($boundTo) { return $this->BoundTo()->canView($member); } return Permission::check('CMS_ACCESS_CMSMain'); } } |