/**
  * Update properties of this calendar folder
  *
  * @see calendar_driver::edit_calendar()
  */
 public function update(&$prop)
 {
     $prop['oldname'] = $this->get_realname();
     $newfolder = kolab_storage::folder_update($prop);
     if ($newfolder === false) {
         $this->cal->last_error = $this->cal->gettext(kolab_storage::$last_error);
         return false;
     }
     // create ID
     return kolab_storage::folder_id($newfolder);
 }
示例#2
0
 /**
  * Create a new calendar assigned to the current user
  *
  * @param array Hash array with calendar properties
  *    name: Calendar name
  *   color: The color of the calendar
  * @return mixed ID of the calendar on success, False on error
  */
 public function create_calendar($prop)
 {
     $prop['type'] = 'event';
     $prop['active'] = true;
     $prop['subscribed'] = true;
     $folder = kolab_storage::folder_update($prop);
     if ($folder === false) {
         $this->last_error = $this->cal->gettext(kolab_storage::$last_error);
         return false;
     }
     // create ID
     $id = kolab_storage::folder_id($folder);
     // save color in user prefs (temp. solution)
     $prefs['kolab_calendars'] = $this->rc->config->get('kolab_calendars', array());
     if (isset($prop['color'])) {
         $prefs['kolab_calendars'][$id]['color'] = $prop['color'];
     }
     if (isset($prop['showalarms'])) {
         $prefs['kolab_calendars'][$id]['showalarms'] = $prop['showalarms'] ? true : false;
     }
     if ($prefs['kolab_calendars'][$id]) {
         $this->rc->user->save_prefs($prefs);
     }
     return $id;
 }
 /**
  * Update properties of an existing tasklist
  *
  * @param array Hash array with list properties
  *          id: List Identifier
  *        name: List name
  *       color: The color of the list
  *  showalarms: True if alarms are enabled (if supported)
  * @return boolean True on success, Fales on failure
  */
 public function edit_list($prop)
 {
     if ($prop['id'] && ($folder = $this->folders[$prop['id']])) {
         $prop['oldname'] = $folder->name;
         $prop['type'] = 'task';
         $newfolder = kolab_storage::folder_update($prop);
         if ($newfolder === false) {
             $this->last_error = kolab_storage::$last_error;
             return false;
         }
         // create ID
         $id = kolab_storage::folder_id($newfolder);
         // fallback to local prefs
         $prefs['kolab_tasklists'] = $this->rc->config->get('kolab_tasklists', array());
         unset($prefs['kolab_tasklists'][$prop['id']]);
         if (isset($prop['showalarms'])) {
             $prefs['kolab_tasklists'][$id]['showalarms'] = $prop['showalarms'] ? true : false;
         }
         if ($prefs['kolab_tasklists'][$id]) {
             $this->rc->user->save_prefs($prefs);
         }
         return $id;
     }
     return false;
 }