Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Moodle/mod/print/test.php
diff options
context:
space:
mode:
Diffstat (limited to 'Moodle/mod/print/test.php')
-rwxr-xr-xMoodle/mod/print/test.php56
1 files changed, 56 insertions, 0 deletions
diff --git a/Moodle/mod/print/test.php b/Moodle/mod/print/test.php
new file mode 100755
index 0000000..5556f42
--- /dev/null
+++ b/Moodle/mod/print/test.php
@@ -0,0 +1,56 @@
+<?php
+require_once("../../config.php");
+require_once('lib.php');
+function actual_func($file,$userid,$title) {
+ require_once("../../config.php");
+ require_once('lib.php');
+ global $CFG;
+
+
+
+ $id = 2;
+
+ if ($id) {
+ if (! $cm = get_coursemodule_from_id('print', $id)) {
+ error("Course Module ID was incorrect");
+ }
+
+ if (! $assignment = get_record("print", "id", $cm->instance)) {
+ error("assignment ID was incorrect");
+ }
+
+ if (! $course = get_record("course", "id", $assignment->course)) {
+ error("Course is misconfigured");
+ }
+ } else {
+ if (!$assignment = get_record("print", "id", $a)) {
+ error("Course module is incorrect");
+ }
+ if (! $course = get_record("course", "id", $assignment->course)) {
+ error("Course is misconfigured");
+ }
+ if (! $cm = get_coursemodule_from_instance("print", $assignment->id, $course->id)) {
+ error("Course Module ID was incorrect");
+ }
+ }
+
+
+
+ $assignmentinstance = new print_base($cm->id, $assignment, $cm, $course);
+ $filearea = $assignmentinstance->file_area_name($userid);
+ print $filearea;
+
+
+ $handle = fopen($CFG->dataroot."/".$filearea."/".$title.".pdf", "wb");
+ fwrite($handle, $file->scalar);
+ fclose($handle);
+ $fpath = $CFG->dataroot."/".$filearea."/".$title.".pdf";
+
+ $assignmentinstance->upload_xmlrpc($fpath, $userid, $title, $id);// Display or process the submissions
+ return 1;
+
+}
+$file = new object();
+$file->scalar = 'blablabla';
+print(actual_func($file,3,'Test'));
+?> \ No newline at end of file