mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
some UI changes
This commit is contained in:
parent
b367b152ad
commit
7e2d7c92ad
6 changed files with 88 additions and 26 deletions
|
@ -1,6 +1,14 @@
|
||||||
|
|
||||||
<form name="assignform" id="assignform" method="post" action="assign.php">
|
<form name="assignform" id="assignform" method="post" action="assign.php">
|
||||||
<input type="hidden" name="previoussearch" value="<?php echo $previoussearch ?>" />
|
<input type="hidden" name="previoussearch" value="<?php echo $previoussearch ?>" />
|
||||||
|
<?php
|
||||||
|
if ($userid) {
|
||||||
|
print ('<input type="hidden" name="userid" value="'.$userid.'"/>');
|
||||||
|
}
|
||||||
|
if ($course->id) {
|
||||||
|
print ('<input type="hidden" name="courseid" value="'.$courseid.'" />');
|
||||||
|
}
|
||||||
|
?>
|
||||||
<input type="hidden" name="sesskey" value="<?php echo sesskey() ?>" />
|
<input type="hidden" name="sesskey" value="<?php echo sesskey() ?>" />
|
||||||
<input type="hidden" name="contextid" value="<?php echo $contextid ?>" />
|
<input type="hidden" name="contextid" value="<?php echo $contextid ?>" />
|
||||||
<input type="hidden" name="roleid" value="<?php echo $roleid ?>" />
|
<input type="hidden" name="roleid" value="<?php echo $roleid ?>" />
|
||||||
|
|
|
@ -16,6 +16,12 @@
|
||||||
$previoussearch = ($searchtext != '') or ($previoussearch) ? 1:0;
|
$previoussearch = ($searchtext != '') or ($previoussearch) ? 1:0;
|
||||||
$timestart = optional_param('timestart', 0, PARAM_INT);
|
$timestart = optional_param('timestart', 0, PARAM_INT);
|
||||||
$timeend = optional_param('timened', 0, PARAM_INT);
|
$timeend = optional_param('timened', 0, PARAM_INT);
|
||||||
|
$userid = optional_param('userid', 0, PARAM_INT); // needed for user tabs
|
||||||
|
$courseid = optional_param('courseid', 0, PARAM_INT); // needed for user tabs
|
||||||
|
|
||||||
|
if ($courseid) {
|
||||||
|
$course = get_record('course', 'id', $courseid);
|
||||||
|
}
|
||||||
|
|
||||||
if (! $site = get_site()) {
|
if (! $site = get_site()) {
|
||||||
redirect("$CFG->wwwroot/$CFG->admin/index.php");
|
redirect("$CFG->wwwroot/$CFG->admin/index.php");
|
||||||
|
@ -38,7 +44,6 @@
|
||||||
* end of permission checking
|
* end of permission checking
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$strassignusers = get_string('assignusers', 'role');
|
$strassignusers = get_string('assignusers', 'role');
|
||||||
$strpotentialusers = get_string('potentialusers', 'role');
|
$strpotentialusers = get_string('potentialusers', 'role');
|
||||||
$strexistingusers = get_string('existingusers', 'role');
|
$strexistingusers = get_string('existingusers', 'role');
|
||||||
|
@ -48,9 +53,20 @@
|
||||||
$strsearch = get_string('search');
|
$strsearch = get_string('search');
|
||||||
$strshowall = get_string('showall');
|
$strshowall = get_string('showall');
|
||||||
|
|
||||||
$currenttab = '';
|
$context = get_record('context', 'id', $contextid);
|
||||||
$tabsmode = 'assign';
|
|
||||||
include_once('tabs.php');
|
// we got a few tabs there
|
||||||
|
if ($context->level == CONTEXT_USERID) {
|
||||||
|
print_header();
|
||||||
|
|
||||||
|
$currenttab = 'roles';
|
||||||
|
include_once($CFG->dirroot.'/user/tabs.php');
|
||||||
|
} else {
|
||||||
|
$currenttab = '';
|
||||||
|
$tabsmode = 'assign';
|
||||||
|
include_once('tabs.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Print a help notice about the need to use this page
|
/// Print a help notice about the need to use this page
|
||||||
|
|
||||||
|
@ -129,7 +145,13 @@
|
||||||
// prints a form to swap roles
|
// prints a form to swap roles
|
||||||
print ('<form name="rolesform" action="assign.php" method="post">');
|
print ('<form name="rolesform" action="assign.php" method="post">');
|
||||||
print ('<div align="center">'.$strcurrentcontext.': '.print_context_name($context).'<br/>');
|
print ('<div align="center">'.$strcurrentcontext.': '.print_context_name($context).'<br/>');
|
||||||
print ('<input type="hidden" name="contextid" value="'.$context->id.'">'.$strcurrentrole.': ');
|
if ($userid) {
|
||||||
|
print ('<input type="hidden" name="userid" value="'.$userid.'" />');
|
||||||
|
}
|
||||||
|
if ($course->id) {
|
||||||
|
print ('<input type="hidden" name="courseid" value="'.$courseid.'" />');
|
||||||
|
}
|
||||||
|
print ('<input type="hidden" name="contextid" value="'.$context->id.'" />'.$strcurrentrole.': ');
|
||||||
choose_from_menu ($options, 'roleid', $roleid, 'choose', $script='rolesform.submit()');
|
choose_from_menu ($options, 'roleid', $roleid, 'choose', $script='rolesform.submit()');
|
||||||
print ('</div></form>');
|
print ('</div></form>');
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ if ($currenttab != 'update') {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CONTEXT_USERID:
|
case CONTEXT_USERID:
|
||||||
|
print_header();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CONTEXT_COURSECAT:
|
case CONTEXT_COURSECAT:
|
||||||
|
@ -82,7 +83,7 @@ if ($currenttab != 'update') {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$toprow[] = new tabobject('roles', $CFG->wwwroot.'/admin/roles/assign.php?contextid='.$context->id, get_string('roles'));
|
$toprow[] = new tabobject('roles', $CFG->wwwroot.'/admin/roles/assign.php?contextid='.$context->id, get_string('roles'));
|
||||||
|
|
||||||
if (isset($tabsmode)) {
|
if (isset($tabsmode)) {
|
||||||
$inactive[] = 'roles';
|
$inactive[] = 'roles';
|
||||||
|
|
|
@ -59,10 +59,15 @@
|
||||||
$currenttab = $mode;
|
$currenttab = $mode;
|
||||||
include($CFG->dirroot.'/user/tabs.php');
|
include($CFG->dirroot.'/user/tabs.php');
|
||||||
|
|
||||||
|
|
||||||
get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
|
get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
|
||||||
|
|
||||||
switch ($mode) {
|
switch ($mode) {
|
||||||
|
case "grade":
|
||||||
|
$course = get_record('course', 'id', required_param('id', PARAM_INT));
|
||||||
|
require_once($CFG->dirroot.'/grade/lib.php');
|
||||||
|
grade_view_all_grades($user->id, 'user');
|
||||||
|
break;
|
||||||
|
|
||||||
case "todaylogs" :
|
case "todaylogs" :
|
||||||
echo '<div class="graph">';
|
echo '<div class="graph">';
|
||||||
print_log_graph($course, $user->id, "userday.png");
|
print_log_graph($course, $user->id, "userday.png");
|
||||||
|
|
|
@ -666,7 +666,7 @@ function grade_drop_lowest($grades, $drop, $total) {
|
||||||
return $grades;
|
return $grades;
|
||||||
}
|
}
|
||||||
|
|
||||||
function grade_get_grades() {
|
function grade_get_grades($mode='') {
|
||||||
global $CFG;
|
global $CFG;
|
||||||
global $course;
|
global $course;
|
||||||
$mods = grade_get_grade_items($course->id);
|
$mods = grade_get_grade_items($course->id);
|
||||||
|
@ -675,7 +675,7 @@ function grade_get_grades() {
|
||||||
if ($mods) {
|
if ($mods) {
|
||||||
foreach ($mods as $mod) {
|
foreach ($mods as $mod) {
|
||||||
// hidden is a gradebook setting for an assignment and visible is a course_module setting
|
// hidden is a gradebook setting for an assignment and visible is a course_module setting
|
||||||
if (($mod->hidden != 1 && $mod->visible==1) or (isteacher($course->id) && $preferences->show_hidden==1)) {
|
if (($mod->hidden != 1 && $mod->visible==1) or (isteacher($course->id) && $preferences->show_hidden==1 && mode=='grade')) {
|
||||||
$libfile = "$CFG->dirroot/mod/$mod->modname/lib.php";
|
$libfile = "$CFG->dirroot/mod/$mod->modname/lib.php";
|
||||||
if (file_exists($libfile)) {
|
if (file_exists($libfile)) {
|
||||||
require_once($libfile);
|
require_once($libfile);
|
||||||
|
@ -1969,11 +1969,10 @@ function grade_view_category_grades($view_by_student) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function grade_view_all_grades($view_by_student) {
|
function grade_view_all_grades($view_by_student, $mode='') { // if mode=='grade' then we are in user view
|
||||||
// displays all grades for the course
|
// displays all grades for the course
|
||||||
global $CFG;
|
global $CFG;
|
||||||
global $course;
|
global $course;
|
||||||
global $preferences;
|
|
||||||
global $USER;
|
global $USER;
|
||||||
global $group; // yu: fix for 5814
|
global $group; // yu: fix for 5814
|
||||||
|
|
||||||
|
@ -1981,11 +1980,17 @@ function grade_view_all_grades($view_by_student) {
|
||||||
$view_by_student = $USER->id;
|
$view_by_student = $USER->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$preferences = grade_get_preferences($course->id);
|
||||||
|
|
||||||
list($grades_by_student, $all_categories) = grade_get_formatted_grades();
|
list($grades_by_student, $all_categories) = grade_get_formatted_grades();
|
||||||
|
|
||||||
if ($grades_by_student != 0 && $all_categories != 0) {
|
if ($grades_by_student != 0 && $all_categories != 0) {
|
||||||
|
|
||||||
// output a form for the user to download the grades.
|
// output a form for the user to download the grades.
|
||||||
grade_download_form();
|
|
||||||
|
if ($mode!='user') {
|
||||||
|
grade_download_form();
|
||||||
|
}
|
||||||
|
|
||||||
if ($view_by_student != -1) {
|
if ($view_by_student != -1) {
|
||||||
// unset all grades except for this student
|
// unset all grades except for this student
|
||||||
|
@ -1995,6 +2000,7 @@ function grade_view_all_grades($view_by_student) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$grade_columns = $preferences->show_weighted + $preferences->show_points + $preferences->show_percent;
|
$grade_columns = $preferences->show_weighted + $preferences->show_points + $preferences->show_percent;
|
||||||
|
|
||||||
$first = 0;
|
$first = 0;
|
||||||
|
@ -2003,7 +2009,7 @@ function grade_view_all_grades($view_by_student) {
|
||||||
$reprint=0;
|
$reprint=0;
|
||||||
|
|
||||||
echo '<table align="center" class="grades">';
|
echo '<table align="center" class="grades">';
|
||||||
if (isteacher($course->id) ) {
|
if (!$mode=='user' && isteacher($course->id) ) {
|
||||||
$student_heading_link = get_string('student','grades');
|
$student_heading_link = get_string('student','grades');
|
||||||
if ($view_by_student == -1) {
|
if ($view_by_student == -1) {
|
||||||
$student_heading_link .='<a href="?id='.$course->id.'&action=grades&sort=lastname&group='.$group.'"><br /><font size="-2">'.get_string('sortbylastname','grades').'</font></a>';
|
$student_heading_link .='<a href="?id='.$course->id.'&action=grades&sort=lastname&group='.$group.'"><br /><font size="-2">'.get_string('sortbylastname','grades').'</font></a>';
|
||||||
|
@ -2022,7 +2028,9 @@ function grade_view_all_grades($view_by_student) {
|
||||||
$rowcount = 0;
|
$rowcount = 0;
|
||||||
$oddrow = true;
|
$oddrow = true;
|
||||||
$colcount = 0;
|
$colcount = 0;
|
||||||
|
|
||||||
foreach($grades_by_student as $student => $categories) {
|
foreach($grades_by_student as $student => $categories) {
|
||||||
|
|
||||||
$totalpoints = 0;
|
$totalpoints = 0;
|
||||||
$totalgrade = 0;
|
$totalgrade = 0;
|
||||||
$total_bonus_points = 0;
|
$total_bonus_points = 0;
|
||||||
|
@ -2036,7 +2044,7 @@ function grade_view_all_grades($view_by_student) {
|
||||||
$oddrow = !$oddrow;
|
$oddrow = !$oddrow;
|
||||||
|
|
||||||
// set the links to student information based on multiview or individual... if individual go to student info... if many go to individual grades view.
|
// set the links to student information based on multiview or individual... if individual go to student info... if many go to individual grades view.
|
||||||
if (isteacher($course->id)) {
|
if (isteacher($course->id) && !$mode=='user') {
|
||||||
if ($view_by_student != -1) {
|
if ($view_by_student != -1) {
|
||||||
$studentviewlink = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$student.'&course='.$course->id.'">'.$grades_by_student[$student]['student_data']['lastname'].', '.$grades_by_student[$student]['student_data']['firstname'].'</a>';
|
$studentviewlink = '<a href="'.$CFG->wwwroot.'/user/view.php?id='.$student.'&course='.$course->id.'">'.$grades_by_student[$student]['student_data']['lastname'].', '.$grades_by_student[$student]['student_data']['firstname'].'</a>';
|
||||||
}
|
}
|
||||||
|
@ -2046,8 +2054,10 @@ function grade_view_all_grades($view_by_student) {
|
||||||
$row .= '<td>'. $studentviewlink .'</td>';
|
$row .= '<td>'. $studentviewlink .'</td>';
|
||||||
}
|
}
|
||||||
ksort($categories);
|
ksort($categories);
|
||||||
|
|
||||||
foreach($categories as $category => $items) {
|
foreach($categories as $category => $items) {
|
||||||
if ($category != 'student_data') {
|
if ($category != 'student_data') {
|
||||||
|
|
||||||
if ($first == 0) {
|
if ($first == 0) {
|
||||||
$colcount++;
|
$colcount++;
|
||||||
if ($category == UNCATEGORISED) {
|
if ($category == UNCATEGORISED) {
|
||||||
|
@ -2086,7 +2096,6 @@ function grade_view_all_grades($view_by_student) {
|
||||||
//$total_course_points = $all_categories[$category]['stats']['totalpoints']+ $total_course_points;
|
//$total_course_points = $all_categories[$category]['stats']['totalpoints']+ $total_course_points;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($preferences->show_points) {
|
if ($preferences->show_points) {
|
||||||
$row .= '<td align="right">' . $items['stats']['points'] . '</td>';
|
$row .= '<td align="right">' . $items['stats']['points'] . '</td>';
|
||||||
}
|
}
|
||||||
|
@ -2108,7 +2117,7 @@ function grade_view_all_grades($view_by_student) {
|
||||||
$total_columns = $grade_columns;
|
$total_columns = $grade_columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isteacher($course->id) && $view_by_student == -1) {
|
if (isteacher($course->id) && $view_by_student == -1 && !$mode=='user') {
|
||||||
$grade_sort_link = '<a href="?id='.$course->id.'&action=grades&sort=highgrade&group='.$group.'"><img src="'.$CFG->wwwroot.'/pix/t/down.gif" alt="'.get_string('highgradedescending','grades').'" /></a>';
|
$grade_sort_link = '<a href="?id='.$course->id.'&action=grades&sort=highgrade&group='.$group.'"><img src="'.$CFG->wwwroot.'/pix/t/down.gif" alt="'.get_string('highgradedescending','grades').'" /></a>';
|
||||||
$grade_sort_link .= '<a href="?id='.$course->id.'&action=grades&sort=highgrade_asc&group='.$group.'"><img src="'.$CFG->wwwroot.'/pix/t/up.gif" alt="'.get_string('highgradeascending','grades').'" /></a>';
|
$grade_sort_link .= '<a href="?id='.$course->id.'&action=grades&sort=highgrade_asc&group='.$group.'"><img src="'.$CFG->wwwroot.'/pix/t/up.gif" alt="'.get_string('highgradeascending','grades').'" /></a>';
|
||||||
$points_sort_link = '<a href="?id='.$course->id.'&action=grades&sort=points&group='.$group.'"><img src="'.$CFG->wwwroot.'/pix/t/down.gif" alt="'.get_string('pointsdescending','grades').'" /></a>';
|
$points_sort_link = '<a href="?id='.$course->id.'&action=grades&sort=points&group='.$group.'"><img src="'.$CFG->wwwroot.'/pix/t/down.gif" alt="'.get_string('pointsdescending','grades').'" /></a>';
|
||||||
|
@ -2120,7 +2129,7 @@ function grade_view_all_grades($view_by_student) {
|
||||||
}
|
}
|
||||||
$stats_link = '<a href="javascript:void(0)"onclick="window.open(\'?id='.$course->id.'&action=stats&category=all\',\''.get_string('statslink','grades').'\',\'height=200,width=300,scrollbars=no\')"><font size=-2>'.get_string('statslink','grades').'</font></a>';
|
$stats_link = '<a href="javascript:void(0)"onclick="window.open(\'?id='.$course->id.'&action=stats&category=all\',\''.get_string('statslink','grades').'\',\'height=200,width=300,scrollbars=no\')"><font size=-2>'.get_string('statslink','grades').'</font></a>';
|
||||||
$header .= '<th colspan="'.$total_columns.'">'.get_string('total','grades').' '.$stats_link.'</th>';
|
$header .= '<th colspan="'.$total_columns.'">'.get_string('total','grades').' '.$stats_link.'</th>';
|
||||||
if (isteacher($course->id) && $view_by_student == -1) {
|
if (isteacher($course->id) && $view_by_student == -1 && !$mode=='user') {
|
||||||
if ($preferences->show_points) {
|
if ($preferences->show_points) {
|
||||||
$header1 .= '<th>'.get_string('points','grades').'('.$all_categories['stats']['totalpoints'].')';
|
$header1 .= '<th>'.get_string('points','grades').'('.$all_categories['stats']['totalpoints'].')';
|
||||||
if ($category != 'student_data' && $all_categories[$category]['stats']['bonus_points'] != 0) {
|
if ($category != 'student_data' && $all_categories[$category]['stats']['bonus_points'] != 0) {
|
||||||
|
@ -2159,14 +2168,14 @@ function grade_view_all_grades($view_by_student) {
|
||||||
}
|
}
|
||||||
$header1 .= '</tr>';
|
$header1 .= '</tr>';
|
||||||
}
|
}
|
||||||
if (isteacher($course->id)) {
|
if (isteacher($course->id) && !$mode=='user') {
|
||||||
$header .= '<th rowspan="2">'.$student_heading_link.'</th></tr>';
|
$header .= '<th rowspan="2">'.$student_heading_link.'</th></tr>';
|
||||||
}
|
}
|
||||||
// adjust colcount to reflect actual number of columns output
|
// adjust colcount to reflect actual number of columns output
|
||||||
$colcount = $colcount * $grade_columns + $total_columns + 2;
|
$colcount = $colcount * $grade_columns + $total_columns + 2;
|
||||||
|
|
||||||
echo '<tr><th colspan="'.$colcount.'"><font size="+1">'.get_string('allgrades','grades').'</font>';
|
echo '<tr><th colspan="'.$colcount.'"><font size="+1">'.get_string('allgrades','grades').'</font>';
|
||||||
if (isteacher($course->id)) {
|
if (isteacher($course->id) && !$mode=='user') {
|
||||||
helpbutton('teacher', get_string('gradehelp','grades'), 'grade');
|
helpbutton('teacher', get_string('gradehelp','grades'), 'grade');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -2209,13 +2218,14 @@ function grade_view_all_grades($view_by_student) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isteacher($course->id) ) {
|
if (isteacher($course->id) && !$mode=='user') {
|
||||||
$row .= '<td>'. $studentviewlink .'</td></tr>';
|
$row .= '<td>'. $studentviewlink .'</td></tr>';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$row .= '</tr>';
|
$row .= '</tr>';
|
||||||
}
|
}
|
||||||
echo $row;
|
|
||||||
|
echo $row;
|
||||||
$reprint++;
|
$reprint++;
|
||||||
}
|
}
|
||||||
echo '</table>';
|
echo '</table>';
|
||||||
|
|
|
@ -132,12 +132,15 @@
|
||||||
|
|
||||||
|
|
||||||
/// Current user must be teacher of the course or the course allows user to view their reports
|
/// Current user must be teacher of the course or the course allows user to view their reports
|
||||||
|
|
||||||
|
//print_object($course);
|
||||||
|
//print_object($user);
|
||||||
if (isteacher($course->id) or ($course->showreports and $USER->id == $user->id)) {
|
if (isteacher($course->id) or ($course->showreports and $USER->id == $user->id)) {
|
||||||
|
|
||||||
$toprow[] = new tabobject('reports', $CFG->wwwroot.'/course/user.php?id='.$course->id.
|
$toprow[] = new tabobject('reports', $CFG->wwwroot.'/course/user.php?id='.$course->id.
|
||||||
'&user='.$user->id.'&mode=outline', get_string('activityreports'));
|
'&user='.$user->id.'&mode=outline', get_string('activityreports'));
|
||||||
|
|
||||||
if (in_array($currenttab, array('outline', 'complete', 'todaylogs', 'alllogs', 'stats'))) {
|
if (in_array($currenttab, array('outline', 'complete', 'todaylogs', 'alllogs', 'stats', 'grade'))) {
|
||||||
$inactive = array('reports');
|
$inactive = array('reports');
|
||||||
$activetwo = array('reports');
|
$activetwo = array('reports');
|
||||||
|
|
||||||
|
@ -154,12 +157,25 @@
|
||||||
$secondrow[] = new tabobject('stats',$CFG->wwwroot.'/course/user.php?id='.$course->id.
|
$secondrow[] = new tabobject('stats',$CFG->wwwroot.'/course/user.php?id='.$course->id.
|
||||||
'&user='.$user->id.'&mode=stats',get_string('stats'));
|
'&user='.$user->id.'&mode=stats',get_string('stats'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// needs permission checking!!!
|
||||||
|
|
||||||
|
$secondrow[] = new tabobject('grade', $CFG->wwwroot.'/course/user.php?id='.$course->id.
|
||||||
|
'&user='.$user->id.'&mode=grade', get_string('grade'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} //close last bracket (individual tags)
|
} //close last bracket (individual tags)
|
||||||
|
|
||||||
|
|
||||||
|
/// this needs permission checkings
|
||||||
|
|
||||||
|
$context = get_context_instance(CONTEXT_USERID, $user->id);
|
||||||
|
$toprow[] = new tabobject('roles', $CFG->wwwroot.'/admin/roles/assign.php?contextid='.$context->id.'&userid='.$user->id.'&courseid='.$course->id
|
||||||
|
,get_string('roles'));
|
||||||
|
|
||||||
/// Add second row to display if there is one
|
/// Add second row to display if there is one
|
||||||
|
|
||||||
if (!empty($secondrow)) {
|
if (!empty($secondrow)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue