ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilDAVProperties Class Reference
+ Collaboration diagram for ilDAVProperties:

Public Member Functions

 put ($objDAV, $namespace, $name, $value)
 Puts a property for the specified DAV object. More...
 
 get ($objDAV, $namespace, $name, $value)
 Gets a property from the specified DAV object. More...
 
 getAll ($objDAV)
 Gets all properties from the specified DAV object. More...
 
 copy ($fromObjDAV, $toObjDAV)
 Moves all properties from one dav object to another. More...
 

Protected Member Functions

 writelog ($message)
 Writes a message to the logfile.,. More...
 

Private Attributes

 $table = 'dav_property'
 

Detailed Description

Definition at line 37 of file class.ilDAVProperties.php.

Member Function Documentation

◆ copy()

ilDAVProperties::copy (   $fromObjDAV,
  $toObjDAV 
)

Moves all properties from one dav object to another.

/ public function move($fromObjDAV, $toObjDAV) { global $ilDB;

$fromObjId = $fromObjDAV->getObjectId(); $fromNodeId = $fromObjDAV->getNodeId(); $toObjId = $toObjDAV->getObjectId(); $toNodeId = $toObjDAV->getNodeId();

$q = 'UPDATE '.$this->table .' SET obj_id = '.$ilDB->quote($toObjId) .', node_id = '.$ilDB->quote($toNodeId) .' WHERE obj_id = '.$ilDB->quote($fromObjId) .' AND node_id ='.$ilDB->quote($toNodeId) ;
$r = $ilDB->query($q); } Copies all properties from one dav object to another.

Definition at line 179 of file class.ilDAVProperties.php.

180 {
181 global $ilDB;
182
183 $fromObjId = $fromObjDAV->getObjectId();
184 $fromNodeId = $fromObjDAV->getNodeId();
185 $toObjId = $toObjDAV->getObjectId();
186 $toNodeId = $toObjDAV->getNodeId();
187
188 $q = 'SELECT ns, name, value FROM '.$this->table
189 .' WHERE obj_id = '.$ilDB->quote($objId,'integer')
190 .' AND node_id ='.$ilDB->quote($nodeId,'integer');
191/* .' FOR UPDATE' */
192 $r = $ilDB->query($q);
193 $result = array();
194 while ($row = $r->fetchRow(DB_FETCHMODE_ASSOC))
195 {
196 $q2 = 'INSERT INTO '.$this->table
197 .' (obj_id, node_id, ns, name, value)'
198 .' VALUES'
199 .'('.$ilDB->quote($row['obj_id'])
200 .', '.$ilDB->quote($row['node_id'])
201 .', '.$ilDB->quote($row['ns'])
202 .', '.$ilDB->quote($row['name'])
203 .', '.$ilDB->quote($row['value'])
204 .')'
205 ;
206 $r2 = $ilDB->manipulate($q2);
207 }
208 }
$result
const DB_FETCHMODE_ASSOC
Definition: class.ilDB.php:10
$r
Definition: example_031.php:79
global $ilDB

References $ilDB, $r, $result, $row, and DB_FETCHMODE_ASSOC.

◆ get()

ilDAVProperties::get (   $objDAV,
  $namespace,
  $name,
  $value 
)

Gets a property from the specified DAV object.

Parameters
ilObjectDAVDAV object for which the property is put
stringNamespace of the property
stringName of the property
Returns
string Value of the property. Returns null if the property is empty.

Definition at line 102 of file class.ilDAVProperties.php.

103 {
104 global $ilDB;
105
106 $objId = $objDAV->getObjectId();
107 $nodeId = $objDAV->getNodeId();
108
109 $q = 'SELECT value FROM '.$this->table
110 .' WHERE obj_id = '.$ilDB->quote($objId,'integer')
111 .' AND node_id ='.$ilDB->quote($nodeId,'integer')
112 .' AND ns = '.$ilDB->quote($namespace,'text')
113 .' AND name = '.$ilDB->quote($name,'text')
114 ;
115 $r = $ilDB->query($q);
116 if ($row = $r->fetchRow(DB_FETCHMODE_ASSOC))
117 {
118 $value = $row['value'];
119 } else {
120 $value = null;
121 }
122 return $value;
123 }
if($err=$client->getError()) $namespace

