function removeSubscription($id_course, $id_user, $lv_group, $edition_id = 0, $start_date = FALSE, $end_date = FALSE) { require_once $GLOBALS["where_framework"] . "/lib/resources/lib.timetable.php"; $tt = new TimeTable(); // ---------------------------------------- $resource = "user"; $resource_id = $id_user; if ($edition_id > 0) { $consumer = "course_edition"; $consumer_id = $edition_id; } else { $consumer = "course"; $consumer_id = $id_course; } // ---------------------------------------- $tt->deleteEvent(FALSE, $resource, $resource_id, $consumer, $consumer_id, $start_date, $end_date); $acl_man =& Docebo::user()->getAclManager(); $acl_man->removeFromGroup($lv_group, $id_user); if ($edition_id > 0) { $group = '/lms/course_edition/' . $edition_id . '/subscribed'; $group_idst = $acl_man->getGroupST($group); $acl_man->removeFromGroup($group_idst, $id_user); } return sql_query("\r\n\tDELETE FROM " . $GLOBALS['prefix_lms'] . "_courseuser\r\n\tWHERE idUser = '******' AND idCourse = '" . $id_course . "'\r\n\tAND edition_id='" . (int) $edition_id . "'"); }
function del() { if ($this->getPerm()) { $start_date = $this->start_year . "-" . $this->start_month . "-" . $this->start_day . " " . $this->start_hour . ":" . $this->start_min . ":" . $this->start_sec; $end_date = $this->end_year . "-" . $this->end_month . "-" . $this->end_day . " " . $this->end_hour . ":" . $this->end_min . ":" . $this->end_sec; // -- timetable setup ------------------------------------------------ require_once $GLOBALS["where_framework"] . "/lib/resources/lib.timetable.php"; $tt = new TimeTable(); $resource = "classroom"; $resource_id = (int) $this->classroom; $consumer = "classroom_event"; $consumer_id = $this->id; // ------------------------------------------------------------------- $delete_ok = $tt->deleteEvent(FALSE, $resource, $resource_id, $consumer, $consumer_id, $start_date, $end_date); if ($delete_ok) { $query = "DELETE FROM " . $GLOBALS['prefix_lms'] . "_classroom_calendar WHERE id='" . $this->id . "'"; $q = sql_query($query); $this->id = 0; } } }