• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

classes/class.ilLinkCheckNotify.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00031 class ilLinkCheckNotify
00032 {
00033         var $db = null;
00034 
00035 
00036         function ilLinkCheckNotify(&$db)
00037         {
00038                 $this->db =& $db;
00039         }
00040         
00041         function setUserId($a_usr_id)
00042         {
00043                 $this->usr_id = $a_usr_id;
00044         }
00045         function getUserId()
00046         {
00047                 return $this->usr_id;
00048         }
00049         function setObjId($a_obj_id)
00050         {
00051                 $this->obj_id = $a_obj_id;
00052         }
00053         function getObjId()
00054         {
00055                 return $this->obj_id;
00056         }
00057 
00058         function addNotifier()
00059         {
00060                 global $ilDB;
00061                 
00062                 $this->deleteNotifier();
00063 
00064                 $query = "INSERT INTO link_check_report ".
00065                         "SET obj_id = ".$ilDB->quote($this->getObjId()).", ".
00066                         "usr_id = ".$ilDB->quote($this->getUserId())."";
00067 
00068                 $this->db->query($query);
00069 
00070                 return true;
00071         }
00072 
00073         function deleteNotifier()
00074         {
00075                 global $ilDB;
00076 
00077                 $query = "DELETE FROM link_check_report ".
00078                         "WHERE obj_id = ".$ilDB->quote($this->getObjId())." ".
00079                         "AND usr_id = ".$ilDB->quote($this->getUserId())." ";
00080 
00081                 $this->db->query($query);
00082 
00083                 return true;
00084         }
00085 
00086         /* Static */
00087         function _getNotifyStatus($a_usr_id,$a_obj_id)
00088         {
00089                 global $ilDB;
00090 
00091                 $query = "SELECT * FROM link_check_report ".
00092                         "WHERE obj_id = ".$ilDB->quote($a_obj_id)." ".
00093                         "AND usr_id = ".$ilDB->quote($a_usr_id)." ";
00094 
00095                 $res = $ilDB->query($query);
00096 
00097                 return $res->numRows() ? true : false;
00098         }
00099 
00100         function _deleteUser($a_usr_id)
00101         {
00102                 global $ilDB;
00103 
00104                 $query = "DELETE FROM link_check_report ".
00105                         "WHERE usr_id = ".$ilDB->quote($a_usr_id)." ";
00106 
00107                 $ilDB->query($query);
00108 
00109                 return true;
00110         }
00111 
00112         function _deleteObject($a_obj_id)
00113         {
00114                 global $ilDB;
00115 
00116                 $query = "DELETE FROM link_check_report ".
00117                         "WHERE obj_id = ".$ilDB->quote($a_obj_id)." ";
00118 
00119                 $ilDB->query($query);
00120 
00121                 return true;
00122         }
00123 
00124         function _getNotifiers($a_obj_id)
00125         {
00126                 global $ilDB;
00127 
00128                 $query = "SELECT * FROM link_check_report ".
00129                         "WHERE obj_id = ".$ilDB->quote($a_obj_id)." ";
00130 
00131                 $res = $ilDB->query($query);
00132                 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00133                 {
00134                         $usr_ids[] = $row->usr_id;
00135                 }
00136 
00137                 return $usr_ids ? $usr_ids : array();
00138         }
00139 
00140         function _getAllNotifiers(&$db)
00141         {
00142                 global $ilDB;
00143 
00144                 $query = "SELECT * FROM link_check_report ";
00145 
00146                 $res = $db->query($query);
00147                 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00148                 {
00149                         $usr_ids[$row->usr_id][] = $row->obj_id;
00150                 }
00151 
00152                 return $usr_ids ? $usr_ids : array();
00153         }                       
00154 }
00155 ?>

Generated on Fri Dec 13 2013 17:56:47 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1