mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
0d06b6fda7
added two new contract methods to the caller class, load_data and expected_callbackargs (static) this means that the base class is the only place that needs a constructor and that no data loading happens in the constructor this in turn means we can check callback argument validity much more lightly also completely remoted portfolio_add_button function and replaced with a class as the argument list was getting out of control. it's now much more readable.
70 lines
2.7 KiB
PHP
70 lines
2.7 KiB
PHP
<?php // $Id$
|
|
|
|
require_once("../../config.php");
|
|
require_once("lib.php");
|
|
|
|
$id = required_param('id', PARAM_INT); // Course Module ID
|
|
|
|
$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
|
|
$cat = optional_param('cat',0, PARAM_ALPHANUM);
|
|
|
|
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
|
|
print_error('invalidcoursemodule');
|
|
}
|
|
|
|
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
|
print_error('coursemisconf');
|
|
}
|
|
|
|
if (! $glossary = $DB->get_record("glossary", array("id"=>$cm->instance))) {
|
|
print_error('invalidid', 'glossary');
|
|
}
|
|
|
|
require_login($course->id, false, $cm);
|
|
|
|
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
|
require_capability('mod/glossary:export', $context);
|
|
|
|
$strglossaries = get_string("modulenameplural", "glossary");
|
|
$strglossary = get_string("modulename", "glossary");
|
|
$strallcategories = get_string("allcategories", "glossary");
|
|
$straddentry = get_string("addentry", "glossary");
|
|
$strnoentries = get_string("noentries", "glossary");
|
|
$strsearchconcept = get_string("searchconcept", "glossary");
|
|
$strsearchindefinition = get_string("searchindefinition", "glossary");
|
|
$strsearch = get_string("search");
|
|
$strexportfile = get_string("exportfile", "glossary");
|
|
$strexportentries = get_string('exportentries', 'glossary');
|
|
|
|
$navigation = build_navigation('', $cm);
|
|
print_header_simple(format_string($glossary->name), "",$navigation,
|
|
"", "", true, update_module_button($cm->id, $course->id, $strglossary),
|
|
navmenu($course, $cm));
|
|
|
|
print_heading($strexportentries);
|
|
|
|
print_box_start('glossarydisplay generalbox');
|
|
?>
|
|
<form action="exportfile.php" method="post">
|
|
<table border="0" cellpadding="6" cellspacing="6" width="100%">
|
|
<tr><td align="center">
|
|
<input type="submit" value="<?php p($strexportfile)?>" />
|
|
</td></tr></table>
|
|
<div>
|
|
<input type="hidden" name="id" value="<?php p($id)?>" />
|
|
<input type="hidden" name="cat" value="<?php p($cat)?>" />
|
|
</div>
|
|
</form>
|
|
<?php
|
|
// don't need cap check here, we share with the general export.
|
|
if ($DB->count_records('glossary_entries', array('glossaryid' => $glossary->id))) {
|
|
require_once($CFG->libdir . '/portfoliolib.php');
|
|
$button = new portfolio_add_button();
|
|
$button->set_callback_options('glossary_csv_portfolio_caller', array('id' => $cm->id), '/mod/glossary/lib.php');
|
|
$button->render();
|
|
}
|
|
print_box_end();
|
|
print_footer($course);
|
|
?>
|