ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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='0000-00-00 00:00:00')
 
 getCreatedate ()
 
 setChangedate ($a_changedate='0000-00-00 00:00:00')
 
 getChangedate ()
 
 setMode ($a_mode)
 
 getMode ()
 

Static Public Member Functions

static _isOwner ($a_ml_id, $a_usr_id)
 

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 = '0000-00-00 00:00:00'
 
 $changedate = '0000-00-00 00:00:00'
 
 $user = null
 
 $db = null
 

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

46 {
47 global $ilDB;
48
49 $this->db = $ilDB;
50 $this->user = $user;
51
52 $this->mail_id = $id;
53 $this->user_id = $this->user->getId();
54
55 $this->setMode(self::MODE_ADDRESSBOOK);
56
57 $this->read();
58 }
global $ilDB

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

+ Here is the call graph for this function:

Member Function Documentation

◆ _isOwner()

static ilMailingList::_isOwner (   $a_ml_id,
  $a_usr_id 
)
static

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

297 {
298 global $ilDB;
299
300 $res = $ilDB->queryf('
301 SELECT * FROM addressbook_mlist
302 WHERE ml_id = %s
303 AND user_id =%s',
304 array('integer', 'integer'),
305 array($a_ml_id, $a_usr_id));
306
307 $row = $ilDB->fetchObject($res);
308
309 return is_object($row) ? true : false;
310 }

References $ilDB, $res, and $row.

Referenced by ilMailingListsGUI\mailToList(), ilMailingListsGUI\performDelete(), ilMailingListsGUI\performDeleteMembers(), ilMailingListsGUI\saveAssignmentForm(), ilMailingListsGUI\saveForm(), ilMailingListsGUI\showAssignmentForm(), and ilMailingListsGUI\showForm().

+ Here is the caller graph for this function:

◆ assignUser()

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

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

207 {
208 $nextId = $this->db->nextId('addressbook_mlist_ass');
209 $this->db->manipulateF(
210 'INSERT INTO addressbook_mlist_ass (a_id, ml_id, usr_id) VALUES(%s, %s, %s)',
211 array('integer', 'integer', 'integer'),
212 array($nextId, $this->getId(), $usr_id)
213 );
214 return true;
215 }

References getId().

+ Here is the call graph for this function:

◆ deassignAllEntries()

ilMailingList::deassignAllEntries ( )
Returns
bool

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

235 {
236 $this->db->manipulateF(
237 'DELETE FROM addressbook_mlist_ass WHERE ml_id = %s',
238 array('integer'),
239 array($this->getId())
240 );
241 return true;
242 }

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

131 {
132 if ($this->mail_id && $this->user_id)
133 {
134 $this->deassignAllEntries();
135
136 $statement = $this->db->manipulateF('
137 DELETE FROM addressbook_mlist
138 WHERE ml_id = %s
139 AND user_id = %s',
140 array('integer', 'integer'),
141 array($this->getId(), $this->getUserId()));
142
143 return true;
144 }
145 else
146 {
147 return false;
148 }
149 }

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

222 {
223 $this->db->manipulateF(
224 'DELETE FROM addressbook_mlist_ass WHERE a_id = %s',
225 array('integer'),
226 array($a_id)
227 );
228 return true;
229 }

◆ getAssignedEntries()

ilMailingList::getAssignedEntries ( )

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

181 {
182 $res = $this->db->queryf(
183 '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',
184 array('integer'),
185 array($this->getId())
186 );
187
188 $entries = array();
189 $counter = 0;
190 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
191 {
192 $entries[$row->a_id] = array(
193 'a_id' => $row->a_id,
194 'usr_id' => $row->usr_id
195 );
196 ++$counter;
197 }
198
199 return $entries;
200 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11

References $res, $row, DB_FETCHMODE_OBJECT, and getId().

+ Here is the call graph for this function:

◆ getChangedate()

ilMailingList::getChangedate ( )

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

292 {
293 return $this->changedate;
294 }

References $changedate.

Referenced by update().

+ Here is the caller graph for this function:

◆ getCreatedate()

ilMailingList::getCreatedate ( )

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

281 {
282 return $this->createdate;
283 }

References $createdate.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getDescription()

ilMailingList::getDescription ( )

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

273 {
274 return $this->description;
275 }

References $description.

Referenced by insert(), and update().

+ Here is the caller graph for this function:

◆ getId()

ilMailingList::getId ( )

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

249 {
250 return $this->mail_id;
251 }

References $mail_id.

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

+ Here is the caller graph for this function:

◆ getMode()

ilMailingList::getMode ( )

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

322 {
323 return $this->mode;
324 }

Referenced by insert(), and update().

+ Here is the caller graph for this function:

◆ getTitle()

ilMailingList::getTitle ( )

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

265 {
266 return $this->title;
267 }

References $title.

Referenced by insert(), and update().

+ Here is the caller graph for this function:

◆ getUserId()

ilMailingList::getUserId ( )

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

257 {
258 return $this->user_id;
259 }

References $user_id.

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

+ Here is the caller graph for this function:

◆ insert()

ilMailingList::insert ( )

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

61 {
62 $nextId = $this->db->nextId('addressbook_mlist');
63 $statement = $this->db->manipulateF('
64 INSERT INTO addressbook_mlist
65 ( ml_id,
66 user_id,
67 title,
68 description,
69 createdate,
70 changedate,
71 lmode
72 )
73 VALUES(%s, %s, %s, %s, %s, %s, %s)',
74 array( 'integer',
75 'integer',
76 'text',
77 'text',
78 'timestamp',
79 'timestamp',
80 'integer'),
81 array( $nextId,
82 $this->getUserId(),
83 $this->getTitle(),
84 $this->getDescription(),
85 $this->getCreatedate(),
86 NULL,
87 $this->getMode()
88 ));
89
90 $this->mail_id = $nextId;
91
92 return true;
93 }

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

+ Here is the call graph for this function:

◆ read()

ilMailingList::read ( )
private

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

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

References $res, $row, DB_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 = '0000-00-00 00:00:00')

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

284 :00:00')
285 {
286 if($a_changedate == '0000-00-00 00:00:00')
287 $this->changedate = NULL;
288 else
289 $this->changedate = $a_changedate;
290 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setCreatedate()

ilMailingList::setCreatedate (   $_createdate = '0000-00-00 00:00:00')

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

276 :00:00')
277 {
278 $this->createdate = $_createdate;
279 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDescription()

ilMailingList::setDescription (   $a_description = '')

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

269 {
270 $this->description = $a_description;
271 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setId()

ilMailingList::setId (   $a_mail_id = 0)

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

245 {
246 $this->mail_id = $a_mail_id;
247 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setMode()

ilMailingList::setMode (   $a_mode)

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

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

Referenced by __construct(), and read().

+ Here is the caller graph for this function:

◆ setTitle()

ilMailingList::setTitle (   $a_title = '')

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

261 {
262 $this->title = $a_title;
263 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setUserId()

ilMailingList::setUserId (   $a_user_id = 0)

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

253 {
254 $this->user_id = $a_user_id;
255 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilMailingList::update ( )

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

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

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

+ Here is the call graph for this function:

Field Documentation

◆ $changedate

ilMailingList::$changedate = '0000-00-00 00:00:00'
private

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

Referenced by getChangedate().

◆ $createdate

ilMailingList::$createdate = '0000-00-00 00:00:00'
private

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

Referenced by getCreatedate().

◆ $db

ilMailingList::$db = null
private

Definition at line 40 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 = null
private

Definition at line 39 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 42 of file class.ilMailingList.php.

◆ MODE_TEMPORARY


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