Пример #1
0
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from config import *
from moodle import MDL

mdl = MDL()
# xmlrpc Connection
print mdl.conn_xmlrpc(server)

"""
Update user
"""
users = [{
    'id': 19,                   # required
    #'username': '******',    # username must be unique
    #'password': '******',
    'firstname': 'Joan Pere',        # Value to modify
    #'lastname': 'Cognoms 3',
    #'email': '*****@*****.**',
}]
print mdl.update_users(server, users)
Пример #2
0
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from config import *
from moodle import MDL

mdl = MDL()
# xmlrpc Connection
print mdl.conn_xmlrpc(server)

"""
Get user
"""

user_ids = ((19,))
print mdl.get_users(server, user_ids)

# Enrol a user in a course
enrols =[{
    'roleid': 1,
    'userid': 18,
    'courseid': 18,
Пример #3
0
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from config import *
from moodle import MDL

mdl = MDL()
# xmlrpc Connection
print mdl.conn_xmlrpc(server)

"""
Create new courses
"""
courses = [{
    'shortname': 'test6', # shortname must be unique
    'fullname': 'Test 6',
    'categoryid': 1,
    #'visible': 1,
    'id': 2,
    #'maxbytes': 2097152,
    #'showreports': 0,
    #'startdate': 1314396000,
Пример #4
0
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from config import *
from moodle import MDL

mdl = MDL()
# xmlrpc Connection
print mdl.conn_xmlrpc(server)
"""
Get user
"""

user_ids = ((19, ))
print mdl.get_users(server, user_ids)

# Enrol a user in a course
enrols = [{
    'roleid': 1,
    'userid': 18,
    'courseid': 18,
}]
Пример #5
0
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from config import *
from moodle import MDL

mdl = MDL()
# xmlrpc Connection
"""
Enrol users
"""
enrols = [{
    'roleid': 1,
    'userid': 3,
    'courseid': 1,
}]

print mdl.enrol_users(server, enrols)
Пример #6
0
#!/usr/bin/python
# -*- coding: UTF-8 -*-

# Test of MDL python library use
# https://github.com/zikzakmedia/python-moodle

from moodle import MDL

server = {
    'protocol': 'rest',
    'uri': 'http://demo.moodle.net',
    'token': 'bb03e754ce64098d6896e9318d956bdc',
}

mdl = MDL()
# xmlrpc Connection
#print mdl.conn_rest(server,'moodle_course_get_courses')

"""
Get courses
"""
print mdl.get_courses(server)
Пример #7
0
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from config import *
from moodle import MDL

mdl = MDL()
# xmlrpc Connection

"""
Enrol users
"""
enrols =[{
    'roleid': 1,
    'userid': 3,
    'courseid': 1,
    }]

print mdl.enrol_users(server, enrols)
Пример #8
0
#                       Raimon Esteve <*****@*****.**>
#                       Jesus Martín <*****@*****.**>
#    $Id$
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from config import *
from moodle import MDL

mdl = MDL()
# xmlrpc Connection
print mdl.conn_xmlrpc(server)

"""
Get courses
"""
print mdl.get_courses(server)