mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
mod-glossary MDL-19809 Added set_url calls, replaced deprecated functions
This commit is contained in:
parent
cd4e6b1769
commit
5fa0208ec3
16 changed files with 1954 additions and 1791 deletions
|
@ -1,38 +1,51 @@
|
|||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
|
||||
$id = required_param('id', PARAM_INT); // Course Module ID
|
||||
$eid = optional_param('eid', 0, PARAM_INT); // Entry ID
|
||||
$id = required_param('id', PARAM_INT); // Course Module ID
|
||||
$eid = optional_param('eid', 0, PARAM_INT); // Entry ID
|
||||
|
||||
$mode = optional_param('mode','approval', PARAM_ALPHA);
|
||||
$hook = optional_param('hook','ALL', PARAM_CLEAN);
|
||||
$mode = optional_param('mode','approval', PARAM_ALPHA);
|
||||
$hook = optional_param('hook','ALL', PARAM_CLEAN);
|
||||
|
||||
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
|
||||
$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');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
print_error('coursemisconf');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $glossary = $DB->get_record("glossary", array("id"=>$cm->instance))) {
|
||||
if (! $glossary = $DB->get_record("glossary", array("id"=>$cm->instance))) {
|
||||
print_error('invalidid', 'glossary');
|
||||
}
|
||||
}
|
||||
|
||||
require_login($course->id, false, $cm);
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('mod/glossary:approve', $context);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('mod/glossary:approve', $context);
|
||||
|
||||
$newentry = new object();
|
||||
$newentry->id = $eid;
|
||||
$newentry->approved = 1;
|
||||
$newentry->timemodified = time(); // wee need this date here to speed up recent activity, TODO: use timestamp in approved field instead in 2.0
|
||||
$newentry = new object();
|
||||
$newentry->id = $eid;
|
||||
$newentry->approved = 1;
|
||||
$newentry->timemodified = time(); // wee need this date here to speed up recent activity, TODO: use timestamp in approved field instead in 2.0
|
||||
|
||||
$DB->update_record("glossary_entries", $newentry);
|
||||
add_to_log($course->id, "glossary", "approve entry", "showentry.php?id=$cm->id&eid=$eid", "$eid",$cm->id);
|
||||
redirect("view.php?id=$cm->id&mode=$mode&hook=$hook",get_string("entryapproved","glossary"),1);
|
||||
die;
|
||||
|
||||
$DB->update_record("glossary_entries", $newentry);
|
||||
add_to_log($course->id, "glossary", "approve entry", "showentry.php?id=$cm->id&eid=$eid", "$eid",$cm->id);
|
||||
redirect("view.php?id=$cm->id&mode=$mode&hook=$hook",get_string("entryapproved","glossary"),1);
|
||||
die;
|
||||
?>
|
|
@ -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)
|
||||
|
|
|
@ -1,76 +1,78 @@
|
|||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
/// This page prints a particular instance of glossary
|
||||
require_once('../../config.php');
|
||||
require_once('lib.php');
|
||||
require_once('../../config.php');
|
||||
require_once('lib.php');
|
||||
|
||||
$id = required_param('id', PARAM_INT); // Course Module ID
|
||||
$eid = required_param('eid', PARAM_INT); // Entry ID
|
||||
$id = required_param('id', PARAM_INT); // Course Module ID
|
||||
$eid = required_param('eid', PARAM_INT); // Entry ID
|
||||
|
||||
if (! $cm = get_coursemodule_from_id('glossary', $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');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
print_error('coursemisconf');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $glossary = $DB->get_record("glossary", array("id"=>$cm->instance))) {
|
||||
if (! $glossary = $DB->get_record("glossary", array("id"=>$cm->instance))) {
|
||||
print_error('invalidcousemodule');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $entry = $DB->get_record("glossary_entries", array("id"=>$eid))) {
|
||||
if (! $entry = $DB->get_record("glossary_entries", array("id"=>$eid))) {
|
||||
print_error('invalidentry');
|
||||
}
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
require_login($course->id, false, $cm);
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id", "$glossary->id",$cm->id);
|
||||
add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id", "$glossary->id",$cm->id);
|
||||
|
||||
$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");
|
||||
$strcomments = get_string("comments", "glossary");
|
||||
$straddcomment = get_string("addcomment", "glossary");
|
||||
$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");
|
||||
$strcomments = get_string("comments", "glossary");
|
||||
$straddcomment = get_string("addcomment", "glossary");
|
||||
|
||||
$PAGE->navbar->add($strcomments);
|
||||
$PAGE->set_title(strip_tags("$strcomments: $entry->concept"));
|
||||
$PAGE->set_button(update_module_button($cm->id, $course->id, $strglossary));
|
||||
echo $OUTPUT->header();
|
||||
$PAGE->navbar->add($strcomments);
|
||||
$PAGE->set_title(strip_tags("$strcomments: $entry->concept"));
|
||||
$PAGE->set_button($OUTPUT->update_module_button($cm->id, 'glossary'));
|
||||
echo $OUTPUT->header();
|
||||
|
||||
/// original glossary entry
|
||||
|
||||
echo "<div class=\"boxaligncenter\">";
|
||||
glossary_print_entry($course, $cm, $glossary, $entry, "", "", false);
|
||||
echo "</div>";
|
||||
echo "<div class=\"boxaligncenter\">";
|
||||
glossary_print_entry($course, $cm, $glossary, $entry, "", "", false);
|
||||
echo "</div>";
|
||||
|
||||
/// comments
|
||||
|
||||
echo $OUTPUT->heading(format_string(get_string('commentson','glossary')." <b>\"$entry->concept\"</b>"));
|
||||
echo $OUTPUT->heading(format_string(get_string('commentson','glossary')." <b>\"$entry->concept\"</b>"));
|
||||
|
||||
if (has_capability('mod/glossary:comment', $context) and $glossary->allowcomments) {
|
||||
if (has_capability('mod/glossary:comment', $context) and $glossary->allowcomments) {
|
||||
echo $OUTPUT->heading("<a href=\"comment.php?action=add&entryid=$entry->id\">$straddcomment <img title=\"$straddcomment\" src=\"comment.gif\" class=\"iconsmall\" alt=\"$straddcomment\" /></a>");
|
||||
}
|
||||
}
|
||||
|
||||
if ($comments = $DB->get_records("glossary_comments", array("entryid"=>$entry->id), "timemodified ASC")) {
|
||||
if ($comments = $DB->get_records("glossary_comments", array("entryid"=>$entry->id), "timemodified ASC")) {
|
||||
foreach ($comments as $comment) {
|
||||
glossary_print_comment($course, $cm, $glossary, $entry, $comment);
|
||||
echo '<br />';
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
echo $OUTPUT->heading(get_string("nocomments","glossary"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Finish the page
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
?>
|
|
@ -1,54 +1,66 @@
|
|||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
|
||||
$id = required_param('id', PARAM_INT); // course module ID
|
||||
$confirm = optional_param('confirm', 0, PARAM_INT); // commit the operation?
|
||||
$entry = optional_param('entry', 0, PARAM_INT); // entry id
|
||||
$prevmode = required_param('prevmode', PARAM_ALPHA);
|
||||
$hook = optional_param('hook', '', PARAM_CLEAN);
|
||||
$id = required_param('id', PARAM_INT); // course module ID
|
||||
$confirm = optional_param('confirm', 0, PARAM_INT); // commit the operation?
|
||||
$entry = optional_param('entry', 0, PARAM_INT); // entry id
|
||||
$prevmode = required_param('prevmode', PARAM_ALPHA);
|
||||
$hook = optional_param('hook', '', PARAM_CLEAN);
|
||||
|
||||
$strglossary = get_string("modulename", "glossary");
|
||||
$strglossaries = get_string("modulenameplural", "glossary");
|
||||
$stredit = get_string("edit");
|
||||
$entrydeleted = get_string("entrydeleted","glossary");
|
||||
$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");
|
||||
$entrydeleted = get_string("entrydeleted","glossary");
|
||||
|
||||
|
||||
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
|
||||
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
|
||||
print_error("invalidcoursemodule");
|
||||
}
|
||||
}
|
||||
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
print_error('coursemisconf');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $entry = $DB->get_record("glossary_entries", array("id"=>$entry))) {
|
||||
if (! $entry = $DB->get_record("glossary_entries", array("id"=>$entry))) {
|
||||
print_error('invalidentry');
|
||||
}
|
||||
}
|
||||
|
||||
require_login($course->id, false, $cm);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$manageentries = has_capability('mod/glossary:manageentries', $context);
|
||||
require_login($course->id, false, $cm);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$manageentries = has_capability('mod/glossary:manageentries', $context);
|
||||
|
||||
if (! $glossary = $DB->get_record("glossary", array("id"=>$cm->instance))) {
|
||||
if (! $glossary = $DB->get_record("glossary", array("id"=>$cm->instance))) {
|
||||
print_error('invalidid', 'glossary');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$strareyousuredelete = get_string("areyousuredelete","glossary");
|
||||
$strareyousuredelete = get_string("areyousuredelete","glossary");
|
||||
|
||||
if (($entry->userid != $USER->id) and !$manageentries) { // guest id is never matched, no need for special check here
|
||||
if (($entry->userid != $USER->id) and !$manageentries) { // guest id is never matched, no need for special check here
|
||||
print_error('nopermissiontodelentry');
|
||||
}
|
||||
$ineditperiod = ((time() - $entry->timecreated < $CFG->maxeditingtime) || $glossary->editalways);
|
||||
if (!$ineditperiod and !$manageentries) {
|
||||
}
|
||||
$ineditperiod = ((time() - $entry->timecreated < $CFG->maxeditingtime) || $glossary->editalways);
|
||||
if (!$ineditperiod and !$manageentries) {
|
||||
print_error('errdeltimeexpired', 'glossary');
|
||||
}
|
||||
}
|
||||
|
||||
/// If data submitted, then process and store.
|
||||
|
||||
if ($confirm and confirm_sesskey()) { // the operation was confirmed.
|
||||
if ($confirm and confirm_sesskey()) { // the operation was confirmed.
|
||||
// if it is an imported entry, just delete the relation
|
||||
|
||||
if ($entry->sourceglossaryid) {
|
||||
|
@ -89,9 +101,9 @@
|
|||
add_to_log($course->id, "glossary", "delete entry", "view.php?id=$cm->id&mode=$prevmode&hook=$hook", $entry->id,$cm->id);
|
||||
redirect("view.php?id=$cm->id&mode=$prevmode&hook=$hook");
|
||||
|
||||
} else { // the operation has not been confirmed yet so ask the user to do so
|
||||
} 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';
|
||||
|
@ -102,5 +114,6 @@
|
|||
echo $OUTPUT->confirm($areyousure, new moodle_url($linkyes, $optionsyes), new moodle_url($linkno, $optionsno));
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,34 +1,56 @@
|
|||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
/// This page allows to edit entries categories for a particular instance of glossary
|
||||
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
|
||||
$id = required_param('id', PARAM_INT); // Course Module ID, or
|
||||
$usedynalink = optional_param('usedynalink', 0, PARAM_INT); // category ID
|
||||
$confirm = optional_param('confirm', 0, PARAM_INT); // confirm the action
|
||||
$name = optional_param('name', '', PARAM_CLEAN); // confirm the name
|
||||
$id = required_param('id', PARAM_INT); // Course Module ID, or
|
||||
$usedynalink = optional_param('usedynalink', 0, PARAM_INT); // category ID
|
||||
$confirm = optional_param('confirm', 0, PARAM_INT); // confirm the action
|
||||
$name = optional_param('name', '', PARAM_CLEAN); // confirm the name
|
||||
|
||||
$action = optional_param('action', '', PARAM_ALPHA ); // what to do
|
||||
$hook = optional_param('hook', '', PARAM_ALPHANUM); // category ID
|
||||
$mode = optional_param('mode', '', PARAM_ALPHA); // cat
|
||||
$action = optional_param('action', '', PARAM_ALPHA ); // what to do
|
||||
$hook = optional_param('hook', '', PARAM_ALPHANUM); // category ID
|
||||
$mode = optional_param('mode', '', PARAM_ALPHA); // cat
|
||||
|
||||
$action = strtolower($action);
|
||||
$action = strtolower($action);
|
||||
|
||||
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
|
||||
$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');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
print_error('coursemisconf');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $glossary = $DB->get_record("glossary", array("id"=>$cm->instance))) {
|
||||
if (! $glossary = $DB->get_record("glossary", array("id"=>$cm->instance))) {
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
}
|
||||
|
||||
if ($hook > 0) {
|
||||
if ($hook > 0) {
|
||||
if ($category = $DB->get_record("glossary_categories", array("id"=>$hook))) {
|
||||
//Check it belongs to the same glossary
|
||||
if ($category->glossaryid != $glossary->id) {
|
||||
|
@ -37,24 +59,24 @@
|
|||
} else {
|
||||
print_error('invalidcategoryid');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
require_login($course->id, false, $cm);
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('mod/glossary:managecategories', $context);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('mod/glossary:managecategories', $context);
|
||||
|
||||
$strglossaries = get_string("modulenameplural", "glossary");
|
||||
$strglossary = get_string("modulename", "glossary");
|
||||
$strglossaries = get_string("modulenameplural", "glossary");
|
||||
$strglossary = get_string("modulename", "glossary");
|
||||
|
||||
$PAGE->navbar->add($strglossaries, new moodle_url($CFG->wwwroot.'/mod/glossary/index.php', array('id'=>$course->id)));
|
||||
$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));
|
||||
echo $OUTPUT->header();
|
||||
$PAGE->navbar->add($strglossaries, new moodle_url($CFG->wwwroot.'/mod/glossary/index.php', array('id'=>$course->id)));
|
||||
$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($OUTPUT->update_module_button($cm->id, 'glossary'));
|
||||
echo $OUTPUT->header();
|
||||
|
||||
if ( $hook >0 ) {
|
||||
if ( $hook >0 ) {
|
||||
|
||||
if ( $action == "edit" ) {
|
||||
if ( $confirm ) {
|
||||
|
@ -132,7 +154,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
} elseif ( $action == "add" ) {
|
||||
} elseif ( $action == "add" ) {
|
||||
if ( $confirm ) {
|
||||
$ILIKE = $DB->sql_ilike();
|
||||
$dupcategory = $DB->get_records_sql("SELECT * FROM {glossary_categories} WHERE name $ILIKE ? AND glossaryid=?", array($name, $glossary->id));
|
||||
|
@ -160,12 +182,12 @@
|
|||
$name="";
|
||||
require "editcategories.html";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $action ) {
|
||||
if ( $action ) {
|
||||
echo $OUTPUT->footer();
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
|
|
@ -1,51 +1,63 @@
|
|||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
|
||||
$id = required_param('id', PARAM_INT); // Course Module ID
|
||||
$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);
|
||||
$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)) {
|
||||
$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');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
print_error('coursemisconf');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $glossary = $DB->get_record("glossary", array("id"=>$cm->instance))) {
|
||||
if (! $glossary = $DB->get_record("glossary", array("id"=>$cm->instance))) {
|
||||
print_error('invalidid', 'glossary');
|
||||
}
|
||||
}
|
||||
|
||||
require_login($course->id, false, $cm);
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('mod/glossary:export', $context);
|
||||
$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('exportentriestoxml', 'glossary');
|
||||
$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('exportentriestoxml', 'glossary');
|
||||
|
||||
$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_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($OUTPUT->update_module_button($cm->id, 'glossary'));
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($strexportentries);
|
||||
echo $OUTPUT->box_start('glossarydisplay generalbox');
|
||||
?>
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($strexportentries);
|
||||
echo $OUTPUT->box_start('glossarydisplay generalbox');
|
||||
?>
|
||||
<form action="exportfile.php" method="post">
|
||||
<table border="0" cellpadding="6" cellspacing="6" width="100%">
|
||||
<tr><td align="center">
|
||||
|
|
|
@ -1,64 +1,74 @@
|
|||
<?php // $Id$
|
||||
require_once('../../config.php');
|
||||
require_once('lib.php');
|
||||
<?php
|
||||
|
||||
$id = required_param('id', PARAM_INT); // Entry ID
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL); // export confirmation
|
||||
$prevmode = required_param('prevmode', PARAM_ALPHA);
|
||||
$hook = optional_param('hook', '', PARAM_CLEAN);
|
||||
require_once('../../config.php');
|
||||
require_once('lib.php');
|
||||
|
||||
if (!$entry = $DB->get_record('glossary_entries', array('id'=>$id))) {
|
||||
$id = required_param('id', PARAM_INT); // Entry ID
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL); // export confirmation
|
||||
$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');
|
||||
}
|
||||
}
|
||||
|
||||
if ($entry->sourceglossaryid) {
|
||||
if ($entry->sourceglossaryid) {
|
||||
//already exported
|
||||
if (!$cm = get_coursemodule_from_id('glossary', $entry->sourceglossaryid)) {
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
redirect('view.php?id='.$cm->id.'&mode=entry&hook='.$entry->id);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$cm = get_coursemodule_from_instance('glossary', $entry->glossaryid)) {
|
||||
if (!$cm = get_coursemodule_from_instance('glossary', $entry->glossaryid)) {
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
}
|
||||
|
||||
if (!$glossary = $DB->get_record('glossary', array('id'=>$cm->instance))) {
|
||||
if (!$glossary = $DB->get_record('glossary', array('id'=>$cm->instance))) {
|
||||
print_error('invalidid', 'glossary');
|
||||
}
|
||||
}
|
||||
|
||||
if (!$course = $DB->get_record('course', array('id'=>$cm->course))) {
|
||||
if (!$course = $DB->get_record('course', array('id'=>$cm->course))) {
|
||||
print_error('coursemisconf');
|
||||
}
|
||||
}
|
||||
|
||||
require_course_login($course->id, true, $cm);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('mod/glossary:export', $context);
|
||||
require_course_login($course->id, true, $cm);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('mod/glossary:export', $context);
|
||||
|
||||
$returnurl = "view.php?id=$cm->id&mode=$prevmode&hook=".urlencode($hook);
|
||||
$returnurl = "view.php?id=$cm->id&mode=$prevmode&hook=".urlencode($hook);
|
||||
|
||||
if (!$mainglossary = $DB->get_record('glossary', array('course'=>$cm->course, 'mainglossary'=>1))) {
|
||||
if (!$mainglossary = $DB->get_record('glossary', array('course'=>$cm->course, 'mainglossary'=>1))) {
|
||||
//main glossary not present
|
||||
redirect($returnurl);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$maincm = get_coursemodule_from_instance('glossary', $mainglossary->id)) {
|
||||
if (!$maincm = get_coursemodule_from_instance('glossary', $mainglossary->id)) {
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
}
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$maincontext = get_context_instance(CONTEXT_MODULE, $maincm->id);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
$maincontext = get_context_instance(CONTEXT_MODULE, $maincm->id);
|
||||
|
||||
if (!$course = $DB->get_record('course', array('id'=>$cm->course))) {
|
||||
if (!$course = $DB->get_record('course', array('id'=>$cm->course))) {
|
||||
print_error('coursemisconf');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$strglossaries = get_string('modulenameplural', 'glossary');
|
||||
$entryalreadyexist = get_string('entryalreadyexist','glossary');
|
||||
$entryexported = get_string('entryexported','glossary');
|
||||
$strglossaries = get_string('modulenameplural', 'glossary');
|
||||
$entryalreadyexist = get_string('entryalreadyexist','glossary');
|
||||
$entryexported = get_string('entryexported','glossary');
|
||||
|
||||
if (!$mainglossary->allowduplicatedentries) {
|
||||
if (!$mainglossary->allowduplicatedentries) {
|
||||
if ($DB->get_record('glossary_entries', array('glossaryid'=>$mainglossary->id, 'lower(concept)'=>moodle_strtolower($entry->concept)))) {
|
||||
$PAGE->set_title(format_string($glossary->name));
|
||||
echo $OUTPUT->header();
|
||||
|
@ -68,9 +78,9 @@
|
|||
echo $OUTPUT->footer();
|
||||
die;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!data_submitted() or !$confirm or !confirm_sesskey()) {
|
||||
if (!data_submitted() or !$confirm or !confirm_sesskey()) {
|
||||
$PAGE->set_title(format_string($glossary->name));
|
||||
echo $OUTPUT->header();
|
||||
echo '<div class="boxaligncenter">';
|
||||
|
@ -85,7 +95,7 @@
|
|||
echo $OUTPUT->footer();
|
||||
die;
|
||||
|
||||
} else {
|
||||
} else {
|
||||
$entry->glossaryid = $mainglossary->id;
|
||||
$entry->sourceglossaryid = $glossary->id;
|
||||
|
||||
|
@ -108,5 +118,6 @@
|
|||
$DB->update_record('glossary_entries', $entry);
|
||||
|
||||
redirect ($returnurl);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,35 +1,45 @@
|
|||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
|
||||
// disable moodle specific debug messages
|
||||
disable_debugging();
|
||||
// disable moodle specific debug messages
|
||||
disable_debugging();
|
||||
|
||||
$id = required_param('id', PARAM_INT); // Course Module ID
|
||||
$id = required_param('id', PARAM_INT); // Course Module ID
|
||||
|
||||
$l = optional_param('l','', PARAM_ALPHANUM);
|
||||
$cat = optional_param('cat',0, PARAM_ALPHANUM);
|
||||
$l = optional_param('l','', PARAM_ALPHANUM);
|
||||
$cat = optional_param('cat',0, PARAM_ALPHANUM);
|
||||
|
||||
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
|
||||
$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');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
print_error('coursemisconf');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $glossary = $DB->get_record("glossary", array("id"=>$cm->instance))) {
|
||||
if (! $glossary = $DB->get_record("glossary", array("id"=>$cm->instance))) {
|
||||
print_error('invalidid', 'glossary');
|
||||
}
|
||||
}
|
||||
|
||||
require_login($course->id, false, $cm);
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('mod/glossary:export', $context);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('mod/glossary:export', $context);
|
||||
|
||||
$filename = clean_filename(strip_tags(format_string($glossary->name,true)).'.xml');
|
||||
$content = glossary_generate_export_file($glossary,$l,$cat);
|
||||
$filename = clean_filename(strip_tags(format_string($glossary->name,true)).'.xml');
|
||||
$content = glossary_generate_export_file($glossary,$l,$cat);
|
||||
|
||||
send_file($content, $filename, 0, 0, true, true);
|
||||
|
||||
send_file($content, $filename, 0, 0, true, true);
|
||||
?>
|
|
@ -1,21 +1,28 @@
|
|||
<?php // $Id$
|
||||
/// This file allows to manage the default behaviour of the display formats
|
||||
<?php
|
||||
|
||||
require_once("../../config.php");
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once("lib.php");
|
||||
/// This file allows to manage the default behaviour of the display formats
|
||||
|
||||
$id = required_param('id', PARAM_INT);
|
||||
$mode = optional_param('mode', '', PARAM_ACTION);
|
||||
require_once("../../config.php");
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once("lib.php");
|
||||
|
||||
admin_externalpage_setup('managemodules'); // this is hacky, tehre should be a special hidden page for it
|
||||
$id = required_param('id', PARAM_INT);
|
||||
$mode = optional_param('mode', '', PARAM_ACTION);
|
||||
|
||||
if ( !$displayformat = $DB->get_record("glossary_formats", array("id"=>$id))) {
|
||||
$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))) {
|
||||
print_error('invalidglossaryformat', 'glossary');
|
||||
}
|
||||
}
|
||||
|
||||
$form = data_submitted();
|
||||
if ( $mode == 'visible' ) {
|
||||
$form = data_submitted();
|
||||
if ( $mode == 'visible' ) {
|
||||
if ( $displayformat ) {
|
||||
if ( $displayformat->visible ) {
|
||||
$displayformat->visible = 0;
|
||||
|
@ -26,7 +33,7 @@
|
|||
}
|
||||
redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=modsettingglossary#glossary_formats_header");
|
||||
die;
|
||||
} elseif ( $mode == 'edit' and $form) {
|
||||
} elseif ( $mode == 'edit' and $form) {
|
||||
|
||||
$displayformat->popupformatname = $form->popupformatname;
|
||||
$displayformat->showgroup = $form->showgroup;
|
||||
|
@ -38,30 +45,30 @@
|
|||
$DB->update_record("glossary_formats",$displayformat);
|
||||
redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=modsettingglossary#glossary_formats_header");
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
$strmodulename = get_string("modulename", "glossary");
|
||||
$strdisplayformats = get_string("displayformats","glossary");
|
||||
$strmodulename = get_string("modulename", "glossary");
|
||||
$strdisplayformats = get_string("displayformats","glossary");
|
||||
|
||||
admin_externalpage_print_header();
|
||||
admin_externalpage_print_header();
|
||||
|
||||
echo $OUTPUT->heading($strmodulename . ': ' . get_string("displayformats","glossary"));
|
||||
echo $OUTPUT->heading($strmodulename . ': ' . get_string("displayformats","glossary"));
|
||||
|
||||
echo $OUTPUT->box(get_string("configwarning", 'admin'), "generalbox boxaligncenter boxwidthnormal");
|
||||
echo "<br />";
|
||||
echo $OUTPUT->box(get_string("configwarning", 'admin'), "generalbox boxaligncenter boxwidthnormal");
|
||||
echo "<br />";
|
||||
|
||||
$yes = get_string("yes");
|
||||
$no = get_string("no");
|
||||
$yes = get_string("yes");
|
||||
$no = get_string("no");
|
||||
|
||||
echo '<form method="post" action="formats.php" id="form">';
|
||||
echo '<table width="90%" align="center" class="generalbox">';
|
||||
?>
|
||||
<tr>
|
||||
echo '<form method="post" action="formats.php" id="form">';
|
||||
echo '<table width="90%" align="center" class="generalbox">';
|
||||
?>
|
||||
<tr>
|
||||
<td colspan="3" align="center"><strong>
|
||||
<?php echo get_string('displayformat'.$displayformat->name,'glossary'); ?>
|
||||
</strong></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right" width="20%"><?php print_string('popupformat','glossary'); ?></td>
|
||||
<td>
|
||||
<?php
|
||||
|
@ -83,12 +90,12 @@
|
|||
<td width="60%">
|
||||
<?php print_string("cnfrelatedview", "glossary") ?><br /><br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right" width="20%"><?php print_string('defaultmode','glossary'); ?></td>
|
||||
<td>
|
||||
<select size="1" name="defaultmode">
|
||||
<?php
|
||||
<?php
|
||||
$sletter = '';
|
||||
$scat = '';
|
||||
$sauthor = '';
|
||||
|
@ -110,7 +117,7 @@
|
|||
$sauthor = ' selected="selected" ';
|
||||
break;
|
||||
}
|
||||
?>
|
||||
?>
|
||||
<option value="letter" <?php p($sletter)?>><?php print_string("letter", "glossary"); ?></option>
|
||||
<option value="cat" <?php p($scat)?>><?php print_string("cat", "glossary"); ?></option>
|
||||
<option value="date" <?php p($sdate)?>><?php print_string("date", "glossary"); ?></option>
|
||||
|
@ -120,12 +127,12 @@
|
|||
<td width="60%">
|
||||
<?php print_string("cnfdefaultmode", "glossary") ?><br /><br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right" width="20%"><?php print_string('defaulthook','glossary'); ?></td>
|
||||
<td>
|
||||
<select size="1" name="defaulthook">
|
||||
<?php
|
||||
<?php
|
||||
$sall = '';
|
||||
$sspecial = '';
|
||||
$sallcategories = '';
|
||||
|
@ -147,7 +154,7 @@
|
|||
$snocategorised = ' selected="selected" ';
|
||||
break;
|
||||
}
|
||||
?>
|
||||
?>
|
||||
<option value="ALL" <?php p($sall)?>><?php p(get_string("allentries","glossary"))?></option>
|
||||
<option value="SPECIAL" <?php p($sspecial)?>><?php p(get_string("special","glossary"))?></option>
|
||||
<option value="0" <?php p($sallcategories)?>><?php p(get_string("allcategories","glossary"))?></option>
|
||||
|
@ -157,12 +164,12 @@
|
|||
<td width="60%">
|
||||
<?php print_string("cnfdefaulthook", "glossary") ?><br /><br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right" width="20%"><?php print_string('defaultsortkey','glossary'); ?></td>
|
||||
<td>
|
||||
<select size="1" name="sortkey">
|
||||
<?php
|
||||
<?php
|
||||
$sfname = '';
|
||||
$slname = '';
|
||||
$supdate = '';
|
||||
|
@ -184,7 +191,7 @@
|
|||
$supdate = ' selected="selected" ';
|
||||
break;
|
||||
}
|
||||
?>
|
||||
?>
|
||||
<option value="CREATION" <?php p($screation)?>><?php p(get_string("sortbycreation","glossary"))?></option>
|
||||
<option value="UPDATE" <?php p($supdate)?>><?php p(get_string("sortbylastupdate","glossary"))?></option>
|
||||
<option value="FIRSTNAME" <?php p($sfname)?>><?php p(get_string("firstname"))?></option>
|
||||
|
@ -194,12 +201,12 @@
|
|||
<td width="60%">
|
||||
<?php print_string("cnfsortkey", "glossary") ?><br /><br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right" width="20%"><?php print_string('defaultsortorder','glossary'); ?></td>
|
||||
<td>
|
||||
<select size="1" name="sortorder">
|
||||
<?php
|
||||
<?php
|
||||
$sasc = '';
|
||||
$sdesc = '';
|
||||
switch ( strtolower($displayformat->sortorder) ) {
|
||||
|
@ -211,7 +218,7 @@
|
|||
$sdesc = ' selected="selected" ';
|
||||
break;
|
||||
}
|
||||
?>
|
||||
?>
|
||||
<option value="asc" <?php p($sasc)?>><?php p(get_string("ascending","glossary"))?></option>
|
||||
<option value="desc" <?php p($sdesc)?>><?php p(get_string("descending","glossary"))?></option>
|
||||
</select>
|
||||
|
@ -219,12 +226,12 @@
|
|||
<td width="60%">
|
||||
<?php print_string("cnfsortorder", "glossary") ?><br /><br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right" width="20%"><?php print_string("includegroupbreaks", "glossary"); ?>:</td>
|
||||
<td>
|
||||
<select size="1" name="showgroup">
|
||||
<?php
|
||||
<?php
|
||||
$yselected = "";
|
||||
$nselected = "";
|
||||
if ($displayformat->showgroup) {
|
||||
|
@ -232,7 +239,7 @@
|
|||
} else {
|
||||
$nselected = " selected=\"selected\" ";
|
||||
}
|
||||
?>
|
||||
?>
|
||||
<option value="1" <?php echo $yselected ?>><?php p($yes)?></option>
|
||||
<option value="0" <?php echo $nselected ?>><?php p($no)?></option>
|
||||
</select>
|
||||
|
@ -240,16 +247,16 @@
|
|||
<td width="60%">
|
||||
<?php print_string("cnfshowgroup", "glossary") ?><br /><br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" align="center">
|
||||
<input type="submit" value="<?php print_string("savechanges") ?>" /></td>
|
||||
</tr>
|
||||
<input type="hidden" name="id" value="<?php p($id) ?>" />
|
||||
<input type="hidden" name="mode" value="edit" />
|
||||
<?php
|
||||
</tr>
|
||||
<input type="hidden" name="id" value="<?php p($id) ?>" />
|
||||
<input type="hidden" name="mode" value="edit" />
|
||||
<?php
|
||||
|
||||
echo '</table></form>';
|
||||
echo '</table></form>';
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
echo $OUTPUT->footer();
|
||||
?>
|
|
@ -1,82 +1,103 @@
|
|||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
require_once("$CFG->dirroot/course/lib.php");
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
require_once("$CFG->dirroot/course/lib.php");
|
||||
|
||||
$id = required_param('id', PARAM_INT); // Course Module ID
|
||||
$id = required_param('id', PARAM_INT); // Course Module ID
|
||||
|
||||
$step = optional_param('step', 0, PARAM_INT);
|
||||
$dest = optional_param('dest', 'current', PARAM_ALPHA); // current | new
|
||||
$file = optional_param('file', '', PARAM_FILE); // file to import
|
||||
$catsincl = optional_param('catsincl', 0, PARAM_INT); // Import Categories too?
|
||||
$step = optional_param('step', 0, PARAM_INT);
|
||||
$dest = optional_param('dest', 'current', PARAM_ALPHA); // current | new
|
||||
$file = optional_param('file', '', PARAM_FILE); // file to import
|
||||
$catsincl = optional_param('catsincl', 0, PARAM_INT); // Import Categories too?
|
||||
|
||||
$mode = optional_param('mode', 'letter', PARAM_ALPHA );
|
||||
$hook = optional_param('hook', 'ALL', PARAM_ALPHANUM);
|
||||
$mode = optional_param('mode', 'letter', PARAM_ALPHA );
|
||||
$hook = optional_param('hook', 'ALL', PARAM_ALPHANUM);
|
||||
|
||||
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
|
||||
$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');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
print_error('coursemisconf');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $glossary = $DB->get_record("glossary", array("id"=>$cm->instance))) {
|
||||
if (! $glossary = $DB->get_record("glossary", array("id"=>$cm->instance))) {
|
||||
print_error('invalidid', 'glossary');
|
||||
}
|
||||
}
|
||||
|
||||
require_login($course->id, false, $cm);
|
||||
require_login($course->id, false, $cm);
|
||||
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('mod/glossary:import', $context);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_capability('mod/glossary:import', $context);
|
||||
|
||||
if ($dest != 'new' and $dest != 'current') {
|
||||
if ($dest != 'new' and $dest != 'current') {
|
||||
$dest = 'current';
|
||||
}
|
||||
$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");
|
||||
$strimportentries = get_string('importentriesfromxml', 'glossary');
|
||||
}
|
||||
$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");
|
||||
$strimportentries = get_string('importentriesfromxml', 'glossary');
|
||||
|
||||
$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_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($OUTPUT->update_module_button($cm->id, 'glossary'));
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($strimportentries);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($strimportentries);
|
||||
|
||||
if ( !$step ) {
|
||||
if ( !$step ) {
|
||||
echo $OUTPUT->box_start('glossarydisplay generalbox');
|
||||
include("import.html");
|
||||
echo $OUTPUT->box_end();
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$form = data_submitted();
|
||||
$file = $_FILES["file"];
|
||||
$form = data_submitted();
|
||||
$file = $_FILES["file"];
|
||||
|
||||
require_once($CFG->dirroot.'/lib/uploadlib.php');
|
||||
$um = new upload_manager('file',false,false,$course,false,0);
|
||||
require_once($CFG->dirroot.'/lib/uploadlib.php');
|
||||
$um = new upload_manager('file',false,false,$course,false,0);
|
||||
|
||||
if (!$um->preprocess_files()) {
|
||||
if (!$um->preprocess_files()) {
|
||||
echo $OUTPUT->box_start('glossarydisplay generalbox');
|
||||
echo $OUTPUT->continue_button('import.php?id='.$id);
|
||||
echo $OUTPUT->box_end();
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
if ($xml = glossary_read_imported_file($file['tmp_name']) ) {
|
||||
if ($xml = glossary_read_imported_file($file['tmp_name']) ) {
|
||||
|
||||
$importedentries = 0;
|
||||
$importedcats = 0;
|
||||
|
@ -340,18 +361,18 @@
|
|||
echo $rejections;
|
||||
echo '</table><hr />';
|
||||
}
|
||||
/// Print continue button, based on results
|
||||
/// Print continue button, based on results
|
||||
if ($importedentries) {
|
||||
echo $OUTPUT->continue_button('view.php?id='.$id);
|
||||
} else {
|
||||
echo $OUTPUT->continue_button('import.php?id='.$id);
|
||||
}
|
||||
echo $OUTPUT->box_end();
|
||||
} else {
|
||||
} else {
|
||||
notice(get_string('errorparsingxml', 'glossary'));
|
||||
}
|
||||
}
|
||||
|
||||
/// Finish the page
|
||||
echo $OUTPUT->footer();
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
?>
|
|
@ -1,74 +1,76 @@
|
|||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
/// This page lists all the instances of glossary in a particular course
|
||||
/// Replace glossary with the name of your module
|
||||
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
require_once("$CFG->libdir/rsslib.php");
|
||||
require_once("$CFG->dirroot/course/lib.php");
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
require_once("$CFG->libdir/rsslib.php");
|
||||
require_once("$CFG->dirroot/course/lib.php");
|
||||
|
||||
$id = required_param('id', PARAM_INT); // course
|
||||
$id = required_param('id', PARAM_INT); // course
|
||||
|
||||
if (!$course = $DB->get_record('course', array('id'=>$id))) {
|
||||
$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');
|
||||
}
|
||||
}
|
||||
|
||||
require_course_login($course);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
require_course_login($course);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $course->id);
|
||||
|
||||
add_to_log($course->id, "glossary", "view all", "index.php?id=$course->id", "");
|
||||
add_to_log($course->id, "glossary", "view all", "index.php?id=$course->id", "");
|
||||
|
||||
|
||||
/// Get all required strings
|
||||
|
||||
$strglossarys = get_string("modulenameplural", "glossary");
|
||||
$strglossary = get_string("modulename", "glossary");
|
||||
$strrss = get_string("rss");
|
||||
$strglossarys = get_string("modulenameplural", "glossary");
|
||||
$strglossary = get_string("modulename", "glossary");
|
||||
$strrss = get_string("rss");
|
||||
|
||||
|
||||
/// Print the header
|
||||
$PAGE->navbar->add($strglossarys, "index.php?id=$course->id");
|
||||
$PAGE->set_title($strglossarys);
|
||||
echo $OUTPUT->header();
|
||||
$PAGE->navbar->add($strglossarys, "index.php?id=$course->id");
|
||||
$PAGE->set_title($strglossarys);
|
||||
echo $OUTPUT->header();
|
||||
|
||||
/// Get all the appropriate data
|
||||
|
||||
if (! $glossarys = get_all_instances_in_course("glossary", $course)) {
|
||||
if (! $glossarys = get_all_instances_in_course("glossary", $course)) {
|
||||
notice(get_string('thereareno', 'moodle', $strglossarys), "../../course/view.php?id=$course->id");
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
||||
/// Print the list of instances (your module will probably extend this)
|
||||
|
||||
$timenow = time();
|
||||
$strname = get_string("name");
|
||||
$strweek = get_string("week");
|
||||
$strtopic = get_string("topic");
|
||||
$strentries = get_string("entries", "glossary");
|
||||
$timenow = time();
|
||||
$strname = get_string("name");
|
||||
$strweek = get_string("week");
|
||||
$strtopic = get_string("topic");
|
||||
$strentries = get_string("entries", "glossary");
|
||||
|
||||
$table = new html_table();
|
||||
$table = new html_table();
|
||||
|
||||
if ($course->format == "weeks") {
|
||||
if ($course->format == "weeks") {
|
||||
$table->head = array ($strweek, $strname, $strentries);
|
||||
$table->align = array ("CENTER", "LEFT", "CENTER");
|
||||
} else if ($course->format == "topics") {
|
||||
} else if ($course->format == "topics") {
|
||||
$table->head = array ($strtopic, $strname, $strentries);
|
||||
$table->align = array ("CENTER", "LEFT", "CENTER");
|
||||
} else {
|
||||
} else {
|
||||
$table->head = array ($strname, $strentries);
|
||||
$table->align = array ("LEFT", "CENTER");
|
||||
}
|
||||
}
|
||||
|
||||
if ($show_rss = (isset($CFG->enablerssfeeds) && isset($CFG->glossary_enablerssfeeds) &&
|
||||
if ($show_rss = (isset($CFG->enablerssfeeds) && isset($CFG->glossary_enablerssfeeds) &&
|
||||
$CFG->enablerssfeeds && $CFG->glossary_enablerssfeeds)) {
|
||||
$table->head[] = $strrss;
|
||||
$table->align[] = "CENTER";
|
||||
}
|
||||
}
|
||||
|
||||
$currentsection = "";
|
||||
$currentsection = "";
|
||||
|
||||
foreach ($glossarys as $glossary) {
|
||||
foreach ($glossarys as $glossary) {
|
||||
if (!$glossary->visible && has_capability('moodle/course:viewhiddenactivities', $context)) {
|
||||
// Show dimmed if the mod is hidden.
|
||||
$link = "<a class=\"dimmed\" href=\"view.php?id=$glossary->coursemodule\">".format_string($glossary->name,true)."</a>";
|
||||
|
@ -121,14 +123,14 @@
|
|||
}
|
||||
|
||||
$table->data[] = $linedata;
|
||||
}
|
||||
}
|
||||
|
||||
echo "<br />";
|
||||
echo "<br />";
|
||||
|
||||
echo $OUTPUT->table($table);
|
||||
echo $OUTPUT->table($table);
|
||||
|
||||
/// Finish the page
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
?>
|
|
@ -1,50 +1,71 @@
|
|||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
global $CFG;
|
||||
global $CFG;
|
||||
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
|
||||
$id = required_param('id', PARAM_INT); // Course Module ID
|
||||
$sortorder = optional_param('sortorder', 'asc', PARAM_ALPHA); // Sorting order
|
||||
$offset = optional_param('offset', 0, PARAM_INT); // number of entries to bypass
|
||||
$displayformat = optional_param('displayformat',-1, PARAM_INT);
|
||||
$id = required_param('id', PARAM_INT); // Course Module ID
|
||||
$sortorder = optional_param('sortorder', 'asc', PARAM_ALPHA); // Sorting order
|
||||
$offset = optional_param('offset', 0, PARAM_INT); // number of entries to bypass
|
||||
$displayformat = optional_param('displayformat',-1, PARAM_INT);
|
||||
|
||||
$mode = required_param('mode', PARAM_ALPHA); // mode to show the entries
|
||||
$hook = optional_param('hook','ALL', PARAM_ALPHANUM); // what to show
|
||||
$sortkey = optional_param('sortkey','UPDATE', PARAM_ALPHA); // Sorting key
|
||||
$mode = required_param('mode', PARAM_ALPHA); // mode to show the entries
|
||||
$hook = optional_param('hook','ALL', PARAM_ALPHANUM); // what to show
|
||||
$sortkey = optional_param('sortkey','UPDATE', PARAM_ALPHA); // Sorting key
|
||||
|
||||
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
|
||||
$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');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
||||
print_error('coursemisconf');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $glossary = $DB->get_record("glossary", array("id"=>$cm->instance))) {
|
||||
if (! $glossary = $DB->get_record("glossary", array("id"=>$cm->instance))) {
|
||||
print_error('invalidid', 'glossary');
|
||||
}
|
||||
}
|
||||
|
||||
if ( !$entriesbypage = $glossary->entbypage ) {
|
||||
if ( !$entriesbypage = $glossary->entbypage ) {
|
||||
$entriesbypage = $CFG->glossary_entbypage;
|
||||
}
|
||||
}
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->header();
|
||||
|
||||
require_course_login($course, true, $cm);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_course_login($course, true, $cm);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
/// Loading the textlib singleton instance. We are going to need it.
|
||||
$textlib = textlib_get_instance();
|
||||
$textlib = textlib_get_instance();
|
||||
|
||||
if (!has_capability('mod/glossary:manageentries', $context) and !$glossary->allowprintview) {
|
||||
if (!has_capability('mod/glossary:manageentries', $context) and !$glossary->allowprintview) {
|
||||
notice(get_string('printviewnotallowed', 'glossary'));
|
||||
}
|
||||
}
|
||||
|
||||
/// setting the default values for the display mode of the current glossary
|
||||
/// only if the glossary is viewed by the first time
|
||||
if ( $dp = $DB->get_record('glossary_formats', array('name'=>$glossary->displayformat)) ) {
|
||||
if ( $dp = $DB->get_record('glossary_formats', array('name'=>$glossary->displayformat)) ) {
|
||||
$printpivot = $dp->showgroup;
|
||||
if ( $mode == '' and $hook == '' and $show == '') {
|
||||
$mode = $dp->defaultmode;
|
||||
|
@ -52,25 +73,25 @@
|
|||
$sortkey = $dp->sortkey;
|
||||
$sortorder = $dp->sortorder;
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
$printpivot = 1;
|
||||
if ( $mode == '' and $hook == '' and $show == '') {
|
||||
$mode = 'letter';
|
||||
$hook = 'ALL';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $displayformat == -1 ) {
|
||||
if ( $displayformat == -1 ) {
|
||||
$displayformat = $glossary->displayformat;
|
||||
}
|
||||
}
|
||||
|
||||
/// stablishing flag variables
|
||||
if ( $sortorder = strtolower($sortorder) ) {
|
||||
if ( $sortorder = strtolower($sortorder) ) {
|
||||
if ($sortorder != 'asc' and $sortorder != 'desc') {
|
||||
$sortorder = '';
|
||||
}
|
||||
}
|
||||
if ( $sortkey = strtoupper($sortkey) ) {
|
||||
}
|
||||
if ( $sortkey = strtoupper($sortkey) ) {
|
||||
if ($sortkey != 'CREATION' and
|
||||
$sortkey != 'UPDATE' and
|
||||
$sortkey != 'FIRSTNAME' and
|
||||
|
@ -78,32 +99,32 @@
|
|||
) {
|
||||
$sortkey = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch ( $mode = strtolower($mode) ) {
|
||||
case 'entry': /// Looking for a certain entry id
|
||||
switch ( $mode = strtolower($mode) ) {
|
||||
case 'entry': /// Looking for a certain entry id
|
||||
$tab = GLOSSARY_STANDARD_VIEW;
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'cat': /// Looking for a certain cat
|
||||
case 'cat': /// Looking for a certain cat
|
||||
$tab = GLOSSARY_CATEGORY_VIEW;
|
||||
if ( $hook > 0 ) {
|
||||
$category = $DB->get_record("glossary_categories", array("id"=>$hook));
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'approval': /// Looking for entries waiting for approval
|
||||
case 'approval': /// Looking for entries waiting for approval
|
||||
$tab = GLOSSARY_APPROVAL_VIEW;
|
||||
if ( !$hook and !$sortkey and !$sortorder) {
|
||||
$hook = 'ALL';
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'term': /// Looking for entries that include certain term in its concept, definition or aliases
|
||||
case 'term': /// Looking for entries that include certain term in its concept, definition or aliases
|
||||
$tab = GLOSSARY_STANDARD_VIEW;
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'date':
|
||||
case 'date':
|
||||
$tab = GLOSSARY_DATE_VIEW;
|
||||
if ( !$sortkey ) {
|
||||
$sortkey = 'UPDATE';
|
||||
|
@ -111,9 +132,9 @@
|
|||
if ( !$sortorder ) {
|
||||
$sortorder = 'desc';
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'author': /// Looking for entries, browsed by author
|
||||
case 'author': /// Looking for entries, browsed by author
|
||||
$tab = GLOSSARY_AUTHOR_VIEW;
|
||||
if ( !$hook ) {
|
||||
$hook = 'ALL';
|
||||
|
@ -124,31 +145,31 @@
|
|||
if ( !$sortorder ) {
|
||||
$sortorder = 'asc';
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'letter': /// Looking for entries that begin with a certain letter, ALL or SPECIAL characters
|
||||
default:
|
||||
case 'letter': /// Looking for entries that begin with a certain letter, ALL or SPECIAL characters
|
||||
default:
|
||||
$tab = GLOSSARY_STANDARD_VIEW;
|
||||
if ( !$hook ) {
|
||||
$hook = 'ALL';
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
include_once("sql.php");
|
||||
include_once("sql.php");
|
||||
|
||||
$entriesshown = 0;
|
||||
$currentpivot = '';
|
||||
if ( $hook == 'SPECIAL' ) {
|
||||
$entriesshown = 0;
|
||||
$currentpivot = '';
|
||||
if ( $hook == 'SPECIAL' ) {
|
||||
$alphabet = explode(",", get_string("alphabet"));
|
||||
}
|
||||
}
|
||||
|
||||
$site = $DB->get_record("course", array("id"=>1));
|
||||
echo '<p style="text-align:right"><span style="font-size:0.75em">' . userdate(time()) . '</span></p>';
|
||||
echo get_string("site") . ': <strong>' . format_string($site->fullname) . '</strong><br />';
|
||||
echo get_string("course") . ': <strong>' . format_string($course->fullname) . ' ('. format_string($course->shortname) . ')</strong><br />';
|
||||
echo get_string("modulename","glossary") . ': <strong>' . format_string($glossary->name, true) . '</strong>';
|
||||
if ( $allentries ) {
|
||||
$site = $DB->get_record("course", array("id"=>1));
|
||||
echo '<p style="text-align:right"><span style="font-size:0.75em">' . userdate(time()) . '</span></p>';
|
||||
echo get_string("site") . ': <strong>' . format_string($site->fullname) . '</strong><br />';
|
||||
echo get_string("course") . ': <strong>' . format_string($course->fullname) . ' ('. format_string($course->shortname) . ')</strong><br />';
|
||||
echo get_string("modulename","glossary") . ': <strong>' . format_string($glossary->name, true) . '</strong>';
|
||||
if ( $allentries ) {
|
||||
foreach ($allentries as $entry) {
|
||||
|
||||
// Setting the pivot for the current entry
|
||||
|
@ -179,7 +200,7 @@
|
|||
|
||||
glossary_print_entry($course, $cm, $glossary, $entry, $mode, $hook,1,$displayformat,false,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
echo $OUTPUT->footer();
|
||||
?>
|
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -1,60 +1,66 @@
|
|||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
// For a given entry, shows a report of all the ratings it has
|
||||
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
|
||||
$id = required_param('id', PARAM_INT);
|
||||
$sort = optional_param('sort', '', PARAM_ALPHA);
|
||||
$id = required_param('id', PARAM_INT);
|
||||
$sort = optional_param('sort', '', PARAM_ALPHA);
|
||||
|
||||
if (! $entry = $DB->get_record('glossary_entries', array('id'=>$id))) {
|
||||
$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');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $glossary = $DB->get_record('glossary', array('id'=>$entry->glossaryid))) {
|
||||
if (! $glossary = $DB->get_record('glossary', array('id'=>$entry->glossaryid))) {
|
||||
print_error('invalidid', 'glossary');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $course = $DB->get_record('course', array('id'=>$glossary->course))) {
|
||||
if (! $course = $DB->get_record('course', array('id'=>$glossary->course))) {
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $cm = get_coursemodule_from_instance('glossary', $glossary->id, $course->id)) {
|
||||
if (! $cm = get_coursemodule_from_instance('glossary', $glossary->id, $course->id)) {
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
}
|
||||
|
||||
require_login($course, false, $cm);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_login($course, false, $cm);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
if (!$glossary->assessed) {
|
||||
if (!$glossary->assessed) {
|
||||
print_error('nopermissiontorate');
|
||||
}
|
||||
}
|
||||
|
||||
if (!has_capability('mod/glossary:manageentries', $context) and $USER->id != $entry->userid) {
|
||||
if (!has_capability('mod/glossary:manageentries', $context) and $USER->id != $entry->userid) {
|
||||
print_error('nopermissiontoviewresult', 'glossary');
|
||||
}
|
||||
}
|
||||
|
||||
switch ($sort) {
|
||||
switch ($sort) {
|
||||
case 'firstname': $sqlsort = "u.firstname ASC"; break;
|
||||
case 'rating': $sqlsort = "r.rating ASC"; break;
|
||||
default: $sqlsort = "r.time ASC";
|
||||
}
|
||||
}
|
||||
|
||||
$scalemenu = make_grades_menu($glossary->scale);
|
||||
$scalemenu = make_grades_menu($glossary->scale);
|
||||
|
||||
$strratings = get_string('ratings', 'glossary');
|
||||
$strrating = get_string('rating', 'glossary');
|
||||
$strname = get_string('name');
|
||||
$strtime = get_string('time');
|
||||
$strratings = get_string('ratings', 'glossary');
|
||||
$strrating = get_string('rating', 'glossary');
|
||||
$strname = get_string('name');
|
||||
$strtime = get_string('time');
|
||||
|
||||
$PAGE->set_title("$strratings: $entry->concept");
|
||||
echo $OUTPUT->header();
|
||||
$PAGE->set_title("$strratings: $entry->concept");
|
||||
echo $OUTPUT->header();
|
||||
|
||||
if (!$ratings = glossary_get_ratings($entry->id, $sqlsort)) {
|
||||
if (!$ratings = glossary_get_ratings($entry->id, $sqlsort)) {
|
||||
print_error('ratingno', 'glossary');
|
||||
|
||||
} else {
|
||||
} else {
|
||||
echo "<table border=\"0\" cellpadding=\"3\" cellspacing=\"3\" class=\"generalbox\" style=\"width:100%\">";
|
||||
echo "<tr>";
|
||||
echo "<th class=\"header\" scope=\"col\"> </th>";
|
||||
|
@ -80,8 +86,9 @@
|
|||
}
|
||||
echo "</table>";
|
||||
echo "<br />";
|
||||
}
|
||||
}
|
||||
|
||||
echo $OUTPUT->close_window_button();
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
echo $OUTPUT->close_window_button();
|
||||
echo $OUTPUT->footer();
|
||||
?>
|
|
@ -1,17 +1,33 @@
|
|||
<?php // $Id$
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
<?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);
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
|
||||
if ($CFG->forcelogin) {
|
||||
$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($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();
|
||||
}
|
||||
}
|
||||
|
||||
if ($eid) {
|
||||
if ($eid) {
|
||||
$entry = $DB->get_record("glossary_entries", array("id"=>$eid));
|
||||
$glossary = $DB->get_record('glossary', array('id'=>$entry->glossaryid));
|
||||
$entry->glossaryname = format_string($glossary->name,true);
|
||||
|
@ -24,21 +40,21 @@
|
|||
$entry->cmid = $cm->id;
|
||||
$entry->courseid = $cm->course;
|
||||
$entries[] = $entry;
|
||||
} else if ($concept) {
|
||||
} else if ($concept) {
|
||||
$entries = glossary_get_entries_search($concept, $courseid);
|
||||
} else {
|
||||
} else {
|
||||
print_error('invalidentry');
|
||||
}
|
||||
}
|
||||
|
||||
if ($entries) {
|
||||
if ($entries) {
|
||||
foreach ($entries as $key => $entry) {
|
||||
//$entries[$key]->footer = "<p align=\"right\">» <a onClick=\"if (window.opener) {window.opener.location.href='$CFG->wwwroot/mod/glossary/view.php?g=$entry->glossaryid'; return false;} else {openpopup('/mod/glossary/view.php?g=$entry->glossaryid', 'glossary', 'menubar=1,location=1,toolbar=1,scrollbars=1,directories=1,status=1,resizable=1', 0); return false;}\" href=\"$CFG->wwwroot/mod/glossary/view.php?g=$entry->glossaryid\" target=\"_blank\">".format_string($entry->glossaryname,true)."</a></p>"; // Could not get this to work satisfactorily in all cases - Martin
|
||||
$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>";
|
||||
add_to_log($entry->courseid, "glossary", "view entry", "showentry.php?eid=$entry->id", $entry->id, $entry->cmid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($courseid)) {
|
||||
if (!empty($courseid)) {
|
||||
$course = $DB->get_record("course", array("id"=>$courseid));
|
||||
if ($course->id != SITEID) {
|
||||
require_login($courseid);
|
||||
|
@ -54,17 +70,17 @@
|
|||
$PAGE->set_title(strip_tags("$course->shortname: $strglossaries $strsearch"));
|
||||
$PAGE->set_heading($course->fullname);
|
||||
echo $OUTPUT->header();
|
||||
} else {
|
||||
} else {
|
||||
echo $OUTPUT->header(); // Needs to be something here to allow linking back to the whole glossary
|
||||
}
|
||||
}
|
||||
|
||||
if ($entries) {
|
||||
if ($entries) {
|
||||
glossary_print_dynaentry($courseid, $entries, $displayformat);
|
||||
}
|
||||
}
|
||||
|
||||
echo $OUTPUT->close_window_button();
|
||||
echo $OUTPUT->close_window_button();
|
||||
|
||||
/// Show one reduced footer
|
||||
echo $OUTPUT->footer();
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
?>
|
|
@ -1,25 +1,26 @@
|
|||
<?php // $Id$
|
||||
<?php
|
||||
|
||||
/// This page prints a particular instance of glossary
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
require_once("$CFG->libdir/rsslib.php");
|
||||
require_once("../../config.php");
|
||||
require_once("lib.php");
|
||||
require_once("$CFG->libdir/rsslib.php");
|
||||
|
||||
$id = optional_param('id', 0, PARAM_INT); // Course Module ID
|
||||
$g = optional_param('g', 0, PARAM_INT); // Glossary ID
|
||||
$id = optional_param('id', 0, PARAM_INT); // Course Module ID
|
||||
$g = optional_param('g', 0, PARAM_INT); // Glossary ID
|
||||
|
||||
$tab = optional_param('tab', GLOSSARY_NO_VIEW, PARAM_ALPHA); // browsing entries by categories?
|
||||
$displayformat = optional_param('displayformat',-1, PARAM_INT); // override of the glossary display format
|
||||
$tab = optional_param('tab', GLOSSARY_NO_VIEW, PARAM_ALPHA); // browsing entries by categories?
|
||||
$displayformat = optional_param('displayformat',-1, PARAM_INT); // override of the glossary display format
|
||||
|
||||
$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
|
||||
$fullsearch = optional_param('fullsearch', 0,PARAM_INT); // full search (concept and definition) when searching?
|
||||
$sortkey = optional_param('sortkey', '', PARAM_ALPHA);// Sorted view: CREATION | UPDATE | FIRSTNAME | LASTNAME...
|
||||
$sortorder = optional_param('sortorder', 'ASC', PARAM_ALPHA); // it defines the order of the sorting (ASC or DESC)
|
||||
$offset = optional_param('offset', 0,PARAM_INT); // entries to bypass (for paging purposes)
|
||||
$page = optional_param('page', 0,PARAM_INT); // Page to show (for paging purposes)
|
||||
$show = optional_param('show', '', PARAM_ALPHA); // [ concept | alias ] => mode=term hook=$show
|
||||
$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
|
||||
$fullsearch = optional_param('fullsearch', 0,PARAM_INT); // full search (concept and definition) when searching?
|
||||
$sortkey = optional_param('sortkey', '', PARAM_ALPHA);// Sorted view: CREATION | UPDATE | FIRSTNAME | LASTNAME...
|
||||
$sortorder = optional_param('sortorder', 'ASC', PARAM_ALPHA); // it defines the order of the sorting (ASC or DESC)
|
||||
$offset = optional_param('offset', 0,PARAM_INT); // entries to bypass (for paging purposes)
|
||||
$page = optional_param('page', 0,PARAM_INT); // Page to show (for paging purposes)
|
||||
$show = optional_param('show', '', PARAM_ALPHA); // [ concept | alias ] => mode=term hook=$show
|
||||
|
||||
if (!empty($id)) {
|
||||
if (!empty($id)) {
|
||||
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
@ -30,7 +31,7 @@
|
|||
print_error('invalidid', 'glossary');
|
||||
}
|
||||
|
||||
} else if (!empty($g)) {
|
||||
} else if (!empty($g)) {
|
||||
if (! $glossary = $DB->get_record("glossary", array("id"=>$g))) {
|
||||
print_error('invalidid', 'glossary');
|
||||
}
|
||||
|
@ -41,36 +42,36 @@
|
|||
print_error('invalidcoursemodule');
|
||||
}
|
||||
$id = $cm->id;
|
||||
} else {
|
||||
} else {
|
||||
print_error('invalidid', 'glossary');
|
||||
}
|
||||
}
|
||||
|
||||
require_course_login($course->id, true, $cm);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
require_course_login($course->id, true, $cm);
|
||||
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
||||
|
||||
/// Loading the textlib singleton instance. We are going to need it.
|
||||
$textlib = textlib_get_instance();
|
||||
$textlib = textlib_get_instance();
|
||||
|
||||
/// redirecting if adding a new entry
|
||||
if ($tab == GLOSSARY_ADDENTRY_VIEW ) {
|
||||
if ($tab == GLOSSARY_ADDENTRY_VIEW ) {
|
||||
redirect("edit.php?cmid=$cm->id&mode=$mode");
|
||||
}
|
||||
}
|
||||
|
||||
/// setting the defaut number of entries per page if not set
|
||||
|
||||
if ( !$entriesbypage = $glossary->entbypage ) {
|
||||
if ( !$entriesbypage = $glossary->entbypage ) {
|
||||
$entriesbypage = $CFG->glossary_entbypage;
|
||||
}
|
||||
}
|
||||
|
||||
/// If we have received a page, recalculate offset
|
||||
if ($page != 0 && $offset == 0) {
|
||||
if ($page != 0 && $offset == 0) {
|
||||
$offset = $page * $entriesbypage;
|
||||
}
|
||||
}
|
||||
|
||||
/// setting the default values for the display mode of the current glossary
|
||||
/// only if the glossary is viewed by the first time
|
||||
if ( $dp = $DB->get_record('glossary_formats', array('name'=>$glossary->displayformat)) ) {
|
||||
/// Based on format->defaultmode, we build the defaulttab to be showed sometimes
|
||||
if ( $dp = $DB->get_record('glossary_formats', array('name'=>$glossary->displayformat)) ) {
|
||||
/// Based on format->defaultmode, we build the defaulttab to be showed sometimes
|
||||
switch ($dp->defaultmode) {
|
||||
case 'cat':
|
||||
$defaulttab = GLOSSARY_CATEGORY_VIEW;
|
||||
|
@ -84,7 +85,7 @@
|
|||
default:
|
||||
$defaulttab = GLOSSARY_STANDARD_VIEW;
|
||||
}
|
||||
/// Fetch the rest of variables
|
||||
/// Fetch the rest of variables
|
||||
$printpivot = $dp->showgroup;
|
||||
if ( $mode == '' and $hook == '' and $show == '') {
|
||||
$mode = $dp->defaultmode;
|
||||
|
@ -92,41 +93,41 @@
|
|||
$sortkey = $dp->sortkey;
|
||||
$sortorder = $dp->sortorder;
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
$defaulttab = GLOSSARY_STANDARD_VIEW;
|
||||
$printpivot = 1;
|
||||
if ( $mode == '' and $hook == '' and $show == '') {
|
||||
$mode = 'letter';
|
||||
$hook = 'ALL';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $displayformat == -1 ) {
|
||||
if ( $displayformat == -1 ) {
|
||||
$displayformat = $glossary->displayformat;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $show ) {
|
||||
if ( $show ) {
|
||||
$mode = 'term';
|
||||
$hook = $show;
|
||||
$show = '';
|
||||
}
|
||||
}
|
||||
/// Processing standard security processes
|
||||
if ($course->id != SITEID) {
|
||||
if ($course->id != SITEID) {
|
||||
require_login($course->id);
|
||||
}
|
||||
if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', $context)) {
|
||||
}
|
||||
if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', $context)) {
|
||||
echo $OUTPUT->header();
|
||||
notice(get_string("activityiscurrentlyhidden"));
|
||||
}
|
||||
add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id&tab=$tab", $glossary->id, $cm->id);
|
||||
}
|
||||
add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id&tab=$tab", $glossary->id, $cm->id);
|
||||
|
||||
/// stablishing flag variables
|
||||
if ( $sortorder = strtolower($sortorder) ) {
|
||||
if ( $sortorder = strtolower($sortorder) ) {
|
||||
if ($sortorder != 'asc' and $sortorder != 'desc') {
|
||||
$sortorder = '';
|
||||
}
|
||||
}
|
||||
if ( $sortkey = strtoupper($sortkey) ) {
|
||||
}
|
||||
if ( $sortkey = strtoupper($sortkey) ) {
|
||||
if ($sortkey != 'CREATION' and
|
||||
$sortkey != 'UPDATE' and
|
||||
$sortkey != 'FIRSTNAME' and
|
||||
|
@ -134,43 +135,43 @@
|
|||
) {
|
||||
$sortkey = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch ( $mode = strtolower($mode) ) {
|
||||
case 'search': /// looking for terms containing certain word(s)
|
||||
switch ( $mode = strtolower($mode) ) {
|
||||
case 'search': /// looking for terms containing certain word(s)
|
||||
$tab = GLOSSARY_STANDARD_VIEW;
|
||||
|
||||
//Clean a bit the search string
|
||||
$hook = trim(strip_tags($hook));
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'entry': /// Looking for a certain entry id
|
||||
case 'entry': /// Looking for a certain entry id
|
||||
$tab = GLOSSARY_STANDARD_VIEW;
|
||||
if ( $dp = $DB->get_record("glossary_formats", array("name"=>$glossary->displayformat)) ) {
|
||||
$displayformat = $dp->popupformatname;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'cat': /// Looking for a certain cat
|
||||
case 'cat': /// Looking for a certain cat
|
||||
$tab = GLOSSARY_CATEGORY_VIEW;
|
||||
if ( $hook > 0 ) {
|
||||
$category = $DB->get_record("glossary_categories", array("id"=>$hook));
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'approval': /// Looking for entries waiting for approval
|
||||
case 'approval': /// Looking for entries waiting for approval
|
||||
$tab = GLOSSARY_APPROVAL_VIEW;
|
||||
if ( !$hook and !$sortkey and !$sortorder) {
|
||||
$hook = 'ALL';
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'term': /// Looking for entries that include certain term in its concept, definition or aliases
|
||||
case 'term': /// Looking for entries that include certain term in its concept, definition or aliases
|
||||
$tab = GLOSSARY_STANDARD_VIEW;
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'date':
|
||||
case 'date':
|
||||
$tab = GLOSSARY_DATE_VIEW;
|
||||
if ( !$sortkey ) {
|
||||
$sortkey = 'UPDATE';
|
||||
|
@ -178,9 +179,9 @@
|
|||
if ( !$sortorder ) {
|
||||
$sortorder = 'desc';
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'author': /// Looking for entries, browsed by author
|
||||
case 'author': /// Looking for entries, browsed by author
|
||||
$tab = GLOSSARY_AUTHOR_VIEW;
|
||||
if ( !$hook ) {
|
||||
$hook = 'ALL';
|
||||
|
@ -191,63 +192,63 @@
|
|||
if ( !$sortorder ) {
|
||||
$sortorder = 'asc';
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'letter': /// Looking for entries that begin with a certain letter, ALL or SPECIAL characters
|
||||
default:
|
||||
case 'letter': /// Looking for entries that begin with a certain letter, ALL or SPECIAL characters
|
||||
default:
|
||||
$tab = GLOSSARY_STANDARD_VIEW;
|
||||
if ( !$hook ) {
|
||||
$hook = 'ALL';
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
switch ( $tab ) {
|
||||
case GLOSSARY_IMPORT_VIEW:
|
||||
case GLOSSARY_EXPORT_VIEW:
|
||||
case GLOSSARY_APPROVAL_VIEW:
|
||||
switch ( $tab ) {
|
||||
case GLOSSARY_IMPORT_VIEW:
|
||||
case GLOSSARY_EXPORT_VIEW:
|
||||
case GLOSSARY_APPROVAL_VIEW:
|
||||
$showcommonelements = 0;
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
default:
|
||||
$showcommonelements = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/// Printing the heading
|
||||
$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");
|
||||
$strwaitingapproval = get_string('waitingapproval', 'glossary');
|
||||
$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");
|
||||
$strwaitingapproval = get_string('waitingapproval', 'glossary');
|
||||
|
||||
/// 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));
|
||||
$url = new moodle_url($CFG->wwwroot.'/mod/glossary/view.php', array('id'=>$cm->id));
|
||||
if (isset($mode)) {
|
||||
$PAGE->set_title(format_string($glossary->name));
|
||||
$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);
|
||||
}
|
||||
$PAGE->set_url($url);
|
||||
if ($tab == GLOSSARY_APPROVAL_VIEW) {
|
||||
}
|
||||
$PAGE->set_url($url);
|
||||
if ($tab == GLOSSARY_APPROVAL_VIEW) {
|
||||
require_capability('mod/glossary:approve', $context);
|
||||
$PAGE->navbar->add($strwaitingapproval);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($strwaitingapproval);
|
||||
} else { /// Print standard header
|
||||
} else { /// Print standard header
|
||||
echo $OUTPUT->header();
|
||||
}
|
||||
}
|
||||
|
||||
/// All this depends if whe have $showcommonelements
|
||||
if ($showcommonelements) {
|
||||
/// To calculate available options
|
||||
if ($showcommonelements) {
|
||||
/// To calculate available options
|
||||
$availableoptions = '';
|
||||
|
||||
/// Decide about to print the import link
|
||||
/// Decide about to print the import link
|
||||
if (has_capability('mod/glossary:import', $context)) {
|
||||
$availableoptions = '<span class="helplink">' .
|
||||
'<a href="' . $CFG->wwwroot . '/mod/glossary/import.php?id=' . $cm->id . '"' .
|
||||
|
@ -255,7 +256,7 @@
|
|||
get_string('importentries', 'glossary') . '</a>' .
|
||||
'</span>';
|
||||
}
|
||||
/// Decide about to print the export link
|
||||
/// Decide about to print the export link
|
||||
if (has_capability('mod/glossary:export', $context)) {
|
||||
if ($availableoptions) {
|
||||
$availableoptions .= ' / ';
|
||||
|
@ -268,7 +269,7 @@
|
|||
'</span>';
|
||||
}
|
||||
|
||||
/// Decide about to print the approval link
|
||||
/// Decide about to print the approval link
|
||||
if (has_capability('mod/glossary:approve', $context)) {
|
||||
/// Check we have pending entries
|
||||
if ($hiddenentries = $DB->count_records('glossary_entries', array('glossaryid'=>$glossary->id, 'approved'=>0))) {
|
||||
|
@ -284,12 +285,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
/// Start to print glossary controls
|
||||
/// Start to print glossary controls
|
||||
// print_box_start('glossarycontrol clearfix');
|
||||
echo '<div class="glossarycontrol" style="text-align: right">';
|
||||
echo $availableoptions;
|
||||
|
||||
/// If rss are activated at site and glossary level and this glossary has rss defined, show link
|
||||
/// 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) {
|
||||
|
||||
|
@ -306,7 +307,7 @@
|
|||
// print_box_end();
|
||||
}
|
||||
|
||||
/// The print icon
|
||||
/// The print icon
|
||||
if ( $showcommonelements and $mode != 'search') {
|
||||
if (has_capability('mod/glossary:manageentries', $context) or $glossary->allowprintview) {
|
||||
// print_box_start('printicon');
|
||||
|
@ -316,20 +317,20 @@
|
|||
// print_box_end();
|
||||
}
|
||||
}
|
||||
/// End glossary controls
|
||||
/// End glossary controls
|
||||
// print_box_end(); /// glossarycontrol
|
||||
echo '</div>';
|
||||
|
||||
// print_box(' ', 'clearer');
|
||||
}
|
||||
}
|
||||
|
||||
/// Info box
|
||||
if ($glossary->intro && $showcommonelements) {
|
||||
if ($glossary->intro && $showcommonelements) {
|
||||
echo $OUTPUT->box(format_module_intro('glossary', $glossary, $cm->id), 'generalbox', 'intro');
|
||||
}
|
||||
}
|
||||
|
||||
/// Search box
|
||||
if ($showcommonelements ) {
|
||||
if ($showcommonelements ) {
|
||||
echo '<form method="post" action="view.php">';
|
||||
|
||||
echo '<table class="boxaligncenter" width="70%" border="0">';
|
||||
|
@ -355,10 +356,10 @@
|
|||
echo '</form>';
|
||||
|
||||
echo '<br />';
|
||||
}
|
||||
}
|
||||
|
||||
/// Show the add entry button if allowed
|
||||
if (has_capability('mod/glossary:write', $context) && $showcommonelements ) {
|
||||
if (has_capability('mod/glossary:write', $context) && $showcommonelements ) {
|
||||
echo '<div class="singlebutton glossaryaddentry">';
|
||||
echo "<form id=\"newentryform\" method=\"get\" action=\"$CFG->wwwroot/mod/glossary/edit.php\">";
|
||||
echo '<div>';
|
||||
|
@ -367,21 +368,21 @@
|
|||
echo '</div>';
|
||||
echo '</form>';
|
||||
echo "</div>\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo '<br />';
|
||||
echo '<br />';
|
||||
|
||||
require("tabs.php");
|
||||
require("tabs.php");
|
||||
|
||||
require("sql.php");
|
||||
require("sql.php");
|
||||
|
||||
/// printing the entries
|
||||
$entriesshown = 0;
|
||||
$currentpivot = '';
|
||||
$ratingsmenuused = NULL;
|
||||
$paging = NULL;
|
||||
$entriesshown = 0;
|
||||
$currentpivot = '';
|
||||
$ratingsmenuused = NULL;
|
||||
$paging = NULL;
|
||||
|
||||
if ($allentries) {
|
||||
if ($allentries) {
|
||||
|
||||
//Decide if we must show the ALL link in the pagebar
|
||||
$specialtext = '';
|
||||
|
@ -486,13 +487,13 @@
|
|||
|
||||
$entriesshown++;
|
||||
}
|
||||
}
|
||||
if ( !$entriesshown ) {
|
||||
}
|
||||
if ( !$entriesshown ) {
|
||||
echo $OUTPUT->box(get_string("noentries","glossary"), "generalbox boxaligncenter boxwidthwide");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($ratingsmenuused) {
|
||||
if ($ratingsmenuused) {
|
||||
|
||||
echo "<div class=\"boxaligncenter\"><input type=\"submit\" value=\"".get_string("sendinratings", "glossary")."\" />";
|
||||
if ($glossary->scale < 0) {
|
||||
|
@ -501,27 +502,28 @@
|
|||
}
|
||||
}
|
||||
echo "</div>";
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($formsent)) {
|
||||
if (!empty($formsent)) {
|
||||
// close the form properly if used
|
||||
echo "</div>";
|
||||
echo "</form>";
|
||||
}
|
||||
}
|
||||
|
||||
if ( $paging ) {
|
||||
if ( $paging ) {
|
||||
echo '<hr />';
|
||||
echo '<div class="paging">';
|
||||
echo $paging;
|
||||
echo '</div>';
|
||||
}
|
||||
echo '<br />';
|
||||
glossary_print_tabbed_table_end();
|
||||
}
|
||||
echo '<br />';
|
||||
glossary_print_tabbed_table_end();
|
||||
|
||||
/// Finish the page
|
||||
echo $OUTPUT->footer();
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
/// Mark as viewed
|
||||
$completion=new completion_info($course);
|
||||
$completion->set_module_viewed($cm);
|
||||
$completion=new completion_info($course);
|
||||
$completion->set_module_viewed($cm);
|
||||
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue