ILIAS  release_7 Revision v7.30-3-g800a261c036
ilMailingList Class Reference
+ Collaboration diagram for ilMailingList:

Public Member Functions

 __construct (ilObjUser $user, $id=0)
 
 insert ()
 
 update ()
 
 delete ()
 
 getAssignedEntries ()
 
 assignUser ($usr_id=0)
 
 deleteEntry ($a_id=0)
 
 deassignAllEntries ()
 
 setId ($a_mail_id=0)
 
 getId ()
 
 setUserId ($a_user_id=0)
 
 getUserId ()
 
 setTitle ($a_title='')
 
 getTitle ()
 
 setDescription ($a_description='')
 
 getDescription ()
 
 setCreatedate ($_createdate)
 
 getCreatedate ()
 
 setChangedate ($a_changedate)
 
 getChangedate ()
 
 setMode ($a_mode)
 
 getMode ()
 

Data Fields

const MODE_ADDRESSBOOK = 1
 
const MODE_TEMPORARY = 2
 

Private Member Functions

 read ()
 

Private Attributes

 $mail_id = 0
 
 $user_id = 0
 
 $title = ''
 
 $description = ''
 
 $createdate = null
 
 $changedate = null
 
 $user
 
 $db
 

Detailed Description

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilMailingList::__construct ( ilObjUser  $user,
  $id = 0 
)

Definition at line 52 of file class.ilMailingList.php.

53 {
54 global $DIC;
55
56 $this->db = $DIC['ilDB'];
57 $this->user = $user;
58
59 $this->mail_id = $id;
60 $this->user_id = $this->user->getId();
61
62 $this->setMode(self::MODE_ADDRESSBOOK);
63
64 $this->read();
65 }
user()
Definition: user.php:4
global $DIC
Definition: goto.php:24

References $DIC, $user, read(), setMode(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ assignUser()

ilMailingList::assignUser (   $usr_id = 0)
Parameters
int$usr_id
Returns
bool

Definition at line 212 of file class.ilMailingList.php.

213 {
214 $nextId = $this->db->nextId('addressbook_mlist_ass');
215 $this->db->manipulateF(
216 'INSERT INTO addressbook_mlist_ass (a_id, ml_id, usr_id) VALUES(%s, %s, %s)',
217 array('integer', 'integer', 'integer'),
218 array($nextId, $this->getId(), $usr_id)
219 );
220 return true;
221 }

References getId().

+ Here is the call graph for this function:

◆ deassignAllEntries()

ilMailingList::deassignAllEntries ( )
Returns
bool

Definition at line 240 of file class.ilMailingList.php.

241 {
242 $this->db->manipulateF(
243 'DELETE FROM addressbook_mlist_ass WHERE ml_id = %s',
244 array('integer'),
245 array($this->getId())
246 );
247 return true;
248 }

References getId().

Referenced by delete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilMailingList::delete ( )

Definition at line 138 of file class.ilMailingList.php.

139 {
140 if ($this->mail_id && $this->user_id) {
141 $this->deassignAllEntries();
142
143 $statement = $this->db->manipulateF(
144 '
145 DELETE FROM addressbook_mlist
146 WHERE ml_id = %s
147 AND user_id = %s',
148 array('integer', 'integer'),
149 array($this->getId(), $this->getUserId())
150 );
151
152 return true;
153 } else {
154 return false;
155 }
156 }

References deassignAllEntries(), getId(), and getUserId().

+ Here is the call graph for this function:

◆ deleteEntry()

ilMailingList::deleteEntry (   $a_id = 0)
Parameters
int$a_id
Returns
bool

Definition at line 227 of file class.ilMailingList.php.

228 {
229 $this->db->manipulateF(
230 'DELETE FROM addressbook_mlist_ass WHERE a_id = %s',
231 array('integer'),
232 array($a_id)
233 );
234 return true;
235 }

◆ getAssignedEntries()

ilMailingList::getAssignedEntries ( )

Definition at line 187 of file class.ilMailingList.php.

188 {
189 $res = $this->db->queryf(
190 'SELECT a_id, usr_data.usr_id FROM addressbook_mlist_ass INNER JOIN usr_data ON usr_data.usr_id = addressbook_mlist_ass.usr_id WHERE ml_id = %s',
191 array('integer'),
192 array($this->getId())
193 );
194
195 $entries = array();
196 $counter = 0;
197 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
198 $entries[$row->a_id] = array(
199 'a_id' => $row->a_id,
200 'usr_id' => $row->usr_id
201 );
202 ++$counter;
203 }
204
205 return $entries;
206 }
foreach($_POST as $key=> $value) $res

