ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 $DIC; $ilDB = $DIC['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 183 of file class.ilDAVProperties.php.

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

References $DIC, $ilDB, $r, $result, $row, and ilDBConstants\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 103 of file class.ilDAVProperties.php.

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

References $DIC, $ilDB, $namespace, $r, $row, and ilDBConstants\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 133 of file class.ilDAVProperties.php.

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

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

References $DIC, $ilDB, and $namespace.

◆ writelog()

ilDAVProperties::writelog (   $message)
protected

Writes a message to the logfile.,.

Parameters
messageString.
Returns
void.

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

222 {
223 global $DIC;
224 $log = $DIC['log'];
225 $ilias = $DIC['ilias'];
226 $log->write(
227 $ilias->account->getLogin()
228 .' DAV ilDAVProperties.'.str_replace("\n",";",$message)
229 );
230 /*
231 if ($this->logFile)
232 {
233 $fh = fopen($this->logFile, 'a');
234 fwrite($fh, date('Y-m-d h:i:s '));
235 fwrite($fh, str_replace("\n",";",$message));
236 fwrite($fh, "\n\n");
237 fclose($fh);
238 }*/
239 }

References $DIC, and $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: