5 include_once(
"./Services/Component/classes/class.ilPlugin.php");
43 require_once
"Services/User/classes/class.ilUDFPermissionHelper.php";
78 $set = $ilDB->query(
"SELECT field_id FROM udf_definition" .
79 " WHERE field_id = " . $ilDB->quote($a_field_id,
"integer"));
80 return (
bool) $ilDB->numRows($set);
93 $set = $ilDB->query(
"SELECT * FROM udf_definition" .
94 " WHERE field_id = " . $ilDB->quote($a_field_id,
"integer"));
95 return $ilDB->fetchAssoc($set);
107 require_once
"Services/User/classes/class.ilUserDefinedFields.php";
111 return in_array($a_field_type,
$valid);
122 $map =
array(
"visible",
"changeable",
"searchable",
"required",
"export",
123 "course_export",
"group_export",
"registration_visible",
"visible_lua",
124 "changeable_lua",
"certificate");
125 foreach ($map as $prop) {
126 if (isset($a_access[$prop])) {
127 $fields[$prop] =
array(
"integer", (
int) $a_access[$prop]);
128 } elseif (isset($a_existing[$prop])) {
129 $fields[$prop] =
array(
"integer", (
int) $a_existing[$prop]);
131 $fields[$prop] =
array(
"integer", 0);
149 $field_id = $ilDB->nextId(
"udf_definition");
153 if (!self::isValidFieldType(
$a_type)) {
164 "field_id" =>
array(
"integer", $field_id),
166 "field_name" =>
array(
"text", trim($a_title)),
167 "field_values" =>
array(
"text", serialize((
array) $a_options))
170 self::handleAccesss($fields, $a_access);
172 $ilDB->insert(
"udf_definition", $fields);
190 if (self::hasDBField($a_field_id)) {
191 $old = self::getDBField($a_field_id);
198 "field_name" =>
array(
"text", trim($a_title)),
199 "field_values" =>
array(
"text", serialize((
array) $a_options))
202 self::handleAccesss($fields, $a_access,
$old);
207 array(
"field_id" =>
array(
"integer", $a_field_id))
225 if (self::hasDBField($a_field_id)) {
228 $ilDB->manipulate(
"DELETE FROM udf_definition" .
229 " WHERE field_id = " . $ilDB->quote($a_field_id,
"integer"));
static isValidFieldType($a_field_type)
Validate field type.
checkPermission($a_user_id, $a_context_type, $a_context_id, $a_action_id, $a_action_sub_id)
Check permission.
static handleAccesss(array &$fields, array $a_access=null, array $a_existing=null)
Convert access array to DB columns.
static updateDBField($a_field_id, $a_title, array $a_access=null, array $a_options=null)
Update field db entry.
static createDBField($a_type, $a_title, array $a_access=null, array $a_options=null)
Create field db entry.
static getDBField($a_field_id)
Get existing field values.
Create styles array
The data for the language used.
static deleteDBField($a_field_id)
Delete field db entry.
static hasDBField($a_field_id)
Check if field has db entry.
Abstract parent class for all udf claiming plugin classes.