ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilDAVProperties Class Reference
+ Collaboration diagram for ilDAVProperties:

Public Member Functions

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

Protected Member Functions

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

Private Attributes

 $table = 'dav_property'

Detailed Description

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

Member Function Documentation

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.

References $result, $row, and DB_FETCHMODE_ASSOC.

{
global $ilDB;
$fromObjId = $fromObjDAV->getObjectId();
$fromNodeId = $fromObjDAV->getNodeId();
$toObjId = $toObjDAV->getObjectId();
$toNodeId = $toObjDAV->getNodeId();
$q = 'SELECT ns, name, value FROM '.$this->table
.' WHERE obj_id = '.$ilDB->quote($objId,'integer')
.' AND node_id ='.$ilDB->quote($nodeId,'integer');
/* .' FOR UPDATE' */
$r = $ilDB->query($q);
$result = array();
while ($row = $r->fetchRow(DB_FETCHMODE_ASSOC))
{
$q2 = 'INSERT INTO '.$this->table
.' (obj_id, node_id, ns, name, value)'
.' VALUES'
.'('.$ilDB->quote($row['obj_id'])
.', '.$ilDB->quote($row['node_id'])
.', '.$ilDB->quote($row['ns'])
.', '.$ilDB->quote($row['name'])
.', '.$ilDB->quote($row['value'])
.')'
;
$r2 = $ilDB->manipulate($q2);
}
}
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.

References $namespace, $row, and DB_FETCHMODE_ASSOC.

{
global $ilDB;
$objId = $objDAV->getObjectId();
$nodeId = $objDAV->getNodeId();
$q = 'SELECT value FROM '.$this->table
.' WHERE obj_id = '.$ilDB->quote($objId,'integer')
.' AND node_id ='.$ilDB->quote($nodeId,'integer')
.' AND ns = '.$ilDB->quote($namespace,'text')
.' AND name = '.$ilDB->quote($name,'text')
;
$r = $ilDB->query($q);
if ($row = $r->fetchRow(DB_FETCHMODE_ASSOC))
{
$value = $row['value'];
} else {
$value = null;
}
return $value;
}
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.

References $result, $row, and DB_FETCHMODE_ASSOC.

{
global $ilDB;
$objId = $objDAV->getObjectId();
$nodeId = $objDAV->getNodeId();
$q = 'SELECT ns, name, value'
.' FROM '.$this->table
.' WHERE obj_id = '.$ilDB->quote($objId,'integer')
.' AND node_id ='.$ilDB->quote($nodeId,'integer')
;
$r = $ilDB->query($q);
$result = array();
while ($row = $r->fetchRow(DB_FETCHMODE_ASSOC))
{
$result[] = array(
'namespace' => $row['ns'],
'name' => $row['name'],
'value' => $row['value']
);
}
return $result;
}
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 $namespace.

{
//$this->writelog('put ns='.$namespace.' name='.$name.' value='.$value);
global $ilDB;
$objId = $objDAV->getObjectId();
$nodeId = $objDAV->getNodeId();
if(isset($value))
{
$ilDB->replace($this->table,
array(
'obj_id' => array('integer',$objId),
'node_id' => array('integer',$nodeId),
'ns' => array('text',$namespace),
'name' => array('text',$name)
),
array('value' => array('clob',$value))
);
/*
$q = 'REPLACE INTO '.$this->table
.' SET obj_id = '.$ilDB->quote($objId)
.', node_id = '.$ilDB->quote($nodeId)
.', ns = '.$ilDB->quote($namespace)
.', name = '.$ilDB->quote($name)
.', value = '.$ilDB->quote($value)
;
*/
}
else
{
$q = 'DELETE FROM '.$this->table
.' WHERE obj_id = '.$ilDB->quote($objId,'integer')
.' AND node_id = '.$ilDB->quote($nodeId,'integer')
.' AND ns = '.$ilDB->quote($namespace,'text')
.' AND name = '.$ilDB->quote($name,'text')
;
$ilDB->manipulate($q);
}
//$this->writelog('put query='.$q);
#$r = $ilDB->query($q);
}
ilDAVProperties::writelog (   $message)
protected

Writes a message to the logfile.,.

Parameters
messageString.
Returns
void.

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

References $log.

{
global $log, $ilias;
$log->write(
$ilias->account->getLogin()
.' DAV ilDAVProperties.'.str_replace("\n",";",$message)
);
/*
if ($this->logFile)
{
$fh = fopen($this->logFile, 'a');
fwrite($fh, date('Y-m-d h:i:s '));
fwrite($fh, str_replace("\n",";",$message));
fwrite($fh, "\n\n");
fclose($fh);
}*/
}

Field Documentation

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: