36 $this->usr_id = $a_usr_id;
44 public static function lookupData(array $a_user_ids, array $a_field_ids): array
50 $query =
"SELECT * FROM udf_text " .
51 "WHERE " .
$ilDB->in(
'usr_id', $a_user_ids,
false,
'integer') .
' ' .
52 'AND ' .
$ilDB->in(
'field_id', $a_field_ids,
false,
'integer');
57 $udfd[$row[
'usr_id']][$row[
'field_id']] = $row[
'value'];
61 foreach ($def_helper->getActivePlugins() as
$plugin) {
62 foreach (
$plugin->lookupUserData($a_user_ids, $a_field_ids) as
$user_id => $usr_data) {
63 foreach ($usr_data as $field_id => $value) {
77 public function set(
string $a_field,
string $a_value):
void 79 $this->user_data[$a_field] = $a_value;
82 public function get(
string $a_field):
string 84 return $this->user_data[$a_field] ??
'';
93 static fn($value):
string => $value ??
'',
102 $ilDB = $DIC[
'ilDB'];
106 foreach ($udf_obj->getDefinitions() as $definition) {
111 "usr_id" => [
"integer", $this->
getUserId()],
112 "field_id" => [
"integer", $definition[
'field_id']]],
114 "value" => [
"clob", $this->
get(
"f_" . $definition[
'field_id'])]
121 "usr_id" => [
"integer", $this->
getUserId()],
122 "field_id" => [
"integer", $definition[
'field_id']]],
124 "value" => [
"text", $this->
get(
"f_" . $definition[
'field_id'])]
135 $ilDB = $DIC[
'ilDB'];
138 "DELETE FROM udf_text WHERE " 139 .
" usr_id = " .
$ilDB->quote($a_user_id,
"integer")
142 "DELETE FROM udf_clob WHERE " 143 .
" usr_id = " .
$ilDB->quote($a_user_id,
"integer")
154 $ilDB = $DIC[
'ilDB'];
157 "DELETE FROM udf_text WHERE " 158 .
" field_id = " .
$ilDB->quote($a_field_id,
"integer")
161 "DELETE FROM udf_clob WHERE " 162 .
" field_id = " .
$ilDB->quote($a_field_id,
"integer")
175 $ilDB = $DIC[
'ilDB'];
178 "UPDATE udf_text SET value = " .
$ilDB->quote(
"",
"text") .
" WHERE " 179 .
" field_id = " .
$ilDB->quote($a_field_id,
"integer")
180 .
" AND value = " .
$ilDB->quote($a_value,
"text")
190 return $xml_writer->xmlDumpMem(
false);
200 foreach ($udf_obj->getDefinitions() as $definition) {
201 if ($definition[
"export"] !=
false) {
204 [
'Id' => $definition[
'il_id'],
205 'Name' => $definition[
'field_name']],
206 (
string) ($this->user_data[
'f_' . (
int) $definition[
'field_id']] ??
'')
215 $this->user_data = [];
216 $query =
"SELECT * FROM udf_text " .
217 "WHERE usr_id = " . $this->db->quote($this->usr_id,
'integer');
218 $res = $this->db->query($query);
220 $this->user_data[
"f_" . $row[
"field_id"]] = $row[
"value"];
222 $query =
"SELECT * FROM udf_clob " .
223 "WHERE usr_id = " . $this->db->quote($this->usr_id,
'integer');
224 $res = $this->db->query($query);
226 $this->user_data[
"f_" . $row[
"field_id"]] = $row[
"value"];
static lookupData(array $a_user_ids, array $a_field_ids)
Lookup data.
static deleteEntriesOfField(int $a_field_id)
Delete data of particular field.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addToXML(ilXmlWriter $xml_writer)
add user defined field data to xml (using usr dtd)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static deleteEntriesOfUser(int $a_user_id)
static deleteFieldValue(int $a_field_id, string $a_value)
Delete data of particular value of a (selection) field.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
__construct(int $a_usr_id)