當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Tinebase_Model_Filter_FilterGroup::removeFilter方法代碼示例

本文整理匯總了PHP中Tinebase_Model_Filter_FilterGroup::removeFilter方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tinebase_Model_Filter_FilterGroup::removeFilter方法的具體用法?PHP Tinebase_Model_Filter_FilterGroup::removeFilter怎麽用?PHP Tinebase_Model_Filter_FilterGroup::removeFilter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Tinebase_Model_Filter_FilterGroup的用法示例。


在下文中一共展示了Tinebase_Model_Filter_FilterGroup::removeFilter方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: search

 /**
  * Calendar optimized search function
  *
  * @param  Tinebase_Model_Filter_FilterGroup    $_filter
  * @param  Tinebase_Model_Pagination            $_pagination
  * @param  boolean                              $_onlyIds
  * @param  bool   $_getDeleted
  * @return Tinebase_Record_RecordSet|array
  */
 public function search(Tinebase_Model_Filter_FilterGroup $_filter = NULL, Tinebase_Model_Pagination $_pagination = NULL, $_onlyIds = FALSE, $_getDeleted = FALSE)
 {
     if ($_pagination === NULL) {
         $_pagination = new Tinebase_Model_Pagination();
     }
     // we use a an extra select to reduce data amount where grants etc. have to be computed for.
     // the exdate is already appended here, to reduce virtual row numbers later
     $subselect = $this->_getSelectSimple('id', $_getDeleted);
     $subselect->joinLeft(array('exdate' => $this->_tablePrefix . 'cal_exdate'), $this->_db->quoteIdentifier('exdate.cal_event_id') . ' = ' . $this->_db->quoteIdentifier($this->_tableName . '.id'), array('exdate' => Tinebase_Backend_Sql_Command::getAggregateFunction($this->_db, $this->_db->quoteIdentifier('exdate.exdate'))));
     // this attendee join has nothing to do with grants but is here for attendee/status/... filters
     $subselect->joinLeft(array('attendee' => $this->_tablePrefix . 'cal_attendee'), $this->_db->quoteIdentifier('attendee.cal_event_id') . ' = ' . $this->_db->quoteIdentifier('cal_events.id'), array());
     if (!$_getDeleted) {
         $subselect->joinLeft(array('dispcontainer' => $this->_tablePrefix . 'container'), $this->_db->quoteIdentifier('dispcontainer.id') . ' = ' . $this->_db->quoteIdentifier('attendee.displaycontainer_id'), array());
         $subselect->where($this->_db->quoteIdentifier('dispcontainer.is_deleted') . ' = 0 OR ' . $this->_db->quoteIdentifier('dispcontainer.is_deleted') . 'IS NULL');
     }
     // remove grantsfilter here as we need it in the main select
     $grantsFilter = $_filter->getFilter('grants');
     if ($grantsFilter) {
         $_filter->removeFilter('grants');
     }
     $this->_addFilter($subselect, $_filter);
     $_pagination->appendPaginationSql($subselect);
     $subselect->group($this->_tableName . '.' . 'id');
     $stmt = $this->_db->query($subselect);
     $rows = (array) $stmt->fetchAll(Zend_Db::FETCH_ASSOC);
     $ids = array();
     $exdates = array();
     foreach ($rows as $row) {
         $ids[] = $row['id'];
         $exdates[$row['id']] = $row['exdate'];
     }
     $select = $this->_getSelectSimple('*', $_getDeleted);
     $select->where($this->_db->quoteInto("{$this->_db->quoteIdentifier('cal_events.id')} IN (?)", !empty($ids) ? $ids : ' '));
     $_pagination->appendPaginationSql($select);
     // append grants filters : only take limited set of attendee into account for grants computation
     $attenderFilter = $_filter->getFilter('attender');
     if (!$attenderFilter) {
         // if a container filter is set, take owners of personal containers (solve secretary scenario)
         $containerFilter = $_filter->getFilter('container_id');
         if ($containerFilter && $containerFilter instanceof Calendar_Model_CalendarFilter) {
             $attenderFilter = $containerFilter->getRelatedAttendeeFilter();
         } else {
             $attenderFilter = new Calendar_Model_AttenderFilter('attender', 'equals', array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => Tinebase_Core::getUser()->contact_id));
         }
     }
     $this->_appendEffectiveGrantCalculationSql($select, $attenderFilter);
     if ($grantsFilter) {
         $grantsFilter->appendFilterSql($select, $this);
     }
     $select->group($this->_tableName . '.' . 'id');
     $this->_traitGroup($select);
     $stmt = null;
     // solve PHP bug @see {http://bugs.php.net/bug.php?id=35793}
     $stmt = $this->_db->query($select);
     $rows = (array) $stmt->fetchAll(Zend_Db::FETCH_ASSOC);
     if ($_onlyIds) {
         $identifier = is_bool($_onlyIds) ? $this->_getRecordIdentifier() : $_onlyIds;
         $result = array();
         foreach ($rows as $row) {
             $result[] = $row[$identifier];
         }
     } else {
         foreach ($rows as &$row) {
             $row['exdate'] = $exdates[$row[$this->_getRecordIdentifier()]];
         }
         $result = $this->_rawDataToRecordSet($rows);
     }
     return $result;
 }
開發者ID:rodrigofns,項目名稱:ExpressoLivre3,代碼行數:78,代碼來源:Sql.php


注:本文中的Tinebase_Model_Filter_FilterGroup::removeFilter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。