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


PHP Tinebase_Model_Filter_FilterGroup::toArray方法代码示例

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


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

示例1: _getRecords

 /**
  * get records and resolve fields
  *
  * @return Tinebase_Record_RecordSet
  */
 protected function _getRecords()
 {
     $pagination = !empty($this->_options['sortInfo']) ? new Tinebase_Model_Pagination($this->_options['sortInfo']) : new Tinebase_Model_Pagination();
     if ($this->_recordIds === NULL) {
         // need to fetch record ids first because filtered fields can change during iteration step
         if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
             Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Getting record ids using filter: ' . print_r($this->_filter->toArray(), TRUE) . ' and pagination: ' . print_r($pagination->toArray(), true));
         }
         $this->_recordIds = $this->_controller->search($this->_filter, $pagination, FALSE, TRUE, $this->_options['searchAction']);
         $this->_totalCount = count($this->_recordIds);
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Found ' . $this->_totalCount . ' total records to process.');
         }
         if (empty($this->_recordIds)) {
             return new Tinebase_Record_RecordSet($this->_filter->getModelName());
         }
     }
     // get records by filter (ensure acl)
     $filterClassname = get_class($this->_filter);
     $recordIdsForIteration = array_splice($this->_recordIds, 0, $this->_options['limit']);
     $idFilter = new $filterClassname(array(array('field' => isset($this->_options['idProperty']) || array_key_exists('idProperty', $this->_options) ? $this->_options['idProperty'] : 'id', 'operator' => 'in', 'value' => $recordIdsForIteration)));
     $records = $this->_controller->search($idFilter, $pagination, $this->_options['getRelations']);
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Got ' . count($records) . ' for next iteration.');
     }
     return $records;
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:32,代码来源:Iterator.php

示例2: _exportRecords

 /**
  * export records
  */
 protected function _exportRecords()
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Starting export of ' . $this->_modelName . ' with filter: ' . print_r($this->_filter->toArray(), true) . ' and sort info: ' . print_r($this->_sortInfo, true));
     }
     $iterator = new Tinebase_Record_Iterator(array('iteratable' => $this, 'controller' => $this->_controller, 'filter' => $this->_filter, 'options' => array('searchAction' => 'export', 'sortInfo' => $this->_sortInfo, 'getRelations' => $this->_getRelations)));
     $result = $iterator->iterate();
     $this->_onAfterExportRecords($result);
     if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
         Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Exported ' . $result['totalcount'] . ' records.');
     }
 }
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:15,代码来源:Abstract.php

示例3: toArray

 public function toArray($_valueToJson = false)
 {
     $result = parent::toArray($_valueToJson);
     /* foreach ($result as &$filterData) {
            if ($filterData['field'] == 'id' && $_valueToJson == true && ! empty($filterData['value'])) {
                //if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' value:' . print_r($filterData['value'], true));
                try {
                    $filterData['value'] = Donator_Controller_Project::getInstance()->get($filterData['value'])->toArray();
                } catch (Tinebase_Exception_NotFound $nfe) {
                    if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) Tinebase_Core::getLogger()->INFO(__METHOD__ . '::' . __LINE__ . " could not find and resolve timeaccount {$filterData['value']}");
                }
            }
        }*/
     return $result;
 }
开发者ID:carriercomm,项目名称:Billing-5,代码行数:15,代码来源:DebitorFilter.php

示例4: 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,代码来源:

示例5: toArray

 /**
  * returns array with the filter settings of this filter group 
  *
  * @param  bool $_valueToJson resolve value for json api?
  * @return array
  */
 public function toArray($_valueToJson = false)
 {
     $result = parent::toArray($_valueToJson);
     foreach ($result as &$filterData) {
         if (isset($filterData['field']) && $filterData['field'] == 'id' && $_valueToJson == true && !empty($filterData['value']) && !is_array($filterData['value'])) {
             try {
                 $filterData['value'] = Timetracker_Controller_Timeaccount::getInstance()->get($filterData['value'])->toArray();
             } catch (Tinebase_Exception_NotFound $nfe) {
                 if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
                     Tinebase_Core::getLogger()->INFO(__METHOD__ . '::' . __LINE__ . " could not find and resolve timeaccount {$filterData['value']}");
                 }
             }
         }
     }
     return $result;
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:22,代码来源:TimeaccountFilter.php


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