XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
IndexTag.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 
11 class IndexTag
12 {
13 
19 
24  var $argument;
25 
30  var $default;
31 
37 
43 
49  function __construct($index)
50  {
51  $this->argument_name = $index->attrs->var;
52 
53  // Sort index - column by which to sort
54  //$dbParser = new DB(); $dbParser = &$dbParser->getParser();
55  //$index->attrs->default = $dbParser->parseExpression($index->attrs->default);
56  $this->default = $index->attrs->default;
57  $this->argument = new QueryArgument($index);
58 
59  // Sort order - asc / desc
60  $this->sort_order = $index->attrs->order;
61  $sortList = array('asc' => 1, 'desc' => 1);
62  if(!isset($sortList[$this->sort_order]))
63  {
64  $arg = new Xml_Node_();
65  $arg->attrs = new Xml_Node_();
66  $arg->attrs->var = $this->sort_order;
67  $arg->attrs->default = 'asc';
68  $this->sort_order_argument = new SortQueryArgument($arg);
69  $this->sort_order = '$' . $this->sort_order_argument->getArgumentName() . '_argument';
70  }
71  else
72  {
73  $this->sort_order = '"' . $this->sort_order . '"';
74  }
75  }
76 
77  function toString()
78  {
79  return sprintf('new OrderByColumn(${\'%s_argument\'}, %s)', $this->argument->getArgumentName(), $this->sort_order);
80  }
81 
82  function getArguments()
83  {
84  $arguments = array();
85  $arguments[] = $this->argument;
86  if($this->sort_order_argument)
87  {
88  $arguments[] = $this->sort_order_argument;
89  }
90  return $arguments;
91  }
92 
93 }
94 /* End of file IndexTag.class.php */
95 /* Location: ./classes/xml/xmlquery/tags/navigation/IndexTag.class.php */
__construct($index)