19 declare(strict_types=0);
38 $this->db = $DIC->database();
39 $this->obj_id = $crs_id;
40 $this->user_id = $a_usr_id;
54 public function accept(
bool $a_status): void
56 $this->accepted = $a_status;
66 $this->remark = $a_remark;
76 $this->visible = $a_visible;
92 $query =
"INSERT INTO crs_timings_usr_accept (crs_id,usr_id,visible,accept,remark) " .
94 $this->db->quote($this->
getCourseId(),
'integer') .
", " .
95 $this->db->quote($this->
getUserId(),
'integer') .
", " .
96 $this->db->quote($this->
isVisible(),
'integer') .
", " .
97 $this->db->quote($this->
isAccepted(),
'integer') .
", " .
98 $this->db->quote($this->
getRemark(),
'text') .
" " .
100 $res = $this->db->manipulate($query);
103 public function delete():
void 108 public function _delete(
int $a_crs_id,
int $a_usr_id): void
110 $query =
"DELETE FROM crs_timings_usr_accept " .
111 "WHERE crs_id = " . $this->db->quote($a_crs_id,
'integer') .
" " .
112 "AND usr_id = " . $this->db->quote($a_usr_id,
'integer') .
" ";
113 $res = $this->db->manipulate($query);
118 $query =
"DELETE FROM crs_timings_usr_accept " .
119 "WHERE crs_id = " . $this->db->quote($a_crs_id,
'integer') .
" ";
120 $res = $this->db->manipulate($query);
127 $ilDB = $DIC->database();
128 $query =
"DELETE FROM crs_timings_usr_accept " .
129 "WHERE usr_id = " .
$ilDB->quote($a_usr_id,
'integer') .
"";
135 if ($this->obj_id <= 0 || $this->user_id <= 0) {
138 $query =
"SELECT * FROM crs_timings_usr_accept " .
139 "WHERE crs_id = " . $this->db->quote($this->
getCourseId(),
'integer') .
" " .
140 "AND usr_id = " . $this->db->quote($this->
getUserId(),
'integer');
141 $res = $this->db->query($query);
145 $this->
accept((
bool) $row->accept);
_delete(int $a_crs_id, int $a_usr_id)
static _deleteByUser(int $a_usr_id)
setVisible(bool $a_visible)
__construct(int $crs_id, int $a_usr_id)
_deleteByCourse(int $a_crs_id)
setRemark(string $a_remark)