public static function delete_template_cohort($templateorid, $cohortorid) {
        global $DB;
        static::require_enabled();

        $template = $templateorid;
        if (!is_object($template)) {
            $template = new template($template);
        }
        require_capability('moodle/competency:templatemanage', $template->get_context());

        $cohort = $cohortorid;
        if (!is_object($cohort)) {
            $cohort = $DB->get_record('cohort', array('id' => $cohort), '*', MUST_EXIST);
        }

        $tplcohort = template_cohort::get_relation($template->get('id'), $cohort->id);
        if (!$tplcohort->get('id')) {
            return true;
        }

        return $tplcohort->delete();
    }
public static function delete_template_cohort($templateorid, $cohortorid) {
        global $DB;
        static::require_enabled();

        $template = $templateorid;
        if (!is_object($template)) {
            $template = new template($template);
        }
        require_capability('moodle/competency:templatemanage', $template->get_context());

        $cohort = $cohortorid;
        if (!is_object($cohort)) {
            $cohort = $DB->get_record('cohort', array('id' => $cohort), '*', MUST_EXIST);
        }

        $tplcohort = template_cohort::get_relation($template->get('id'), $cohort->id);
        if (!$tplcohort->get('id')) {
            return true;
        }

        return $tplcohort->delete();
    }
public static function delete_template_cohort ( $ templateorid , $ cohortorid ) { global $ DB ; static :: require_enabled ( ) ; $ template = $ templateorid ; if ( ! is_object ( $ template ) ) { $ template = new template ( $ template ) ; } require_capability ( 'moodle/competency:templatemanage' , $ template -> get_context ( ) ) ; $ cohort = $ cohortorid ; if ( ! is_object ( $ cohort ) ) { $ cohort = $ DB -> get_record ( 'cohort' , array ( 'id' => $ cohort ) , '*' , MUST_EXIST ) ; } $ tplcohort = template_cohort :: get_relation ( $ template -> get ( 'id' ) , $ cohort -> id ) ; if ( ! $ tplcohort -> get ( 'id' ) ) { return true ; } return $ tplcohort -> delete ( ) ; }
Remove a relation between a template and a cohort.

@param  template|int $templateorid The template or its ID.
@param  stdClass|int $cohortorid   The cohort ot its ID.
@return boolean True on success or when the relation did not exist.
Remove a relation between a template and a cohort .