ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $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  public 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  public static 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  public static 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  public static 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  public static 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(ilDBConstants::FETCHMODE_OBJECT)) {
109  $usr_ids[] = $row->usr_id;
110  }
111 
112  return $usr_ids ? $usr_ids : array();
113  }
114 
115  public static function _getAllNotifiers(&$db)
116  {
117  global $ilDB;
118 
119  $query = "SELECT * FROM link_check_report ";
120 
121  $res = $db->query($query);
122  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
123  $usr_ids[$row->usr_id][] = $row->obj_id;
124  }
125 
126  return $usr_ids ? $usr_ids : array();
127  }
128 }
static _deleteObject($a_obj_id)
class for checking external links in page objects.
static _getNotifiers($a_obj_id)
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
static _getNotifyStatus($a_usr_id, $a_obj_id)
global $ilDB
static _deleteUser($a_usr_id)