ILIAS  release_7 Revision v7.30-3-g800a261c036
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

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

References $DIC.

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

Member Function Documentation

◆ addToPeerReviewForm()

ilExcCriteria::addToPeerReviewForm (   $a_value = null)
abstract

Referenced by setPeerReviewContext().

+ Here is the caller graph for this function:

◆ cloneObject()

ilExcCriteria::cloneObject (   $a_target_parent_id)

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

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

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

◆ delete()

ilExcCriteria::delete ( )

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

References $db, and $ilDB.

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

◆ deleteByParent()

static ilExcCriteria::deleteByParent (   $a_parent_id)
static

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

References $DIC, and $ilDB.

Referenced by ilExcCriteriaCatalogue\delete().

302  {
303  global $DIC;
304 
305  $ilDB = $DIC->database();
306 
307  if (!(int) $a_parent_id) {
308  return;
309  }
310 
311  $ilDB->manipulate("DELETE FROM exc_crit" .
312  " WHERE parent = " . $ilDB->quote($a_parent_id, "integer"));
313  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ exportCustomForm()

ilExcCriteria::exportCustomForm ( ilPropertyFormGUI  $a_form)

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

Referenced by ilExcCriteriaGUI\exportForm().

340  {
341  // type-specific
342  }
+ Here is the caller graph for this function:

◆ getDBProperties()

ilExcCriteria::getDBProperties ( )
protected

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

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

Referenced by save(), and update().

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

◆ getDefinition()

ilExcCriteria::getDefinition ( )
protected

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

References $def.

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

186  {
187  return $this->def;
188  }
+ Here is the caller graph for this function:

◆ getDescription()

◆ getHTML()

ilExcCriteria::getHTML (   $a_value)
abstract

Referenced by validate().

+ Here is the caller graph for this function:

◆ getId()

◆ getInstanceById()

static ilExcCriteria::getInstanceById (   $a_id)
static

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

References $DIC, and $ilDB.

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

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  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ getInstanceByType()

static ilExcCriteria::getInstanceByType (   $a_type)
static

◆ getInstancesByParentId()

static ilExcCriteria::getInstancesByParentId (   $a_parent_id)
static

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

References $DIC, $ilDB, and $res.

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

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
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ getLastPosition()

ilExcCriteria::getLastPosition ( )
protected

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

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

Referenced by save().

243  {
244  $ilDB = $this->db;
245 
246  if (!$this->getParent()) {
247  return;
248  }
249 
250  $set = $ilDB->query("SELECT MAX(pos) pos" .
251  " FROM exc_crit" .
252  " WHERE parent = " . $ilDB->quote($this->getParent(), "integer"));
253  $row = $ilDB->fetchAssoc($set);
254  return (int) $row["pos"];
255  }
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParent()

ilExcCriteria::getParent ( )

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

References $parent.

Referenced by getLastPosition(), and save().

132  {
133  return $this->parent;
134  }
+ Here is the caller graph for this function:

◆ getPosition()

ilExcCriteria::getPosition ( )

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

References $pos.

Referenced by cloneObject(), and getDBProperties().

176  {
177  return $this->pos;
178  }
+ Here is the caller graph for this function:

◆ getTitle()

◆ getTranslatedType()

ilExcCriteria::getTranslatedType ( )

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

References getType(), and getTypesMap().

Referenced by ilExcCriteriaGUI\initForm().

96  {
97  $map = $this->getTypesMap();
98  return $map[$this->getType()];
99  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getType()

ilExcCriteria::getType ( )
abstract

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

+ Here is the caller graph for this function:

◆ getTypesMap()

static ilExcCriteria::getTypesMap ( )
static

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

References $DIC, and $lng.

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

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  }
$lng
global $DIC
Definition: goto.php:24
+ Here is the caller graph for this function:

◆ hasValue()

ilExcCriteria::hasValue (   $a_value)
abstract

Referenced by validate().

+ Here is the caller graph for this function:

◆ importCustomForm()

ilExcCriteria::importCustomForm ( ilPropertyFormGUI  $a_form)

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

Referenced by ilExcCriteriaGUI\importForm().

345  {
346  // type-specific
347  }
+ Here is the caller graph for this function:

◆ importDefinition()

ilExcCriteria::importDefinition (   $a_def,
  $a_def_json 
)

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

References $def, and setDefinition().

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

◆ importFromDB()

ilExcCriteria::importFromDB ( array  $a_row)
protected

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

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

217  {
218  $this->setId($a_row["id"]);
219  $this->setParent($a_row["parent"]);
220  $this->setTitle($a_row["title"]);
221  $this->setDescription($a_row["descr"]);
222  $this->setRequired($a_row["required"]);
223  $this->setPosition($a_row["pos"]);
224  $this->setDefinition($a_row["def"]
225  ? unserialize($a_row["def"])
226  : null);
227  }
setDefinition(array $a_value=null)
+ Here is the call graph for this function:

◆ importFromPeerReviewForm()

ilExcCriteria::importFromPeerReviewForm ( )
abstract

Referenced by setPeerReviewContext().

+ Here is the caller graph for this function:

◆ initCustomForm()

ilExcCriteria::initCustomForm ( ilPropertyFormGUI  $a_form)

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

Referenced by ilExcCriteriaGUI\initForm().

335  {
336  // type-specific
337  }
+ Here is the caller graph for this function:

◆ isRequired()

◆ resetReview()

ilExcCriteria::resetReview ( )

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

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

◆ save()

ilExcCriteria::save ( )

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

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

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

258  {
259  $ilDB = $this->db;
260 
261  if ($this->id) {
262  return $this->update();
263  }
264 
265  $this->id = $ilDB->nextId("exc_crit");
266 
267  $fields = $this->getDBProperties();
268 
269  $fields["id"] = array("integer", $this->id);
270  $fields["type"] = array("text", $this->getType());
271  $fields["parent"] = array("integer", $this->getParent());
272  $fields["pos"] = array("integer", $this->getLastPosition() + 10);
273 
274  $ilDB->insert("exc_crit", $fields);
275  }
global $ilDB
+ 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 180 of file class.ilExcCriteria.php.

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

181  {
182  $this->def = $a_value;
183  }
+ Here is the caller graph for this function:

◆ setDescription()

ilExcCriteria::setDescription (   $a_value)

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

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

149  {
150  $this->desc = ($a_value !== null)
151  ? trim($a_value)
152  : null;
153  }
+ Here is the caller graph for this function:

◆ setId()

ilExcCriteria::setId (   $a_id)
protected

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

References getType().

Referenced by importFromDB().

118  {
119  $this->id = (int) $a_id;
120  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setParent()

ilExcCriteria::setParent (   $a_value)

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

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

125  {
126  $this->parent = ($a_value !== null)
127  ? (int) $a_value
128  : null;
129  }
+ 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 352 of file class.ilExcCriteria.php.

References addToPeerReviewForm(), and importFromPeerReviewForm().

353  {
354  $this->form = $a_form;
355  $this->ass = $a_ass;
356  $this->giver_id = $a_giver_id;
357  $this->peer_id = $a_peer_id;
358  }
+ Here is the call graph for this function:

◆ setPosition()

ilExcCriteria::setPosition (   $a_value)

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

Referenced by importFromDB().

171  {
172  $this->pos = (int) $a_value;
173  }
+ Here is the caller graph for this function:

◆ setRequired()

ilExcCriteria::setRequired (   $a_value)

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

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

161  {
162  $this->required = (bool) $a_value;
163  }
+ Here is the caller graph for this function:

◆ setTitle()

ilExcCriteria::setTitle (   $a_value)

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

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

137  {
138  $this->title = ($a_value !== null)
139  ? trim($a_value)
140  : null;
141  }
+ Here is the caller graph for this function:

◆ update()

ilExcCriteria::update ( )

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

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

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

278  {
279  $ilDB = $this->db;
280 
281  if (!$this->id) {
282  return $this->save();
283  }
284 
285  $primary = array("id" => array("integer", $this->id));
286  $ilDB->update("exc_crit", $this->getDBProperties(), $primary);
287  }
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateFromAjax()

ilExcCriteria::updateFromAjax ( )

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

365  {
366  // type-specific
367  }

◆ validate()

ilExcCriteria::validate (   $a_value)

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

References getHTML(), and hasValue().

370  {
371  return true;
372  }
+ Here is the call graph for this function:

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

◆ $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

◆ $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: