| Server IP : 165.22.154.248 / Your IP : 216.73.217.54 [ Web Server : Apache/2.4.29 (Ubuntu) System : Linux droplet-integra 4.15.0-197-generic #208-Ubuntu SMP Tue Nov 1 17:23:37 UTC 2022 x86_64 User : www-data ( 33) PHP Version : 7.2.24-0ubuntu0.18.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, Domains : 1 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /proc/9427/cwd/avanza-lms.old.bak9874115/mod/glossary/ |
Upload File : |
<?php
require_once('../../config.php');
require_once('lib.php');
$concept = optional_param('concept', '', PARAM_CLEAN);
$courseid = optional_param('courseid', 0, PARAM_INT);
$eid = optional_param('eid', 0, PARAM_INT); // glossary entry id
$displayformat = optional_param('displayformat',-1, PARAM_SAFEDIR);
$url = new moodle_url('/mod/glossary/showentry.php');
$url->param('concept', $concept);
$url->param('courseid', $courseid);
$url->param('eid', $eid);
$url->param('displayformat', $displayformat);
$PAGE->set_url($url);
if ($CFG->forcelogin) {
require_login();
}
if ($eid) {
$entry = $DB->get_record('glossary_entries', array('id'=>$eid), '*', MUST_EXIST);
$glossary = $DB->get_record('glossary', array('id'=>$entry->glossaryid), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance('glossary', $glossary->id, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST);
require_course_login($course, true, $cm);
$entry->glossaryname = $glossary->name;
$entry->cmid = $cm->id;
$entry->courseid = $cm->course;
$entries = array($entry);
} else if ($concept) {
$course = $DB->get_record('course', array('id'=>$courseid), '*', MUST_EXIST);
require_course_login($course);
$entries = glossary_get_entries_search($concept, $courseid);
} else {
print_error('invalidelementid');
}
$PAGE->set_pagelayout('incourse');
if ($entries) {
foreach ($entries as $key => $entry) {
// Need to get the course where the entry is,
// in order to check for visibility/approve permissions there
$entrycourse = $DB->get_record('course', array('id' => $entry->courseid), '*', MUST_EXIST);
$modinfo = get_fast_modinfo($entrycourse);
// make sure the entry is visible
if (empty($modinfo->cms[$entry->cmid]->uservisible)) {
unset($entries[$key]);
continue;
}
// make sure the entry is approved (or approvable by current user)
if (!$entry->approved and ($USER->id != $entry->userid)) {
$context = context_module::instance($entry->cmid);
if (!has_capability('mod/glossary:approve', $context)) {
unset($entries[$key]);
continue;
}
}
$entries[$key]->footer = "<p style=\"text-align:right\">» <a href=\"$CFG->wwwroot/mod/glossary/view.php?g=$entry->glossaryid\">".format_string($entry->glossaryname,true)."</a></p>";
glossary_entry_view($entry, $modinfo->cms[$entry->cmid]->context);
}
}
if (!empty($courseid)) {
$strglossaries = get_string('modulenameplural', 'glossary');
$strsearch = get_string('search');
$PAGE->navbar->add($strglossaries);
$PAGE->navbar->add($strsearch);
$PAGE->set_title(strip_tags("$course->shortname: $strglossaries $strsearch"));
$PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
} else {
echo $OUTPUT->header(); // Needs to be something here to allow linking back to the whole glossary
}
if ($entries) {
glossary_print_dynaentry($courseid, $entries, $displayformat);
}
/// Show one reduced footer
echo $OUTPUT->footer();