ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilExcCriteria Class Reference

Class ilExcCriteria. More...

+ Inheritance diagram for ilExcCriteria:
+ Collaboration diagram for ilExcCriteria:

Public Member Functions

 getTranslatedType ()
 
 getId ()
 
 getType ()
 
 setParent ($a_value)
 
 getParent ()
 
 setTitle ($a_value)
 
 getTitle ()
 
 setDescription ($a_value)
 
 getDescription ()
 
 setRequired ($a_value)
 
 isRequired ()
 
 setPosition ($a_value)
 
 getPosition ()
 
 importDefinition ($a_def, $a_def_json)
 
 save ()
 
 update ()
 
 delete ()
 
 cloneObject ($a_target_parent_id)
 
 initCustomForm (ilPropertyFormGUI $a_form)
 
 exportCustomForm (ilPropertyFormGUI $a_form)
 
 importCustomForm (ilPropertyFormGUI $a_form)
 
 setPeerReviewContext (ilExAssignment $a_ass, $a_giver_id, $a_peer_id, ilPropertyFormGUI $a_form=null)
 
 addToPeerReviewForm ($a_value=null)
 
 importFromPeerReviewForm ()
 
 updateFromAjax ()
 
 validate ($a_value)
 
 hasValue ($a_value)
 
 getHTML ($a_value)
 
 resetReview ()
 

Static Public Member Functions

static getInstanceById ($a_id)
 
static getInstancesByParentId ($a_parent_id)
 
static getTypesMap ()
 
static getInstanceByType ($a_type)
 
static deleteByParent ($a_parent_id)
 

Protected Member Functions

 __construct ()
 
 setId ($a_id)
 
 setDefinition (array $a_value=null)
 
 getDefinition ()
 
 importFromDB (array $a_row)
 
 getDBProperties ()
 
 getLastPosition ()
 

Protected Attributes

 $db
 
 $id
 
 $parent
 
 $title
 
 $desc
 
 $required
 
 $pos
 
 $def
 
 $form
 
 $ass
 
 $giver_id
 
 $peer_id
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilExcCriteria::__construct ( )
protected

Reimplemented in ilExcCriteriaBool, ilExcCriteriaFile, ilExcCriteriaRating, and ilExcCriteriaText.

Definition at line 31 of file class.ilExcCriteria.php.

32 {
33 global $DIC;
34
35 $this->db = $DIC->database();
36 }
global $DIC
Definition: saml.php:7

References $DIC.

Member Function Documentation

◆ addToPeerReviewForm()

ilExcCriteria::addToPeerReviewForm (   $a_value = null)
abstract

◆ cloneObject()

ilExcCriteria::cloneObject (   $a_target_parent_id)

Definition at line 316 of file class.ilExcCriteria.php.

317 {
318 $new_obj = ilExcCriteria::getInstanceByType($this->getType());
319 $new_obj->setParent($a_target_parent_id);
320 $new_obj->setTitle($this->getTitle());
321 $new_obj->setDescription($this->getDescription());
322 $new_obj->setRequired($this->isRequired());
323 $new_obj->setPosition($this->getPosition());
324 $new_obj->setDefinition($this->getDefinition());
325 $new_obj->save();
326
327 return $new_obj->getId();
328 }
static getInstanceByType($a_type)

References getDefinition(), getDescription(), getInstanceByType(), getPosition(), getTitle(), getType(), and isRequired().

+ Here is the call graph for this function:

◆ delete()

ilExcCriteria::delete ( )

Definition at line 290 of file class.ilExcCriteria.php.

291 {
293
294 if (!$this->id) {
295 return;
296 }
297
298 $ilDB->manipulate("DELETE FROM exc_crit" .
299 " WHERE id = " . $ilDB->quote($this->id, "integer"));
300 }
global $ilDB

References $db, and $ilDB.

◆ deleteByParent()

static ilExcCriteria::deleteByParent (   $a_parent_id)
static

