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


PHP ARSelectFilter::setOrder方法代码示例

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


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

示例1: reorder

 /**
  * Reorder pages
  *
  * @role sort
  */
 public function reorder()
 {
     $inst = StaticPage::getInstanceById($this->request->get('id'), StaticPage::LOAD_DATA);
     $f = new ARSelectFilter();
     $handle = new ARFieldHandle('StaticPage', 'position');
     if ('down' == $this->request->get('order')) {
         $f->setCondition(new MoreThanCond($handle, $inst->position->get()));
         $f->setOrder($handle, 'ASC');
     } else {
         $f->setCondition(new LessThanCond($handle, $inst->position->get()));
         $f->setOrder($handle, 'DESC');
     }
     $f->setLimit(1);
     $s = ActiveRecordModel::getRecordSet('StaticPage', $f);
     if ($s->size()) {
         $pos = $inst->position->get();
         $replace = $s->get(0);
         $inst->position->set($replace->position->get());
         $replace->position->set($pos);
         $inst->save();
         $replace->save();
         return new JSONResponse(array('id' => $inst->getID(), 'order' => $this->request->get('order')), 'success');
     } else {
         return new JSONResponse(false, 'failure', $this->translate('_could_not_reorder_pages'));
     }
 }
开发者ID:saiber,项目名称:www,代码行数:31,代码来源:StaticPageController.php

示例2: index

 /**
  *	Main settings page
  */
 public function index()
 {
     $f = new ARSelectFilter();
     $f->setOrder(new ARFieldHandle('StaticPage', 'position'));
     $f->setOrder(new ARFieldHandle('StaticPage', 'parentID'));
     $s = ActiveRecordModel::getRecordSetArray('StaticPage', $f);
     $pages = array();
     foreach ($s as $page) {
         $pointers[$page['ID']] = array('title' => $page['title_lang'], 'id' => $page['ID'], 'parentID' => $page['parentID']);
     }
     foreach ($pointers as $page) {
         if ($page['parentID'] && !empty($pointers[$page['parentID']])) {
             $root =& $pointers[$page['parentID']];
         } else {
             $root =& $pages;
         }
         $root['children'][] =& $pointers[$page['id']];
     }
     $response = new ActionResponse();
     $response->set('pages', json_encode($pages));
     $form = $this->getForm();
     $page = StaticPage::getNewInstance();
     $page->getSpecification()->setFormResponse($response, $form);
     $response->set('form', $form);
     $response->set('page', $page->toArray());
     return $response;
 }
开发者ID:saiber,项目名称:livecart,代码行数:30,代码来源:StaticPageController.php

示例3: getSelectFilter

 public function getSelectFilter($searchTerm)
 {
     $c = new ARExpressionHandle($this->getWeighedSearchCondition($this->getOption('BACKEND_QUICK_SEARCH') ? array('title' => 1) : array('title' => 4, 'text' => 2, 'moreText' => 1), $searchTerm));
     $f = new ARSelectFilter(new MoreThanCond($c, 0));
     $f->setOrder($c, 'DESC');
     return $f;
 }
开发者ID:saiber,项目名称:livecart,代码行数:7,代码来源:SearchableNewsPost.php

示例4: products

 public function products()
 {
     $this->setLayout('empty');
     set_time_limit(0);
     $response = new XMLResponse();
     $filter = new ARSelectFilter();
     $filter->setOrder(f('Product.dateCreated'), ARSelectFilter::ORDER_DESC);
     $categoryId = $this->getRequest()->get('id');
     if (preg_match('/^\\d+$/', $categoryId)) {
         $this->shouldBeEnabledFeed('CATEGORY_PRODUCTS');
         $category = Category::getInstanceById($categoryId, Category::LOAD_DATA);
         $filter = new ProductFilter($category, $filter);
     } else {
         $this->shouldBeEnabledFeed('ALL_PRODUCTS');
         $category = Category::getRootNode(true);
         $filter = new ProductFilter($category, $filter);
         $filter->includeSubCategories();
     }
     $feed = new ProductFeed($filter);
     $feed->setFlush();
     $feed->setLimit($this->config->get('NUMBER_OF_PRODUCTS_TO_INCLUDE'));
     $response->set('feed', $feed);
     $response->set('category', $category->toArray());
     return $response;
 }
开发者ID:saiber,项目名称:livecart,代码行数:25,代码来源:RssController.php

