/**
  * event handler function
  * 
  * all events get routed through this function
  *
  * @param Tinebase_Event_Abstract $_eventObject the eventObject
  */
 protected function _handleEvent(Tinebase_Event_Abstract $_eventObject)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . ' (' . __LINE__ . ') handle event of type ' . get_class($_eventObject));
     }
     switch (get_class($_eventObject)) {
         case 'Admin_Event_AddAccount':
             //$this->createPersonalFolder($_eventObject->account);
             Tinebase_Core::getPreference('Calendar')->getValueForUser(Calendar_Preference::DEFAULTCALENDAR, $_eventObject->account->getId());
             break;
         case 'Tinebase_Event_User_DeleteAccount':
             /**
              * @var Tinebase_Event_User_DeleteAccount $_eventObject
              */
             $this->_handleDeleteUserEvent($_eventObject);
             // let event bubble
             parent::_handleEvent($_eventObject);
             break;
         case 'Admin_Event_UpdateGroup':
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                 Tinebase_Core::getLogger()->debug(__METHOD__ . ' (' . __LINE__ . ') updated group ' . $_eventObject->group->name);
             }
             Tinebase_ActionQueue::getInstance()->queueAction('Calendar.onUpdateGroup', $_eventObject->group->getId());
             break;
         case 'Admin_Event_AddGroupMember':
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                 Tinebase_Core::getLogger()->debug(__METHOD__ . ' (' . __LINE__ . ') add groupmember ' . (string) $_eventObject->userId . ' to group ' . (string) $_eventObject->groupId);
             }
             Tinebase_ActionQueue::getInstance()->queueAction('Calendar.onUpdateGroup', $_eventObject->groupId);
             break;
         case 'Admin_Event_RemoveGroupMember':
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                 Tinebase_Core::getLogger()->debug(__METHOD__ . ' (' . __LINE__ . ') removed groupmember ' . (string) $_eventObject->userId . ' from group ' . (string) $_eventObject->groupId);
             }
             Tinebase_ActionQueue::getInstance()->queueAction('Calendar.onUpdateGroup', $_eventObject->groupId);
             break;
         case 'Tinebase_Event_Container_BeforeCreate':
             $this->_handleContainerBeforeCreateEvent($_eventObject);
             break;
     }
 }
Example #2
0
 public function getConfigSettings($_resolve = FALSE)
 {
     $cache = Tinebase_Core::get('cache');
     $cacheId = convertCacheId('getCrmSettings');
     $result = $cache->load($cacheId);
     if (!$result) {
         $translate = Tinebase_Translation::getTranslation('Crm');
         $result = new Crm_Model_Config(array('defaults' => parent::getConfigSettings()));
         $others = array(Crm_Model_Config::LEADTYPES => array(array('id' => 1, 'leadtype' => $translate->_('Customer')), array('id' => 2, 'leadtype' => $translate->_('Partner')), array('id' => 3, 'leadtype' => $translate->_('Reseller'))), Crm_Model_Config::LEADSTATES => array(array('id' => 1, 'leadstate' => $translate->_('open'), 'probability' => 0, 'endslead' => 0), array('id' => 2, 'leadstate' => $translate->_('contacted'), 'probability' => 10, 'endslead' => 0), array('id' => 3, 'leadstate' => $translate->_('waiting for feedback'), 'probability' => 30, 'endslead' => 0), array('id' => 4, 'leadstate' => $translate->_('quote sent'), 'probability' => 50, 'endslead' => 0), array('id' => 5, 'leadstate' => $translate->_('accepted'), 'probability' => 100, 'endslead' => 1), array('id' => 6, 'leadstate' => $translate->_('lost'), 'probability' => 0, 'endslead' => 1)), Crm_Model_Config::LEADSOURCES => array(array('id' => 1, 'leadsource' => $translate->_('Market')), array('id' => 2, 'leadsource' => $translate->_('Email')), array('id' => 3, 'leadsource' => $translate->_('Telephone')), array('id' => 4, 'leadsource' => $translate->_('Website'))));
         foreach ($others as $setting => $defaults) {
             $result->{$setting} = Tinebase_Config::getInstance()->getConfigAsArray($setting, $this->_applicationName, $defaults);
         }
         // save result and tag it with 'settings'
         $cache->save($result, $cacheId, array('settings'));
     }
     return $result;
 }
Example #3
0
 /**
  * save SimpleFAAQ settings
  *
  * @param SimpleFAQ_Model_Config $_settings
  * @return SimpleFAQ_Model_Config
  *
  * @todo generalize this
  */
 public function saveConfigSettings($_settings)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Updating SimpleFAQ Settings: ' . print_r($_settings->toArray(), TRUE));
     }
     foreach ($_settings->toArray() as $field => $value) {
         if ($field == 'id') {
             continue;
         } else {
             if ($field == 'defaults') {
                 parent::saveConfigSettings($value);
             } else {
                 Tinebase_Config::getInstance()->setConfigForApplication($field, Zend_Json::encode($value), $this->_applicationName);
             }
         }
     }
     // invalidate cache
     Tinebase_Core::get('cache')->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array('settings'));
     return $this->getConfigSettings();
 }
 /**
  * get core data for this application
  *
  * @return Tinebase_Record_RecordSet
  */
 public function getCoreDataForApplication()
 {
     $result = parent::getCoreDataForApplication();
     $application = Tinebase_Application::getInstance()->getApplicationByName($this->_applicationName);
     if (Tinebase_Core::getUser()->hasRight($application, Addressbook_Acl_Rights::MANAGE_CORE_DATA_LISTS)) {
         $result->addRecord(new CoreData_Model_CoreData(array('id' => 'adb_lists', 'application_id' => $application, 'model' => 'Addressbook_Model_List', 'label' => 'Lists')));
     }
     if (Tinebase_Core::getUser()->hasRight($application, Addressbook_Acl_Rights::MANAGE_CORE_DATA_LIST_ROLES)) {
         $result->addRecord(new CoreData_Model_CoreData(array('id' => 'adb_list_roles', 'application_id' => $application, 'model' => 'Addressbook_Model_ListRole', 'label' => 'List Roles')));
     }
     return $result;
 }
 /**
  * save crm settings
  * 
  * @param Crm_Model_Config $_settings
  * @return Crm_Model_Config
  * 
  * @todo generalize this
  */
 public function saveConfigSettings($_settings)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Updating Crm Settings: ' . print_r($_settings->toArray(), TRUE));
     }
     foreach ($_settings->toArray() as $field => $value) {
         if ($field == 'id') {
             continue;
         } else {
             if ($field == 'defaults') {
                 parent::saveConfigSettings($value);
             } else {
                 Crm_Config::getInstance()->set($field, $value);
             }
         }
     }
     // invalidate cache
     Tinebase_Core::getCache()->remove('getCrmSettings');
     Crm_Config::getInstance()->clearCache();
     return $this->getConfigSettings();
 }
 /**
  * get core data for this application
  *
  * @return Tinebase_Record_RecordSet
  */
 public function getCoreDataForApplication()
 {
     $result = parent::getCoreDataForApplication();
     $application = Tinebase_Application::getInstance()->getApplicationByName($this->_applicationName);
     if (Tinebase_Core::getUser()->hasRight($application, Calendar_Acl_Rights::MANAGE_RESOURCES)) {
         $result->addRecord(new CoreData_Model_CoreData(array('id' => 'cal_resources', 'application_id' => $application, 'model' => 'Calendar_Model_Resource', 'label' => 'Resources')));
     }
     return $result;
 }