]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14129, fix print_error() call, see tracker
authordongsheng <dongsheng>
Wed, 23 Apr 2008 08:00:05 +0000 (08:00 +0000)
committerdongsheng <dongsheng>
Wed, 23 Apr 2008 08:00:05 +0000 (08:00 +0000)
blog/blogpage.php
blog/index.php
blog/preferences.php

index 2d4fca3b62c9b17c4913cfc75c2a8902a1ce14bf..7dfb52b9cb239533ae664cd6fd8598a97f273982 100644 (file)
@@ -57,7 +57,7 @@ class page_blog extends page_base {
             $courserecord = NULL;
         } else {
             if (! ($courserecord = get_record('course', 'id', $this->courseid)) ) {
-                print_error( 'You are tring to view an invalid course. Id: ('. $this->courseid .')' );
+                print_error('invalidcourseid', 'error', '',  $this->courseid);
             }
         }
         $this->full_init_done = true;
index 27044896dd513f270135e22956f80ded7eb80593..8d8786dc401b08073c3210c80cda8532ee6b8460 100755 (executable)
@@ -24,7 +24,7 @@ $courseid     = optional_param('courseid', 0, PARAM_INT); // needed for user tab
 
 
 if (empty($CFG->bloglevel)) {
-    print_error('Blogging is disabled!');
+    print_error('blogdisable', 'blog');
 }
 
 $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
@@ -63,53 +63,53 @@ switch ($filtertype) {
 
     case 'site':
         if ($CFG->bloglevel < BLOG_SITE_LEVEL) {
-            print_error('Site blogs is not enabled');
+            print_error('siteblogdisable', 'blog');
         }
         if ($CFG->bloglevel < BLOG_GLOBAL_LEVEL) {
             require_login();
         }
         if (!has_capability('moodle/blog:view', $sitecontext)) {
-            print_error('You do not have the required permissions to view all site blogs');
+            print_error('cannotviewsiteblog', 'blog');
         }
     break;
 
     case 'course':
         if ($CFG->bloglevel < BLOG_COURSE_LEVEL) {
-            print_error('Course blogs is not enabled');
+            print_error('courseblogdisable', 'blog');
         }
         if (!$course = get_record('course', 'id', $filterselect)) {
-            print_error('Incorrect course id specified');
+            print_error('invalidcourseid');
         }
         $courseid = $course->id;
         $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
         require_login($course);
         if (!has_capability('moodle/blog:view', $coursecontext)) {
-            print_error('You do not have the required permissions to view blogs in this course');
+            print_error('cannotviewcourseblog', 'blog');
         }
     break;
 
     case 'group':
         if ($CFG->bloglevel < BLOG_GROUP_LEVEL) {
-            print_error('Group blogs is not enabled');
+            print_error('groupblogdisable', 'blog');
         }
         
         // fix for MDL-9268
         if (! $group = groups_get_group($filterselect)) { //TODO:check.
-            print_error('Incorrect group id specified');
+            print_error('invalidgroupid');
         }
         if (!$course = get_record('course', 'id', $group->courseid)) {
-            print_error('Incorrect course id specified');
+            print_error('invalidcourseid');
         }
         $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
         $courseid = $course->id;
         require_login($course);
         if (!has_capability('moodle/blog:view', $coursecontext)) {
-            print_error('You do not have the required permissions to view blogs in this course/group');
+            print_error('cannotviewcourseorgroupblog', 'blog');
         }
         if (groups_get_course_groupmode($course) == SEPARATEGROUPS
           and !has_capability('moodle/site:accessallgroups', $coursecontext)) {
             if (!groups_is_member($filterselect)) {
-                error ('You are not a member of this course group');
+                print_error('notmemberofgroup');
             }
         }
 
@@ -117,24 +117,24 @@ switch ($filtertype) {
 
     case 'user':
         if ($CFG->bloglevel < BLOG_USER_LEVEL) {
-            print_error('Blogs is not enabled');
+            print_error('blogdisable', 'blog');
         }
         if (!$user = get_record('user', 'id', $filterselect)) {
-            print_error('Incorrect user id');
+            print_error('invaliduserid');
         }
         if ($USER->id == $filterselect) {
             if (!has_capability('moodle/blog:create', $sitecontext)
               and !has_capability('moodle/blog:view', $sitecontext)) {
-                print_error('You do not have your own blog, sorry.');
+                print_error('donothaveblog', 'blog');
             }
         } else {
             $personalcontext = get_context_instance(CONTEXT_USER, $filterselect);
             if (!has_capability('moodle/blog:view', $sitecontext) 
               and !has_capability('moodle/user:readuserblogs', $personalcontext)) {
-                print_error('You do not have the required permissions to read user blogs');
+                print_error('cannotviewuserblog', 'blog');
             }
             if (!blog_user_can_view_user_post($filterselect)) {
-                print_error('You can not view blog of this user, sorry.');
+                print_error('cannotviewcourseblog', 'blog');
             }
         }
         $userid = $filterselect;
@@ -146,7 +146,7 @@ switch ($filtertype) {
     break;
 
     default:
-        print_error('Incorrect blog filter type specified');
+        print_error('incorrectblogfilter', 'blog');
     break;
 }
 
index 81daa68b4147f59b0b1a3759d8632db8c97d98ff..ee0017cf1e85f56b20be0387b0ac5cfed71e9bd1 100755 (executable)
@@ -15,7 +15,7 @@
     }
 
     if (empty($CFG->bloglevel)) {
-        print_error('Blogging is disabled!');
+        print_error('blogdisable', 'blog');
     }
 
     require_capability('moodle/blog:view', $context);
@@ -26,7 +26,7 @@
         $pagesize = required_param('pagesize', PARAM_INT);
 
         if ($pagesize < 1) {
-            print_error('invalid page size');
+            print_error('invalidpagesize');
         }
         set_user_preference('blogpagesize', $pagesize);