]> git.mjollnir.org Git - moodle.git/commitdiff
modifying manage tags page to print user names, allowing modifying of tag types,...
authortoyomoyo <toyomoyo>
Thu, 30 Aug 2007 05:34:31 +0000 (05:34 +0000)
committertoyomoyo <toyomoyo>
Thu, 30 Aug 2007 05:34:31 +0000 (05:34 +0000)
lang/en_utf8/tag.php
tag/lib.php
tag/manage.php
theme/standard/styles_layout.css

index 4d73ae55c7d29a78bdd31841982bbdca742ad41f..bb744c4d5342a386270aa305f30a79ff3e22c856 100644 (file)
@@ -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';
index a3a153f4ea590ec6f54a55b3a2fabf027b2d6515..bb9ef7b5d273960a466cad4bba6b2fe82f9bc461 100644 (file)
@@ -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           =   '<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) {
@@ -1615,9 +1618,10 @@ function print_tag_management_list($perpage='100') {
                 $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);
         }
@@ -1630,6 +1634,7 @@ function print_tag_management_list($perpage='100') {
                     <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>';
 
index f9097088ceb764905728a3b628728adeda297180..e40b58c60256b4719b950196f3f4f01e74abe708 100644 (file)
@@ -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 );
         
index 8d5ea60d358f0fabeab9d72547113722ab69b55f..0d713d7a1af707c8df81490f6ed4818565c5af06 100644 (file)
@@ -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;