2009-09-24 07:29:14 +00:00
|
|
|
<?php
|
2003-11-04 03:54:01 +00:00
|
|
|
|
2009-09-24 07:29:14 +00:00
|
|
|
require_once("../../config.php");
|
|
|
|
require_once("lib.php");
|
|
|
|
require_once("$CFG->dirroot/course/lib.php");
|
2014-02-20 10:43:08 +08:00
|
|
|
require_once("$CFG->dirroot/course/modlib.php");
|
2010-06-04 03:14:21 +00:00
|
|
|
require_once('import_form.php');
|
2003-11-04 03:54:01 +00:00
|
|
|
|
2009-09-24 07:29:14 +00:00
|
|
|
$id = required_param('id', PARAM_INT); // Course Module ID
|
2003-11-04 03:54:01 +00:00
|
|
|
|
2009-09-24 07:29:14 +00:00
|
|
|
$mode = optional_param('mode', 'letter', PARAM_ALPHA );
|
|
|
|
$hook = optional_param('hook', 'ALL', PARAM_ALPHANUM);
|
2003-11-04 03:54:01 +00:00
|
|
|
|
2010-01-16 15:39:56 +00:00
|
|
|
$url = new moodle_url('/mod/glossary/import.php', array('id'=>$id));
|
2009-09-24 07:29:14 +00:00
|
|
|
if ($mode !== 'letter') {
|
|
|
|
$url->param('mode', $mode);
|
|
|
|
}
|
|
|
|
if ($hook !== 'ALL') {
|
|
|
|
$url->param('hook', $hook);
|
|
|
|
}
|
|
|
|
$PAGE->set_url($url);
|
2009-08-10 04:59:55 +00:00
|
|
|
|
2009-09-24 07:29:14 +00:00
|
|
|
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
|
|
|
|
print_error('invalidcoursemodule');
|
|
|
|
}
|
2005-01-19 12:02:52 +00:00
|
|
|
|
2009-09-24 07:29:14 +00:00
|
|
|
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
|
|
|
print_error('coursemisconf');
|
|
|
|
}
|
2005-01-19 12:02:52 +00:00
|
|
|
|
2009-09-24 07:29:14 +00:00
|
|
|
if (! $glossary = $DB->get_record("glossary", array("id"=>$cm->instance))) {
|
|
|
|
print_error('invalidid', 'glossary');
|
|
|
|
}
|
2009-08-10 04:59:55 +00:00
|
|
|
|
2012-04-22 17:41:47 +02:00
|
|
|
require_login($course, false, $cm);
|
2003-11-04 03:54:01 +00:00
|
|
|
|
2012-07-27 13:25:24 +08:00
|
|
|
$context = context_module::instance($cm->id);
|
2009-09-24 07:29:14 +00:00
|
|
|
require_capability('mod/glossary:import', $context);
|
2003-11-04 03:54:01 +00:00
|
|
|
|
2009-09-24 07:29:14 +00:00
|
|
|
$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");
|
|
|
|
$strsearchindefinition = get_string("searchindefinition", "glossary");
|
|
|
|
$strsearch = get_string("search");
|
|
|
|
$strimportentries = get_string('importentriesfromxml', 'glossary');
|
|
|
|
|
|
|
|
$PAGE->navbar->add($strimportentries);
|
2014-02-05 14:47:23 +08:00
|
|
|
$PAGE->set_title($glossary->name);
|
2010-05-28 06:38:17 +00:00
|
|
|
$PAGE->set_heading($course->fullname);
|
2009-09-24 07:29:14 +00:00
|
|
|
|
|
|
|
echo $OUTPUT->header();
|
|
|
|
echo $OUTPUT->heading($strimportentries);
|
|
|
|
|
2010-06-04 03:14:21 +00:00
|
|
|
$form = new mod_glossary_import_form();
|
|
|
|
|
|
|
|
if ( !$data = $form->get_data() ) {
|
2009-09-24 07:29:14 +00:00
|
|
|
echo $OUTPUT->box_start('glossarydisplay generalbox');
|
2010-06-04 03:14:21 +00:00
|
|
|
// display upload form
|
2010-09-21 08:54:01 +00:00
|
|
|
$data = new stdClass();
|
2010-06-04 03:14:21 +00:00
|
|
|
$data->id = $id;
|
|
|
|
$form->set_data($data);
|
|
|
|
$form->display();
|
2009-09-24 07:29:14 +00:00
|
|
|
echo $OUTPUT->box_end();
|
|
|
|
echo $OUTPUT->footer();
|
|
|
|
exit;
|
|
|
|
}
|
Centralised file upload code, integration with clam AV, integration with some modules: assignment, exercise, forum, glossaryt, resource, scorm (more to come soon).
These patches are maintained in an publicly accessible Arch repository, see: http://lists.eduforge.org/cgi-bin/archzoom.cgi/arch-eduforge@catalyst.net.nz--2004-MIRROR/moodle--eduforge--1.3.3
Index of arch patches in this commit:
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-15
final touches to sears stuff until testing can begin, beginning of magical uploadey wrappery function goodness
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-18
Virus scanning on upload
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-19
made emacs use spaces instead of tabs and fixed lib/moodlelib.php where it was bad in the new functions; few wording changes, added in support for clamdscan
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-20
handlevirus.php = new script to handle output of clamscan (designed for cron clamscan), changes to strings for emailing out virus notifications, changes to moodlelib - slightly different notice reporting in handle_infected_file and new function for replacing file with message
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-21
refactor to filter out invalid lines in input to handlevirus
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-22
modified assignment to use hande_file_upload
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-25
bug fix for handle_file_upload
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-26
Small fix for non thinking brain doing something silly
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-35
small fix to switch order of items in drop down to allow sensible defaults
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-36
small changes to strings file
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-38
taken stuff out of moodlelib to put in upload class
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-39
new upload class -in a changeset by itself just in case - not quite finished
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-40
tweaks to upload class - clam_scan_file can now take a path as an argument, not just an entry from _FILES, there is better handling of failure and notification, more allowance for module writers to keep control in general. Also slightly nicer strings entries for a few things
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-41
upload class integration with assignment module, bug fix, slight tweak
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-42
small changes to uploadlib, integration with assessment and assignment
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-44
tweaks for assessment and assignment for uploading
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-48
integration with exercise module
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-49
integration of virus stuff with forum module
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-50
integration of upload class and glossary module
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-51
just in case glossary_move_attachments is ever used, we change the log entries before we move the files. also moved clam_log_upload out of the class
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-52
virus scanning for imports for glossary
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-53
relog entries when moving files attached to forum posts
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-54
resource module integration with virus scanning
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-55
scorm integration with upload/virus class
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-56
fix for handlevirus.php since upload class changes
Full logs:
Revision: moodle--eduforge--1.3.3--patch-15
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Wed Sep 1 17:28:13 NZST 2004
Standard-date: 2004-09-01 05:28:13 GMT
Modified-files: lang/en/moodle.php lib/moodlelib.php
mod/assessment/sears.php mod/assessment/upload.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-15
Summary: final touches to sears stuff until testing can begin, beginning of magical uploadey wrappery function goodness
Keywords:
Revision: moodle--eduforge--1.3.3--patch-18
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Thu Sep 2 15:49:54 NZST 2004
Standard-date: 2004-09-02 03:49:54 GMT
Modified-files: admin/config.html lang/en/moodle.php
lib/moodlelib.php mod/assessment/upload.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-18
Summary: Virus scanning on upload
Keywords:
Revision: moodle--eduforge--1.3.3--patch-19
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Thu Sep 2 17:06:14 NZST 2004
Standard-date: 2004-09-02 05:06:14 GMT
Modified-files: lang/en/moodle.php lib/moodlelib.php
mod/assessment/upload.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-19
Summary: made emacs use spaces instead of tabs and fixed lib/moodlelib.php where it was bad in the new functions; few wording changes, added in support for clamdscan
Keywords:
Revision: moodle--eduforge--1.3.3--patch-20
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Fri Sep 3 16:06:05 NZST 2004
Standard-date: 2004-09-03 04:06:05 GMT
New-files: admin/.arch-ids/handlevirus.php.id
admin/handlevirus.php
Modified-files: lang/en/moodle.php lib/moodlelib.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-20
Summary: handlevirus.php = new script to handle output of clamscan (designed for cron clamscan), changes to strings for emailing out virus notifications, changes to moodlelib - slightly different notice reporting in handle_infected_file and new function for replacing file with message
Keywords:
Revision: moodle--eduforge--1.3.3--patch-21
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 6 11:37:31 NZST 2004
Standard-date: 2004-09-05 23:37:31 GMT
Modified-files: admin/handlevirus.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-21
Summary: refactor to filter out invalid lines in input to handlevirus
Keywords:
Revision: moodle--eduforge--1.3.3--patch-22
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 6 13:07:48 NZST 2004
Standard-date: 2004-09-06 01:07:48 GMT
Modified-files: mod/assignment/upload.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-22
Summary: modified assignment to use hande_file_upload
Keywords:
Revision: moodle--eduforge--1.3.3--patch-25
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 6 16:32:11 NZST 2004
Standard-date: 2004-09-06 04:32:11 GMT
Modified-files: lib/moodlelib.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-25
Summary: bug fix for handle_file_upload
Keywords:
Revision: moodle--eduforge--1.3.3--patch-26
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 6 16:51:50 NZST 2004
Standard-date: 2004-09-06 04:51:50 GMT
Modified-files: lib/moodlelib.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-26
Summary: Small fix for non thinking brain doing something silly
Keywords:
Revision: moodle--eduforge--1.3.3--patch-35
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Fri Sep 10 10:09:53 NZST 2004
Standard-date: 2004-09-09 22:09:53 GMT
Modified-files: admin/config.html
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-35
Summary: small fix to switch order of items in drop down to allow sensible defaults
Keywords:
Revision: moodle--eduforge--1.3.3--patch-36
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Fri Sep 10 10:11:29 NZST 2004
Standard-date: 2004-09-09 22:11:29 GMT
Modified-files: lang/en/moodle.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-36
Summary: small changes to strings file
Keywords:
Revision: moodle--eduforge--1.3.3--patch-38
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Fri Sep 10 10:17:24 NZST 2004
Standard-date: 2004-09-09 22:17:24 GMT
Modified-files: lib/moodlelib.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-38
Summary: taken stuff out of moodlelib to put in upload class
Keywords:
Revision: moodle--eduforge--1.3.3--patch-39
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Fri Sep 10 10:21:21 NZST 2004
Standard-date: 2004-09-09 22:21:21 GMT
New-files: lib/.arch-ids/uploadlib.php.id lib/uploadlib.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-39
Summary: new upload class -in a changeset by itself just in case - not quite finished
Keywords:
Revision: moodle--eduforge--1.3.3--patch-40
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Fri Sep 10 11:58:24 NZST 2004
Standard-date: 2004-09-09 23:58:24 GMT
Modified-files: lang/en/moodle.php lib/uploadlib.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-40
Summary: tweaks to upload class - clam_scan_file can now take a path as an argument, not just an entry from _FILES, there is better handling of failure and notification, more allowance for module writers to keep control in general. Also slightly nicer strings entries for a few things
Keywords:
Revision: moodle--eduforge--1.3.3--patch-41
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Fri Sep 10 12:38:02 NZST 2004
Standard-date: 2004-09-10 00:38:02 GMT
Modified-files: lib/uploadlib.php mod/assignment/upload.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-41
Summary: upload class integration with assignment module, bug fix, slight tweak
Keywords:
Revision: moodle--eduforge--1.3.3--patch-42
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Fri Sep 10 15:30:20 NZST 2004
Standard-date: 2004-09-10 03:30:20 GMT
Modified-files: lib/uploadlib.php mod/assessment/upload.php
mod/assessment/view.php mod/assignment/upload.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-42
Summary: small changes to uploadlib, integration with assessment and assignment
Keywords:
Revision: moodle--eduforge--1.3.3--patch-44
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Fri Sep 10 16:54:40 NZST 2004
Standard-date: 2004-09-10 04:54:40 GMT
Modified-files: mod/assessment/lib.php
mod/assignment/lib.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-44
Summary: tweaks for assessment and assignment for uploading
Keywords:
Revision: moodle--eduforge--1.3.3--patch-48
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 13 09:57:03 NZST 2004
Standard-date: 2004-09-12 21:57:03 GMT
Modified-files: lang/en/moodle.php
mod/exercise/locallib.php mod/exercise/upload.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-48
Summary: integration with exercise module
Keywords:
Revision: moodle--eduforge--1.3.3--patch-49
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 13 11:35:46 NZST 2004
Standard-date: 2004-09-12 23:35:46 GMT
Modified-files: mod/forum/lib.php mod/forum/post.html
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-49
Summary: integration of virus stuff with forum module
Keywords:
Revision: moodle--eduforge--1.3.3--patch-50
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 13 14:00:29 NZST 2004
Standard-date: 2004-09-13 02:00:29 GMT
Modified-files: lang/en/glossary.php mod/glossary/edit.html
mod/glossary/edit.php mod/glossary/lib.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-50
Summary: integration of upload class and glossary module
Keywords:
Revision: moodle--eduforge--1.3.3--patch-51
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 13 15:13:02 NZST 2004
Standard-date: 2004-09-13 03:13:02 GMT
Modified-files: lib/uploadlib.php mod/glossary/lib.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-51
Summary: just in case glossary_move_attachments is ever used, we change the log entries before we move the files. also moved clam_log_upload out of the class
Keywords:
Revision: moodle--eduforge--1.3.3--patch-52
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 13 15:26:56 NZST 2004
Standard-date: 2004-09-13 03:26:56 GMT
Modified-files: mod/glossary/import.html
mod/glossary/import.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-52
Summary: virus scanning for imports for glossary
Keywords:
Revision: moodle--eduforge--1.3.3--patch-53
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 13 16:02:22 NZST 2004
Standard-date: 2004-09-13 04:02:22 GMT
Modified-files: mod/forum/lib.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-53
Summary: relog entries when moving files attached to forum posts
Keywords:
Revision: moodle--eduforge--1.3.3--patch-54
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 13 16:58:37 NZST 2004
Standard-date: 2004-09-13 04:58:37 GMT
Modified-files: mod/resource/coursefiles.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-54
Summary: resource module integration with virus scanning
Keywords:
Revision: moodle--eduforge--1.3.3--patch-55
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Tue Sep 14 16:15:47 NZST 2004
Standard-date: 2004-09-14 04:15:47 GMT
Modified-files: mod/scorm/coursefiles.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-55
Summary: scorm integration with upload/virus class
Keywords:
Revision: moodle--eduforge--1.3.3--patch-56
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Wed Sep 15 10:33:23 NZST 2004
Standard-date: 2004-09-14 22:33:23 GMT
Modified-files: admin/handlevirus.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-56
Summary: fix for handlevirus.php since upload class changes
Keywords:
2004-09-14 22:58:13 +00:00
|
|
|
|
2010-06-04 03:14:21 +00:00
|
|
|
$result = $form->get_file_content('file');
|
Centralised file upload code, integration with clam AV, integration with some modules: assignment, exercise, forum, glossaryt, resource, scorm (more to come soon).
These patches are maintained in an publicly accessible Arch repository, see: http://lists.eduforge.org/cgi-bin/archzoom.cgi/arch-eduforge@catalyst.net.nz--2004-MIRROR/moodle--eduforge--1.3.3
Index of arch patches in this commit:
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-15
final touches to sears stuff until testing can begin, beginning of magical uploadey wrappery function goodness
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-18
Virus scanning on upload
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-19
made emacs use spaces instead of tabs and fixed lib/moodlelib.php where it was bad in the new functions; few wording changes, added in support for clamdscan
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-20
handlevirus.php = new script to handle output of clamscan (designed for cron clamscan), changes to strings for emailing out virus notifications, changes to moodlelib - slightly different notice reporting in handle_infected_file and new function for replacing file with message
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-21
refactor to filter out invalid lines in input to handlevirus
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-22
modified assignment to use hande_file_upload
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-25
bug fix for handle_file_upload
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-26
Small fix for non thinking brain doing something silly
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-35
small fix to switch order of items in drop down to allow sensible defaults
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-36
small changes to strings file
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-38
taken stuff out of moodlelib to put in upload class
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-39
new upload class -in a changeset by itself just in case - not quite finished
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-40
tweaks to upload class - clam_scan_file can now take a path as an argument, not just an entry from _FILES, there is better handling of failure and notification, more allowance for module writers to keep control in general. Also slightly nicer strings entries for a few things
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-41
upload class integration with assignment module, bug fix, slight tweak
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-42
small changes to uploadlib, integration with assessment and assignment
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-44
tweaks for assessment and assignment for uploading
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-48
integration with exercise module
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-49
integration of virus stuff with forum module
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-50
integration of upload class and glossary module
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-51
just in case glossary_move_attachments is ever used, we change the log entries before we move the files. also moved clam_log_upload out of the class
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-52
virus scanning for imports for glossary
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-53
relog entries when moving files attached to forum posts
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-54
resource module integration with virus scanning
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-55
scorm integration with upload/virus class
arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-56
fix for handlevirus.php since upload class changes
Full logs:
Revision: moodle--eduforge--1.3.3--patch-15
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Wed Sep 1 17:28:13 NZST 2004
Standard-date: 2004-09-01 05:28:13 GMT
Modified-files: lang/en/moodle.php lib/moodlelib.php
mod/assessment/sears.php mod/assessment/upload.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-15
Summary: final touches to sears stuff until testing can begin, beginning of magical uploadey wrappery function goodness
Keywords:
Revision: moodle--eduforge--1.3.3--patch-18
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Thu Sep 2 15:49:54 NZST 2004
Standard-date: 2004-09-02 03:49:54 GMT
Modified-files: admin/config.html lang/en/moodle.php
lib/moodlelib.php mod/assessment/upload.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-18
Summary: Virus scanning on upload
Keywords:
Revision: moodle--eduforge--1.3.3--patch-19
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Thu Sep 2 17:06:14 NZST 2004
Standard-date: 2004-09-02 05:06:14 GMT
Modified-files: lang/en/moodle.php lib/moodlelib.php
mod/assessment/upload.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-19
Summary: made emacs use spaces instead of tabs and fixed lib/moodlelib.php where it was bad in the new functions; few wording changes, added in support for clamdscan
Keywords:
Revision: moodle--eduforge--1.3.3--patch-20
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Fri Sep 3 16:06:05 NZST 2004
Standard-date: 2004-09-03 04:06:05 GMT
New-files: admin/.arch-ids/handlevirus.php.id
admin/handlevirus.php
Modified-files: lang/en/moodle.php lib/moodlelib.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-20
Summary: handlevirus.php = new script to handle output of clamscan (designed for cron clamscan), changes to strings for emailing out virus notifications, changes to moodlelib - slightly different notice reporting in handle_infected_file and new function for replacing file with message
Keywords:
Revision: moodle--eduforge--1.3.3--patch-21
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 6 11:37:31 NZST 2004
Standard-date: 2004-09-05 23:37:31 GMT
Modified-files: admin/handlevirus.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-21
Summary: refactor to filter out invalid lines in input to handlevirus
Keywords:
Revision: moodle--eduforge--1.3.3--patch-22
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 6 13:07:48 NZST 2004
Standard-date: 2004-09-06 01:07:48 GMT
Modified-files: mod/assignment/upload.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-22
Summary: modified assignment to use hande_file_upload
Keywords:
Revision: moodle--eduforge--1.3.3--patch-25
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 6 16:32:11 NZST 2004
Standard-date: 2004-09-06 04:32:11 GMT
Modified-files: lib/moodlelib.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-25
Summary: bug fix for handle_file_upload
Keywords:
Revision: moodle--eduforge--1.3.3--patch-26
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 6 16:51:50 NZST 2004
Standard-date: 2004-09-06 04:51:50 GMT
Modified-files: lib/moodlelib.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-26
Summary: Small fix for non thinking brain doing something silly
Keywords:
Revision: moodle--eduforge--1.3.3--patch-35
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Fri Sep 10 10:09:53 NZST 2004
Standard-date: 2004-09-09 22:09:53 GMT
Modified-files: admin/config.html
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-35
Summary: small fix to switch order of items in drop down to allow sensible defaults
Keywords:
Revision: moodle--eduforge--1.3.3--patch-36
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Fri Sep 10 10:11:29 NZST 2004
Standard-date: 2004-09-09 22:11:29 GMT
Modified-files: lang/en/moodle.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-36
Summary: small changes to strings file
Keywords:
Revision: moodle--eduforge--1.3.3--patch-38
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Fri Sep 10 10:17:24 NZST 2004
Standard-date: 2004-09-09 22:17:24 GMT
Modified-files: lib/moodlelib.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-38
Summary: taken stuff out of moodlelib to put in upload class
Keywords:
Revision: moodle--eduforge--1.3.3--patch-39
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Fri Sep 10 10:21:21 NZST 2004
Standard-date: 2004-09-09 22:21:21 GMT
New-files: lib/.arch-ids/uploadlib.php.id lib/uploadlib.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-39
Summary: new upload class -in a changeset by itself just in case - not quite finished
Keywords:
Revision: moodle--eduforge--1.3.3--patch-40
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Fri Sep 10 11:58:24 NZST 2004
Standard-date: 2004-09-09 23:58:24 GMT
Modified-files: lang/en/moodle.php lib/uploadlib.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-40
Summary: tweaks to upload class - clam_scan_file can now take a path as an argument, not just an entry from _FILES, there is better handling of failure and notification, more allowance for module writers to keep control in general. Also slightly nicer strings entries for a few things
Keywords:
Revision: moodle--eduforge--1.3.3--patch-41
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Fri Sep 10 12:38:02 NZST 2004
Standard-date: 2004-09-10 00:38:02 GMT
Modified-files: lib/uploadlib.php mod/assignment/upload.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-41
Summary: upload class integration with assignment module, bug fix, slight tweak
Keywords:
Revision: moodle--eduforge--1.3.3--patch-42
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Fri Sep 10 15:30:20 NZST 2004
Standard-date: 2004-09-10 03:30:20 GMT
Modified-files: lib/uploadlib.php mod/assessment/upload.php
mod/assessment/view.php mod/assignment/upload.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-42
Summary: small changes to uploadlib, integration with assessment and assignment
Keywords:
Revision: moodle--eduforge--1.3.3--patch-44
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Fri Sep 10 16:54:40 NZST 2004
Standard-date: 2004-09-10 04:54:40 GMT
Modified-files: mod/assessment/lib.php
mod/assignment/lib.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-44
Summary: tweaks for assessment and assignment for uploading
Keywords:
Revision: moodle--eduforge--1.3.3--patch-48
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 13 09:57:03 NZST 2004
Standard-date: 2004-09-12 21:57:03 GMT
Modified-files: lang/en/moodle.php
mod/exercise/locallib.php mod/exercise/upload.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-48
Summary: integration with exercise module
Keywords:
Revision: moodle--eduforge--1.3.3--patch-49
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 13 11:35:46 NZST 2004
Standard-date: 2004-09-12 23:35:46 GMT
Modified-files: mod/forum/lib.php mod/forum/post.html
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-49
Summary: integration of virus stuff with forum module
Keywords:
Revision: moodle--eduforge--1.3.3--patch-50
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 13 14:00:29 NZST 2004
Standard-date: 2004-09-13 02:00:29 GMT
Modified-files: lang/en/glossary.php mod/glossary/edit.html
mod/glossary/edit.php mod/glossary/lib.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-50
Summary: integration of upload class and glossary module
Keywords:
Revision: moodle--eduforge--1.3.3--patch-51
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 13 15:13:02 NZST 2004
Standard-date: 2004-09-13 03:13:02 GMT
Modified-files: lib/uploadlib.php mod/glossary/lib.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-51
Summary: just in case glossary_move_attachments is ever used, we change the log entries before we move the files. also moved clam_log_upload out of the class
Keywords:
Revision: moodle--eduforge--1.3.3--patch-52
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 13 15:26:56 NZST 2004
Standard-date: 2004-09-13 03:26:56 GMT
Modified-files: mod/glossary/import.html
mod/glossary/import.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-52
Summary: virus scanning for imports for glossary
Keywords:
Revision: moodle--eduforge--1.3.3--patch-53
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 13 16:02:22 NZST 2004
Standard-date: 2004-09-13 04:02:22 GMT
Modified-files: mod/forum/lib.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-53
Summary: relog entries when moving files attached to forum posts
Keywords:
Revision: moodle--eduforge--1.3.3--patch-54
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Mon Sep 13 16:58:37 NZST 2004
Standard-date: 2004-09-13 04:58:37 GMT
Modified-files: mod/resource/coursefiles.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-54
Summary: resource module integration with virus scanning
Keywords:
Revision: moodle--eduforge--1.3.3--patch-55
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Tue Sep 14 16:15:47 NZST 2004
Standard-date: 2004-09-14 04:15:47 GMT
Modified-files: mod/scorm/coursefiles.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-55
Summary: scorm integration with upload/virus class
Keywords:
Revision: moodle--eduforge--1.3.3--patch-56
Archive: arch-eduforge@catalyst.net.nz--2004
Creator: Penny Leach <penny@catalyst.net.nz>
Date: Wed Sep 15 10:33:23 NZST 2004
Standard-date: 2004-09-14 22:33:23 GMT
Modified-files: admin/handlevirus.php
New-patches: arch-eduforge@catalyst.net.nz--2004/moodle--eduforge--1.3.3--patch-56
Summary: fix for handlevirus.php since upload class changes
Keywords:
2004-09-14 22:58:13 +00:00
|
|
|
|
2010-06-04 03:14:21 +00:00
|
|
|
if (empty($result)) {
|
2009-09-24 07:29:14 +00:00
|
|
|
echo $OUTPUT->box_start('glossarydisplay generalbox');
|
|
|
|
echo $OUTPUT->continue_button('import.php?id='.$id);
|
|
|
|
echo $OUTPUT->box_end();
|
|
|
|
echo $OUTPUT->footer();
|
|
|
|
die();
|
|
|
|
}
|
2004-07-01 20:07:43 +00:00
|
|
|
|
2015-03-20 15:02:32 +08:00
|
|
|
// Large exports are likely to take their time and memory.
|
|
|
|
core_php_time_limit::raise();
|
|
|
|
raise_memory_limit(MEMORY_EXTRA);
|
|
|
|
|
2010-06-04 03:14:21 +00:00
|
|
|
if ($xml = glossary_read_imported_file($result)) {
|
2009-09-24 07:29:14 +00:00
|
|
|
$importedentries = 0;
|
|
|
|
$importedcats = 0;
|
|
|
|
$entriesrejected = 0;
|
|
|
|
$rejections = '';
|
2015-03-13 17:44:49 +08:00
|
|
|
$glossarycontext = $context;
|
2010-06-04 03:14:21 +00:00
|
|
|
|
|
|
|
if ($data->dest == 'newglossary') {
|
2009-09-24 07:29:14 +00:00
|
|
|
// If the user chose to create a new glossary
|
|
|
|
$xmlglossary = $xml['GLOSSARY']['#']['INFO'][0]['#'];
|
|
|
|
|
|
|
|
if ( $xmlglossary['NAME'][0]['#'] ) {
|
2012-06-19 13:57:11 +02:00
|
|
|
$glossary = new stdClass();
|
2014-02-20 10:43:08 +08:00
|
|
|
$glossary->modulename = 'glossary';
|
|
|
|
$glossary->module = $cm->module;
|
2009-09-24 07:29:14 +00:00
|
|
|
$glossary->name = ($xmlglossary['NAME'][0]['#']);
|
|
|
|
$glossary->globalglossary = ($xmlglossary['GLOBALGLOSSARY'][0]['#']);
|
|
|
|
$glossary->intro = ($xmlglossary['INTRO'][0]['#']);
|
2010-07-18 08:52:21 +00:00
|
|
|
$glossary->introformat = isset($xmlglossary['INTROFORMAT'][0]['#']) ? $xmlglossary['INTROFORMAT'][0]['#'] : FORMAT_MOODLE;
|
2009-09-24 07:29:14 +00:00
|
|
|
$glossary->showspecial = ($xmlglossary['SHOWSPECIAL'][0]['#']);
|
|
|
|
$glossary->showalphabet = ($xmlglossary['SHOWALPHABET'][0]['#']);
|
|
|
|
$glossary->showall = ($xmlglossary['SHOWALL'][0]['#']);
|
2014-02-20 10:43:08 +08:00
|
|
|
$glossary->cmidnumber = null;
|
2009-09-24 07:29:14 +00:00
|
|
|
|
|
|
|
// Setting the default values if no values were passed
|
|
|
|
if ( isset($xmlglossary['ENTBYPAGE'][0]['#']) ) {
|
|
|
|
$glossary->entbypage = ($xmlglossary['ENTBYPAGE'][0]['#']);
|
|
|
|
} else {
|
|
|
|
$glossary->entbypage = $CFG->glossary_entbypage;
|
|
|
|
}
|
|
|
|
if ( isset($xmlglossary['ALLOWDUPLICATEDENTRIES'][0]['#']) ) {
|
|
|
|
$glossary->allowduplicatedentries = ($xmlglossary['ALLOWDUPLICATEDENTRIES'][0]['#']);
|
|
|
|
} else {
|
|
|
|
$glossary->allowduplicatedentries = $CFG->glossary_dupentries;
|
|
|
|
}
|
|
|
|
if ( isset($xmlglossary['DISPLAYFORMAT'][0]['#']) ) {
|
|
|
|
$glossary->displayformat = ($xmlglossary['DISPLAYFORMAT'][0]['#']);
|
|
|
|
} else {
|
|
|
|
$glossary->displayformat = 2;
|
|
|
|
}
|
|
|
|
if ( isset($xmlglossary['ALLOWCOMMENTS'][0]['#']) ) {
|
|
|
|
$glossary->allowcomments = ($xmlglossary['ALLOWCOMMENTS'][0]['#']);
|
|
|
|
} else {
|
|
|
|
$glossary->allowcomments = $CFG->glossary_allowcomments;
|
|
|
|
}
|
|
|
|
if ( isset($xmlglossary['USEDYNALINK'][0]['#']) ) {
|
|
|
|
$glossary->usedynalink = ($xmlglossary['USEDYNALINK'][0]['#']);
|
|
|
|
} else {
|
|
|
|
$glossary->usedynalink = $CFG->glossary_linkentries;
|
|
|
|
}
|
|
|
|
if ( isset($xmlglossary['DEFAULTAPPROVAL'][0]['#']) ) {
|
|
|
|
$glossary->defaultapproval = ($xmlglossary['DEFAULTAPPROVAL'][0]['#']);
|
|
|
|
} else {
|
|
|
|
$glossary->defaultapproval = $CFG->glossary_defaultapproval;
|
|
|
|
}
|
2004-07-01 20:07:43 +00:00
|
|
|
|
2014-02-20 10:43:08 +08:00
|
|
|
// These fields were not included in export, assume zero.
|
|
|
|
$glossary->assessed = 0;
|
2014-03-21 11:34:15 +00:00
|
|
|
$glossary->availability = null;
|
2014-02-20 10:43:08 +08:00
|
|
|
|
2018-04-11 16:39:04 +08:00
|
|
|
// Check if we're creating the new glossary on the front page or inside a course.
|
|
|
|
if ($cm->course == SITEID) {
|
|
|
|
// On the front page, activities are in section 1.
|
|
|
|
$glossary->section = 1;
|
|
|
|
} else {
|
|
|
|
// Inside a course, add to the general section (0).
|
|
|
|
$glossary->section = 0;
|
|
|
|
}
|
|
|
|
// New glossary is always visible.
|
2014-02-20 10:43:08 +08:00
|
|
|
$glossary->visible = 1;
|
2017-02-03 09:40:46 +08:00
|
|
|
$glossary->visibleoncoursepage = 1;
|
2014-02-20 10:43:08 +08:00
|
|
|
|
2009-09-24 07:29:14 +00:00
|
|
|
// Include new glossary and return the new ID
|
2014-02-20 10:43:08 +08:00
|
|
|
if ( !($glossary = add_moduleinfo($glossary, $course)) ) {
|
2009-09-24 07:29:14 +00:00
|
|
|
echo $OUTPUT->notification("Error while trying to create the new glossary.");
|
|
|
|
glossary_print_tabbed_table_end();
|
|
|
|
echo $OUTPUT->footer();
|
|
|
|
exit;
|
|
|
|
} else {
|
2015-03-13 17:44:49 +08:00
|
|
|
$glossarycontext = context_module::instance($glossary->coursemodule);
|
|
|
|
glossary_xml_import_files($xmlglossary, 'INTROFILES', $glossarycontext->id, 'intro', 0);
|
2009-09-24 07:29:14 +00:00
|
|
|
echo $OUTPUT->box(get_string("newglossarycreated","glossary"),'generalbox boxaligncenter boxwidthnormal');
|
2003-11-04 03:54:01 +00:00
|
|
|
}
|
2009-09-24 07:29:14 +00:00
|
|
|
} else {
|
|
|
|
echo $OUTPUT->notification("Error while trying to create the new glossary.");
|
|
|
|
echo $OUTPUT->footer();
|
|
|
|
exit;
|
2003-11-04 03:54:01 +00:00
|
|
|
}
|
2009-09-24 07:29:14 +00:00
|
|
|
}
|
2003-11-04 03:54:01 +00:00
|
|
|
|
2009-09-24 07:29:14 +00:00
|
|
|
$xmlentries = $xml['GLOSSARY']['#']['INFO'][0]['#']['ENTRIES'][0]['#']['ENTRY'];
|
2018-04-05 12:16:28 -05:00
|
|
|
$sizeofxmlentries = is_array($xmlentries) ? count($xmlentries) : 0;
|
2010-12-10 17:13:43 +08:00
|
|
|
for($i = 0; $i < $sizeofxmlentries; $i++) {
|
2009-09-24 07:29:14 +00:00
|
|
|
// Inserting the entries
|
|
|
|
$xmlentry = $xmlentries[$i];
|
2012-06-19 13:57:11 +02:00
|
|
|
$newentry = new stdClass();
|
2009-09-24 07:29:14 +00:00
|
|
|
$newentry->concept = trim($xmlentry['#']['CONCEPT'][0]['#']);
|
2016-08-25 17:04:11 +01:00
|
|
|
$definition = $xmlentry['#']['DEFINITION'][0]['#'];
|
|
|
|
if (!is_string($definition)) {
|
|
|
|
print_error('errorparsingxml', 'glossary');
|
|
|
|
}
|
|
|
|
$newentry->definition = trusttext_strip($definition);
|
2009-09-24 07:29:14 +00:00
|
|
|
if ( isset($xmlentry['#']['CASESENSITIVE'][0]['#']) ) {
|
|
|
|
$newentry->casesensitive = $xmlentry['#']['CASESENSITIVE'][0]['#'];
|
|
|
|
} else {
|
|
|
|
$newentry->casesensitive = $CFG->glossary_casesensitive;
|
|
|
|
}
|
2003-11-04 03:54:01 +00:00
|
|
|
|
2009-09-24 07:29:14 +00:00
|
|
|
$permissiongranted = 1;
|
|
|
|
if ( $newentry->concept and $newentry->definition ) {
|
|
|
|
if ( !$glossary->allowduplicatedentries ) {
|
|
|
|
// checking if the entry is valid (checking if it is duplicated when should not be)
|
|
|
|
if ( $newentry->casesensitive ) {
|
2010-12-09 22:50:23 +00:00
|
|
|
$dupentry = $DB->record_exists_select('glossary_entries',
|
|
|
|
'glossaryid = :glossaryid AND concept = :concept', array(
|
|
|
|
'glossaryid' => $glossary->id,
|
|
|
|
'concept' => $newentry->concept));
|
2003-11-04 03:54:01 +00:00
|
|
|
} else {
|
2010-12-09 22:50:23 +00:00
|
|
|
$dupentry = $DB->record_exists_select('glossary_entries',
|
|
|
|
'glossaryid = :glossaryid AND LOWER(concept) = :concept', array(
|
|
|
|
'glossaryid' => $glossary->id,
|
2013-08-06 20:58:28 +02:00
|
|
|
'concept' => core_text::strtolower($newentry->concept)));
|
2003-11-04 03:54:01 +00:00
|
|
|
}
|
2009-09-24 07:29:14 +00:00
|
|
|
if ($dupentry) {
|
|
|
|
$permissiongranted = 0;
|
2003-11-04 03:54:01 +00:00
|
|
|
}
|
2009-09-24 07:29:14 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$permissiongranted = 0;
|
2010-07-18 08:52:21 +00:00
|
|
|
}
|
2009-09-24 07:29:14 +00:00
|
|
|
if ($permissiongranted) {
|
|
|
|
$newentry->glossaryid = $glossary->id;
|
|
|
|
$newentry->sourceglossaryid = 0;
|
|
|
|
$newentry->approved = 1;
|
|
|
|
$newentry->userid = $USER->id;
|
|
|
|
$newentry->teacherentry = 1;
|
2010-07-18 08:52:21 +00:00
|
|
|
$newentry->definitionformat = $xmlentry['#']['FORMAT'][0]['#'];
|
2009-09-24 07:29:14 +00:00
|
|
|
$newentry->timecreated = time();
|
|
|
|
$newentry->timemodified = time();
|
|
|
|
|
|
|
|
// Setting the default values if no values were passed
|
|
|
|
if ( isset($xmlentry['#']['USEDYNALINK'][0]['#']) ) {
|
|
|
|
$newentry->usedynalink = $xmlentry['#']['USEDYNALINK'][0]['#'];
|
|
|
|
} else {
|
|
|
|
$newentry->usedynalink = $CFG->glossary_linkentries;
|
|
|
|
}
|
|
|
|
if ( isset($xmlentry['#']['FULLMATCH'][0]['#']) ) {
|
|
|
|
$newentry->fullmatch = $xmlentry['#']['FULLMATCH'][0]['#'];
|
|
|
|
} else {
|
|
|
|
$newentry->fullmatch = $CFG->glossary_fullmatch;
|
|
|
|
}
|
2003-11-04 03:54:01 +00:00
|
|
|
|
2010-09-03 17:47:41 +00:00
|
|
|
$newentry->id = $DB->insert_record("glossary_entries",$newentry);
|
|
|
|
$importedentries++;
|
|
|
|
|
|
|
|
$xmlaliases = @$xmlentry['#']['ALIASES'][0]['#']['ALIAS']; // ignore missing ALIASES
|
2018-04-05 12:16:28 -05:00
|
|
|
$sizeofxmlaliases = is_array($xmlaliases) ? count($xmlaliases) : 0;
|
2010-12-10 17:13:43 +08:00
|
|
|
for($k = 0; $k < $sizeofxmlaliases; $k++) {
|
2010-09-03 17:47:41 +00:00
|
|
|
/// Importing aliases
|
|
|
|
$xmlalias = $xmlaliases[$k];
|
|
|
|
$aliasname = $xmlalias['#']['NAME'][0]['#'];
|
|
|
|
|
|
|
|
if (!empty($aliasname)) {
|
2010-09-21 08:37:36 +00:00
|
|
|
$newalias = new stdClass();
|
2010-09-03 17:47:41 +00:00
|
|
|
$newalias->entryid = $newentry->id;
|
|
|
|
$newalias->alias = trim($aliasname);
|
|
|
|
$newalias->id = $DB->insert_record("glossary_alias",$newalias);
|
2009-09-24 07:29:14 +00:00
|
|
|
}
|
2010-09-03 17:47:41 +00:00
|
|
|
}
|
2003-11-07 15:58:29 +00:00
|
|
|
|
2010-09-03 17:47:41 +00:00
|
|
|
if (!empty($data->catsincl)) {
|
|
|
|
// If the categories must be imported...
|
|
|
|
$xmlcats = @$xmlentry['#']['CATEGORIES'][0]['#']['CATEGORY']; // ignore missing CATEGORIES
|
2018-04-05 12:16:28 -05:00
|
|
|
$sizeofxmlcats = is_array($xmlcats) ? count($xmlcats) : 0;
|
2010-12-10 17:13:43 +08:00
|
|
|
for($k = 0; $k < $sizeofxmlcats; $k++) {
|
2010-09-03 17:47:41 +00:00
|
|
|
$xmlcat = $xmlcats[$k];
|
|
|
|
|
2010-09-21 08:37:36 +00:00
|
|
|
$newcat = new stdClass();
|
2010-09-03 17:47:41 +00:00
|
|
|
$newcat->name = $xmlcat['#']['NAME'][0]['#'];
|
|
|
|
$newcat->usedynalink = $xmlcat['#']['USEDYNALINK'][0]['#'];
|
|
|
|
if ( !$category = $DB->get_record("glossary_categories", array("glossaryid"=>$glossary->id,"name"=>$newcat->name))) {
|
|
|
|
// Create the category if it does not exist
|
2010-09-21 08:37:36 +00:00
|
|
|
$category = new stdClass();
|
2010-09-03 17:47:41 +00:00
|
|
|
$category->name = $newcat->name;
|
|
|
|
$category->glossaryid = $glossary->id;
|
|
|
|
$category->id = $DB->insert_record("glossary_categories",$category);
|
|
|
|
$importedcats++;
|
|
|
|
}
|
|
|
|
if ( $category ) {
|
|
|
|
// inserting the new relation
|
2010-09-21 08:37:36 +00:00
|
|
|
$entrycat = new stdClass();
|
2010-09-03 17:47:41 +00:00
|
|
|
$entrycat->entryid = $newentry->id;
|
|
|
|
$entrycat->categoryid = $category->id;
|
|
|
|
$DB->insert_record("glossary_entries_categories",$entrycat);
|
2003-11-04 03:54:01 +00:00
|
|
|
}
|
|
|
|
}
|
2009-09-24 07:29:14 +00:00
|
|
|
}
|
2015-03-13 17:44:49 +08:00
|
|
|
|
|
|
|
// Import files embedded in the entry text.
|
|
|
|
glossary_xml_import_files($xmlentry['#'], 'ENTRYFILES', $glossarycontext->id, 'entry', $newentry->id);
|
|
|
|
|
|
|
|
// Import files attached to the entry.
|
|
|
|
if (glossary_xml_import_files($xmlentry['#'], 'ATTACHMENTFILES', $glossarycontext->id, 'attachment', $newentry->id)) {
|
|
|
|
$DB->update_record("glossary_entries", array('id' => $newentry->id, 'attachment' => '1'));
|
|
|
|
}
|
|
|
|
|
2018-04-04 19:26:05 -05:00
|
|
|
// Import tags associated with the entry.
|
|
|
|
if (core_tag_tag::is_enabled('mod_glossary', 'glossary_entries')) {
|
|
|
|
$xmltags = @$xmlentry['#']['TAGS'][0]['#']['TAG']; // Ignore missing TAGS.
|
2018-04-05 12:16:28 -05:00
|
|
|
$sizeofxmltags = is_array($xmltags) ? count($xmltags) : 0;
|
2018-04-04 19:26:05 -05:00
|
|
|
for ($k = 0; $k < $sizeofxmltags; $k++) {
|
|
|
|
// Importing tags.
|
|
|
|
$tag = $xmltags[$k]['#'];
|
|
|
|
if (!empty($tag)) {
|
|
|
|
core_tag_tag::add_item_tag('mod_glossary', 'glossary_entries', $newentry->id, $glossarycontext, $tag);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-09-24 07:29:14 +00:00
|
|
|
} else {
|
|
|
|
$entriesrejected++;
|
|
|
|
if ( $newentry->concept and $newentry->definition ) {
|
|
|
|
// add to exception report (duplicated entry))
|
|
|
|
$rejections .= "<tr><td>$newentry->concept</td>" .
|
|
|
|
"<td>" . get_string("duplicateentry","glossary"). "</td></tr>";
|
|
|
|
} else {
|
|
|
|
// add to exception report (no concept or definition found))
|
|
|
|
$rejections .= "<tr><td>---</td>" .
|
|
|
|
"<td>" . get_string("noconceptfound","glossary"). "</td></tr>";
|
2003-11-04 03:54:01 +00:00
|
|
|
}
|
|
|
|
}
|
2009-09-24 07:29:14 +00:00
|
|
|
}
|
2014-03-28 15:02:46 +08:00
|
|
|
|
|
|
|
// Reset caches.
|
|
|
|
\mod_glossary\local\concept_cache::reset_glossary($glossary);
|
|
|
|
|
2009-09-24 07:29:14 +00:00
|
|
|
// processed entries
|
|
|
|
echo $OUTPUT->box_start('glossarydisplay generalbox');
|
|
|
|
echo '<table class="glossaryimportexport">';
|
|
|
|
echo '<tr>';
|
|
|
|
echo '<td width="50%" align="right">';
|
|
|
|
echo get_string("totalentries","glossary");
|
|
|
|
echo ':</td>';
|
|
|
|
echo '<td width="50%" align="left">';
|
|
|
|
echo $importedentries + $entriesrejected;
|
|
|
|
echo '</td>';
|
|
|
|
echo '</tr>';
|
|
|
|
echo '<tr>';
|
|
|
|
echo '<td width="50%" align="right">';
|
|
|
|
echo get_string("importedentries","glossary");
|
|
|
|
echo ':</td>';
|
|
|
|
echo '<td width="50%" align="left">';
|
|
|
|
echo $importedentries;
|
|
|
|
if ( $entriesrejected ) {
|
|
|
|
echo ' <small>(' . get_string("rejectedentries","glossary") . ": $entriesrejected)</small>";
|
|
|
|
}
|
|
|
|
echo '</td>';
|
|
|
|
echo '</tr>';
|
2010-06-04 03:14:21 +00:00
|
|
|
if (!empty($data->catsincl)) {
|
2004-07-01 20:07:43 +00:00
|
|
|
echo '<tr>';
|
2004-09-12 16:24:41 +00:00
|
|
|
echo '<td width="50%" align="right">';
|
2009-09-24 07:29:14 +00:00
|
|
|
echo get_string("importedcategories","glossary");
|
2004-07-01 20:07:43 +00:00
|
|
|
echo ':</td>';
|
2009-09-24 07:29:14 +00:00
|
|
|
echo '<td width="50%">';
|
|
|
|
echo $importedcats;
|
2004-07-01 20:07:43 +00:00
|
|
|
echo '</td>';
|
|
|
|
echo '</tr>';
|
2009-09-24 07:29:14 +00:00
|
|
|
}
|
|
|
|
echo '</table><hr />';
|
2003-11-04 03:54:01 +00:00
|
|
|
|
2009-09-24 07:29:14 +00:00
|
|
|
// rejected entries
|
|
|
|
if ($rejections) {
|
2010-06-02 07:30:13 +00:00
|
|
|
echo $OUTPUT->heading(get_string("rejectionrpt","glossary"), 4);
|
2009-09-24 07:29:14 +00:00
|
|
|
echo '<table class="glossaryimportexport">';
|
|
|
|
echo $rejections;
|
|
|
|
echo '</table><hr />';
|
|
|
|
}
|
|
|
|
/// Print continue button, based on results
|
|
|
|
if ($importedentries) {
|
|
|
|
echo $OUTPUT->continue_button('view.php?id='.$id);
|
2003-11-04 03:54:01 +00:00
|
|
|
} else {
|
2009-09-24 07:29:14 +00:00
|
|
|
echo $OUTPUT->continue_button('import.php?id='.$id);
|
2003-11-04 03:54:01 +00:00
|
|
|
}
|
2009-09-24 07:29:14 +00:00
|
|
|
echo $OUTPUT->box_end();
|
|
|
|
} else {
|
2010-06-02 07:30:13 +00:00
|
|
|
echo $OUTPUT->box_start('glossarydisplay generalbox');
|
|
|
|
echo get_string('errorparsingxml', 'glossary');
|
|
|
|
echo $OUTPUT->continue_button('import.php?id='.$id);
|
|
|
|
echo $OUTPUT->box_end();
|
2009-09-24 07:29:14 +00:00
|
|
|
}
|
2003-11-04 03:54:01 +00:00
|
|
|
|
|
|
|
/// Finish the page
|
2009-09-24 07:29:14 +00:00
|
|
|
echo $OUTPUT->footer();
|