ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilLinkCheckNotify.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
12{
13 public $db = null;
14
15
16 public function __construct($db)
17 {
18 $this->db = $db;
19 }
20
21 public function setUserId($a_usr_id)
22 {
23 $this->usr_id = $a_usr_id;
24 }
25 public function getUserId()
26 {
27 return $this->usr_id;
28 }
29 public function setObjId($a_obj_id)
30 {
31 $this->obj_id = $a_obj_id;
32 }
33 public function getObjId()
34 {
35 return $this->obj_id;
36 }
37
38 public function addNotifier()
39 {
40 global $DIC;
41
42 $ilDB = $DIC['ilDB'];
43
44 $this->deleteNotifier();
45
46 $query = "INSERT INTO link_check_report (obj_id,usr_id) " .
47 "VALUES ( " .
48 $ilDB->quote($this->getObjId(), 'integer') . ", " .
49 $ilDB->quote($this->getUserId(), 'integer') .
50 ")";
51 $res = $ilDB->manipulate($query);
52
53 return true;
54 }
55
56 public function deleteNotifier()
57 {
58 global $DIC;
59
60 $ilDB = $DIC['ilDB'];
61
62 $query = "DELETE FROM link_check_report " .
63 "WHERE obj_id = " . $ilDB->quote($this->getObjId(), 'integer') . " " .
64 "AND usr_id = " . $ilDB->quote($this->getUserId(), 'integer') . " ";
65 $res = $ilDB->manipulate($query);
66
67 return true;
68 }
69
70 /* Static */
71 public static function _getNotifyStatus($a_usr_id, $a_obj_id)
72 {
73 global $DIC;
74
75 $ilDB = $DIC['ilDB'];
76
77 $query = "SELECT * FROM link_check_report " .
78 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
79 "AND usr_id = " . $ilDB->quote($a_usr_id, 'integer');
80 $res = $ilDB->query($query);
81
82 return $res->numRows() ? true : false;
83 }
84
85 public static function _deleteUser($a_usr_id)
86 {
87 global $DIC;
88
89 $ilDB = $DIC['ilDB'];
90
91 $query = "DELETE FROM link_check_report " .
92 "WHERE usr_id = " . $ilDB->quote($a_usr_id, 'integer');
93 $res = $ilDB->manipulate($query);
94 return true;
95 }
96
97 public static function _deleteObject($a_obj_id)
98 {
99 global $DIC;
100
101 $ilDB = $DIC['ilDB'];
102
103 $query = "DELETE FROM link_check_report " .
104 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
105 $res = $ilDB->manipulate($query);
106
107 return true;
108 }
109
110 public static function _getNotifiers($a_obj_id)
111 {
112 global $DIC;
113
114 $ilDB = $DIC['ilDB'];
115
116 $query = "SELECT * FROM link_check_report " .
117 "WHERE obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
118
119 $res = $ilDB->query($query);
120 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
121 $usr_ids[] = $row->usr_id;
122 }
123
124 return $usr_ids ? $usr_ids : array();
125 }
126
127 public static function _getAllNotifiers(&$db)
128 {
129 global $DIC;
130
131 $ilDB = $DIC['ilDB'];
132
133 $query = "SELECT * FROM link_check_report ";
134
135 $res = $db->query($query);
136 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
137 $usr_ids[$row->usr_id][] = $row->obj_id;
138 }
139
140 return $usr_ids ? $usr_ids : array();
141 }
142}
An exception for terminatinating execution or to throw for unit testing.
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.
class for checking external links in page objects.
static _deleteObject($a_obj_id)
static _getNotifiers($a_obj_id)
static _deleteUser($a_usr_id)
static _getNotifyStatus($a_usr_id, $a_obj_id)
global $DIC
Definition: goto.php:24
$query
foreach($_POST as $key=> $value) $res
global $ilDB