19 declare(strict_types=1);
34 $this->db = $DIC[
'ilDB'];
37 public function isOwner(
int $a_ml_id,
int $a_usr_id): bool
39 $res = $this->db->queryF(
40 'SELECT EXISTS(SELECT 1 FROM addressbook_mlist WHERE ml_id = %s AND user_id = %s) cnt',
41 [
'integer',
'integer'],
44 $row = $this->db->fetchAssoc(
$res);
46 return is_array($row) && (
int) $row[
'cnt'] === 1;
62 foreach ($a_ids as $id) {
71 $res = $this->db->queryF(
72 'SELECT EXISTS(SELECT 1 FROM addressbook_mlist WHERE user_id = %s) cnt',
74 [$this->
user->getId()]
76 $row = $this->db->fetchAssoc(
$res);
78 return (is_array($row) && (
int) $row[
'cnt'] === 1);
86 $res = $this->db->queryF(
87 'SELECT * FROM addressbook_mlist WHERE user_id = %s',
89 [$this->
user->getId()]
97 $tmpObj->setId((
int) $row->ml_id);
98 $tmpObj->setUserId((
int) $row->user_id);
99 $tmpObj->setTitle($row->title);
100 $tmpObj->setDescription($row->description);
101 $tmpObj->setCreatedate($row->createdate);
102 $tmpObj->setChangedate($row->changedate);
103 $tmpObj->setMode((
int) $row->lmode);
105 $entries[$counter] = $tmpObj;
117 $ml_id = (
int) substr($a_list_name, strrpos($a_list_name,
'_') + 1);
118 if (!is_numeric($ml_id) || $ml_id <= 0) {
129 $this->ml = $this->
get(
$id);
140 foreach ($this->
getAll() as $mlist) {
149 $this->db->manipulateF(
150 'DELETE ass FROM addressbook_mlist_ass ass INNER JOIN addressbook_mlist list ON ass.ml_id = list.ml_id WHERE list.user_id = %s',
152 [$this->
user->getId()]
154 $this->db->manipulateF(
155 'DELETE FROM addressbook_mlist WHERE user_id = %s',
157 [$this->
user->getId()]
163 $this->db->manipulate(
164 'DELETE FROM addressbook_mlist_ass WHERE usr_id = ' . $this->db->quote($this->user->getId(),
'integer')
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
final const MODE_TEMPORARY
setCurrentMailingList(int $id=0)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
__construct(private readonly ilObjUser $user)
readonly ilDBInterface $db
mailingListExists(string $a_list_name)
getSelected(array $a_ids=[])
isOwner(int $a_ml_id, int $a_usr_id)