/** * Remove the subscription for the calendar. * @param int $id */ public function actionUnsubscribe($id) { $savedCalendarSubscription = SavedCalendarSubscription::getById(intval($id)); $savedCalendarSubscription->delete(); $dataProvider = CalendarUtil::getCalendarItemsDataProvider(Yii::app()->user->userModel); $savedCalendarSubscriptions = $dataProvider->getSavedCalendarSubscriptions(); $content = CalendarUtil::makeCalendarItemsList($savedCalendarSubscriptions->getSubscribedToSavedCalendarsAndSelected(), 'sharedcalendar[]', 'sharedcalendar', 'shared'); echo $content; }
/** * Renders content. * @return string */ protected function renderContent() { $content = CalendarUtil::makeCalendarItemsList($this->data, $this->field, $this->itemClass, $this->listType); $content = $this->wrapContent($content); $title = $this->renderTitleContent(); return ZurmoHtml::tag('div', array('class' => 'calendars-list-container'), $title . $content); }
public function testMakeCalendarItemsList() { $savedCalendarSubscriptions = SavedCalendarSubscriptions::makeByUser(Yii::app()->user->userModel); $content = CalendarUtil::makeCalendarItemsList($savedCalendarSubscriptions->getMySavedCalendarsAndSelected(), 'mycalendar[]', 'mycalendar', 'saved'); $this->assertContains('Test Cal', $content); $content = CalendarUtil::makeCalendarItemsList($savedCalendarSubscriptions->getSubscribedToSavedCalendarsAndSelected(), 'sharedcalendar[]', 'sharedcalendar', 'shared'); $this->assertContains('Test Cal New', $content); }