/**
  * return contentfilter array
  * 
  * @param  int $_filterType
  * @return Tinebase_Model_Filter_FilterGroup
  */
 protected function _getContentFilter($_filterType)
 {
     $filter = parent::_getContentFilter($_filterType);
     // no persistent filter set -> add default filter
     if (!$filter->getId()) {
         $defaultFilter = $filter->createFilter('container_id', 'equals', array('path' => '/personal/' . Tinebase_Core::getUser()->getId()));
         $filter->addFilter($defaultFilter);
     }
     if (in_array($_filterType, $this->_filterArray)) {
         switch ($_filterType) {
             case Syncope_Command_Sync::FILTER_2_WEEKS_BACK:
                 $from = Tinebase_DateTime::now()->subWeek(2);
                 break;
             case Syncope_Command_Sync::FILTER_1_MONTH_BACK:
                 $from = Tinebase_DateTime::now()->subMonth(2);
                 break;
             case Syncope_Command_Sync::FILTER_3_MONTHS_BACK:
                 $from = Tinebase_DateTime::now()->subMonth(3);
                 break;
             case Syncope_Command_Sync::FILTER_6_MONTHS_BACK:
                 $from = Tinebase_DateTime::now()->subMonth(6);
                 break;
         }
         // next 10 years
         $to = Tinebase_DateTime::now()->addYear(10);
         // remove all 'old' period filters
         $filter->removeFilter('period');
         // add period filter
         $filter->addFilter(new Calendar_Model_PeriodFilter('period', 'within', array('from' => $from, 'until' => $to)));
     }
     return $filter;
 }
Exemple #2
0
 /**
  * return contentfilter array
  * 
  * @param  int $_filterType
  * @return Tinebase_Model_Filter_FilterGroup
  */
 protected function _getContentFilter($_filterType)
 {
     $filter = parent::_getContentFilter($_filterType);
     if (in_array($_filterType, $this->_filterArray)) {
         $today = Tinebase_DateTime::now()->setTime(0, 0, 0);
         switch ($_filterType) {
             case Syncope_Command_Sync::FILTER_1_DAY_BACK:
                 $received = $today->subDay(1);
                 break;
             case Syncope_Command_Sync::FILTER_3_DAYS_BACK:
                 $received = $today->subDay(3);
                 break;
             case Syncope_Command_Sync::FILTER_1_WEEK_BACK:
                 $received = $today->subWeek(1);
                 break;
             case Syncope_Command_Sync::FILTER_2_WEEKS_BACK:
                 $received = $today->subWeek(2);
                 break;
             case Syncope_Command_Sync::FILTER_1_MONTH_BACK:
                 $received = $today->subMonth(2);
                 break;
         }
         // add period filter
         $filter->addFilter(new Tinebase_Model_Filter_DateTime('received', 'after', $received->get(Tinebase_Record_Abstract::ISO8601LONG)));
     }
     return $filter;
 }
Exemple #3
0
 /**
  * return contentfilter array
  * 
  * @param  int $_filterType
  * @return Tinebase_Model_Filter_FilterGroup
  */
 protected function _getContentFilter($_filterType)
 {
     $filter = parent::_getContentFilter($_filterType);
     // no persistent filter set -> add default filter
     if (!$filter->getId()) {
         $defaultFilter = $filter->createFilter('container_id', 'equals', array('path' => '/personal/' . Tinebase_Core::getUser()->getId()));
         $filter->addFilter($defaultFilter);
     }
     if (in_array($_filterType, $this->_filterArray)) {
         switch ($_filterType) {
             case Syncope_Command_Sync::FILTER_INCOMPLETE:
                 $filter->removeFilter('status');
                 $openStatus = Tasks_Config::getInstance()->get(Tasks_Config::TASK_STATUS)->records->filter('is_open', 1);
                 if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                     Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " filter by status ids " . print_r($openStatus->getId(), true));
                 }
                 $filter->addFilter(new Tinebase_Model_Filter_Text('status', 'in', $openStatus->getId()));
                 break;
         }
     }
     return $filter;
 }