Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/mod/glossary/export.php
Go to the documentation of this file.
00001 <?php
00002 
00003 require_once("../../config.php");
00004 require_once("lib.php");
00005 
00006 $id = required_param('id', PARAM_INT);      // Course Module ID
00007 
00008 $mode= optional_param('mode', '', PARAM_ALPHA);           // term entry cat date letter search author approval
00009 $hook= optional_param('hook', '', PARAM_CLEAN);           // the term, entry, cat, etc... to look for based on mode
00010 $cat = optional_param('cat',0, PARAM_ALPHANUM);
00011 
00012 $url = new moodle_url('/mod/glossary/export.php', array('id'=>$id));
00013 if ($cat !== 0) {
00014     $url->param('cat', $cat);
00015 }
00016 if ($mode !== '') {
00017     $url->param('mode', $mode);
00018 }
00019 
00020 $PAGE->set_url($url);
00021 
00022 if (! $cm = get_coursemodule_from_id('glossary', $id)) {
00023     print_error('invalidcoursemodule');
00024 }
00025 
00026 if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
00027     print_error('coursemisconf');
00028 }
00029 
00030 if (! $glossary = $DB->get_record("glossary", array("id"=>$cm->instance))) {
00031     print_error('invalidid', 'glossary');
00032 }
00033 
00034 require_login($course->id, false, $cm);
00035 
00036 $context = get_context_instance(CONTEXT_MODULE, $cm->id);
00037 require_capability('mod/glossary:export', $context);
00038 
00039 $strglossaries = get_string("modulenameplural", "glossary");
00040 $strglossary = get_string("modulename", "glossary");
00041 $strallcategories = get_string("allcategories", "glossary");
00042 $straddentry = get_string("addentry", "glossary");
00043 $strnoentries = get_string("noentries", "glossary");
00044 $strsearchindefinition = get_string("searchindefinition", "glossary");
00045 $strsearch = get_string("search");
00046 $strexportfile = get_string("exportfile", "glossary");
00047 $strexportentries = get_string('exportentriestoxml', 'glossary');
00048 
00049 $PAGE->set_url('/mod/glossary/export.php', array('id'=>$cm->id));
00050 $PAGE->navbar->add($strexportentries);
00051 $PAGE->set_title(format_string($glossary->name));
00052 $PAGE->set_heading($course->fullname);
00053 
00054 echo $OUTPUT->header();
00055 echo $OUTPUT->heading($strexportentries);
00056 echo $OUTPUT->box_start('glossarydisplay generalbox');
00057 $exporturl = moodle_url::make_pluginfile_url($context->id, 'mod_glossary', 'export', 0, "/$cat/", 'export.xml', true);
00058 
00059 ?>
00060     <form action="<?php echo $exporturl->out(); ?>" method="post">
00061     <table border="0" cellpadding="6" cellspacing="6" width="100%">
00062     <tr><td align="center">
00063         <input type="submit" value="<?php p($strexportfile)?>" />
00064     </td></tr></table>
00065     <div>
00066     </div>
00067     </form>
00068 <?php
00069     // don't need cap check here, we share with the general export.
00070     if (!empty($CFG->enableportfolios) && $DB->count_records('glossary_entries', array('glossaryid' => $glossary->id))) {
00071         require_once($CFG->libdir . '/portfoliolib.php');
00072         $button = new portfolio_add_button();
00073         $button->set_callback_options('glossary_full_portfolio_caller', array('id' => $cm->id), '/mod/glossary/locallib.php');
00074         $button->render();
00075     }
00076     echo $OUTPUT->box_end();
00077     echo $OUTPUT->footer();
00078 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations