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


PHP SearchHandler::extractOrdering方法代码示例

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


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

示例1: view

 public function view()
 {
     if (!$this->loadData()) {
         $this->dataError();
         sendBack();
     }
     $transaction = $this->_uses[$this->modeltype];
     $id = $transaction->id;
     $this->view->set('transaction', $transaction);
     $elements = new WHTransferruleCollection(new WHTransferrule());
     $sh = new SearchHandler($elements, false);
     $sh->extract();
     $sh->addConstraint(new Constraint('whaction_id', '=', $id));
     $sh->extractOrdering();
     $sh->extractPaging();
     $elements->load($sh);
     $this->view->set('elements', $elements);
     $sidebar = new SidebarController($this->view);
     $sidebar->addList('Show', array('all' => array('tag' => 'All Actions', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'index'))), 'locations' => array('tag' => 'All Stores', 'link' => array_merge($this->_modules, array('controller' => 'WHStores', 'action' => 'index')))));
     $sidebarlist = array();
     $sidebarlist['edit'] = array('tag' => 'Edit', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'edit', 'id' => $id)));
     $sidebarlist['delete'] = array('tag' => 'Delete', 'link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'delete', 'id' => $id)));
     if (is_null($transaction->max_rules) || $elements->count() < $transaction->max_rules) {
         $sidebarlist['Add'] = array('tag' => 'Add Rule', 'link' => array_merge($this->_modules, array('controller' => 'WHTransferrules', 'action' => 'new', 'whaction_id' => $id)));
     }
     $sidebar->addList('This Action', $sidebarlist);
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
     $this->view->set('clickaction', 'view');
     $this->view->set('clickcontroller', 'WHTransferrules');
     $this->view->set('no_ordering', true);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:32,代码来源:WhactionsController.php

示例2: _new

 public function _new()
 {
     parent::_new();
     // For new actions the stitem_id and from_uom_id will be set
     // For edit actions, the id will be set pointing to the uom conversion to be edited
     if ($this->_data['action'] == 'edit') {
         $stuom = $this->_uses[$this->modeltype];
         $stitem_id = $stuom->stitem_id;
         $stitem_uom_id = $stuom->from_uom_id;
         $stitem_uom_name = $stuom->from_uom_name;
     } else {
         $stitem = new STitem();
         $stitem->load($this->_data['stitem_id']);
         $stitem_id = $stitem->id;
         $stitem_uom_id = $stitem->uom_id;
         $stitem_uom_name = $stitem->uom_name;
     }
     $this->view->set('stitem_id', $stitem_id);
     $this->view->set('stitem_uom_id', $stitem_uom_id);
     $this->view->set('stitem_uom_name', $stitem_uom_name);
     $this->view->set('stitem', Stuomconversion::getStockItem($stitem_id));
     $elements = new STuomconversionCollection(new STuomconversion());
     $sh = new SearchHandler($elements, false);
     $sh->extract();
     $sh->addConstraint(new Constraint('stitem_id', '=', $stitem_id));
     $sh->setOrderBy('from_uom_name');
     $sh->extractOrdering();
     $sh->extractPaging();
     $elements->load($sh);
     $this->view->set('elements', $elements);
     $this->view->set('no_ordering', true);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:32,代码来源:StuomconversionsController.php

示例3: showParts

 public function showParts($id)
 {
     $elements = new MFWOStructureCollection(new MFWOStructure());
     $sh = new SearchHandler($elements, false);
     $sh->addConstraint(new Constraint('work_order_id', '=', $id));
     $sh->setOrderBy('line_no');
     $sh->extractOrdering();
     $elements->load($sh);
     return $elements;
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:10,代码来源:MfwostructuresController.php

示例4: detail

 public function detail()
 {
     $errors = array();
     $s_data = $this->setSearch();
     $constrain = FALSE;
     $fields = array('slmaster_id', 'product_group', 'cs_failurecode_id', 'start', 'end');
     // if failure code is 'any' remove it from the search, we've got other criteria to search by...
     if (isset($this->_data['cs_failurecode_id']) && strtolower($this->_data['cs_failurecode_id']) === 'any') {
         // don't let the standard search do anything with the cs_failurecode_id field
         unset($s_data['cs_failurecode_id']);
         $constrain = TRUE;
         // constrain where failure code has not been set...
         $cc1 = new ConstraintChain();
         $cc1->add(new Constraint('cs_failurecode_id', 'IS', 'NULL'));
         // and another constraint chain for the failed order
         $cc2 = new ConstraintChain();
         $cc2->add(new Constraint('despatch_date', '>', '(due_despatch_date)'));
         $cc2->add(new Constraint('order_qty', '>', '(despatch_qty)'), 'OR');
     }
     $customerservice = new CustomerServiceCollection($this->_templateobject);
     if (!isset($this->_data['orderby']) && !isset($this->_data['page']) && !($this->isPrintDialog() || $this->isPrinting())) {
         $sh = $customerservice->setSearch($s_data, false);
         $sh->setOrderby(array('product_group', 'customer', 'order_number', 'due_despatch_date'), array('ASC', 'ASC', 'DESC', 'DESC'));
     } else {
         // $sh = $customerservice->setSearch($s_data, TRUE);
         // echo '$s_data<pre>'.print_r($s_data, true).'</pre><br>';
         $sh = new SearchHandler($customerservice, TRUE);
     }
     $this->search = customerServicesSearch::useDefault($s_data, $errors, $customerservice);
     if (count($errors) > 0) {
         $flash = Flash::Instance();
         $flash->addErrors($errors);
         $this->search->clear();
     }
     if (isset($this->search) && !isset($this->_data['ajax_print']) && !isset($this->_data['orderby']) && !isset($this->_data['page'])) {
         // cache the search string
         $search_string_array = array('fop' => $this->search->toString('fop'), 'html' => $this->search->toString('html'));
         $_SESSION['search_strings'][EGS_USERNAME][$sh->search_id] = $search_string_array;
     }
     if ($constrain === TRUE) {
         // add the two constraint chains seperately
         $sh->addConstraintChain($cc1);
         $sh->addConstraintChain($cc2);
     }
     $sh->extractOrdering();
     $sh->setFields(array('id', 'product_group', 'customer', 'stitem', 'order_number', 'despatch_number', 'due_despatch_date', 'despatch_date', 'order_qty', 'despatch_qty', 'failurecode', 'cs_failurecode_id', 'cs_failure_note'));
     if (isset($this->search) && ($this->isPrintDialog() || $this->isPrinting())) {
         $sh->setLimit(0);
         $customerservice->load($sh);
         return parent::printCollection($customerservice);
     } else {
         $sh->extractPaging();
         $customerservice->load($sh);
     }
     $this->view->set('num_records', $customerservice->num_records);
     $this->view->set('num_pages', $customerservice->num_pages);
     $this->view->set('cur_page', $customerservice->cur_page);
     $this->view->set(strtolower($customerservice->getModelName()) . 's', $customerservice);
     $sidebar = new SidebarController($this->view);
     $sidebar->addList('Actions', array('all' => array('link' => array_merge($this->_modules, array('controller' => $this->name, 'action' => 'index')), 'tag' => 'Customer Service Summary'), 'failurecodes' => array('link' => array_merge($this->_modules, array('controller' => 'csfailurecodes', 'action' => 'index')), 'tag' => 'View Failure Codes')));
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:63,代码来源:CustomerservicesController.php

示例5: fillCollection

 /**
  * fills a collection of the specified model type with the fields specified,
  * also gives correct click controller, action and edit handlers so
  * that smarty datatable will work correctly.
  * finally outputs specified smarty variable as the collection for
  * datatable to use
  * used for alternate controller to display specific contents of a different
  * controller
  */
 public function fillCollection($modelname, $fields, $constraints, $clickcontroller, $clickaction, $editclickaction, $deletecontroller, $smartyname, $tablename = null, $deleteaction = null, $newtext = null, $limit = null, $orderdir = null, $offset = null)
 {
     $collectionname = $modelname . 'Collection';
     $collection = new $collectionname();
     $sh = new SearchHandler($collection);
     $sh->fields = $fields;
     $sh->constraints = $constraints;
     $sh->extractOrdering();
     $sh->extractPaging();
     $sh->perpage = 900000;
     if (isset($orderdir)) {
         $sh->orderdir = $orderdir;
     }
     if (isset($limit) && isset($offset)) {
         $sh->setLimit($limit, $offset);
     }
     if (isset($tablename)) {
         $collection->_tablename = $tablename;
     }
     $collection->load($sh);
     $collection->clickcontroller = $clickcontroller;
     $collection->clickaction = $clickaction;
     $collection->editclickaction = $editclickaction;
     $collection->deletecontroller = $deletecontroller;
     if (isset($deleteaction)) {
         $collection->deleteclickaction = $deleteaction;
     }
     if (isset($newtext)) {
         $collection->newtext = $newtext;
     }
     $this->view->set($smartyname, $collection);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:41,代码来源:Controller.php

示例6: select_for_output

 public function select_for_output()
 {
     // Search
     $errors = array();
     $s_data = array();
     // Set context from calling module
     if (isset($this->_data['Search'])) {
         $this->_data['type'] = $this->_data['Search']['type'];
         if (!empty($this->_data['Search']['clear'])) {
             $_SESSION['selected_output'][$this->_data['type']] = array('count' => 0);
         }
     }
     if (!$this->checkParams('type')) {
         sendBack();
     }
     $type = $this->_data['type'];
     $selected = empty($_SESSION['selected_output'][$type]) ? array() : $_SESSION['selected_output'][$type];
     $output_details = $this->output_types[$this->_data['type']];
     $s_data = $output_details['search_defaults'];
     $s_data['type'] = $_GET['type'] = $type;
     $this->setSearch($output_details['search_do'], $output_details['search_method'], $s_data, array(), TRUE);
     // End of search
     if (!isset($this->_data['page']) && !isset($this->_data['orderby'])) {
         $collection = new $output_details['collection']($this->_templateobject);
         if (!isset($this->_data['orderby']) && !isset($this->_data['page'])) {
             $sh = new SearchHandler($collection, FALSE);
         } else {
             $sh = new SearchHandler($collection);
         }
         $sh->setFields($output_details['collection_fields']);
         $cc = $this->search->toConstraintChain();
         $sh->addConstraintChain($cc);
         $sh->extractOrdering();
         $collection->load($sh);
         $selected = empty($_SESSION['selected_output'][$type]) ? array() : $_SESSION['selected_output'][$type];
         $new_selection = array('count' => 0);
         foreach ($collection as $detail) {
             if (isset($selected[$detail->id])) {
                 $new_selection[$detail->id] = $selected[$detail->id];
                 if ($selected[$detail->id]['select'] == 'true') {
                     $new_selection['count']++;
                 }
             } else {
                 if (isset($output_details['identifier'])) {
                     $new_selection[$detail->id]['description'] = prettify($output_details['identifier']) . ' : ' . $detail->{$output_details}['identifier'];
                 } else {
                     $new_selection[$detail->id]['description'] = $detail->getIdentifierValue();
                 }
                 if (empty($new_selection[$detail->id]['description'])) {
                     $new_selection[$detail->id]['description'] = 'no identifier set';
                 }
                 // Need a beter way of identifying the print action
                 // - in SLCustomer, there is the invoice method enum
                 // - in PrintController there is the printaction enum
                 // These are not equivalent; e.g. the print controller printaction needs to list
                 // methods that can be handled within the code whereas the SLCustomer invoice_method
                 // defines how an invoice is sent which may be handled within the code or externally.
                 // As an example, invoices can be faxed, but this cannot currently be done from within code,
                 // so the invoice must be printed and manually faxed.
                 // Therefore, perhaps the SLCustomer invoice_method Fax needs to be implemented internally
                 // as Print until a fax model is implemented
                 if (!is_null($detail->method)) {
                     switch ($detail->method) {
                         case 'E':
                             $new_selection[$detail->id]['printaction'] = 'email';
                             break;
                         case 'D':
                             $new_selection[$detail->id]['printaction'] = 'edi';
                             break;
                         case 'F':
                         case 'P':
                             $new_selection[$detail->id]['printaction'] = 'print';
                             break;
                         default:
                             $new_selection[$detail->id]['printaction'] = strtolower($detail->method);
                     }
                 } elseif ($detail->email == '') {
                     $new_selection[$detail->id]['printaction'] = 'print';
                 } else {
                     $new_selection[$detail->id]['printaction'] = 'email';
                 }
                 $new_selection[$detail->id]['email'] = $detail->email;
                 $new_selection[$detail->id]['select'] = 'false';
             }
         }
         $_SESSION['selected_output'][$type] = $selected = $new_selection;
     }
     $collection = new $output_details['collection']($this->_templateobject);
     $sh = $this->setSearchHandler($collection);
     $sh->setFields($output_details['collection_fields']);
     parent::index($collection, $sh);
     $this->view->set('type', $this->_data['type']);
     $this->view->set('fields', $output_details['display_fields']);
     $this->view->set('clickaction', 'view');
     $this->view->set('no_ordering', TRUE);
     $this->view->set('collection', $this->view->getTemplateVars(strtolower($collection->getModelName()) . 's'));
     $this->_data['printaction'] = $output_details['printaction'];
     $this->_data['filename'] = $output_details['filename'];
     unset($this->printaction['view']);
     $this->printAction();
//.........这里部分代码省略.........
开发者ID:uzerpllp,项目名称:uzerp,代码行数:101,代码来源:printController.php

示例7: showFulfilled

 public function showFulfilled()
 {
     $mfworkorders = new MFWorkorderCollection($this->_templateobject);
     $sh = new SearchHandler($mfworkorders);
     $sh->extract();
     $sh->addConstraint(new Constraint('status', '=', 'O'));
     $sh->addConstraint(new Constraint('made_qty', '>=', '(order_qty)'));
     $sh->extractOrdering();
     $sh->extractPaging();
     $mfworkorders->load($sh);
     $this->view->set('clickaction', 'view');
     $this->view->set('mfworkorders', $mfworkorders);
     $sidebar = new SidebarController($this->view);
     $sidebarlist = array();
     $sidebarlist['viewAll'] = array('tag' => 'View', 'link' => array('modules' => $this->_modules, 'controller' => $this->name, 'action' => 'index'));
     $sidebar->addList('All Works Orders', $sidebarlist);
     $this->view->register('sidebar', $sidebar);
     $this->view->set('sidebar', $sidebar);
 }
开发者ID:uzerpllp,项目名称:uzerp,代码行数:19,代码来源:MfworkordersController.php


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