5 include_once(
"./Services/Component/classes/class.ilPlugin.php");
43 require_once
"Services/User/classes/class.ilUDFPermissionHelper.php";
61 abstract public function checkPermission($a_user_id, $a_context_type, $a_context_id, $a_action_id, $a_action_sub_id);
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);
120 protected static function handleAccesss(array &$fields, array $a_access = null, array $a_existing = null)
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)
127 if(isset($a_access[$prop]))
129 $fields[$prop] = array(
"integer", (
int)$a_access[$prop]);
131 else if(isset($a_existing[$prop]))
133 $fields[$prop] = array(
"integer", (
int)$a_existing[$prop]);
137 $fields[$prop] = array(
"integer", 0);
151 public static function createDBField($a_type, $a_title, array $a_access = null, array $a_options = null)
155 $field_id = $ilDB->nextId(
"udf_definition");
158 $a_type = (int)$a_type;
159 if(!self::isValidFieldType($a_type))
172 "field_id" => array(
"integer", $field_id),
173 "field_type" => array(
"integer", $a_type),
174 "field_name" => array(
"text", trim($a_title)),
175 "field_values" => array(
"text", serialize((array)$a_options))
180 $ilDB->insert(
"udf_definition", $fields);
194 public static function updateDBField($a_field_id, $a_title, array $a_access = null, array $a_options = null)
198 if(self::hasDBField($a_field_id))
208 "field_name" => array(
"text", trim($a_title)),
209 "field_values" => array(
"text", serialize((array)$a_options))
214 $ilDB->update(
"udf_definition", $fields,
215 array(
"field_id" => array(
"integer", $a_field_id)));
232 if(self::hasDBField($a_field_id))
236 $ilDB->manipulate(
"DELETE FROM udf_definition".
237 " WHERE field_id = ".$ilDB->quote($a_field_id,
"integer"));