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


PHP selector::order方法代码示例

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


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

示例1: merge

		/**
			* Слить все заказы покупателя в профиль пользователя.
			* Объект покупателя после этого будет уничтожен
		*/
		public function merge(umiObject $customer) {

			$cmsController = cmsController::getInstance();
			$domain = $cmsController->getCurrentDomain();
			$domainId = $domain->getId();

			$sel = new selector('objects');
			$sel->types('object-type')->name('emarket', 'order');
			$sel->where('customer_id')->equals($customer->id);
			$sel->where('domain_id')->equals($domainId);
			$sel->order('id')->desc();

			$permissions = permissionsCollection::getInstance();
			$userId = $permissions->getUserId();

			foreach($sel as $order) {
				if(!$order->status_id) {
					$this->mergeBasket($order);
					continue;
				}

				$order->customer_id = $userId;
				$order->commit();
			}
			if (!defined('UMICMS_CLI_MODE') || !UMICMS_CLI_MODE) {
				setcookie('customer-id', 0, 1, '/');
			}
			$customer->delete();
		}
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:33,代码来源:customer.php

示例2: orders

 public function orders()
 {
     $this->setDataType("list");
     $this->setActionType("view");
     if ($this->ifNotXmlMode()) {
         return $this->doData();
     }
     $limit = getRequest('per_page_limit');
     $curr_page = (int) getRequest('p');
     $offset = $limit * $curr_page;
     $sel = new selector('objects');
     $sel->types('object-type')->name('emarket', 'order');
     $sel->where('status_id')->isNull(false);
     $sel->where('name')->notequals('dummy');
     $sel->limit($offset, $limit);
     if (!getRequest('order_filter')) {
         $sel->order('order_date')->desc();
     }
     selectorHelper::detectFilters($sel);
     $domains = getRequest('domain_id');
     if (is_array($domains) && sizeof($domains)) {
         $domainsCollection = domainsCollection::getInstance();
         if (sizeof($domainsCollection->getList()) > 1) {
             $sel->where('domain_id')->equals($domains[0]);
         }
     }
     $this->setDataRange($limit, $offset);
     $data = $this->prepareData($sel->result, "objects");
     $this->setData($data, $sel->length);
     return $this->doData();
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:31,代码来源:__admin_orders.php

示例3: view_comments

 public function view_comments()
 {
     $this->setDataType("list");
     $this->setActionType("view");
     if ($this->ifNotXmlMode()) {
         return $this->doData();
     }
     //Получение id родительской страницы. Если передан неверный id, будет выброшен exception
     $parent_id = $this->expectElementId('param0');
     $limit = getRequest('per_page_limit');
     $curr_page = (int) getRequest('p');
     $offset = $limit * $curr_page;
     if (!is_null($rel = getRequest('rel'))) {
         $rel = array_extract_values($rel);
         if (empty($rel)) {
             unset($_REQUEST['rel']);
         }
     }
     $sel = new selector('pages');
     $sel->types('hierarchy-type')->name('comments', 'comment');
     $sel->order('publish_time')->desc();
     $sel->limit($offset, $limit);
     selectorHelper::detectFilters($sel);
     $this->setDataRange($limit, $offset);
     $data = $this->prepareData($sel->result, "pages");
     $this->setData($data, $sel->length);
     return $this->doData();
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:28,代码来源:__admin.php

示例4: number

 public function number()
 {
     $sel = new selector('objects');
     $sel->types('object-type')->name('emarket', 'order');
     $sel->order('number')->desc();
     $sel->limit(0, 1);
     $number = $sel->first ? $sel->first->number + 1 : 1;
     $order = $this->order;
     $order->name = getLabel('order-name-prefix', 'emarket', $number);
     $order->number = $number;
     $order->commit();
     return $number;
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:13,代码来源:default.php

示例5: last_messages

 public function last_messages()
 {
     $this->setDataType("list");
     $this->setActionType("view");
     if ($this->ifNotXmlMode()) {
         return $this->doData();
     }
     $limit = getRequest('per_page_limit');
     $curr_page = getRequest('p');
     $offset = $curr_page * $limit;
     $sel = new selector('pages');
     $sel->types('hierarchy-type')->name('forum', 'message');
     $sel->order('publish_time')->desc();
     $sel->limit($offset, $limit);
     selectorHelper::detectFilters($sel);
     $data = $this->prepareData($sel->result, "pages");
     $this->setData($data, $sel->length);
     $this->setDataRangeByPerPage($limit, $curr_page);
     return $this->doData();
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:20,代码来源:__admin.php

示例6: albums

 public function albums($template = "default", $limit = false, $ignore_paging = false, $parentElementId = false, $order = 'asc')
 {
     list($template_block, $template_block_empty, $template_line) = def_module::loadTemplates("photoalbum/" . $template, "albums_list_block", "albums_list_block_empty", "albums_list_block_line");
     $block_arr = array();
     $curr_page = (int) getRequest('p');
     if ($ignore_paging) {
         $curr_page = 0;
     }
     $offset = $limit * $curr_page;
     $sel = new selector('pages');
     $sel->types('hierarchy-type')->name('photoalbum', 'album');
     $sel->where('permissions');
     if ($parentElementId) {
         $sel->where('hierarchy')->page($parentElementId)->childs(1);
     }
     if (in_array($order, array('asc', 'desc', 'rand'))) {
         $sel->order('ord')->{$order}();
     }
     $sel->limit($offset, $limit);
     $result = $sel->result;
     $total = $sel->length();
     $lines = array();
     if ($total > 0) {
         foreach ($result as $element) {
             $line_arr = array();
             $element_id = $element->getId();
             $line_arr['attribute:id'] = $element_id;
             $line_arr['attribute:link'] = umiHierarchy::getInstance()->getPathById($element_id);
             $line_arr['xlink:href'] = "upage://" . $element_id;
             $line_arr['node:name'] = $element->getName();
             $this->pushEditable("photoalbum", "album", $element_id);
             $lines[] = self::parseTemplate($template_line, $line_arr, $element_id);
         }
     } else {
         return self::parseTemplate($template_block_empty, $block_arr);
     }
     $block_arr['subnodes:items'] = $block_arr['void:lines'] = $lines;
     $block_arr['total'] = $total;
     $block_arr['per_page'] = $limit;
     return self::parseTemplate($template_block, $block_arr);
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:41,代码来源:class.php

示例7: json_encode

<?php

//http://api.docs.umi-cms.ru/razrabotka_nestandartnogo_funkcionala/proizvolnye_vyborki/selector/
define("CURRENT_WORKING_DIR", str_replace("\\", "/", $_SERVER['DOCUMENT_ROOT']));
require CURRENT_WORKING_DIR . '/libs/config.php';
$reviews = new selector('pages');
$reviews->types('object-type')->id(69);
$reviews->where('lang')->equals(array(1, 2));
//it seems to be the only feasible way to select all languages (FALSE doesn't work)
if (!array_key_exists('sort', $_REQUEST)) {
    $reviews->order('publish_time')->desc();
} else {
    $sortBy = $_REQUEST['sort'];
    if (array_key_exists('dir', $_REQUEST) && $_REQUEST['dir'] == 'desc') {
        $reviews->order($sortBy)->desc();
    } else {
        $reviews->order($sortBy)->asc();
    }
}
$offset = array_key_exists('offset', $_REQUEST) ? $_REQUEST['offset'] : 0;
$limit = array_key_exists('limit', $_REQUEST) ? $_REQUEST['limit'] : 0;
if ($offset || $limit) {
    $reviews->limit($offset, $limit);
}
$res = array();
foreach ($reviews as $review) {
    $author = umiObjectsCollection::getInstance()->getObject($review->getObject()->author_id);
    $res[] = array('author_name' => $author->nickname, 'message' => $review->message, 'rating' => $review->rating, 'country' => $review->country, 'language' => $review->language, 'date' => explode('.', $review->publish_time->getFormattedDate('j.n.Y')));
}
echo json_encode(array('total' => $reviews->length, 'reviews' => $res));
/*
开发者ID:sd-studio,项目名称:nz,代码行数:31,代码来源:reviews.php

示例8: result

 /**
  * Возвращает страницу "Заказ оформлен/Неудалось оформить"
  * @param order $order
  * @param String $step - результат оформления заказа (успешно/нет)
  * @param $mode
  * @param String $template
  * @return Array
  */
 public function result(order $order, $step, $mode, $template)
 {
     list($tpl_successful, $tpl_failed) = def_module::loadTemplates("emarket/" . $template, 'purchase_successful', 'purchase_failed');
     $tpl_block = $step == 'successful' ? $tpl_successful : $tpl_failed;
     if ($order->isEmpty()) {
         $customer = customer::get();
         $domain = cmsController::getInstance()->getCurrentDomain();
         $domainId = $domain->getId();
         $sel = new selector('objects');
         $sel->types('object-type')->name('emarket', 'order');
         $sel->where('customer_id')->equals($customer->getId());
         $sel->where('domain_id')->equals($domainId);
         $sel->order('id')->desc();
         if ($sel->length()) {
             $orderId = $sel->first->id;
         }
     } else {
         $orderId = $order->getId();
     }
     $result = array('status' => $step, 'order' => array('attribute:id' => $orderId), 'void:order_id' => $orderId);
     return def_module::parseTemplate($tpl_block, $result);
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:30,代码来源:__purchasing.php

示例9: frontendPanel

 public function frontendPanel()
 {
     $permissions = permissionsCollection::getInstance();
     $cmsController = cmsController::getInstance();
     $maxRecentPages = 5;
     $this->flushAsXml('frontendPanel');
     $modules = array();
     $modulesSortedPriorityList = $this->getSortedModulesList();
     foreach ($modulesSortedPriorityList as $moduleInfo) {
         $modules[] = array('attribute:label' => $moduleInfo['label'], 'attribute:type' => $moduleInfo['type'], 'node:name' => $moduleInfo['name']);
     }
     $hierarchy = umiHierarchy::getInstance();
     $key = md5(getServer('HTTP_REFERER'));
     $currentIds = is_array(getSession($key)) ? getSession($key) : array();
     foreach ($currentIds as $i => $id) {
         $currentIds[$i] = $id[2];
     }
     $currentIds = array_unique($currentIds);
     $current = array();
     foreach ($currentIds as $id) {
         $current[] = $hierarchy->getElement($id);
     }
     $recent = new selector('pages');
     $recent->where('is_deleted')->equals(0);
     $recent->where('is_active')->equals(1);
     $recent->where('lang')->equals(langsCollection::getInstance()->getList());
     $recent->order('updatetime')->desc();
     $recent->limit(0, $maxRecentPages);
     if (sizeof($currentIds) && $permissions->isAllowedModule($permissions->getUserId(), 'backup')) {
         $backup = $cmsController->getModule('backup');
         $changelog = $backup->backup_panel($currentIds[0]);
     } else {
         $changelog = null;
     }
     $user = selector::get('object')->id($permissions->getUserId());
     $referer = getRequest('referer') ? getRequest('referer') : getServer('HTTP_REFERER');
     $tickets = new selector('objects');
     $tickets->types('object-type')->name('content', 'ticket');
     $tickets->where('url')->equals($referer);
     $tickets->limit(0, 100);
     $ticketsResult = array();
     foreach ($tickets as $ticket) {
         $user = selector::get('object')->id($ticket->user_id);
         if (!$user) {
             continue;
         }
         $ticketsResult[] = array('attribute:id' => $ticket->id, 'author' => array('attribute:fname' => $user->fname, 'attribute:lname' => $user->lname, 'attribute:login' => $user->login), 'position' => array('attribute:x' => $ticket->x, 'attribute:y' => $ticket->y, 'attribute:width' => $ticket->width, 'attribute:height' => $ticket->height), 'message' => $ticket->message);
     }
     $result = array('user' => array('attribute:id' => $user->id, 'attribute:fname' => $user->fname, 'attribute:lname' => $user->lname, 'attribute:login' => $user->login), 'tickets' => array('nodes:ticket' => $ticketsResult), 'modules' => array('nodes:module' => $modules), 'documents' => array('editable' => array('nodes:page' => $current), 'recent' => array('nodes:page' => $recent->result())));
     if (!$permissions->isAllowedMethod($permissions->getUserId(), 'content', 'tickets')) {
         unset($result['tickets']);
     }
     if ($changelog && sizeof($changelog['nodes:revision'])) {
         $result['changelog'] = $changelog;
     }
     $event = new umiEventPoint('eipFrontendPanelGet');
     $event->setParam("id", getArrayKey($currentIds, 0));
     $event->addRef("result", $result);
     $event->setMode('after');
     $event->call();
     return $result;
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:62,代码来源:__editor.php

示例10: catalog_objects

function catalog_objects($parentId, $properties = array(), $sortings = array())
{
    $objects = new \selector('pages');
    $objects->types('object-type')->name('catalog', 'object');
    $objects->where('hierarchy')->page($parentId);
    foreach ($sortings as $sort) {
        if ($sort) {
            $objects->order($sort)->asc();
        }
    }
    return select($objects, $properties);
}
开发者ID:sd-studio,项目名称:nz,代码行数:12,代码来源:umix.php

示例11: calculateLastMessageId

 public function calculateLastMessageId(iUmiHierarchyElement $element)
 {
     $sel = new selector('pages');
     $sel->types('hierarchy-type')->name('forum', 'message');
     $sel->order('publish_time')->desc();
     $sel->limit(0, 1);
     if ($element->getMethod() == 'conf') {
         $lastTopics = new selector('pages');
         $lastTopics->types('hierarchy-type')->name('forum', 'topic');
         $lastTopics->where('hierarchy')->page($element->id)->childs(1);
         $lastTopics->order('last_post_time')->desc();
         $lastTopics->limit(0, 1);
         if ($lastTopics->first) {
             $sel->where('hierarchy')->page($lastTopics->first->id)->childs(1);
         } else {
             return null;
         }
     } else {
         $sel->where('hierarchy')->page($element->id)->childs(1);
     }
     return $sel->first;
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:22,代码来源:__events_handlers.php

示例12: detectOrderFilters

 static function detectOrderFilters(selector $v8be74552df93e31bbdd6b36ed74bdb6a)
 {
     $v12c500ed0b7879105fb46af0f246be87 = (array) getRequest('order_filter');
     foreach ($v12c500ed0b7879105fb46af0f246be87 as $v972bf3f05d14ffbdb817bef60638ff00 => $vef72c37be9d1b9e6e5bbd6ef09448abe) {
         $v7df4935f4a5a2865191ef74f64df8754 = strtolower($vef72c37be9d1b9e6e5bbd6ef09448abe) == 'desc' ? 'desc' : 'asc';
         try {
             $v8be74552df93e31bbdd6b36ed74bdb6a->order($v972bf3f05d14ffbdb817bef60638ff00)->{$v7df4935f4a5a2865191ef74f64df8754}();
         } catch (selectorException $ve1671797c52e15f763380b45e841ec32) {
             self::tryException($ve1671797c52e15f763380b45e841ec32);
         }
     }
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:12,代码来源:helper.php

示例13: generateFeed

 public function generateFeed($elementId, $xslPath, $typeId = null)
 {
     $this->errorSetErrorPage('/');
     if ($elementId && (!umiHierarchy::getInstance()->isExists($elementId) || !umiHierarchy::getInstance()->getElement($elementId)->getIsActive())) {
         if (def_module::isXSLTResultMode()) {
             $result = array('error' => '%data_feed_nofeed%');
             return def_module::parseTemplate('', $result);
         } else {
             return '%data_feed_nofeed%';
         }
     }
     if ($typeId) {
         list($name, $ext) = explode('-', $typeId);
         $hierarchyType = umiHierarchyTypesCollection::getInstance()->getTypeByName($name, $ext);
         if ($hierarchyType) {
             $typeId = umiObjectTypesCollection::getInstance()->getTypeByHierarchyTypeId($hierarchyType->getId());
         }
     } elseif ($elementId) {
         $typeId = umiHierarchy::getInstance()->getDominantTypeId($elementId);
     } else {
         $typeId = umiObjectTypesCollection::getInstance()->getTypeIdByGUID('news-item');
     }
     $type = umiObjectTypesCollection::getInstance()->getType($typeId);
     if ($type instanceof umiObjectType) {
         $module = $type->getModule();
         $method = $type->getMethod();
     }
     if (!isset($module) && !isset($method)) {
         if (def_module::isXSLTResultMode()) {
             $result = array('error' => '%data_feed_nofeed%');
             return def_module::parseTemplate('', $result);
         } else {
             return '%data_feed_nofeed%';
         }
     }
     if (!$this->checkIfFeedable($module, $method)) {
         if (def_module::isXSLTResultMode()) {
             $result = array('error' => '%data_feed_wrong%');
             return def_module::parseTemplate('', $result);
         } else {
             return '%data_feed_wrong%';
         }
     }
     $rss_per_page = (int) regedit::getInstance()->getVal("//modules/news/rss_per_page");
     $rss_per_page = $rss_per_page > 0 ? $rss_per_page : 10;
     $sel = new selector('pages');
     $sel->option('return')->value('id');
     $sel->where('hierarchy')->page($elementId)->childs(100);
     $sel->types('hierarchy-type')->name($module, $method);
     if ($type->getFieldId('publish_time')) {
         $sel->order('publish_time')->desc();
     }
     $sel->limit(0, $rss_per_page);
     $result = array();
     foreach ($sel->result() as $res) {
         $result[] = $res['id'];
     }
     $exporter = new xmlExporter('rss');
     $exporter->addElements($result);
     $exporter->setIgnoreRelations();
     $umiDump = $exporter->execute();
     $styleFile = CURRENT_WORKING_DIR . "/" . $xslPath;
     if (!is_file($styleFile)) {
         throw new publicException("Can't load exporter {$styleFile}");
     }
     $doc = new DOMDocument("1.0", "utf-8");
     $doc->formatOutput = XML_FORMAT_OUTPUT;
     $doc->loadXML($umiDump->saveXML());
     if (!$elementId) {
         $elementId = umiHierarchy::getInstance()->getDefaultElementId();
     }
     $element = umiHierarchy::getInstance()->getElement($elementId);
     $language = langsCollection::getInstance()->getLang($element->getLangId())->getPrefix();
     $link = umiHierarchy::getInstance()->getPathById($elementId);
     $description = $element->getIsDefault() ? '' : $element->getName();
     $templater = umiTemplater::create('XSLT', $styleFile);
     $templater->setAdditionalVariables(array('link' => $link, 'description' => $description, 'language' => $language));
     $resultXml = $templater->parse($doc);
     $buffer = outputBuffer::current();
     $buffer->contentType('text/xml');
     $buffer->clear();
     $buffer->push($resultXml);
     $buffer->end();
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:84,代码来源:__rss.php


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