ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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

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

27  {
28 
29  }

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

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

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

◆ delete()

ilExcCriteria::delete ( )

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

References $ilDB.

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

◆ deleteByParent()

static ilExcCriteria::deleteByParent (   $a_parent_id)
static

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

References $ilDB.

Referenced by ilExcCriteriaCatalogue\delete().

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

◆ exportCustomForm()

ilExcCriteria::exportCustomForm ( ilPropertyFormGUI  $a_form)

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

Referenced by ilExcCriteriaGUI\exportForm().

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

◆ getDBProperties()

ilExcCriteria::getDBProperties ( )
protected

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

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

Referenced by save(), and update().

224  {
225  return array(
226  "type" => array("text", $this->getType())
227  ,"title" => array("text", $this->getTitle())
228  ,"descr" => array("text", $this->getDescription())
229  ,"required" => array("integer", $this->isRequired())
230  ,"pos" => array("integer", $this->getPosition())
231  ,"def" => array("text", is_array($this->getDefinition())
232  ? serialize($this->getDefinition())
233  : null)
234  );
235  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDefinition()

ilExcCriteria::getDefinition ( )
protected

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

References $def.

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

176  {
177  return $this->def;
178  }
+ 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 31 of file class.ilExcCriteria.php.

References $ilDB, and $row.

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

32  {
33  global $ilDB;
34 
35  $set = $ilDB->query("SELECT *".
36  " FROM exc_crit".
37  " WHERE id = ".$ilDB->quote($a_id, "integer"));
38  if($ilDB->numRows($set))
39  {
40  $row = $ilDB->fetchAssoc($set);
41  $obj = self::getInstanceByType($row["type"]);
42  $obj->importFromDB($row);
43  return $obj;
44  }
45  }
global $ilDB
+ Here is the caller graph for this function:

◆ getInstanceByType()

static ilExcCriteria::getInstanceByType (   $a_type)
static

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

References $a_type.

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

91  {
92  $class = "ilExcCriteria".ucfirst($a_type);
93  include_once "Modules/Exercise/classes/class.".$class.".php";
94  return new $class;
95  }
$a_type
Definition: workflow.php:93
+ Here is the caller graph for this function:

◆ getInstancesByParentId()

static ilExcCriteria::getInstancesByParentId (   $a_parent_id)
static

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

References $ilDB, $res, $row, and array.

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

48  {
49  global $ilDB;
50 
51  $res = array();
52 
53  $set = $ilDB->query("SELECT *".
54  " FROM exc_crit".
55  " WHERE parent = ".$ilDB->quote($a_parent_id, "integer").
56  " ORDER BY pos");
57  while($row = $ilDB->fetchAssoc($set))
58  {
59  $obj = self::getInstanceByType($row["type"]);
60  $obj->importFromDB($row);
61  $res[$obj->getId()] = $obj;
62  }
63 
64  return $res;
65  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ getLastPosition()

ilExcCriteria::getLastPosition ( )
protected

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

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

Referenced by save().

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

◆ getParent()

ilExcCriteria::getParent ( )

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

References $parent.

Referenced by getLastPosition(), and save().

122  {
123  return $this->parent;
124  }
+ Here is the caller graph for this function:

◆ getPosition()

ilExcCriteria::getPosition ( )

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

References $pos.

Referenced by cloneObject(), and getDBProperties().

166  {
167  return $this->pos;
168  }
+ Here is the caller graph for this function:

◆ getTitle()

◆ getTranslatedType()

ilExcCriteria::getTranslatedType ( )

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

References getType(), and getTypesMap().

Referenced by ilExcCriteriaGUI\initForm().

85  {
86  $map = $this->getTypesMap();
87  return $map[$this->getType()];
88  }
+ 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 72 of file class.ilExcCriteria.php.

References $lng, and array.

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

73  {
74  global $lng;
75 
76  return array(
77  "bool" => $lng->txt("exc_criteria_type_bool")
78  ,"rating" => $lng->txt("exc_criteria_type_rating")
79  ,"text" => $lng->txt("exc_criteria_type_text")
80  ,"file" => $lng->txt("exc_criteria_type_file")
81  );
82  }
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
+ 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 341 of file class.ilExcCriteria.php.

Referenced by ilExcCriteriaGUI\importForm().

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

◆ importDefinition()

ilExcCriteria::importDefinition (   $a_def,
  $a_def_json 
)

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

References $def, and setDefinition().

181  {
182  // see #23711
183  // use json, if given
184  if ($a_def_json != "")
185  {
186  $def = json_decode($a_def_json, true);
187  if (is_array($def))
188  {
189  $this->setDefinition($def);
190  }
191  return;
192  }
193 
194  // use unserialize only if php > 7
195  if ($a_def != "" && version_compare(PHP_VERSION, '7.0.0') >= 0)
196  {
197  $a_def = @unserialize($a_def, false);
198  if(is_array($a_def))
199  {
200  $this->setDefinition($a_def);
201  }
202  }
203  }
setDefinition(array $a_value=null)
+ Here is the call graph for this function:

◆ importFromDB()

ilExcCriteria::importFromDB ( array  $a_row)
protected

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

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

211  {
212  $this->setId($a_row["id"]);
213  $this->setParent($a_row["parent"]);
214  $this->setTitle($a_row["title"]);
215  $this->setDescription($a_row["descr"]);
216  $this->setRequired($a_row["required"]);
217  $this->setPosition($a_row["pos"]);
218  $this->setDefinition($a_row["def"]
219  ? unserialize($a_row["def"])
220  : null);
221  }
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 331 of file class.ilExcCriteria.php.

Referenced by ilExcCriteriaGUI\initForm().

332  {
333  // type-specific
334  }
+ Here is the caller graph for this function:

◆ isRequired()

◆ resetReview()

ilExcCriteria::resetReview ( )

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

376  {
377  // type-specific (only needed for data not kept in exc_assignment_peer)
378  }

◆ save()

ilExcCriteria::save ( )

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

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

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

253  {
254  global $ilDB;
255 
256  if($this->id)
257  {
258  return $this->update();
259  }
260 
261  $this->id = $ilDB->nextId("exc_crit");
262 
263  $fields = $this->getDBProperties();
264 
265  $fields["id"] = array("integer", $this->id);
266  $fields["type"] = array("text", $this->getType());
267  $fields["parent"] = array("integer", $this->getParent());
268  $fields["pos"] = array("integer", $this->getLastPosition()+10);
269 
270  $ilDB->insert("exc_crit", $fields);
271  }
Create styles array
The data for the language used.
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 170 of file class.ilExcCriteria.php.

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

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

◆ setDescription()

ilExcCriteria::setDescription (   $a_value)

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

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

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

◆ setId()

ilExcCriteria::setId (   $a_id)
protected

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

References getType().

Referenced by importFromDB().

108  {
109  $this->id = (int)$a_id;
110  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setParent()

ilExcCriteria::setParent (   $a_value)

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

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

115  {
116  $this->parent = ($a_value !== null)
117  ? (int)$a_value
118  : null;
119  }
+ 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 349 of file class.ilExcCriteria.php.

References addToPeerReviewForm(), and importFromPeerReviewForm().

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

◆ setPosition()

ilExcCriteria::setPosition (   $a_value)

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

Referenced by importFromDB().

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

◆ setRequired()

ilExcCriteria::setRequired (   $a_value)

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

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

151  {
152  $this->required = (bool)$a_value;
153  }
+ Here is the caller graph for this function:

◆ setTitle()

ilExcCriteria::setTitle (   $a_value)

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

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

127  {
128  $this->title = ($a_value !== null)
129  ? trim($a_value)
130  : null;
131  }
+ Here is the caller graph for this function:

◆ update()

ilExcCriteria::update ( )

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

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

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

274  {
275  global $ilDB;
276 
277  if(!$this->id)
278  {
279  return $this->save();
280  }
281 
282  $primary = array("id"=>array("integer", $this->id));
283  $ilDB->update("exc_crit", $this->getDBProperties(), $primary);
284  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateFromAjax()

ilExcCriteria::updateFromAjax ( )

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

362  {
363  // type-specific
364  }

◆ validate()

ilExcCriteria::validate (   $a_value)

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

References getHTML(), and hasValue().

367  {
368  return true;
369  }
+ Here is the call graph for this function:

Field Documentation

◆ $ass

ilExcCriteria::$ass
protected

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

◆ $def

ilExcCriteria::$def
protected

◆ $desc

ilExcCriteria::$desc
protected

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

Referenced by getDescription().

◆ $form

ilExcCriteria::$form
protected

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

◆ $giver_id

ilExcCriteria::$giver_id
protected

◆ $id

ilExcCriteria::$id
protected

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

Referenced by getId().

◆ $parent

ilExcCriteria::$parent
protected

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

Referenced by getParent().

◆ $peer_id

◆ $pos

ilExcCriteria::$pos
protected

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

Referenced by getPosition().

◆ $required

ilExcCriteria::$required
protected

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

Referenced by isRequired().

◆ $title

ilExcCriteria::$title
protected

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

Referenced by getTitle().


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