public static function delete($tagcoll) {
        global $DB, $CFG;

        $defaulttagcollid = self::get_default();
        if ($tagcoll->id == $defaulttagcollid) {
            return false;
        }

        // Move all tags from this tag collection to the default one.
        $allitemtypes = core_tag_area::get_areas($tagcoll->id);
        foreach ($allitemtypes as $it) {
            foreach ($it as $v) {
                core_tag_area::update($v, array('tagcollid' => $defaulttagcollid));
            }
        }

        // Delete tags from this tag_coll.
        core_tag_tag::delete_tags($DB->get_fieldset_select('tag', 'id', 'tagcollid = ?', array($tagcoll->id)));

        // Delete the tag collection.
        $DB->delete_records('tag_coll', array('id' => $tagcoll->id));

        // Reset cache.
        cache::make('core', 'tags')->delete('tag_coll');

        \core\event\tag_collection_deleted::create_from_record($tagcoll)->trigger();

        return true;
    }
public static function delete($tagcoll) {
        global $DB, $CFG;

        $defaulttagcollid = self::get_default();
        if ($tagcoll->id == $defaulttagcollid) {
            return false;
        }

        // Move all tags from this tag collection to the default one.
        $allitemtypes = core_tag_area::get_areas($tagcoll->id);
        foreach ($allitemtypes as $it) {
            foreach ($it as $v) {
                core_tag_area::update($v, array('tagcollid' => $defaulttagcollid));
            }
        }

        // Delete tags from this tag_coll.
        core_tag_tag::delete_tags($DB->get_fieldset_select('tag', 'id', 'tagcollid = ?', array($tagcoll->id)));

        // Delete the tag collection.
        $DB->delete_records('tag_coll', array('id' => $tagcoll->id));

        // Reset cache.
        cache::make('core', 'tags')->delete('tag_coll');

        \core\event\tag_collection_deleted::create_from_record($tagcoll)->trigger();

        return true;
    }
public static function delete ( $ tagcoll ) { global $ DB , $ CFG ; $ defaulttagcollid = self :: get_default ( ) ; if ( $ tagcoll -> id == $ defaulttagcollid ) { return false ; } // Move all tags from this tag collection to the default one. $ allitemtypes = core_tag_area :: get_areas ( $ tagcoll -> id ) ; foreach ( $ allitemtypes as $ it ) { foreach ( $ it as $ v ) { core_tag_area :: update ( $ v , array ( 'tagcollid' => $ defaulttagcollid ) ) ; } } // Delete tags from this tag_coll. core_tag_tag :: delete_tags ( $ DB -> get_fieldset_select ( 'tag' , 'id' , 'tagcollid = ?' , array ( $ tagcoll -> id ) ) ) ; // Delete the tag collection. $ DB -> delete_records ( 'tag_coll' , array ( 'id' => $ tagcoll -> id ) ) ; // Reset cache. cache :: make ( 'core' , 'tags' ) -> delete ( 'tag_coll' ) ; \ core \ event \ tag_collection_deleted :: create_from_record ( $ tagcoll ) -> trigger ( ) ; return true ; }
Deletes a custom tag collection

@param stdClass $tagcoll existing record in DB table tag_coll
@return bool wether the tag collection was deleted
Deletes a custom tag collection