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


PHP DataObjectCollection::load方法代码示例

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


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

示例1: populate

 function populate()
 {
     $po_obj = new DataObject('po_no_auth_user');
     $po_obj->idField = 'id';
     $po_obj->identifierField = 'order_number';
     $po_col = new DataObjectCollection($po_obj);
     $po_col->setParams();
     $sh = new SearchHandler($po_col, false);
     $sh->setFields(array('id', 'order_number', 'supplier', 'status'));
     $sh->addConstraint(new Constraint('status', '!=', 'X'));
     $this->setSearchLimit($sh);
     $sh->setOrderby(array('order_date', 'due_date', 'order_number'));
     $po_col->load($sh);
     $this->contents = $po_col;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:15,代码来源:POrdersNoAuthUserEGlet.php

示例2: run

 public function run()
 {
     // process any search data that may be passed
     if (is_array($this->_data['Search']) && isset($this->_data['Search']['report_id'])) {
         $this->_data[$this->_templateobject->idField] = $this->_data['Search']['report_id'];
         unset($this->_data['Search']['report_id']);
     }
     if (!$this->loadData()) {
         $this->dataError();
         sendBack();
     }
     $flash = Flash::Instance();
     // get the report model, lets not envoke it again... that's not cool
     $report = $this->_uses[$this->modeltype];
     // there's no point in processing all the following data just to display the dialog... display it now
     if (isset($this->_data['printaction']) || isset($this->_data['printAction']) || isset($this->_data['ajax_print'])) {
         // build options array
         $defs = ReportDefinition::getDefinition('PrintCollection');
         $dialog_options = array('type' => array('pdf' => '', 'xml' => '', 'csv' => ''), 'output' => array('print' => '', 'save' => '', 'email' => '', 'view' => ''), 'filename' => strtolower(str_replace(" ", "_", $report->description)) . '_' . date('d-m-Y'));
         // if ajax_print is not set we must be on the dialog
         if (!isset($this->_data['ajax_print'])) {
             return $dialog_options;
         }
     }
     // give smarty the title
     $this->view->set('title', $report->description);
     // unserialise the options from the db
     $options = unserialize($report->options);
     // overlay the defaults so we've got a full set of options
     $options = $this->expand_options($options, $report->tablename);
     // sort options by position
     $options = $this->sort_options($options);
     // vars
     $aggregate_fields = array();
     $at_agg = FALSE;
     $fields = array();
     $display_fields = array();
     $measure_fields = array();
     $search_fields = array();
     $filter_fields = array();
     $aggregate_methods = array();
     // build arrays for use in the view
     foreach ($options as $field => $field_options) {
         // we need to check against legacy search options
         if ($field_options['field_type'] === 'search') {
             $flash->addError('Report has legacy search fields, please edit this report to update');
             sendBack();
         }
         // ignore the filter field... it really isn't a field
         if ($field == 'filter') {
             continue;
         }
         // iron out the field label if it exists
         if (isset($field_options['field_label']) && !empty($field_options['field_label'])) {
             $label = $field_options['field_label'];
         } else {
             $label = $field;
         }
         $position = $field_options['position'];
         // we're always dealing with normal fields now
         // no need for a switch statement
         // ignore fields that aren't meant to be displayed
         if ($field_options['normal_display_field'] !== 'false') {
             // build two arrays, the display fields array will include filter fields... for now
             $original_fields[$position] = $field;
             $display_fields[$position] = $field;
             if ($field_options['normal_break_on'] === "true") {
                 $measure_fields[$position] = $field;
             }
             if (!empty($field_options['normal_method']) && $field_options['normal_method'] !== 'dont_total') {
                 $aggregate_fields[$position] = $field;
                 $aggregate_methods[$position] = $field_options['normal_method'] . '(' . $field . ') as ' . $field;
                 // if we're setting an aggregate field... this must not be a display field
                 unset($display_fields[$position]);
             }
         }
         // if the field is also a search field, add it to the search array
         if (isset($field_options['normal_enable_search']) && $field_options['normal_enable_search'] === 'true') {
             $search_fields[$field] = $field_options;
         }
     }
     // if the filters aren't empty, apply them one by one
     if (!empty($options['filter'])) {
         // loop through filter lines
         foreach (range(1, 3) as $number) {
             if (!isset($filter_cc)) {
                 $filter_cc = new ConstraintChain();
             }
             // filter line 1 will never have an operator
             if ($number === 1) {
                 $operator = 'AND';
             } else {
                 $operator = $options['filter']['filter_' . $number . '_operator'];
             }
             $field = $options['filter']['filter_' . $number . '_field'];
             $condition = $options['filter']['filter_' . $number . '_condition'];
             $value = $options['filter']['filter_' . $number . '_value'];
             // if we're dealing with a valid filter line...
             if (($number === 1 or !empty($operator)) and !empty($value)) {
                 // add the field to the display fields
//.........这里部分代码省略.........
开发者ID:uzerpllp,项目名称:uzerp,代码行数:101,代码来源:ReportsController.php


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