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


PHP DataObjectCollection::getFields方法代码示例

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


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

示例1: index

 public function index(DataObjectCollection $collection, $sh = '', &$c_query = null)
 {
     $display_fields = array();
     $model = $collection->getModel();
     // If selection of display fields is disabled, don't set them up
     if (!$this->search->disable_field_selection) {
         foreach ($model->getFields() as $fieldname => $field) {
             if ($fieldname != 'id' && $fieldname != 'usercompanyid' && substr($fieldname, -3) != '_id' && !isset($model->belongsToField[$fieldname])) {
                 $display_fields[$fieldname] = $field->tag;
             }
         }
         $selected_fields = array();
         if (isset($this->_data['Search']['display_fields'])) {
             foreach ($this->_data['Search']['display_fields'] as $fieldname => $field) {
                 $selected_fields[$fieldname] = prettify($field);
             }
         } else {
             foreach ($collection->getFields() as $fieldname => $field) {
                 if (substr($fieldname, -3) != '_id') {
                     $selected_fields[$fieldname] = $field->tag;
                 }
             }
         }
         $this->view->set('selected_fields', $selected_fields);
         $display_fields = array_diff($display_fields, $selected_fields);
         $this->view->set('display_fields', $display_fields);
     }
     if (!isset($this->_data['ajax_print'])) {
         parent::index($collection, $sh, $c_query);
         return;
     }
     showtime('start-controller-index');
     $collection->setParams();
     if (!$sh instanceof SearchHandler) {
         $sh = $this->setSearchHandler($collection);
     }
     showtime('sh-extracted');
     // Need to set the orderby of the collection in the searchhandler?
     // But if this is set in the collection, seems to take it
     // so why not here?
     showtime('pre-load');
     // TODO: Printing needs looking at; the model is too complicated and
     // therefore maintenance is difficult. Needs breaking down into more
     // logical discrete units.
     // BEWARE: the following may not work for all cases
     // needs extensive testing; this is implemented for selectorController output
     if ($this->_data['session_key'] == 'undefined') {
         $sh->setLimit(0);
         $collection->load($sh);
         $this->PrintCollection($collection);
     }
     // echo 'controller::index setting printing session data<br>';
     // in this instance we can only pass the data through the session
     // but it's only the collection name and search id :-)
     $_SESSION['printing'][$this->_data['session_key']]['collection'] = get_class($collection);
     $_SESSION['printing'][$this->_data['session_key']]['search_id'] = $this->_data['search_id'];
     exit;
     showtime('end-controller-index');
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:59,代码来源:printController.php


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