-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathNode.php
More file actions
48 lines (44 loc) · 1.32 KB
/
Node.php
File metadata and controls
48 lines (44 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
class Node extends Connector
{
// data stored in this object
protected $node;
public function __construct($options){
parent::__construct($options);
$this->connect();
}
public function node_load($nid) {
return (object)$this->requestSend($this->_methods->NODE_GET, array($nid));
}
public function node_create($node) {
if(is_array($node)){
$node = (object)$node;
}
return $this->requestSend($this->_methods->NODE_CREATE, array($node));
}
public function node_save($nid, $node) {
if(is_object($node)){
$node = (array)$node;
}
return $this->requestSend($this->_methods->NODE_SAVE, array($nid, $node));
}
public function node_delete($nid) {
if (!is_array($nid)) {
$nid = (array)$nid;
}
$return = array();
foreach ($nid as $id) {
$return[] = $this->requestSend($this->_methods->NODE_DELETE, array($id));
}
return $return;
}
/*
$page: The zero-based index of the page to get, defaults to 0.
$fields: string, The fields to get.
$parameters: array, Parameters array
$pagesize: Number of records to get per page.
*/
public function node_list($page = 0, $fields = '*', $parameters = array(), $pagesize = 20){
return $this->requestSend($this->_methods->NODE_LIST, array($page, $fields, $parameters, $pagesize));
}
}