Definition at line 302 of file class.ilExcCriteria.php.

303 {
304 global $DIC;
305
306 $ilDB = $DIC->database();
307
308 if (!(int) $a_parent_id) {
309 return;
310 }
311
312 $ilDB->manipulate("DELETE FROM exc_crit" .
313 " WHERE parent = " . $ilDB->quote($a_parent_id, "integer"));
314 }

References $DIC, and $ilDB.

Referenced by ilExcCriteriaCatalogue\delete().

+ Here is the caller graph for this function:

◆ exportCustomForm()

ilExcCriteria::exportCustomForm ( ilPropertyFormGUI  $a_form)

Reimplemented in ilExcCriteriaText.

Definition at line 340 of file class.ilExcCriteria.php.

341 {
342 // type-specific
343 }

Referenced by ilExcCriteriaGUI\exportForm().

+ Here is the caller graph for this function:

◆ getDBProperties()

ilExcCriteria::getDBProperties ( )
protected

Definition at line 230 of file class.ilExcCriteria.php.

231 {
232 return array(
233 "type" => array("text", $this->getType())
234 ,"title" => array("text", $this->getTitle())
235 ,"descr" => array("text", $this->getDescription())
236 ,"required" => array("integer", $this->isRequired())
237 ,"pos" => array("integer", $this->getPosition())
238 ,"def" => array("text", is_array($this->getDefinition())
239 ? serialize($this->getDefinition())
240 : null)
241 );
242 }

References getDefinition(), getDescription(), getPosition(), getTitle(), getType(), and isRequired().

Referenced by save(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDefinition()

ilExcCriteria::getDefinition ( )
protected

Definition at line 186 of file class.ilExcCriteria.php.

187 {
188 return $this->def;
189 }

References $def.

Referenced by cloneObject(), getDBProperties(), and ilExcCriteriaText\getMinChars().

+ Here is the caller graph for this function:

◆ getDescription()

◆ getHTML()

ilExcCriteria::getHTML (   $a_value)
abstract

◆ getId()

◆ getInstanceById()

static ilExcCriteria::getInstanceById (   $a_id)
static

Definition at line 38 of file class.ilExcCriteria.php.

39 {
40 global $DIC;
41
42 $ilDB = $DIC->database();
43
44 $set = $ilDB->query("SELECT *" .
45 " FROM exc_crit" .
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);
51 return $obj;
52 }
53 }

References $DIC, $ilDB, $row, and getInstanceByType().

Referenced by ilExPeerReviewGUI\downloadPeerReviewObject(), ilExcCriteriaGUI\getCurrentCritera(), and ilExPeerReviewGUI\updateCritAjaxObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getInstanceByType()

static ilExcCriteria::getInstanceByType (   $a_type)
static

Definition at line 101 of file class.ilExcCriteria.php.

102 {
103 $class = "ilExcCriteria" . ucfirst($a_type);
104 include_once "Modules/Exercise/classes/class." . $class . ".php";
105 return new $class;
106 }
$a_type
Definition: workflow.php:92

References $a_type.

Referenced by ilExcCriteriaGUI\add(), cloneObject(), ilExcCriteriaGUI\create(), ilExPeerReviewGUI\downloadPeerReviewObject(), getInstanceById(), getInstancesByParentId(), ilExAssignment\getPeerReviewCriteriaCatalogueItems(), ilExerciseDataSet\importRecord(), and ilExPeerReviewGUI\updateCritAjaxObject().

+ Here is the caller graph for this function:

◆ getInstancesByParentId()

static ilExcCriteria::getInstancesByParentId (   $a_parent_id)
static

Definition at line 55 of file class.ilExcCriteria.php.

