Source of file MemberExtension.php
Size: 1,165 Bytes - Last Modified: 2021-12-23T10:25:43+00:00
/var/www/docs.ssmods.com/process/src/src/Extension/MemberExtension.php
123456789101112131415161718192021222324252627282930313233343536373839404142 | <?php namespace Symbiote\Notifications\Extension; use SilverStripe\ORM\ArrayList; use SilverStripe\Core\Extension; use SilverStripe\View\ArrayData; use SilverStripe\Control\Director; use SilverStripe\Security\Permission; use Symbiote\MemberProfiles\Pages\MemberProfilePage; use Symbiote\Notifications\Model\InternalNotification; class MemberExtension extends Extension { public function getNotifications($limit = 10, $offset = 0, $filter = []) { $filter = array_merge( $filter, ['ToID' => $this->owner->ID] ); $notifications = ArrayList::create(); foreach (InternalNotification::get()->filter($filter)->limit($limit, $offset) as $intNote) { $notification = ArrayData::create($intNote->toMap()); $notification->setField('FromUsername', $intNote->From()->getNotificationUsername()); $notifications->push($notification); } return $notifications; } public function getNotificationUsername() { if ($this->owner->Username) { return $this->owner->Username; } return $this->owner->getTitle(); } } |