]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-12649: Prevent editing a blog from changing the display sort (based on creation...
authorscyrma <scyrma>
Mon, 7 Jul 2008 03:21:52 +0000 (03:21 +0000)
committerscyrma <scyrma>
Mon, 7 Jul 2008 03:21:52 +0000 (03:21 +0000)
blog/lib.php

index c999054b1cba2c3d893047a78ee0d7837bd154ee..08822530c1e630c6b07c499ef55426cfbbfc79f8 100755 (executable)
@@ -82,8 +82,8 @@
 
         $morelink = '<br />&nbsp;&nbsp;';
 
-        $totalentries = get_viewable_entry_count($postid, $bloglimit, $start, $filtertype, $filterselect, $tagid, $tag, $sort='lastmodified DESC');
-        $blogEntries = blog_fetch_entries($postid, $bloglimit, $start, $filtertype, $filterselect, $tagid, $tag, $sort='lastmodified DESC', true);
+        $totalentries = get_viewable_entry_count($postid, $bloglimit, $start, $filtertype, $filterselect, $tagid, $tag, $sort='created DESC');
+        $blogEntries = blog_fetch_entries($postid, $bloglimit, $start, $filtertype, $filterselect, $tagid, $tag, $sort='created DESC', true);
 
         print_paging_bar($totalentries, $blogpage, $bloglimit, get_baseurl($filtertype, $filterselect), 'blogpage');
 
         $template['title'] .= '<span class="nolink">'. format_string($blogEntry->subject) .'</span>';
         $template['userid'] = $blogEntry->userid;
         $template['author'] = fullname($DB->get_record('user', array('id'=>$blogEntry->userid)));
-        $template['lastmod'] = userdate($blogEntry->lastmodified);
         $template['created'] = userdate($blogEntry->created);
+
+        if($blogEntry->created != $blogEntry->lastmodified){
+            $template['lastmod'] = userdate($blogEntry->lastmodified);
+        }
+        
         $template['publishstate'] = $blogEntry->publishstate;
 
         /// preventing user to browse blogs that they aren't supposed to see
         $by = new object();
         $by->name =  '<a href="'.$CFG->wwwroot.'/user/view.php?id='.
                     $user->id.'&amp;course='.$COURSE->id.'">'.$fullname.'</a>';
-        $by->date = $template['lastmod'];
+        $by->date = $template['created'];
         print_string('bynameondate', 'forum', $by);
         echo '</div></td></tr>';
 
 
         echo '</div>';
 
+        if( isset($template['lastmod']) ){
+            echo '<div style="font-size: 55%;">';
+            echo ' [ '.get_string('modified').': '.$template['lastmod'].' ]';
+            echo '</div>';
+        }
+
         echo '</td></tr></table>'."\n\n";
 
     }