/**
 * Delete cohort.
 * @param  stdClass $cohort
 * @return void
 */
function meditraxcohort_delete_cohort($cohort)
{
    global $DB;
    if ($cohort->component) {
        // TODO: add component delete callback
    }
    $DB->delete_records('cohort_members', array('cohortid' => $cohort->id));
    $DB->delete_records('cohort', array('id' => $cohort->id));
    $event = \core\event\cohort_deleted::create(array('context' => context::instance_by_id($cohort->contextid), 'objectid' => $cohort->id));
    $event->add_record_snapshot('cohort', $cohort);
    $event->trigger();
}
예제 #2
0
파일: lib.php 프로젝트: evltuma/moodle
/**
 * Delete cohort.
 * @param  stdClass $cohort
 * @return void
 */
function cohort_delete_cohort($cohort)
{
    global $DB;
    if ($cohort->component) {
        // TODO: add component delete callback
    }
    $DB->delete_records('cohort_members', array('cohortid' => $cohort->id));
    $DB->delete_records('cohort', array('id' => $cohort->id));
    // Notify the competency subsystem.
    \core_competency\api::hook_cohort_deleted($cohort);
    $event = \core\event\cohort_deleted::create(array('context' => context::instance_by_id($cohort->contextid), 'objectid' => $cohort->id));
    $event->add_record_snapshot('cohort', $cohort);
    $event->trigger();
}