]> git.mjollnir.org Git - moodle.git/commitdiff
Checking in some blog-related user changes for testing on
authortoyomoyo <toyomoyo>
Thu, 9 Mar 2006 09:09:20 +0000 (09:09 +0000)
committertoyomoyo <toyomoyo>
Thu, 9 Mar 2006 09:09:20 +0000 (09:09 +0000)
another machine

user/index.php
user/tabs.php
version.php

index f4cc2369401887f878105feb5b2c915f26adae5a..4718f02daa770dd5f9045c64069ea46822a69590 100644 (file)
                      get_string('participants'), "", "", true, "&nbsp;", navmenu($course));
     }
 
+
+    //setting up tags
+    if ($id == SITEID) {
+        $filtertype = 'site';
+    } else if ($id && !$currentgroup) {
+        $filtertype = 'course';
+        $filterselect = $id;
+    } else {
+        $filtertype = 'group';
+        $filterselect = $currentgroup;
+    }
+    $currenttab = 'participants';
+    $user = $USER;
+
+    require_once($CFG->dirroot .'/user/tabs.php');
+
+
 /// Get the hidden field list
     if ($isteacher || isadmin()) {
         $hiddenfields = array();  // teachers and admins are allowed to see everything
 
     echo '<table class="controls" cellspacing="0"><tr>';
 
+    //print my course menus
+    echo '<td class="left">';
+    print_string('mycourses');
+    echo ': ';
+    $mycourses = get_my_courses($USER->id);
+    foreach ($mycourses as $mycourse) {
+        $my_course[$mycourse->id] = $mycourse->shortname;
+    }
+    //choose_from_menu($my_course, 'id', $course->id, '', 'courseform.submit()');
+    popup_form($CFG->wwwroot.'/user/index.php?id=',$my_course,'courseform',$course->id);
+    echo '</td></tr>';
+    
     if ($groupmode == VISIBLEGROUPS or ($groupmode and isteacheredit($course->id))) {
         if ($groups = get_records_menu("groups", "courseid", $course->id, "name ASC", "id,name")) {
             echo '<td class="left">';
index a42af3adc70a2512c23a37686db961430114b59b..bd9723392de5fa9c3feb3491e6f5664f69612a4c 100644 (file)
 /// This file to be included so we can assume config.php has already been included.
 /// We also assume that $user, $course, $currenttab have been set
 
+    if (!isset($filtertype)) {
+        $filtertype = '';
+    }
+    if (!isset($filterselect)) {
+        $filterselect = '';
+    }
 
     if (empty($currenttab) or empty($user) or empty($course)) {
-        error('You cannot call this script in that way');
+        //error('You cannot call this script in that way');
     }
 
-    print_heading(fullname($user, isteacher($course->id)));
-
-//if (!empty($USER) and (isteacher($course->id) or (($USER->id == $user->id) and !isguest()))) { // tabs are shown
+    if (($filtertype == 'site' && $filterselect) || ($filtertype=='user' && $filterselect)) {
+        $user = get_record('user','id',$filterselect);
+    }
 
     $inactive = NULL;
     $activetwo = NULL;
     $toprow = array();
 
-    $toprow[] = new tabobject('profile', $CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$course->id, 
-                get_string('profile'));
+    /**************************************
+     * Site Level participation or Blogs  *
+     **************************************/
+    if ($filtertype == 'site') {
 
+        $site = get_site();
+        print_heading($site->fullname);
+        
+        if ($CFG->bloglevel >= 4) {
+            $toprow[] = new tabobject('participants', $CFG->wwwroot.'/user/index.php?id='.SITEID,
+                get_string('participants'));
 
+            $toprow[] = new tabobject('blogs', $CFG->wwwroot.'/blog/index.php?filtertype=site&amp;',
+                get_string('blogs'));
+        }
 
-/// Can only edit profile if it belongs to user or current user is admin and not editing primary admin
+    /**************************************
+     * Course Level participation or Blogs  *
+     **************************************/
+    } else if ($filtertype == 'course' && $filterselect) {
 
-    if (($mainadmin = get_admin()) === false) {
-        $mainadmin->id = 0; /// Weird - no primary admin!
-    }
-    if ((!empty($USER->id) and ($USER->id == $user->id) and !isguest()) or 
-        (isadmin() and ($user->id != $mainadmin->id)) ) {
+        $course = get_record('course','id',$filterselect);
+        print_heading($course->fullname);
 
-        if(empty($CFG->loginhttps)) {
-            $wwwroot = $CFG->wwwroot;
-        } else {
-            $wwwroot = str_replace('http','https',$CFG->wwwroot);
+        if ($CFG->bloglevel >= 3) {
+
+            $toprow[] = new tabobject('participants', $CFG->wwwroot.'/user/index.php?id='.$filterselect.'&amp;group=0',
+                get_string('participants'));    //the groupid hack is necessary, otherwise the group in the session willbe used
+        
+            $toprow[] = new tabobject('blogs', $CFG->wwwroot.'/blog/index.php?filtertype=course&amp;filterselect='.$filterselect, get_string('blogs'));
         }
-        $toprow[] = new tabobject('editprofile', $wwwroot.'/user/edit.php?id='.$user->id.'&amp;course='.$course->id, 
-                    get_string('editmyprofile'));
-    }
 
+    /**************************************
+     * Group Level participation or Blogs  *
+     **************************************/
+    } else if ($filtertype == 'group' && $filterselect) {
 
-/// Everyone can see posts for this user
+        $group = get_record('groups','id',$filterselect);
+        print_heading($group->name);
 
-    $toprow[] = new tabobject('forumposts', $CFG->wwwroot.'/mod/forum/user.php?id='.$user->id.'&amp;course='.$course->id, 
-                get_string('forumposts', 'forum'));
+        if ($CFG->bloglevel >= 2) {
 
-    if (in_array($currenttab, array('posts', 'discussions'))) {
-        $inactive = array('forumposts');
-        $activetwo = array('forumposts');
+            $toprow[] = new tabobject('participants', $CFG->wwwroot.'/user/index.php?id='.$course->id.'&amp;group='.$filterselect,
+                get_string('participants'));
 
-        $secondrow = array();
-        $secondrow[] = new tabobject('posts', $CFG->wwwroot.'/mod/forum/user.php?course='.$course->id.
-                                  '&amp;id='.$user->id.'&amp;mode=posts', get_string('posts', 'forum'));
-        $secondrow[] = new tabobject('discussions', $CFG->wwwroot.'/mod/forum/user.php?course='.$course->id.
-                                  '&amp;id='.$user->id.'&amp;mode=discussions', get_string('discussions', 'forum'));
-    }
+        
+            $toprow[] = new tabobject('blogs', $CFG->wwwroot.'/blog/index.php?filtertype=group&amp;filterselect='.$filterselect, get_string('blogs'));
+        }
 
+    /*********************************************************************
+     * if selection in progress, only print blogs tab, in blog interface *
+     *********************************************************************/
+    } else if ($filtertype == 'course' || $filtertype == 'group') {
 
-/// Current user must be teacher of the course or the course allows user to view their reports
-    if (isteacher($course->id) or ($course->showreports and $USER->id == $user->id)) {
+        print_heading('');
+        $toprow[] = new tabobject('blogs', $CFG->wwwroot.'/blog/index.php?filtertype=site&amp;',
+                get_string('blogs'));
 
-        $toprow[] = new tabobject('reports', $CFG->wwwroot.'/course/user.php?id='.$course->id.
-                                  '&amp;user='.$user->id.'&amp;mode=outline', get_string('activityreports'));
+    /**************************************
+     * User Level participation or Blogs  *
+     **************************************/
+    } else {
+        if (isset($userid)) {
+            $user = get_record('user','id', $userid);
+        }
+        print_heading(fullname($user, isteacher($course->id)));
+        $toprow[] = new tabobject('profile', $CFG->wwwroot.'/user/view.php?id='.$user->id.'&amp;course='.$course->id,
+                    get_string('profile'));
 
-        if (in_array($currenttab, array('outline', 'complete', 'todaylogs', 'alllogs', 'stats'))) {
-            $inactive = array('reports');
-            $activetwo = array('reports');
 
-            $secondrow = array();
-            $secondrow[] = new tabobject('outline', $CFG->wwwroot.'/course/user.php?id='.$course->id.
-                                      '&amp;user='.$user->id.'&amp;mode=outline', get_string('outlinereport'));
-            $secondrow[] = new tabobject('complete', $CFG->wwwroot.'/course/user.php?id='.$course->id.
-                                      '&amp;user='.$user->id.'&amp;mode=complete', get_string('completereport'));
-            $secondrow[] = new tabobject('todaylogs', $CFG->wwwroot.'/course/user.php?id='.$course->id.
-                                      '&amp;user='.$user->id.'&amp;mode=todaylogs', get_string('todaylogs'));
-            $secondrow[] = new tabobject('alllogs', $CFG->wwwroot.'/course/user.php?id='.$course->id.
-                                      '&amp;user='.$user->id.'&amp;mode=alllogs', get_string('alllogs'));
-            if (!empty($CFG->enablestats)) {
-                $secondrow[] = new tabobject('stats',$CFG->wwwroot.'/course/user.php?id='.$course->id.
-                                             '&amp;user='.$user->id.'&amp;mode=stats',get_string('stats'));
+    /// Can only edit profile if it belongs to user or current user is admin and not editing primary admin
+
+        if (($mainadmin = get_admin()) === false) {
+            $mainadmin->id = 0; /// Weird - no primary admin!
+        }
+        if ((!empty($USER->id) and ($USER->id == $user->id) and !isguest()) or
+            (isadmin() and ($user->id != $mainadmin->id)) ) {
+
+            if(empty($CFG->loginhttps)) {
+                $wwwroot = $CFG->wwwroot;
+            } else {
+                $wwwroot = str_replace('http','https',$CFG->wwwroot);
             }
+            $toprow[] = new tabobject('editprofile', $wwwroot.'/user/edit.php?id='.$user->id.'&amp;course='.$course->id,
+                        get_string('editmyprofile'));
         }
 
-    }
+
+    /// Everyone can see posts for this user
+
+        $toprow[] = new tabobject('forumposts', $CFG->wwwroot.'/mod/forum/user.php?id='.$user->id.'&amp;course='.$course->id,
+                    get_string('forumposts', 'forum'));
+
+        if (in_array($currenttab, array('posts', 'discussions'))) {
+            $inactive = array('forumposts');
+            $activetwo = array('forumposts');
+
+            $secondrow = array();
+            $secondrow[] = new tabobject('posts', $CFG->wwwroot.'/mod/forum/user.php?course='.$course->id.
+                                      '&amp;id='.$user->id.'&amp;mode=posts', get_string('posts', 'forum'));
+            $secondrow[] = new tabobject('discussions', $CFG->wwwroot.'/mod/forum/user.php?course='.$course->id.
+                                      '&amp;id='.$user->id.'&amp;mode=discussions', get_string('discussions', 'forum'));
+        }
 
 
+    /// Blog entry, everyone can view
+        if ($CFG->bloglevel >= 1) {
+            $toprow[] = new tabobject('blogs', $CFG->wwwroot.'/blog/index.php?userid='.$user->id.'&amp;courseid='.$course->id, get_string('blogs', 'blog'));
+        }
+        
+
+    /// Current user must be teacher of the course or the course allows user to view their reports
+        if (isteacher($course->id) or ($course->showreports and $USER->id == $user->id)) {
+
+            $toprow[] = new tabobject('reports', $CFG->wwwroot.'/course/user.php?id='.$course->id.
+                                      '&amp;user='.$user->id.'&amp;mode=outline', get_string('activityreports'));
+
+            if (in_array($currenttab, array('outline', 'complete', 'todaylogs', 'alllogs', 'stats'))) {
+                $inactive = array('reports');
+                $activetwo = array('reports');
+
+                $secondrow = array();
+                $secondrow[] = new tabobject('outline', $CFG->wwwroot.'/course/user.php?id='.$course->id.
+                                          '&amp;user='.$user->id.'&amp;mode=outline', get_string('outlinereport'));
+                $secondrow[] = new tabobject('complete', $CFG->wwwroot.'/course/user.php?id='.$course->id.
+                                          '&amp;user='.$user->id.'&amp;mode=complete', get_string('completereport'));
+                $secondrow[] = new tabobject('todaylogs', $CFG->wwwroot.'/course/user.php?id='.$course->id.
+                                          '&amp;user='.$user->id.'&amp;mode=todaylogs', get_string('todaylogs'));
+                $secondrow[] = new tabobject('alllogs', $CFG->wwwroot.'/course/user.php?id='.$course->id.
+                                          '&amp;user='.$user->id.'&amp;mode=alllogs', get_string('alllogs'));
+                if (!empty($CFG->enablestats)) {
+                    $secondrow[] = new tabobject('stats',$CFG->wwwroot.'/course/user.php?id='.$course->id.
+                                                 '&amp;user='.$user->id.'&amp;mode=stats',get_string('stats'));
+                }
+            }
+
+        }
+
+    }    //close last bracket (individual tags)
+
 /// Add second row to display if there is one
 
     if (!empty($secondrow)) {
         $tabs = array($toprow);
     }
 
-
 /// Print out the tabs and continue!
 
     print_tabs($tabs, $currenttab, $inactive, $activetwo);
index 06e809f3b6f4c638a4f00e31c49dcfc465ba32e9..a74dfbca0cdcd099fba87964f9388e1da82b4efe 100644 (file)
@@ -6,7 +6,7 @@
 // This is compared against the values stored in the database to determine
 // whether upgrades should be performed (see lib/db/*.php)
 
-   $version = 2006030900;  // YYYYMMDD = date
+   $version = 2006030901;  // YYYYMMDD = date
                            //       XY = increments within a single day
 
    $release = '1.6 development';    // Human-friendly version name