ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMailingList Class Reference
+ Collaboration diagram for ilMailingList:

Public Member Functions

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

Data Fields

const MODE_ADDRESSBOOK = 1
 
const MODE_TEMPORARY = 2
 

Private Member Functions

 read ()
 

Private Attributes

int $mail_id
 
int $user_id
 
string $title = ''
 
string $description = ''
 
string $createdate
 
string $changedate
 
ilDBInterface $db
 
int $mode
 
bool $exists = false
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ __construct()

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

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

References $DIC, $id, ilObject\getId(), read(), and setMode().

42  {
43  global $DIC;
44 
45  $this->db = $DIC['ilDB'];
46 
47  $this->mail_id = $id;
48  $this->user_id = $user->getId();
49 
50  $this->setMode(self::MODE_ADDRESSBOOK);
51 
52  $this->read();
53  }
global $DIC
Definition: feed.php:28
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
setMode(int $a_mode)
+ Here is the call graph for this function:

Member Function Documentation

◆ assignUser()

ilMailingList::assignUser ( int  $usr_id = 0)

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

References getId().

199  : bool
200  {
201  $nextId = $this->db->nextId('addressbook_mlist_ass');
202  $this->db->manipulateF(
203  'INSERT INTO addressbook_mlist_ass (a_id, ml_id, usr_id) VALUES(%s, %s, %s)',
204  ['integer', 'integer', 'integer'],
205  [$nextId, $this->getId(), $usr_id]
206  );
207  return true;
208  }
+ Here is the call graph for this function:

◆ deassignAllEntries()

ilMailingList::deassignAllEntries ( )

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

References getId().

Referenced by delete().

222  : bool
223  {
224  $this->db->manipulateF(
225  'DELETE FROM addressbook_mlist_ass WHERE ml_id = %s',
226  ['integer'],
227  [$this->getId()]
228  );
229  return true;
230  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilMailingList::delete ( )

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

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

132  : bool
133  {
134  if ($this->mail_id && $this->user_id) {
135  $this->deassignAllEntries();
136 
137  $statement = $this->db->manipulateF(
138  'DELETE FROM addressbook_mlist WHERE ml_id = %s AND user_id = %s',
139  ['integer', 'integer'],
140  [$this->getId(), $this->getUserId()]
141  );
142  $this->exists = false;
143 
144  return true;
145  }
146 
147  return false;
148  }
+ Here is the call graph for this function:

◆ deleteEntry()

ilMailingList::deleteEntry ( int  $a_id = 0)

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

211  : bool
212  {
213  $this->db->manipulateF(
214  'DELETE FROM addressbook_mlist_ass WHERE a_id = %s',
215  ['integer'],
216  [$a_id]
217  );
218  return true;
219  }

◆ doesExist()

ilMailingList::doesExist ( )

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

References $exists.

303  : bool
304  {
305  return $this->exists;
306  }

◆ getAssignedEntries()

ilMailingList::getAssignedEntries ( )
Returns
array<int, array{a_id: int, usr_id: int}>

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

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

177  : array
178  {
179  $res = $this->db->queryF(
180  'SELECT a_id, usr_data.usr_id FROM addressbook_mlist_ass ' .
181  'INNER JOIN usr_data ON usr_data.usr_id = addressbook_mlist_ass.usr_id WHERE ml_id = %s',
182  ['integer'],
183  [$this->getId()]
184  );
185 
186  $entries = [];
187  $counter = 0;
188  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
189  $entries[(int) $row->a_id] = [
190  'a_id' => (int) $row->a_id,
191  'usr_id' => (int) $row->usr_id
192  ];
193  }
194 
195  return $entries;
196  }
$res
Definition: ltiservices.php:69
+ Here is the call graph for this function:

◆ getChangedate()

ilMailingList::getChangedate ( )

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

References $changedate.

Referenced by update().

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

◆ getCreatedate()

ilMailingList::getCreatedate ( )

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

References $createdate.

Referenced by insert().

277  : string
278  {
279  return $this->createdate;
280  }
+ Here is the caller graph for this function:

◆ getDescription()

ilMailingList::getDescription ( )

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

References $description.

Referenced by insert(), and update().

267  : ?string
268  {
269  return $this->description;
270  }
+ Here is the caller graph for this function:

◆ getId()

ilMailingList::getId ( )

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

References $mail_id.

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

237  : int
238  {
239  return $this->mail_id;
240  }
+ Here is the caller graph for this function:

◆ getMode()

ilMailingList::getMode ( )

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

References $mode.

Referenced by insert(), and update().

299  : int
300  {
301  return $this->mode;
302  }
+ Here is the caller graph for this function:

◆ getTitle()

ilMailingList::getTitle ( )

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

References $title.

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

257  : string
258  {
259  return $this->title;
260  }
+ Here is the caller graph for this function:

◆ getUserId()

ilMailingList::getUserId ( )

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

References $user_id.

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

