//////////////////////////////////////////////////////
//                                                  //
//                                                  //
//     Drupal to Moodle XML-RPC has created by      //
//          Alicia García Holgado - GRIAL           //
//             University of Salamanca              //
//              http://grial.usal.es                //
//                                                  //
//                                                  //
//////////////////////////////////////////////////////

IMPORTANT: This version is NOT a module for Moodle.
Provides a XML-RPC server with some functions required for the correct
work of a Drupal module named Drupal to Moodle.


Only install on versions >= 1.9

BBDD suported has MySQL and PostgreSQL

Require the xmlrpc PHP extension


Here is a basic outline of the installation process,
which normally takes me only a few seconds:

    1. Copy "xmlrpc" folder to the Moodle installation directory
    
    2. Edit "xmlrpc/drupaltomoodle_xmlrpc.php"
    
    3. Around line 19 put your encryption key: `define( 'DRUPALTOMOODLE_KEY', 'your-key-value' );`
       You must use the same key to encrypt your user password in the client using the function `drupaltomoodle_encrypt_password`
    
    4. Around line 22 put id of the forum where you want publish the news: `define( 'DRUPALTOMOODLE_FORUM', forum-id);`
    
    5. Now you can use the new XML-RPC server


//////////////////////////////////////////////////////
//                                                  //
//                   XML-RPC client                 //
//                                                  //
//////////////////////////////////////////////////////

Functions (check params in drupaltomoodle_xmlrpc.php file):

    moodle.ping
    moodle.getCoursesCategories
    moodle.createCategory
    moodle.createCourse
    moodle.checkShortname
    moodle.addTeacherById
    moodle.getUsers
    moodle.checkUser
    moodle.createNews

Authentication:

The XML-RPC server requires login with an admin user.
Password must be encrypted before calling one of this xml-rpc functions so follow this steps:
    1. Open file `drupaltomoodle_xmlrpc.php` and copy the function `drupaltomoodle_encrypt_password` to your code or migrate it to your program language
    2. Define a key for encrypting your passwords. Max 20 characters.
    3. Edit file `drupaltomoodle_xmlrpc.php` and put your key value in line 32: `define( 'DRUPALTOWP_KEY', 'your-key-value' );`

For bugs, please contact with Alicia García (aliciagh@usal.es), thanks.
