From: toyomoyo Date: Thu, 30 Aug 2007 05:34:31 +0000 (+0000) Subject: modifying manage tags page to print user names, allowing modifying of tag types,... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=79081e871b002ce7a4010c9bcfd586612b67a909;p=moodle.git modifying manage tags page to print user names, allowing modifying of tag types, minor css --- diff --git a/lang/en_utf8/tag.php b/lang/en_utf8/tag.php index 4d73ae55c7..bb744c4d53 100644 --- a/lang/en_utf8/tag.php +++ b/lang/en_utf8/tag.php @@ -3,7 +3,7 @@ $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'; @@ -13,9 +13,9 @@ $string['flagasinappropriate'] = 'Flag as inappropriate'; $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'; @@ -28,11 +28,13 @@ $string['searchtags'] = 'Search 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'; diff --git a/tag/lib.php b/tag/lib.php index a3a153f4ea..bb9ef7b5d2 100644 --- a/tag/lib.php +++ b/tag/lib.php @@ -1513,7 +1513,7 @@ function print_tag_management_list($perpage='100') { //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'), @@ -1521,6 +1521,7 @@ function print_tag_management_list($perpage='100') { get_string('flag','tag'), get_string('timemodified','tag'), get_string('newname', 'tag'), + get_string('tagtype', 'tag'), get_string('select', 'tag') ); @@ -1563,9 +1564,9 @@ function print_tag_management_list($perpage='100') { $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 @@ -1600,12 +1601,14 @@ function print_tag_management_list($perpage='100') { $id = $tag->id; $name = ''. tag_display_name($tag) .''; - $owner = '' . $tag->owner . ''; + $owner = '' . fullname($tag) . ''; $count = $tag->count; $flag = $tag->flag; $timemodified = format_time(time() - $tag->timemodified); $checkbox = ''; $text = ''; + $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) { @@ -1615,9 +1618,10 @@ function print_tag_management_list($perpage='100') { $count = '' . $count . ''; $flag = '' . $flag . ''; $timemodified = '' . $timemodified . ''; + $tagtype = ''. $tagtype. ''; } - $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); } @@ -1630,6 +1634,7 @@ function print_tag_management_list($perpage='100') { + '; diff --git a/tag/manage.php b/tag/manage.php index f9097088ce..e40b58c602 100644 --- a/tag/manage.php +++ b/tag/manage.php @@ -16,6 +16,7 @@ require_capability('moodle/tag:manage', $systemcontext); $tagschecked = optional_param('tagschecked', array()); $newnames = optional_param('newname', array()); +$tagtypes = optional_param('tagtypes', array()); $action = optional_param('action', '', PARAM_ALPHA); $navlinks = array(); @@ -45,11 +46,24 @@ switch($action) { 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 ); diff --git a/theme/standard/styles_layout.css b/theme/standard/styles_layout.css index 8d5ea60d35..0d713d7a1a 100644 --- a/theme/standard/styles_layout.css +++ b/theme/standard/styles_layout.css @@ -3103,11 +3103,14 @@ body#user-index #showall { margin: 10px 0px; } -body#user-index table#participants { +body#user-index table#participants, +body#tag-manage table#tag-management-list { margin: auto; width: 80%; } +body#tag-manage table#tag-management-list td, +body#tag-manage table#tag-management-list, th, body#user-index table#participants td, body#user-index table#participants th { vertical-align: middle;