本文整理汇总了PHP中selector::limit方法的典型用法代码示例。如果您正苦于以下问题:PHP selector::limit方法的具体用法?PHP selector::limit怎么用?PHP selector::limit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类selector
的用法示例。
在下文中一共展示了selector::limit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createAuthorGuest
public function createAuthorGuest($nick, $email, $ip)
{
$objects = umiObjectsCollection::getInstance();
$objectTypes = umiObjectTypesCollection::getInstance();
$nick = trim($nick);
$email = trim($email);
if (!$nick) {
$nick = getLabel('author-anonymous');
}
if (!$email) {
$email = getServer('REMOTE_ADDR');
}
$sel = new selector('objects');
$sel->types('object-type')->name('users', 'author');
$sel->where('email')->equals($email);
$sel->where('nickname')->equals($nick);
$sel->where('ip')->equals($ip);
$sel->limit(0, 1);
if ($sel->first) {
return $sel->first->id;
} else {
$user_name = $nick . " ({$email})";
$object_type_id = $objectTypes->getBaseType("users", "author");
$author_id = $objects->addObject($user_name, $object_type_id);
$author = $objects->getObject($author_id);
$author->name = $user_name;
$author->is_registrated = false;
$author->nickname = $nick;
$author->email = $email;
$author->ip = $ip;
$author->commit();
return $author_id;
}
}
示例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();
}
示例3: 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;
}
示例4: export
public function export()
{
$this->setDataType("list");
$this->setActionType("view");
$limit = getRequest('per_page_limit');
$curr_page = (int) getRequest('p');
$offset = $limit * $curr_page;
$sel = new selector('objects');
$sel->types('object-type')->name('exchange', 'export');
$sel->limit($offset, $limit);
selectorHelper::detectFilters($sel);
$this->setDataRange($limit, $offset);
$data = $this->prepareData($sel->result, "objects");
$this->setData($data, $sel->length);
return $this->doData();
}
示例5: create
/**
* Создать новый пустой заказ
* @return Integer $order id нового заказа
*/
public static function create($useDummyOrder = false)
{
$objectTypes = umiObjectTypesCollection::getInstance();
$objects = umiObjectsCollection::getInstance();
$permissions = permissionsCollection::getInstance();
$cmsController = cmsController::getInstance();
$domain = $cmsController->getCurrentDomain();
$domainId = $domain->getId();
$orderTypeId = $objectTypes->getBaseType('emarket', 'order');
if ($useDummyOrder) {
$sel = new selector('objects');
$sel->types('object-type')->name('emarket', 'order');
$sel->where('name')->equals('dummy');
$sel->limit(0, 1);
if ($sel->length()) {
$orderId = $sel->first->id;
} else {
$orderTypeId = $objectTypes->getBaseType('emarket', 'order');
$orderId = $objects->addObject('dummy', $orderTypeId);
$order = $objects->getObject($orderId);
if ($order instanceof iUmiObject == false) {
throw new publicException("Can't load dummy object for order #{$orderId}");
} else {
$order->setValue('domain_id', $domainId);
$order->commit();
}
}
return self::get($orderId);
}
$managerId = 0;
$statusId = self::getStatusByCode('basket');
$customer = customer::get();
$createTime = time();
$orderId = $objects->addObject('', $orderTypeId);
$order = $objects->getObject($orderId);
if ($order instanceof iUmiObject == false) {
throw new publicException("Can't load created object for order #{$orderId}");
}
$order->domain_id = $domainId;
$order->manager_id = $managerId;
$order->status_id = $statusId;
$order->customer_id = $customer->getId();
$order->order_create_date = $createTime;
$order->commit();
$customer->setLastOrder($orderId, $domainId);
return self::get($orderId);
}
示例6: list_files
public function list_files($element_id = false, $template = "default", $per_page = false, $ignore_paging = false) {
if(!$template) $template = "default";
list($template_block, $template_line) = def_module::loadTemplates("filemanager/".$template, "list_files", "list_files_row");
$block_arr = Array();
$element_id = $this->analyzeRequiredPath($element_id);
if(!$per_page) $per_page = $this->per_page;
$curr_page = (int) getRequest('p');
if($ignore_paging) $curr_page = 0;
$sel = new selector('pages');
$sel->types('hierarchy-type')->name('filemanager', 'shared_file');
$sel->where('hierarchy')->page($element_id)->childs(100);
$sel->limit($curr_page, $per_page);
$result = $sel->result();
$total = $sel->length();
$lines = Array();
foreach($result as $element) {
$line_arr = Array();
$next_element_id = $element->getId();
$line_arr['attribute:id'] = $element->getId();
$line_arr['attribute:name'] = $element->getName();
$line_arr['attribute:link'] = umiHierarchy::getInstance()->getPathById($next_element_id);
$line_arr['attribute:downloads-count'] = $element->getValue('downloads_counter');
$line_arr['xlink:download-link'] = $this->pre_lang . "/filemanager/download/" . $next_element_id;
$line_arr['xlink:href'] = "upage://" . $next_element_id;
$line_arr['node:desc'] = $element->getValue("content");
$this->pushEditable("filemanager", "shared_file", $next_element_id);
$lines[] = self::parseTemplate($template_line, $line_arr, $next_element_id);
}
$block_arr['nodes:items'] = $block_arr['void:lines'] = $lines;
$block_arr['per_page'] = $per_page;
$block_arr['total'] = $total;
return self::parseTemplate($template_block, $block_arr);
}
示例7: stores
public function stores()
{
$this->setDataType("list");
$this->setActionType("view");
if ($this->ifNotXmlMode()) {
return $this->doData();
}
$limit = getRequest('per_page_limit');
$curr_page = (int) getRequest('p');
$offset = $curr_page * $limit;
$sel = new selector('objects');
$sel->types('object-type')->name('emarket', 'store');
$sel->limit($offset, $limit);
selectorHelper::detectFilters($sel);
$this->setDataRange($limit, $offset);
$data = $this->prepareData($sel->result, "objects");
$this->setData($data, $sel->length);
return $this->doData();
}
示例8: lists
public function lists()
{
$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('pages');
$sel->types('hierarchy-type')->name('vote', 'poll');
$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();
}
示例9: pages
function pages($parentId, $properties = array(), $sortings = array(), $limit = false)
{
$depth = 1;
if (!empty($properties['hierarchy_depth'])) {
$depth = (int) $properties['hierarchy_depth'];
unset($properties['hierarchy_depth']);
}
$pages = new \selector('pages');
$pages->types('hierarchy-type')->name('content', 'page');
$pages->where('hierarchy')->page($parentId)->childs($depth);
foreach ($sortings as $sorting) {
if ($sorting == 'rand') {
$pages->order('rand');
}
}
if ($limit) {
$pages->limit(0, $limit);
}
return select($pages, $properties);
}
示例10: 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();
}
示例11: 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);
}
示例12: discounts
public function discounts()
{
$this->setDataType("list");
$this->setActionType("view");
if ($this->ifNotXmlMode()) {
return $this->doData();
}
$objectTypes = umiObjectTypesCollection::getInstance();
$type_id = $objectTypes->getBaseType("emarket", "discount");
$limit = getRequest('per_page_limit');
$curr_page = (int) getRequest('p');
$offset = $limit * $curr_page;
$sel = new selector('objects');
$sel->types('object-type')->name('emarket', 'discount');
$sel->limit($offset, $limit);
selectorHelper::detectFilters($sel);
$this->setDataRange($limit, $offset);
$data = $this->prepareData($sel->result, "objects");
$this->setData($data, $sel->length);
return $this->doData();
}
示例13: tree
public function tree()
{
$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('catalog', 'category');
$sel->types('hierarchy-type')->name('catalog', 'object');
$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();
}
示例14: view_noactive_comments
public function view_noactive_comments()
{
$this->setDataType("list");
$this->setActionType("view");
if ($this->ifNotXmlMode()) {
return $this->doData();
}
//Получение id родительской страницы. Если передан неверный id, будет выброшен exception
$parent_id = $this->expectElementId('param0');
$limit = 20;
$curr_page = (int) getRequest('p');
$offset = $limit * $curr_page;
$sel = new selector('pages');
$sel->types('hierarchy-type')->name('comments', 'comment');
$sel->where('is_active')->equals(false);
$sel->limit($offset, $limit);
selectorHelper::detectFilters($sel);
$this->setDataRange($limit, $offset);
$data = $this->prepareData($sel->result, "pages");
$this->setData($data, $sel->total);
return $this->doData();
}
示例15: tickets
public function tickets()
{
$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('objects');
$sel->types('object-type')->name('content', 'ticket');
$sel->limit($offset, $limit);
selectorHelper::detectFilters($sel);
if (isset($_REQUEST['order_filter']['name'])) {
$_REQUEST['order_filter']['message'] = $_REQUEST['order_filter']['name'];
unset($_REQUEST['order_filter']['name']);
}
$data = $this->prepareData($sel->result, "objects");
$this->setData($data, $sel->length);
$this->setDataRangeByPerPage($limit, $curr_page);
return $this->doData();
}