mod-glossary MDL-19809 Added set_url calls, replaced deprecated functions

This commit is contained in:
samhemelryk 2009-09-24 07:29:14 +00:00
parent cd4e6b1769
commit 5fa0208ec3
16 changed files with 1954 additions and 1791 deletions

View file

@ -1,4 +1,4 @@
<?php // $Id$
<?php
require_once("../../config.php");
require_once("lib.php");
@ -9,6 +9,18 @@
$mode = optional_param('mode','approval', PARAM_ALPHA);
$hook = optional_param('hook','ALL', PARAM_CLEAN);
$url = new moodle_url($CFG->wwwroot.'/mod/glossary/approve.php', array('id'=>$id));
if ($eid !== 0) {
$url->param('eid', $eid);
}
if ($mode !== 'approval') {
$url->param('mode', $mode);
}
if ($hook !== 'ALL') {
$url->param('hook', $hook);
}
$PAGE->set_url($url);
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
print_error('invalidcoursemodule');
}
@ -35,4 +47,5 @@
add_to_log($course->id, "glossary", "approve entry", "showentry.php?id=$cm->id&amp;eid=$eid", "$eid",$cm->id);
redirect("view.php?id=$cm->id&amp;mode=$mode&amp;hook=$hook",get_string("entryapproved","glossary"),1);
die;
?>

View file

@ -1,4 +1,4 @@
<?php // $Id$
<?php
require_once('../../config.php');
require_once('lib.php');
@ -6,7 +6,9 @@ require_once('comment_form.php');
$action = optional_param('action','add', PARAM_ACTION);
if (isguest()) {
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/glossary/comment.php', array('action'=>$action)));
if (has_capability('moodle/legacy:guest', get_context_instance(CONTEXT_SYSTEM), 0, false)) {
print_error('guestnocomment');
}
@ -226,7 +228,7 @@ function glossary_comment_print_header($course, $cm, $glossary, $entry, $action)
$PAGE->navbar->add($strcomments, new moodle_url($CFG->wwwroot.'/mod/glossary/comments.php', array('id'=>$cm->id,'eid'=>$entry->id)));
$PAGE->navbar->add($straction);
$PAGE->set_title(format_string($glossary->name));
$PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'glossary'));
echo $OUTPUT->header();
/// print original glossary entry for any comment action (add, update, delete)

View file

@ -1,4 +1,4 @@
<?php // $Id$
<?php
/// This page prints a particular instance of glossary
require_once('../../config.php');
@ -7,6 +7,8 @@
$id = required_param('id', PARAM_INT); // Course Module ID
$eid = required_param('eid', PARAM_INT); // Entry ID
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/glossary/comments.php', array('id'=>$id,'eid'=>$eid)));
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
print_error('invalidcoursemodule');
}
@ -42,7 +44,7 @@
$PAGE->navbar->add($strcomments);
$PAGE->set_title(strip_tags("$strcomments: $entry->concept"));
$PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'glossary'));
echo $OUTPUT->header();
/// original glossary entry

View file

@ -1,4 +1,4 @@
<?php // $Id$
<?php
require_once("../../config.php");
require_once("lib.php");
@ -9,6 +9,18 @@
$prevmode = required_param('prevmode', PARAM_ALPHA);
$hook = optional_param('hook', '', PARAM_CLEAN);
$url = new moodle_url($CFG->wwwroot.'/mod/glossary/deleteentry.php', array('id'=>$id,'prevmode'=>$prevmode));
if ($confirm !== 0) {
$url->param('confirm', $confirm);
}
if ($entry !== 0) {
$url->param('entry', $entry);
}
if ($hook !== '') {
$url->param('hook', $hook);
}
$PAGE->set_url($url);
$strglossary = get_string("modulename", "glossary");
$strglossaries = get_string("modulenameplural", "glossary");
$stredit = get_string("edit");
@ -91,7 +103,7 @@
} else { // the operation has not been confirmed yet so ask the user to do so
$PAGE->set_title(format_string($glossary->name));
$PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'glossary'));
echo $OUTPUT->header();
$areyousure = "<b>".format_string($entry->concept)."</b><p>$strareyousuredelete</p>";
$linkyes = 'deleteentry.php';
@ -103,4 +115,5 @@
echo $OUTPUT->footer();
}
?>

View file

