/** * Removes all associations with a track, this entails removing * user track, cluster track and class track associations * @param none * @return none */ function delete() { // Cascade //clean make the delete cascade into association records $filter = new field_filter('trackid', $this->id); usertrack::delete_records($filter, $this->_db); clustertrack::delete_records($filter, $this->_db); trackassignment::delete_records($filter, $this->_db); parent::delete(); //Delete this leve's context $context = \local_elisprogram\context\track::instance($this->id); $context->delete(); }
public function delete() { global $CFG; $muser = $this->get_moodleuser(); if (empty($muser) || !is_primary_admin($muser->id)) { // delete associated data require_once elis::lib('data/data_filter.class.php'); $filter = new field_filter('userid', $this->id); curriculumstudent::delete_records($filter, $this->_db); student::delete_records($filter, $this->_db); student_grade::delete_records($filter, $this->_db); waitlist::delete_records($filter, $this->_db); instructor::delete_records($filter, $this->_db); usertrack::delete_records($filter, $this->_db); clusterassignment::delete_records($filter, $this->_db); //delete association to Moodle user, if applicable require_once elispm::lib('data/usermoodle.class.php'); $filter = new field_filter('cuserid', $this->id); usermoodle::delete_records($filter, $this->_db); // Delete Moodle user. if (!empty($muser)) { delete_user($muser); } parent::delete(); $context = \local_elisprogram\context\user::instance($this->id); $context->delete(); } }