/**
  * asserts correct event filter and calendar user in MSEventFacade
  * 
  * NOTE: this is nessesary as MSEventFacade is a singleton and in some operations (e.g. move) there are 
  *       multiple instances of self
  */
 public function assertEventFacadeParams(Tinebase_Model_Container $container, $setEventFilter = true)
 {
     if (!$this->_currentEventFacadeContainer || $this->_currentEventFacadeContainer->getId() !== $container->getId()) {
         $this->_currentEventFacadeContainer = $container;
         try {
             $calendarUserId = $container->type == Tinebase_Model_Container::TYPE_PERSONAL ? Addressbook_Controller_Contact::getInstance()->getContactByUserId($container->getOwner(), true)->getId() : Tinebase_Core::getUser()->contact_id;
         } catch (Exception $e) {
             $calendarUserId = Calendar_Controller_MSEventFacade::getCurrentUserContactId();
         }
         $calendarUser = new Calendar_Model_Attender(array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $calendarUserId));
         $this->setCalendarUser($calendarUser);
         if ($setEventFilter) {
             $eventFilter = new Calendar_Model_EventFilter(array(array('field' => 'container_id', 'operator' => 'equals', 'value' => $container->getId())));
             $this->setEventFilter($eventFilter);
         }
     }
 }
コード例 #2
0
 /**
  * the constructor
  *
  * don't use the constructor. use the singleton 
  */
 private function __construct()
 {
     $this->_applicationName = 'Calendar';
     $this->_modelName = 'Calendar_Model_Event';
     $this->_backend = new Calendar_Backend_Sql();
     // set default CU
     $this->setCalendarUser(new Calendar_Model_Attender(array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => Calendar_Controller_MSEventFacade::getCurrentUserContactId())));
 }