ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
13 private $group_id = 0;
14 private $usr_id = 0;
15 private $num_assignments = 1;
16 private $title = '';
17
22 public function __construct($a_group_id = 0)
23 {
24 $this->group_id = $a_group_id;
25 $this->read();
26 }
27
28 public function getGroupId()
29 {
30 return $this->group_id;
31 }
32
33 public function setUserId($a_id)
34 {
35 $this->usr_id = $a_id;
36 }
37
38 public function getUserId()
39 {
40 return $this->usr_id;
41 }
42
43 public function setMaxAssignments($a_num)
44 {
45 $this->num_assignments = $a_num;
46 }
47
48 public function getMaxAssignments()
49 {
51 }
52
53
54 public function setTitle($a_title)
55 {
56 $this->title = $a_title;
57 }
58
59 public function getTitle()
60 {
61 return $this->title;
62 }
63
69 public function save()
70 {
71 global $ilDB;
72
73 $this->group_id = $ilDB->nextId('cal_ch_group');
74 $query = 'INSERT INTO cal_ch_group (grp_id,usr_id,multiple_assignments,title) '.
75 'VALUES ( '.
76 $ilDB->quote($this->getGroupId(),'integer').', '.
77 $ilDB->quote($this->getUserId(),'integer').', '.
78 $ilDB->quote($this->getMaxAssignments(),'integer').', '.
79 $ilDB->quote($this->getTitle(),'text').
80 ')';
81 $ilDB->manipulate($query);
82 return $this->getGroupId();
83 }
84
90 public function update()
91 {
92 global $ilDB;
93
94 $query = 'UPDATE cal_ch_group SET '.
95 'usr_id = '.$ilDB->quote($this->getUserId(),'integer').', '.
96 'multiple_assignments = '.$ilDB->quote($this->getMaxAssignments(),'integer').', '.
97 'title = '.$ilDB->quote($this->getTitle(),'text').' '.
98 'WHERE grp_id = '.$ilDB->quote($this->getGroupId(),'integer');
99 $ilDB->manipulate($query);
100 return true;
101 }
102
103 public function delete()
104 {
105 global $ilDB;
106
107 $query = 'DELETE FROM cal_ch_group '.
108 'WHERE grp_id = '.$ilDB->quote($this->getGroupId(),'integer');
109 $ilDB->manipulate($query);
110
111 include_once './Services/Booking/classes/class.ilBookingEntry.php';
113 }
114
115
121 protected function read()
122 {
123 global $ilDB;
124
125 if(!$this->getGroupId())
126 {
127 return false;
128 }
129 $query = 'SELECT * FROM cal_ch_group '.
130 'WHERE grp_id = '.$ilDB->quote($this->getGroupId(),'integer');
131 $res = $ilDB->query($query);
132 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
133 {
134 $this->setUserId($row->usr_id);
135 $this->setTitle($row->title);
136 $this->setMaxAssignments($row->multiple_assignments);
137 }
138 return true;
139 }
140
141}
142?>
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
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 $ilDB