<?php
/*
@author dhtmlx.com
@license GPL, see license.txt
*/
require_once("tools.php");
/*! manager of data request
**/
class DataRequestConfig{
private $action_mode = "";
private $filters; //!< array of filtering rules
private $relation=false; //!< ID or other element used for linking hierarchy
private $sort_by; //!< sorting field
private $start; //!< start of requested data
private $count; //!< length of requested data
private $order = false;
private $user;
private $version;
//for render_sql
private $source; //!< souce table or another source destination
private $fieldset; //!< set of data, which need to be retrieved from source
/*! constructor
@param proto
DataRequestConfig object, optional, if provided then new request object will copy all properties from provided one
*/
public function __construct($proto=false){
if ($proto)
$this->copy($proto);
else{
$start=0;
$this->filters=array();
$this->sort_by=array();
}
}
/*! copy parameters of source object into self
@param proto
source object
*/
public function copy($proto){
$this->filters =$proto->get_filters();
$this->sort_by =$proto->get_sort_by();
$this->count =$proto->get_count();
$this->start =$proto->get_start();
$this->source =$proto->get_source();
$this->fieldset =$proto->get_fieldset();
$this->relation =$proto->get_relation();
$this->user = $proto->user;
$this->version = $proto->version;
$this->action_mode = $proto->action_mode;
}
/*! convert self to string ( for logs )
@return
self as plain string,
*/
public function __toString(){
$str="Source:{$this->source}\nFieldset:{$this->fieldset}\nWhere:";
for ($i=0; $i < sizeof($this->filters); $i++)
$str.=$this->filters[$i]["name"]." ".$this->filters[$i]["operation"]." ".$this->filters[$i]["value"].";";
$str.="\nStart:{$this->start}\nCount:{$this->count}\n";
for ($i=0; $i < sizeof($this->sort_by); $i++)
$str.=$this->sort_by[$i]["name"]."=".$this->sort_by[$i]["direction"].";";
$str.="\nRelation:{$this->relation}";
return $str;
}
public function set_action_mode($action_mode) {
$this->action_mode = $action_mode;
return $this;
}
public function get_action_mode() {
return $this->action_mode;
}
/*! returns set of filtering rules
@return
set of filtering rules
*/
public function get_filters(){
return $this->filters;
}
public function &get_filters_ref(){
return $this->filters;
}
public function set_filters($data){
$this->filters=$data;
}
public function get_order(){
return $this->order;
}
public function set_order($order){
$this->order = $order;
}
public function get_user(){
return $this->user;
}
public function set_user($user){
$this->user = $user;
}
public function get_version(){
return $this->version;
}
public function set_version($version){
$this->version = $version;
}
/*! returns list of used fields
@return
list of used fields
*/
public function get_fieldset(){
return $this->fieldset;
}
/*! returns name of source table
@return
name of source table
*/
public function get_source(){
return $this->source;
}
/*! returns set of sorting rules
@return
set of sorting rules
*/
public function get_sort_by(){
return $this->sort_by;
}
public function &get_sort_by_ref(){
return $this->sort_by;
}
public function set_sort_by($data){
$this->sort_by=$data;
}
/*! returns start index
@return
start index
*/
public function get_start(){
return $this->start;
}
/*! returns count of requested records
@return
count of requested records
*/
public function get_count(){
return $this->count;
}
/*! returns name of relation id
@return
relation id name
*/
public function get_relation(){
return $this->relation;
}
/*! sets sorting rule
@param field
name of column
@param order
direction of sorting
*/
public function set_sort($field,$order=false){
if (!$field && !$order)
$this->sort_by=array();
else{
if ($order===false)
$this->sort_by[] = $field;
else {
$order=strtolower($order)=="asc"?"ASC":"DESC";
$this->sort_by[]=array("name"=>$field,"direction" => $order);
}
}
}
/*! sets filtering rule
@param field
name of column
@param value
value for filtering
@param operation
operation for filtering, optional , LIKE by default
*/
public function set_filter($field,$value=false,$operation=false){
if ($value === false)
array_push($this->filters,$field);
else
array_push($this->filters,array("name"=>$field,"value"=>$value,"operation"=>$operation));
}
/*! sets list of used fields
@param value
list of used fields
*/
public function set_fieldset($value){
$this->fieldset=$value;
}
/*! sets name of source table
@param value
name of source table
*/
public function set_source($value){
if (is_string($value))
$value = trim($value);
$this->source = $value;
}
/*! sets data limits
@param start
start index
@param count
requested count of data
*/
public function set_limit($start,$count){
$this->start=$start;
$this->count=$count;
}
/*! sets name of relation id
@param value
name of relation id field
*/
public function set_relation($value){
$this->relation=$value;
}
/*! parse incoming sql, to fill other properties
@param sql
incoming sql string
*/
public function parse_sql($sql, $as_is = false){
if ($as_is){
$this->fieldset = $sql;
return;
}
$sql= preg_replace("/[ \n\t]+limit[\n\t ,0-9]*$/i","",$sql);
$data = preg_split("/[ \n\t]+\\_from\\_/i",$sql,2);
if (count($data)!=2)
$data = preg_split("/[ \n\t]+from/i",$sql,2);
$this->fieldset = preg_replace("/^[\s]*select/i","",$data[0],1);
//Ignore next type of calls
//direct call to stored procedure without FROM
if ((count($data) == 1) ||
//UNION select
preg_match("#[ \n\r\t]union[ \n\t\r]#i", $sql)){
$this->fieldset = $sql;
return;
}
$table_data = preg_split("/[ \n\t]+where/i",$data[1],2);
/*
if sql code contains group_by we will place all sql query in the FROM
it will not allow to use any filtering against the query
still it is better than just generate incorrect sql commands for any group by query
*/
if (sizeof($table_data)>1 && !preg_match("#.*group by.*#i",$table_data[1])){ //where construction exists
$this->set_source($table_data[0]);
$where_data = preg_split("/[ \n\t]+order[ ]+by/i",$table_data[1],2);
$this->filters[]=$where_data[0];
if (sizeof($where_data)==1) return; //end of line detected
$data=$where_data[1];
} else {
$table_data = preg_split("/[ \n\t]+order[ ]+by/i",$data[1],2);
$this->set_source($table_data[0]);
if (sizeof($table_data)==1) return; //end of line detected
$data=$table_data[1];
}
if (trim($data)){ //order by construction exists
$s_data = preg_split("/\\,/",trim($data));
for ($i=0; $i < count($s_data); $i++) {
$data=preg_split("/[ ]+/",trim($s_data[$i]),2);
if (sizeof($data)>1)
$this->set_sort($data[0],$data[1]);
else
$this->set_sort($data[0]);
}
}
}
}
/*! manager of data configuration
**/
class DataConfig{
public $id;////!< name of ID field
public $relation_id;//!< name or relation ID field
public $text;//!< array of text fields
public $data;//!< array of all known fields , fields which exists only in this collection will not be included in dataprocessor's operations
/*! converts self to the string, for lo
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
【原创】jquery甘特图插件 (407个子文件)
amazeui.min.css 359KB
amazeui.flat.css 325KB
amazeui.css 324KB
amazeui.flat.min.css 250KB
amazeui.min.css 249KB
bootstrap.min.css 244KB
bootstrap.css 134KB
style.css 113KB
bootstrap.min.css 111KB
dhtmlxgantt_broadway.css 56KB
dhtmlxgantt_contrast_white.css 49KB
dhtmlxgantt_contrast_black.css 49KB
dhtmlxgantt_terrace.css 48KB
dhtmlxgantt_skyblue.css 47KB
dhtmlxgantt_broadway.css 46KB
dhtmlxgantt_meadow.css 44KB
dhtmlxgantt_contrast_black.css 42KB
dhtmlxgantt.css 42KB
dhtmlxgantt_terrace.css 42KB
dhtmlxgantt_contrast_white.css 42KB
dhtmlxgantt_skyblue.css 39KB
dhtmlxgantt_meadow.css 37KB
jquery-ui-1.10.1.custom.min.css 26KB
bootstrap-theme.css 21KB
font-awesome.css 21KB
bootstrap-theme.min.css 19KB
style-responsive.css 14KB
basic.css 14KB
dropzone.css 11KB
layer.css 11KB
datetimepicker.css 11KB
bootstrap-fullcalendar.css 10KB
gallery.css 10KB
demo_table.css 7KB
bootstrap-reset.css 7KB
clndr.css 6KB
admin.css 5KB
xcharts.css 4KB
daterangepicker-bs3.css 4KB
datepicker.css 4KB
tree-style.css 4KB
daterangepicker.css 4KB
table-responsive.css 3KB
jquery.fancybox.css 3KB
DT_bootstrap.css 3KB
jquery.nestable.css 3KB
layer.ext.css 3KB
tasks.css 2KB
bootstrap-wysihtml5.css 2KB
multi-select.css 2KB
colorpicker.css 2KB
bootstrap-fileupload.css 2KB
timepicker.css 2KB
demo_page.css 1KB
jquery.fileupload-ui.css 1006B
jquery.fileupload-ui.css 723B
invoice-print.css 629B
morris.css 493B
jquery.stepy.css 433B
jquery.fileupload.css 355B
app.css 23B
fontawesome-webfont.eot 75KB
fontawesome-webfont.eot 37KB
glyphicons-halflings-regular.eot 20KB
xubox_loading0.gif 6KB
loading-0.gif 6KB
loading.gif 4KB
loading.gif 4KB
fancybox_loading.gif 4KB
progressbar.gif 3KB
xubox_loading2.gif 2KB
loading-2.gif 2KB
animated-overlay.gif 2KB
loading-1.gif 701B
xubox_loading1.gif 701B
ie-spacer.gif 43B
blank.gif 43B
甘特图.html 7KB
de_t_01.jpg 345B
echarts.min.js 626KB
amazeui.js 459KB
ckeditor.js 405KB
dhtmlxgantt.js 290KB
jquery-1.11.3.js 278KB
jquery-ui-1.10.1.custom.min.js 223KB
amazeui.min.js 206KB
wysihtml5-0.3.0.js 173KB
dhtmlxgantt.js 171KB
d3.v3.min.js 143KB
jquery.flot.js 123KB
jquery.dataTables.js 117KB
jquery.dataTables.js 117KB
amazeui.ie8polyfill.js 111KB
jquery.js 91KB
raphael-min.js 82KB
handlebars.min.js 71KB
bootstrap.js 64KB
dropzone.js 60KB
fullcalendar.min.js 49KB
bootstrap-datetimepicker.js 37KB
共 407 条
- 1
- 2
- 3
- 4
- 5
资源评论
- qq_148317912018-08-09。。。亏了啊,不是我想象中的实际时间,计划时间对比....不过还是点个赞吧...
Demon_LHY
- 粉丝: 10
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功