Skip to content

Instantly share code, notes, and snippets.

@nadavkav
nadavkav / download_unicko_videos.php
Created Sep 13, 2020
Download UNICKO videos (php script via web API)
View download_unicko_videos.php
<?php
//require_once('config.php');
//require_once($CFG->libdir.'/filelib.php');
//use curl;
@ini_set('display_errors', '1');
@ini_set('html_errors', '1');
//$CFG->debug = (E_ALL | E_STRICT); // === DEBUG_DEVELOPER - NOT FOR PRODUCTION SERVERS!
//$CFG->debugdisplay = true;
@nadavkav
nadavkav / list_online_rooms_bbb.php
Created Mar 19, 2020
List online BBB rooms (PHP)
View list_online_rooms_bbb.php
<?php
// List online BBB rooms
//
//
// https://docs.bigbluebutton.org/dev/api.html
// https://github.com/bigbluebutton/bigbluebutton-api-php
//
// echo sha1('getMeetings'.'gcAIBNoat3WN4oRioGxY9Ik5Xrfzm3KTi3KixyCVf4');
//
@nadavkav
nadavkav / bbb_api_getmeetings.php
Created Mar 19, 2020
Bigbluebutton API getmeetings (PHP) Moodle
View bbb_api_getmeetings.php
//https://docs.bigbluebutton.org/dev/api.html#getmeetings
// Adhoc task that keep updating the BBB load params every X minutes.
$bbb_api_getmeetings_xml = file_get_contents('https://bbb-service.edu/bigbluebutton/api/getMeetings?checksum=7fd047728b989f36bffdc3337a08f334a5');
$xml = simplexml_load_string($bbb_api_getmeetings_xml, "SimpleXMLElement", LIBXML_NOCDATA);
$json = json_encode($xml);
$meeting_array = json_decode($json,TRUE);
@nadavkav
nadavkav / send sms via moodle php
Created Mar 10, 2018
send sms via moodle php to ssl-vp.com smoove.io
View send sms via moodle php
<?php
require(__DIR__.'../../config.php');
require_once($CFG->libdir.'/filelib.php');
$endpoint = 'https://ssl-vp.com/rest/v1/Messages?sendNow=true';
$header = array('Content-type: application/json','Authorization: PUT-API-KEY');
$params = array('toMembersByCell' => array('+972 53 333333'),
'body' => 'Hello PeTeLs !!! what\'s going on??? ',
'fromNumber' => '+972 53 3333333');
@nadavkav
nadavkav / log_user_pageload_js_perf_stats
Created Nov 2, 2019
Log Moodle user page load statistics
View log_user_pageload_js_perf_stats
<?php
define('AJAX_SCRIPT', true);
require(__DIR__ . '/config.php');
$contextid = required_param('contextid', PARAM_INT);
$preftiming = optional_param('preftiming', '', PARAM_RAW);
// Security.
@nadavkav
nadavkav / PerformanceNavigationTiming
Created Nov 2, 2019
Moodle user page load PerformanceNavigationTiming
View PerformanceNavigationTiming
define(['jquery', 'core/config', 'core/notification'],
function($, config, notification) {
// https://developer.mozilla.org/en-US/docs/Web/API/PerformanceNavigationTiming
var preftiming = performance.timing;
var params = {
contextid: config.contextid,
preftiming: JSON.stringify(preftiming),
sesskey: config.sesskey
View Alef_Regular-normal.js
(function (jsPDFAPI) {
var font = 'AAEAAAATAQAABAAwRkZUTWatrcwAAAE8AAAAHEdERUYJSQdnAAABWAAAAERHUE9TaxINtAAAAZwAAAVMR1NVQobuvs4AAAboAAADdE9TLzKAEc+oAAAKXAAAAGBjbWFwJxxliQAACrwAAAP2Y3Z0IGx0aJMAAA60AAAChmZwZ212vUTEAAARPAAABiNnYXNwAAAAEAAAF2AAAAAIZ2x5ZqCJZS0AABdoAAEy5GhlYWQC6ER3AAFKTAAAADZoaGVhDu4DlgABSoQAAAAkaG10eMh6vR8AAUqoAAAGoGxvY2H4f60MAAFRSAAAA1JtYXhwBLUCGAABVJwAAAAgbmFtZTAoU+YAAVS8AAACWnBvc3S3zoa3AAFXGAAACkZwcmVwcFDMKQABYWAAAAN4d2ViZsxqUUkAAWTYAAAABgAAAAEAAAAAzD2izwAAAADNAI4VAAAAAM1vfOcAAQAAAA4AAAA8AAAAAAACAAcAAAEqAAEBKwE3AAMBOAE5AAEBOgE7AAMBPAE8AAEBPQE9AAMBPgGnAAEABAAAAAIAAAABAAAACgBMAIIAAmhlYnIADmxhdG4ALAAKAAF6ejAxABIAAP//AAEAAAAA//8AAwABAAIAAwAAAAF6ejAxAAoAAP//AAMAAQACAAMABG1hcmsAGnp6MDEAJHp6MDIAKnp6MDMAMAAAAAMAAAABAAIAAAABAAAAAAABAAEAAAABAAIAAwAIABAAGAAEAAEAAQAYAAQAAQABAmIABAABAAECsAABAcwBtgABAeIADAA1AGwAcgB4AH4AhACKAJAAlgCcAKIAqACuALQAugDAAMYAzADSANgA3gDkAOoA8AD2APwBAgEIAQ4BFAEaASABJgEsATIBOAE+AUQBSgFQAVYBXAFiAWgBbgF0AXoBgAGGAYwBkgGYAZ4BpAABAH4AAAABAF0AAAAB//0AAAABAQ0AAAABAJgAAAAB/8oAAAABAG0AAAABAJEAA
View oer_catalog.sql
SELECT
lm.instanceid
,(SELECT DISTINCT m.data
FROM mdl_local_metadata as m
JOIN mdl_local_metadata_field AS mf ON m.fieldid = mf.id AND mf.contextlevel = 70
WHERE mf.shortname = 'ID' and m.instanceid = cm.id) as 'Unique resource ID'
,(SELECT DISTINCT m.data
FROM mdl_local_metadata as m
JOIN mdl_local_metadata_field AS mf ON m.fieldid = mf.id AND mf.contextlevel = 70
WHERE mf.shortname = 'teacherremarks' and m.instanceid = cm.id) as 'MD - Teacher intro'
@nadavkav
nadavkav / oer_catalog.sql
Created Sep 17, 2019
What modules are copied from what course? (PETEL)
View oer_catalog.sql
SELECT
cm.course, cm.id, cm.module, m.name
,CASE m.name
WHEN 'quiz' THEN (SELECT m.name FROM mdl_quiz m WHERE m.id = cm.instance)
END AS 'Module name'
,t.courseid, c.fullname, u.firstname, u.lastname
FROM mdl_local_courseduplicate t
JOIN mdl_course_modules cm ON cm.id = t.sourceactivityid
JOIN mdl_modules m ON m.id = cm.module
JOIN mdl_course c ON c.id = t.courseid
View h5p_moodle_filter_wip.php
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,