ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 179 of file class.ilDAVProperties.php.

References $DIC, $ilDB, $r, $result, $row, array, and ilDBConstants\FETCHMODE_ASSOC.

180  {
181  global $DIC;
182  $ilDB = $DIC['ilDB'];
183 
184  $fromObjId = $fromObjDAV->getObjectId();
185  $fromNodeId = $fromObjDAV->getNodeId();
186  $toObjId = $toObjDAV->getObjectId();
187  $toNodeId = $toObjDAV->getNodeId();
188 
189  $q = 'SELECT ns, name, value FROM ' . $this->table
190  . ' WHERE obj_id = ' . $ilDB->quote($objId, 'integer')
191  . ' AND node_id =' . $ilDB->quote($nodeId, 'integer');
192  /* .' FOR UPDATE' */
193  $r = $ilDB->query($q);
194  $result = array();
195  while ($row = $r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) {
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
global $DIC
Definition: saml.php:7
$r
Definition: example_031.php:79
Create styles array
The data for the language used.
global $ilDB

◆ 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 101 of file class.ilDAVProperties.php.

References $DIC, $ilDB, $r, $row, and ilDBConstants\FETCHMODE_ASSOC.

102  {
103  global $DIC;
104  $ilDB = $DIC['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(ilDBConstants::FETCHMODE_ASSOC)) {
117  $value = $row['value'];
118  } else {
119  $value = null;
120  }
121  return $value;
122  }
if($err=$client->getError()) $namespace
global $DIC
Definition: saml.php:7
if($format !==null) $name
Definition: metadata.php:146
$r
Definition: example_031.php:79
global $ilDB

◆ 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 130 of file class.ilDAVProperties.php.

References $DIC, $ilDB, $r, $result, $row, array, and ilDBConstants\FETCHMODE_ASSOC.

131  {
132  global $DIC;
133  $ilDB = $DIC['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(ilDBConstants::FETCHMODE_ASSOC)) {
146  $result[] = array(
147  'namespace' => $row['ns'],
148  'name' => $row['name'],
149  'value' => $row['value']
150  );
151  }
152  return $result;
153  }
$result
global $DIC
Definition: saml.php:7
$r
Definition: example_031.php:79
Create styles array
The data for the language used.
global $ilDB

◆ 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.

References $DIC, $ilDB, $name, $namespace, and array.

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  $ilDB->replace(
61  $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  } else {
81  $q = 'DELETE FROM ' . $this->table
82  . ' WHERE obj_id = ' . $ilDB->quote($objId, 'integer')
83  . ' AND node_id = ' . $ilDB->quote($nodeId, 'integer')
84  . ' AND ns = ' . $ilDB->quote($namespace, 'text')
85  . ' AND name = ' . $ilDB->quote($name, 'text')
86  ;
87  $ilDB->manipulate($q);
88  }
89  //$this->writelog('put query='.$q);
90  #$r = $ilDB->query($q);
91  }
if($err=$client->getError()) $namespace
global $DIC
Definition: saml.php:7
if($format !==null) $name
Definition: metadata.php:146
Create styles array
The data for the language used.
global $ilDB

◆ writelog()

ilDAVProperties::writelog (   $message)
protected

Writes a message to the logfile.,.

Parameters
messageString.
Returns
void.

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

References $DIC, $log, and $message.

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

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: