1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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'));
?>
|