56 {
57 global $DIC;
58
59 $ilDB = $DIC->database();
60
61 $res = array();
62
63 $set = $ilDB->query("SELECT *" .
64 " FROM exc_crit" .
65 " WHERE parent = " . $ilDB->quote($a_parent_id, "integer") .
66 " ORDER BY pos");
67 while ($row = $ilDB->fetchAssoc($set)) {
68 $obj = self::getInstanceByType($row["type"]);
69 $obj->importFromDB($row);
70 $res[$obj->getId()] = $obj;
71 }
72
73 return $res;
74 }
foreach($_POST as $key=> $value) $res

References $DIC, $ilDB, $res, $row, and getInstanceByType().

Referenced by ilExcCriteriaCatalogue\cloneObject(), ilExcCriteriaGUI\confirmDeletion(), ilExcCriteriaGUI\delete(), ilExcCriteriaCatalogueTableGUI\getItems(), ilExcCriteriaTableGUI\getItems(), ilExAssignment\getPeerReviewCriteriaCatalogueItems(), ilExAssignmentEditorGUI\initPeerReviewForm(), and ilExcCriteriaGUI\saveOrder().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLastPosition()

ilExcCriteria::getLastPosition ( )
protected

Definition at line 243 of file class.ilExcCriteria.php.

244 {
246
247 if (!$this->getParent()) {
248 return;
249 }
250
251 $set = $ilDB->query("SELECT MAX(pos) pos" .
252 " FROM exc_crit" .
253 " WHERE parent = " . $ilDB->quote($this->getParent(), "integer"));
254 $row = $ilDB->fetchAssoc($set);
255 return (int) $row["pos"];
256 }

References $db, $ilDB, $row, and getParent().

Referenced by save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParent()

ilExcCriteria::getParent ( )

Definition at line 132 of file class.ilExcCriteria.php.

133 {
134 return $this->parent;
135 }

References $parent.

Referenced by getLastPosition(), and save().

+ Here is the caller graph for this function:

◆ getPosition()

ilExcCriteria::getPosition ( )

Definition at line 176 of file class.ilExcCriteria.php.

177 {
178 return $this->pos;
179 }

References $pos.

Referenced by cloneObject(), and getDBProperties().

+ Here is the caller graph for this function:

◆ getTitle()

◆ getTranslatedType()

ilExcCriteria::getTranslatedType ( )

Definition at line 95 of file class.ilExcCriteria.php.

96 {
97 $map = $this->getTypesMap();
98 return $map[$this->getType()];
99 }

References getType(), and getTypesMap().

Referenced by ilExcCriteriaGUI\initForm().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getType()

ilExcCriteria::getType ( )
abstract

Reimplemented in ilExcCriteriaBool, ilExcCriteriaFile, ilExcCriteriaRating, and ilExcCriteriaText.

Referenced by cloneObject(), getDBProperties(), getTranslatedType(), and save().

+ Here is the caller graph for this function:

◆ getTypesMap()

static ilExcCriteria::getTypesMap ( )
static

Definition at line 81 of file class.ilExcCriteria.php.

82 {
83 global $DIC;
84
85 $lng = $DIC->language();
86
87 return array(
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")
92 );
93 }
global $lng
Definition: privfeed.php:17

References $DIC, and $lng.

Referenced by getTranslatedType(), and ilExcCriteriaGUI\view().

+ Here is the caller graph for this function:

◆ hasValue()

ilExcCriteria::hasValue (   $a_value)
abstract

◆ importCustomForm()

ilExcCriteria::importCustomForm ( ilPropertyFormGUI  $a_form)

Reimplemented in ilExcCriteriaText.

Definition at line 345 of file class.ilExcCriteria.php.

346 {
347 // type-specific
348 }

Referenced by ilExcCriteriaGUI\importForm().

+ Here is the caller graph for this function:

◆ importDefinition()

ilExcCriteria::importDefinition (   $a_def,
  $a_def_json 
)

Definition at line 191 of file class.ilExcCriteria.php.

192 {
193 // see #23711
194 // use json, if given
195 if ($a_def_json != "") {
196 $def = json_decode($a_def_json, true);
197 if (is_array($def)) {
198 $this->setDefinition($def);
199 }
200 return;
201 }
202
203 // use unserialize only if php > 7
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)) {
207 $this->setDefinition($a_def);
208 }
209 }
210 }
setDefinition(array $a_value=null)

