mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 00:39:57 +09:00
add "limit" navigation control to xml query and db classes
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0-DB@8395 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
4d2d18b53b
commit
750733936b
6 changed files with 65 additions and 8 deletions
|
|
@ -131,9 +131,10 @@ class QueryParser {
|
|||
$buff .= '$output->columns = ' . $columns->toString() . ';'.PHP_EOL;
|
||||
$buff .= '$output->tables = ' . $tables->toString() .';'.PHP_EOL;
|
||||
$buff .= '$output->conditions = '.$conditions->toString() .';'.PHP_EOL;
|
||||
$buff .= '$output->groups = ' . $groups->toString() . ';';
|
||||
$buff .= '$output->orderby = ' . $navigation->getOrderByString() .';';
|
||||
|
||||
$buff .= '$output->groups = ' . $groups->toString() . ';';
|
||||
$buff .= '$output->orderby = ' . $navigation->getOrderByString() .';';
|
||||
$buff .= $navigation->getLimitString()?'$output->limit = ' . $navigation->getLimitString() .';':"";
|
||||
|
||||
return "<?php if(!defined('__ZBXE__')) exit();\n"
|
||||
. sprintf('$output->query_id = "%s";%s', $this->query_id, "\n")
|
||||
. sprintf('$output->action = "%s";%s', $this->action, "\n")
|
||||
|
|
|
|||
27
classes/xml/xmlquery/tags/navigation/LimitTag.class.php
Normal file
27
classes/xml/xmlquery/tags/navigation/LimitTag.class.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
class LimitTag {
|
||||
var $arguments;
|
||||
var $page;
|
||||
var $page_count;
|
||||
var $list_count;
|
||||
|
||||
function LimitTag($index){
|
||||
$this->page = $index->page->attrs;
|
||||
$this->page_count = $index->page_count->attrs;
|
||||
$this->list_count = $index->list_count->attrs;
|
||||
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/QueryArgument.class.php');
|
||||
$this->arguments[] = new QueryArgument($index->page);
|
||||
$this->arguments[] = new QueryArgument($index->list_count);
|
||||
}
|
||||
|
||||
function toString(){
|
||||
return sprintf("new Limit(\$%s_argument->getValue(), \$%s_argument->getValue())", $this->page->var, $this->list_count->var);
|
||||
}
|
||||
|
||||
function getArguments(){
|
||||
return $this->arguments;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
<?php
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/navigation/IndexTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/navigation/LimitTag.class.php');
|
||||
|
||||
class NavigationTag {
|
||||
var $order;
|
||||
var $list_count;
|
||||
var $page_count;
|
||||
var $page;
|
||||
var $limit;
|
||||
|
||||
function NavigationTag($xml_navigation){
|
||||
$this->order = array();
|
||||
|
|
@ -17,7 +19,10 @@
|
|||
$this->order[] = new IndexTag($order_info);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($xml_navigation->page->attrs && $xml_navigation->list_count->attrs)
|
||||
$this->limit = new LimitTag($xml_navigation);
|
||||
|
||||
$list_count = $xml_navigation->list_count->attrs;
|
||||
$this->list_count = $list_count;
|
||||
|
||||
|
|
@ -40,7 +45,8 @@
|
|||
}
|
||||
|
||||
function getLimitString(){
|
||||
|
||||
if ($this->limit) return $this->limit->toString();
|
||||
else return "";
|
||||
}
|
||||
|
||||
function getArguments(){
|
||||
|
|
@ -48,6 +54,7 @@
|
|||
foreach($this->order as $order){
|
||||
$arguments = array_merge($order->getArguments(), $arguments);
|
||||
}
|
||||
if($this->limit) $arguments = array_merge($this->limit->getArguments(), $arguments);
|
||||
return $arguments;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue