mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-26 13:52:24 +09:00
Updated the way DB class files are included.
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9034 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
03b5c9a365
commit
833dcfae37
18 changed files with 270 additions and 242 deletions
|
|
@ -1,74 +1,65 @@
|
|||
<?php
|
||||
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/column/ColumnTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/column/SelectColumnsTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/column/InsertColumnsTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/column/UpdateColumnsTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/table/TablesTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/condition/ConditionsTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/condition/JoinConditionsTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/group/GroupsTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/navigation/NavigationTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/navigation/IndexTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/query/QueryTag.class.php');
|
||||
class QueryParser {
|
||||
|
||||
class QueryParser {
|
||||
var $queryTag;
|
||||
|
||||
function QueryParser($query, $isSubQuery = false){
|
||||
$this->queryTag = new QueryTag($query, $isSubQuery);
|
||||
}
|
||||
|
||||
function getTableInfo($query_id, $table_name){
|
||||
$column_type = array();
|
||||
|
||||
$id_args = explode('.', $query_id);
|
||||
if(count($id_args)==2) {
|
||||
$target = 'modules';
|
||||
$module = $id_args[0];
|
||||
$id = $id_args[1];
|
||||
} elseif(count($id_args)==3) {
|
||||
$target = $id_args[0];
|
||||
if(!in_array($target, array('modules','addons','widgets'))) return;
|
||||
$module = $id_args[1];
|
||||
$id = $id_args[2];
|
||||
}
|
||||
|
||||
// get column properties from the table
|
||||
$table_file = sprintf('%s%s/%s/schemas/%s.xml', _XE_PATH_, 'modules', $module, $table_name);
|
||||
if(!file_exists($table_file)) {
|
||||
$searched_list = FileHandler::readDir(_XE_PATH_.'modules');
|
||||
$searched_count = count($searched_list);
|
||||
for($i=0;$i<$searched_count;$i++) {
|
||||
$table_file = sprintf('%s%s/%s/schemas/%s.xml', _XE_PATH_, 'modules', $searched_list[$i], $table_name);
|
||||
if(file_exists($table_file)) break;
|
||||
var $queryTag;
|
||||
|
||||
function QueryParser($query, $isSubQuery = false) {
|
||||
$this->queryTag = new QueryTag($query, $isSubQuery);
|
||||
}
|
||||
|
||||
function getTableInfo($query_id, $table_name) {
|
||||
$column_type = array();
|
||||
|
||||
$id_args = explode('.', $query_id);
|
||||
if (count($id_args) == 2) {
|
||||
$target = 'modules';
|
||||
$module = $id_args[0];
|
||||
$id = $id_args[1];
|
||||
} elseif (count($id_args) == 3) {
|
||||
$target = $id_args[0];
|
||||
if (!in_array($target, array('modules', 'addons', 'widgets')))
|
||||
return;
|
||||
$module = $id_args[1];
|
||||
$id = $id_args[2];
|
||||
}
|
||||
}
|
||||
|
||||
if(file_exists($table_file)) {
|
||||
$table_xml = FileHandler::readFile($table_file);
|
||||
$xml_parser = new XmlParser();
|
||||
$table_obj = $xml_parser->parse($table_xml);
|
||||
if($table_obj->table) {
|
||||
if(isset($table_obj->table->column) && !is_array($table_obj->table->column))
|
||||
{
|
||||
$table_obj->table->column = array($table_obj->table->column);
|
||||
}
|
||||
|
||||
foreach($table_obj->table->column as $k => $v) {
|
||||
$column_type[$v->attrs->name] = $v->attrs->type;
|
||||
// get column properties from the table
|
||||
$table_file = sprintf('%s%s/%s/schemas/%s.xml', _XE_PATH_, 'modules', $module, $table_name);
|
||||
if (!file_exists($table_file)) {
|
||||
$searched_list = FileHandler::readDir(_XE_PATH_ . 'modules');
|
||||
$searched_count = count($searched_list);
|
||||
for ($i = 0; $i < $searched_count; $i++) {
|
||||
$table_file = sprintf('%s%s/%s/schemas/%s.xml', _XE_PATH_, 'modules', $searched_list[$i], $table_name);
|
||||
if (file_exists($table_file))
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $column_type;
|
||||
}
|
||||
|
||||
function toString(){
|
||||
return "<?php if(!defined('__ZBXE__')) exit();\n"
|
||||
.$this->queryTag->toString()
|
||||
. 'return $query; ?>';
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($table_file)) {
|
||||
$table_xml = FileHandler::readFile($table_file);
|
||||
$xml_parser = new XmlParser();
|
||||
$table_obj = $xml_parser->parse($table_xml);
|
||||
if ($table_obj->table) {
|
||||
if (isset($table_obj->table->column) && !is_array($table_obj->table->column)) {
|
||||
$table_obj->table->column = array($table_obj->table->column);
|
||||
}
|
||||
|
||||
foreach ($table_obj->table->column as $k => $v) {
|
||||
$column_type[$v->attrs->name] = $v->attrs->type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $column_type;
|
||||
}
|
||||
|
||||
function toString() {
|
||||
return "<?php if(!defined('__ZBXE__')) exit();\n"
|
||||
. $this->queryTag->toString()
|
||||
. 'return $query; ?>';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
if($tag->attrs->operation) $this->operation = $tag->attrs->operation;
|
||||
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/validator/QueryArgumentValidator.class.php');
|
||||
$this->argument_validator = new QueryArgumentValidator($tag, $this);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
<?php
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/DefaultValue.class.php');
|
||||
|
||||
class QueryArgumentValidator {
|
||||
var $argument_name;
|
||||
var $default_value;
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
<?php
|
||||
|
||||
class Validator {
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php
|
||||
/**
|
||||
* @class InsertColumnTag
|
||||
* @author Arnia Software
|
||||
|
|
@ -9,24 +9,23 @@
|
|||
|
||||
class InsertColumnTag extends ColumnTag {
|
||||
var $argument;
|
||||
|
||||
|
||||
function InsertColumnTag($column) {
|
||||
parent::ColumnTag($column->attrs->name);
|
||||
$dbParser = XmlQueryParser::getDBParser();
|
||||
$this->name = $dbParser->parseColumnName($this->name);
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/QueryArgument.class.php');
|
||||
$this->argument = new QueryArgument($column);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function getExpressionString(){
|
||||
return sprintf('new InsertExpression(\'%s\', $%s_argument)'
|
||||
, $this->name
|
||||
, $this->argument->argument_name);
|
||||
}
|
||||
|
||||
, $this->argument->argument_name);
|
||||
}
|
||||
|
||||
function getArgument(){
|
||||
return $this->argument;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php
|
||||
/**
|
||||
* @class InsertColumnsTag
|
||||
* @author Arnia Software
|
||||
|
|
@ -6,34 +6,31 @@
|
|||
*
|
||||
**/
|
||||
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/column/ColumnTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/column/InsertColumnTag.class.php');
|
||||
|
||||
class InsertColumnsTag{
|
||||
var $columns;
|
||||
|
||||
function InsertColumnsTag($xml_columns) {
|
||||
$this->columns = array();
|
||||
|
||||
|
||||
function InsertColumnsTag($xml_columns) {
|
||||
$this->columns = array();
|
||||
|
||||
if(!$xml_columns)
|
||||
return;
|
||||
|
||||
if(!is_array($xml_columns)) $xml_columns = array($xml_columns);
|
||||
|
||||
|
||||
if(!is_array($xml_columns)) $xml_columns = array($xml_columns);
|
||||
|
||||
foreach($xml_columns as $column){
|
||||
if($column->name === 'query') $this->columns[] = new QueryTag($column, true);
|
||||
else $this->columns[] = new InsertColumnTag($column);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function toString(){
|
||||
$output_columns = 'array(' . PHP_EOL;
|
||||
foreach($this->columns as $column){
|
||||
$output_columns .= $column->getExpressionString() . PHP_EOL . ',';
|
||||
}
|
||||
$output_columns = substr($output_columns, 0, -1);
|
||||
$output_columns .= ')';
|
||||
return $output_columns;
|
||||
$output_columns .= ')';
|
||||
return $output_columns;
|
||||
}
|
||||
|
||||
function getArguments(){
|
||||
|
|
@ -42,8 +39,8 @@
|
|||
$arguments[] = $column->getArgument();
|
||||
}
|
||||
return $arguments;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,40 +1,37 @@
|
|||
<?php
|
||||
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/column/ColumnTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/column/SelectColumnTag.class.php');
|
||||
|
||||
|
||||
class SelectColumnsTag {
|
||||
var $columns;
|
||||
|
||||
|
||||
function SelectColumnsTag($xml_columns_tag){
|
||||
$xml_columns = $xml_columns_tag->column;
|
||||
$xml_queries = $xml_columns_tag->query;
|
||||
|
||||
$this->columns = array();
|
||||
|
||||
|
||||
$this->columns = array();
|
||||
|
||||
if(!$xml_columns) {
|
||||
$this->columns[] = new SelectColumnTag("*");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!is_array($xml_columns)) $xml_columns = array($xml_columns);
|
||||
|
||||
if(!is_array($xml_columns)) $xml_columns = array($xml_columns);
|
||||
|
||||
foreach($xml_columns as $column){
|
||||
$this->columns[] = new SelectColumnTag($column);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if(!$xml_queries) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!is_array($xml_queries)) $xml_queries = array($xml_queries);
|
||||
|
||||
if(!is_array($xml_queries)) $xml_queries = array($xml_queries);
|
||||
|
||||
foreach($xml_queries as $column){
|
||||
$this->columns[] = new QueryTag($column, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function toString(){
|
||||
$output_columns = 'array(' . PHP_EOL;
|
||||
foreach($this->columns as $column){
|
||||
|
|
@ -44,10 +41,10 @@
|
|||
$output_columns .= $column->getExpressionString() . PHP_EOL . ',';
|
||||
}
|
||||
$output_columns = substr($output_columns, 0, -1);
|
||||
$output_columns .= ')';
|
||||
return $output_columns;
|
||||
$output_columns .= ')';
|
||||
return $output_columns;
|
||||
}
|
||||
|
||||
|
||||
function getArguments(){
|
||||
$arguments = array();
|
||||
foreach($this->columns as $column){
|
||||
|
|
@ -55,6 +52,6 @@
|
|||
$arguments = array_merge($arguments, $column->getArguments());
|
||||
}
|
||||
return $arguments;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @class UpdateColumnTag
|
||||
|
|
@ -11,24 +11,23 @@
|
|||
|
||||
class UpdateColumnTag extends ColumnTag {
|
||||
var $argument;
|
||||
|
||||
|
||||
function UpdateColumnTag($column) {
|
||||
parent::ColumnTag($column->attrs->name);
|
||||
$dbParser = XmlQueryParser::getDBParser();
|
||||
$this->name = $dbParser->parseColumnName($this->name);
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/QueryArgument.class.php');
|
||||
$this->argument = new QueryArgument($column);
|
||||
}
|
||||
|
||||
|
||||
function getExpressionString(){
|
||||
return sprintf('new UpdateExpression(\'%s\', $%s_argument)'
|
||||
, $this->name
|
||||
, $this->argument->argument_name);
|
||||
}
|
||||
|
||||
, $this->argument->argument_name);
|
||||
}
|
||||
|
||||
function getArgument(){
|
||||
return $this->argument;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @class UpdateColumnsTag
|
||||
|
|
@ -7,33 +7,30 @@
|
|||
*
|
||||
**/
|
||||
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/column/ColumnTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/column/UpdateColumnTag.class.php');
|
||||
|
||||
class UpdateColumnsTag{
|
||||
var $columns;
|
||||
|
||||
function UpdateColumnsTag($xml_columns) {
|
||||
$this->columns = array();
|
||||
|
||||
if(!is_array($xml_columns)) $xml_columns = array($xml_columns);
|
||||
|
||||
|
||||
function UpdateColumnsTag($xml_columns) {
|
||||
$this->columns = array();
|
||||
|
||||
if(!is_array($xml_columns)) $xml_columns = array($xml_columns);
|
||||
|
||||
foreach($xml_columns as $column){
|
||||
if($column->name === 'query') $this->columns[] = new QueryTag($column, true);
|
||||
else $this->columns[] = new UpdateColumnTag($column);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function toString(){
|
||||
$output_columns = 'array(' . PHP_EOL;
|
||||
foreach($this->columns as $column){
|
||||
$output_columns .= $column->getExpressionString() . PHP_EOL . ',';
|
||||
}
|
||||
$output_columns = substr($output_columns, 0, -1);
|
||||
$output_columns .= ')';
|
||||
return $output_columns;
|
||||
$output_columns .= ')';
|
||||
return $output_columns;
|
||||
}
|
||||
|
||||
|
||||
function getArguments(){
|
||||
$arguments = array();
|
||||
foreach($this->columns as $column){
|
||||
|
|
@ -41,7 +38,7 @@
|
|||
}
|
||||
return $arguments;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,25 +1,24 @@
|
|||
<?php
|
||||
<?php
|
||||
|
||||
class ConditionGroupTag {
|
||||
class ConditionGroupTag {
|
||||
var $conditions;
|
||||
var $pipe;
|
||||
|
||||
|
||||
function ConditionGroupTag($conditions, $pipe = ""){
|
||||
$this->pipe = $pipe;
|
||||
|
||||
|
||||
if(!is_array($conditions)) $conditions = array($conditions);
|
||||
if(count($conditions))require_once(_XE_PATH_.'classes/xml/xmlquery/tags/condition/ConditionTag.class.php');
|
||||
|
||||
|
||||
foreach($conditions as $condition){
|
||||
//if($condition->node_name === 'query') $this->conditions[] = new QueryTag($condition, true);
|
||||
$this->conditions[] = new ConditionTag($condition);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getConditions(){
|
||||
return $this->conditions;
|
||||
}
|
||||
|
||||
|
||||
function getConditionGroupString(){
|
||||
$conditions_string = 'array('.PHP_EOL;
|
||||
foreach($this->conditions as $condition){
|
||||
|
|
@ -27,10 +26,10 @@
|
|||
}
|
||||
$conditions_string = substr($conditions_string, 0, -2);//remove ','
|
||||
$conditions_string .= ')';
|
||||
|
||||
|
||||
return sprintf("new ConditionGroup(%s%s)", $conditions_string, $this->pipe ? ',\''.$this->pipe . '\'': '');
|
||||
}
|
||||
|
||||
|
||||
function getArguments(){
|
||||
$arguments = array();
|
||||
foreach($this->conditions as $condition){
|
||||
|
|
@ -38,6 +37,6 @@
|
|||
}
|
||||
return $arguments;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
@ -31,8 +31,6 @@
|
|||
$this->default_column = $this->query->toString();
|
||||
}
|
||||
else if(($condition->attrs->var && !$isColumnName) || $isColumnName === false){
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/QueryArgument.class.php');
|
||||
|
||||
$this->argument = new QueryArgument($condition);
|
||||
$this->argument_name = $this->argument->getArgumentName();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,42 +1,40 @@
|
|||
<?php
|
||||
<?php
|
||||
class ConditionsTag {
|
||||
var $condition_groups;
|
||||
|
||||
|
||||
function ConditionsTag($xml_conditions){
|
||||
$this->condition_groups = array();
|
||||
|
||||
|
||||
$xml_condition_list = array();
|
||||
if($xml_conditions->condition)
|
||||
$xml_condition_list = $xml_conditions->condition;
|
||||
|
||||
|
||||
if($xml_conditions->query){
|
||||
if(!is_array($xml_condition_list)) $xml_condition_list = array($xml_condition_list);
|
||||
if(!is_array($xml_conditions->query)) $xml_conditions->query = array($xml_conditions->query);
|
||||
$xml_condition_list = array_merge($xml_condition_list, $xml_conditions->query);
|
||||
}
|
||||
if($xml_condition_list){
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/condition/ConditionGroupTag.class.php');
|
||||
$this->condition_groups[] = new ConditionGroupTag($xml_condition_list);
|
||||
}
|
||||
|
||||
|
||||
$xml_groups = $xml_conditions->group;
|
||||
if($xml_groups){
|
||||
if(!is_array($xml_groups)) $xml_groups = array($xml_groups);
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/condition/ConditionGroupTag.class.php');
|
||||
foreach($xml_groups as $group){
|
||||
$this->condition_groups[] = new ConditionGroupTag($group->condition, $group->attrs->pipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function toString(){
|
||||
$output_conditions = 'array(' . PHP_EOL;
|
||||
foreach($this->condition_groups as $condition){
|
||||
$output_conditions .= $condition->getConditionGroupString() . PHP_EOL . ',';
|
||||
}
|
||||
$output_conditions = substr($output_conditions, 0, -1);
|
||||
$output_conditions .= ')';
|
||||
return $output_conditions;
|
||||
$output_conditions .= ')';
|
||||
return $output_conditions;
|
||||
}
|
||||
|
||||
function getArguments(){
|
||||
|
|
@ -45,6 +43,6 @@
|
|||
$arguments = array_merge($arguments, $condition->getArguments());
|
||||
}
|
||||
return $arguments;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -14,8 +14,6 @@
|
|||
//$dbParser = XmlQueryParser::getDBParser();
|
||||
//$index->attrs->default = $dbParser->parseExpression($index->attrs->default);
|
||||
$this->default = $index->attrs->default;
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/QueryArgument.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/SortQueryArgument.class.php');
|
||||
$this->argument = new QueryArgument($index);
|
||||
|
||||
// Sort order - asc / desc
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@
|
|||
var $list_count;
|
||||
|
||||
function LimitTag($index){
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/QueryArgument.class.php');
|
||||
|
||||
if($index->page->attrs && $index->page_count->attrs){
|
||||
$this->page = new QueryArgument($index->page);
|
||||
$this->page_count = new QueryArgument($index->page_count);
|
||||
|
|
|
|||
|
|
@ -1,14 +1,11 @@
|
|||
<?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');
|
||||
|
||||
<?php
|
||||
class NavigationTag {
|
||||
var $order;
|
||||
var $list_count;
|
||||
var $page_count;
|
||||
var $page;
|
||||
var $limit;
|
||||
|
||||
|
||||
function NavigationTag($xml_navigation){
|
||||
$this->order = array();
|
||||
if($xml_navigation) {
|
||||
|
|
@ -19,10 +16,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;
|
||||
|
||||
|
|
@ -31,19 +28,19 @@
|
|||
|
||||
$page = $xml_navigation->page->attrs;
|
||||
$this->page = $page ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getOrderByString(){
|
||||
$output = 'array(' . PHP_EOL;
|
||||
foreach($this->order as $order){
|
||||
$output .= $order->toString() . PHP_EOL . ',';
|
||||
}
|
||||
$output = substr($output, 0, -1);
|
||||
$output .= ')';
|
||||
return $output;
|
||||
$output .= ')';
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
function getLimitString(){
|
||||
if ($this->limit) return $this->limit->toString();
|
||||
else return "";
|
||||
|
|
@ -56,7 +53,7 @@
|
|||
}
|
||||
if($this->limit) $arguments = array_merge($this->limit->getArguments(), $arguments);
|
||||
return $arguments;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @class TablesTag
|
||||
|
|
@ -16,17 +16,15 @@
|
|||
* Can have children of type <table> or <query>
|
||||
*/
|
||||
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/table/TableTag.class.php');
|
||||
|
||||
class TablesTag {
|
||||
var $tables;
|
||||
|
||||
function TablesTag($xml_tables_tag){
|
||||
|
||||
function TablesTag($xml_tables_tag){
|
||||
$this->tables = array();
|
||||
|
||||
|
||||
$xml_tables = $xml_tables_tag->table;
|
||||
if(!is_array($xml_tables)) $xml_tables = array($xml_tables);
|
||||
|
||||
|
||||
foreach($xml_tables as $tag){
|
||||
if($tag->attrs->query == 'true'){
|
||||
$this->tables[] = new QueryTag($tag, true);
|
||||
|
|
@ -34,26 +32,26 @@
|
|||
else {
|
||||
$this->tables[] = new TableTag($tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getTables(){
|
||||
return $this->tables;
|
||||
}
|
||||
|
||||
|
||||
function toString(){
|
||||
$output_tables = 'array(' . PHP_EOL;
|
||||
foreach($this->tables as $table){
|
||||
foreach($this->tables as $table){
|
||||
if(is_a($table, 'QueryTag'))
|
||||
$output_tables .= $table->toString() . PHP_EOL . ',';
|
||||
else
|
||||
$output_tables .= $table->getTableString() . PHP_EOL . ',';
|
||||
$output_tables .= $table->getTableString() . PHP_EOL . ',';
|
||||
}
|
||||
$output_tables = substr($output_tables, 0, -1);
|
||||
$output_tables .= ')';
|
||||
return $output_tables;
|
||||
$output_tables .= ')';
|
||||
return $output_tables;
|
||||
}
|
||||
|
||||
|
||||
function getArguments(){
|
||||
$arguments = array();
|
||||
foreach($this->tables as $table)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue