ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilExcCriteriaCatalogue Class Reference

Class ilExcCriteriaCatalogue. More...

+ Collaboration diagram for ilExcCriteriaCatalogue:

Public Member Functions

 __construct ($a_id=null)
 
 getId ()
 
 setParent ($a_value)
 
 getParent ()
 
 setTitle ($a_value)
 
 getTitle ()
 
 setPosition ($a_value)
 
 getPosition ()
 
 save ()
 
 update ()
 
 delete ()
 
 cloneObject ($a_target_parent_id)
 

Static Public Member Functions

static getInstancesByParentId ($a_parent_id)
 
static deleteByParent ($a_parent_id)
 

Protected Member Functions

 setId ($a_id)
 
 importFromDB (array $a_row)
 
 getDBProperties ()
 
 getLastPosition ()
 
 read ($a_id)
 

Protected Attributes

 $id
 
 $parent
 
 $title
 
 $pos
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilExcCriteriaCatalogue::__construct (   $a_id = null)

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

References read().

19  {
20  $this->read($a_id);
21  }
+ Here is the call graph for this function:

Member Function Documentation

◆ cloneObject()

ilExcCriteriaCatalogue::cloneObject (   $a_target_parent_id)

Definition at line 207 of file class.ilExcCriteriaCatalogue.php.

References getId(), ilExcCriteria\getInstancesByParentId(), getPosition(), and getTitle().

208  {
209  $new_obj = new self();
210  $new_obj->setParent($a_target_parent_id);
211  $new_obj->setTitle($this->getTitle());
212  $new_obj->setPosition($this->getPosition());
213  $new_obj->save();
214 
215  include_once "Modules/Exercise/classes/class.ilExcCriteria.php";
216  foreach(ilExcCriteria::getInstancesByParentId($this->getId()) as $crit)
217  {
218  $crit->cloneObject($new_obj->getId());
219  }
220 
221  return $new_obj->getId();
222  }
static getInstancesByParentId($a_parent_id)
+ Here is the call graph for this function:

◆ delete()

ilExcCriteriaCatalogue::delete ( )

Definition at line 178 of file class.ilExcCriteriaCatalogue.php.

References $ilDB, and ilExcCriteria\deleteByParent().

179  {
180  global $ilDB;
181 
182  if(!$this->id)
183  {
184  return;
185  }
186 
187  include_once "Modules/Exercise/classes/class.ilExcCriteria.php";
189 
190  $ilDB->manipulate("DELETE FROM exc_crit_cat".
191  " WHERE id = ".$ilDB->quote($this->id, "integer"));
192  }
static deleteByParent($a_parent_id)
global $ilDB
+ Here is the call graph for this function:

◆ deleteByParent()

static ilExcCriteriaCatalogue::deleteByParent (   $a_parent_id)
static

Definition at line 194 of file class.ilExcCriteriaCatalogue.php.

References $ilDB.

Referenced by ilObjExercise\delete().

195  {
196  global $ilDB;
197 
198  if(!(int)$a_parent_id)
199  {
200  return;
201  }
202 
203  $ilDB->manipulate("DELETE FROM exc_crit".
204  " WHERE parent = ".$ilDB->quote($a_parent_id, "integer"));
205  }
global $ilDB
+ Here is the caller graph for this function:

◆ getDBProperties()

ilExcCriteriaCatalogue::getDBProperties ( )
protected

Definition at line 105 of file class.ilExcCriteriaCatalogue.php.

References array, getPosition(), and getTitle().

Referenced by save(), and update().

106  {
107  return array(
108  "title" => array("text", $this->getTitle())
109  ,"pos" => array("integer", $this->getPosition())
110  );
111  }
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:

◆ getId()

ilExcCriteriaCatalogue::getId ( )

Definition at line 48 of file class.ilExcCriteriaCatalogue.php.

References $id.

Referenced by cloneObject().

+ Here is the caller graph for this function:

◆ getInstancesByParentId()

static ilExcCriteriaCatalogue::getInstancesByParentId (   $a_parent_id)
static

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

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

Referenced by ilObjExercise\cloneObject(), ilExcCriteriaCatalogueGUI\confirmDeletion(), ilExcCriteriaCatalogueGUI\delete(), ilExcCriteriaCatalogueTableGUI\getItems(), ilExAssignmentEditorGUI\initPeerReviewForm(), and ilExcCriteriaCatalogueGUI\saveOrder().