@ -1,4 +1,4 @@
<?php // $Id$
<?php
/// This page allows to edit entries categories for a particular instance of glossary
@ -16,6 +16,28 @@
$action = strtolower($action);
$url = new moodle_url($CFG->wwwroot.'/mod/glossary/editcategories.php', array('id'=>$id));
if ($usedynalink !== 0) {
$url->param('usedynalink', $usedynalink);
}
if ($confirm !== 0) {
$url->param('confirm', $confirm);
}
if ($name !== 'name') {
$url->param('name', $name);
}
if ($action !== 'action') {
$url->param('action', $action);
}
if ($hook !== 'hook') {
$url->param('hook', $hook);
}
if ($mode !== 'mode') {
$url->param('mode', $mode);
}
$PAGE->set_url($url);
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
print_error('invalidcoursemodule');
}
@ -51,7 +73,7 @@
$PAGE->navbar->add(format_string($glossary->name), new moodle_url($CFG->wwwroot.'/mod/glossary/view.php', array('id'=>$cm->id,'tab'=>'GLOSSARY_CATEGORY_VIEW')));
$PAGE->navbar->add(get_string("categories","glossary"));
$PAGE->set_title(format_string($glossary->name));
$PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'glossary'));
echo $OUTPUT->header();
if ( $hook >0 ) {

View file

@ -1,4 +1,4 @@
<?php // $Id$
<?php
require_once("../../config.php");
require_once("lib.php");
@ -9,6 +9,18 @@
$hook= optional_param('hook', '', PARAM_CLEAN); // the term, entry, cat, etc... to look for based on mode
$cat = optional_param('cat',0, PARAM_ALPHANUM);
$url = new moodle_url($CFG->wwwroot.'/mod/glossary/export.php', array('id'=>$id));
if ($cat !== 0) {
$url->param('cat', $cat);
}
if ($mode !== '') {
$url->param('mode', $mode);
}
if ($hook !== '') {
$url->param('hook', $hook);
}
$PAGE->set_url($url);
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
print_error('invalidcoursemodule');
}
@ -40,7 +52,7 @@
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/glossary/export.php', array('id'=>$cm->id)));
$PAGE->navbar->add($strexportentries);
$PAGE->set_title(format_string($glossary->name));
$PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'glossary'));
echo $OUTPUT->header();
echo $OUTPUT->heading($strexportentries);

View file

@ -1,4 +1,5 @@
<?php // $Id$
<?php
require_once('../../config.php');
require_once('lib.php');
@ -7,6 +8,15 @@
$prevmode = required_param('prevmode', PARAM_ALPHA);
$hook = optional_param('hook', '', PARAM_CLEAN);
$url = new moodle_url($CFG->wwwroot.'/mod/glossary/exportentry.php', array('id'=>$id,'prevmode'=>$prevmode));
if ($confirm !== 0) {
$url->param('confirm', $confirm);
}
if ($hook !== 'ALL') {
$url->param('hook', $hook);
}
$PAGE->set_url($url);
if (!$entry = $DB->get_record('glossary_entries', array('id'=>$id))) {
print_error('invalidentry');
}
@ -109,4 +119,5 @@
redirect ($returnurl);
}
?>

View file

@ -1,4 +1,4 @@
<?php // $Id$
<?php
require_once("../../config.php");
require_once("lib.php");
@ -11,6 +11,15 @@
$l = optional_param('l','', PARAM_ALPHANUM);
$cat = optional_param('cat',0, PARAM_ALPHANUM);
$url = new moodle_url($CFG->wwwroot.'/mod/glossary/exportfile.php', array('id'=>$id));
if ($l !== '') {
$url->param('l', $l);
}
if ($cat !== 0) {
$url->param('cat', $cat);
}
$PAGE->set_url($url);
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
print_error('invalidcoursemodule');
}
@ -32,4 +41,5 @@
$content = glossary_generate_export_file($glossary,$l,$cat);
send_file($content, $filename, 0, 0, true, true);
?>

View file

@ -1,4 +1,5 @@
<?php // $Id$
<?php
/// This file allows to manage the default behaviour of the display formats
require_once("../../config.php");
@ -8,6 +9,12 @@
$id = required_param('id', PARAM_INT);
$mode = optional_param('mode', '', PARAM_ACTION);
$url = new moodle_url($CFG->wwwroot.'/mod/glossary/formats.php', array('id'=>$id));
if ($mode !== '') {
$url->param('mode', $mode);
}
$PAGE->set_url($url);
admin_externalpage_setup('managemodules'); // this is hacky, tehre should be a special hidden page for it
if ( !$displayformat = $DB->get_record("glossary_formats", array("id"=>$id))) {

View file

@ -1,4 +1,4 @@
<?php // $Id$
<?php
require_once("../../config.php");
require_once("lib.php");
@ -14,6 +14,27 @@
$mode = optional_param('mode', 'letter', PARAM_ALPHA );
$hook = optional_param('hook', 'ALL', PARAM_ALPHANUM);
$url = new moodle_url($CFG->wwwroot.'/mod/glossary/import.php', array('id'=>$id));
if ($step !== 0) {
$url->param('step', $step);
}
if ($dest !== 'current') {
$url->param('dest', $dest);
}
if ($file !== '') {
$url->param('file', $file);
}
if ($catsincl !== 0) {
$url->param('catsincl', $catsincl);
}
if ($mode !== 'letter') {
$url->param('mode', $mode);
}
if ($hook !== 'ALL') {
$url->param('hook', $hook);
}
$PAGE->set_url($url);
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
print_error('invalidcoursemodule');
}
@ -47,7 +68,7 @@
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/glossary/import.php', array('id'=>$cm->id, 'mode'=>$mode, 'hook'=>$hook)));
$PAGE->navbar->add($strimportentries);
$PAGE->set_title(format_string($glossary->name));
$PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'glossary'));
echo $OUTPUT->header();
echo $OUTPUT->heading($strimportentries);