示例5: getUserToolbarItems

 public static function getUserToolbarItems($types = null, $filter = null, $order = 'ASC')
 {
     if ($filter == null) {
         $filter = new ARSelectFilter();
     }
     $filter->mergeCondition(eq(f(__CLASS__ . '.ownerID'), SessionUser::getUser()->getID()));
     $filter->setOrder(f(__CLASS__ . '.position'), $order);
     $m = array(BackendToolbarItem::TYPE_MENU => '', BackendToolbarItem::TYPE_PRODUCT => '', BackendToolbarItem::TYPE_USER => '', BackendToolbarItem::TYPE_ORDER => '');
     if (is_array($types) == false) {
         $types = array($types);
     }
     $conditions = array();
     foreach ($types as $type) {
         switch ($type) {
             case BackendToolbarItem::TYPE_MENU:
                 $conditions[] = isnotnull(f(__CLASS__ . '.menuID'));
                 break;
             case BackendToolbarItem::TYPE_PRODUCT:
                 $conditions[] = new AndChainCondition(array(isnotnull(f(__CLASS__ . '.productID')), isnotnull(f('Product.ID'))));
                 // fake inner join
                 break;
             case BackendToolbarItem::TYPE_USER:
                 $conditions[] = new AndChainCondition(array(isnotnull(f(__CLASS__ . '.userID')), isnotnull(f('User.ID'))));
                 break;
             case BackendToolbarItem::TYPE_ORDER:
                 $conditions[] = new AndChainCondition(array(isnotnull(f(__CLASS__ . '.orderID')), isnotnull(f('CustomerOrder.ID'))));
                 break;
         }
     }
     if (count($conditions)) {
         $filter->mergeCondition(new OrChainCondition($conditions));
     }
     return self::getRecordSetArray(__CLASS__, $filter, true);
 }
开发者ID:saiber,项目名称:livecart,代码行数:34,代码来源:BackendToolbarItem.php

示例6: filter

 public function filter($emptyListIsException = false)
 {
     $request = $this->application->getRequest();
     $parser = $this->getParser();
     $apiFieldNames = $parser->getApiFieldNames();
     $parser->loadDataInRequest($request);
     $f = new ARSelectFilter();
     $id = $request->get('ID');
     if (intval($id) > 0) {
         $f->mergeCondition(new EqualsCond(new ARFieldHandle('NewsPost', 'ID'), $id));
     }
     $f->setOrder(new ARExpressionHandle('NewsPost.ID'), 'DESC');
     $newspost = ActiveRecordModel::getRecordSetArray('NewsPost', $f);
     $response = new LiveCartSimpleXMLElement('<response datetime="' . date('c') . '"></response>');
     if ($emptyListIsException && count($newspost) == 0) {
         throw new Exception('News post not found');
     }
     while ($category = array_shift($newspost)) {
         $xmlNewsPost = $response->addChild('newspost');
         foreach ($category as $k => $v) {
             if (in_array($k, $apiFieldNames)) {
                 $xmlNewsPost->addChild($k, htmlentities($v));
             }
         }
     }
     return new SimpleXMLResponse($response);
 }
开发者ID:saiber,项目名称:www,代码行数:27,代码来源:NewsPostApi.php

示例7: getSelectFilter

 public function getSelectFilter($searchTerm)
 {
     // create initial index
     if (0 && !SearchableItem::getRecordCount()) {
         $app = ActiveRecordModel::getApplication();
         $sc = new SearchableConfigurationIndexing($app->getConfig(), $app);
         $sc->buildIndex(null);
     }
     $c = new ARExpressionHandle($this->getWeighedSearchCondition(array('value' => 1), $searchTerm));
     $app = ActiveRecordModel::getApplication();
     $f = new ARSelectFilter(new MoreThanCond($c, 0));
     $f->mergeCondition(new OrChainCondition(array(eq(f('SearchableItem.locale'), $app->getDefaultLanguageCode()), eq(f('SearchableItem.locale'), $app->getLocaleCode()), isnull(f('SearchableItem.locale')))));
     $f->setOrder(f('SearchableItem.sort'), 'DESC');
     $f->setOrder($c, 'DESC');
     return $f;
 }
开发者ID:saiber,项目名称:www,代码行数:16,代码来源:SearchableConfiguration.php

示例8: index

 public function index()
 {
     // get filter to select manufacturers of active products only
     $rootCat = Category::getRootNode();
     $f = new ARSelectFilter();
     $productFilter = new ProductFilter($rootCat, $f);
     $ids = $counts = array();
     foreach (ActiveRecordModel::getDataBySQL('SELECT DISTINCT(manufacturerID), COUNT(*) AS cnt FROM Product ' . $f->createString() . ' GROUP BY manufacturerID') as $row) {
         $ids[] = $row['manufacturerID'];
         $counts[$row['manufacturerID']] = $row['cnt'];
     }
     $f = new ARSelectFilter(new InCond(new ARFieldHandle('Manufacturer', 'ID'), $ids));
     $f->mergeCondition(new NotEqualsCond(new ARFieldHandle('Manufacturer', 'name'), ''));
     $f->setOrder(new ARFieldHandle('Manufacturer', 'name'));
     $manufacturers = ActiveRecordModel::getRecordSetArray('Manufacturer', $f);
     foreach ($manufacturers as &$manufacturer) {
         $manufacturer['url'] = $this->getManufacturerFilterUrl($manufacturer);
     }
     $this->addBreadCrumb($this->translate('_manufacturers'), '');
     $response = new ActionResponse();
     $response->setReference('manufacturers', $manufacturers);
     $response->set('counts', $counts);
     $response->set('rootCat', $rootCat->toArray());
     return $response;
 }
