Exemplo n.º 1
0
 /** 
  * Retrives all checked calendar events
  * @param int $start starting unix time to fetch events between
  * @param int $end ending unix time to fetch events between
  */
 public function feedAll($start = null, $end = null)
 {
     // default window is +/- one month
     if (!isset($start)) {
         $start = strtotime("-1 month");
     }
     $end = strtotime("+1 month");
     $this->calendarUsers = X2CalendarPermissions::getViewableUserCalendarNames();
     $this->groupCalendars = X2Calendar::getViewableGroupCalendarNames();
     $this->calendarFilter = X2Calendar::getCalendarFilters();
     $user = User::model()->findByPk(Yii::app()->user->getId());
     $showCalendars = json_decode($user->showCalendars, true);
     //fix showCalendars['groupCalendars']
     if (!isset($showCalendars['groupCalendars'])) {
         $showCalendars['groupCalendars'] = array();
         $user->showCalendars = json_encode($showCalendars);
         $user->update();
     }
     // get a list of all calendars to show
     $events = array();
     foreach ($showCalendars['userCalendars'] as $cal) {
         $events = array_merge($events, $this->feedUser($cal, $start, $end));
     }
     foreach ($showCalendars['groupCalendars'] as $cal) {
         $events = array_merge($events, $this->feedGroup($cal, $start, $end));
     }
     return $events;
 }
Exemplo n.º 2
0
Yii::app()->clientScript->registerScriptFile($this->module->assetsUrl . '/js/calendar.js', CClientScript::POS_END);
Yii::app()->clientScript->registerScriptFile(Yii::app()->getBaseUrl() . '/js/X2Dialog.js');
// register jquery timepicker css and js
// (used inside js dialog because CJuiDateTimePicker is a php library that won't work inside a js dialog)
//Yii::app()->clientScript->registerCssFile(Yii::app()->getBaseUrl() .'/protected/extensions/CJuiDateTimePicker/assets/jquery-ui-timepicker-addon.css');
//Yii::app()->clientScript->registerScriptFile(Yii::app()->getBaseUrl().'/protected/extensions/CJuiDateTimePicker/assets/jquery-ui-timepicker-addon.js');
$menuOptions = array('index', 'myPermissions');
if (Yii::app()->params->isAdmin) {
    $menuOptions[] = 'userPermissions';
}
if (Yii::app()->settings->googleIntegration) {
    $menuOptions[] = 'sync';
}
$this->insertMenu($menuOptions);
$this->calendarUsers = X2CalendarPermissions::getViewableUserCalendarNames();
$this->groupCalendars = X2Calendar::getViewableGroupCalendarNames();
//$this->sharedCalendars = X2Calendar::getViewableCalendarNames();
//$this->googleCalendars = X2Calendar::getViewableGoogleCalendarNames();
$this->calendarFilter = X2Calendar::getCalendarFilters();
// urls for ajax (and other javascript) calls
$urls = X2Calendar::getCalendarUrls();
$user = User::model()->findByPk(Yii::app()->user->getId());
$showCalendars = json_decode($user->showCalendars, true);
// fix showCalendars['groupCalendars']
if (!isset($showCalendars['groupCalendars'])) {
    $showCalendars['groupCalendars'] = array();
    $user->showCalendars = json_encode($showCalendars);
    $user->update();
}
$userCalendars = $showCalendars['userCalendars'];
$groupCalendars = $showCalendars['groupCalendars'];