ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMailingList Class Reference
+ Collaboration diagram for ilMailingList:

Public Member Functions

 __construct (ilObjUser $user, $id=0)
 
 insert ()
 
 update ()
 
 delete ()
 
 getAssignedEntries ()
 
 assignAddressbookEntry ($addr_id=0)
 
 deassignAddressbookEntry ($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.

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

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

References $ilDB, $res, and $row.

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

312  {
313  global $ilDB;
314 
315  $res = $ilDB->queryf('
316  SELECT * FROM addressbook_mlist
317  WHERE ml_id = %s
318  AND user_id =%s',
319  array('integer', 'integer'),
320  array($a_ml_id, $a_usr_id));
321 
322  $row = $ilDB->fetchObject($res);
323 
324  return is_object($row) ? true : false;
325  }
global $ilDB
+ Here is the caller graph for this function:

◆ assignAddressbookEntry()

ilMailingList::assignAddressbookEntry (   $addr_id = 0)

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

References getId().

221  {
222  $nextId = $this->db->nextId('addressbook_mlist_ass');
223  $statement = $this->db->manipulateF('
224  INSERT INTO addressbook_mlist_ass
225  ( a_id,
226  ml_id,
227  addr_id
228  )
229  VALUES(%s,%s,%s )',
230  array('integer', 'integer', 'integer'),
231  array($nextId, $this->getId(), $addr_id));
232 
233  return true;
234  }
+ Here is the call graph for this function:

◆ deassignAddressbookEntry()

ilMailingList::deassignAddressbookEntry (   $a_id = 0)

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

237  {
238 
239  $statement = $this->db->manipulateF('
240  DELETE FROM addressbook_mlist_ass
241  WHERE a_id = %s',
242  array('integer'),
243  array($a_id));
244 
245  return true;
246  }

◆ deassignAllEntries()

ilMailingList::deassignAllEntries ( )

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

References getId().

Referenced by delete().

249  {
250  $statement = $this->db->manipulateF('
251  DELETE FROM addressbook_mlist_ass
252  WHERE ml_id = %s',
253  array('integer'),
254  array($this->getId()));
255 
256  return true;
257  }
+ 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.

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

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  }
+ Here is the call graph for this function:

◆ getAssignedEntries()

ilMailingList::getAssignedEntries ( )

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

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

181  {
182  if($this->getMode() == self::MODE_ADDRESSBOOK)
183  {
184  $res = $this->db->queryf('
185  SELECT * FROM addressbook_mlist_ass
186  INNER JOIN addressbook ON addressbook.addr_id = addressbook_mlist_ass.addr_id
187  WHERE ml_id = %s',
188  array('integer'),
189  array($this->getId()));
190  }
191  else
192  {
193  $res = $this->db->queryf('
194  SELECT * FROM addressbook_mlist_ass
195  INNER JOIN usr_data ON addressbook_mlist_ass.addr_id = usr_data.usr_id
196  WHERE ml_id = %s',
197  array('integer'),
198  array($this->getId()));
199  }
200 
201  $entries = array();
202 
203  $counter = 0;
204  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
205  {
206  $entries[$counter] = array('a_id' => $row->a_id,
207  'addr_id' => $row->addr_id,
208  'login' => $row->login,
209  'email' => $row->email,
210  'firstname' => $row->firstname,
211  'lastname' => $row->lastname
212  );
213 
214  ++$counter;
215  }
216 
217  return $entries;
218  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the call graph for this function:

◆ getChangedate()

ilMailingList::getChangedate ( )

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

References $changedate.

Referenced by update().

307  {
308  return $this->changedate;
309  }
+ Here is the caller graph for this function:

◆ getCreatedate()

ilMailingList::getCreatedate ( )

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

References $createdate.

Referenced by insert().

296  {
297  return $this->createdate;
298  }
+ Here is the caller graph for this function:

◆ getDescription()

ilMailingList::getDescription ( )

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

References $description.

Referenced by insert(), and update().

288  {
289  return $this->description;
290  }
+ Here is the caller graph for this function:

◆ getId()

ilMailingList::getId ( )

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

References $mail_id.

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

264  {
265  return $this->mail_id;
266  }
+ Here is the caller graph for this function:

◆ getMode()

ilMailingList::getMode ( )

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

Referenced by getAssignedEntries(), insert(), and update().

337  {
338  return $this->mode;
339  }
+ Here is the caller graph for this function:

◆ getTitle()

ilMailingList::getTitle ( )

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

References $title.

Referenced by insert(), and update().

280  {
281  return $this->title;
282  }
+ Here is the caller graph for this function:

◆ getUserId()

ilMailingList::getUserId ( )

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

References $user_id.

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

272  {
273  return $this->user_id;
274  }
+ Here is the caller graph for this function:

◆ insert()

ilMailingList::insert ( )

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

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

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  }
+ Here is the call graph for this function:

◆ read()

ilMailingList::read ( )
private

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

References $res, $row, DB_FETCHMODE_OBJECT, getId(), getUserId(), setChangedate(), setCreatedate(), setDescription(), setId(), setMode(), setTitle(), and setUserId().

Referenced by __construct().

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  }
setTitle($a_title='')
setDescription($a_description='')
setId($a_mail_id=0)
setUserId($a_user_id=0)
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
setChangedate($a_changedate='0000-00-00 00:00:00')
setCreatedate($_createdate='0000-00-00 00:00:00')
+ 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 299 of file class.ilMailingList.php.

Referenced by read().

299  :00:00')
300  {
301  if($a_changedate == '0000-00-00 00:00:00')
302  $this->changedate = NULL;
303  else
304  $this->changedate = $a_changedate;
305  }
+ Here is the caller graph for this function:

◆ setCreatedate()

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

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

Referenced by read().

291  :00:00')
292  {
293  $this->createdate = $_createdate;
294  }
+ Here is the caller graph for this function:

◆ setDescription()

ilMailingList::setDescription (   $a_description = '')

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

Referenced by read().

284  {
285  $this->description = $a_description;
286  }
+ Here is the caller graph for this function:

◆ setId()

ilMailingList::setId (   $a_mail_id = 0)

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

Referenced by read().

260  {
261  $this->mail_id = $a_mail_id;
262  }
+ Here is the caller graph for this function:

◆ setMode()

ilMailingList::setMode (   $a_mode)

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

Referenced by __construct(), and read().

328  {
329  $a_mode = (int)$a_mode;
330  if(in_array($a_mode, array(self::MODE_ADDRESSBOOK, self::MODE_TEMPORARY)))
331  {
332  $this->mode = (int)$a_mode;
333  }
334  }
+ Here is the caller graph for this function:

◆ setTitle()

ilMailingList::setTitle (   $a_title = '')

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

Referenced by read().

276  {
277  $this->title = $a_title;
278  }
+ Here is the caller graph for this function:

◆ setUserId()

ilMailingList::setUserId (   $a_user_id = 0)

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

Referenced by read().

268  {
269  $this->user_id = $a_user_id;
270  }
+ Here is the caller graph for this function:

◆ update()

ilMailingList::update ( )

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

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

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  }
+ 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: