/** * get preference defaults if no default is found in the database * * @param string $_preferenceName * @return Tinebase_Model_Preference */ public function getApplicationPreferenceDefaults($_preferenceName, $_accountId = NULL, $_accountType = Tinebase_Acl_Rights::ACCOUNT_TYPE_USER) { $preference = $this->_getDefaultBasePreference($_preferenceName); switch ($_preferenceName) { case self::DEFAULTPERSISTENTFILTER: $preference->value = Tinebase_PersistentFilter::getPreferenceValues('Courses', $_accountId, self::DEFAULTPERSISTENTFILTER_NAME); break; default: throw new Tinebase_Exception_NotFound('Default preference with name ' . $_preferenceName . ' not found.'); } return $preference; }
/** * get special options * * @param string $_value * @return array */ protected function _getSpecialOptions($_value) { $result = array(); switch ($_value) { case self::DEFAULTPERSISTENTFILTER: $result = Tinebase_PersistentFilter::getPreferenceValues('Projects'); break; default: $result = parent::_getSpecialOptions($_value); } return $result; }
/** * get preference defaults if no default is found in the database * * @param string $_preferenceName * @param string|Tinebase_Model_User $_accountId * @param string $_accountType * @return Tinebase_Model_Preference */ public function getApplicationPreferenceDefaults($_preferenceName, $_accountId = NULL, $_accountType = Tinebase_Acl_Rights::ACCOUNT_TYPE_USER) { $preference = $this->_getDefaultBasePreference($_preferenceName); switch ($_preferenceName) { case self::DEFAULTADDRESSBOOK: $this->_getDefaultContainerPreferenceDefaults($preference, $_accountId); break; case self::DEFAULTPERSISTENTFILTER: $preference->value = Tinebase_PersistentFilter::getPreferenceValues('Addressbook', $_accountId, self::DEFAULTPERSISTENTFILTER_NAME); break; case self::DEFAULT_CONTACT_ODS_EXPORTCONFIG: $preference->value = 'adb_default_ods'; break; case self::DEFAULT_CONTACT_XLS_EXPORTCONFIG: $preference->value = 'adb_default_xls'; break; default: throw new Tinebase_Exception_NotFound('Default preference with name ' . $_preferenceName . ' not found.'); } return $preference; }
/** * get preference defaults if no default is found in the database * * @param string $_preferenceName * @param string|Tinebase_Model_User $_accountId * @param string $_accountType * @return Tinebase_Model_Preference */ public function getApplicationPreferenceDefaults($_preferenceName, $_accountId = NULL, $_accountType = Tinebase_Acl_Rights::ACCOUNT_TYPE_USER) { if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Get default value for ' . $_preferenceName . ' of account id ' . $_accountId); } $preference = $this->_getDefaultBasePreference($_preferenceName); switch ($_preferenceName) { case self::DAYSVIEW_STARTTIME: $preference->value = '08:00'; $preference->options = $this->_createTimespanDataXML(0, 23); break; case self::DAYSVIEW_ENDTIME: $preference->value = '18:00'; $preference->options = $this->_createTimespanDataXML(1, 24); break; case self::DAYSVIEW_DEFAULT_STARTTIME: $preference->value = '08:00'; $preference->options = $this->_createTimespanDataXML(0, 23); break; case self::DEFAULTCALENDAR: $this->_getDefaultContainerPreferenceDefaults($preference, $_accountId); break; case self::DEFAULTPERSISTENTFILTER: $preference->value = Tinebase_PersistentFilter::getPreferenceValues('Calendar', $_accountId, "All my events"); break; case self::NOTIFICATION_LEVEL: $translate = Tinebase_Translation::getTranslation($this->_application); // need to put the translations strings here because they were not found in the xml below :/ // _('Never') _('On invitation and cancellation only') _('On time changes') _('On all updates but attendee responses') _('On attendee responses too') $preference->value = Calendar_Controller_EventNotifications::NOTIFICATION_LEVEL_EVENT_RESCHEDULE; $preference->options = '<?xml version="1.0" encoding="UTF-8"?> <options> <option> <value>' . Calendar_Controller_EventNotifications::NOTIFICATION_LEVEL_NONE . '</value> <label>' . $translate->_('Never') . '</label> </option> <option> <value>' . Calendar_Controller_EventNotifications::NOTIFICATION_LEVEL_INVITE_CANCEL . '</value> <label>' . $translate->_('On invitation and cancellation only') . '</label> </option> <option> <value>' . Calendar_Controller_EventNotifications::NOTIFICATION_LEVEL_EVENT_RESCHEDULE . '</value> <label>' . $translate->_('On time changes') . '</label> </option> <option> <value>' . Calendar_Controller_EventNotifications::NOTIFICATION_LEVEL_EVENT_UPDATE . '</value> <label>' . $translate->_('On all updates but attendee responses') . '</label> </option> <option> <value>' . Calendar_Controller_EventNotifications::NOTIFICATION_LEVEL_ATTENDEE_STATUS_UPDATE . '</value> <label>' . $translate->_('On attendee responses too') . '</label> </option> </options>'; break; case self::SEND_NOTIFICATION_OF_OWN_ACTIONS: $preference->value = 0; $preference->options = '<?xml version="1.0" encoding="UTF-8"?> <options> <special>' . Tinebase_Preference_Abstract::YES_NO_OPTIONS . '</special> </options>'; break; case self::SEND_ALARM_NOTIFICATIONS: $preference->value = 1; $preference->options = '<?xml version="1.0" encoding="UTF-8"?> <options> <special>' . Tinebase_Preference_Abstract::YES_NO_OPTIONS . '</special> </options>'; break; case self::DEFAULTALARM_ENABLED: $preference->value = 0; $preference->options = '<?xml version="1.0" encoding="UTF-8"?> <options> <special>' . Tinebase_Preference_Abstract::YES_NO_OPTIONS . '</special> </options>'; break; case self::DEFAULTALARM_MINUTESBEFORE: $preference->value = 15; $preference->options = ''; break; case self::DEFAULTATTENDEE_STRATEGY: $preference->value = 'me'; $preference->options = '<?xml version="1.0" encoding="UTF-8"?> <options> <option> <label>Me</label> <value>me</value> </option> <option> <label>Intelligent</label> <value>intelligent</value> </option> <option> <label>Calendar owner</label> <value>calendarOwner</value> </option> <option> <label>Filtered attendee</label> <value>filteredAttendee</value> </option> </options>'; break; case self::DEFAULT_TIMEINCREMENT: $preference->value = 15; $preference->options = '<?xml version="1.0" encoding="UTF-8"?> <options> <option> <label>5</label> <value>5</value> </option> <option> <label>10</label> <value>10</value> </option> <option> <label>15</label> <value>15</value> </option> <option> <label>20</label> <value>20</value> </option> <option> <label>30</label> <value>30</value> </option> <option> <label>60</label> <value>60</value> </option> </options>'; break; case self::DEFAULT_EVENTS_RRIVATE: $preference->value = 0; $preference->options = '<?xml version="1.0" encoding="UTF-8"?> <options> <special>' . Tinebase_Preference_Abstract::YES_NO_OPTIONS . '</special> </options>'; break; case self::FIRSTDAYOFWEEK: $preference->value = 1; $preference->options = '<?xml version="1.0" encoding="UTF-8"?> <options> <option> <label>Sunday</label> <value>0</value> </option> <option> <label>Monday</label> <value>1</value> </option> </options>'; break; default: throw new Tinebase_Exception_NotFound('Default preference with name ' . $_preferenceName . ' not found.'); } return $preference; }
/** * overwrite this to add more special options for other apps * * - result array has to have the following format: * array( * array('value1', 'label1'), * array('value2', 'label2'), * ... * ) * * @param string $_value * @return array */ protected function _getSpecialOptions($_value) { $result = array(); switch ($_value) { case self::YES_NO_OPTIONS: $locale = Tinebase_Core::get(Tinebase_Core::LOCALE); $question = Zend_Locale::getTranslationList('Question', $locale); list($yes, $dummy) = explode(':', $question['yes']); list($no, $dummy) = explode(':', $question['no']); $result[] = array(0, $no); $result[] = array(1, $yes); break; case self::DEFAULTCONTAINER_OPTIONS: $result = $this->_getDefaultContainerOptions(); break; case self::DEFAULTPERSISTENTFILTER: $result = Tinebase_PersistentFilter::getPreferenceValues($this->_application); break; default: throw new Tinebase_Exception_NotFound("Special option '{$_value}' not found."); } return $result; }
/** * get preference defaults if no default is found in the database * * @param string $_preferenceName * @param string|Tinebase_Model_User $_accountId * @param string $_accountType * @return Tinebase_Model_Preference */ public function getApplicationPreferenceDefaults($_preferenceName, $_accountId = NULL, $_accountType = Tinebase_Acl_Rights::ACCOUNT_TYPE_USER) { $preference = $this->_getDefaultBasePreference($_preferenceName); switch ($_preferenceName) { case self::DEFAULTLEADLIST: $this->_getDefaultContainerPreferenceDefaults($preference, $_accountId); break; /* case self::NOTIFICATION_LEVEL: $translate = Tinebase_Translation::getTranslation($this->_application); $preference->value = Crm_Controller_EventNotifications::NOTIFICATION_LEVEL_EVENT_RESCHEDULE; $preference->options = '<?xml version="1.0" encoding="UTF-8"?> <options> <option> <value>'. Crm_Controller_EventNotifications::NOTIFICATION_LEVEL_NONE . '</value> <label>'. $translate->_('Never') . '</label> </option> <option> <value>'. Crm_Controller_EventNotifications::NOTIFICATION_LEVEL_INVITE_CANCEL . '</value> <label>'. $translate->_('On invitaion and cancelation only') . '</label> </option> <option> <value>'. Crm_Controller_EventNotifications::NOTIFICATION_LEVEL_EVENT_RESCHEDULE . '</value> <label>'. $translate->_('On time changes') . '</label> </option> <option> <value>'. Crm_Controller_EventNotifications::NOTIFICATION_LEVEL_EVENT_UPDATE . '</value> <label>'. $translate->_('On all updates but attendee responses') . '</label> </option> <option> <value>'. Crm_Controller_EventNotifications::NOTIFICATION_LEVEL_ATTENDEE_STATUS_UPDATE . '</value> <label>'. $translate->_('On attendee responses too') . '</label> </option> </options>'; break; */ /* case self::NOTIFICATION_LEVEL: $translate = Tinebase_Translation::getTranslation($this->_application); $preference->value = Crm_Controller_EventNotifications::NOTIFICATION_LEVEL_EVENT_RESCHEDULE; $preference->options = '<?xml version="1.0" encoding="UTF-8"?> <options> <option> <value>'. Crm_Controller_EventNotifications::NOTIFICATION_LEVEL_NONE . '</value> <label>'. $translate->_('Never') . '</label> </option> <option> <value>'. Crm_Controller_EventNotifications::NOTIFICATION_LEVEL_INVITE_CANCEL . '</value> <label>'. $translate->_('On invitaion and cancelation only') . '</label> </option> <option> <value>'. Crm_Controller_EventNotifications::NOTIFICATION_LEVEL_EVENT_RESCHEDULE . '</value> <label>'. $translate->_('On time changes') . '</label> </option> <option> <value>'. Crm_Controller_EventNotifications::NOTIFICATION_LEVEL_EVENT_UPDATE . '</value> <label>'. $translate->_('On all updates but attendee responses') . '</label> </option> <option> <value>'. Crm_Controller_EventNotifications::NOTIFICATION_LEVEL_ATTENDEE_STATUS_UPDATE . '</value> <label>'. $translate->_('On attendee responses too') . '</label> </option> </options>'; break; */ case self::SEND_NOTIFICATION_OF_OWN_ACTIONS: $preference->value = 1; $preference->options = '<?xml version="1.0" encoding="UTF-8"?> <options> <special>' . Tinebase_Preference_Abstract::YES_NO_OPTIONS . '</special> </options>'; break; case self::DEFAULTPERSISTENTFILTER: $preference->value = Tinebase_PersistentFilter::getPreferenceValues('Crm', $_accountId, self::DEFAULTPERSISTENTFILTER_NAME); break; default: throw new Tinebase_Exception_NotFound('Default preference with name ' . $_preferenceName . ' not found.'); } return $preference; }