ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilUserDefinedData Class Reference

Class ilUserDefinedData. More...

+ Collaboration diagram for ilUserDefinedData:

Public Member Functions

 ilUserDefinedData ($a_usr_id)
 getUserId ()
 set ($a_field, $a_value)
 get ($a_field)
 getAll ()
 Get all fields.
 update ()
 Update data.
 toXML ()
 addToXML ($xml_writer)
 add user defined field data to xml (using usr dtd)
 __read ()

Static Public Member Functions

static deleteEntriesOfUser ($a_user_id)
 Delete data of user.
static deleteEntriesOfField ($a_field_id)
 Delete data of particular field.
static deleteFieldValue ($a_field_id, $a_value)
 Delete data of particular value of a (selection) field.

Data Fields

 $db = null
 $user_data = array()
 $usr_id = null

Detailed Description

Class ilUserDefinedData.

Author
Stefan Meyer smeye.nosp@m.r@da.nosp@m.tabay.nosp@m..de
Version
Id:
class.ilUserDefinedData.php 23243 2010-03-18 08:58:36Z smeyer

Definition at line 12 of file class.ilUserDefinedData.php.

Member Function Documentation

ilUserDefinedData::__read ( )

Definition at line 190 of file class.ilUserDefinedData.php.

References $query, $res, $row, and DB_FETCHMODE_ASSOC.

Referenced by ilUserDefinedData().

{
$this->user_data = array();
$query = "SELECT * FROM udf_text ".
"WHERE usr_id = ".$this->db->quote($this->usr_id,'integer')."";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
{
$this->user_data["f_".$row["field_id"]] = $row["value"];
}
$query = "SELECT * FROM udf_clob ".
"WHERE usr_id = ".$this->db->quote($this->usr_id,'integer')."";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
{
$this->user_data["f_".$row["field_id"]] = $row["value"];
}
}

+ Here is the caller graph for this function:

ilUserDefinedData::addToXML (   $xml_writer)

add user defined field data to xml (using usr dtd)

Parameters
ilXmlWriter$xml_writer

Definition at line 171 of file class.ilUserDefinedData.php.

References ilUserDefinedFields\_getInstance().

Referenced by toXML().

