Not long ago I was tasked to make a tool to manage Moodle courses by moving them through categories, creating and cleaning them up. Now I had to make some way to “refresh” the course participants and that means unenrolling teachers and managers, assign different roles, suspending students, adding students, all that stuff.
This was going pretty good and easy until I hit upon a web service function
core_enrol_edit_user_enrolment. It’s an
External function that updates a given user enrolment, it is needed to suspend students from a course.
From the official API docs, we can see that it takes in required arguments courseid (User enrolment ID), ueid (User enrolment ID) and status (Enrolment status).
The problem here is with a ueid (User enrolment ID) argument because there’s no function that returns such an ID. At least I wasn’t able to find one easily accessible and I had to make my own web service function to get that ID.
A long time ago I wrote about the same thing, but with more text and a C++ example, you can find it here. This time I made the same thing but in PHP and using cURL, because it was for a project I was working on. Basically I had a very simple task that needed to be a bit automated. Whole website is also basic, just simple authentication and then a simple file upload. In this project generate a lot of data (around 5mb) and then POST all of that to the file upload script.
Greetings. So today I’m gonna write about stuff. Managing basic LDAP things with PHP, to be precise… Had a problem at work, that sometimes we do not receive information about new people when they get accepted. Because we don’t receive any information, we don’t always know what to import/create. Then those people come to us asking why they can’t log into computers and use Wifi, then we have to look them up in a outside Oracle DB and create a user like that. That’s a silly, repetitive and a daunting task. Some kinda tool to automate this had to be created so it could be integrated into our existing IT system as well.
I’m not gonna write about the tool, instead I’ll be writing about problems that came up adding users, creating groups and modifying attributes.
Oh hello, I present to you my latest project in PHP – a Voteban bot. This project is probably my last in a very long time as I have became VERY busy lately and have no time for new projects…
So I will not write a lot here, instead I’ll c/p the README I made yesterday, it explains errythang.
You can download the whole project from here: https://github.com/kulverstukas1/votebanbot
And the bot is live on Evilzone’s IRC server, I am hosting it on my RaspPI for now.
I am open to suggestions and already have a TODO list which I am hoping to complete one day…
Teko pasirašyti kelias funkcijas kad linksniuotų vardą ir pavardę pagal tris linksnius, kad kreipimasis sistemoje atrodytų natūralesnis. Žemiau pateikti 3 kodų blokai veikia tik su Lietuviškais vardais ir pavardėmis, kiek teko bandyti tai keičia tinkamai visada jeigu vardas ir pavardė yra sąmoningi :P – jeigu kokią klaidą pastebėtumėte, prašau pranešti komentaruose :)
Nesiu aš kietas PHP programeris tai ir kodas gal bus kiek lievokas, tačiau atitinka mano lūkesčius ir veikia. Good enough :D