ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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

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 213 of file class.ilMailingList.php.

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

References getId().

+ Here is the call graph for this function:

◆ deassignAllEntries()

ilMailingList::deassignAllEntries ( )
Returns
bool

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

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

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 137 of file class.ilMailingList.php.

138 {
139 if ($this->mail_id && $this->user_id)
140 {
141 $this->deassignAllEntries();
142
143 $statement = $this->db->manipulateF('
144 DELETE FROM addressbook_mlist
145 WHERE ml_id = %s
146 AND user_id = %s',
147 array('integer', 'integer'),
148 array($this->getId(), $this->getUserId()));
149
150 return true;
151 }
152 else
153 {
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 228 of file class.ilMailingList.php.

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

◆ 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 {
199 $entries[$row->a_id] = array(
200 'a_id' => $row->a_id,
201 'usr_id' => $row->usr_id
202 );
203 ++$counter;
204 }
205
206 return $entries;
207 }
$counter

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

+ Here is the call graph for this function:

◆ getChangedate()

ilMailingList::getChangedate ( )

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

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

References $changedate.

Referenced by update().

+ Here is the caller graph for this function:

◆ getCreatedate()

ilMailingList::getCreatedate ( )

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

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

References $createdate.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getDescription()

ilMailingList::getDescription ( )

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

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

References $description.

Referenced by insert(), and update().

+ Here is the caller graph for this function:

◆ getId()

ilMailingList::getId ( )

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

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

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 325 of file class.ilMailingList.php.

326 {
327 return $this->mode;
328 }

Referenced by insert(), and update().

+ Here is the caller graph for this function:

◆ getTitle()

ilMailingList::getTitle ( )

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

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

References $title.

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

+ Here is the caller graph for this function:

◆ getUserId()

ilMailingList::getUserId ( )

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

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

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 INSERT INTO addressbook_mlist
72 ( ml_id,
73 user_id,
74 title,
75 description,
76 createdate,
77 changedate,
78 lmode
79 )
80 VALUES(%s, %s, %s, %s, %s, %s, %s)',
81 array( 'integer',
82 'integer',
83 'text',
84 'text',
85 'timestamp',
86 'timestamp',
87 'integer'),
88 array( $nextId,
89 $this->getUserId(),
90 $this->getTitle(),
91 $this->getDescription(),
92 $this->getCreatedate(),
93 NULL,
94 $this->getMode()
95 ));
96
97 $this->mail_id = $nextId;
98
99 return true;
100 }

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 {
162 $res = $this->db->queryf('
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
170
171 if (is_object($row))
172 {
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, $row, 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 291 of file class.ilMailingList.php.

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setCreatedate()

ilMailingList::setCreatedate (   $_createdate)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setDescription()

ilMailingList::setDescription (   $a_description = '')

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setId()

ilMailingList::setId (   $a_mail_id = 0)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setMode()

ilMailingList::setMode (   $a_mode)

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

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

Referenced by __construct(), and read().

+ Here is the caller graph for this function:

◆ setTitle()

ilMailingList::setTitle (   $a_title = '')

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setUserId()

ilMailingList::setUserId (   $a_user_id = 0)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilMailingList::update ( )

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

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

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: