35 $this->db = $DIC->database();
42 $ilDB = $DIC->database();
44 $set =
$ilDB->query(
"SELECT *" .
46 " WHERE id = " .
$ilDB->quote($a_id,
"integer"));
47 if (
$ilDB->numRows($set)) {
49 $obj = self::getInstanceByType(
$row[
"type"]);
50 $obj->importFromDB(
$row);
59 $ilDB = $DIC->database();
63 $set =
$ilDB->query(
"SELECT *" .
65 " WHERE parent = " .
$ilDB->quote($a_parent_id,
"integer") .
68 $obj = self::getInstanceByType(
$row[
"type"]);
69 $obj->importFromDB(
$row);
70 $res[$obj->getId()] = $obj;
85 $lng = $DIC->language();
88 "bool" =>
$lng->txt(
"exc_criteria_type_bool")
89 ,
"rating" =>
$lng->txt(
"exc_criteria_type_rating")
90 ,
"text" =>
$lng->txt(
"exc_criteria_type_text")
91 ,
"file" =>
$lng->txt(
"exc_criteria_type_file")
103 $class =
"ilExcCriteria" . ucfirst(
$a_type);
104 include_once
"Modules/Exercise/classes/class." . $class .
".php";
120 $this->
id = (int) $a_id;
123 abstract public function getType();
127 $this->
parent = ($a_value !== null)
139 $this->title = ($a_value !== null)
151 $this->desc = ($a_value !== null)
163 $this->required = (bool) $a_value;
173 $this->pos = (int) $a_value;
183 $this->def = $a_value;
195 if ($a_def_json !=
"") {
196 $def = json_decode($a_def_json,
true);
197 if (is_array(
$def)) {
204 if ($a_def !=
"" && version_compare(PHP_VERSION,
'7.0.0') >= 0) {
205 $a_def = @unserialize($a_def,
false);
206 if (is_array($a_def)) {
219 $this->
setId($a_row[
"id"]);
226 ? unserialize($a_row[
"def"])
233 "type" => array(
"text", $this->
getType())
234 ,
"title" => array(
"text", $this->
getTitle())
236 ,
"required" => array(
"integer", $this->
isRequired())
251 $set =
$ilDB->query(
"SELECT MAX(pos) pos" .
253 " WHERE parent = " .
$ilDB->quote($this->getParent(),
"integer"));
255 return (
int)
$row[
"pos"];
266 $this->
id =
$ilDB->nextId(
"exc_crit");
270 $fields[
"id"] = array(
"integer", $this->
id);
271 $fields[
"type"] = array(
"text", $this->
getType());
272 $fields[
"parent"] = array(
"integer", $this->
getParent());
275 $ilDB->insert(
"exc_crit", $fields);
283 return $this->
save();
286 $primary = array(
"id" => array(
"integer", $this->
id));
290 public function delete()
298 $ilDB->manipulate(
"DELETE FROM exc_crit" .
299 " WHERE id = " .
$ilDB->quote($this->id,
"integer"));
306 $ilDB = $DIC->database();
308 if (!(
int) $a_parent_id) {
312 $ilDB->manipulate(
"DELETE FROM exc_crit" .
313 " WHERE parent = " .
$ilDB->quote($a_parent_id,
"integer"));
319 $new_obj->setParent($a_target_parent_id);
320 $new_obj->setTitle($this->
getTitle());
327 return $new_obj->getId();
355 $this->form = $a_form;
357 $this->giver_id = $a_giver_id;
358 $this->peer_id = $a_peer_id;
375 abstract public function hasValue($a_value);
377 abstract public function getHTML($a_value);
static getInstanceByType($a_type)
importCustomForm(ilPropertyFormGUI $a_form)
static getInstanceById($a_id)
importFromPeerReviewForm()
static deleteByParent($a_parent_id)
setDefinition(array $a_value=null)
exportCustomForm(ilPropertyFormGUI $a_form)
cloneObject($a_target_parent_id)
foreach($_POST as $key=> $value) $res
static getInstancesByParentId($a_parent_id)
importDefinition($a_def, $a_def_json)
importFromDB(array $a_row)
initCustomForm(ilPropertyFormGUI $a_form)
setPeerReviewContext(ilExAssignment $a_ass, $a_giver_id, $a_peer_id, ilPropertyFormGUI $a_form=null)
addToPeerReviewForm($a_value=null)