Skip to content

Instantly share code, notes, and snippets.

View markward's full-sized avatar

Mark Ward markward

View GitHub Profile
@markward
markward / autohide.css
Last active October 1, 2015 17:07
AutoHide for Editing Mode on Moodle 2.X
/** 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,
@markward
markward / edit_to_query.php
Created April 24, 2012 13:11
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
/**
* 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 / gist:2593208
Created May 4, 2012 08:12
Moodle 2 - Generate pure HTML menu
//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 / example.css
Created November 28, 2012 14:26
Make Moodle Debugging Prettier
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 / crumbs.css
Last active December 17, 2015 13:58
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.
div.navbar {
padding: .5em 0;
}
div.navbar div.breadcrumb ul li{
display:inline-block;
*displace:inline;
background-color: #DDD;
color: #BBB;
padding: .1em 5px;
$mtime = microtime();
$mtime = explode(' ', $mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
//Do something!
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];