24  {
25  global $ilDB;
26 
27  $res = array();
28 
29  $set = $ilDB->query("SELECT *".
30  " FROM exc_crit_cat".
31  " WHERE parent = ".$ilDB->quote($a_parent_id, "integer").
32  " ORDER BY pos");
33  while($row = $ilDB->fetchAssoc($set))
34  {
35  $obj = new self();
36  $obj->importFromDB($row);
37  $res[$obj->getId()] = $obj;
38  }
39 
40  return $res;
41  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ getLastPosition()

ilExcCriteriaCatalogue::getLastPosition ( )
protected

Definition at line 112 of file class.ilExcCriteriaCatalogue.php.

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

Referenced by save().

113  {
114  global $ilDB;
115 
116  if(!$this->getParent())
117  {
118  return;
119  }
120 
121  $set = $ilDB->query("SELECT MAX(pos) pos".
122  " FROM exc_crit_cat".
123  " WHERE parent = ".$ilDB->quote($this->getParent(), "integer"));
124  $row = $ilDB->fetchAssoc($set);
125  return (int)$row["pos"];
126  }
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParent()

ilExcCriteriaCatalogue::getParent ( )

Definition at line 65 of file class.ilExcCriteriaCatalogue.php.

References $parent.

Referenced by getLastPosition(), and save().

+ Here is the caller graph for this function:

◆ getPosition()

ilExcCriteriaCatalogue::getPosition ( )

Definition at line 87 of file class.ilExcCriteriaCatalogue.php.

References $pos.

Referenced by cloneObject(), and getDBProperties().

+ Here is the caller graph for this function:

◆ getTitle()

ilExcCriteriaCatalogue::getTitle ( )

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

References $title.

Referenced by cloneObject(), ilExcCriteriaCatalogueGUI\exportForm(), and getDBProperties().

+ Here is the caller graph for this function:

◆ importFromDB()

ilExcCriteriaCatalogue::importFromDB ( array  $a_row)
protected

Definition at line 97 of file class.ilExcCriteriaCatalogue.php.

References setId(), setParent(), setPosition(), and setTitle().

Referenced by read().

98  {
99  $this->setId($a_row["id"]);
100  $this->setParent($a_row["parent"]);
101  $this->setTitle($a_row["title"]);
102  $this->setPosition($a_row["pos"]);
103  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilExcCriteriaCatalogue::read (   $a_id)
protected

Definition at line 128 of file class.ilExcCriteriaCatalogue.php.

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

Referenced by __construct().

129  {
130  global $ilDB;
131 
132  $a_id = (int)$a_id;
133  if($a_id)
134  {
135  $set = $ilDB->query("SELECT *".
136  " FROM exc_crit_cat".
137  " WHERE id = ".$ilDB->quote($a_id, "integer"));
138  if($ilDB->numRows($set))
139  {
140  $row = $ilDB->fetchAssoc($set);
141  $this->importFromDB($row);
142  }
143  }
144  }
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilExcCriteriaCatalogue::save ( )

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

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

Referenced by update().

147  {
148  global $ilDB;
149 
150  if($this->id)
151  {
152  return $this->update();
153  }
154 
155  $this->id = $ilDB->nextId("exc_crit_cat");
156 
157  $fields = $this->getDBProperties();
158  $fields["parent"] = array("integer", $this->getParent());
159  $fields["pos"] = array("integer", $this->getLastPosition()+10);
160  $fields["id"] = array("integer", $this->id);
161 
162  $ilDB->insert("exc_crit_cat", $fields);
163  }
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:

◆ setId()

ilExcCriteriaCatalogue::setId (   $a_id)
protected

Definition at line 53 of file class.ilExcCriteriaCatalogue.php.

Referenced by importFromDB().

54  {
55  $this->id = (int)$a_id;
56  }
+ Here is the caller graph for this function:

◆ setParent()

ilExcCriteriaCatalogue::setParent (   $a_value)

Definition at line 58 of file class.ilExcCriteriaCatalogue.php.

Referenced by importFromDB().

59  {
60  $this->parent = ($a_value !== null)
61  ? (int)$a_value
62  : null;
63  }
+ Here is the caller graph for this function:

◆ setPosition()

ilExcCriteriaCatalogue::setPosition (   $a_value)

Definition at line 82 of file class.ilExcCriteriaCatalogue.php.

Referenced by importFromDB().

83  {
84  $this->pos = (int)$a_value;
85  }
+ Here is the caller graph for this function:

◆ setTitle()

ilExcCriteriaCatalogue::setTitle (   $a_value)

Definition at line 70 of file class.ilExcCriteriaCatalogue.php.

Referenced by importFromDB().

71  {
72  $this->title = ($a_value !== null)
73  ? trim($a_value)
74  : null;
75  }
+ Here is the caller graph for this function:

◆ update()

ilExcCriteriaCatalogue::update ( )

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

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

Referenced by save().

166  {
167  global $ilDB;
168 
169  if(!$this->id)
170  {
171  return $this->save();
172  }
173 
174  $primary = array("id"=>array("integer", $this->id));
175  $ilDB->update("exc_crit_cat", $this->getDBProperties(), $primary);
176  }
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:

Field Documentation

◆ $id

ilExcCriteriaCatalogue::$id
protected

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

Referenced by getId().

◆ $parent

ilExcCriteriaCatalogue::$parent
protected

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

Referenced by getParent().

◆ $pos

ilExcCriteriaCatalogue::$pos
protected

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

Referenced by getPosition().

◆ $title

ilExcCriteriaCatalogue::$title
protected

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

Referenced by getTitle().


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