Kronolith_Driver::saveEvent PHP Method

saveEvent() public method

If it is a new event, it is added, otherwise the event is updated.
public saveEvent ( Kronolith_Event $event ) : string
$event Kronolith_Event The event to save.
return string The event id.
    public function saveEvent(Kronolith_Event $event)
    {
        if (empty($event->start) || $event->start->year <= 0 || empty($event->end) || $event->end->year <= 0) {
            throw new Kronolith_Exception(_("Invalid date"));
        }
        if ($event->stored || $event->exists()) {
            return $this->_updateEvent($event);
        }
        return $this->_addEvent($event);
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Saves an event in the backend.
  *
  * If it is a new event, it is added, otherwise the event is updated.
  *
  * @param Kronolith_Event $event  The event to save.
  *
  * @return string  The event id.
  * @throws Horde_Mime_Exception
  * @throws Kronolith_Exception
  */
 public function saveEvent(Kronolith_Event $event)
 {
     return $this->_driver->saveEvent($event);
 }