diff --git a/mod/glossary/view.php b/mod/glossary/view.php
index b65465fb17d..4ad268c0bd6 100644
--- a/mod/glossary/view.php
+++ b/mod/glossary/view.php
@@ -44,12 +44,9 @@
error("Must specify glossary ID or course module ID");
}
+ require_course_login($course->id, true, $cm);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
- if ($CFG->forcelogin) {
- require_login();
- }
-
/// Loading the textlib singleton instance. We are going to need it.
$textlib = textlib_get_instance();
@@ -113,9 +110,7 @@
$show = '';
}
/// Processing standard security processes
- $navigation = "";
if ($course->id != SITEID) {
- $navigation = "
id\">$course->shortname ->";
require_login($course->id);
}
if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', $context)) {
@@ -210,11 +205,11 @@
case GLOSSARY_IMPORT_VIEW:
case GLOSSARY_EXPORT_VIEW:
case GLOSSARY_APPROVAL_VIEW:
- $isuserframe = 0;
+ $showcommonelements = 0;
break;
default:
- $isuserframe = 1;
+ $showcommonelements = 1;
break;
}
@@ -227,117 +222,138 @@
$strsearchconcept = get_string("searchconcept", "glossary");
$strsearchindefinition = get_string("searchindefinition", "glossary");
$strsearch = get_string("search");
+ $strwaitingapproval = get_string('waitingapproval', 'glossary');
- $navigation = "
id\">$strglossaries ->";
+/// If we are in approval mode, prit special header
+ if ($tab == GLOSSARY_APPROVAL_VIEW) {
+ require_capability('mod/glossary:approve', $context);
+ print_header_simple(format_string($glossary->name), "",
+ "
id\">$strglossaries -> " .
+ "
" .format_string($glossary->name) . " -> " .
+ $strwaitingapproval,
+ "", "", true,
+ update_module_button($cm->id, $course->id, $strglossary), navmenu($course, $cm));
- print_header_simple(format_string($glossary->name), "",
- "$navigation ".format_string($glossary->name), "", "", true, update_module_button($cm->id, $course->id, $strglossary), navmenu($course, $cm));
-
-/// To calculate available options
- $availableoptions = '';
-
-/// Decide about to print the import link
- if (has_capability('mod/glossary:import', $context)) {
- $availableoptions = '
' .
- '' .
- get_string('importentries', 'glossary') . '' .
- '';
- }
-/// Decide about to print the export link
- if (has_capability('mod/glossary:export', $context)) {
- if ($availableoptions) {
- $availableoptions .= ' / ';
- }
- $availableoptions .='
' .
- '' .
- get_string('exportentries', 'glossary') . '' .
- '';
+ print_heading($strwaitingapproval);
+ } else { /// Print standard header
+ print_header_simple(format_string($glossary->name), "",
+ "
id\">$strglossaries -> " .
+ format_string($glossary->name),
+ "", "", true,
+ update_module_button($cm->id, $course->id, $strglossary), navmenu($course, $cm));
}
-/// Decide about to print the approval link
- if (has_capability('mod/glossary:approve', $context)) {
- /// Check we have pending entries
- if ($hiddenentries = count_records_select('glossary_entries',"glossaryid = $glossary->id and approved = 0")) {
- if ($availableoptions) {
- $availableoptions .= '
';
- }
- $availableoptions .='
' .
- '' .
- get_string('waitingapproval', 'glossary') . ' ('.$hiddenentries.')' .
+/// All this depends if whe have $showcommonelements
+ if ($showcommonelements) {
+ /// To calculate available options
+ $availableoptions = '';
+
+ /// Decide about to print the import link
+ if (has_capability('mod/glossary:import', $context)) {
+ $availableoptions = '' .
+ '' .
+ get_string('importentries', 'glossary') . '' .
'';
}
- }
-
-/// Start to print glossary controls
- print_box_start('glossarycontrol');
- echo $availableoptions;
-
-/// If rss are activated at site and glossary level and this glossary has rss defined, show link
- if (isset($CFG->enablerssfeeds) && isset($CFG->glossary_enablerssfeeds) &&
- $CFG->enablerssfeeds && $CFG->glossary_enablerssfeeds && $glossary->rsstype && $glossary->rssarticles) {
-
- $tooltiptext = get_string("rsssubscriberss","glossary",format_string($glossary->name,true));
- if (empty($USER->id)) {
- $userid = 0;
- } else {
- $userid = $USER->id;
+ /// Decide about to print the export link
+ if (has_capability('mod/glossary:export', $context)) {
+ if ($availableoptions) {
+ $availableoptions .= ' / ';
+ }
+ $availableoptions .='' .
+ '' .
+ get_string('exportentries', 'glossary') . '' .
+ '';
}
- print_box_start('rsslink');
- rss_print_link($course->id, $userid, "glossary", $glossary->id, $tooltiptext);
- print_box_end();
- }
-/// The print icon
- if ( $isuserframe and $mode != 'search') {
- if (has_capability('mod/glossary:manageentries', $context) or $glossary->allowprintview) {
- print_box_start('printicon');
- echo " id&mode=$mode&hook=".urlencode($hook)."&sortkey=$sortkey&sortorder=$sortorder&offset=$offset\">
";
+
+ /// Decide about to print the approval link
+ if (has_capability('mod/glossary:approve', $context)) {
+ /// Check we have pending entries
+ if ($hiddenentries = count_records_select('glossary_entries',"glossaryid = $glossary->id and approved = 0")) {
+ if ($availableoptions) {
+ $availableoptions .= '
';
+ }
+ $availableoptions .='' .
+ '' .
+ get_string('waitingapproval', 'glossary') . ' ('.$hiddenentries.')' .
+ '';
+ }
+ }
+
+ /// Start to print glossary controls
+ print_box_start('glossarycontrol');
+ echo $availableoptions;
+
+ /// If rss are activated at site and glossary level and this glossary has rss defined, show link
+ if (isset($CFG->enablerssfeeds) && isset($CFG->glossary_enablerssfeeds) &&
+ $CFG->enablerssfeeds && $CFG->glossary_enablerssfeeds && $glossary->rsstype && $glossary->rssarticles) {
+
+ $tooltiptext = get_string("rsssubscriberss","glossary",format_string($glossary->name,true));
+ if (empty($USER->id)) {
+ $userid = 0;
+ } else {
+ $userid = $USER->id;
+ }
+ print_box_start('rsslink');
+ rss_print_link($course->id, $userid, "glossary", $glossary->id, $tooltiptext);
print_box_end();
}
- }
-/// End glossary controls
- print_box_end(); /// glossarycontrol
- print_box(' ', 'clearer');
+ /// The print icon
+ if ( $showcommonelements and $mode != 'search') {
+ if (has_capability('mod/glossary:manageentries', $context) or $glossary->allowprintview) {
+ print_box_start('printicon');
+ echo " id&mode=$mode&hook=".urlencode($hook)."&sortkey=$sortkey&sortorder=$sortorder&offset=$offset\">
";
+ print_box_end();
+ }
+ }
+ /// End glossary controls
+ print_box_end(); /// glossarycontrol
+
+ print_box(' ', 'clearer');
+ }
/// Info box
- if ( $glossary->intro ) {
+ if ( $glossary->intro && $showcommonelements ) {
print_box(format_text($glossary->intro), 'generalbox', 'intro');
}
/// Search box
- echo '';
-
- echo '
';
/// Show the add entry button if allowed
- if (has_capability('mod/glossary:write', $context)) {
+ if (has_capability('mod/glossary:write', $context) && $showcommonelements ) {
echo '