当前位置: 首页>>代码示例>>PHP>>正文


PHP Tinebase_Model_Filter_FilterGroup类代码示例

本文整理汇总了PHP中Tinebase_Model_Filter_FilterGroup的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_Model_Filter_FilterGroup类的具体用法?PHP Tinebase_Model_Filter_FilterGroup怎么用?PHP Tinebase_Model_Filter_FilterGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Tinebase_Model_Filter_FilterGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: factory

 /**
  * get export object for given filter and format
  * 
  * @param Tinebase_Model_Filter_FilterGroup $_filter
  * @param string|array $_options format (as string) or export definition id (array)
  * @param Tinebase_Controller_Record_Interface $_controller (optional)
  * @param array $_additionalOptions (optional)
  * @return Tinebase_Export_Abstract
  * @throws Tinebase_Exception_NotFound
  */
 public static function factory($_filter, $_options, $_controller = NULL, $_additionalOptions = array())
 {
     if (!is_array($_options)) {
         $_options = array('format' => $_options);
     }
     if (array_key_exists('definitionId', $_options)) {
         $definition = Tinebase_ImportExportDefinition::getInstance()->get($_options['definitionId']);
         $exportClass = $definition->plugin;
         // export plugin needs the definition id
         $_additionalOptions = array_merge($_additionalOptions, $_options);
     } else {
         if (array_key_exists('format', $_options) && !empty($_options['format'])) {
             $appName = $_filter->getApplicationName();
             $model = $_filter->getModelName();
             $exportClass = $appName . '_Export_' . ucfirst(strtolower($_options['format']));
             if (!@class_exists($exportClass)) {
                 // check for model specific export class
                 list($a, $b, $modelPart) = explode('_', $model);
                 $exportClass = $exportClass . '_' . $modelPart;
                 if (!@class_exists($exportClass)) {
                     throw new Tinebase_Exception_NotFound('No ' . $_options['format'] . ' export class found for ' . $appName . ' / ' . $model);
                 }
             }
         } else {
             throw new Tinebase_Exception_InvalidArgument('Export definition ID or format required in options');
         }
     }
     if (preg_match('/pdf/i', $exportClass)) {
         // legacy
         $result = new $exportClass($_additionalOptions);
     } else {
         $result = new $exportClass($_filter, $_controller, $_additionalOptions);
     }
     return $result;
 }
开发者ID:,项目名称:,代码行数:45,代码来源:

