30 protected \ILIAS\Exercise\InternalGUIService
$gui;
34 protected ?
int $id =
null;
40 protected ?array
$def =
null;
50 $this->db =
$DIC->database();
51 $this->
lng = $DIC->language();
52 $this->
ctrl = $DIC->ctrl();
53 $this->gui =
$DIC->exercise()->internal()->gui();
62 $set =
$ilDB->query(
"SELECT *" .
64 " WHERE id = " .
$ilDB->quote($a_id,
"integer"));
65 if (
$ilDB->numRows($set)) {
66 $row =
$ilDB->fetchAssoc($set);
68 $obj->importFromDB($row);
87 $set =
$ilDB->query(
"SELECT *" .
89 " WHERE parent = " .
$ilDB->quote($a_parent_id,
"integer") .
91 while ($row =
$ilDB->fetchAssoc($set)) {
93 $obj->importFromDB($row);
94 $res[$obj->getId()] = $obj;
112 "bool" =>
$lng->
txt(
"exc_criteria_type_bool")
113 ,
"rating" =>
$lng->
txt(
"exc_criteria_type_rating")
114 ,
"text" =>
$lng->
txt(
"exc_criteria_type_text")
115 ,
"file" =>
$lng->
txt(
"exc_criteria_type_file")
127 $class =
"ilExcCriteria" . ucfirst($a_type);
141 protected function setId(?
int $a_id): void
150 $this->parent = $a_value;
160 $this->title = $a_value;
170 $this->desc = $a_value;
180 $this->required = $a_value;
190 $this->pos = $a_value;
200 $this->def = $a_value;
212 if ($a_def_json !=
"") {
213 $def = json_decode($a_def_json,
true);
214 if (is_array(
$def)) {
221 if ($a_def !=
"" && version_compare(PHP_VERSION,
'7.0.0') >= 0) {
222 $a_def = unserialize($a_def, [
'allowed_classes' =>
false]);
223 if (is_array($a_def)) {
236 $this->
setId((
int) $a_row[
"id"]);
237 $this->
setParent((
int) $a_row[
"parent"]);
238 $this->
setTitle((
string) $a_row[
"title"]);
243 ? unserialize((
string) $a_row[
"def"], [
'allowed_classes' =>
false])
250 "type" => array(
"text", $this->
getType())
251 ,
"title" => array(
"text", $this->
getTitle())
253 ,
"required" => array(
"integer", $this->
isRequired())
269 $set =
$ilDB->query(
"SELECT MAX(pos) pos" .
271 " WHERE parent = " .
$ilDB->quote($this->getParent(),
"integer"));
272 $row =
$ilDB->fetchAssoc($set);
273 return (
int) $row[
"pos"];
285 $this->
id =
$ilDB->nextId(
"exc_crit");
289 $fields[
"id"] = array(
"integer", $this->
id);
290 $fields[
"type"] = array(
"text", $this->
getType());
291 $fields[
"parent"] = array(
"integer", $this->
getParent());
294 $ilDB->insert(
"exc_crit", $fields);
306 $primary = array(
"id" => array(
"integer", $this->
id));
310 public function delete():
void
318 $ilDB->manipulate(
"DELETE FROM exc_crit" .
319 " WHERE id = " .
$ilDB->quote($this->id,
"integer"));
332 $ilDB->manipulate(
"DELETE FROM exc_crit" .
333 " WHERE parent = " .
$ilDB->quote($a_parent_id,
"integer"));
339 $new_obj->setParent($a_target_parent_id);
340 $new_obj->setTitle($this->
getTitle());
347 return $new_obj->getId();
379 $this->
form = $a_form;
381 $this->giver_id = $a_giver_id;
382 $this->peer_id = $a_peer_id;
401 abstract public function getHTML($a_value): string;
Class ilCtrl provides processing control methods.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setDefinition(?array $a_value=null)
importFromPeerReviewForm()
importFromDB(array $a_row)
initCustomForm(ilPropertyFormGUI $a_form)
static deleteByParent(int $a_parent_id)
exportCustomForm(ilPropertyFormGUI $a_form)
setRequired(bool $a_value)
setTitle(?string $a_value)
importDefinition(string $a_def, string $a_def_json)
setPeerReviewContext(ilExAssignment $a_ass, int $a_giver_id, int $a_peer_id, ?ilPropertyFormGUI $a_form=null)
setPosition(int $a_value)
importCustomForm(ilPropertyFormGUI $a_form)
addToPeerReviewForm($a_value=null)
setDescription(?string $a_value)
cloneObject(int $a_target_parent_id)
ILIAS Exercise InternalGUIService $gui
static getInstancesByParentId(int $a_parent_id)
static getInstanceById(int $a_id)
static getInstanceByType(string $a_type)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
form( $class_path, string $cmd, string $submit_caption="")