References $res, ilDBConstants\FETCHMODE_OBJECT, and getId().

+ Here is the call graph for this function:

◆ getChangedate()

ilMailingList::getChangedate ( )

Definition at line 294 of file class.ilMailingList.php.

295 {
296 return $this->changedate;
297 }

References $changedate.

Referenced by update().

+ Here is the caller graph for this function:

◆ getCreatedate()

ilMailingList::getCreatedate ( )

Definition at line 286 of file class.ilMailingList.php.

287 {
288 return $this->createdate;
289 }

References $createdate.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getDescription()

ilMailingList::getDescription ( )

Definition at line 278 of file class.ilMailingList.php.

279 {
280 return $this->description;
281 }

References $description.

Referenced by insert(), and update().

+ Here is the caller graph for this function:

◆ getId()

ilMailingList::getId ( )

Definition at line 254 of file class.ilMailingList.php.

255 {
256 return $this->mail_id;
257 }

References $mail_id.

Referenced by ilMailingListsMembersTableGUI\__construct(), assignUser(), deassignAllEntries(), delete(), getAssignedEntries(), read(), and update().

+ Here is the caller graph for this function:

◆ getMode()

ilMailingList::getMode ( )

Definition at line 323 of file class.ilMailingList.php.

324 {
325 return $this->mode;
326 }

Referenced by insert(), and update().

+ Here is the caller graph for this function:

◆ getTitle()

ilMailingList::getTitle ( )

Definition at line 270 of file class.ilMailingList.php.

271 {
272 return $this->title;
273 }

References $title.

Referenced by ilMailingListsMembersTableGUI\__construct(), insert(), and update().

+ Here is the caller graph for this function:

◆ getUserId()

ilMailingList::getUserId ( )

Definition at line 262 of file class.ilMailingList.php.

263 {
264 return $this->user_id;
265 }

References $user_id.

Referenced by delete(), insert(), read(), and update().

+ Here is the caller graph for this function:

◆ insert()

ilMailingList::insert ( )

Definition at line 67 of file class.ilMailingList.php.

68 {
69 $nextId = $this->db->nextId('addressbook_mlist');
70 $statement = $this->db->manipulateF(
71 '
72 INSERT INTO addressbook_mlist
73 ( ml_id,
74 user_id,
75 title,
76 description,
77 createdate,
78 changedate,
79 lmode
80 )
81 VALUES(%s, %s, %s, %s, %s, %s, %s)',
82 array( 'integer',
83 'integer',
84 'text',
85 'text',
86 'timestamp',
87 'timestamp',
88 'integer'),
89 array( $nextId,
90 $this->getUserId(),
91 $this->getTitle(),
92 $this->getDescription(),
93 $this->getCreatedate(),
94 null,
95 $this->getMode()
96 )
97 );
98
99 $this->mail_id = $nextId;
100
101 return true;
102 }

References getCreatedate(), getDescription(), getMode(), getTitle(), and getUserId().

+ Here is the call graph for this function:

◆ read()

ilMailingList::read ( )
private

Definition at line 158 of file class.ilMailingList.php.

159 {
160 if ($this->getId() && $this->getUserId()) {
161 $res = $this->db->queryf(
162 '
163 SELECT * FROM addressbook_mlist
164 WHERE ml_id = %s
165 AND user_id =%s',
166 array('integer', 'integer'),
167 array($this->getId(), $this->getUserId())
168 );
169
170 $row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT);
171
172 if (is_object($row)) {
173 $this->setId($row->ml_id);
174 $this->setUserId($row->user_id);
175 $this->setTitle($row->title);
176 $this->setDescription($row->description);
177 $this->setCreatedate($row->createdate);
178 $this->setChangedate($row->changedae);
179 $this->setMode($row->lmode);
180 }
181 }
182
183
184 return true;
185 }
setChangedate($a_changedate)
setCreatedate($_createdate)
setDescription($a_description='')
setTitle($a_title='')
setUserId($a_user_id=0)
setId($a_mail_id=0)

