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


PHP ActionResponse::get方法代码示例

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


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

示例1: index

 public function index()
 {
     $this->loadLanguageFile('backend/abstract/ActiveGridQuickEdit');
     $this->updateApplicationUri();
     // order stats
     $conditions = array('last' => new EqualsOrMoreCond(new ARFieldHandle('CustomerOrder', 'dateCompleted'), time() - 86400), 'new' => new IsNullCond(new ARFieldHandle('CustomerOrder', 'status')), 'processing' => new EqualsCond(new ARFieldHandle('CustomerOrder', 'status'), CustomerOrder::STATUS_PROCESSING), 'total' => new EqualsCond(new ARFieldHandle('CustomerOrder', 'isFinalized'), true));
     foreach ($conditions as $key => $cond) {
         $f = new ARSelectFilter($cond);
         $f->mergeCondition(new EqualsCond(new ARFieldHandle('CustomerOrder', 'isFinalized'), true));
         $f->mergeCondition(new EqualsCond(new ARFieldHandle('CustomerOrder', 'isCancelled'), false));
         $orderCount[$key] = ActiveRecordModel::getRecordCount('CustomerOrder', $f);
     }
     // messages
     $f = new ARSelectFilter(new EqualsCond(new ARFieldHandle('OrderNote', 'isAdmin'), 0));
     $f->mergeCondition(new EqualsCond(new ARFieldHandle('OrderNote', 'isRead'), 0));
     $orderCount['messages'] = ActiveRecordModel::getRecordCount('OrderNote', $f);
     // inventory stats
     $lowStock = new EqualsOrLessCond(new ARFieldHandle('Product', 'stockCount'), $this->config->get('LOW_STOCK'));
     $lowStock->addAnd(new MoreThanCond(new ARFieldHandle('Product', 'stockCount'), 0));
     $conditions = array('lowStock' => $lowStock, 'outOfStock' => new EqualsOrLessCond(new ARFieldHandle('Product', 'stockCount'), 0));
     foreach ($conditions as $key => $cond) {
         $cond->addAnd(new EqualsCond(new ARFieldHandle('Product', 'isEnabled'), true));
         $inventoryCount[$key] = ActiveRecordModel::getRecordCount('Product', new ARSelectFilter($cond));
     }
     // overall stats
     $rootCat = Category::getRootNode();
     $rootCat->load();
     $response = new ActionResponse();
     $response->set('orderCount', $orderCount);
     $response->set('inventoryCount', $inventoryCount);
     $response->set('rootCat', $rootCat->toArray());
     $response->set('thisMonth', date('m'));
     $response->set('lastMonth', date('Y-m', strtotime(date('m') . '/15 -1 month')));
     $response->set('ordersLast24', $this->getOrderCount('-24 hours', 'now'));
     $response->set('ordersThisWeek', $this->getOrderCount('w:Monday', 'now'));
     $response->set('ordersThisMonth', $this->getOrderCount(date('m') . '/1', 'now'));
     $response->set('ordersLastMonth', $this->getOrderCount($response->get('lastMonth') . '-1', date('m') . '/1'));
     $response->set('lastOrders', $this->getLastOrders());
     return $response;
 }
开发者ID:saiber,项目名称:www,代码行数:40,代码来源:IndexController.php

示例2: setFormResponse

 public function setFormResponse(ActionResponse $response, Form $form, $prefix = '')
 {
     $specFields = $this->owner->getSpecification()->getSpecificationFieldSet(ActiveRecordModel::LOAD_REFERENCES);
     $specFieldArray = $specFields->toArray();
     // set select values
     $selectors = EavFieldCommon::getSelectorValueTypes();
     foreach ($specFields as $key => $field) {
         if (in_array($field->type->get(), $selectors)) {
             $values = $field->getValuesSet()->toArray();
             $specFieldArray[$key]['values'] = array('' => '');
             foreach ($values as $value) {
                 $specFieldArray[$key]['values'][$value['ID']] = isset($value['value_lang']) ? $value['value_lang'] : $value['value'];
             }
         }
     }
     // arrange SpecFields's into groups
     $specFieldsByGroup = array();
     $prevGroupID = -1;
     $groupClass = $this->getFieldClass() . 'Group';
     foreach ($specFieldArray as $field) {
         $groupID = isset($field[$groupClass]['ID']) ? $field[$groupClass]['ID'] : '';
         if ((int) $groupID && $prevGroupID != $groupID) {
             $prevGroupID = $groupID;
         }
         $specFieldsByGroup[$groupID][] = $field;
     }
     // get multi language spec fields
     $multiLingualSpecFields = array();
     foreach ($specFields as $key => $field) {
         if ($field->isTextField()) {
             $multiLingualSpecFields[] = $field->toArray();
         }
     }
     if (!$prefix) {
         $response->set("specFieldList", $specFieldsByGroup);
     }
     $response->set("groupClass", $groupClass);
     $response->set("multiLingualSpecFieldss", $multiLingualSpecFields);
     // set fields by prefix
     $prefixed = $response->get("specFieldList_prefix", array());
     $prefixed[$prefix] = $specFieldsByGroup;
     $response->set("specFieldList_prefix", $prefixed);
     $this->owner->load();
     // set fields by owner
     if ($this->owner instanceof EavObject && ($owner = $this->owner->getOwner())) {
         $byOwner = $response->get("specFieldListByOwner", array());
         $byOwner[get_class($owner)][$owner->getID()] = $specFieldsByGroup;
         $response->set("specFieldListByOwner", $byOwner);
     }
     $form->setData($this->getFormData($prefix));
     //$this->setFormValidator($form->getValidator());
 }
开发者ID:saiber,项目名称:www,代码行数:52,代码来源:EavSpecificationManagerCommon.php


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