/** * persist vacation data in db */ protected function _saveVacation() { if (empty($this->_vacation)) { return; } $vacationRecord = new Expressomail_Model_Sieve_Vacation(); $vacationRecord->setFromFSV($this->_vacation); $vacationRecord->account_id = $this->_accountId; $vacationRecord->setId($this->_accountId); $vacationRecord->addresses = Zend_Json::encode($vacationRecord->addresses); try { $oldVac = $this->_vacationBackend->get($vacationRecord->getId()); $this->_vacationBackend->update($vacationRecord); } catch (Tinebase_Exception_NotFound $tenf) { $this->_vacationBackend->create($vacationRecord); } }
/** * get vacation message defined by template / do substitutions for dates and representative * * @param Expressomail_Model_Sieve_Vacation $vacation * @return string */ public function getVacationMessage(Expressomail_Model_Sieve_Vacation $vacation) { if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) { Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($vacation->toArray(), TRUE)); } $message = $this->_getMessageFromTemplateFile($vacation->template_id); $message = $this->_doMessageSubstitutions($vacation, $message); return $message; }
/** * set sieve vacation for account * * @param array $recordData * @return array */ public function saveVacation($recordData) { $record = new Expressomail_Model_Sieve_Vacation(array(), TRUE); $record->setFromJsonInUsersTimezone($recordData); $record = Expressomail_Controller_Sieve::getInstance()->setVacation($record); return $this->_recordToJson($record); }