ILIAS  release_8 Revision v8.24
ilExcCriteria Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

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

Public Member Functions

 __construct ()
 
 getTranslatedType ()
 
 getId ()
 
 getType ()
 
 setParent (?int $a_value)
 
 getParent ()
 
 setTitle (?string $a_value)
 
 getTitle ()
 
 setDescription (?string $a_value)
 
 getDescription ()
 
 setRequired (bool $a_value)
 
 isRequired ()
 
 setPosition (int $a_value)
 
 getPosition ()
 
 importDefinition (string $a_def, string $a_def_json)
 
 save ()
 
 update ()
 
 delete ()
 
 cloneObject (int $a_target_parent_id)
 
 initCustomForm (ilPropertyFormGUI $a_form)
 
 exportCustomForm (ilPropertyFormGUI $a_form)
 
 importCustomForm (ilPropertyFormGUI $a_form)
 
 setPeerReviewContext (ilExAssignment $a_ass, int $a_giver_id, int $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 (int $a_id)
 
static getInstancesByParentId (int $a_parent_id)
 
static getTypesMap ()
 
static getInstanceByType (string $a_type)
 
static deleteByParent (int $a_parent_id)
 

Protected Member Functions

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

Protected Attributes

ilLanguage $lng
 
ilCtrl $ctrl
 
ilDBInterface $db
 
int $id = null
 
int $parent = null
 
string $title = ""
 
string $desc = ""
 
bool $required = false
 
int $pos = 0
 
array $def = null
 
ilPropertyFormGUI $form = null
 
ilExAssignment $ass
 
int $giver_id = 0
 
int $peer_id = 0
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilExcCriteria.

Note: This class does stuff on application and gui layer and should be divided in multiple interfaces.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ilExcCriteria::__construct ( )

Reimplemented in ilExcCriteriaRating.

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

46 {
47 global $DIC;
48
49 $this->db = $DIC->database();
50 $this->lng = $DIC->language();
51 $this->ctrl = $DIC->ctrl();
52 }
global $DIC
Definition: feed.php:28

References $DIC, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ addToPeerReviewForm()

ilExcCriteria::addToPeerReviewForm (   $a_value = null)
abstract

◆ cloneObject()

ilExcCriteria::cloneObject ( int  $a_target_parent_id)

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

334 : ?int
335 {
336 $new_obj = ilExcCriteria::getInstanceByType($this->getType());
337 $new_obj->setParent($a_target_parent_id);
338 $new_obj->setTitle($this->getTitle());
339 $new_obj->setDescription($this->getDescription());
340 $new_obj->setRequired($this->isRequired());
341 $new_obj->setPosition($this->getPosition());
342 $new_obj->setDefinition($this->getDefinition());
343 $new_obj->save();
344
345 return $new_obj->getId();
346 }
static getInstanceByType(string $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 308 of file class.ilExcCriteria.php.

308 : void
309 {
311
312 if (!$this->id) {
313 return;
314 }
315
316 $ilDB->manipulate("DELETE FROM exc_crit" .
317 " WHERE id = " . $ilDB->quote($this->id, "integer"));
318 }
ilDBInterface $db

References $db, and $ilDB.

◆ deleteByParent()

static ilExcCriteria::deleteByParent ( int  $a_parent_id)
static

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

320 : void
321 {
322 global $DIC;
323
324 $ilDB = $DIC->database();
325
326 if (!$a_parent_id) {
327 return;
328 }
329
330 $ilDB->manipulate("DELETE FROM exc_crit" .
331 " WHERE parent = " . $ilDB->quote($a_parent_id, "integer"));
332 }

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 358 of file class.ilExcCriteria.php.

358 : void
359 {
360 // type-specific
361 }

◆ getDBProperties()

ilExcCriteria::getDBProperties ( )
protected

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

245 : array
246 {
247 return array(
248 "type" => array("text", $this->getType())
249 ,"title" => array("text", $this->getTitle())
250 ,"descr" => array("text", $this->getDescription())
251 ,"required" => array("integer", $this->isRequired())
252 ,"pos" => array("integer", $this->getPosition())
253 ,"def" => array("text", is_array($this->getDefinition())
254 ? serialize($this->getDefinition())
255 : null)
256 );
257 }

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 201 of file class.ilExcCriteria.php.

201 : ?array
202 {
203 return $this->def;
204 }

References $def.

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

+ Here is the caller graph for this function:

◆ getDescription()

ilExcCriteria::getDescription ( )

◆ getHTML()

ilExcCriteria::getHTML (   $a_value)
abstract

◆ getId()

◆ getInstanceById()

static ilExcCriteria::getInstanceById ( int  $a_id)
static

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

55 {
56 global $DIC;
57
58 $ilDB = $DIC->database();
59
60 $set = $ilDB->query("SELECT *" .
61 " FROM exc_crit" .
62 " WHERE id = " . $ilDB->quote($a_id, "integer"));
63 if ($ilDB->numRows($set)) {
64 $row = $ilDB->fetchAssoc($set);
65 $obj = self::getInstanceByType($row["type"]);
66 $obj->importFromDB($row);
67 return $obj;
68 }
69
70 return null;
71 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $DIC, $ilDB, 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 ( string  $a_type)
static

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

124 {
125 $class = "ilExcCriteria" . ucfirst($a_type);
126 return new $class();
127 }

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

+ Here is the caller graph for this function:

◆ getInstancesByParentId()

static ilExcCriteria::getInstancesByParentId ( int  $a_parent_id)
static
Parameters
int$a_parent_id
Returns
ilExcCriteria[]

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

77 : array
78 {
79 global $DIC;
80
81 $ilDB = $DIC->database();
82
83 $res = array();
84
85 $set = $ilDB->query("SELECT *" .
86 " FROM exc_crit" .
87 " WHERE parent = " . $ilDB->quote($a_parent_id, "integer") .
88 " ORDER BY pos");
89 while ($row = $ilDB->fetchAssoc($set)) {
90 $obj = self::getInstanceByType($row["type"]);
91 $obj->importFromDB($row);
92 $res[$obj->getId()] = $obj;
93 }
94
95 return $res;
96 }
$res
Definition: ltiservices.php:69

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

Referenced by ilExcCriteriaCatalogue\cloneObject(), ilExcCriteriaGUI\confirmDeletion(), ilExcCriteriaGUI\delete(), ilExcCriteriaCatalogueTableGUI\getItems(), ilExcCriteriaTableGUI\getItems(), 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 259 of file class.ilExcCriteria.php.

259 : int
260 {
262
263 if (!$this->getParent()) {
264 return 0;
265 }
266
267 $set = $ilDB->query("SELECT MAX(pos) pos" .
268 " FROM exc_crit" .
269 " WHERE parent = " . $ilDB->quote($this->getParent(), "integer"));
270 $row = $ilDB->fetchAssoc($set);
271 return (int) $row["pos"];
272 }

References $db, $ilDB, 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 151 of file class.ilExcCriteria.php.

151 : ?int
152 {
153 return $this->parent;
154 }

References $parent.

Referenced by getLastPosition(), and save().

+ Here is the caller graph for this function:

◆ getPosition()

ilExcCriteria::getPosition ( )

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

191 : int
192 {
193 return $this->pos;
194 }

References $pos.

Referenced by cloneObject(), and getDBProperties().

+ Here is the caller graph for this function:

◆ getTitle()

ilExcCriteria::getTitle ( )

◆ getTranslatedType()

ilExcCriteria::getTranslatedType ( )

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

117 : string
118 {
119 $map = $this->getTypesMap();
120 return $map[$this->getType()];
121 }

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 103 of file class.ilExcCriteria.php.

103 : array
104 {
105 global $DIC;
106
107 $lng = $DIC->language();
108
109 return array(
110 "bool" => $lng->txt("exc_criteria_type_bool")
111 ,"rating" => $lng->txt("exc_criteria_type_rating")
112 ,"text" => $lng->txt("exc_criteria_type_text")
113 ,"file" => $lng->txt("exc_criteria_type_file")
114 );
115 }
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...

References $DIC, $lng, and ilLanguage\txt().

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

+ Here is the call graph for this function:
+ 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 363 of file class.ilExcCriteria.php.

363 : void
364 {
365 // type-specific
366 }

◆ importDefinition()

ilExcCriteria::importDefinition ( string  $a_def,
string  $a_def_json 
)

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

206 : void
207 {
208 // see #23711
209 // use json, if given
210 if ($a_def_json != "") {
211 $def = json_decode($a_def_json, true);
212 if (is_array($def)) {
213 $this->setDefinition($def);
214 }
215 return;
216 }
217
218 // use unserialize only if php > 7
219 if ($a_def != "" && version_compare(PHP_VERSION, '7.0.0') >= 0) {
220 $a_def = unserialize($a_def, ['allowed_classes' => false]);
221 if (is_array($a_def)) {
222 $this->setDefinition($a_def);
223 }
224 }
225 }
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 232 of file class.ilExcCriteria.php.

233 {
234 $this->setId((int) $a_row["id"]);
235 $this->setParent((int) $a_row["parent"]);
236 $this->setTitle((string) $a_row["title"]);
237 $this->setDescription((string) $a_row["descr"]);
238 $this->setRequired((bool) $a_row["required"]);
239 $this->setPosition((int) $a_row["pos"]);
240 $this->setDefinition((string) $a_row["def"]
241 ? unserialize($a_row["def"], ['allowed_classes' => false])
242 : null);
243 }
setRequired(bool $a_value)
setTitle(?string $a_value)
setPosition(int $a_value)
setDescription(?string $a_value)
setParent(?int $a_value)

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 353 of file class.ilExcCriteria.php.

353 : void
354 {
355 // type-specific
356 }

Referenced by ilExcCriteriaGUI\initForm().

+ Here is the caller graph for this function:

◆ isRequired()

◆ resetReview()

ilExcCriteria::resetReview ( )

Reimplemented in ilExcCriteriaFile, and ilExcCriteriaRating.

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

402 {
403 // type-specific (only needed for data not kept in exc_assignment_peer)
404 }

◆ save()

ilExcCriteria::save ( )

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

274 : void
275 {
277
278 if ($this->id) {
279 $this->update();
280 return;
281 }
282
283 $this->id = $ilDB->nextId("exc_crit");
284
285 $fields = $this->getDBProperties();
286
287 $fields["id"] = array("integer", $this->id);
288 $fields["type"] = array("text", $this->getType());
289 $fields["parent"] = array("integer", $this->getParent());
290 $fields["pos"] = array("integer", $this->getLastPosition() + 10);
291
292 $ilDB->insert("exc_crit", $fields);
293 }

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

Referenced by 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 196 of file class.ilExcCriteria.php.

197 {
198 $this->def = $a_value;
199 }

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

+ Here is the caller graph for this function:

◆ setDescription()

ilExcCriteria::setDescription ( ?string  $a_value)

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

166 : void
167 {
168 $this->desc = $a_value;
169 }

Referenced by importFromDB().

+ Here is the caller graph for this function:

◆ setId()

ilExcCriteria::setId ( ?int  $a_id)
protected

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

139 : void
140 {
141 $this->id = $a_id;
142 }

Referenced by importFromDB().

+ Here is the caller graph for this function:

◆ setParent()

ilExcCriteria::setParent ( ?int  $a_value)

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

146 : void
147 {
148 $this->parent = $a_value;
149 }

Referenced by importFromDB().

+ Here is the caller graph for this function:

◆ setPeerReviewContext()

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

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

376 {
377 $this->form = $a_form;
378 $this->ass = $a_ass;
379 $this->giver_id = $a_giver_id;
380 $this->peer_id = $a_peer_id;
381 }
form( $class_path, string $cmd)

References ILIAS\Repository\form().

+ Here is the call graph for this function:

◆ setPosition()

ilExcCriteria::setPosition ( int  $a_value)

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

186 : void
187 {
188 $this->pos = $a_value;
189 }

Referenced by importFromDB().

+ Here is the caller graph for this function:

◆ setRequired()

ilExcCriteria::setRequired ( bool  $a_value)

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

176 : void
177 {
178 $this->required = $a_value;
179 }

Referenced by importFromDB().

+ Here is the caller graph for this function:

◆ setTitle()

ilExcCriteria::setTitle ( ?string  $a_value)

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

156 : void
157 {
158 $this->title = $a_value;
159 }

Referenced by importFromDB().

+ Here is the caller graph for this function:

◆ update()

ilExcCriteria::update ( )

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

295 : void
296 {
298
299 if (!$this->id) {
300 $this->save();
301 return;
302 }
303
304 $primary = array("id" => array("integer", $this->id));
305 $ilDB->update("exc_crit", $this->getDBProperties(), $primary);
306 }

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

Referenced by 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 387 of file class.ilExcCriteria.php.

387 : string
388 {
389 return "";
390 }

◆ validate()

ilExcCriteria::validate (   $a_value)

Reimplemented in ilExcCriteriaFile, ilExcCriteriaRating, and ilExcCriteriaText.

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

392 : bool
393 {
394 return true;
395 }

Field Documentation

◆ $ass

ilExAssignment ilExcCriteria::$ass
protected

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

◆ $ctrl

ilCtrl ilExcCriteria::$ctrl
protected

◆ $db

ilDBInterface ilExcCriteria::$db
protected

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

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

◆ $def

array ilExcCriteria::$def = null
protected

◆ $desc

string ilExcCriteria::$desc = ""
protected

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

Referenced by getDescription().

◆ $form

ilPropertyFormGUI ilExcCriteria::$form = null
protected

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

◆ $giver_id

int ilExcCriteria::$giver_id = 0
protected

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

◆ $id

int ilExcCriteria::$id = null
protected

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

Referenced by getId().

◆ $lng

◆ $parent

int ilExcCriteria::$parent = null
protected

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

Referenced by getParent().

◆ $peer_id

int ilExcCriteria::$peer_id = 0
protected

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

◆ $pos

int ilExcCriteria::$pos = 0
protected

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

Referenced by getPosition().

◆ $required

bool ilExcCriteria::$required = false
protected

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

Referenced by isRequired().

◆ $title

string ilExcCriteria::$title = ""
protected

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

Referenced by getTitle().


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