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)) {
48 $row =
$ilDB->fetchAssoc($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") .
67 while ($row =
$ilDB->fetchAssoc($set)) {
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);
119 $this->
id = (int) $a_id;
122 abstract public function getType();
126 $this->parent = ($a_value !== null)
138 $this->title = ($a_value !== null)
150 $this->desc = ($a_value !== null)
162 $this->required = (bool) $a_value;
172 $this->pos = (int) $a_value;
182 $this->def = $a_value;
194 if ($a_def_json !=
"") {
195 $def = json_decode($a_def_json,
true);
196 if (is_array(
$def)) {
203 if ($a_def !=
"" && version_compare(PHP_VERSION,
'7.0.0') >= 0) {
204 $a_def = @unserialize($a_def,
false);
205 if (is_array($a_def)) {
218 $this->
setId($a_row[
"id"]);
225 ? unserialize($a_row[
"def"])
232 "type" => array(
"text", $this->
getType())
233 ,
"title" => array(
"text", $this->
getTitle())
235 ,
"required" => array(
"integer", $this->
isRequired())
250 $set =
$ilDB->query(
"SELECT MAX(pos) pos" .
252 " WHERE parent = " .
$ilDB->quote($this->getParent(),
"integer"));
253 $row =
$ilDB->fetchAssoc($set);
254 return (
int) $row[
"pos"];
265 $this->
id =
$ilDB->nextId(
"exc_crit");
269 $fields[
"id"] = array(
"integer", $this->
id);
270 $fields[
"type"] = array(
"text", $this->
getType());
271 $fields[
"parent"] = array(
"integer", $this->
getParent());
274 $ilDB->insert(
"exc_crit", $fields);
282 return $this->
save();
285 $primary = array(
"id" => array(
"integer", $this->
id));
289 public function delete()
297 $ilDB->manipulate(
"DELETE FROM exc_crit" .
298 " WHERE id = " .
$ilDB->quote($this->id,
"integer"));
305 $ilDB = $DIC->database();
307 if (!(
int) $a_parent_id) {
311 $ilDB->manipulate(
"DELETE FROM exc_crit" .
312 " WHERE parent = " .
$ilDB->quote($a_parent_id,
"integer"));
318 $new_obj->setParent($a_target_parent_id);
319 $new_obj->setTitle($this->
getTitle());
326 return $new_obj->getId();
354 $this->form = $a_form;
356 $this->giver_id = $a_giver_id;
357 $this->peer_id = $a_peer_id;
374 abstract public function hasValue($a_value);
376 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)