|
| __construct ($table="tree", $fields=array(), $add_fields=array("title"=> "title", "type"=> "type")) |
|
| create_node ($data) |
|
| set_data ($data) |
|
| rename_node ($data) |
|
| move_node ($data) |
|
| remove_node ($data) |
|
| get_children ($data) |
|
| search ($data) |
|
| _create_default () |
|
| __construct ($table="tree", $fields=array()) |
|
| _get_node ($id) |
|
| _get_children ($id, $recursive=false) |
|
| _get_path ($id) |
|
| _create ($parent, $position) |
|
| _remove ($id) |
|
| _move ($id, $ref_id, $position=0, $is_copy=false) |
|
| _fix_copy ($id, $position) |
|
| _reconstruct () |
|
| _analyze () |
|
| _dump ($output=false) |
|
| _drop () |
|
Definition at line 477 of file class.tree.php.
◆ __construct()
json_tree::__construct |
( |
|
$table = "tree" , |
|
|
|
$fields = array() , |
|
|
|
$add_fields = array("title" => "title", "type" => "type") |
|
) |
| |
◆ _create_default()
json_tree::_create_default |
( |
| ) |
|
◆ create_node()
json_tree::create_node |
( |
|
$data | ) |
|
Definition at line 484 of file class.tree.php.
References $data, $id, and fields.
485 $id = parent::_create((
int)
$data[$this->
fields[
"id"]], (
int)
$data[$this->fields[
"position"]]);
489 return "{ \"status\" : 1, \"id\" : ".(int)
$id.
" }";
491 return "{ \"status\" : 0 }";
if(!array_key_exists('StateId', $_REQUEST)) $id
◆ get_children()
json_tree::get_children |
( |
|
$data | ) |
|
Definition at line 531 of file class.tree.php.
References $data, $result, _tree_struct\_get_children(), array, and fields.
533 if((
int)
$data[
"id"] === 1 && count($tmp) === 0) {
539 foreach($tmp as $k => $v) {
541 "attr" =>
array(
"id" =>
"node_".$k,
"rel" => $v[$this->
fields[
"type"]]),
542 "data" => $v[$this->fields[
"title"]],
543 "state" => ((
int)$v[$this->fields[
"right"]] - (
int)$v[$this->fields[
"left"]] > 1) ?
"closed" :
""
_get_children($id, $recursive=false)
Create styles array
The data for the language used.
◆ move_node()
json_tree::move_node |
( |
|
$data | ) |
|
Definition at line 506 of file class.tree.php.
References $data, $i, $id, $s, _tree_struct\_get_children(), and fields.
507 $id = parent::_move((
int)
$data[
"id"], (
int)$data[
"ref"], (
int)$data[
"position"], (
int)$data[
"copy"]);
508 if(!
$id)
return "{ \"status\" : 0 }";
509 if((
int)$data[
"copy"] && count($this->add_fields)) {
514 foreach($data as $dk => $dv) {
515 $s =
"UPDATE `".$this->table.
"` SET `".$this->
fields[
"id"].
"` = `".$this->
fields[
"id"].
"` ";
516 foreach($this->add_fields as $k => $v) {
517 if(isset($dv[$k]))
$s .=
", `".$this->fields[$v].
"` = \"".$this->db->escape($dv[$k]).
"\" ";
518 else $s .=
", `".$this->fields[$v].
"` = `".$this->
fields[$v].
"` ";
520 $s .=
"WHERE `".$this->fields[
"id"].
"` = ".$ids[
$i];
521 $this->db->query(
$s);
525 return "{ \"status\" : 1, \"id\" : ".$id.
" }";
_get_children($id, $recursive=false)
if(!array_key_exists('StateId', $_REQUEST)) $id
◆ remove_node()
json_tree::remove_node |
( |
|
$data | ) |
|
Definition at line 527 of file class.tree.php.
References $data, and $id.
528 $id = parent::_remove((
int)
$data[
"id"]);
529 return "{ \"status\" : 1 }";
if(!array_key_exists('StateId', $_REQUEST)) $id
◆ rename_node()
json_tree::rename_node |
( |
|
$data | ) |
|
◆ search()
json_tree::search |
( |
|
$data | ) |
|
Definition at line 548 of file class.tree.php.
References $data, $result, array, and fields.
549 $this->db->query(
"SELECT `".$this->
fields[
"left"].
"`, `".$this->
fields[
"right"].
"` FROM `".$this->table.
"` WHERE `".$this->fields[
"title"].
"` LIKE '%".$this->db->escape(
$data[
"search_str"]).
"%'");
550 if($this->db->nf() === 0)
return "[]";
551 $q =
"SELECT DISTINCT `".$this->fields[
"id"].
"` FROM `".$this->table.
"` WHERE 0 ";
552 while($this->db->nextr()) {
553 $q .=
" OR (`".$this->fields[
"left"].
"` < ".(int)$this->db->f(0).
" AND `".$this->
fields[
"right"].
"` > ".(int)$this->db->f(1).
") ";
556 $this->db->query($q);
557 while($this->db->nextr()) {
$result[] =
"#node_".$this->db->f(0); }
Create styles array
The data for the language used.
◆ set_data()
json_tree::set_data |
( |
|
$data | ) |
|
Definition at line 493 of file class.tree.php.
References $data, $s, and fields.
494 if(count($this->add_fields) == 0) {
return "{ \"status\" : 1 }"; }
495 $s =
"UPDATE `".$this->table.
"` SET `".$this->
fields[
"id"].
"` = `".$this->
fields[
"id"].
"` ";
496 foreach($this->add_fields as $k => $v) {
497 if(isset(
$data[$k]))
$s .=
", `".$this->fields[$v].
"` = \"".$this->db->escape(
$data[$k]).
"\" ";
498 else $s .=
", `".$this->fields[$v].
"` = `".$this->
fields[$v].
"` ";
500 $s .=
"WHERE `".$this->fields[
"id"].
"` = ".(int)
$data[
"id"];
501 $this->db->query(
$s);
502 return "{ \"status\" : 1 }";
The documentation for this class was generated from the following file: