/** * */ public function testMarkTimelineEventAsStarred() { $member = $this->objFromFixture('Member', 'reciever'); TimelineEvent::notify($member, 'Im important message to u!'); $this->assertEquals(0, TimelineEvent::get_starred($member)->count()); $notifications = TimelineEvent::get_all($member); $this->assertEquals(1, $notifications->count()); $notifications->first()->markAsStarred(); $this->assertEquals(1, TimelineEvent::get_starred($member)->count()); $notifications->first()->markAsNotStarred(); $this->assertEquals(0, TimelineEvent::get_starred($member)->count()); }
/** * * @param int $id * @param FieldList $fields * @return Form */ public function getEditForm($id = null, $fields = null) { $fields = new FieldList(); $notifications = TimelineEvent::get_all(Member::currentUser()); $gridField = new GridField('TimelineEvents', 'Timeline', $notifications, new TimelineConfig()); $fields->add($gridField); $form = CMSForm::create($this, "EditForm", $fields, new FieldList())->setHTMLID('Form_EditForm'); $form->setResponseNegotiator($this->getResponseNegotiator()); $form->addExtraClass('cms-edit-form'); $form->setTemplate($this->getTemplatesWithSuffix('_EditForm')); $form->setAttribute('data-pjax-fragment', 'CurrentForm'); return $form; }