References $def, and setDefinition().

+ Here is the call graph for this function:

◆ importFromDB()

ilExcCriteria::importFromDB ( array  $a_row)
protected

Definition at line 217 of file class.ilExcCriteria.php.

218 {
219 $this->setId($a_row["id"]);
220 $this->setParent($a_row["parent"]);
221 $this->setTitle($a_row["title"]);
222 $this->setDescription($a_row["descr"]);
223 $this->setRequired($a_row["required"]);
224 $this->setPosition($a_row["pos"]);
225 $this->setDefinition($a_row["def"]
226 ? unserialize($a_row["def"])
227 : null);
228 }

References setDefinition(), setDescription(), setId(), setParent(), setPosition(), setRequired(), and setTitle().

+ Here is the call graph for this function:

◆ importFromPeerReviewForm()

ilExcCriteria::importFromPeerReviewForm ( )
abstract

◆ initCustomForm()

ilExcCriteria::initCustomForm ( ilPropertyFormGUI  $a_form)

Reimplemented in ilExcCriteriaText.

Definition at line 335 of file class.ilExcCriteria.php.

336 {
337 // type-specific
338 }

Referenced by ilExcCriteriaGUI\initForm().

+ Here is the caller graph for this function:

◆ isRequired()

◆ resetReview()

ilExcCriteria::resetReview ( )

Reimplemented in ilExcCriteriaFile, and ilExcCriteriaRating.

Definition at line 379 of file class.ilExcCriteria.php.

380 {
381 // type-specific (only needed for data not kept in exc_assignment_peer)
382 }

◆ save()

ilExcCriteria::save ( )

Definition at line 258 of file class.ilExcCriteria.php.

259 {
261
262 if ($this->id) {
263 return $this->update();
264 }
265
266 $this->id = $ilDB->nextId("exc_crit");
267
268 $fields = $this->getDBProperties();
269
270 $fields["id"] = array("integer", $this->id);
271 $fields["type"] = array("text", $this->getType());
272 $fields["parent"] = array("integer", $this->getParent());
273 $fields["pos"] = array("integer", $this->getLastPosition()+10);
274
275 $ilDB->insert("exc_crit", $fields);
276 }

References $db, $ilDB, getDBProperties(), getLastPosition(), getParent(), getType(), and update().

Referenced by ilExcCriteriaGUI\importForm(), and update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDefinition()

ilExcCriteria::setDefinition ( array  $a_value = null)
protected

Definition at line 181 of file class.ilExcCriteria.php.

182 {
183 $this->def = $a_value;
184 }

Referenced by ilExcCriteriaText\importCustomForm(), importDefinition(), importFromDB(), and ilExcCriteriaText\setMinChars().

+ Here is the caller graph for this function:

◆ setDescription()

ilExcCriteria::setDescription (   $a_value)

Definition at line 149 of file class.ilExcCriteria.php.

150 {
151 $this->desc = ($a_value !== null)
152 ? trim($a_value)
153 : null;
154 }

Referenced by ilExcCriteriaGUI\importForm(), and importFromDB().

+ Here is the caller graph for this function:

◆ setId()

ilExcCriteria::setId (   $a_id)
protected

Definition at line 118 of file class.ilExcCriteria.php.

119 {
120 $this->id = (int) $a_id;
121 }

Referenced by importFromDB().

+ Here is the caller graph for this function:

◆ setParent()

ilExcCriteria::setParent (   $a_value)

Definition at line 125 of file class.ilExcCriteria.php.

126 {
127 $this->parent = ($a_value !== null)
128 ? (int) $a_value
129 : null;
130 }

Referenced by ilExcCriteriaGUI\importForm(), and importFromDB().

+ Here is the caller graph for this function:

◆ setPeerReviewContext()

