XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
LimitTag.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 
11 class LimitTag
12 {
13 
19 
24  var $page;
25 
31 
37 
42  var $offset;
43 
49  function __construct($index)
50  {
51  if($index->page && $index->page->attrs && $index->page_count && $index->page_count->attrs)
52  {
53  if(!isset($index->page->attrs->default))
54  $index->page->attrs->default = 1;
55  if(!isset($index->page_count->attrs->default))
56  $index->page_count->attrs->default = 10;
57  $this->page = new QueryArgument($index->page);
58  $this->page_count = new QueryArgument($index->page_count);
59  $this->arguments[] = $this->page;
60  $this->arguments[] = $this->page_count;
61  }
62 
63  if(!isset($index->list_count->attrs->default))
64  $index->list_count->attrs->default = 0;
65  $this->list_count = new QueryArgument($index->list_count);
66  $this->arguments[] = $this->list_count;
67 
68  if(isset($index->offset) && isset($index->offset->attrs))
69  {
70  $this->offset = new QueryArgument($index->offset);
71  $this->arguments[] = $this->offset;
72  }
73  }
74 
75  function toString()
76  {
77  if($this->page)
78  {
79  return sprintf('new Limit(${\'%s_argument\'}, ${\'%s_argument\'}, ${\'%s_argument\'})', $this->list_count->getArgumentName(), $this->page->getArgumentName(), $this->page_count->getArgumentName());
80  }
81  elseif($this->offset)
82  {
83  return sprintf('new Limit(${\'%s_argument\'}, NULL, NULL, ${\'%s_argument\'})', $this->list_count->getArgumentName(), $this->offset->getArgumentName());
84  }
85  else
86  {
87  return sprintf('new Limit(${\'%s_argument\'})', $this->list_count->getArgumentName());
88  }
89  }
90 
91  function getArguments()
92  {
93  return $this->arguments;
94  }
95 
96 }
97 /* End of file LimitTag.class.php */
98 /* Location: ./classes/xml/xmlquery/tags/navigation/LimitTag.class.php */
high class of the module page
Definition: page.class.php:8
__construct($index)