/** * get vacation for account * * @param string|Felamimail_Model_Account $_accountId * @return Felamimail_Model_Sieve_Vacation */ public function getVacation($_accountId) { $script = $this->_getSieveScript($_accountId); $vacation = $script !== NULL ? $script->getVacation() : NULL; $result = new Felamimail_Model_Sieve_Vacation(array('id' => $_accountId instanceof Felamimail_Model_Account ? $_accountId->getId() : $_accountId)); if ($vacation !== NULL) { $result->setFromFSV($vacation); } return $result; }
/** * persist vacation data in db */ protected function _saveVacation() { if (empty($this->_vacation)) { return; } $vacationRecord = new Felamimail_Model_Sieve_Vacation(); $vacationRecord->setFromFSV($this->_vacation); $vacationRecord->account_id = $this->_accountId; $vacationRecord->setId($this->_accountId); $vacationRecord->addresses = Zend_Json::encode($vacationRecord->addresses); if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) { Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Saving vacation in DB: ' . print_r($vacationRecord->toArray(), TRUE)); } try { $oldVac = $this->_vacationBackend->get($vacationRecord->getId()); $this->_vacationBackend->update($vacationRecord); } catch (Tinebase_Exception_NotFound $tenf) { $this->_vacationBackend->create($vacationRecord); } }
/** * persist vacation data in db */ protected function _saveVacation() { if (empty($this->_vacation)) { return; } $vacationRecord = new Felamimail_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); } }