ILIAS  release_7 Revision v7.30-3-g800a261c036
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 $DIC;
71
72 $ilDB = $DIC['ilDB'];
73
74 $this->group_id = $ilDB->nextId('cal_ch_group');
75 $query = 'INSERT INTO cal_ch_group (grp_id,usr_id,multiple_assignments,title) ' .
76 'VALUES ( ' .
77 $ilDB->quote($this->getGroupId(), 'integer') . ', ' .
78 $ilDB->quote($this->getUserId(), 'integer') . ', ' .
79 $ilDB->quote($this->getMaxAssignments(), 'integer') . ', ' .
80 $ilDB->quote($this->getTitle(), 'text') .
81 ')';
82 $ilDB->manipulate($query);
83 return $this->getGroupId();
84 }
85
91 public function update()
92 {
93 global $DIC;
94
95 $ilDB = $DIC['ilDB'];
96
97 $query = 'UPDATE cal_ch_group SET ' .
98 'usr_id = ' . $ilDB->quote($this->getUserId(), 'integer') . ', ' .
99 'multiple_assignments = ' . $ilDB->quote($this->getMaxAssignments(), 'integer') . ', ' .
100 'title = ' . $ilDB->quote($this->getTitle(), 'text') . ' ' .
101 'WHERE grp_id = ' . $ilDB->quote($this->getGroupId(), 'integer');
102 $ilDB->manipulate($query);
103 return true;
104 }
105
106 public function delete()
107 {
108 global $DIC;
109
110 $ilDB = $DIC['ilDB'];
111
112 $query = 'DELETE FROM cal_ch_group ' .
113 'WHERE grp_id = ' . $ilDB->quote($this->getGroupId(), 'integer');
114 $ilDB->manipulate($query);
115
116 include_once './Services/Booking/classes/class.ilBookingEntry.php';
118 }
119
120
126 protected function read()
127 {
128 global $DIC;
129
130 $ilDB = $DIC['ilDB'];
131
132 if (!$this->getGroupId()) {
133 return false;
134 }
135 $query = 'SELECT * FROM cal_ch_group ' .
136 'WHERE grp_id = ' . $ilDB->quote($this->getGroupId(), 'integer');
137 $res = $ilDB->query($query);
138 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
139 $this->setUserId($row->usr_id);
140 $this->setTitle($row->title);
141 $this->setMaxAssignments($row->multiple_assignments);
142 }
143 return true;
144 }
145}
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.
global $DIC
Definition: goto.php:24
$query
foreach($_POST as $key=> $value) $res
global $ilDB