References $ilDB, $namespace, $r, $row, and DB_FETCHMODE_ASSOC.

◆ getAll()

ilDAVProperties::getAll (   $objDAV)

Gets all properties from the specified DAV object.

Parameters
ilObjectDAVDAV object for which the property is put
Returns
array of assicative arrays. Each associative array contains the fields 'namespace','name' and 'value'.

Definition at line 131 of file class.ilDAVProperties.php.

132 {
133 global $ilDB;
134
135 $objId = $objDAV->getObjectId();
136 $nodeId = $objDAV->getNodeId();
137
138 $q = 'SELECT ns, name, value'
139 .' FROM '.$this->table
140 .' WHERE obj_id = '.$ilDB->quote($objId,'integer')
141 .' AND node_id ='.$ilDB->quote($nodeId,'integer')
142 ;
143 $r = $ilDB->query($q);
144 $result = array();
145 while ($row = $r->fetchRow(DB_FETCHMODE_ASSOC))
146 {
147 $result[] = array(
148 'namespace' => $row['ns'],
149 'name' => $row['name'],
150 'value' => $row['value']
151 );
152 }
153 return $result;
154 }

References $ilDB, $r, $result, $row, and DB_FETCHMODE_ASSOC.

◆ put()

ilDAVProperties::put (   $objDAV,
  $namespace,
  $name,
  $value 
)

Puts a property for the specified DAV object.

Parameters
ilObjectDAVDAV object for which the property is put
stringNamespace of the property
stringName of the property
stringValue of the property. Specify null, to remove the property.

Definition at line 50 of file class.ilDAVProperties.php.

51 {
52 //$this->writelog('put ns='.$namespace.' name='.$name.' value='.$value);
53 global $ilDB;
54
55 $objId = $objDAV->getObjectId();
56 $nodeId = $objDAV->getNodeId();
57
58 if(isset($value))
59 {
60 $ilDB->replace($this->table,
61 array(
62 'obj_id' => array('integer',$objId),
63 'node_id' => array('integer',$nodeId),
64 'ns' => array('text',$namespace),
65 'name' => array('text',$name)
66 ),
67 array('value' => array('clob',$value))
68 );
69
70 /*
71 $q = 'REPLACE INTO '.$this->table
72 .' SET obj_id = '.$ilDB->quote($objId)
73 .', node_id = '.$ilDB->quote($nodeId)
74 .', ns = '.$ilDB->quote($namespace)
75 .', name = '.$ilDB->quote($name)
76 .', value = '.$ilDB->quote($value)
77 ;
78 */
79 }
80 else
81 {
82 $q = 'DELETE FROM '.$this->table
83 .' WHERE obj_id = '.$ilDB->quote($objId,'integer')
84 .' AND node_id = '.$ilDB->quote($nodeId,'integer')
85 .' AND ns = '.$ilDB->quote($namespace,'text')
86 .' AND name = '.$ilDB->quote($name,'text')
87 ;
88 $ilDB->manipulate($q);
89 }
90 //$this->writelog('put query='.$q);
91 #$r = $ilDB->query($q);
92 }

References $ilDB, and $namespace.

◆ writelog()

ilDAVProperties::writelog (   $message)
protected

Writes a message to the logfile.,.

Parameters
messageString.
Returns
void.

Definition at line 216 of file class.ilDAVProperties.php.

217 {
218 global $log, $ilias;
219 $log->write(
220 $ilias->account->getLogin()
221 .' DAV ilDAVProperties.'.str_replace("\n",";",$message)
222 );
223 /*
224 if ($this->logFile)
225 {
226 $fh = fopen($this->logFile, 'a');
227 fwrite($fh, date('Y-m-d h:i:s '));
228 fwrite($fh, str_replace("\n",";",$message));
229 fwrite($fh, "\n\n");
230 fclose($fh);
231 }*/
232 }

References $log.

Field Documentation

◆ $table

ilDAVProperties::$table = 'dav_property'
private

Definition at line 39 of file class.ilDAVProperties.php.


The documentation for this class was generated from the following file: