ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilConsultationHourGroup.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
11{
12 private $group_id = 0;
13 private $usr_id = 0;
14 private $num_assignments = 1;
15 private $title = '';
16
21 public function __construct($a_group_id = 0)
22 {
23 $this->group_id = $a_group_id;
24 $this->read();
25 }
26
27 public function getGroupId()
28 {
29 return $this->group_id;
30 }
31
32 public function setUserId($a_id)
33 {
34 $this->usr_id = $a_id;
35 }
36
37 public function getUserId()
38 {
39 return $this->usr_id;
40 }
41
42 public function setMaxAssignments($a_num)
43 {
44 $this->num_assignments = $a_num;
45 }
46
47 public function getMaxAssignments()
48 {
50 }
51
52
53 public function setTitle($a_title)
54 {
55 $this->title = $a_title;
56 }
57
58 public function getTitle()
59 {
60 return $this->title;
61 }
62
68 public function save()
69 {
70 global $ilDB;
71
72 $this->group_id = $ilDB->nextId('cal_ch_group');
73 $query = 'INSERT INTO cal_ch_group (grp_id,usr_id,multiple_assignments,title) ' .
74 'VALUES ( ' .
75 $ilDB->quote($this->getGroupId(), 'integer') . ', ' .
76 $ilDB->quote($this->getUserId(), 'integer') . ', ' .
77 $ilDB->quote($this->getMaxAssignments(), 'integer') . ', ' .
78 $ilDB->quote($this->getTitle(), 'text') .
79 ')';
80 $ilDB->manipulate($query);
81 return $this->getGroupId();
82 }
83
89 public function update()
90 {
91 global $ilDB;
92
93 $query = 'UPDATE cal_ch_group SET ' .
94 'usr_id = ' . $ilDB->quote($this->getUserId(), 'integer') . ', ' .
95 'multiple_assignments = ' . $ilDB->quote($this->getMaxAssignments(), 'integer') . ', ' .
96 'title = ' . $ilDB->quote($this->getTitle(), 'text') . ' ' .
97 'WHERE grp_id = ' . $ilDB->quote($this->getGroupId(), 'integer');
98 $ilDB->manipulate($query);
99 return true;
100 }
101
102 public function delete()
103 {
104 global $ilDB;
105
106 $query = 'DELETE FROM cal_ch_group ' .
107 'WHERE grp_id = ' . $ilDB->quote($this->getGroupId(), 'integer');
108 $ilDB->manipulate($query);
109
110 include_once './Services/Booking/classes/class.ilBookingEntry.php';
112 }
113
114
120 protected function read()
121 {
122 global $ilDB;
123
124 if (!$this->getGroupId()) {
125 return false;
126 }
127 $query = 'SELECT * FROM cal_ch_group ' .
128 'WHERE grp_id = ' . $ilDB->quote($this->getGroupId(), 'integer');
129 $res = $ilDB->query($query);
130 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
131 $this->setUserId($row->usr_id);
132 $this->setTitle($row->title);
133 $this->setMaxAssignments($row->multiple_assignments);
134 }
135 return true;
136 }
137}
An exception for terminatinating execution or to throw for unit testing.
static resetGroup($a_group_id)
Reset booking group (in case of deletion) @global type $ilDB.
save()
Save new group to db @global type $ilDB.
__construct($a_group_id=0)
Constructor.
update()
Update group information @global type $ilDB.
$query
foreach($_POST as $key=> $value) $res
global $ilDB