ilExcCriteria::setPeerReviewContext ( ilExAssignment  $a_ass,
  $a_giver_id,
  $a_peer_id,
ilPropertyFormGUI  $a_form = null 
)

Definition at line 353 of file class.ilExcCriteria.php.

354 {
355 $this->form = $a_form;
356 $this->ass = $a_ass;
357 $this->giver_id = $a_giver_id;
358 $this->peer_id = $a_peer_id;
359 }

◆ setPosition()

ilExcCriteria::setPosition (   $a_value)

Definition at line 171 of file class.ilExcCriteria.php.

172 {
173 $this->pos = (int) $a_value;
174 }

Referenced by importFromDB().

+ Here is the caller graph for this function:

◆ setRequired()

ilExcCriteria::setRequired (   $a_value)

Definition at line 161 of file class.ilExcCriteria.php.

162 {
163 $this->required = (bool) $a_value;
164 }

Referenced by ilExcCriteriaGUI\importForm(), and importFromDB().

+ Here is the caller graph for this function:

◆ setTitle()

ilExcCriteria::setTitle (   $a_value)

Definition at line 137 of file class.ilExcCriteria.php.

138 {
139 $this->title = ($a_value !== null)
140 ? trim($a_value)
141 : null;
142 }

Referenced by ilExcCriteriaGUI\importForm(), and importFromDB().

+ Here is the caller graph for this function:

◆ update()

ilExcCriteria::update ( )

Definition at line 278 of file class.ilExcCriteria.php.

279 {
281
282 if (!$this->id) {
283 return $this->save();
284 }
285
286 $primary = array("id"=>array("integer", $this->id));
287 $ilDB->update("exc_crit", $this->getDBProperties(), $primary);
288 }

References $db, $ilDB, getDBProperties(), and save().

Referenced by ilExcCriteriaGUI\importForm(), and save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateFromAjax()

ilExcCriteria::updateFromAjax ( )

Reimplemented in ilExcCriteriaRating.

Definition at line 365 of file class.ilExcCriteria.php.

366 {
367 // type-specific
368 }

◆ validate()

ilExcCriteria::validate (   $a_value)

Reimplemented in ilExcCriteriaFile, ilExcCriteriaRating, and ilExcCriteriaText.

Definition at line 370 of file class.ilExcCriteria.php.

371 {
372 return true;
373 }

Field Documentation

◆ $ass

ilExcCriteria::$ass
protected

Definition at line 27 of file class.ilExcCriteria.php.

◆ $db

ilExcCriteria::$db
protected

Definition at line 16 of file class.ilExcCriteria.php.

Referenced by delete(), getLastPosition(), save(), and update().

◆ $def

ilExcCriteria::$def
protected

◆ $desc

ilExcCriteria::$desc
protected

Definition at line 21 of file class.ilExcCriteria.php.

Referenced by getDescription().

◆ $form

ilExcCriteria::$form
protected

Definition at line 26 of file class.ilExcCriteria.php.

◆ $giver_id

ilExcCriteria::$giver_id
protected

Definition at line 28 of file class.ilExcCriteria.php.

◆ $id

ilExcCriteria::$id
protected

Definition at line 18 of file class.ilExcCriteria.php.

Referenced by getId().

◆ $parent

ilExcCriteria::$parent
protected

Definition at line 19 of file class.ilExcCriteria.php.

Referenced by getParent().

◆ $peer_id

ilExcCriteria::$peer_id
protected

Definition at line 29 of file class.ilExcCriteria.php.

◆ $pos

ilExcCriteria::$pos
protected

Definition at line 23 of file class.ilExcCriteria.php.

Referenced by getPosition().

◆ $required

ilExcCriteria::$required
protected

Definition at line 22 of file class.ilExcCriteria.php.

Referenced by isRequired().

◆ $title

ilExcCriteria::$title
protected

Definition at line 20 of file class.ilExcCriteria.php.

Referenced by getTitle().


The documentation for this class was generated from the following file: