Exemplo n.º 1
0
 /**
  * Permanently deletes all non-standard tags that no longer have any instances pointing to them
  *
  * @param array $collections optional list of tag collections ids to cleanup
  */
 public static function cleanup_unused_tags($collections = null)
 {
     global $DB, $CFG;
     $params = array();
     $sql = "SELECT tg.id FROM {tag} tg LEFT OUTER JOIN {tag_instance} ti ON ti.tagid = tg.id\n                WHERE ti.id IS NULL AND tg.isstandard = 0";
     if ($collections) {
         list($sqlcoll, $params) = $DB->get_in_or_equal($collections, SQL_PARAMS_NAMED);
         $sql .= " AND tg.tagcollid " . $sqlcoll;
     }
     if ($unusedtags = $DB->get_fieldset_sql($sql, $params)) {
         core_tag_tag::delete_tags($unusedtags);
     }
 }
Exemplo n.º 2
0
/**
 * Delete one or more tag, and all their instances if there are any left.
 *
 * @package  core_tag
 * @deprecated since 3.1
 * @param    mixed    $tagids one tagid (int), or one array of tagids to delete
 * @return   bool     true on success, false otherwise
 */
function tag_delete($tagids)
{
    debugging('Method tag_delete() is deprecated, use core_tag_tag::delete_tags()', DEBUG_DEVELOPER);
    return core_tag_tag::delete_tags($tagids);
}
Exemplo n.º 3
0
 case 'areasetshowstandard':
     if ($tagarea) {
         require_sesskey();
         if (($showstandard = optional_param('showstandard', null, PARAM_INT)) !== null) {
             core_tag_area::update($tagarea, array('showstandard' => $showstandard));
             redirect(new moodle_url($manageurl, array('notice' => 'changessaved')));
         }
     }
     redirect($manageurl);
     break;
 case 'delete':
     require_sesskey();
     if (!$tagschecked && $tagid) {
         $tagschecked = array($tagid);
     }
     core_tag_tag::delete_tags($tagschecked);
     redirect(new moodle_url($PAGE->url, $tagschecked ? array('notice' => 'deleted') : null));
     break;
 case 'setflag':
     require_sesskey();
     if ($tagid) {
         $tagobject->flag();
         redirect(new moodle_url($PAGE->url, array('notice' => 'flagged')));
     }
     redirect($PAGE->url);
     break;
 case 'resetflag':
     require_sesskey();
     if ($tagid) {
         $tagobject->reset_flag();
         redirect(new moodle_url($PAGE->url, array('notice' => 'resetflag')));