{
include_once './Services/User/classes/class.ilUserDefinedFields.php';
foreach($udf_obj->getDefinitions() as $definition)
{
if ($definition["export"] != FALSE)
{
$xml_writer->xmlElement('UserDefinedField',
array('Id' => $definition['il_id'],
'Name' => $definition['field_name']),
(string) $this->user_data['f_'.(int) $definition['field_id']]);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilUserDefinedData::deleteEntriesOfField (   $a_field_id)
static

Delete data of particular field.

Parameters
intfield id

Definition at line 129 of file class.ilUserDefinedData.php.

References $ilDB.

Referenced by ilUserDefinedFields\delete().

{
global $ilDB;
$ilDB->manipulate("DELETE FROM udf_text WHERE "
." field_id = ".$ilDB->quote($a_field_id, "integer")
);
$ilDB->manipulate("DELETE FROM udf_clob WHERE "
." field_id = ".$ilDB->quote($a_field_id, "integer")
);
}

+ Here is the caller graph for this function:

static ilUserDefinedData::deleteEntriesOfUser (   $a_user_id)
static

Delete data of user.

Parameters
intuser id

Definition at line 112 of file class.ilUserDefinedData.php.

References $ilDB.

Referenced by ilObjUser\deleteUserDefinedFieldEntries().

{
global $ilDB;
$ilDB->manipulate("DELETE FROM udf_text WHERE "
." usr_id = ".$ilDB->quote($a_user_id, "integer")
);
$ilDB->manipulate("DELETE FROM udf_clob WHERE "
." usr_id = ".$ilDB->quote($a_user_id, "integer")
);
}

+ Here is the caller graph for this function:

static ilUserDefinedData::deleteFieldValue (   $a_field_id,
  $a_value 
)
static

Delete data of particular value of a (selection) field.

Parameters
intfield id
stringvalue

Definition at line 147 of file class.ilUserDefinedData.php.

References $ilDB.

Referenced by ilUserDefinedFields\deleteValue().

{
global $ilDB;
$ilDB->manipulate("UPDATE udf_text SET value = ".$ilDB->quote("", "text")." WHERE "
." field_id = ".$ilDB->quote($a_field_id, "integer")
." AND value = ".$ilDB->quote($a_value, "text")
);
}

+ Here is the caller graph for this function:

ilUserDefinedData::get (   $a_field)

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

{
return isset($this->user_data[$a_field]) ? $this->user_data[$a_field] : '';
}
ilUserDefinedData::getAll ( )

Get all fields.

Definition at line 45 of file class.ilUserDefinedData.php.

References $user_data.

{
}
ilUserDefinedData::getUserId ( )

Definition at line 28 of file class.ilUserDefinedData.php.

References $usr_id.

Referenced by update().

{
return $this->usr_id;
}

+ Here is the caller graph for this function:

ilUserDefinedData::ilUserDefinedData (   $a_usr_id)

Definition at line 18 of file class.ilUserDefinedData.php.

References $ilDB, and __read().

{
global $ilDB;
$this->db =& $ilDB;
$this->usr_id = $a_usr_id;
$this->__read();
}

+ Here is the call graph for this function:

ilUserDefinedData::set (   $a_field,
  $a_value 
)

Definition at line 33 of file class.ilUserDefinedData.php.

Referenced by ilUserImportParser\importEndTag().

{
$this->user_data[$a_field] = $a_value;
}

+ Here is the caller graph for this function:

ilUserDefinedData::toXML ( )

Definition at line 157 of file class.ilUserDefinedData.php.

References addToXML().

{
include_once 'classes/class.ilXmlWriter.php';
$xml_writer = new ilXmlWriter();
$this->addToXML ($xml_writer);
return $xml_writer->xmlDumpMem(false);
}

+ Here is the call graph for this function:

ilUserDefinedData::update ( )

Update data.

Definition at line 53 of file class.ilUserDefinedData.php.

References $ilDB, ilUserDefinedFields\_getInstance(), getUserId(), and UDF_TYPE_WYSIWYG.

{
global $ilDB;
include_once './Services/User/classes/class.ilUserDefinedFields.php';
$sql = '';
$field_def = array();
foreach($udf_obj->getDefinitions() as $definition)
{
// $field_def['f_'.$definition['field_id']] = array('text',$this->get($definition['field_id']));
// $sql .= ("`".(int) $definition['field_id']."` = ".$this->db->quote($this->get($definition['field_id'])).", ");
if ($definition["field_type"] == UDF_TYPE_WYSIWYG)
{
$ilDB->replace("udf_clob", array(
"usr_id" => array("integer", $this->getUserId()),
"field_id" => array("integer", $definition['field_id'])),
array(
"value" => array("clob", $this->get("f_".$definition['field_id']))
));
}
else
{
$ilDB->replace("udf_text", array(
"usr_id" => array("integer", $this->getUserId()),
"field_id" => array("integer", $definition['field_id'])),
array(
"value" => array("text", $this->get("f_".$definition['field_id']))
));
}
}
/* if(!$field_def)
{
return true;
}
$query = "SELECT usr_id FROM udf_data WHERE usr_id = ".$ilDB->quote($this->getUserId(),'integer');
$res = $ilDB->query($query);
if($res->numRows())
{
$ilDB->update('udf_data',$field_def,array('usr_id' => array('integer',$this->getUserId())));
}
else
{
$field_def['usr_id'] = array('integer',$this->getUserId());
$ilDB->insert('udf_data',$field_def);
}*/
return true;
}

+ Here is the call graph for this function:

Field Documentation

ilUserDefinedData::$db = null

Definition at line 14 of file class.ilUserDefinedData.php.

ilUserDefinedData::$user_data = array()

Definition at line 15 of file class.ilUserDefinedData.php.

Referenced by getAll().

ilUserDefinedData::$usr_id = null

Definition at line 16 of file class.ilUserDefinedData.php.

Referenced by getUserId().


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