3 declare(strict_types=0);
    33     public function __construct(
int $a_user_id, 
int $a_field_id = 0)
    37         $this->db = $DIC->database();
    38         $this->user_id = $a_user_id;
    39         $this->field_id = $a_field_id;
    40         if ($this->field_id) {
    49         $ilDB = $DIC->database();
    51         if ($field_ids === []) {
    54         $where = 
"WHERE " . 
$ilDB->in(
'field_id', $field_ids, 
false, 
'integer');
    55         $query = 
"SELECT * FROM crs_user_data " .
    61             $user_data[(
int) $row->usr_id][(
int) $row->field_id] = $row->value;
    70         $ilDB = $DIC->database();
    72         if ($required === []) {
    77         $and = 
"AND " . 
$ilDB->in(
'field_id', $required, 
false, 
'integer');
    79         $query = 
"SELECT COUNT(*) num_entries FROM crs_user_data " .
    80             "WHERE usr_id = " . 
$ilDB->quote($a_usr_id, 
'integer') . 
" " .
    81             "AND value != '' AND value IS NOT NULL " .
    86         return $row->num_entries == count($required);
    93         $ilDB = $DIC->database();
    94         $query = 
"DELETE FROM crs_user_data " .
    95             "WHERE usr_id = " . 
$ilDB->quote($a_user_id, 
'integer');
   103         $ilDB = $DIC[
'ilDB'];
   105         $query = 
"DELETE FROM crs_user_data " .
   106             "WHERE field_id = " . 
$ilDB->quote($a_field_id, 
'integer');
   112         $this->value = $a_value;
   126     public function delete(): 
void   128         $query = 
"DELETE FROM crs_user_data " .
   129             "WHERE usr_id = " . $this->db->quote($this->user_id, 
'integer') . 
" " .
   130             "AND field_id = " . $this->db->quote($this->field_id, 
'integer');
   131         $res = $this->db->manipulate($query);
   136         $query = 
"INSERT INTO crs_user_data (value,usr_id,field_id) " .
   138             $this->db->quote($this->
getValue(), 
'text') . 
", " .
   139             $this->db->quote($this->user_id, 
'integer') . 
", " .
   140             $this->db->quote($this->field_id, 
'integer') . 
" " .
   143         $res = $this->db->manipulate($query);
   148         $query = 
"SELECT * FROM crs_user_data " .
   149             "WHERE usr_id = " . $this->db->quote($this->user_id, 
'integer') . 
" " .
   150             "AND field_id = " . $this->db->quote($this->field_id, 
'integer');
   151         $res = $this->db->query($query);
   154             $this->
setValue((
string) $row->value);
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
setValue(string $a_value)
 
static _getFieldIds(int $a_container_id, string $a_sort=self::IL_CDF_SORT_ID)
 
static _getValuesByObjId(int $a_obj_id)
 
__construct(int $a_user_id, int $a_field_id=0)
 
static _checkRequired(int $a_usr_id, int $a_obj_id)
 
static _deleteByField(int $a_field_id)
 
static _deleteByUser(int $a_user_id)
 
static _getRequiredFieldIds(int $a_obj_id)
Get required filed id's.