Skip to content

Instantly share code, notes, and snippets.

@jleyva
jleyva / futurelib.php
Created Dec 8, 2016
check_updates backport local_mobile
View futurelib.php
require_once($CFG->dirroot . '/course/lib.php');
if (!function_exists('course_check_updates')) {
/**
* Check for course updates in the given context level instances (only modules supported right Now)
*
* @param stdClass $course course object
* @param array $tocheck instances to check for updates
* @param array $filter check only for updates in these areas
@jleyva
jleyva / services.php
Created Mar 10, 2016
mod/quiz/db/services.php
View services.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,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
@jleyva
jleyva / external.php
Created Mar 10, 2016
mod/quiz/external.php
View external.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,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
@jleyva
jleyva / moodlemobileapp.css
Last active Mar 13, 2019
moodlemobileapp.css advanced
View moodlemobileapp.css
.bar-header {
background-color: #5069A1;
}
ion-side-menu li .item {
background-color: #313848;
border-color: #4F5865;
color: #BCC3CF;
}
@jleyva
jleyva / forcesendgrades.php
Last active Jan 13, 2016
forcesendgrades.php
View forcesendgrades.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,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
View scorm.js
/**
* Check if the given SCORM is available (time restrictions).
* The remote Web Service check that, but if we are offline maybe we have passed the timeclose date.
*/
isAvailable = function(scorm) {
var timeNow = $mmUtil.timestamp();
if (scorm.timeopen > 0 && scorm.timeopen > timeNow) {
return false;
}
@jleyva
jleyva / mm.css
Created Jun 22, 2015
Moodle Mobile 2 remote CSS
View mm.css
.bar-side-menu {
background-color: blue;
}
.bar-content {
background-color: blue;
}
.button.button-positive {
border-color: blue;
@jleyva
jleyva / core_message_get_blocked_users.php
Last active Aug 29, 2015
core_message_get_blocked_users
View core_message_get_blocked_users.php
<?php
// message/externallib.php
/**
* Retrieve a list of users blocked
*
* @param int $userid the user whose blocked users we want to retrieve
* @return external_description
* @since 2.9
*/
View cors.html
<html>
<head>
<script language="javascript">
function test() {
var siteURL = document.getElementById("url").value;
var token = document.getElementById("token").value;
var data = {
"wsfunction": "moodle_webservice_get_siteinfo",
"wstoken": token
@jleyva
jleyva / test.php
Created Oct 3, 2014
function test_custom_parameter()
View test.php
public function test_custom_parameter() {
global $DB, $SITE, $USER;
$custom1 = 'a=one;b=two;three=3';
$custom2 = "a=one\nb=two\nthree=3";
$this->resetAfterTest(true);
$ltigenerator = $this->getDataGenerator()->get_plugin_generator('mod_lti');