ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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)
 
 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

◆ cloneObject()

ilExcCriteria::cloneObject (   $a_target_parent_id)

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

300 {
301 $new_obj = ilExcCriteria::getInstanceByType($this->getType());
302 $new_obj->setParent($a_target_parent_id);
303 $new_obj->setTitle($this->getTitle());
304 $new_obj->setDescription($this->getDescription());
305 $new_obj->setRequired($this->isRequired());
306 $new_obj->setPosition($this->getPosition());
307 $new_obj->setDefinition($this->getDefinition());
308 $new_obj->save();
309
310 return $new_obj->getId();
311 }
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 273 of file class.ilExcCriteria.php.

274 {
275 global $ilDB;
276
277 if(!$this->id)
278 {
279 return;
280 }
281
282 $ilDB->manipulate("DELETE FROM exc_crit".
283 " WHERE id = ".$ilDB->quote($this->id, "integer"));
284 }
global $ilDB

References $ilDB.

◆ deleteByParent()

static ilExcCriteria::deleteByParent (   $a_parent_id)
static

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

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

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

324 {
325 // type-specific
326 }

Referenced by ilExcCriteriaGUI\exportForm().

+ Here is the caller graph for this function:

◆ getDBProperties()

ilExcCriteria::getDBProperties ( )
protected

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

211 {
212 return array(
213 "type" => array("text", $this->getType())
214 ,"title" => array("text", $this->getTitle())
215 ,"descr" => array("text", $this->getDescription())
216 ,"required" => array("integer", $this->isRequired())
217 ,"pos" => array("integer", $this->getPosition())
218 ,"def" => array("text", is_array($this->getDefinition())
219 ? serialize($this->getDefinition())
220 : null)
221 );
222 }

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

176 {
177 return $this->def;
178 }

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

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 }

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

91 {
92 $class = "ilExcCriteria".ucfirst($a_type);
93 include_once "Modules/Exercise/classes/class.".$class.".php";
94 return new $class;
95 }

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

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 }

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

224 {
225 global $ilDB;
226
227 if(!$this->getParent())
228 {
229 return;
230 }
231
232 $set = $ilDB->query("SELECT MAX(pos) pos".
233 " FROM exc_crit".
234 " WHERE parent = ".$ilDB->quote($this->getParent(), "integer"));
235 $row = $ilDB->fetchAssoc($set);
236 return (int)$row["pos"];
237 }

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

122 {
123 return $this->parent;
124 }

References $parent.

Referenced by getLastPosition(), and save().

+ Here is the caller graph for this function:

◆ getPosition()

ilExcCriteria::getPosition ( )

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

166 {
167 return $this->pos;
168 }

References $pos.

Referenced by cloneObject(), and getDBProperties().

+ Here is the caller graph for this function:

◆ getTitle()

◆ getTranslatedType()

ilExcCriteria::getTranslatedType ( )

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

85 {
86 $map = $this->getTypesMap();
87 return $map[$this->getType()];
88 }

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

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 }
global $lng
Definition: privfeed.php:40

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

329 {
330 // type-specific
331 }

Referenced by ilExcCriteriaGUI\importForm().

+ Here is the caller graph for this function:

◆ importDefinition()

ilExcCriteria::importDefinition (   $a_def)

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

181 {
182 if($a_def)
183 {
184 $a_def = @unserialize($a_def);
185 if(is_array($a_def))
186 {
187 $this->setDefinition($a_def);
188 }
189 }
190 }
setDefinition(array $a_value=null)

References setDefinition().

+ Here is the call graph for this function:

◆ importFromDB()

ilExcCriteria::importFromDB ( array  $a_row)
protected

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

198 {
199 $this->setId($a_row["id"]);
200 $this->setParent($a_row["parent"]);
201 $this->setTitle($a_row["title"]);
202 $this->setDescription($a_row["descr"]);
203 $this->setRequired($a_row["required"]);
204 $this->setPosition($a_row["pos"]);
205 $this->setDefinition($a_row["def"]
206 ? unserialize($a_row["def"])
207 : null);
208 }

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

319 {
320 // type-specific
321 }

Referenced by ilExcCriteriaGUI\initForm().

+ Here is the caller graph for this function:

◆ isRequired()

◆ resetReview()

ilExcCriteria::resetReview ( )

Reimplemented in ilExcCriteriaFile, and ilExcCriteriaRating.

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

363 {
364 // type-specific (only needed for data not kept in exc_assignment_peer)
365 }

◆ save()

ilExcCriteria::save ( )

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

240 {
241 global $ilDB;
242
243 if($this->id)
244 {
245 return $this->update();
246 }
247
248 $this->id = $ilDB->nextId("exc_crit");
249
250 $fields = $this->getDBProperties();
251
252 $fields["id"] = array("integer", $this->id);
253 $fields["type"] = array("text", $this->getType());
254 $fields["parent"] = array("integer", $this->getParent());
255 $fields["pos"] = array("integer", $this->getLastPosition()+10);
256
257 $ilDB->insert("exc_crit", $fields);
258 }

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

171 {
172 $this->def = $a_value;
173 }

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

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

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

+ Here is the caller graph for this function:

◆ setId()

ilExcCriteria::setId (   $a_id)
protected

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

108 {
109 $this->id = (int)$a_id;
110 }

Referenced by importFromDB().

+ Here is the caller graph for this function:

◆ setParent()

ilExcCriteria::setParent (   $a_value)

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

115 {
116 $this->parent = ($a_value !== null)
117 ? (int)$a_value
118 : null;
119 }

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

337 {
338 $this->form = $a_form;
339 $this->ass = $a_ass;
340 $this->giver_id = $a_giver_id;
341 $this->peer_id = $a_peer_id;
342 }

◆ setPosition()

ilExcCriteria::setPosition (   $a_value)

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

161 {
162 $this->pos = (int)$a_value;
163 }

Referenced by importFromDB().

+ Here is the caller graph for this function:

◆ setRequired()

ilExcCriteria::setRequired (   $a_value)

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

151 {
152 $this->required = (bool)$a_value;
153 }

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

+ Here is the caller graph for this function:

◆ setTitle()

ilExcCriteria::setTitle (   $a_value)

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

127 {
128 $this->title = ($a_value !== null)
129 ? trim($a_value)
130 : null;
131 }

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

+ Here is the caller graph for this function:

◆ update()

ilExcCriteria::update ( )

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

261 {
262 global $ilDB;
263
264 if(!$this->id)
265 {
266 return $this->save();
267 }
268
269 $primary = array("id"=>array("integer", $this->id));
270 $ilDB->update("exc_crit", $this->getDBProperties(), $primary);
271 }

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

349 {
350 // type-specific
351 }

◆ validate()

ilExcCriteria::validate (   $a_value)

Reimplemented in ilExcCriteriaFile, ilExcCriteriaRating, and ilExcCriteriaText.

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

354 {
355 return true;
356 }

Field Documentation

◆ $ass

ilExcCriteria::$ass
protected

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

◆ $def

ilExcCriteria::$def
protected

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

Referenced by getDefinition(), and ilExcCriteriaText\getMinChars().

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

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

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

ilExcCriteria::$peer_id
protected

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

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