$this->widget('zii.widgets.CMenu', array('items' => $this->actionMenu)); $this->endWidget(); } if (isset($this->modelClass) && $this->modelClass == 'Actions' && $this->showActions !== null) { $this->beginWidget('zii.widgets.CPortlet', array('title' => Yii::t('actions', 'Show Actions'), 'id' => 'actions-filter')); echo '<div class="form" style="border: none;">'; echo CHtml::dropDownList('show-actions', $this->showActions, array('uncomplete' => Yii::t('actions', 'Uncomplete'), 'complete' => Yii::t('actions', 'Complete'), 'all' => Yii::t('actions', 'All')), array('id' => 'dropdown-show-actions', 'onChange' => 'toggleShowActions();')); echo '</div>'; $this->endWidget(); } if (isset($this->modelClass) && $this->modelClass == 'Calendar') { $user = UserChild::model()->findByPk(Yii::app()->user->getId()); $showCalendars = json_decode($user->showCalendars, true); $editableCalendars = X2Calendar::getEditableCalendarNames(); // list of calendars current user can edit $editableUserCalendars = X2Calendar::getEditableUserCalendarNames(); // list of user calendars current user can edit if (isset($this->sharedCalendars) && $this->sharedCalendars !== null) { $this->beginWidget('zii.widgets.CPortlet', array('title' => Yii::t('calendar', 'Calendars'), 'id' => 'shared-calendar')); $showSharedCalendars = $showCalendars['sharedCalendars']; echo '<ul style="font-size: 0.8em; font-weight: bold; color: black;">'; foreach ($this->sharedCalendars as $calendarId => $calendarName) { if (isset($editableCalendars[$calendarId])) { // check if current user has permission to edit calendar $editable = 'true'; } else { $editable = 'false'; } echo "<li>\n"; // checkbox for each user; current user and Anyone are set to checked echo CHtml::checkBox($calendarId, in_array($calendarId, $showSharedCalendars), array('onChange' => "toggleCalendarSourceShared(this.name, this.checked, {$editable});"));