]> git.mjollnir.org Git - moodle.git/commitdiff
fixing counter for (name filters) manage tag page, adding last 10 blogs to tag/index.php
authortoyomoyo <toyomoyo>
Thu, 30 Aug 2007 08:37:53 +0000 (08:37 +0000)
committertoyomoyo <toyomoyo>
Thu, 30 Aug 2007 08:37:53 +0000 (08:37 +0000)
lang/en_utf8/tag.php
tag/index.php
tag/lib.php

index bb744c4d5342a386270aa305f30a79ff3e22c856..64561e5ac005a0e667ff20eb5ea10b6da955d147 100644 (file)
@@ -12,6 +12,7 @@ $string['flag'] = 'Flag';
 $string['flagasinappropriate'] = 'Flag as inappropriate';
 $string['helprelatedtags'] = 'Comma separated related tags';
 $string['id'] = 'id';
+$string['lasttenblogs'] = 'Last 10 blogs';
 $string['managetags'] = 'Manage tags';
 $string['name'] = 'Tag name';
 $string['namesalreadybeeingused'] = 'Tag names already being used';
index e4aed35909f94de405fac03f81fd4c8beb84a3a5..041a9aac30f263dfcb508dc3116c14b47b1cc4e2 100644 (file)
@@ -83,8 +83,24 @@ if ($usercount > 0) {
 
 }
 
-echo '</td>';
+// print last 10 blogs
+print_string('lasttenblogs', 'tag');
+
+print_box_start();
+
+// I was not able to use get_items_tagged_with() because it automatically 
+// tries to join on 'blog' table, since the itemtype is 'blog'. However blogs
+// uses the post table so this would not really work.
+if ($blogs = fetch_entries('', 10, 0, 'site', '', $tag->id)) {
+
+    foreach ($blogs as $blog) {
+        blog_print_entry($blog);
+    }
 
+}
+print_box_end();
+
+echo '</td>';
 
 
 //----------------- right column -----------------
index bb9ef7b5d273960a466cad4bba6b2fe82f9bc461..033d47138b081306c890ad2297d2db1151f2635d 100644 (file)
@@ -1581,11 +1581,13 @@ function print_tag_management_list($perpage='100') {
         {$sort}
         ";
 
-    $totalcount = count_records('tag');
 
-    $table->initialbars($totalcount > $perpage);
-    $table->pagesize($perpage, $totalcount);
+    $totalcount = count_records_sql("SELECT COUNT(DISTINCT(tg.id)) 
+                                     FROM {$CFG->prefix}tag tg LEFT JOIN {$CFG->prefix}user u ON u.id = tg.userid
+                                     $where");
 
+    $table->initialbars(true); // always initial bars
+    $table->pagesize($perpage, $totalcount);
 
     echo '<form id="tag-management-form" method="post" action="'.$CFG->wwwroot.'/tag/manage.php">';
 
@@ -1607,7 +1609,18 @@ function print_tag_management_list($perpage='100') {
             $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');
+            
+            // get all the possible tag types from db
+            $tagtypes = array();
+            if ($ptypes = get_records_sql("SELECT DISTINCT(tagtype), id FROM {$CFG->prefix}tag")) {
+                foreach ($ptypes as $ptype) {
+                    $tagtypes[$ptype->tagtype] = $ptype->tagtype;
+                }
+            }
+            // default types
+            $tagtypes['default']='default';
+            $tagtypes['official']='official';
+            
             $tagtype        =   choose_from_menu ($tagtypes, 'tagtypes['.$tag->id.']', $tag->tagtype, '', '', '0', true);
 
             //if the tag if flagged, highlight it