本文整理匯總了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;
}