$string['addtagtomyinterests'] = 'Add \"$a\" to my interests';
$string['blocktagstitle'] = 'Tags';
$string['count'] = 'Count';
-$string['changename'] = 'Change name';
+$string['changename'] = 'Change tag name';
$string['description'] = 'Description';
$string['delete'] = 'Delete';
$string['deleted'] = 'Deleted';
$string['helprelatedtags'] = 'Comma separated related tags';
$string['id'] = 'id';
$string['managetags'] = 'Manage tags';
-$string['name'] = 'Name';
+$string['name'] = 'Tag name';
$string['namesalreadybeeingused'] = 'Tag names already being used';
-$string['newname'] = 'New Name';
+$string['newname'] = 'New tag name';
$string['noresultsfor'] = 'No results for \"$a\"';
$string['owner'] = 'Owner';
$string['relatedtags'] = 'Related tags';
$string['select'] = 'Select';
$string['tagdescription'] = 'Tag description';
$string['tag'] = 'Tag';
+$string['tagtype'] = 'Tag type';
$string['tags'] = 'Tags';
$string['tagsaredisabled'] = 'Tags are disabled';
$string['thingstaggedwith'] = '$a->count things tagged with \"$a->name\"';
$string['thistaghasnodesc'] = 'This tag currently has no description.';
$string['timemodified'] = 'Modified';
+$string['typechanged'] = 'Tag type changed';
$string['userstaggedwith'] = 'Users tagged with \"$a\"';
$string['updatetag'] = 'Update';
$string['updated'] = 'Updated';
//setup table
- $tablecolumns = array('id','name', 'owner', 'count', 'flag', 'timemodified', 'rawname', '');
+ $tablecolumns = array('id','name', 'fullname', 'count', 'flag', 'timemodified', 'rawname', 'tagtype', '');
$tableheaders = array( get_string('id' , 'tag'),
get_string('name' , 'tag'),
get_string('owner','tag'),
get_string('flag','tag'),
get_string('timemodified','tag'),
get_string('newname', 'tag'),
+ get_string('tagtype', 'tag'),
get_string('select', 'tag')
);
$query = "
SELECT
- tg.id, tg.name, tg.rawname, COUNT(ti.id) AS count, u.id AS owner, tg.flag, tg.timemodified
+ tg.id, tg.name, tg.rawname, tg.tagtype, COUNT(ti.id) AS count, u.id AS owner, tg.flag, tg.timemodified, u.firstname, u.lastname
FROM
- {$CFG->prefix}tag_instance ti
+ {$CFG->prefix}tag_instance ti
RIGHT JOIN
{$CFG->prefix}tag tg
ON
$id = $tag->id;
$name = '<a href="'.$CFG->wwwroot.'/tag/index.php?id='.$tag->id.'">'. tag_display_name($tag) .'</a>';
- $owner = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$tag->owner.'">' . $tag->owner . '</a>';
+ $owner = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$tag->owner.'">' . fullname($tag) . '</a>';
$count = $tag->count;
$flag = $tag->flag;
$timemodified = format_time(time() - $tag->timemodified);
$checkbox = '<input type="checkbox" name="tagschecked[]" value="'.$tag->id.'" />';
$text = '<input type="text" name="newname['.$tag->id.']" />';
+ $tagtypes = array('default'=>'default', 'official'=>'official');
+ $tagtype = choose_from_menu ($tagtypes, 'tagtypes['.$tag->id.']', $tag->tagtype, '', '', '0', true);
//if the tag if flagged, highlight it
if ($tag->flag > 0) {
$count = '<span class="flagged-tag">' . $count . '</span>';
$flag = '<span class="flagged-tag">' . $flag . '</span>';
$timemodified = '<span class="flagged-tag">' . $timemodified . '</span>';
+ $tagtype = '<span class="flagged-tag">'. $tagtype. '</span>';
}
- $data = array($id, $name , $owner ,$count ,$flag, $timemodified, $text, $checkbox);
+ $data = array($id, $name , $owner ,$count ,$flag, $timemodified, $text, $tagtype, $checkbox);
$table->add_data($data);
}
<option value="" selected="selected">'. get_string('withselectedtags', 'tag') .'</option>
<option value="reset">'. get_string('resetflag', 'tag') .'</option>
<option value="delete">'. get_string('delete', 'tag') .'</option>
+ <option value="changetype">'. get_string('changetype', 'tag') .'</option>
<option value="changename">'. get_string('changename', 'tag') .'</option>
</select>';
$tagschecked = optional_param('tagschecked', array());
$newnames = optional_param('newname', array());
+$tagtypes = optional_param('tagtypes', array());
$action = optional_param('action', '', PARAM_ALPHA);
$navlinks = array();
tag_flag_reset(implode($tagschecked, ','));
break;
+ case 'changetype':
+ foreach ($tagschecked as $tag_id){
+
+ // update tag type;
+ $tag = tag_by_id($tag_id);
+
+ $tag -> tagtype = $tagtypes[$tag_id];
+ if (update_record('tag', $tag)) {
+ $notice .= ' -- ' . get_string('typechanged','tag');
+ }
+ }
+
+ break;
case 'changename':
$normalized_new_names_csv = tag_normalize( str_replace(',,','',implode($newnames, ',')) );
-
+
//tag names entered might already exist
$existing_tags = tags_id( $normalized_new_names_csv );