View file

@ -1,4 +1,4 @@
<?php // $Id$
<?php
/// This page lists all the instances of glossary in a particular course
/// Replace glossary with the name of your module
@ -10,6 +10,8 @@
$id = required_param('id', PARAM_INT); // course
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/glossary/index.php', array('id'=>$id)));
if (!$course = $DB->get_record('course', array('id'=>$id))) {
print_error('invalidcourseid');
}

View file

@ -1,4 +1,4 @@
<?php // $Id$
<?php
global $CFG;
@ -14,6 +14,27 @@
$hook = optional_param('hook','ALL', PARAM_ALPHANUM); // what to show
$sortkey = optional_param('sortkey','UPDATE', PARAM_ALPHA); // Sorting key
$url = new moodle_url($CFG->wwwroot.'/mod/glossary/print.php', array('id'=>$id));
if ($sortorder !== 'asc') {
$url->param('sortorder', $sortorder);
}
if ($offset !== 0) {
$url->param('offset', $offset);
}
if ($displayformat !== -1) {
$url->param('displayformat', $displayformat);
}
if ($sortkey !== 'UPDATE') {
$url->param('sortkey', $sortkey);
}
if ($mode !== 'letter') {
$url->param('mode', $mode);
}
if ($hook !== 'ALL') {
$url->param('hook', $hook);
}
$PAGE->set_url($url);
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
print_error('invalidcoursemodule');
}

View file

@ -8,6 +8,8 @@
$glossaryid = required_param('glossaryid', PARAM_INT); // The forum the rated posts are from
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/glossary/rate.php', array('glossaryid'=>$glossaryid)));
if (!$glossary = $DB->get_record('glossary', array('id'=>$glossaryid))) {
print_error('invalidid', 'glossary');
}

View file

@ -1,4 +1,4 @@
<?php // $Id$
<?php
// For a given entry, shows a report of all the ratings it has
@ -8,6 +8,12 @@
$id = required_param('id', PARAM_INT);
$sort = optional_param('sort', '', PARAM_ALPHA);
$url = new moodle_url($CFG->wwwroot.'/mod/glossary/report.php', array('id'=>$id));
if ($sort !== '') {
$url->param('sort', $sort);
}
$PAGE->set_url($url);
if (! $entry = $DB->get_record('glossary_entries', array('id'=>$id))) {
print_error('invalidentry');
}
@ -84,4 +90,5 @@
echo $OUTPUT->close_window_button();
echo $OUTPUT->footer();
?>

View file

@ -1,4 +1,5 @@
<?php // $Id$
<?php
require_once("../../config.php");
require_once("lib.php");
@ -7,6 +8,21 @@
$eid = optional_param('eid', 0, PARAM_INT); // glossary entry id
$displayformat = optional_param('displayformat',-1, PARAM_SAFEDIR);
$url = new moodle_url($CFG->wwwroot.'/mod/glossary/showentry.php');
if ($concept !== '') {
$url->param('concept', $concept);
}
if ($courseid !== 0) {
$url->param('courseid', $courseid);
}
if ($eid !== 0) {
$url->param('eid', $eid);
}
if ($displayformat !== -1) {
$url->param('displayformat', $displayformat);
}
$PAGE->set_url($url);
if ($CFG->forcelogin) {
require_login();
}

View file

@ -1,4 +1,5 @@
<?php // $Id$
<?php
/// This page prints a particular instance of glossary
require_once("../../config.php");
require_once("lib.php");
@ -227,7 +228,7 @@
/// If we are in approval mode, prit special header
$PAGE->set_title(format_string($glossary->name));
$PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'glossary'));
$url = new moodle_url($CFG->wwwroot.'/mod/glossary/view.php', array('id'=>$cm->id));
if (isset($mode)) {
$url->param('mode', $mode);
@ -524,4 +525,5 @@
/// Mark as viewed
$completion=new completion_info($course);
$completion->set_module_viewed($cm);
?>