mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-09 03:52:15 +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
|
|
@ -13,24 +13,30 @@
|
||||||
* queryid = module_name.query_name
|
* queryid = module_name.query_name
|
||||||
**/
|
**/
|
||||||
|
|
||||||
require_once(_XE_PATH_.'classes/xml/xmlquery/DBParser.class.php');
|
if(!defined('__XE_LOADED_DB_CLASS__')){
|
||||||
require_once(_XE_PATH_.'classes/xml/xmlquery/argument/Argument.class.php');
|
define('__XE_LOADED_DB_CLASS__', 1);
|
||||||
require_once(_XE_PATH_.'classes/xml/xmlquery/argument/SortArgument.class.php');
|
|
||||||
require_once(_XE_PATH_.'classes/xml/xmlquery/argument/ConditionArgument.class.php');
|
require(_XE_PATH_.'classes/xml/xmlquery/DBParser.class.php');
|
||||||
require_once(_XE_PATH_.'classes/xml/XmlQueryParser.class.php');
|
require(_XE_PATH_.'classes/xml/xmlquery/QueryParser.class.php');
|
||||||
require_once(_XE_PATH_.'classes/db/queryparts/expression/Expression.class.php');
|
require(_XE_PATH_.'classes/xml/xmlquery/argument/Argument.class.php');
|
||||||
require_once(_XE_PATH_.'classes/db/queryparts/expression/SelectExpression.class.php');
|
require(_XE_PATH_.'classes/xml/xmlquery/argument/SortArgument.class.php');
|
||||||
require_once(_XE_PATH_.'classes/db/queryparts/expression/InsertExpression.class.php');
|
require(_XE_PATH_.'classes/xml/xmlquery/argument/ConditionArgument.class.php');
|
||||||
require_once(_XE_PATH_.'classes/db/queryparts/expression/UpdateExpression.class.php');
|
require(_XE_PATH_.'classes/xml/XmlQueryParser.class.php');
|
||||||
require_once(_XE_PATH_.'classes/db/queryparts/table/Table.class.php');
|
|
||||||
require_once(_XE_PATH_.'classes/db/queryparts/table/JoinTable.class.php');
|
require(_XE_PATH_.'classes/db/queryparts/expression/Expression.class.php');
|
||||||
require_once(_XE_PATH_.'classes/db/queryparts/condition/ConditionGroup.class.php');
|
require(_XE_PATH_.'classes/db/queryparts/expression/SelectExpression.class.php');
|
||||||
require_once(_XE_PATH_.'classes/db/queryparts/condition/Condition.class.php');
|
require(_XE_PATH_.'classes/db/queryparts/expression/InsertExpression.class.php');
|
||||||
require_once(_XE_PATH_.'classes/db/queryparts/expression/StarExpression.class.php');
|
require(_XE_PATH_.'classes/db/queryparts/expression/UpdateExpression.class.php');
|
||||||
require_once(_XE_PATH_.'classes/db/queryparts/order/OrderByColumn.class.php');
|
require(_XE_PATH_.'classes/db/queryparts/table/Table.class.php');
|
||||||
require_once(_XE_PATH_.'classes/db/queryparts/limit/Limit.class.php');
|
require(_XE_PATH_.'classes/db/queryparts/table/JoinTable.class.php');
|
||||||
require_once(_XE_PATH_.'classes/db/queryparts/Query.class.php');
|
require(_XE_PATH_.'classes/db/queryparts/condition/ConditionGroup.class.php');
|
||||||
require_once(_XE_PATH_.'classes/db/queryparts/Subquery.class.php');
|
require(_XE_PATH_.'classes/db/queryparts/condition/Condition.class.php');
|
||||||
|
require(_XE_PATH_.'classes/db/queryparts/expression/StarExpression.class.php');
|
||||||
|
require(_XE_PATH_.'classes/db/queryparts/order/OrderByColumn.class.php');
|
||||||
|
require(_XE_PATH_.'classes/db/queryparts/limit/Limit.class.php');
|
||||||
|
require(_XE_PATH_.'classes/db/queryparts/Query.class.php');
|
||||||
|
require(_XE_PATH_.'classes/db/queryparts/Subquery.class.php');
|
||||||
|
}
|
||||||
|
|
||||||
class DB {
|
class DB {
|
||||||
|
|
||||||
|
|
@ -56,6 +62,7 @@
|
||||||
var $errstr = ''; ///< error message
|
var $errstr = ''; ///< error message
|
||||||
var $query = ''; ///< query string of latest executed query
|
var $query = ''; ///< query string of latest executed query
|
||||||
var $elapsed_time = 0; ///< elapsed time of latest executed query
|
var $elapsed_time = 0; ///< elapsed time of latest executed query
|
||||||
|
var $elapsed_dbclass_time = 0; ///< elapsed time of latest executed query
|
||||||
|
|
||||||
var $transaction_started = false; ///< transaction flag
|
var $transaction_started = false; ///< transaction flag
|
||||||
|
|
||||||
|
|
@ -313,7 +320,10 @@
|
||||||
**/
|
**/
|
||||||
function executeQuery($query_id, $args = NULL, $arg_columns = NULL, $database_type = 'master') {
|
function executeQuery($query_id, $args = NULL, $arg_columns = NULL, $database_type = 'master') {
|
||||||
if(!$query_id) return new Object(-1, 'msg_invalid_queryid');
|
if(!$query_id) return new Object(-1, 'msg_invalid_queryid');
|
||||||
$this->query_id = $query_id;
|
|
||||||
|
$this->actDBClassStart();
|
||||||
|
|
||||||
|
$this->query_id = $query_id;
|
||||||
|
|
||||||
$id_args = explode('.', $query_id);
|
$id_args = explode('.', $query_id);
|
||||||
if(count($id_args) == 2) {
|
if(count($id_args) == 2) {
|
||||||
|
|
@ -322,20 +332,31 @@
|
||||||
$id = $id_args[1];
|
$id = $id_args[1];
|
||||||
} elseif(count($id_args) == 3) {
|
} elseif(count($id_args) == 3) {
|
||||||
$target = $id_args[0];
|
$target = $id_args[0];
|
||||||
if(!in_array($target, array('addons','widgets'))) return;
|
if(!in_array($target, array('addons','widgets'))){
|
||||||
|
$this->actDBClassFinish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
$module = $id_args[1];
|
$module = $id_args[1];
|
||||||
$id = $id_args[2];
|
$id = $id_args[2];
|
||||||
}
|
}
|
||||||
if(!$target || !$module || !$id) return new Object(-1, 'msg_invalid_queryid');
|
if(!$target || !$module || !$id){
|
||||||
|
$this->actDBClassFinish();
|
||||||
|
return new Object(-1, 'msg_invalid_queryid');
|
||||||
|
}
|
||||||
|
|
||||||
$xml_file = sprintf('%s%s/%s/queries/%s.xml', _XE_PATH_, $target, $module, $id);
|
$xml_file = sprintf('%s%s/%s/queries/%s.xml', _XE_PATH_, $target, $module, $id);
|
||||||
if(!file_exists($xml_file)) return new Object(-1, 'msg_invalid_queryid');
|
if(!file_exists($xml_file)){
|
||||||
|
$this->actDBClassFinish();
|
||||||
|
return new Object(-1, 'msg_invalid_queryid');
|
||||||
|
}
|
||||||
|
|
||||||
// look for cache file
|
// look for cache file
|
||||||
$cache_file = $this->checkQueryCacheFile($query_id, $xml_file);
|
$cache_file = $this->checkQueryCacheFile($query_id, $xml_file);
|
||||||
|
$result = $this->_executeQuery($cache_file, $args, $query_id, $arg_columns, $database_type);
|
||||||
|
|
||||||
|
$this->actDBClassFinish();
|
||||||
// execute query
|
// execute query
|
||||||
return $this->_executeQuery($cache_file, $args, $query_id, $arg_columns, $database_type);
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -746,7 +767,27 @@
|
||||||
|
|
||||||
$this->_afterConnect($result);
|
$this->_afterConnect($result);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @brief start recording DBClass log
|
||||||
|
* @return none
|
||||||
|
**/
|
||||||
|
function actDBClassStart() {
|
||||||
|
$this->setError(0, 'success');
|
||||||
|
$this->act_dbclass_start = getMicroTime();
|
||||||
|
$this->elapsed_dbclass_time = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief finish recording DBClass log
|
||||||
|
* @return none
|
||||||
|
**/
|
||||||
|
function actDBClassFinish() {
|
||||||
|
if(!$this->query) return;
|
||||||
|
$this->act_dbclass_finish = getMicroTime();
|
||||||
|
$elapsed_dbclass_time = $this->act_dbclass_finish - $this->act_dbclass_start;
|
||||||
|
$this->elapsed_dbclass_time = $elapsed_dbclass_time;
|
||||||
|
$GLOBALS['__dbclass_elapsed_time__'] += $elapsed_dbclass_time;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -2,69 +2,100 @@
|
||||||
/**
|
/**
|
||||||
* @class NewXmlQueryParser
|
* @class NewXmlQueryParser
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief case to parse XE xml query
|
* @brief case to parse XE xml query
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
*
|
*
|
||||||
* @todo need to support extend query such as subquery, union
|
* @todo need to support extend query such as subquery, union
|
||||||
* @todo include info about column types for parsing user input
|
* @todo include info about column types for parsing user input
|
||||||
**/
|
**/
|
||||||
|
|
||||||
require_once(_XE_PATH_.'classes/xml/xmlquery/DBParser.class.php');
|
if(!defined('__XE_LOADED_XML_CLASS__')){
|
||||||
require_once(_XE_PATH_.'classes/xml/xmlquery/QueryParser.class.php');
|
define('__XE_LOADED_XML_CLASS__', 1);
|
||||||
|
|
||||||
|
require(_XE_PATH_.'classes/xml/xmlquery/tags/query/QueryTag.class.php');
|
||||||
|
|
||||||
|
require(_XE_PATH_.'classes/xml/xmlquery/tags/table/TableTag.class.php');
|
||||||
|
require(_XE_PATH_.'classes/xml/xmlquery/tags/table/TablesTag.class.php');
|
||||||
|
|
||||||
|
require(_XE_PATH_.'classes/xml/xmlquery/tags/column/ColumnTag.class.php');
|
||||||
|
require(_XE_PATH_.'classes/xml/xmlquery/tags/column/SelectColumnTag.class.php');
|
||||||
|
require(_XE_PATH_.'classes/xml/xmlquery/tags/column/InsertColumnTag.class.php');
|
||||||
|
require(_XE_PATH_.'classes/xml/xmlquery/tags/column/UpdateColumnTag.class.php');
|
||||||
|
require(_XE_PATH_.'classes/xml/xmlquery/tags/column/SelectColumnsTag.class.php');
|
||||||
|
require(_XE_PATH_.'classes/xml/xmlquery/tags/column/InsertColumnsTag.class.php');
|
||||||
|
require(_XE_PATH_.'classes/xml/xmlquery/tags/column/UpdateColumnsTag.class.php');
|
||||||
|
|
||||||
|
require(_XE_PATH_.'classes/xml/xmlquery/tags/condition/ConditionTag.class.php');
|
||||||
|
require(_XE_PATH_.'classes/xml/xmlquery/tags/condition/ConditionsTag.class.php');
|
||||||
|
require(_XE_PATH_.'classes/xml/xmlquery/tags/condition/JoinConditionsTag.class.php');
|
||||||
|
require(_XE_PATH_.'classes/xml/xmlquery/tags/condition/ConditionGroupTag.class.php');
|
||||||
|
|
||||||
|
require(_XE_PATH_.'classes/xml/xmlquery/tags/group/GroupsTag.class.php');
|
||||||
|
|
||||||
|
require(_XE_PATH_.'classes/xml/xmlquery/tags/navigation/NavigationTag.class.php');
|
||||||
|
require(_XE_PATH_.'classes/xml/xmlquery/tags/navigation/IndexTag.class.php');
|
||||||
|
require(_XE_PATH_.'classes/xml/xmlquery/tags/navigation/LimitTag.class.php');
|
||||||
|
|
||||||
|
require(_XE_PATH_.'classes/xml/xmlquery/queryargument/QueryArgument.class.php');
|
||||||
|
require(_XE_PATH_.'classes/xml/xmlquery/queryargument/SortQueryArgument.class.php');
|
||||||
|
require(_XE_PATH_.'classes/xml/xmlquery/queryargument/validator/QueryArgumentValidator.class.php');
|
||||||
|
require(_XE_PATH_.'classes/xml/xmlquery/queryargument/DefaultValue.class.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class XmlQueryParser extends XmlParser {
|
class XmlQueryParser extends XmlParser {
|
||||||
static $dbParser = null;
|
static $dbParser = null;
|
||||||
var $db_type;
|
var $db_type;
|
||||||
|
|
||||||
function XmlQueryParser($db_type = NULL){
|
function XmlQueryParser($db_type = NULL){
|
||||||
$this->db_type = $db_type;
|
$this->db_type = $db_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
function &getInstance($db_type = NULL){
|
function &getInstance($db_type = NULL){
|
||||||
static $theInstance = null;
|
static $theInstance = null;
|
||||||
if(!isset($theInstance)){
|
if(!isset($theInstance)){
|
||||||
$theInstance = new XmlQueryParser($db_type);
|
$theInstance = new XmlQueryParser($db_type);
|
||||||
}
|
}
|
||||||
return $theInstance;
|
return $theInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
function parse($query_id, $xml_file, $cache_file) {
|
function parse($query_id, $xml_file, $cache_file) {
|
||||||
|
|
||||||
// Read xml file
|
// Read xml file
|
||||||
$xml_obj = $this->getXmlFileContent($xml_file);
|
$xml_obj = $this->getXmlFileContent($xml_file);
|
||||||
|
|
||||||
// insert, update, delete, select action
|
// insert, update, delete, select action
|
||||||
$action = strtolower($xml_obj->query->attrs->action);
|
$action = strtolower($xml_obj->query->attrs->action);
|
||||||
if(!$action) return;
|
if(!$action) return;
|
||||||
|
|
||||||
$parser = new QueryParser($xml_obj->query);
|
$parser = new QueryParser($xml_obj->query);
|
||||||
|
|
||||||
FileHandler::writeFile($cache_file, $parser->toString());
|
FileHandler::writeFile($cache_file, $parser->toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// singleton
|
// singleton
|
||||||
function &getDBParser(){
|
function &getDBParser(){
|
||||||
if(!$self->dbParser){
|
if(!$self->dbParser){
|
||||||
is_a($this,'XmlQueryParser')?$self=&$this:$self=&XmlQueryParser::getInstance();
|
is_a($this,'XmlQueryParser')?$self=&$this:$self=&XmlQueryParser::getInstance();
|
||||||
if(isset($self->db_type))
|
if(isset($self->db_type))
|
||||||
$oDB = &DB::getInstance($self->db_type);
|
$oDB = &DB::getInstance($self->db_type);
|
||||||
else
|
else
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
$self->dbParser = $oDB->getParser();
|
$self->dbParser = $oDB->getParser();
|
||||||
}
|
}
|
||||||
return $self->dbParser;
|
return $self->dbParser;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setDBParser($value){
|
function setDBParser($value){
|
||||||
$self->dbParser = $value;
|
$self->dbParser = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getXmlFileContent($xml_file){
|
function getXmlFileContent($xml_file){
|
||||||
$buff = FileHandler::readFile($xml_file);
|
$buff = FileHandler::readFile($xml_file);
|
||||||
$xml_obj = parent::parse($buff);
|
$xml_obj = parent::parse($buff);
|
||||||
if(!$xml_obj) return;
|
if(!$xml_obj) return;
|
||||||
unset($buff);
|
unset($buff);
|
||||||
return $xml_obj;
|
return $xml_obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -1,74 +1,65 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/column/ColumnTag.class.php');
|
class QueryParser {
|
||||||
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 {
|
var $queryTag;
|
||||||
var $queryTag;
|
|
||||||
|
function QueryParser($query, $isSubQuery = false) {
|
||||||
function QueryParser($query, $isSubQuery = false){
|
$this->queryTag = new QueryTag($query, $isSubQuery);
|
||||||
$this->queryTag = new QueryTag($query, $isSubQuery);
|
}
|
||||||
}
|
|
||||||
|
function getTableInfo($query_id, $table_name) {
|
||||||
function getTableInfo($query_id, $table_name){
|
$column_type = array();
|
||||||
$column_type = array();
|
|
||||||
|
$id_args = explode('.', $query_id);
|
||||||
$id_args = explode('.', $query_id);
|
if (count($id_args) == 2) {
|
||||||
if(count($id_args)==2) {
|
$target = 'modules';
|
||||||
$target = 'modules';
|
$module = $id_args[0];
|
||||||
$module = $id_args[0];
|
$id = $id_args[1];
|
||||||
$id = $id_args[1];
|
} elseif (count($id_args) == 3) {
|
||||||
} elseif(count($id_args)==3) {
|
$target = $id_args[0];
|
||||||
$target = $id_args[0];
|
if (!in_array($target, array('modules', 'addons', 'widgets')))
|
||||||
if(!in_array($target, array('modules','addons','widgets'))) return;
|
return;
|
||||||
$module = $id_args[1];
|
$module = $id_args[1];
|
||||||
$id = $id_args[2];
|
$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;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(file_exists($table_file)) {
|
// get column properties from the table
|
||||||
$table_xml = FileHandler::readFile($table_file);
|
$table_file = sprintf('%s%s/%s/schemas/%s.xml', _XE_PATH_, 'modules', $module, $table_name);
|
||||||
$xml_parser = new XmlParser();
|
if (!file_exists($table_file)) {
|
||||||
$table_obj = $xml_parser->parse($table_xml);
|
$searched_list = FileHandler::readDir(_XE_PATH_ . 'modules');
|
||||||
if($table_obj->table) {
|
$searched_count = count($searched_list);
|
||||||
if(isset($table_obj->table->column) && !is_array($table_obj->table->column))
|
for ($i = 0; $i < $searched_count; $i++) {
|
||||||
{
|
$table_file = sprintf('%s%s/%s/schemas/%s.xml', _XE_PATH_, 'modules', $searched_list[$i], $table_name);
|
||||||
$table_obj->table->column = array($table_obj->table->column);
|
if (file_exists($table_file))
|
||||||
}
|
break;
|
||||||
|
|
||||||
foreach($table_obj->table->column as $k => $v) {
|
|
||||||
$column_type[$v->attrs->name] = $v->attrs->type;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (file_exists($table_file)) {
|
||||||
return $column_type;
|
$table_xml = FileHandler::readFile($table_file);
|
||||||
}
|
$xml_parser = new XmlParser();
|
||||||
|
$table_obj = $xml_parser->parse($table_xml);
|
||||||
function toString(){
|
if ($table_obj->table) {
|
||||||
return "<?php if(!defined('__ZBXE__')) exit();\n"
|
if (isset($table_obj->table->column) && !is_array($table_obj->table->column)) {
|
||||||
.$this->queryTag->toString()
|
$table_obj->table->column = array($table_obj->table->column);
|
||||||
. 'return $query; ?>';
|
}
|
||||||
}
|
|
||||||
}
|
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;
|
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);
|
$this->argument_validator = new QueryArgumentValidator($tag, $this);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/DefaultValue.class.php');
|
|
||||||
|
|
||||||
class QueryArgumentValidator {
|
class QueryArgumentValidator {
|
||||||
var $argument_name;
|
var $argument_name;
|
||||||
var $default_value;
|
var $default_value;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
class Validator {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class InsertColumnTag
|
* @class InsertColumnTag
|
||||||
* @author Arnia Software
|
* @author Arnia Software
|
||||||
|
|
@ -9,24 +9,23 @@
|
||||||
|
|
||||||
class InsertColumnTag extends ColumnTag {
|
class InsertColumnTag extends ColumnTag {
|
||||||
var $argument;
|
var $argument;
|
||||||
|
|
||||||
function InsertColumnTag($column) {
|
function InsertColumnTag($column) {
|
||||||
parent::ColumnTag($column->attrs->name);
|
parent::ColumnTag($column->attrs->name);
|
||||||
$dbParser = XmlQueryParser::getDBParser();
|
$dbParser = XmlQueryParser::getDBParser();
|
||||||
$this->name = $dbParser->parseColumnName($this->name);
|
$this->name = $dbParser->parseColumnName($this->name);
|
||||||
require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/QueryArgument.class.php');
|
|
||||||
$this->argument = new QueryArgument($column);
|
$this->argument = new QueryArgument($column);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getExpressionString(){
|
function getExpressionString(){
|
||||||
return sprintf('new InsertExpression(\'%s\', $%s_argument)'
|
return sprintf('new InsertExpression(\'%s\', $%s_argument)'
|
||||||
, $this->name
|
, $this->name
|
||||||
, $this->argument->argument_name);
|
, $this->argument->argument_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getArgument(){
|
function getArgument(){
|
||||||
return $this->argument;
|
return $this->argument;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class InsertColumnsTag
|
* @class InsertColumnsTag
|
||||||
* @author Arnia Software
|
* @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{
|
class InsertColumnsTag{
|
||||||
var $columns;
|
var $columns;
|
||||||
|
|
||||||
function InsertColumnsTag($xml_columns) {
|
function InsertColumnsTag($xml_columns) {
|
||||||
$this->columns = array();
|
$this->columns = array();
|
||||||
|
|
||||||
if(!$xml_columns)
|
if(!$xml_columns)
|
||||||
return;
|
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){
|
foreach($xml_columns as $column){
|
||||||
if($column->name === 'query') $this->columns[] = new QueryTag($column, true);
|
if($column->name === 'query') $this->columns[] = new QueryTag($column, true);
|
||||||
else $this->columns[] = new InsertColumnTag($column);
|
else $this->columns[] = new InsertColumnTag($column);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toString(){
|
function toString(){
|
||||||
$output_columns = 'array(' . PHP_EOL;
|
$output_columns = 'array(' . PHP_EOL;
|
||||||
foreach($this->columns as $column){
|
foreach($this->columns as $column){
|
||||||
$output_columns .= $column->getExpressionString() . PHP_EOL . ',';
|
$output_columns .= $column->getExpressionString() . PHP_EOL . ',';
|
||||||
}
|
}
|
||||||
$output_columns = substr($output_columns, 0, -1);
|
$output_columns = substr($output_columns, 0, -1);
|
||||||
$output_columns .= ')';
|
$output_columns .= ')';
|
||||||
return $output_columns;
|
return $output_columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getArguments(){
|
function getArguments(){
|
||||||
|
|
@ -42,8 +39,8 @@
|
||||||
$arguments[] = $column->getArgument();
|
$arguments[] = $column->getArgument();
|
||||||
}
|
}
|
||||||
return $arguments;
|
return $arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
@ -1,40 +1,37 @@
|
||||||
<?php
|
<?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 {
|
class SelectColumnsTag {
|
||||||
var $columns;
|
var $columns;
|
||||||
|
|
||||||
function SelectColumnsTag($xml_columns_tag){
|
function SelectColumnsTag($xml_columns_tag){
|
||||||
$xml_columns = $xml_columns_tag->column;
|
$xml_columns = $xml_columns_tag->column;
|
||||||
$xml_queries = $xml_columns_tag->query;
|
$xml_queries = $xml_columns_tag->query;
|
||||||
|
|
||||||
$this->columns = array();
|
$this->columns = array();
|
||||||
|
|
||||||
if(!$xml_columns) {
|
if(!$xml_columns) {
|
||||||
$this->columns[] = new SelectColumnTag("*");
|
$this->columns[] = new SelectColumnTag("*");
|
||||||
return;
|
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){
|
foreach($xml_columns as $column){
|
||||||
$this->columns[] = new SelectColumnTag($column);
|
$this->columns[] = new SelectColumnTag($column);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!$xml_queries) {
|
if(!$xml_queries) {
|
||||||
return;
|
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){
|
foreach($xml_queries as $column){
|
||||||
$this->columns[] = new QueryTag($column, true);
|
$this->columns[] = new QueryTag($column, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toString(){
|
function toString(){
|
||||||
$output_columns = 'array(' . PHP_EOL;
|
$output_columns = 'array(' . PHP_EOL;
|
||||||
foreach($this->columns as $column){
|
foreach($this->columns as $column){
|
||||||
|
|
@ -44,10 +41,10 @@
|
||||||
$output_columns .= $column->getExpressionString() . PHP_EOL . ',';
|
$output_columns .= $column->getExpressionString() . PHP_EOL . ',';
|
||||||
}
|
}
|
||||||
$output_columns = substr($output_columns, 0, -1);
|
$output_columns = substr($output_columns, 0, -1);
|
||||||
$output_columns .= ')';
|
$output_columns .= ')';
|
||||||
return $output_columns;
|
return $output_columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getArguments(){
|
function getArguments(){
|
||||||
$arguments = array();
|
$arguments = array();
|
||||||
foreach($this->columns as $column){
|
foreach($this->columns as $column){
|
||||||
|
|
@ -55,6 +52,6 @@
|
||||||
$arguments = array_merge($arguments, $column->getArguments());
|
$arguments = array_merge($arguments, $column->getArguments());
|
||||||
}
|
}
|
||||||
return $arguments;
|
return $arguments;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class UpdateColumnTag
|
* @class UpdateColumnTag
|
||||||
|
|
@ -11,24 +11,23 @@
|
||||||
|
|
||||||
class UpdateColumnTag extends ColumnTag {
|
class UpdateColumnTag extends ColumnTag {
|
||||||
var $argument;
|
var $argument;
|
||||||
|
|
||||||
function UpdateColumnTag($column) {
|
function UpdateColumnTag($column) {
|
||||||
parent::ColumnTag($column->attrs->name);
|
parent::ColumnTag($column->attrs->name);
|
||||||
$dbParser = XmlQueryParser::getDBParser();
|
$dbParser = XmlQueryParser::getDBParser();
|
||||||
$this->name = $dbParser->parseColumnName($this->name);
|
$this->name = $dbParser->parseColumnName($this->name);
|
||||||
require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/QueryArgument.class.php');
|
|
||||||
$this->argument = new QueryArgument($column);
|
$this->argument = new QueryArgument($column);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getExpressionString(){
|
function getExpressionString(){
|
||||||
return sprintf('new UpdateExpression(\'%s\', $%s_argument)'
|
return sprintf('new UpdateExpression(\'%s\', $%s_argument)'
|
||||||
, $this->name
|
, $this->name
|
||||||
, $this->argument->argument_name);
|
, $this->argument->argument_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getArgument(){
|
function getArgument(){
|
||||||
return $this->argument;
|
return $this->argument;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class UpdateColumnsTag
|
* @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{
|
class UpdateColumnsTag{
|
||||||
var $columns;
|
var $columns;
|
||||||
|
|
||||||
function UpdateColumnsTag($xml_columns) {
|
function UpdateColumnsTag($xml_columns) {
|
||||||
$this->columns = array();
|
$this->columns = array();
|
||||||
|
|
||||||
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){
|
foreach($xml_columns as $column){
|
||||||
if($column->name === 'query') $this->columns[] = new QueryTag($column, true);
|
if($column->name === 'query') $this->columns[] = new QueryTag($column, true);
|
||||||
else $this->columns[] = new UpdateColumnTag($column);
|
else $this->columns[] = new UpdateColumnTag($column);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toString(){
|
function toString(){
|
||||||
$output_columns = 'array(' . PHP_EOL;
|
$output_columns = 'array(' . PHP_EOL;
|
||||||
foreach($this->columns as $column){
|
foreach($this->columns as $column){
|
||||||
$output_columns .= $column->getExpressionString() . PHP_EOL . ',';
|
$output_columns .= $column->getExpressionString() . PHP_EOL . ',';
|
||||||
}
|
}
|
||||||
$output_columns = substr($output_columns, 0, -1);
|
$output_columns = substr($output_columns, 0, -1);
|
||||||
$output_columns .= ')';
|
$output_columns .= ')';
|
||||||
return $output_columns;
|
return $output_columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getArguments(){
|
function getArguments(){
|
||||||
$arguments = array();
|
$arguments = array();
|
||||||
foreach($this->columns as $column){
|
foreach($this->columns as $column){
|
||||||
|
|
@ -41,7 +38,7 @@
|
||||||
}
|
}
|
||||||
return $arguments;
|
return $arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
@ -1,25 +1,24 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class ConditionGroupTag {
|
class ConditionGroupTag {
|
||||||
var $conditions;
|
var $conditions;
|
||||||
var $pipe;
|
var $pipe;
|
||||||
|
|
||||||
function ConditionGroupTag($conditions, $pipe = ""){
|
function ConditionGroupTag($conditions, $pipe = ""){
|
||||||
$this->pipe = $pipe;
|
$this->pipe = $pipe;
|
||||||
|
|
||||||
if(!is_array($conditions)) $conditions = array($conditions);
|
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){
|
foreach($conditions as $condition){
|
||||||
//if($condition->node_name === 'query') $this->conditions[] = new QueryTag($condition, true);
|
//if($condition->node_name === 'query') $this->conditions[] = new QueryTag($condition, true);
|
||||||
$this->conditions[] = new ConditionTag($condition);
|
$this->conditions[] = new ConditionTag($condition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getConditions(){
|
function getConditions(){
|
||||||
return $this->conditions;
|
return $this->conditions;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getConditionGroupString(){
|
function getConditionGroupString(){
|
||||||
$conditions_string = 'array('.PHP_EOL;
|
$conditions_string = 'array('.PHP_EOL;
|
||||||
foreach($this->conditions as $condition){
|
foreach($this->conditions as $condition){
|
||||||
|
|
@ -27,10 +26,10 @@
|
||||||
}
|
}
|
||||||
$conditions_string = substr($conditions_string, 0, -2);//remove ','
|
$conditions_string = substr($conditions_string, 0, -2);//remove ','
|
||||||
$conditions_string .= ')';
|
$conditions_string .= ')';
|
||||||
|
|
||||||
return sprintf("new ConditionGroup(%s%s)", $conditions_string, $this->pipe ? ',\''.$this->pipe . '\'': '');
|
return sprintf("new ConditionGroup(%s%s)", $conditions_string, $this->pipe ? ',\''.$this->pipe . '\'': '');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getArguments(){
|
function getArguments(){
|
||||||
$arguments = array();
|
$arguments = array();
|
||||||
foreach($this->conditions as $condition){
|
foreach($this->conditions as $condition){
|
||||||
|
|
@ -38,6 +37,6 @@
|
||||||
}
|
}
|
||||||
return $arguments;
|
return $arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
@ -31,8 +31,6 @@
|
||||||
$this->default_column = $this->query->toString();
|
$this->default_column = $this->query->toString();
|
||||||
}
|
}
|
||||||
else if(($condition->attrs->var && !$isColumnName) || $isColumnName === false){
|
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 = new QueryArgument($condition);
|
||||||
$this->argument_name = $this->argument->getArgumentName();
|
$this->argument_name = $this->argument->getArgumentName();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,42 +1,40 @@
|
||||||
<?php
|
<?php
|
||||||
class ConditionsTag {
|
class ConditionsTag {
|
||||||
var $condition_groups;
|
var $condition_groups;
|
||||||
|
|
||||||
function ConditionsTag($xml_conditions){
|
function ConditionsTag($xml_conditions){
|
||||||
$this->condition_groups = array();
|
$this->condition_groups = array();
|
||||||
|
|
||||||
$xml_condition_list = array();
|
$xml_condition_list = array();
|
||||||
if($xml_conditions->condition)
|
if($xml_conditions->condition)
|
||||||
$xml_condition_list = $xml_conditions->condition;
|
$xml_condition_list = $xml_conditions->condition;
|
||||||
|
|
||||||
if($xml_conditions->query){
|
if($xml_conditions->query){
|
||||||
if(!is_array($xml_condition_list)) $xml_condition_list = array($xml_condition_list);
|
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);
|
if(!is_array($xml_conditions->query)) $xml_conditions->query = array($xml_conditions->query);
|
||||||
$xml_condition_list = array_merge($xml_condition_list, $xml_conditions->query);
|
$xml_condition_list = array_merge($xml_condition_list, $xml_conditions->query);
|
||||||
}
|
}
|
||||||
if($xml_condition_list){
|
if($xml_condition_list){
|
||||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/condition/ConditionGroupTag.class.php');
|
|
||||||
$this->condition_groups[] = new ConditionGroupTag($xml_condition_list);
|
$this->condition_groups[] = new ConditionGroupTag($xml_condition_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
$xml_groups = $xml_conditions->group;
|
$xml_groups = $xml_conditions->group;
|
||||||
if($xml_groups){
|
if($xml_groups){
|
||||||
if(!is_array($xml_groups)) $xml_groups = array($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){
|
foreach($xml_groups as $group){
|
||||||
$this->condition_groups[] = new ConditionGroupTag($group->condition, $group->attrs->pipe);
|
$this->condition_groups[] = new ConditionGroupTag($group->condition, $group->attrs->pipe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function toString(){
|
function toString(){
|
||||||
$output_conditions = 'array(' . PHP_EOL;
|
$output_conditions = 'array(' . PHP_EOL;
|
||||||
foreach($this->condition_groups as $condition){
|
foreach($this->condition_groups as $condition){
|
||||||
$output_conditions .= $condition->getConditionGroupString() . PHP_EOL . ',';
|
$output_conditions .= $condition->getConditionGroupString() . PHP_EOL . ',';
|
||||||
}
|
}
|
||||||
$output_conditions = substr($output_conditions, 0, -1);
|
$output_conditions = substr($output_conditions, 0, -1);
|
||||||
$output_conditions .= ')';
|
$output_conditions .= ')';
|
||||||
return $output_conditions;
|
return $output_conditions;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getArguments(){
|
function getArguments(){
|
||||||
|
|
@ -45,6 +43,6 @@
|
||||||
$arguments = array_merge($arguments, $condition->getArguments());
|
$arguments = array_merge($arguments, $condition->getArguments());
|
||||||
}
|
}
|
||||||
return $arguments;
|
return $arguments;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
@ -14,8 +14,6 @@
|
||||||
//$dbParser = XmlQueryParser::getDBParser();
|
//$dbParser = XmlQueryParser::getDBParser();
|
||||||
//$index->attrs->default = $dbParser->parseExpression($index->attrs->default);
|
//$index->attrs->default = $dbParser->parseExpression($index->attrs->default);
|
||||||
$this->default = $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);
|
$this->argument = new QueryArgument($index);
|
||||||
|
|
||||||
// Sort order - asc / desc
|
// Sort order - asc / desc
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,6 @@
|
||||||
var $list_count;
|
var $list_count;
|
||||||
|
|
||||||
function LimitTag($index){
|
function LimitTag($index){
|
||||||
require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/QueryArgument.class.php');
|
|
||||||
|
|
||||||
if($index->page->attrs && $index->page_count->attrs){
|
if($index->page->attrs && $index->page_count->attrs){
|
||||||
$this->page = new QueryArgument($index->page);
|
$this->page = new QueryArgument($index->page);
|
||||||
$this->page_count = new QueryArgument($index->page_count);
|
$this->page_count = new QueryArgument($index->page_count);
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,11 @@
|
||||||
<?php
|
<?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 {
|
class NavigationTag {
|
||||||
var $order;
|
var $order;
|
||||||
var $list_count;
|
var $list_count;
|
||||||
var $page_count;
|
var $page_count;
|
||||||
var $page;
|
var $page;
|
||||||
var $limit;
|
var $limit;
|
||||||
|
|
||||||
function NavigationTag($xml_navigation){
|
function NavigationTag($xml_navigation){
|
||||||
$this->order = array();
|
$this->order = array();
|
||||||
if($xml_navigation) {
|
if($xml_navigation) {
|
||||||
|
|
@ -19,10 +16,10 @@
|
||||||
$this->order[] = new IndexTag($order_info);
|
$this->order[] = new IndexTag($order_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($xml_navigation->page->attrs || $xml_navigation->list_count->attrs)
|
if($xml_navigation->page->attrs || $xml_navigation->list_count->attrs)
|
||||||
$this->limit = new LimitTag($xml_navigation);
|
$this->limit = new LimitTag($xml_navigation);
|
||||||
|
|
||||||
$list_count = $xml_navigation->list_count->attrs;
|
$list_count = $xml_navigation->list_count->attrs;
|
||||||
$this->list_count = $list_count;
|
$this->list_count = $list_count;
|
||||||
|
|
||||||
|
|
@ -31,19 +28,19 @@
|
||||||
|
|
||||||
$page = $xml_navigation->page->attrs;
|
$page = $xml_navigation->page->attrs;
|
||||||
$this->page = $page ;
|
$this->page = $page ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOrderByString(){
|
function getOrderByString(){
|
||||||
$output = 'array(' . PHP_EOL;
|
$output = 'array(' . PHP_EOL;
|
||||||
foreach($this->order as $order){
|
foreach($this->order as $order){
|
||||||
$output .= $order->toString() . PHP_EOL . ',';
|
$output .= $order->toString() . PHP_EOL . ',';
|
||||||
}
|
}
|
||||||
$output = substr($output, 0, -1);
|
$output = substr($output, 0, -1);
|
||||||
$output .= ')';
|
$output .= ')';
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLimitString(){
|
function getLimitString(){
|
||||||
if ($this->limit) return $this->limit->toString();
|
if ($this->limit) return $this->limit->toString();
|
||||||
else return "";
|
else return "";
|
||||||
|
|
@ -56,7 +53,7 @@
|
||||||
}
|
}
|
||||||
if($this->limit) $arguments = array_merge($this->limit->getArguments(), $arguments);
|
if($this->limit) $arguments = array_merge($this->limit->getArguments(), $arguments);
|
||||||
return $arguments;
|
return $arguments;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class TablesTag
|
* @class TablesTag
|
||||||
|
|
@ -16,17 +16,15 @@
|
||||||
* Can have children of type <table> or <query>
|
* Can have children of type <table> or <query>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/table/TableTag.class.php');
|
|
||||||
|
|
||||||
class TablesTag {
|
class TablesTag {
|
||||||
var $tables;
|
var $tables;
|
||||||
|
|
||||||
function TablesTag($xml_tables_tag){
|
function TablesTag($xml_tables_tag){
|
||||||
$this->tables = array();
|
$this->tables = array();
|
||||||
|
|
||||||
$xml_tables = $xml_tables_tag->table;
|
$xml_tables = $xml_tables_tag->table;
|
||||||
if(!is_array($xml_tables)) $xml_tables = array($xml_tables);
|
if(!is_array($xml_tables)) $xml_tables = array($xml_tables);
|
||||||
|
|
||||||
foreach($xml_tables as $tag){
|
foreach($xml_tables as $tag){
|
||||||
if($tag->attrs->query == 'true'){
|
if($tag->attrs->query == 'true'){
|
||||||
$this->tables[] = new QueryTag($tag, true);
|
$this->tables[] = new QueryTag($tag, true);
|
||||||
|
|
@ -34,26 +32,26 @@
|
||||||
else {
|
else {
|
||||||
$this->tables[] = new TableTag($tag);
|
$this->tables[] = new TableTag($tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTables(){
|
function getTables(){
|
||||||
return $this->tables;
|
return $this->tables;
|
||||||
}
|
}
|
||||||
|
|
||||||
function toString(){
|
function toString(){
|
||||||
$output_tables = 'array(' . PHP_EOL;
|
$output_tables = 'array(' . PHP_EOL;
|
||||||
foreach($this->tables as $table){
|
foreach($this->tables as $table){
|
||||||
if(is_a($table, 'QueryTag'))
|
if(is_a($table, 'QueryTag'))
|
||||||
$output_tables .= $table->toString() . PHP_EOL . ',';
|
$output_tables .= $table->toString() . PHP_EOL . ',';
|
||||||
else
|
else
|
||||||
$output_tables .= $table->getTableString() . PHP_EOL . ',';
|
$output_tables .= $table->getTableString() . PHP_EOL . ',';
|
||||||
}
|
}
|
||||||
$output_tables = substr($output_tables, 0, -1);
|
$output_tables = substr($output_tables, 0, -1);
|
||||||
$output_tables .= ')';
|
$output_tables .= ')';
|
||||||
return $output_tables;
|
return $output_tables;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getArguments(){
|
function getArguments(){
|
||||||
$arguments = array();
|
$arguments = array();
|
||||||
foreach($this->tables as $table)
|
foreach($this->tables as $table)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue