SELECT u.idnumber, u.firstname, u.lastname, r.id, r.roleid, c.idnumber AS m_name, c.id AS c_id, role.shortname
FROM mdl_user u
LEFT JOIN mdl_role_assignments r ON u.id = r.userid
LEFT JOIN mdl_role role ON r.roleid = role.id
LEFT JOIN mdl_context c1 ON r.contextid = c1.id
LEFT JOIN mdl_course c ON c1.instanceid = c.id
WHERE u.idnumber = 'p.fagan'
AND (
c.idnumber NOT LIKE 'C%'
AND c.idnumber NOT LIKE '%-E-%'
AND c.idnumber NOT LIKE '%-S-%'
AND c.idnumber NOT LIKE '%-A-%'
AND c.idnumber NOT LIKE '%-P-%'
AND c.idnumber NOT LIKE '%-AD-%'
)
Wednesday, 10 July 2013
Monday, 20 May 2013
Moodle - creating courses from en bulk with templates
I've gone for the following solution:
https://github.com/piersharding/moodle-tool_uploadcourse
There are a few quirks to it. I created the following csv:
============
fullname, shortname, category, idnumber, summary, format, numsections, maxbytes, visible,backupfile
------------------
TEST-1,TEST-1,Cross-College/Admin and Development Cross-College,TEST-1,test,topics,8,10485760,FALSE,C:/Downloads/backup-moodle2-course-admin-template-20130605-1642.mbz
============
I then use the CLI to run it (in windows open a cmd using Administrator rights):
C:\xampp\php>php.exe C:/WEB-APPS/moodleLIVE/admin/tool/uploadcourse/cli/uploadcourse.php --action=addupdate --file=C:/temp/fileimportlist1.csv
I really want to get a metacourse enrolment on each of these courses, so looking at the documentation I can't see much to guide me, maybe:
###code to import
php.exe C:/WEB-APPS/moodleLIVE/admin/tool/uploadcourse/cli/uploadcourse.php --action=addupdate --file=C:/temp/fileimportlist1.csv -s
###code to delete
php.exe C:/WEB-APPS/moodleLIVE/admin/tool/uploadcourse/cli/uploadcourse.php --action=addupdate --mode=delete --file=C:/temp/fileimportlist1.csv
##code to build from a template zipped file (defined in the CSV)
php.exe C:/WEB-APPS/moodleLIVE/admin/tool/uploadcourse/cli/uploadcourse.php --action=addupdate --file=C:/temp/fileimportlist1.csv
you can also run it from the web link: moodleaddress/admin/tool/uploadcourse/index.php. From here you can add, update and delete
To bulk import courses you can use the following:
https://github.com/piersharding/moodle-tool_uploadcoursecategory
To access it go to:
Settings -> Site administration -> Courses -> Upload course categories
-----------------------------------------
Other research is below:
Code to list all courses in your moodle install along with the categories
SELECT `mdl_course`.`id`, `mdl_course`.`category`, `mdl_course`.`fullname`, `mdl_course`.`shortname`, `mdl_course`.`idnumber`, `mdl_course`.`numsections`, `mdl_course_categories`.`description`, `mdl_course_categories`.`id`, `mdl_course_categories`.`parent`
FROM `mdl_course_categories`
INNER JOIN `mdl_course`
ON `mdl_course`.`category` = `mdl_course_categories`.`id`
The topics on the page seem to be related like so:
the table course contains a field called sequence
sequence contains a list of comma separated ids for the table course_section
label table linked to course table through the id
course_modules table has 3 fields:
Steps to implement:
Appendix:
module table:
How does label get linked to course section? does sequence have to contain a unique list?
https://github.com/piersharding/moodle-tool_uploadcourse
There are a few quirks to it. I created the following csv:
============
fullname, shortname, category, idnumber, summary, format, numsections, maxbytes, visible,backupfile
------------------
TEST-1,TEST-1,Cross-College/Admin and Development Cross-College,TEST-1,test,topics,8,10485760,FALSE,C:/Downloads/backup-moodle2-course-admin-template-20130605-1642.mbz
============
I then use the CLI to run it (in windows open a cmd using Administrator rights):
C:\xampp\php>php.exe C:/WEB-APPS/moodleLIVE/admin/tool/uploadcourse/cli/uploadcourse.php --action=addupdate --file=C:/temp/fileimportlist1.csv
I really want to get a metacourse enrolment on each of these courses, so looking at the documentation I can't see much to guide me, maybe:
| fullname | shortname | category | idnumber | summary | enrolmethod_1 | link_1 |
| Parent | Parent | Parent | Parent | meta | 873 | |
| Students | Students | Students | Students | meta | 862 | |
| Teachers | Teachers | Teachers | Teachers | meta | 128 |
###code to import
php.exe C:/WEB-APPS/moodleLIVE/admin/tool/uploadcourse/cli/uploadcourse.php --action=addupdate --file=C:/temp/fileimportlist1.csv -s
###code to delete
php.exe C:/WEB-APPS/moodleLIVE/admin/tool/uploadcourse/cli/uploadcourse.php --action=addupdate --mode=delete --file=C:/temp/fileimportlist1.csv
##code to build from a template zipped file (defined in the CSV)
php.exe C:/WEB-APPS/moodleLIVE/admin/tool/uploadcourse/cli/uploadcourse.php --action=addupdate --file=C:/temp/fileimportlist1.csv
you can also run it from the web link: moodleaddress/admin/tool/uploadcourse/index.php. From here you can add, update and delete
To bulk import courses you can use the following:
https://github.com/piersharding/moodle-tool_uploadcoursecategory
To access it go to:
Settings -> Site administration -> Courses -> Upload course categories
-----------------------------------------
Other research is below:
Code to list all courses in your moodle install along with the categories
SELECT `mdl_course`.`id`, `mdl_course`.`category`, `mdl_course`.`fullname`, `mdl_course`.`shortname`, `mdl_course`.`idnumber`, `mdl_course`.`numsections`, `mdl_course_categories`.`description`, `mdl_course_categories`.`id`, `mdl_course_categories`.`parent`
FROM `mdl_course_categories`
INNER JOIN `mdl_course`
ON `mdl_course`.`category` = `mdl_course_categories`.`id`
The topics on the page seem to be related like so:
the table course contains a field called sequence
sequence contains a list of comma separated ids for the table course_section
label table linked to course table through the id
course_modules table has 3 fields:
- module the id from the module table specifying the module type e.g. 5 for forum. Where are these ids from? Is there a table that defines them?
- instance the id of the module you are link to, e.g. 7 here for a label would link to the label table id 7
- section the id of the course_section that it is linking to
Steps to implement:
- create course and get id
- create course_section and get id
- add course_section ids to the sequence field on course
- create instance of the desired module eg. label get the id
- create course_modules for each module needed linking course, instance (label id), module, section (course_section id)
Appendix:
module table:
- assignment
- chat
- choice
- data
- forum
- glossary
- hotpot
- label
- lesson
- quiz
- resource
- scorm
- survey
- wiki
- workshop
- questionnaire
- feedback
- folder
- imscp
- lti
- page
- url
- checklist
- lightbox
mdl_course_modules: put this data in these fields
- module: 5 . Seems to be a 'type' of the module and #5 it's a module of type FORUM.
- instance: the ID of the forum in mdl_forum (the id of the forum we just created)
- section: it will contain the ID of the section in which we will put this module in mdl_course_sections (see next table explanation). I could get the forum to work without setting this field properly though...
How does label get linked to course section? does sequence have to contain a unique list?
Friday, 21 September 2012
FastCGI Error
The FastCGI Handler was unable to process the request.
--------------------------------------------------------------------------------
Error Details:
The FastCGI process exited unexpectedly
Error Number: -2147467259 (0x80004005).
Error Description: Unspecified error
HTTP Error 500 - Server Error.
Internet Information Services (IIS)
This sounds pretty terminal, our server was down and we could no longer use moodle. I hadn't changed any settings in php.ini. What had happened was I had manually cleared the php.log file sitting in C:/temp/ without the log file it no longer wanted to serve webpages...(?!). restoring that file, brought the server back up.
This sounds pretty terminal, our server was down and we could no longer use moodle. I hadn't changed any settings in php.ini. What had happened was I had manually cleared the php.log file sitting in C:/temp/ without the log file it no longer wanted to serve webpages...(?!). restoring that file, brought the server back up.
Wednesday, 5 September 2012
Other moodle 2.2 missing features
Moodle 2.x no longer uses the section anchors that were present in 1.9 For example
Take me to <a href="#sectionblock-1">Course Materal</a>
<a name="sectionblock-1"> the page anchor it links to
used to link to the first section block. We've had to recode several sections to add our own anchors, which is a little annoying
Take me to <a href="#sectionblock-1">Course Materal</a>
<a name="sectionblock-1"> the page anchor it links to
used to link to the first section block. We've had to recode several sections to add our own anchors, which is a little annoying
Tuesday, 4 September 2012
Moodle 2 CRON issues
We upgraded from 1.9 to 2.2 and our CRON tasks stopped working. It turned out that we should have use php-cgi.exe and NOT php-win.exe
Saturday, 18 February 2012
get_iplayer hd and convert to avi
get the video:
get_iplayer --vmode=flashhigh --pid ####### --force
converting flash video with ffmpeg, first get a terminal to the folder with the .flvs in it. Then run the following:
//this copies
ffmpeg -i "Sing2.flv" -vcodec copy "Sing2.avi"
//this converts
ffmpeg -i "Sing2.flv" "Sing2.avi"
//this copies
ffmpeg -vcodec copy -acodec copy -i INPUT.flv OUTPUT.mp4
get_iplayer --vmode=flashhigh --pid ####### --force
converting flash video with ffmpeg, first get a terminal to the folder with the .flvs in it. Then run the following:
//this copies
ffmpeg -i "Sing2.flv" -vcodec copy "Sing2.avi"
//this converts
ffmpeg -i "Sing2.flv" "Sing2.avi"
//this copies
ffmpeg -vcodec copy -acodec copy -i INPUT.flv OUTPUT.mp4
Wednesday, 7 December 2011
SVG innerHTML
In SVG, you don't always use the innerHTML command to write to a tag. Use the node.textContent
command instead
command instead
Subscribe to:
Posts (Atom)