MDL-13691 - make the tag description edition work again.

This commit is contained in:
scyrma
2008-02-27 09:33:24 +00:00
parent a6b6baf25e
commit 7684e6314d
2 changed files with 21 additions and 1 deletions
+2
View File
@@ -49,6 +49,8 @@ $tagform->set_data($tag);
// If new data has been sent, update the tag record
if ($tagnew = $tagform->get_data()) {
tag_description_set($tag_id, stripslashes($tagnew->description), $tagnew->descriptionformat);
if (!has_capability('moodle/tag:manage', $systemcontext)) {
unset($tagnew->name);
unset($tagnew->rawname);
+19 -1
View File
@@ -104,6 +104,24 @@ function tag_delete_instance($record, $tagid) {
}
}
/**
* Set the description of a tag
*
* @param int $tagid the id of the tag
* @param string $description the description
* @param int $descriptionformat the moodle text format of the description
* @return true on success, false otherwise
*/
function tag_description_set($tagid, $description, $descriptionformat) {
if ($tag = get_record('tag', 'id', $tagid, '', '', '', '', 'id')) {
$tag->description = addslashes($description);
$tag->descriptionformat = addslashes($descriptionformat);
$tag->timemodified = time();
return update_record('tag', $tag);
}
return false;
}
/**
* Function that returns the name that should be displayed for a specific tag
*
@@ -595,7 +613,7 @@ function tag_add($tags, $type="default") {
// capitalization : the rawname is NOT the same at the rawtag.
$tag_object->rawname = addslashes($tag);
$tag_name_lc = moodle_strtolower($tag);
$tag_object->name = addslashes($tag_name_lc);
$tag_object->name = addslashes($tag_name_lc);
//var_dump($tag_object);
$tags_ids[$tag_name_lc] = insert_record('tag', $tag_object);
}