开发者ID:saiber,项目名称:www,代码行数:25,代码来源:ManufacturersController.php

示例9: getProductGroupsFilter

 private static function getProductGroupsFilter(Product $product)
 {
     $filter = new ARSelectFilter();
     $filter->setOrder(new ARFieldHandle(__CLASS__, "position"), 'ASC');
     $filter->setCondition(new EqualsCond(new ARFieldHandle(__CLASS__, "productID"), $product->getID()));
     return $filter;
 }
开发者ID:saiber,项目名称:livecart,代码行数:7,代码来源:ProductFileGroup.php

示例10: filter

 public function filter($emptyListIsException = false)
 {
     $request = $this->application->getRequest();
     $parser = $this->getParser();
     $apiFieldNames = $parser->getApiFieldNames();
     $parser->loadDataInRequest($request);
     $id = $request->get('orderID');
     $f = new ARSelectFilter();
     if (!isset($id)) {
         throw new Exception('Order id is required');
     }
     $f->mergeCondition(new EqualsCond(new ARFieldHandle('OrderNote', 'orderID'), $id));
     $f->setOrder(new ARExpressionHandle('OrderNote.ID'), 'ASC');
     $orderNotes = ActiveRecordModel::getRecordSetArray('OrderNote', $f);
     $response = new LiveCartSimpleXMLElement('<response datetime="' . date('c') . '"></response>');
     if ($emptyListIsException && count($orderNotes) == 0) {
         throw new Exception('Not found notes for this order');
     }
     while ($notes = array_shift($orderNotes)) {
         $xmlPage = $response->addChild('note');
         foreach ($notes as $k => $v) {
             if (in_array($k, $apiFieldNames)) {
                 $xmlPage->addChild($k, htmlentities($v));
             }
         }
     }
     return new SimpleXMLResponse($response);
 }
开发者ID:saiber,项目名称:www,代码行数:28,代码来源:OrderNoteApi.php

示例11: index

 public function index()
 {
     $this->addIndexBreadCrumb();
     $f = new ARSelectFilter(new EqualsCond(new ARFieldHandle('NewsPost', 'isEnabled'), true));
     $f->setOrder(new ARFieldHandle('NewsPost', 'position'), 'DESC');
     return new ActionResponse('news', ActiveRecordModel::getRecordSetArray('NewsPost', $f));
 }
开发者ID:saiber,项目名称:livecart,代码行数:7,代码来源:NewsController.php

示例12: getSelectFilter

 public function getSelectFilter($searchTerm)
 {
     $c = new ARExpressionHandle($this->getWeighedSearchCondition(array('name' => 1), $searchTerm));
     $f = new ARSelectFilter(new MoreThanCond($c, 0));
     $f->setOrder($c, 'DESC');
     return $f;
 }
开发者ID:saiber,项目名称:livecart,代码行数:7,代码来源:SearchableManufacturer.php

示例13: index

 public function index()
 {
     $f = new ARSelectFilter();
     $f->setOrder(new ARFieldHandle('NewsPost', 'position'), 'DESC');
     $response = new ActionResponse('newsList', ActiveRecordModel::getRecordSetArray('NewsPost', $f));
     $response->set('form', $this->buildForm());
     return $response;
 }
开发者ID:saiber,项目名称:livecart,代码行数:8,代码来源:SiteNewsController.php

示例14: getProductGroupsFilter

 private static function getProductGroupsFilter(Product $product, $type)
 {
     $filter = new ARSelectFilter();
     $filter->setOrder(new ARFieldHandle("ProductRelationshipGroup", "position"), 'ASC');
     $filter->setCondition(new EqualsCond(new ARFieldHandle("ProductRelationshipGroup", "productID"), $product->getID()));
     $filter->mergeCondition(new EqualsCond(new ARFieldHandle("ProductRelationshipGroup", "type"), $type));
     return $filter;
 }
开发者ID:saiber,项目名称:www,代码行数:8,代码来源:ProductRelationshipGroup.php

示例15: getRecordSet

 /**
  * Load service rates record set
  *
  * @param ARSelectFilter $filter
  * @param bool $loadReferencedRecords
  *
  * @return ARSet
  */
 public static function getRecordSet(ARSelectFilter $filter, $loadReferencedRecords = false)
 {
     if (!$loadReferencedRecords) {
         $loadReferencedRecords = array('Tax');
     }
     $filter->setOrder(new ARFieldHandle('Tax', 'position'));
     return parent::getRecordSet(__CLASS__, $filter, $loadReferencedRecords);
 }
开发者ID:saiber,项目名称:www,代码行数:16,代码来源:TaxRate.php


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