Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Moodle/mod/print/print_xmlrpc.php
diff options
context:
space:
mode:
Diffstat (limited to 'Moodle/mod/print/print_xmlrpc.php')
-rwxr-xr-xMoodle/mod/print/print_xmlrpc.php70
1 files changed, 57 insertions, 13 deletions
diff --git a/Moodle/mod/print/print_xmlrpc.php b/Moodle/mod/print/print_xmlrpc.php
index 63df086..b74a550 100755
--- a/Moodle/mod/print/print_xmlrpc.php
+++ b/Moodle/mod/print/print_xmlrpc.php
@@ -21,13 +21,14 @@ function actual_func($file, $title) {
global $USER;
error_log("okay first step done", 0);
#require_login();
- $olpcxs = get_auth_plugin('olpcxs');
- $olpcxs->loginpage_hook();
+ #$olpcxs = get_auth_plugin('olpcxs');
+ #$olpcxs->loginpage_hook();
error_log("require login done", 0);
#$userrecord = get_record('user', 'username', $username);
#$userid = $userrecord->id;
- $id = 2;
+
+ $id = 1;
if ($id) {
if (! $cm = get_coursemodule_from_id('print', $id)) {
error("Course Module ID was incorrect");
@@ -67,19 +68,62 @@ function actual_func($file, $title) {
$assignmentinstance->upload_xmlrpc($fpath, $userid, $title, $assignment);// Display or process the submissions
return 1;
}
-function send_func($method_name, $params, $app_data) {
- $file = $params[0];
- $title = $params[1];
- actual_func($file, $title);
- return 1;
+
+function get_course_details($method_name, $params, $app_data) {
+ require_once("../../config.php");
+ require_once("lib.php");
+ require_once("../../lib/moodlelib.php");
+ require_once('../../lib/datalib.php');
+ require_once('xmlrpc.inc');
+ require_once('xmlrpcs.inc');
+
+ global $CFG;
+ global $USER;
+ #error_log("okay first step done", 0);
+
+ #require_login();
+ #$olpcxs = get_auth_plugin('olpcxs');
+ #$olpcxs->loginpage_hook();
+
+ $usr = 3;
+ if (isset($usr)) {
+ #error_log('lol'.var_dump($USER), 0);
+ $courseArray = get_my_courses(3);
+ $i = 1;
+ foreach ( $courseArray as $course) {
+ $records[$i] = get_record_sql("SELECT *
+ FROM {$CFG->prefix}print
+ WHERE course = $course->id");
+ $i++;
+ }
+ $i = 1;
+
+ foreach( $records as $record) {
+
+ $course = get_record('course','id', $record->course);
+ $tosend[$i] = array('modulename'=> $record->name,
+ 'coursename'=> $course->shortname,
+ 'courseid'=> $record->course);
+ $i++;
+ }
+ #ob_start();
+ #print_r($tosend);
+ #$output = ob_get_contents();
+ #error_log($output, 0);
+ return $tosend;
+ }
+ return 1;
}
-function greeting_func($method_name, $params, $app_data)
-{
- $name = $params[0];
- return "Hello, $name. How are you today?";
+function send_func($method_name, $params, $app_data) {
+ $file = $params[0];
+ $title = $params[1];
+ actual_func($file, $title);
+ return 1;
}
+
+
/*
* This creates a server and sets a handle for the
* server in the variable $xmlrpc_server
@@ -99,7 +143,7 @@ $xmlrpc_server = xmlrpc_server_create();
*/
xmlrpc_server_register_method($xmlrpc_server, "send_func", "send_func");
-xmlrpc_server_register_method($xmlrpc_server, "greeting_func", "greeting_func");
+xmlrpc_server_register_method($xmlrpc_server, "get_course_details", "get_course_details");
/*
* When an XML-RPC request is sent to this script, it