ILIAS  release_8 Revision v8.24
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.

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 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
setMode(int $a_mode)
global $DIC
Definition: feed.php:28

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

+ 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.

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 }

References getId().

+ Here is the call graph for this function:

◆ deassignAllEntries()

ilMailingList::deassignAllEntries ( )

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

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 }

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

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 }

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

+ 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.

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

References $exists.

◆ getAssignedEntries()

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

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

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

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

+ Here is the call graph for this function:

◆ getChangedate()

ilMailingList::getChangedate ( )

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

287 : ?string
288 {
289 return $this->changedate;
290 }

References $changedate.

Referenced by update().

+ Here is the caller graph for this function:

◆ getCreatedate()

ilMailingList::getCreatedate ( )

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

277 : string
278 {
279 return $this->createdate;
280 }

References $createdate.

Referenced by insert().

+ Here is the caller graph for this function:

◆ getDescription()

ilMailingList::getDescription ( )

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

267 : ?string
268 {
269 return $this->description;
270 }

References $description.

Referenced by insert(), and update().

+ Here is the caller graph for this function:

◆ getId()

ilMailingList::getId ( )

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

237 : int
238 {
239 return $this->mail_id;
240 }

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

299 : int
300 {
301 return $this->mode;
302 }

References $mode.

Referenced by insert(), and update().

+ Here is the caller graph for this function:

◆ getTitle()

ilMailingList::getTitle ( )

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

257 : string
258 {
259 return $this->title;
260 }

References $title.

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

+ Here is the caller graph for this function:

◆ getUserId()

ilMailingList::getUserId ( )

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

247 : int
248 {
249 return $this->user_id;
250 }

References $user_id.

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

+ Here is the caller graph for this function:

◆ insert()

ilMailingList::insert ( )

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

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 }

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

+ Here is the call graph for this function:

◆ read()

ilMailingList::read ( )
private

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

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 }
setTitle(string $a_title='')
setCreatedate(string $_createdate)
setChangedate(?string $a_changedate)
setDescription(?string $a_description='')
setUserId(int $a_user_id=0)
setId(int $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 ( ?string  $a_changedate)

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

282 : void
283 {
284 $this->changedate = $a_changedate;
285 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setCreatedate()

ilMailingList::setCreatedate ( string  $_createdate)

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

272 : void
273 {
274 $this->createdate = $_createdate;
275 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDescription()

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

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

262 : void
263 {
264 $this->description = $a_description;
265 }

Referenced by read().

+ 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.

232 : void
233 {
234 $this->mail_id = $a_mail_id;
235 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setMode()

ilMailingList::setMode ( int  $a_mode)

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

292 : void
293 {
294 if (in_array($a_mode, [self::MODE_ADDRESSBOOK, self::MODE_TEMPORARY], true)) {
295 $this->mode = $a_mode;
296 }
297 }

Referenced by __construct(), and read().

+ Here is the caller graph for this function:

◆ setTitle()

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

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

252 : void
253 {
254 $this->title = $a_title;
255 }

Referenced by read().

+ 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.

242 : void
243 {
244 $this->user_id = $a_user_id;
245 }

Referenced by read().

+ Here is the caller graph for this function:

◆ update()

ilMailingList::update ( )

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

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 }

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

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