Skip to content

Instantly share code, notes, and snippets.

@jleyva
jleyva / client.php
Created September 23, 2013 12:29
Testing core_user_add_user_device
<?php
// This file is NOT a part of Moodle - http://moodle.org/
//
// This client for Moodle 2 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.
//
/**
@jleyva
jleyva / locallib.php
Last active December 19, 2015 01:28
Assinglib para funcionar con uploadgroup mod/assign/submission/file/locallib.php
/**
* Return true if this plugin can upgrade an old Moodle 2.2 assignment of this type
* and version.
*
* @param string $type
* @param int $version
* @return bool True if upgrade is possible
*/
public function can_upgrade($type, $version) {
@jleyva
jleyva / scorm.js
Last active November 25, 2015 12:05
/**
* 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 / groupings_test.php
Created April 30, 2012 15:11
Groupings test
<?php
// This client for local_illl 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.
//
/**
* XMLRPC client for Moodle 2 - local_illl
*
@jleyva
jleyva / externallib.php
Created April 17, 2012 07:36
core_course_get_categories
<?php
/**
* Returns description of method parameters
*
* @return external_function_parameters
* @since Moodle 2.3
*/
public static function get_categories_parameters() {
@jleyva
jleyva / externallib.php
Created April 16, 2012 08:12
Part of external lib
<?php
/**
* Returns description of method parameters
* @return external_function_parameters
*/
public static function duplicate_course_parameters() {
return new external_function_parameters(
array(
'courseid' => new external_value(PARAM_INT, 'course to duplicate id'),
@jleyva
jleyva / mm.css
Created June 22, 2015 09:57
Moodle Mobile 2 remote 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 August 29, 2015 14:13
core_message_get_blocked_users
<?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
*/
@jleyva
jleyva / cors.html
Created October 6, 2014 21:38
MDL-47545
<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 October 3, 2014 09:04
function test_custom_parameter()
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');