One default was causing author view not being able to sortby firstname or lastname.
Backported from MOODLE_18_STABLE
This commit is contained in:
+38
-29
@@ -13,7 +13,7 @@
|
||||
$mode = optional_param('mode', '', PARAM_ALPHA); // term entry cat date letter search author approval
|
||||
$hook = optional_param('hook', '', PARAM_CLEAN); // the term, entry, cat, etc... to look for based on mode
|
||||
$fullsearch = optional_param('fullsearch', 0,PARAM_INT); // full search (concept and definition) when searching?
|
||||
$sortkey = optional_param('sortkey', 'CREATION', PARAM_ALPHA);// Sorted view: CREATION | UPDATE | FIRSTNAME | LASTNAME...
|
||||
$sortkey = optional_param('sortkey', '', PARAM_ALPHA);// Sorted view: CREATION | UPDATE | FIRSTNAME | LASTNAME...
|
||||
$sortorder = optional_param('sortorder', 'ASC', PARAM_ALPHA); // it defines the order of the sorting (ASC or DESC)
|
||||
$offset = optional_param('offset', 0,PARAM_INT); // entries to bypass (for paging purposes)
|
||||
$page = optional_param('page', 0,PARAM_INT); // Page to show (for paging purposes)
|
||||
@@ -44,6 +44,8 @@
|
||||
error("Must specify glossary ID or course module ID");
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
if ($CFG->forcelogin) {
|
||||
require_login();
|
||||
}
|
||||
@@ -112,11 +114,11 @@
|
||||
}
|
||||
/// Processing standard security processes
|
||||
$navigation = "";
|
||||
if ($course->category) {
|
||||
if ($course->id != SITEID) {
|
||||
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
|
||||
require_login($course->id);
|
||||
}
|
||||
if (!$cm->visible and !isteacher($course->id)) {
|
||||
if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', $context)) {
|
||||
print_header();
|
||||
notice(get_string("activityiscurrentlyhidden"));
|
||||
}
|
||||
@@ -249,8 +251,8 @@
|
||||
/// the "Print" icon
|
||||
$printicon = '';
|
||||
if ( $isuserframe and $mode != 'search') {
|
||||
if (isteacher($course->id) or $glossary->allowprintview) {
|
||||
$printicon = " <a title =\"". get_string("printerfriendly","glossary") . "\" target=\"printview\" href=\"print.php?id=$cm->id&mode=$mode&hook=$hook&sortkey=$sortkey&sortorder=$sortorder&offset=$offset\"><img border=\"0\" src=\"print.gif\" alt=\"\" /></a>";
|
||||
if (has_capability('mod/glossary:manageentries', $context) or $glossary->allowprintview) {
|
||||
$printicon = " <a title =\"". get_string("printerfriendly","glossary") ."\" target=\"printview\" href=\"print.php?id=$cm->id&mode=$mode&hook=".urlencode($hook)."&sortkey=$sortkey&sortorder=$sortorder&offset=$offset\"><img class=\"icon\" src=\"print.gif\" alt=\"". get_string("printerfriendly","glossary") . "\" /></a>";
|
||||
}
|
||||
}
|
||||
print_heading(format_string($glossary->name).$printicon);
|
||||
@@ -258,11 +260,10 @@
|
||||
|
||||
/// Info box
|
||||
if ( $glossary->intro ) {
|
||||
print_simple_box(format_text($glossary->intro), 'center', '70%', '', 5, 'generalbox', 'intro');
|
||||
print_box(format_text($glossary->intro), 'generalbox', 'intro');
|
||||
}
|
||||
|
||||
/// Search box
|
||||
|
||||
echo '<form method="post" action="view.php">';
|
||||
|
||||
echo '<table align="center" width="70%" border="0">';
|
||||
@@ -286,9 +287,26 @@
|
||||
echo '</td></tr></table>';
|
||||
|
||||
echo '</form>';
|
||||
|
||||
echo '<br />';
|
||||
|
||||
include("tabs.html");
|
||||
/// Show the add entry button if allowed
|
||||
if (has_capability('mod/glossary:write', $context)) {
|
||||
echo '<div class="singlebutton glossaryaddentry">';
|
||||
echo "<form id=\"newentryform\" method=\"get\" action=\"$CFG->wwwroot/mod/glossary/edit.php\">";
|
||||
echo '<div>';
|
||||
echo "<input type=\"hidden\" name=\"id\" value=\"$cm->id\" />";
|
||||
echo '<input type="submit" value="';
|
||||
print_string('addentry', 'glossary');
|
||||
echo '" />';
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
echo "</div>\n";
|
||||
}
|
||||
|
||||
echo '<br />';
|
||||
|
||||
include("tabs.php");
|
||||
|
||||
include_once("sql.php");
|
||||
|
||||
@@ -320,24 +338,24 @@
|
||||
$ratings->assesstimestart = $glossary->assesstimestart;
|
||||
$ratings->assesstimefinish = $glossary->assesstimefinish;
|
||||
}
|
||||
if ($glossary->assessed == 2 and !isteacher($course->id)) {
|
||||
if ($glossary->assessed == 2 and !has_capability('mod/glossary:rate', $context)) {
|
||||
$ratings->allow = false;
|
||||
} else {
|
||||
$ratings->allow = true;
|
||||
}
|
||||
|
||||
echo "<form name=\"form\" method=\"post\" action=\"rate.php\">";
|
||||
echo "<form method=\"post\" action=\"rate.php\">";
|
||||
echo "<input type=\"hidden\" name=\"id\" value=\"$course->id\" />";
|
||||
}
|
||||
|
||||
foreach ($allentries as $entry) {
|
||||
|
||||
// Setting the pivot for the current entry
|
||||
$pivot = $entry->pivot;
|
||||
$upperpivot = $textlib->strtoupper($pivot, current_charset());
|
||||
$pivot = $entry->glossarypivot;
|
||||
$upperpivot = $textlib->strtoupper($pivot);
|
||||
// Reduce pivot to 1cc if necessary
|
||||
if ( !$fullpivot ) {
|
||||
$upperpivot = $textlib->substr($upperpivot, 0, 1, current_charset());
|
||||
$upperpivot = $textlib->substr($upperpivot, 0, 1);
|
||||
}
|
||||
|
||||
// if there's a group break
|
||||
@@ -348,17 +366,17 @@
|
||||
$currentpivot = $upperpivot;
|
||||
|
||||
echo '<div>';
|
||||
echo '<table cellspacing="0" class="categoryheader">';
|
||||
echo '<table cellspacing="0" class="glossarycategoryheader">';
|
||||
|
||||
echo '<tr>';
|
||||
$pivottoshow = $currentpivot;
|
||||
if ( isset($entry->uid) ) {
|
||||
if ( isset($entry->userispivot) ) {
|
||||
// printing the user icon if defined (only when browsing authors)
|
||||
echo '<td align="left">';
|
||||
|
||||
$user = get_record("user","id",$entry->uid);
|
||||
$user = get_record("user","id",$entry->userid);
|
||||
print_user_picture($user->id, $course->id, $user->picture);
|
||||
$pivottoshow = fullname($user, isteacher($course->id));;
|
||||
$pivottoshow = fullname($user, has_capability('moodle/site:viewfullnames', get_context_instance(CONTEXT_COURSE, $course->id)));
|
||||
} else {
|
||||
echo '<td align="center">';
|
||||
}
|
||||
@@ -402,18 +420,18 @@
|
||||
}
|
||||
}
|
||||
if ( !$entriesshown ) {
|
||||
print_simple_box('<center>' . get_string("noentries","glossary") . '</center>',"center","95%");
|
||||
print_simple_box('<div style="text-align:center">' . get_string("noentries","glossary") . '</div>',"center","95%");
|
||||
}
|
||||
|
||||
|
||||
if ($ratingsmenuused) {
|
||||
echo "<center><input type=\"submit\" value=\"".get_string("sendinratings", "glossary")."\" />";
|
||||
echo "<div class=\"boxaligncenter\"><input type=\"submit\" value=\"".get_string("sendinratings", "glossary")."\" />";
|
||||
if ($glossary->scale < 0) {
|
||||
if ($scale = get_record("scale", "id", abs($glossary->scale))) {
|
||||
print_scale_menu_helpbutton($course->id, $scale );
|
||||
}
|
||||
}
|
||||
echo "</center>";
|
||||
echo "</div>";
|
||||
echo "</form>";
|
||||
}
|
||||
|
||||
@@ -424,16 +442,7 @@
|
||||
echo '</div>';
|
||||
}
|
||||
echo '<br />';
|
||||
echo '</center>';
|
||||
glossary_print_tabbed_table_end();
|
||||
if ( !empty($debug) and isadmin() ) {
|
||||
echo '<p>';
|
||||
print_simple_box("$sqlselect<br /> $sqlfrom<br /> $sqlwhere<br /> $sqlorderby<br /> $sqllimit","center","85%");
|
||||
|
||||
echo "<p align=\"right\"><font size=\"-3\">";
|
||||
echo microtime_diff($CFG->startpagetime, microtime());
|
||||
echo "</font></p>";
|
||||
}
|
||||
|
||||
/// Finish the page
|
||||
|
||||
|
||||
Reference in New Issue
Block a user