Skip to content

Instantly share code, notes, and snippets.

View danpoltawski's full-sized avatar

Dan Poltawski danpoltawski

View GitHub Profile
@danpoltawski
danpoltawski / gist:1123720
Created August 3, 2011 20:46
Moodle config.php files
<?php // Moodle configuration file
unset($CFG);
global $CFG;
$CFG = new stdClass();
date_default_timezone_set('Australia/Perth');
/**************************************************
* Work out a branch prefix based on ugly branch retrieval
* Thanks Iñaki:
* http://moodle.org/mod/forum/discuss.php?d=139693
@danpoltawski
danpoltawski / testgoogle.php
Created October 6, 2011 12:03
Google api testing in moodle
<?php
require_once('config.php');
require_once($CFG->libdir.'/googleapi.php');
$googletoken = optional_param('token', false, PARAM_RAW);
$sesskey = google_docs::get_sesskey($USER->id);
echo "Sessionkey is: $sesskey \n<br />";
echo "Google Token is: $googletoken \n<br />";
@danpoltawski
danpoltawski / gist:1433924
Created December 5, 2011 15:17
pre 1.5 upgrades
UPDATE mdl_user set lastip = '127.0.0.1' WHERE lastip IS NULL;
UPDATE mdl_user set city = 'London' WHERE city IS NULL;
UPDATE mdl_resource SET reference = course WHERE type = 'directory' AND reference IS NULL;
UPDATE mdl_resource SET reference = '' WHERE type = 'text' AND reference IS NULL;
UPDATE mdl_resource SET reference = '' WHERE type = 'html' AND reference IS NULL;
@danpoltawski
danpoltawski / subpage-dnd.patch
Created April 18, 2012 02:57
adding dndupload support to mod_subpage
diff --git a/view.php b/view.php
index b0cdac0..b6a1778 100644
--- a/view.php
+++ b/view.php
@@ -29,6 +29,7 @@ require_once('lib.php');
require_once($CFG->dirroot.'/course/lib.php');
require_once($CFG->dirroot.'/mod/forum/lib.php');
require_once($CFG->libdir.'/completionlib.php');
+require_once($CFG->libdir.'/dnduploadlib.php');
diff --git a/lib/navigationlib.php b/lib/navigationlib.php
index f4b89df..2e30de9 100644
--- a/lib/navigationlib.php
+++ b/lib/navigationlib.php
@@ -3007,6 +3007,7 @@ class settings_navigation extends navigation_node {
break;
case CONTEXT_COURSE:
if ($this->page->course->id != SITEID) {
+ $this->load_section_settings();
$this->load_course_settings(($context->id == $this->context->id));
@danpoltawski
danpoltawski / fun.php
Created May 10, 2012 05:10
php references fun
<?php
$array = array(
new stdClass,
new stdClass
);
$count = 0;
foreach ($array as &$object) {
$object->count = $count;
$count++;
diff --git a/mod/workshop/form/rubric/simpletest/testlib.php b/mod/workshop/form/rubric/simpletest/testlib.php
index 23dddd2..6ecac70 100644
--- a/mod/workshop/form/rubric/simpletest/testlib.php
+++ b/mod/workshop/form/rubric/simpletest/testlib.php
@@ -47,6 +47,13 @@ class testable_workshop_rubric_strategy extends workshop_rubric_strategy {
public function calculate_peer_grade(array $grades) {
return parent::calculate_peer_grade($grades);
}
+
+ /**
diff --git a/mod/workshop/form/rubric/simpletest/testlib.php b/mod/workshop/form/rubric/simpletest/testlib.php
index 23dddd2..20e5eeb 100644
--- a/mod/workshop/form/rubric/simpletest/testlib.php
+++ b/mod/workshop/form/rubric/simpletest/testlib.php
@@ -49,6 +49,17 @@ class testable_workshop_rubric_strategy extends workshop_rubric_strategy {
}
}
+/**
+ * Because we are testing with a recordset, implement the bare minimum
pc-php fribidi libmemcached opencore-amr rtmpdump
autoconf gettext libogg ossp-uuid theora
bash-completion git libvorbis pcre tsocks
bsdmake gmp libvpx php wget
cmake icu4c libxml2 pidof x264
faac jpeg mcrypt pkg-config xdebug-php
ffmpeg lame memcached postgresql xvid
flvstreamer libass memcached-php proctools yasm
freetds libevent mysql readline
@danpoltawski
danpoltawski / testicons.php
Created June 21, 2012 10:27 — forked from marinaglancy/testicons.php
Script to test icons and mimetype stings in Moodle 2.3
<?php
require_once('config.php');
require_once($CFG->libdir .'/filelib.php');
$PAGE->set_context(get_system_context());
$mimeicons = get_mimetypes_array();
?>
<style>