quickAdd() public method

Imports an event parsed from a string.
public quickAdd ( string $text, string $calendar = null ) : array
$text string The text to parse into an event
$calendar string The calendar into which the event will be imported. If 'null', the user's default calendar will be used.
return array The UID of all events that were added.
Example #1
0
 /**
  * TODO
  */
 public function quickSaveEvent()
 {
     $cal = explode('|', $this->vars->cal, 2);
     try {
         $event = Kronolith::quickAdd($this->vars->text, $cal[1]);
         return $this->_saveEvent($event);
     } catch (Horde_Exception $e) {
         $GLOBALS['notification']->push($e);
         $result = $this->_signedResponse($this->vars->cal);
         $result->error = true;
         return $result;
     }
 }
Example #2
0
File: Api.php Project: horde/horde
 /**
  * Imports an event parsed from a string.
  *
  * @param string $text      The text to parse into an event
  * @param string $calendar  The calendar into which the event will be
  *                          imported.  If 'null', the user's default
  *                          calendar will be used.
  *
  * @return array  The UID of all events that were added.
  * @throws Kronolith_Exception
  */
 public function quickAdd($text, $calendar = null)
 {
     if (!isset($calendar)) {
         $calendar = Kronolith::getDefaultCalendar(Horde_Perms::EDIT);
     } elseif (!Kronolith::hasPermission($calendar, Horde_Perms::EDIT)) {
         throw new Horde_Exception_PermissionDenied();
     }
     $event = Kronolith::quickAdd($text, $calendar);
     return $event->uid;
 }