References $res, ilDBConstants\FETCHMODE_OBJECT, getId(), getUserId(), setChangedate(), setCreatedate(), setDescription(), setId(), setMode(), setTitle(), and setUserId().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setChangedate()

ilMailingList::setChangedate (   $a_changedate)

Definition at line 290 of file class.ilMailingList.php.

291 {
292 $this->changedate = $a_changedate;
293 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setCreatedate()

ilMailingList::setCreatedate (   $_createdate)

Definition at line 282 of file class.ilMailingList.php.

283 {
284 $this->createdate = $_createdate;
285 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDescription()

ilMailingList::setDescription (   $a_description = '')

Definition at line 274 of file class.ilMailingList.php.

275 {
276 $this->description = $a_description;
277 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setId()

ilMailingList::setId (   $a_mail_id = 0)

Definition at line 250 of file class.ilMailingList.php.

251 {
252 $this->mail_id = $a_mail_id;
253 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setMode()

ilMailingList::setMode (   $a_mode)

Definition at line 315 of file class.ilMailingList.php.

316 {
317 $a_mode = (int) $a_mode;
318 if (in_array($a_mode, array(self::MODE_ADDRESSBOOK, self::MODE_TEMPORARY))) {
319 $this->mode = (int) $a_mode;
320 }
321 }

Referenced by __construct(), and read().

+ Here is the caller graph for this function:

◆ setTitle()

ilMailingList::setTitle (   $a_title = '')

Definition at line 266 of file class.ilMailingList.php.

267 {
268 $this->title = $a_title;
269 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setUserId()

ilMailingList::setUserId (   $a_user_id = 0)

Definition at line 258 of file class.ilMailingList.php.

259 {
260 $this->user_id = $a_user_id;
261 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilMailingList::update ( )

Definition at line 104 of file class.ilMailingList.php.

105 {
106 if ($this->mail_id && $this->user_id) {
107 $statement = $this->db->manipulateF(
108 '
109 UPDATE addressbook_mlist
110 SET title = %s,
111 description = %s,
112 changedate = %s,
113 lmode = %s
114 WHERE ml_id = %s
115 AND user_id = %s',
116 array( 'text',
117 'text',
118 'timestamp',
119 'integer',
120 'integer',
121 'integer'
122 ),
123 array( $this->getTitle(),
124 $this->getDescription(),
125 $this->getChangedate(),
126 $this->getMode(),
127 $this->getId(),
128 $this->getUserId()
129 )
130 );
131
132 return true;
133 } else {
134 return false;
135 }
136 }

References getChangedate(), getDescription(), getId(), getMode(), getTitle(), and getUserId().

+ Here is the call graph for this function:

Field Documentation

◆ $changedate

ilMailingList::$changedate = null
private

Definition at line 37 of file class.ilMailingList.php.

Referenced by getChangedate().

◆ $createdate

ilMailingList::$createdate = null
private

Definition at line 36 of file class.ilMailingList.php.

Referenced by getCreatedate().

◆ $db

ilMailingList::$db
private

Definition at line 47 of file class.ilMailingList.php.

◆ $description

ilMailingList::$description = ''
private

Definition at line 35 of file class.ilMailingList.php.

Referenced by getDescription().

◆ $mail_id

ilMailingList::$mail_id = 0
private

Definition at line 32 of file class.ilMailingList.php.

Referenced by getId().

◆ $title

ilMailingList::$title = ''
private

Definition at line 34 of file class.ilMailingList.php.

Referenced by getTitle().

◆ $user

ilMailingList::$user
private

Definition at line 42 of file class.ilMailingList.php.

Referenced by __construct().

◆ $user_id

ilMailingList::$user_id = 0
private

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

Referenced by getUserId().

◆ MODE_ADDRESSBOOK

const ilMailingList::MODE_ADDRESSBOOK = 1

Definition at line 49 of file class.ilMailingList.php.

◆ MODE_TEMPORARY

const ilMailingList::MODE_TEMPORARY = 2

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