Skip to content

Instantly share code, notes, and snippets.

Avatar

Mark Ward markward

View GitHub Profile
View timer.php
$mtime = microtime();
$mtime = explode(' ', $mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
//Do something!
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
@markward
markward / crumbs.css
Last active Dec 17, 2015
Crumbs is a CSS file for Moodle themes. It cleans up the navigation breadcrumbs by hiding long page names until the user wants to see them. This theme works best with modern browsers which support CSS transitions fully. Look at line 34 to configure the highlight colour.
View crumbs.css
div.navbar {
padding: .5em 0;
}
div.navbar div.breadcrumb ul li{
display:inline-block;
*displace:inline;
background-color: #DDD;
color: #BBB;
padding: .1em 5px;
@markward
markward / example.css
Created Nov 28, 2012
Make Moodle Debugging Prettier
View example.css
div.notifytiny{
position: fixed;
bottom: 15px;
right: 15px;
background: rgba(83, 1, 7, 0.8);
border-bottom: 1px solid #750B13;
box-shadow: 0px 0px 6px black;
color: white;
font-size: 1.4em;
font-weight: bold;
@markward
markward / gist:2593208
Created May 4, 2012
Moodle 2 - Generate pure HTML menu
View gist:2593208
//custom navigation bar - pure HTML
function themename_get_menu(){
//get the menu string from CFG
global $CFG;
$menu = $CFG->custommenuitems;
//now get everything into a two dimensional array [entry][value]
$items = explode("\r\n", $menu);
$count = 0;
while (isset($items[$count])){
@markward
markward / edit_to_query.php
Created Apr 24, 2012
This function can be used to grab a url and variables from $PAGE->button in Moodle 2.X. Working through a string and deconstructing the variables seemed to be a backwards approach to me, but in practice this is much quicker than going through the Navigati
View edit_to_query.php
/**
* Gets URL and actions from the old-style $PAGE->button
*
* It may not look it but this is lightening fast, 10x quicker than getting the button
* from the Settings Navigation through navigation API on Moodle 2.1!
*
* @param string $button The page's edit button from $PAGE->button
* @return array containing the 'url' and 'actions'
*/
@markward
markward / autohide.css
Last active Oct 1, 2015
AutoHide for Editing Mode on Moodle 2.X
View autohide.css
/** To hide the icons we are using opacity as display:none makes
the buttons inaccessible.
FILTER attributes should apply to IE so long as the strict
doctype is served. Use Filter: none on clear to protect PNG alphas.
Tweak the top opacity values to get "ghost" icons rather than hiding them**/
.block .header .commands a img,
.path-course-view .section .content li .commands img,
.path-course-view .section .content li .commands span.editing_move img,