Integrating Moodle to own systems -- what risks...

Integrating Moodle to own systems -- what risks...

by Monica Franz -
Number of replies: 7
Hi!

We would like to get information from the Moodle database (coursename, students enroled in specific courses, etc.) for our Room-Access-Control System.

What do we have to be aware of? Can we use the functions in $CFG/lib or even those in $CFG/course.

Does a dummy-php-file exist, where the needed function e.g. has_capability and other
musts for integrating already are listed? Or something like the Moodle-Programming course?

Hope someone can answer my questions!

Regards,

Monica

Average of ratings: -
In reply to Monica Franz

Re: Integrating Moodle to own systems -- what risks...

by Mark Drechsler -
Hi Monica,

If you don't get a response to this here then you might do better asking in the developer forum.

Cheers,

Mark.
Average of ratings: Useful (1)
In reply to Monica Franz

Re: Integrating Moodle to own systems -- what risks...

by Lindley Bailey -

You are trying to go through Moodle to the database.

Why not just query the database directly?

Set up a user for the database that can access but not update the database, then use that account to access the information straight from the database.

Much less programming needed and gets rid of the moodle processing overhead.

Sincerely

Lin Bailey

In reply to Lindley Bailey

Re: Integrating Moodle to own systems -- what risks...

by Monica Franz -
Hi Lin!

I think it's easier for customizing to use Moodle functions instead of going directly on the database.

Regards,
Monica

In reply to Monica Franz

Re: Integrating Moodle to own systems -- what risks...

by Dale Davies -
For certain tasks it may be more secure to use Moodle's internal functions, also to save your sanity it may be quicker and easier, rather than recreating the same functionality yourself.

An example of a risk that springs to my mind are that if you execute an update query in the wrong way then you risk the integrity of the data stored in your databse. For example, deleting a user directly from the user table, or changing their ID without updating it in other related tables.

Always test, test and test some more! Never on your production server.
In reply to Dale Davies

Re: Integrating Moodle to own systems -- what risks...

by Monica Franz -
Hi!

I just want to read tables and print some informations (categories,courses, students) out on a website! The user should select the category and course and just get the list of students in that course.

I wrote some php's using Moodle libraries, but e.g. can I use other Moodle functions as well? And is the has_capability function the only one I need to check out if the user has the permissions to read the tables? Sure just an admin is allowed to do so!

Thanks for answering!

Monica
In reply to Monica Franz

Re: Integrating Moodle to own systems -- what risks...

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Ok, if possible write your addition as a recognised plugin. Blocks are surprisingly useful as they have access to most functionality (and there are lots of examples to look at). You don't *actually* have to add an instance of the block either.

Failing that, create a new script and just 'require' Moodle's config.php. That drags in all the standard libraries and APIs.

You can look at lib/dmllib.php for the database access functions or just have a sift through other code.
Average of ratings: Useful (1)
In reply to Howard Miller

Re: Integrating Moodle to own systems -- what risks...

by Monica Franz -
Thank you all for your good hints!

I posted my questions to the General developer forum as well.

A great mix of answers!

Could someone gather both of my "forum-answerlists" to the General developer forum?

Monica