示例2: update_0

 /**
  * update to 8.1
  * - move ack & snooze time from attendee to alarm
  */
 public function update_0()
 {
     // find all events with ack or snooze times set
     $eventIds = $this->_db->query("SELECT DISTINCT " . $this->_db->quoteIdentifier('cal_event_id') . " FROM " . $this->_db->quoteIdentifier(SQL_TABLE_PREFIX . "cal_attendee") . " WHERE " . $this->_db->quoteIdentifier("alarm_ack_time") . " IS NOT NULL OR " . $this->_db->quoteIdentifier("alarm_snooze_time") . " IS NOT NULL")->fetchAll(Zend_Db::FETCH_ASSOC);
     $attendeeBE = new Calendar_Backend_Sql_Attendee();
     $alarmBE = Tinebase_Alarm::getInstance();
     foreach ($eventIds as $eventId) {
         $eventId = $eventId['cal_event_id'];
         $attendeeFilter = new Tinebase_Model_Filter_FilterGroup();
         $attendeeFilter->addFilter(new Tinebase_Model_Filter_Text('cal_event_id', 'equals', $eventId));
         $attendees = $attendeeBE->search($attendeeFilter);
         $alarms = $alarmBE->search(new Tinebase_Model_AlarmFilter(array(array('field' => 'model', 'operator' => 'equals', 'value' => 'Calendar_Model_Event'), array('field' => 'record_id', 'operator' => 'equals', 'value' => $eventId))));
         foreach ($alarms as $alarm) {
             foreach ($attendees as $attendee) {
                 if ($attendee->alarm_ack_time instanceof Tinebase_DateTime) {
                     $alarm->setOption("acknowledged-{$attendee->user_id}", $attendee->alarm_ack_time->format(Tinebase_Record_Abstract::ISO8601LONG));
                 }
                 if ($attendee->alarm_snooze_time instanceof Tinebase_DateTime) {
                     $alarm->setOption("snoozed-{$attendee->user_id}", $attendee->alarm_snooze_time->format(Tinebase_Record_Abstract::ISO8601LONG));
                 }
             }
             $alarmBE->update($alarm);
         }
     }
     // delte ack & snooze from attendee
     $this->_backend->dropCol('cal_attendee', 'alarm_ack_time');
     $this->_backend->dropCol('cal_attendee', 'alarm_snooze_time');
     $this->setTableVersion('cal_attendee', 5);
     $this->setApplicationVersion('Calendar', '8.1');
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:34,代码来源:Release8.php

示例3: _advancedSearch

 /**
  * append relation filter
  *
  * @param Tinebase_Model_Filter_FilterGroup $filter
  */
 protected function _advancedSearch(Tinebase_Model_Filter_FilterGroup $filter)
 {
     $relationFilter = $this->_getAdvancedSearchFilter('Crm_Model_Lead', array('Addressbook_Model_Contact', 'Sales_Model_Product', 'Tasks_Model_Task'));
     if ($relationFilter) {
         $filter->addFilter($relationFilter);
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:12,代码来源:LeadQueryFilter.php

示例4: checkFilterACL

 /**
  * Removes accounts where current user has no access to
  * 
  * @param Tinebase_Model_Filter_FilterGroup $_filter
  * @param string $_action get|update
  * 
  * @todo move logic to Felamimail_Model_MessageFilter
  */
 public function checkFilterACL(Tinebase_Model_Filter_FilterGroup $_filter, $_action = 'get')
 {
     $accountFilter = $_filter->getFilter('account_id');
     // force a $accountFilter filter (ACL) / all accounts of user
     if ($accountFilter === NULL || $accountFilter['operator'] !== 'equals' || !empty($accountFilter['value'])) {
         $_filter->createFilter('account_id', 'equals', array());
     }
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:16,代码来源:Abstract.php

示例5: __construct

 /**
  * the constructor
  *
  * @param Tinebase_Model_Filter_FilterGroup $_filter
  * @param Tinebase_Controller_Record_Interface $_controller (optional)
  * @param array $_additionalOptions (optional) additional options
  */
 public function __construct(Tinebase_Model_Filter_FilterGroup $_filter, Tinebase_Controller_Record_Interface $_controller = NULL, $_additionalOptions = array())
 {
     $periodFilter = $_filter->getFilter('period');
     if ($periodFilter) {
         $this->_from = $periodFilter->getFrom();
         $this->_until = $periodFilter->getUntil();
     }
     parent::__construct($_filter, $_controller, $_additionalOptions);
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:16,代码来源:Abstract.php

示例6: _appendRecordPaths

 /**
  * append record paths (if path filter is set)
  *
  * @param Tinebase_Record_RecordSet $_records
  * @param Tinebase_Model_Filter_FilterGroup $_filter
  *
  * TODO move to generic json converter
  */
 protected function _appendRecordPaths($_records, $_filter)
 {
     if ($_filter && $_filter->getFilter('path', false, true) !== null) {
         $recordPaths = Tinebase_Record_Path::getInstance()->getPathsForRecords($_records);
         foreach ($_records as $record) {
             $record->paths = $recordPaths->filter('record_id', $record->getId());
         }
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:17,代码来源:Json.php

示例7: init

 /**
  * the constructor
  *
  * @param Tinebase_Model_Filter_FilterGroup $_filter
  * @param Tinebase_Controller_Record_Interface $_controller (optional)
  * @param array $_additionalOptions (optional) additional options
  */
 public function init(Tinebase_Model_Filter_FilterGroup $_filter, Tinebase_Controller_Record_Interface $_controller = NULL, $_additionalOptions = array())
 {
     $this->_applicationName = 'Calendar';
     $this->_modelName = 'Event';
     $periodFilter = $_filter->getFilter('period', false, true);
     if ($periodFilter) {
         $this->_from = $periodFilter->getFrom();
         $this->_until = $periodFilter->getUntil();
     }
     parent::__construct($_filter, $_controller, $_additionalOptions);
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:18,代码来源:GenericTrait.php

示例8: factory

 /**
  * get export object for given filter and format
  * 
  * @param Tinebase_Model_Filter_FilterGroup $_filter
  * @param string|array $_options format (as string) or export definition id (array)
  * @param Tinebase_Controller_Record_Interface $_controller (optional)
  * @param array $_additionalOptions (optional)
  * @return Tinebase_Export_Abstract
  * @throws Tinebase_Exception_NotFound
  */
 public static function factory($_filter, $_options, $_controller = NULL, $_additionalOptions = array())
 {
     if (!is_array($_options)) {
         $_options = array('format' => $_options);
     }
     // always merge options? this needs to be refactored!
     $_additionalOptions = array_merge($_additionalOptions, $_options);
     if (isset($_options['definitionId']) || array_key_exists('definitionId', $_options)) {
         $definition = Tinebase_ImportExportDefinition::getInstance()->get($_options['definitionId']);
         $exportClass = $definition->plugin;
     } else {
         if ((isset($_options['format']) || array_key_exists('format', $_options)) && !empty($_options['format'])) {
             $appName = $_filter->getApplicationName();
             $model = $_filter->getModelName();
             $exportClass = $appName . '_Export_' . ucfirst(strtolower($_options['format']));
             // start output buffering to catch errors, append them to log and exception
             ob_start();
             if (!class_exists($exportClass)) {
                 $ob = ob_get_length() > 0 ? ob_get_clean() : '';
                 // check for model specific export class
                 list($a, $b, $modelPart) = explode('_', $model);
                 $exportClass2 = $exportClass . '_' . $modelPart;
                 if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) {
                     Tinebase_Core::getLogger()->log(__METHOD__ . '::' . __LINE__ . ' Could not find class ' . $exportClass . ' trying ' . $exportClass2 . '. Output Buffer: ' . PHP_EOL . $ob, Zend_Log::NOTICE);
                 }
                 if (!class_exists($exportClass2)) {
                     $ob = ob_get_length() > 0 ? ob_get_clean() : NULL;
                     ob_end_flush();
                     throw new Tinebase_Exception_NotFound('No ' . $_options['format'] . ' export class found for ' . $appName . ' / ' . $model . '. ClassName: ' . $exportClass2 . ($ob ? 'Output: ' . $ob : ''));
                 } else {
                     $exportClass = $exportClass2;
                 }
             }
             ob_end_flush();
         } else {
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                 Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Export options: ' . print_r($_options, TRUE));
             }
             throw new Tinebase_Exception_InvalidArgument('Export definition ID or format required in options');
         }
     }
     if (preg_match('/pdf/i', $exportClass)) {
         // legacy
         $result = new $exportClass($_additionalOptions);
     } else {
         $result = new $exportClass($_filter, $_controller, $_additionalOptions);
     }
     return $result;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:59,代码来源:Export.php

示例9: search

 /**
  * Search for records matching given filter
  *
  * @param  Tinebase_Model_Filter_FilterGroup    $_filter
  * @param  Tinebase_Model_Pagination            $_pagination
  * @param  array|string|boolean                 $_cols columns to get, * per default / use self::IDCOL or TRUE to get only ids
  * @return Tinebase_Record_RecordSet|array
  */
 public function search(Tinebase_Model_Filter_FilterGroup $_filter = NULL, Tinebase_Model_Pagination $_pagination = NULL, $_cols = '*')
 {
     $filters = $_filter->getFilterObjects();
     //        TODO: implement this folder filter
     //        $folderFilter = new Felamimail_Model_FolderFilter(array(
     //                        array('field' => 'account_id',  'operator' => 'in',     'value' => $accounts->getArrayOfIds()),
     //                        array('field' => 'localname',   'operator' => 'equals', 'value' => 'INBOX')
     //        ));
     foreach ($filters as $filter) {
         switch ($filter->getField()) {
             case 'account_id':
                 $accountId = $filter->getValue();
                 break;
             case 'parent':
                 $globalName = $filter->getValue();
                 $parent = true;
                 break;
             case 'id':
                 $felamimailAccount = Felamimail_Controller_Account::getInstance()->search()->toArray();
                 $accountId = $felamimailAccount[0]['id'];
                 $globalName = $filter->getValue();
                 $parent = true;
                 break;
             case 'globalname':
                 $globalName = $filter->getValue();
                 if ($filter->getOperator() == 'startswith') {
                     $parent = true;
                     $globalName = substr($globalName, 0, -1);
                 }
                 break;
         }
     }
     $resultArray = array();
     $accountId = (array) $accountId;
     foreach ($accountId as $id) {
         $account = Felamimail_Controller_Account::getInstance()->get($id);
         if ($parent === true) {
             $folders = $this->_getFoldersFromIMAP($account, $globalName);
             foreach ($folders as $folder) {
                 $resultArray[] = $this->get(self::encodeFolderUid($folder['globalName'], $id));
             }
         } else {
             $resultArray[] = $this->get(self::encodeFolderUid(Felamimail_Model_Folder::encodeFolderName($globalName), $id));
         }
     }
     $result = new Tinebase_Record_RecordSet('Felamimail_Model_Folder', $resultArray, true);
     return $result;
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:56,代码来源:Folder.php

示例10: search

 /**
  * get list of records
  *
  * @param Tinebase_Model_Filter_FilterGroup|optional $_filter
  * @param Tinebase_Model_Pagination|optional $_pagination
  * @param boolean|array $_getRelations
  * @param boolean $_onlyIds
  * @param string $_action for right/acl check
  * @return Tinebase_Record_RecordSet|array
  */
 public function search(Tinebase_Model_Filter_FilterGroup $_filter = NULL, Tinebase_Record_Interface $_pagination = NULL, $_getRelations = FALSE, $_onlyIds = FALSE, $_action = 'get')
 {
     //@TODO support more appfilter combinations when needed
     $appFilter = $_filter->getFilter('application_id');
     $app = Tinebase_Application::getInstance()->getApplicationById($appFilter->getValue());
     $appname = $app->name;
     if (!Tinebase_Core::getUser()->hasRight($appname, 'admin')) {
         throw new Tinebase_Exception_AccessDenied("You do not have admin rights for {$appname}");
     }
     $configRecords = new Tinebase_Record_RecordSet('Tinebase_Model_Config');
     $appConfigObject = Tinebase_Config::getAppConfig($appname);
     $appConfigDefinitions = $appConfigObject->getProperties();
     $appDBConfig = $this->_configBackend->search($_filter);
     foreach ($appConfigDefinitions as $name => $definition) {
         if (array_key_exists('setByAdminModule', $definition) && $definition['setByAdminModule']) {
             $configFromFile = $appConfigObject->getConfigFileSection($name);
             $configFromDb = $appDBConfig->filter('name', $name)->getFirstRecord();
             if ($configFromDb && !$configFromFile) {
                 $configRecord = $this->_mergeDefinition($configFromDb, $definition);
                 $configRecord->source = Tinebase_Model_Config::SOURCE_DB;
             } else {
                 $definition['id'] = 'virtual-' . $name;
                 $definition['application_id'] = $app->getId();
                 $definition['name'] = $name;
                 $definition['value'] = json_encode($configFromFile);
                 $definition['source'] = is_null($configFromFile) ? Tinebase_Model_Config::SOURCE_DEFAULT : Tinebase_Model_Config::SOURCE_FILE;
                 $configRecord = new Tinebase_Model_Config($definition);
             }
             // exclude config's which the admin can't set
             if ($configRecord->source != Tinebase_Model_Config::SOURCE_FILE) {
                 $configRecords->addRecord($configRecord);
             }
         }
     }
     return $configRecords;
 }
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:46,代码来源:Config.php

示例11: _addContainerFilter

 /**
  * (non-PHPdoc)
  * @see ActiveSync_Frontend_Abstract::_addContainerFilter()
  */
 protected function _addContainerFilter(Tinebase_Model_Filter_FilterGroup $_filter, $_containerId)
 {
     // custom filter gets added when created
     $_filter->createFilter('account_id', 'equals', Tinebase_Core::getPreference('Expressomail')->{Expressomail_Preference::DEFAULTACCOUNT});
     $_filter->addFilter($_filter->createFilter('folder_id', 'equals', $_containerId));
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:10,代码来源:ActiveSync.php

示例12: checkFilterACL

 /**
  * Removes containers where current user has no access to
  * 
  * @param Timetracker_Model_TimeaccountFilter $_filter
  * @param string $_action
  */
 public function checkFilterACL(Tinebase_Model_Filter_FilterGroup $_filter, $_action = 'get')
 {
     switch ($_action) {
         case 'get':
             $_filter->setRequiredGrants(array(Timetracker_Model_TimeaccountGrants::BOOK_OWN, Timetracker_Model_TimeaccountGrants::BOOK_ALL, Timetracker_Model_TimeaccountGrants::VIEW_ALL, Tinebase_Model_Grants::GRANT_ADMIN));
             break;
         case 'update':
             $_filter->setRequiredGrants(array(Tinebase_Model_Grants::GRANT_ADMIN));
             break;
         case 'export':
             $_filter->setRequiredGrants(array(Tinebase_Model_Grants::GRANT_EXPORT, Tinebase_Model_Grants::GRANT_ADMIN));
             break;
         default:
             throw new Timetracker_Exception_UnexpectedValue('Unknown action: ' . $_action);
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:22,代码来源:Timeaccount.php

示例13: search

 /**
  * search tree nodes
  * 
  * @param Tinebase_Model_Filter_FilterGroup|optional $_filter
  * @param Tinebase_Model_Pagination|optional $_pagination
  * @param bool $_getRelations
  * @param bool $_onlyIds
  * @param string|optional $_action
  * @return Tinebase_Record_RecordSet of Tinebase_Model_Tree_Node
  */
 public function search(Tinebase_Model_Filter_FilterGroup $_filter = NULL, Tinebase_Record_Interface $_pagination = NULL, $_getRelations = FALSE, $_onlyIds = FALSE, $_action = 'get')
 {
     // perform recursive search on recursive filter set
     if ($_filter->getFilter('recursive')) {
         return $this->_searchNodesRecursive($_filter, $_pagination);
     } else {
         $path = $this->_checkFilterACL($_filter, $_action);
     }
     if ($path->containerType === Tinebase_Model_Tree_Node_Path::TYPE_ROOT) {
         $result = $this->_getRootNodes();
     } else {
         if ($path->containerType === Tinebase_Model_Container::TYPE_PERSONAL && !$path->containerOwner) {
             if (!file_exists($path->statpath)) {
                 $this->_backend->mkdir($path->statpath);
             }
             $result = $this->_getOtherUserNodes();
         } else {
             try {
                 $result = $this->_backend->searchNodes($_filter, $_pagination);
             } catch (Tinebase_Exception_NotFound $tenf) {
                 // create basic nodes like personal|shared|user root
                 if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                     Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . $path->statpath);
                 }
                 if ($path->name === Tinebase_Model_Container::TYPE_SHARED || $path->statpath === $this->_backend->getApplicationBasePath(Tinebase_Application::getInstance()->getApplicationByName($this->_applicationName), Tinebase_Model_Container::TYPE_PERSONAL) . '/' . Tinebase_Core::getUser()->getId()) {
                     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Creating new path ' . $path->statpath);
                     }
                     $this->_backend->mkdir($path->statpath);
                     $result = $this->_backend->searchNodes($_filter, $_pagination);
                 } else {
                     throw $tenf;
                 }
             }
             $this->resolveContainerAndAddPath($result, $path);
             $this->_sortContainerNodes($result, $path, $_pagination);
         }
     }
     return $result;
 }
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:50,代码来源:Node.php

示例14: _addDefaultAndRemoveUndefinedPrefs

 /**
  * add default preferences to and remove undefined preferences from record set
  * 
  * @param Tinebase_Record_RecordSet $_prefs
  * @param Tinebase_Model_Filter_FilterGroup $_filter
  */
 protected function _addDefaultAndRemoveUndefinedPrefs(Tinebase_Record_RecordSet $_prefs, Tinebase_Model_Filter_FilterGroup $_filter)
 {
     $allAppPrefs = $this->getAllApplicationPreferences();
     // add default prefs if not already in array (only if no name or type filters are set)
     if (!$_filter->isFilterSet('name') && !$_filter->isFilterSet('type')) {
         $missingDefaultPrefs = array_diff($allAppPrefs, $_prefs->name);
         foreach ($missingDefaultPrefs as $prefName) {
             $_prefs->addRecord($this->getApplicationPreferenceDefaults($prefName));
         }
     }
     // remove all prefs that are not defined
     $undefinedPrefs = array_diff($_prefs->name, $allAppPrefs);
     if (count($undefinedPrefs) > 0) {
         $_prefs->addIndices(array('name'));
         foreach ($undefinedPrefs as $undefinedPrefName) {
             $record = $_prefs->find('name', $undefinedPrefName);
             $_prefs->removeRecord($record);
             if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
                 Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Removed undefined preference from result: ' . $undefinedPrefName);
             }
         }
     }
 }
开发者ID:,项目名称:,代码行数:29,代码来源:

示例15: _getFilterObject

 /**
  * get the filter group object
  *
  * @param $filterModel
  * @return Tinebase_Model_Filter_FilterGroup
  */
 protected function _getFilterObject($filterModel)
 {
     if (!class_exists($filterModel)) {
         $configuredModel = preg_replace('/Filter$/', '', $filterModel);
         // TODO check if model class exists?
         //if (class_exists($configuredModel))
         // use generic filter model
         $filter = new Tinebase_Model_Filter_FilterGroup();
         $filter->setConfiguredModel($configuredModel);
     } else {
         $filter = new $filterModel();
     }
     return $filter;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:20,代码来源:Abstract.php


注:本文中的Tinebase_Model_Filter_FilterGroup类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。