ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilExcCriteriaCatalogue Class Reference

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

+ Collaboration diagram for ilExcCriteriaCatalogue:

Public Member Functions

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

Static Public Member Functions

static getInstancesByParentId (int $a_parent_id)
 

Protected Member Functions

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

Protected Attributes

ilDBInterface $db
 
int $id = null
 
int $parent = null
 
string $title = null
 
int $pos = 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 ilExcCriteriaCatalogue

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 25 of file class.ilExcCriteriaCatalogue.php.

Constructor & Destructor Documentation

◆ __construct()

ilExcCriteriaCatalogue::__construct ( int  $a_id = null)

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

References $DIC, and read().

34  {
35  global $DIC;
36 
37  $this->db = $DIC->database();
38  $this->read($a_id);
39  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ cloneObject()

ilExcCriteriaCatalogue::cloneObject ( int  $a_target_parent_id)

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

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

207  : int
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  foreach (ilExcCriteria::getInstancesByParentId($this->getId()) as $crit) {
216  $crit->cloneObject($new_obj->getId());
217  }
218 
219  return $new_obj->getId();
220  }
static getInstancesByParentId(int $a_parent_id)
+ Here is the call graph for this function:

◆ delete()

ilExcCriteriaCatalogue::delete ( )

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

References $db, $ilDB, and ilExcCriteria\deleteByParent().

193  : void
194  {
195  $ilDB = $this->db;
196 
197  if (!$this->id) {
198  return;
199  }
200 
202 
203  $ilDB->manipulate("DELETE FROM exc_crit_cat" .
204  " WHERE id = " . $ilDB->quote($this->id, "integer"));
205  }
static deleteByParent(int $a_parent_id)
+ Here is the call graph for this function:

◆ getDBProperties()

ilExcCriteriaCatalogue::getDBProperties ( )
protected

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

References getPosition(), and getTitle().

Referenced by save(), and update().

123  : array
124  {
125  return array(
126  "title" => array("text", $this->getTitle())
127  ,"pos" => array("integer", $this->getPosition())
128  );
129  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getId()

ilExcCriteriaCatalogue::getId ( )

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

References $id.

Referenced by cloneObject().

70  : ?int
71  {
72  return $this->id;
73  }
+ Here is the caller graph for this function:

◆ getInstancesByParentId()

static ilExcCriteriaCatalogue::getInstancesByParentId ( int  $a_parent_id)
static
Returns
self[]

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

References $DIC, $ilDB, and $res.

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

44  : array
45  {
46  global $DIC;
47 
48  $ilDB = $DIC->database();
49 
50  $res = array();
51 
52  $set = $ilDB->query("SELECT *" .
53  " FROM exc_crit_cat" .
54  " WHERE parent = " . $ilDB->quote($a_parent_id, "integer") .
55  " ORDER BY pos");
56  while ($row = $ilDB->fetchAssoc($set)) {
57  $obj = new self();
58  $obj->importFromDB($row);
59  $res[$obj->getId()] = $obj;
60  }
61 
62  return $res;
63  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ getLastPosition()

ilExcCriteriaCatalogue::getLastPosition ( )
protected

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

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

Referenced by save().

131  : int
132  {
133  $ilDB = $this->db;
134 
135  if (!$this->getParent()) {
136  return 0;
137  }
138 
139  $set = $ilDB->query("SELECT MAX(pos) pos" .
140  " FROM exc_crit_cat" .
141  " WHERE parent = " . $ilDB->quote($this->getParent(), "integer"));
142  $row = $ilDB->fetchAssoc($set);
143  return (int) $row["pos"];
144  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getParent()

ilExcCriteriaCatalogue::getParent ( )

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

References $parent.

Referenced by getLastPosition(), and save().

85  : ?int
86  {
87  return $this->parent;
88  }
+ Here is the caller graph for this function:

◆ getPosition()

ilExcCriteriaCatalogue::getPosition ( )

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

References $pos.

Referenced by cloneObject(), and getDBProperties().

105  : int
106  {
107  return $this->pos;
108  }
+ Here is the caller graph for this function:

◆ getTitle()

ilExcCriteriaCatalogue::getTitle ( )

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

References $title.

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

95  : ?string
96  {
97  return $this->title;
98  }
+ Here is the caller graph for this function:

◆ importFromDB()

ilExcCriteriaCatalogue::importFromDB ( array  $a_row)
protected

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

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

Referenced by read().

115  : void
116  {
117  $this->setId((int) $a_row["id"]);
118  $this->setParent((int) $a_row["parent"]);
119  $this->setTitle((string) $a_row["title"]);
120  $this->setPosition((int) $a_row["pos"]);
121  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilExcCriteriaCatalogue::read ( ?int  $a_id)
protected

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

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

Referenced by __construct().

146  : void
147  {
148  $ilDB = $this->db;
149 
150  if ($a_id > 0) {
151  $set = $ilDB->query("SELECT *" .
152  " FROM exc_crit_cat" .
153  " WHERE id = " . $ilDB->quote($a_id, "integer"));
154  if ($ilDB->numRows($set) !== 0) {
155  $row = $ilDB->fetchAssoc($set);
156  $this->importFromDB($row);
157  }
158  }
159  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilExcCriteriaCatalogue::save ( )

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

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

Referenced by update().

161  : void
162  {
163  $ilDB = $this->db;
164 
165  if ($this->id) {
166  $this->update();
167  return;
168  }
169 
170  $this->id = $ilDB->nextId("exc_crit_cat");
171 
172  $fields = $this->getDBProperties();
173  $fields["parent"] = array("integer", $this->getParent());
174  $fields["pos"] = array("integer", $this->getLastPosition() + 10);
175  $fields["id"] = array("integer", $this->id);
176 
177  $ilDB->insert("exc_crit_cat", $fields);
178  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setId()

ilExcCriteriaCatalogue::setId ( int  $a_id)
protected

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

Referenced by importFromDB().

75  : void
76  {
77  $this->id = $a_id;
78  }
+ Here is the caller graph for this function:

◆ setParent()

ilExcCriteriaCatalogue::setParent ( ?int  $a_value)

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

Referenced by importFromDB().

80  : void
81  {
82  $this->parent = $a_value;
83  }
+ Here is the caller graph for this function:

◆ setPosition()

ilExcCriteriaCatalogue::setPosition ( int  $a_value)

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

Referenced by importFromDB().

100  : void
101  {
102  $this->pos = $a_value;
103  }
+ Here is the caller graph for this function:

◆ setTitle()

ilExcCriteriaCatalogue::setTitle ( ?string  $a_value)

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

Referenced by importFromDB().

90  : void
91  {
92  $this->title = $a_value;
93  }
+ Here is the caller graph for this function:

◆ update()

ilExcCriteriaCatalogue::update ( )

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

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

Referenced by save().

180  : void
181  {
182  $ilDB = $this->db;
183 
184  if (!$this->id) {
185  $this->save();
186  return;
187  }
188 
189  $primary = array("id" => array("integer", $this->id));
190  $ilDB->update("exc_crit_cat", $this->getDBProperties(), $primary);
191  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $db

ilDBInterface ilExcCriteriaCatalogue::$db
protected

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

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

◆ $id

int ilExcCriteriaCatalogue::$id = null
protected

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

Referenced by getId().

◆ $parent

int ilExcCriteriaCatalogue::$parent = null
protected

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

Referenced by getParent().

◆ $pos

int ilExcCriteriaCatalogue::$pos = 0
protected

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

Referenced by getPosition().

◆ $title

string ilExcCriteriaCatalogue::$title = null
protected

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

Referenced by getTitle().


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