55 $this->user_id = $a_user_id;
56 $this->field_id = $a_field_id;
58 if ($this->field_id) {
77 include_once(
'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
79 if (!count($field_ids)) {
83 $where =
"WHERE " .
$ilDB->in(
'field_id', $field_ids,
false,
'integer');
84 $query =
"SELECT * FROM crs_user_data " .
92 return $user_data ? $user_data : array();
110 $ilDB = $DIC[
'ilDB'];
112 include_once(
'Modules/Course/classes/Export/class.ilCourseDefinedFieldDefinition.php');
114 if (!count($required)) {
119 $and =
"AND " .
$ilDB->in(
'field_id', $required,
false,
'integer');
121 $query =
"SELECT COUNT(*) num_entries FROM crs_user_data " .
122 "WHERE usr_id = " .
$ilDB->quote($a_usr_id,
'integer') .
" " .
123 "AND value != '' AND value IS NOT NULL " .
129 return $row->num_entries == count($required);
144 $ilDB = $DIC[
'ilDB'];
146 $query =
"DELETE FROM crs_user_data " .
147 "WHERE usr_id = " .
$ilDB->quote($a_user_id,
'integer');
162 $ilDB = $DIC[
'ilDB'];
164 $query =
"DELETE FROM crs_user_data " .
165 "WHERE field_id = " .
$ilDB->quote($a_field_id,
'integer');
171 $this->value = $a_value;
196 public function delete()
200 $ilDB = $DIC[
'ilDB'];
202 $query =
"DELETE FROM crs_user_data " .
203 "WHERE usr_id = " . $this->db->quote($this->user_id,
'integer') .
" " .
204 "AND field_id = " . $this->db->quote($this->field_id,
'integer');
218 $ilDB = $DIC[
'ilDB'];
220 $query =
"INSERT INTO crs_user_data (value,usr_id,field_id) " .
222 $this->db->quote($this->
getValue(),
'text') .
", " .
223 $this->db->quote($this->user_id,
'integer') .
", " .
224 $this->db->quote($this->field_id,
'integer') .
" " .
239 $ilDB = $DIC[
'ilDB'];
241 $query =
"SELECT * FROM crs_user_data " .
242 "WHERE usr_id = " . $this->db->quote($this->user_id,
'integer') .
" " .
243 "AND field_id = " . $this->db->quote($this->field_id,
'integer');
__construct($a_user_id, $a_field_id=0)
Contructor.
static _getValuesByObjId($a_obj_id)
Get values by obj_id (for all users)
static _getFieldIds($a_container_id, $a_sort=IL_CDF_SORT_ID)
Get all field ids of a container.
static _getRequiredFieldIds($a_obj_id)
Get required filed id's.
static _deleteByField($a_field_id)
Delete by field.
foreach($_POST as $key=> $value) $res
static _checkRequired($a_usr_id, $a_obj_id)
Check required fields.
static _deleteByUser($a_user_id)
Delete all entries of an user.