247  : int
248  {
249  return $this->user_id;
250  }
+ Here is the caller graph for this function:

◆ insert()

ilMailingList::insert ( )

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

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

55  : bool
56  {
57  $nextId = $this->db->nextId('addressbook_mlist');
58  $statement = $this->db->manipulateF(
59  '
60  INSERT INTO addressbook_mlist
61  ( ml_id,
62  user_id,
63  title,
64  description,
65  createdate,
66  changedate,
67  lmode
68  )
69  VALUES(%s, %s, %s, %s, %s, %s, %s)',
70  [
71  'integer',
72  'integer',
73  'text',
74  'text',
75  'timestamp',
76  'timestamp',
77  'integer'
78  ],
79  [
80  $nextId,
81  $this->getUserId(),
82  $this->getTitle(),
83  $this->getDescription(),
84  $this->getCreatedate(),
85  null,
86  $this->getMode()
87  ]
88  );
89 
90  $this->mail_id = $nextId;
91  $this->exists = true;
92 
93  return true;
94  }
+ Here is the call graph for this function:

◆ read()

ilMailingList::read ( )
private

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

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

Referenced by __construct().

150  : void
151  {
152  if ($this->getId() && $this->getUserId()) {
153  $res = $this->db->queryF(
154  'SELECT * FROM addressbook_mlist WHERE ml_id = %s AND user_id =%s',
155  ['integer', 'integer'],
156  [$this->getId(), $this->getUserId()]
157  );
158 
159  $row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT);
160 
161  if (is_object($row)) {
162  $this->setId((int) $row->ml_id);
163  $this->setUserId((int) $row->user_id);
164  $this->setTitle($row->title);
165  $this->setDescription($row->description);
166  $this->setCreatedate($row->createdate);
167  $this->setChangedate($row->changedate);
168  $this->setMode((int) $row->lmode);
169  $this->exists = true;
170  }
171  }
172  }
setCreatedate(string $_createdate)
$res
Definition: ltiservices.php:69
setId(int $a_mail_id=0)
setTitle(string $a_title='')
setDescription(?string $a_description='')
setChangedate(?string $a_changedate)
setUserId(int $a_user_id=0)
setMode(int $a_mode)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setChangedate()

ilMailingList::setChangedate ( ?string  $a_changedate)

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

Referenced by read().

282  : void
283  {
284  $this->changedate = $a_changedate;
285  }
+ Here is the caller graph for this function:

◆ setCreatedate()

ilMailingList::setCreatedate ( string  $_createdate)

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

Referenced by read().

272  : void
273  {
274  $this->createdate = $_createdate;
275  }
+ Here is the caller graph for this function:

◆ setDescription()

ilMailingList::setDescription ( ?string  $a_description = '')

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

Referenced by read().

262  : void
263  {
264  $this->description = $a_description;
265  }
+ Here is the caller graph for this function:

◆ setId()

ilMailingList::setId ( int  $a_mail_id = 0)

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

Referenced by read().

232  : void
233  {
234  $this->mail_id = $a_mail_id;
235  }
+ Here is the caller graph for this function:

◆ setMode()

ilMailingList::setMode ( int  $a_mode)

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

Referenced by __construct(), and read().

292  : void
293  {
294  if (in_array($a_mode, [self::MODE_ADDRESSBOOK, self::MODE_TEMPORARY], true)) {
295  $this->mode = $a_mode;
296  }
297  }
+ Here is the caller graph for this function:

◆ setTitle()

ilMailingList::setTitle ( string  $a_title = '')

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

Referenced by read().

252  : void
253  {
254  $this->title = $a_title;
255  }
+ Here is the caller graph for this function:

◆ setUserId()

ilMailingList::setUserId ( int  $a_user_id = 0)

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

Referenced by read().

242  : void
243  {
244  $this->user_id = $a_user_id;
245  }
+ Here is the caller graph for this function:

◆ update()

ilMailingList::update ( )

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

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

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

Field Documentation

◆ $changedate

string ilMailingList::$changedate
private

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

Referenced by getChangedate().

◆ $createdate

string ilMailingList::$createdate
private

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

Referenced by getCreatedate().

◆ $db

ilDBInterface ilMailingList::$db
private

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

◆ $description

string ilMailingList::$description = ''
private

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

Referenced by getDescription().

◆ $exists

bool ilMailingList::$exists = false
private

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

Referenced by doesExist().

◆ $mail_id

int ilMailingList::$mail_id
private

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

Referenced by getId().

◆ $mode

int ilMailingList::$mode
private

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

Referenced by getMode().

◆ $title

string ilMailingList::$title = ''
private

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

Referenced by getTitle().

◆ $user_id

int ilMailingList::$user_id
private

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

Referenced by getUserId().

◆ MODE_ADDRESSBOOK

const ilMailingList::MODE_ADDRESSBOOK = 1

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

◆ MODE_TEMPORARY

const ilMailingList::MODE_TEMPORARY = 2

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