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


PHP Tinebase_Model_Filter_FilterGroup::getAccountFilter方法代碼示例

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


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

示例1: search

 /**
  * search for preferences
  * 
  * @param  Tinebase_Model_Filter_FilterGroup    $_filter
  * @param  Tinebase_Model_Pagination            $_pagination
  * @param  boolean                              $_onlyIds
  * @return Tinebase_Record_RecordSet|array of preferences / pref ids
  */
 public function search(Tinebase_Model_Filter_FilterGroup $_filter = NULL, Tinebase_Model_Pagination $_pagination = NULL, $_onlyIds = FALSE)
 {
     // make sure account is set in filter
     $userId = Tinebase_Core::getUser()->getId();
     if (!$_filter->isFilterSet('account')) {
         $accountFilter = $_filter->createFilter('account', 'equals', array('accountId' => $userId, 'accountType' => Tinebase_Acl_Rights::ACCOUNT_TYPE_USER));
         $_filter->addFilter($accountFilter);
     } else {
         // only admins can search for other users prefs
         $accountFilter = $_filter->getAccountFilter();
         $accountFilterValue = $accountFilter->getValue();
         if ($accountFilterValue['accountId'] != $userId && $accountFilterValue['accountType'] == Tinebase_Acl_Rights::ACCOUNT_TYPE_USER) {
             if (!Tinebase_Acl_Roles::getInstance()->hasRight($this->_application, Tinebase_Core::getUser()->getId(), Tinebase_Acl_Rights_Abstract::ADMIN)) {
                 return new Tinebase_Record_RecordSet('Tinebase_Model_Preference');
             }
         }
     }
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($_filter->toArray(), TRUE));
     }
     $paging = new Tinebase_Model_Pagination(array('dir' => 'ASC', 'sort' => array('name')));
     $allPrefs = parent::search($_filter, $_pagination, $_onlyIds);
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r(is_array($allPrefs) ? $allPrefs : $allPrefs->toArray(), TRUE));
     }
     if (!$_onlyIds) {
         $this->_addDefaultAndRemoveUndefinedPrefs($allPrefs, $_filter);
         // get single matching preferences for each different pref
         $result = $this->getMatchingPreferences($allPrefs);
     } else {
         $result = $allPrefs;
     }
     return $result;
 }
開發者ID:,項目名稱:,代碼行數:42,代碼來源:


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