• Main Page
  • Related Pages
  • 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 
00032 class ilLinkCheckNotify
00033 {
00034         var $db = null;
00035 
00036 
00037         function ilLinkCheckNotify(&$db)
00038         {
00039                 $this->db =& $db;
00040         }
00041         
00042         function setUserId($a_usr_id)
00043         {
00044                 $this->usr_id = $a_usr_id;
00045         }
00046         function getUserId()
00047         {
00048                 return $this->usr_id;
00049         }
00050         function setObjId($a_obj_id)
00051         {
00052                 $this->obj_id = $a_obj_id;
00053         }
00054         function getObjId()
00055         {
00056                 return $this->obj_id;
00057         }
00058 
00059         function addNotifier()
00060         {
00061                 $this->deleteNotifier();
00062 
00063                 $query = "INSERT INTO link_check_report ".
00064                         "SET obj_id = '".$this->getObjId()."', ".
00065                         "usr_id = '".$this->getUserId()."'";
00066 
00067                 $this->db->query($query);
00068 
00069                 return true;
00070         }
00071 
00072         function deleteNotifier()
00073         {
00074                 $query = "DELETE FROM link_check_report ".
00075                         "WHERE obj_id = '".$this->getObjId()."' ".
00076                         "AND usr_id = '".$this->getUserId()."'";
00077 
00078                 $this->db->query($query);
00079 
00080                 return true;
00081         }
00082 
00083         /* Static */
00084         function _getNotifyStatus($a_usr_id,$a_obj_id)
00085         {
00086                 global $ilDB;
00087 
00088                 $query = "SELECT * FROM link_check_report ".
00089                         "WHERE obj_id = '".$a_obj_id."' ".
00090                         "AND usr_id = '".$a_usr_id."'";
00091 
00092                 $res = $ilDB->query($query);
00093 
00094                 return $res->numRows() ? true : false;
00095         }
00096 
00097         function _deleteUser($a_usr_id)
00098         {
00099                 global $ilDB;
00100 
00101                 $query = "DELETE FROM link_check_report ".
00102                         "WHERE usr_id = '".$a_usr_id."'";
00103 
00104                 $ilDB->query($query);
00105 
00106                 return true;
00107         }
00108 
00109         function _deleteObject($a_obj_id)
00110         {
00111                 global $ilDB;
00112 
00113                 $query = "DELETE FROM link_check_report ".
00114                         "WHERE obj_id = '".$a_obj_id."'";
00115 
00116                 $ilDB->query($query);
00117 
00118                 return true;
00119         }
00120 
00121         function _getNotifiers($a_obj_id)
00122         {
00123                 global $ilDB;
00124 
00125                 $query = "SELECT * FROM link_check_report ".
00126                         "WHERE obj_id = '".$a_obj_id."'";
00127 
00128                 $res = $ilDB->query($query);
00129                 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00130                 {
00131                         $usr_ids[] = $row->usr_id;
00132                 }
00133 
00134                 return $usr_ids ? $usr_ids : array();
00135         }
00136 
00137         function _getAllNotifiers(&$db)
00138         {
00139 
00140                 $query = "SELECT * FROM link_check_report ";
00141 
00142                 $res = $db->query($query);
00143                 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00144                 {
00145                         $usr_ids[$row->usr_id][] = $row->obj_id;
00146                 }
00147 
00148                 return $usr_ids ? $usr_ids : array();
00149         }                       
00150 }
00151 ?>

Generated on Fri Dec 13 2013 09:06:34 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1