ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 var $db = null;
14
15
17 {
18 $this->db =& $db;
19 }
20
21 function setUserId($a_usr_id)
22 {
23 $this->usr_id = $a_usr_id;
24 }
25 function getUserId()
26 {
27 return $this->usr_id;
28 }
29 function setObjId($a_obj_id)
30 {
31 $this->obj_id = $a_obj_id;
32 }
33 function getObjId()
34 {
35 return $this->obj_id;
36 }
37
38 function addNotifier()
39 {
40 global $ilDB;
41
42 $this->deleteNotifier();
43
44 $query = "INSERT INTO link_check_report (obj_id,usr_id) ".
45 "VALUES ( ".
46 $ilDB->quote($this->getObjId(),'integer').", ".
47 $ilDB->quote($this->getUserId(),'integer').
48 ")";
49 $res = $ilDB->manipulate($query);
50
51 return true;
52 }
53
54 function deleteNotifier()
55 {
56 global $ilDB;
57
58 $query = "DELETE FROM link_check_report ".
59 "WHERE obj_id = ".$ilDB->quote($this->getObjId(),'integer')." ".
60 "AND usr_id = ".$ilDB->quote($this->getUserId(),'integer')." ";
61 $res = $ilDB->manipulate($query);
62
63 return true;
64 }
65
66 /* Static */
67 function _getNotifyStatus($a_usr_id,$a_obj_id)
68 {
69 global $ilDB;
70
71 $query = "SELECT * FROM link_check_report ".
72 "WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ".
73 "AND usr_id = ".$ilDB->quote($a_usr_id,'integer');
74 $res = $ilDB->query($query);
75
76 return $res->numRows() ? true : false;
77 }
78
79 function _deleteUser($a_usr_id)
80 {
81 global $ilDB;
82
83 $query = "DELETE FROM link_check_report ".
84 "WHERE usr_id = ".$ilDB->quote($a_usr_id,'integer');
85 $res = $ilDB->manipulate($query);
86 return true;
87 }
88
89 function _deleteObject($a_obj_id)
90 {
91 global $ilDB;
92
93 $query = "DELETE FROM link_check_report ".
94 "WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ";
95 $res = $ilDB->manipulate($query);
96
97 return true;
98 }
99
100 function _getNotifiers($a_obj_id)
101 {
102 global $ilDB;
103
104 $query = "SELECT * FROM link_check_report ".
105 "WHERE obj_id = ".$ilDB->quote($a_obj_id,'integer')." ";
106
107 $res = $ilDB->query($query);
108 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
109 {
110 $usr_ids[] = $row->usr_id;
111 }
112
113 return $usr_ids ? $usr_ids : array();
114 }
115
117 {
118 global $ilDB;
119
120 $query = "SELECT * FROM link_check_report ";
121
122 $res = $db->query($query);
123 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
124 {
125 $usr_ids[$row->usr_id][] = $row->obj_id;
126 }
127
128 return $usr_ids ? $usr_ids : array();
129 }
130}
131?>
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
class for checking external links in page objects.
_getNotifyStatus($a_usr_id, $a_obj_id)
global $ilDB