Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00034 class ilTimingAccepted
00035 {
00036 var $ilErr;
00037 var $ilDB;
00038 var $lng;
00039
00040 function ilTimingAccepted($crs_id,$a_usr_id)
00041 {
00042 global $ilErr,$ilDB,$lng,$tree;
00043
00044 $this->ilErr =& $ilErr;
00045 $this->db =& $ilDB;
00046 $this->lng =& $lng;
00047
00048 $this->crs_id = $crs_id;
00049 $this->user_id = $a_usr_id;
00050
00051 $this->__read();
00052 }
00053
00054 function getUserId()
00055 {
00056 return $this->user_id;
00057 }
00058 function getCourseId()
00059 {
00060 return $this->crs_id;
00061 }
00062 function accept($a_status)
00063 {
00064 $this->accepted = $a_status;
00065 }
00066 function isAccepted()
00067 {
00068 return $this->accepted ? true : false;
00069 }
00070 function setRemark($a_remark)
00071 {
00072 $this->remark = $a_remark;
00073 }
00074 function getRemark()
00075 {
00076 return $this->remark;
00077 }
00078 function setVisible($a_visible)
00079 {
00080 $this->visible = $a_visible;
00081 }
00082 function isVisible()
00083 {
00084 return $this->visible ? true : false;
00085 }
00086
00087 function update()
00088 {
00089 ilTimingAccepted::_delete($this->getCourseId(),$this->getUserId());
00090 $this->create();
00091 return true;
00092 }
00093
00094 function create()
00095 {
00096 global $ilDB;
00097
00098 $query = "INSERT INTO crs_timings_usr_accept ".
00099 "SET crs_id = ".$ilDB->quote($this->getCourseId()).", ".
00100 "usr_id = ".$ilDB->quote($this->getUserId()).", ".
00101 "visible = ".$ilDB->quote($this->isVisible()).", ".
00102 "accept = ".$ilDB->quote($this->isAccepted()).", ".
00103 "remark = ".$ilDB->quote($this->getRemark())." ";
00104 $this->db->query($query);
00105 }
00106
00107 function delete()
00108 {
00109 return ilTimingAccepted::_delete($this->getCourseId(),$this->getUserId());
00110 }
00111
00112 function _delete($a_crs_id,$a_usr_id)
00113 {
00114 global $ilDB;
00115
00116 $query = "DELETE FROM crs_timings_usr_accept ".
00117 "WHERE crs_id = ".$ilDB->quote($a_crs_id)." ".
00118 "AND usr_id = ".$ilDB->quote($a_usr_id)." ";
00119 $ilDB->query($query);
00120 }
00121
00122 function _deleteByCourse($a_crs_id)
00123 {
00124 global $ilDB;
00125
00126 $query = "DELETE FROM crs_timings_usr_accept ".
00127 "WHERE crs_id = ".$ilDB->quote($a_crs_id)." ";
00128 $ilDB->query($query);
00129 }
00130
00131 function _deleteByUser($a_usr_id)
00132 {
00133 global $ilDB;
00134
00135 $query = "DELETE FROM crs_timings_usr_accept ".
00136 "WHERE usr_id = ".$ilDB->quote($a_usr_id)."";
00137 $ilDB->query($query);
00138 }
00139
00140 function __read()
00141 {
00142 global $ilDB;
00143
00144 $query = "SELECT * FROM crs_timings_usr_accept ".
00145 "WHERE crs_id = ".$ilDB->quote($this->getCourseId())." ".
00146 "AND usr_id = ".$this->getUserId()."";
00147 $res = $this->db->query($query);
00148 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
00149 {
00150 $this->setVisible($row->visible);
00151 $this->setRemark($row->remark);
00152 $this->accept($row->accept);
00153 }
00154 return true;
00155 }
00156 }
00157 ?>