QUICK INSTALL
=============
-For the impatient, here is a basic outline of the
-installation process, which normally takes me only
+For the impatient, here is a basic outline of the
+installation process, which normally takes me only
a few minutes:
-1) Move the Moodle files into your web directory.
+1) Move the Moodle files into your web directory.
2) Create a single database for Moodle to store all
it's tables in (or choose an existing database).
-3) Visit your Moodle site with a browser, you should
+3) Visit your Moodle site with a browser, you should
be taken to the install.php script, which will lead
- you through creating a config.php file and then
+ you through creating a config.php file and then
setting up Moodle, creating an admin account etc.
4) Set up a cron task to call the file admin/cron.php
For more information, see the INSTALL DOCUMENTATION:
- http://docs.moodle.org/en/Installing_Moodle
+ http://docs.moodle.org/en/Installing_Moodle
-A local copy can also be found in
+A local copy can also be found in
lang/en_utf8/help/install.html (or your language)
The name Moodle™ is a registered trademark of the Moodle Trust.
-A key part of the business model that allows us to produce and
-distribute Moodle as completely Free open source software is that
-we restrict the commercial use of the Moodle trademark to those
+A key part of the business model that allows us to produce and
+distribute Moodle as completely Free open source software is that
+we restrict the commercial use of the Moodle trademark to those
who have contracted to support Moodle development (Moodle Partners).
-If you are intending to use the name (and/or logo) to advertise
-generic Moodle™ services (eg Moodle Hosting, Moodle Support,
-Moodle Certification, Moodle Training, Moodle Consulting,
-Moodle Customisation, Moodle Courseware Development, Moodle
-Theme design, Moodle Integrations, Moodle Installations, etc)
-or as the name of a software package, then you must seek
-direct permission in writing from the Moodle Trust via the
-moodle.com helpdesk, in accordance with normal trademark
+If you are intending to use the name (and/or logo) to advertise
+generic Moodle™ services (eg Moodle Hosting, Moodle Support,
+Moodle Certification, Moodle Training, Moodle Consulting,
+Moodle Customisation, Moodle Courseware Development, Moodle
+Theme design, Moodle Integrations, Moodle Installations, etc)
+or as the name of a software package, then you must seek
+direct permission in writing from the Moodle Trust via the
+moodle.com helpdesk, in accordance with normal trademark
restrictions.
-There are no restrictions on how you use the name in other
-contexts (for example, if you use Moodle just to provide
-courses then you can use the name freely to refer to it.)
+There are no restrictions on how you use the name in other
+contexts (for example, if you use Moodle just to provide
+courses then you can use the name freely to refer to it.)
-If you aren't sure of a particular case, please ask us via
-http://moodle.com/helpdesk: we'll be happy to either provide
-you with official permission in writing or help you fix
-your wording.
+If you aren't sure of a particular case, please ask us via
+http://moodle.com/helpdesk: we'll be happy to either provide
+you with official permission in writing or help you fix
+your wording.
Martin Dougiamas
Executive Director
if ($externalbloguserid == $USER->id) {
$DB->delete_records('blog_external', array('id' => $delete));
$message = get_string('externalblogdeleted', 'blog');
- }
+ }
}
$blogs = $DB->get_records('blog_external', array('userid' => $USER->id));
$blogurl = new moodle_url($CFG->wwwroot . '/blog/index.php');
// If the title is not yet set, it's likely that the context isn't set either, so skip this part
- $pagetitle = $PAGE->title;
+ $pagetitle = $PAGE->title;
if (!empty($pagetitle)) {
$contexturl = blog_get_context_url();
-YAHOO.util.Event.onDOMReady(init);
+YAHOO.util.Event.onDOMReady(init);
function init() {
var select_all = document.getElementById('comment_select_all');
select_all.onclick = function() {
}
var data = {
'commentids': list,
- 'sesskey': moodle_cfg.sesskey
+ 'sesskey': moodle_cfg.sesskey
}
var trans = YAHOO.util.Connect.asyncRequest('POST',
url+'?action=delete', cb, build_querystring(data));
backgroundColor: { to: '#FFE390' }
};
var anim = new YAHOO.util.ColorAnim(ids[i], attributes);
- anim.animate();
+ anim.animate();
}
}
}
backgroundColor: { from: '#FFE390', to:'#FFFFFF' }
};
var anim = new YAHOO.util.ColorAnim('dlg-content-'+cid, attributes);
- anim.animate();
+ anim.animate();
}
}
function delete_comment(client_id, comment_id) {
height:{to:0}
};
var anim = new YAHOO.util.Anim(htmlid, attributes, 1, YAHOO.util.Easing.easeOut);
- anim.onComplete.subscribe(this.remove_dom, [], this);
- anim.animate();
+ anim.onComplete.subscribe(this.remove_dom, [], this);
+ anim.animate();
},
remove_dom: function() {
- this.el.parentNode.removeChild(this.el);
+ this.el.parentNode.removeChild(this.el);
}
}
var trans = YAHOO.util.Connect.asyncRequest('POST',
/**
* Return comments by pages
- * @param int $page
+ * @param int $page
* @return mixed
*/
function get_comments($page) {
} else {
$start = $page*$this->perpage;
}
- $sql = "SELECT c.id, c.contextid, c.itemid, c.commentarea, c.userid, c.content, u.username, u.firstname, u.lastname, c.timecreated
+ $sql = "SELECT c.id, c.contextid, c.itemid, c.commentarea, c.userid, c.content, u.username, u.firstname, u.lastname, c.timecreated
FROM {comments} c, {user} u
WHERE u.id=c.userid ORDER BY c.timecreated ASC";
/**
* Print comments
- * @param int $page
+ * @param int $page
*/
function print_comments($page=0) {
global $CFG, $OUTPUT, $DB;
$action .= "<a target='_blank' href='{$url}'>".get_string('commentincontext').'</a>';
}
$table->data[] = array($checkbox, $c->username, $c->content, $action);
- }
+ }
echo $OUTPUT->table($table);
echo $OUTPUT->paging_bar(moodle_paging_bar::make($count, $page, $this->perpage, $CFG->wwwroot.'/comment/index.php'));
}
/**
* delete a comment
- * @param int $commentid
+ * @param int $commentid
*/
public function delete_comment($commentid) {
global $DB;
}
/**
* delete comments
- * @param int $commentid
+ * @param int $commentid
*/
public function delete_comments($list) {
global $DB;
if ($form = data_submitted()) { // form submitted, do not check referer (original page unknown)!
/// Only deal with real users
- if (!isloggedin()) {
+ if (!isloggedin()) {
redirect($CFG->wwwroot);
}
$eventdata->fullmessagehtml = '';
$eventdata->smallmessage = '';
events_trigger('message_send', $eventdata);
-
+
redirect($CFG->wwwroot .'/course/', 'Message sent, thanks', 3);
exit;
}
$redirecturl = empty($_SERVER['REDIRECT_URL']) ? '' : $_SERVER['REDIRECT_URL'];
$httpreferer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER'];
$requesturi = empty($_SERVER['REQUEST_URI']) ? '' : $_SERVER['REQUEST_URI'];
-
+
header("HTTP/1.0 404 Not Found");
header("Status: 404 Not Found");
/**
* Client-side JavaScript for group management interface.
- * @author vy-shane AT moodle.com
+ * @author vy-shane AT moodle.com
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package groups
*/
if(singleSelection) {
createLoaderImg("membersloader", "memberslabel", this.wwwRoot);
}
-
+
// Update the label.
var spanEl = document.getElementById("thegroup");
if (singleSelection) {
selectEl.removeChild(selectEl.firstChild);
}
}
-
+
document.getElementById("showaddmembersform").disabled = !singleSelection;
document.getElementById("showeditgroupsettingsform").disabled = !singleSelection;
document.getElementById("deletegroup").disabled = selectionCount == 0;
$selectedname = $groupname;
}
}
-
+
echo "<option value=\"{$group->id}\"$select title=\"$groupname\">$groupname</option>\n";
}
} else {
function groups_create_group($data, $editform=false) {
global $CFG, $DB;
require_once("$CFG->libdir/gdlib.php");
-
+
//check that courseid exists
$course = $DB->get_record('course', array('id' => $data->courseid), '*', MUST_EXIST);
/**
* Obtains a list of the possible roles that group members might come from,
- * on a course. Generally this includes all the roles who would have
+ * on a course. Generally this includes all the roles who would have
* course:view on that course, except the doanything roles.
* @param object $context Context of course
* @return Array of role ID integers, or false if error/none.
return $validroleids;
} else {
return false; // No need to continue, since no roles have this capability set
- }
+ }
}
/**
* Lists users in a group based on their role on the course.
- * Returns false if there's an error or there are no users in the group.
+ * Returns false if there's an error or there are no users in the group.
* Otherwise returns an array of role ID => role data, where role data includes:
* (role) $id, $shortname, $name
* $users: array of objects for each user which include the specified fields
global $CFG, $DB;
// Retrieve information about all users and their roles on the course or
- // parent ('related') contexts
+ // parent ('related') contexts
$context = get_context_instance(CONTEXT_COURSE, $courseid);
if ($extrawheretest) {
u.id AS userid, $fields
FROM {groups_members} gm
JOIN {user} u ON u.id = gm.userid
- JOIN {role_assignments} ra ON ra.userid = u.id
+ JOIN {role_assignments} ra ON ra.userid = u.id
JOIN {role} r ON r.id = ra.roleid
WHERE gm.groupid=?
AND ra.contextid ".get_related_contexts_string($context).
*
* @param object $rs The record set (may be false)
* @param int $contextid ID of course context
- * @return array As described in groups_get_members_by_role
+ * @return array As described in groups_get_members_by_role
*/
function groups_calculate_role_people($rs, $context) {
global $CFG, $DB;
$potentialmembersselector = new group_non_members_selector('addselect',
array('groupid' => $groupid, 'courseid' => $course->id));
$potentialmembersselector->set_extra_fields(array());
-
+
if (optional_param('add', false, PARAM_BOOL) && confirm_sesskey()) {
$userstoadd = $potentialmembersselector->get_selected_users();
if (!empty($userstoadd)) {
}
function test_add_group_members3() {
- //the user is not a participant
+ //the user is not a participant
$params = array(array("groupid" => $this->group->id, "userid" => $this->userid5));
$this->expectException(new moodle_exception('userisnotaparticipant'));
$result = group_external::add_groupmembers($params);
-
+
}
function test_get_groupmembers() {
$groups = group_external::get_groupmembers($params);
$this->assertEqual(sizeof($groups), 2);
$this->assertEqual(sizeof($groups[0]['members']), 2);
- $this->assertEqual(sizeof($groups[1]['members']), 1);
+ $this->assertEqual(sizeof($groups[1]['members']), 1);
}
function test_delete_group_members() {
ini_set('include_path', $CFG->libdir.'/pear' . PATH_SEPARATOR . ini_get('include_path'));
//point zend include path to moodles lib/zend so that includes and requires will search there for files before anywhere else
ini_set('include_path', $CFG->libdir.'/zend' . PATH_SEPARATOR . ini_get('include_path'));
-
+
require('version.php');
$CFG->target_release = $release;
The file stringnames.txt contains a list of all the strings used during the install process.
-A daily cron job will pick up the changes to this file and update all the language files
+A daily cron job will pick up the changes to this file and update all the language files
(ie those in install/lang/*/install.php) automatically.
marker.gif
custom made in Inkscape
-Petr Skoda (skodak), January 2008
+Petr Skoda (skodak), January 2008
}
$this->reposition_block($block->instance->id, $newregion, $newweight);
}
-
+
$this->page->ensure_param_not_in_url('bui_moveid');
$this->page->ensure_param_not_in_url('bui_newregion');
$this->page->ensure_param_not_in_url('bui_newweight');
} else {
$this->debug = false;
}
- }
+ }
/**
* Setup for Functions
*
* @param string $method
* @param array $params
- * @return array
+ * @return array
*/
function makeRequest($method, $params = array()) {
$this->_clearErrors();
}
/**
* @param array $params
- * @return array
+ * @return array
*/
function getTicket($params = array()) {
$params['api_key'] = $this->api_key;
$tmp = array('title'=>(string)$file->attributes()->file_name,
'size'=>display_size((int)$file->attributes()->size),
'thumbnail'=>$thumbnail,
- 'date'=>userdate((int)$file->attributes()->updated),
+ 'date'=>userdate((int)$file->attributes()->updated),
'source'=>'http://box.net/api/1.0/download/'
.$this->auth_token.'/'.(string)$file->attributes()->id,
'url'=>(string)$file->attributes()->shared_link);
return $ret_array;
}
- /**
+ /**
* Upload a File
* @param array $params the file MUST be present in key 'file' and be a moodle stored_file object.
* @return array|bool Array or false
<?php
-// This file is part of Moodle - http://moodle.org/
-//
+// 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
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This is a one-line short description of the file
*
- * You can have a rather longer description of the file as well,
+ * You can have a rather longer description of the file as well,
* if you like, and it can span multiple lines.
- *
+ *
* @copyright Petr Skoda
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package moodlecore
<?php
-// This file is part of Moodle - http://moodle.org/
-//
+// 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
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
$messageproviders = array (
/// Notices that an admin might be interested in
- 'notices' => array (
+ 'notices' => array (
'capability' => 'moodle/site:config'
),
'instantmessage' => array (
),
-
+
);
}
}
}
-
+
return(array('newnav' => true, 'navlinks' => array()));
}
global variables
Note:
-if I didn't use global variables, we would need to pass them as parameter:
-=> in initSelect():
+if I didn't use global variables, we would need to pass them as parameter:
+=> in initSelect():
I would write "theSelect.onchange = selectChanged(...);"
This code causes a javascript error on IE. (not firefox)
so I had to write theSelect.onchange = selectChanged; It's why I use global variables .
Because I use global variables, I didn't put this code in javascript-static.js.
This file is loaded in javascript.php.
-*/
+*/
var select_formid;
var select_targetwindow;
theSelect.onchange = selectChanged;
theSelect.onkeydown = selectKeyed;
theSelect.onclick = selectClicked;
-
+
return true;
}
function selectChanged(theElement)
{
var theSelect;
-
+
if (theElement && theElement.value)
{
theSelect = theElement;
{
theSelect = this;
}
-
+
if (!theSelect.changed)
{
return false;
}
//here is the onchange redirection
- select_targetwindow.location=document.getElementById(select_formid).jump.options[document.getElementById(select_formid).jump.selectedIndex].value;
-
+ select_targetwindow.location=document.getElementById(select_formid).jump.options[document.getElementById(select_formid).jump.selectedIndex].value;
+
return true;
}
function selectFocussed()
{
this.initValue = this.value;
-
+
return true;
}
var keyCodeTab = "9";
var keyCodeEnter = "13";
var keyCodeEsc = "27";
-
+
if (e)
{
theEvent = e;
{
this.changed = false;
}
-
+
return true;
}
\ No newline at end of file
-<?xml version="1.0" encoding="utf-8" ?>
-<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <xs:element name="moodle_database" type="databaseType" />
+<?xml version="1.0" encoding="utf-8" ?>
+<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="moodle_database" type="databaseType" />
<xs:complexType name="databaseType">
<xs:sequence>
<xs:element maxOccurs="unbounded" name="table"
use="required" />
<xs:attribute name="comment" type="xs:string" />
</xs:complexType>
- <xs:complexType name="tableType">
- <xs:sequence>
- <xs:element maxOccurs="unbounded" name="record" type="recordType" />
- </xs:sequence>
- <xs:attribute name="name" type="xs:NCName" use="required" />
- <xs:attribute name="schemaHash" type="xs:string" use="required" />
- </xs:complexType>
- <xs:complexType name="recordType">
- <xs:sequence>
- <xs:element maxOccurs="unbounded" name="field" type="fieldType" />
- </xs:sequence>
- </xs:complexType>
- <xs:complexType name="fieldType">
- <xs:simpleContent>
- <xs:extension base="xs:string">
- <xs:attribute name="name" type="xs:string" use="required" />
- <xs:attribute default="content" name="value" use="optional">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:enumeration value="content" />
- <xs:enumeration value="null" />
- </xs:restriction>
- </xs:simpleType>
- </xs:attribute>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
+ <xs:complexType name="tableType">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" name="record" type="recordType" />
+ </xs:sequence>
+ <xs:attribute name="name" type="xs:NCName" use="required" />
+ <xs:attribute name="schemaHash" type="xs:string" use="required" />
+ </xs:complexType>
+ <xs:complexType name="recordType">
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" name="field" type="fieldType" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="fieldType">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute name="name" type="xs:string" use="required" />
+ <xs:attribute default="content" name="value" use="optional">
+ <xs:simpleType>
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="content" />
+ <xs:enumeration value="null" />
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
</xs:schema>
<?php
-// This file is part of Moodle - http://moodle.org/
-//
+// 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
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This class abstracts eaccelerator/turckmmcache
* API to provide
- *
+ *
* - get()
* - set()
* - delete()
* - releaseforfill()
*
* Note: do NOT store booleans here. For compatibility with
- * memcached, a false value is indistinguisable from a
+ * memcached, a false value is indistinguisable from a
* "not found in cache" response.
*
* @copyright Martin Langhoff <martin@catalyst.net.nz>
return false;
}
return unserialize($rec);
- }
-
+ }
+
/**
* @todo Document this function
*
* @param string $key
* @return mixed
- */
+ */
function delete($key) {
$fn = $this->mode . '_rm';
return $fn($this->prefix . $key);
}
/**
- * In the simple case, this function will
+ * In the simple case, this function will
* get the cached value if available. If the entry
* is not cached, it will try to get an exclusive
* lock that announces that this process will
* populate the cache.
*
* If we fail to get the lock -- this means another
- * process is doing it.
+ * process is doing it.
* so we wait (block) for a few microseconds while we wait for
* the cache to be filled or the lock to timeout.
- *
+ *
* If you get a false from this call, you _must_
* populate the cache ASAP or indicate that
* you won't by calling releaseforfill().
*
- * This technique forces serialisation and so helps deal
- * with thundering herd scenarios where a lot of clients
- * ask the for the same idempotent (and costly) operation.
+ * This technique forces serialisation and so helps deal
+ * with thundering herd scenarios where a lot of clients
+ * ask the for the same idempotent (and costly) operation.
* The implementation is based on suggestions in this message
* http://marc.theaimsgroup.com/?l=git&m=116562052506776&w=2
*
function getforfill ($key) {
$get = $this->mode . '_get';
$lock = $this->mode . '_lock';
-
+
$rec = $get($this->prefix . $key);
if (!is_null($rec)) {
return unserialize($rec);
}
/**
- * Release the exclusive lock obtained by
+ * Release the exclusive lock obtained by
* getforfill(). See getforfill()
* for more details.
*
NAME
EvalMath - safely evaluate math expressions
-
+
SYNOPSIS
<?
include('evalmath.class.php');
// and then use them
$result = $m->evaluate('3*f(42,a)');
?>
-
+
DESCRIPTION
- Use the EvalMath class when you want to evaluate mathematical expressions
+ Use the EvalMath class when you want to evaluate mathematical expressions
from untrusted sources. You can define your own variables and functions,
which are stored in the object. Try it, it's fun!
Evaluates the expression and returns the result. If an error occurs,
prints a warning and returns false. If $expr is a function assignment,
returns true on success.
-
+
$m->e($expr)
A synonym for $m->evaluate().
-
+
$m->vars()
Returns an associative array of all user-defined variables and values.
-
+
$m->funcs()
Returns an array of all user-defined functions.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
-
+
1 Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
3. The name of the author may not be used to endorse or promote
products derived from this software without specific prior written
permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
/**
* This class was heavily modified in order to get usefull spreadsheet emulation ;-)
* skodak
- *
+ *
*/
class EvalMath {
var $suppress_errors = false;
var $last_error = null;
-
+
var $v = array(); // variables (and constants)
var $f = array(); // user-defined functions
var $vb = array(); // constants
'average'=>array(-1), 'max'=>array(-1), 'min'=>array(-1),
'mod'=>array(2), 'pi'=>array(0), 'power'=>array(2),
'round'=>array(1, 2), 'sum'=>array(-1));
-
+
function EvalMath() {
}
-
+
function e($expr) {
return $this->evaluate($expr);
}
-
+
function evaluate($expr) {
$this->last_error = null;
$expr = trim($expr);
return $this->pfx($this->nfx($expr)); // straight up evaluation, woo
}
}
-
+
function vars() {
return $this->v;
}
-
+
function funcs() {
$output = array();
foreach ($this->f as $fnn=>$dat)
// Convert infix to postfix notation
function nfx($expr) {
-
+
$index = 0;
$stack = new EvalMathStack;
$output = array(); // postfix form of expression, to be passed to pfx()
$expr = trim(strtolower($expr));
-
+
$ops = array('+', '-', '*', '/', '^', '_');
- $ops_r = array('+'=>0,'-'=>0,'*'=>0,'/'=>0,'^'=>1); // right-associative operator?
+ $ops_r = array('+'=>0,'-'=>0,'*'=>0,'/'=>0,'^'=>1); // right-associative operator?
$ops_p = array('+'=>0,'-'=>0,'*'=>1,'/'=>1,'_'=>1,'^'=>2); // operator precedence
-
+
$expecting_op = false; // we use this in syntax-checking the expression
// and determining when a - is a negation
-
+
if (preg_match("/[^\w\s+*^\/()\.,-]/", $expr, $matches)) { // make sure the characters are all good
return $this->trigger("illegal character '{$matches[0]}'");
}
-
+
while(1) { // 1 Infinite Loop ;)
$op = substr($expr, $index, 1); // get the first character at the current index
// find out if we're currently at the beginning of a number/variable/function/parenthesis/operand
if ($op == '-' and !$expecting_op) { // is it a negation instead of a minus?
$stack->push('_'); // put a negation on the stack
$index++;
- } elseif ($op == '_') { // we have to explicitly deny this, because it's legal on the stack
+ } elseif ($op == '_') { // we have to explicitly deny this, because it's legal on the stack
return $this->trigger("illegal character '_'"); // but not in the input expression
//===============
} elseif ((in_array($op, $ops) or $ex) and $expecting_op) { // are we putting an operator on the stack?
$index++;
//===============
} elseif ($op == ',' and $expecting_op) { // did we just finish a function argument?
- while (($o2 = $stack->pop()) != '(') {
+ while (($o2 = $stack->pop()) != '(') {
if (is_null($o2)) return $this->trigger("unexpected ','"); // oops, never had a (
else $output[] = $o2; // pop the argument expression stuff and push onto the output
}
break;
}
}
- while (substr($expr, $index, 1) == ' ') { // step the index past whitespace (pretty much turns whitespace
+ while (substr($expr, $index, 1) == ' ') { // step the index past whitespace (pretty much turns whitespace
$index++; // into implicit multiplication if no operator is there)
}
-
- }
+
+ }
while (!is_null($op = $stack->pop())) { // pop everything off the stack and push onto output
if ($op == '(') return $this->trigger("expecting ')'"); // if there are (s on the stack, ()s were unbalanced
$output[] = $op;
// evaluate postfix notation
function pfx($tokens, $vars = array()) {
-
+
if ($tokens == false) return false;
-
+
$stack = new EvalMathStack;
-
+
foreach ($tokens as $token) { // nice and easy
// if the token is a function, pop arguments off the stack, hand them to the function, and push the result back on
if ($stack->count != 1) return $this->trigger("internal error");
return $stack->pop();
}
-
+
// trigger an error, but nicely, if need be
function trigger($msg) {
$this->last_error = $msg;
var $stack = array();
var $count = 0;
-
+
function push($val) {
$this->stack[$this->count] = $val;
$this->count++;
}
-
+
function pop() {
if ($this->count > 0) {
$this->count--;
}
return null;
}
-
+
function last($n=1) {
if ($this->count - $n >= 0) {
return $this->stack[$this->count-$n];
$str .= $PAGE->requires->js_function_call('destroy_item', array("{$id}_filemanager"))->asap();
}
} else {
- // should disable file picker
+ // should disable file picker
$str .= 'No file allowed';
}
// hide file browser and breadcrumb
container.style.display='none';
if (options.path.length <= 1) {
- breadcrumb.style.display='none';
+ breadcrumb.style.display='none';
}
return;
} else {
container.style.display='block';
- breadcrumb.style.display='block';
+ breadcrumb.style.display='block';
}
count = 0;
for(var i in list) {
}
break;
}
- var fullname = list[i].fullname;
+ var fullname = list[i].fullname;
if (ismainfile) {
fullname = "<strong>"+list[i].fullname+"</strong> <img src='"+moodle_cfg.wwwroot+"/pix/i/tick_green_small.gif"+"' />";
}
var rootNode = tree.getRoot();
tree.setDynamicLoad(this.loadDataForNode);
- tree.removeChildren(rootNode);
+ tree.removeChildren(rootNode);
var textnode = {label: "Files", path: '/', itemid: obj.itemid};
var tmpNode = new YAHOO.widget.TextNode(textnode, rootNode, true);
tree.draw();
fm_cfg[client_id] = options;
fm_cfg[client_id].mainfile = options.mainfile;
fm_cfg[client_id].currentpath = '/';
- fm_cfg[client_id].currentfiles = 0;
+ fm_cfg[client_id].currentfiles = 0;
// XXX: When editing existing folder, currentfiles shouldn't
// be 0
- fm_cfg[client_id].maxfiles = options.maxfiles;
+ fm_cfg[client_id].maxfiles = options.maxfiles;
if (options.mainfile) {
var mainfilename = document.getElementById(options.mainfile+'-id');
if (mainfilename.value) {
success:function(o) {
var result = json_decode(o.responseText);
refresh_filemanager(result.filepath, fm_cfg[this.client_id]);
- var win = window.open(result.fileurl, 'fm-download-folder');
+ var win = window.open(result.fileurl, 'fm-download-folder');
if (!win) {
alert(mstr.repository.popupblockeddownload);
}
function MoodleQuickForm_header($elementName = null, $text = null) {
parent::HTML_QuickForm_header($elementName, $text);
}
-
+
// {{{ accept()
/**
function MoodleQuickForm_hidden($elementName=null, $value='', $attributes=null) {
parent::HTML_QuickForm_hidden($elementName, $value, $attributes);
}
-
+
/**
* set html for help button
*
function MoodleQuickForm_text($elementName=null, $elementLabel=null, $attributes=null) {
parent::HTML_QuickForm_text($elementName, $elementLabel, $attributes);
}
-
+
function setHiddenLabel($hiddenLabel){
$this->_hiddenLabel = $hiddenLabel;
}
<?php
-// This file is part of Moodle - http://moodle.org/
-//
+// 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
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
-//
+//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
* @global object
* @param object $dst_img
* @param object $src_img
- * @param int $dst_x
- * @param int $dst_y
- * @param int $src_x
- * @param int $src_y
- * @param int $dst_w
- * @param int $dst_h
- * @param int $src_w
- * @param int $src_h
+ * @param int $dst_x
+ * @param int $dst_y
+ * @param int $src_x
+ * @param int $src_y
+ * @param int $dst_w
+ * @param int $dst_h
+ * @param int $src_w
+ * @param int $src_h
* @return bool
* @todo Finish documenting this function
*/
return false;
}
}
-
+
if ($dir == 'user') {
$destination = make_user_directory($id, true);
} else {
# On some PHP servers it may help if this file is copied
# to the main moodle directory and renamed .htaccess
#
-# As soon as you do this, check your web site. Is it
+# As soon as you do this, check your web site. Is it
# still working OK? If you are getting a "configuration
# error" then you may need to enable overrides by editing
# the main httpd.conf for Apache and in the main server
# or virtual server area, adding something like:
#
# <Directory /web/moodle>
-# AllowOverride All
+# AllowOverride All
# </Directory>
#
### Firstly, if you are using Apache 2, you need the following
-### three lines to allow Apache to pass a PATH_INFO variable
+### three lines to allow Apache to pass a PATH_INFO variable
### correctly for URLs like http://server/file.php/arg1/arg2
<IfDefine APACHE2>
LimitRequestBody 0
-### These are optional - you may not want to override php.ini
+### These are optional - you may not want to override php.ini
### To enable them, remove the leading hash (#)
#php_value upload_max_filesize 2M
#php_value session.gc_maxlifetime 7200
-### You can change the following line to point to the
-### error/index.php file in your Moodle distribution.
-### It provides a form which emails you (the admin)
+### You can change the following line to point to the
+### error/index.php file in your Moodle distribution.
+### It provides a form which emails you (the admin)
### about 404 errors (URL not found).
#ErrorDocument 404 http://example.org/moodle/error/index.php
}
YAHOO.moodle.navigation.tabpanel.remove_from_tab_panel(this.name);
-
+
var block = this.cachedcontent;
while (!YAHOO.util.Dom.hasClass(block, 'sideblock')) {
block = block.parentNode;
}
/**
* Replacement for getElementsByClassName in browsers that aren't cool enough
- *
+ *
* Relying on the built-in getElementsByClassName is far, far faster than
* using YUI.
- *
+ *
* Note: the third argument used to be an object with odd behaviour. It now
* acts like the 'name' in the HTML5 spec, though the old behaviour is still
* mimicked if you pass an object.
###############################################################################
{
$string = kses_no_null($string);
- $string = preg_replace('/([^\xc3-\xcf])\xad+/', '\\1', $string); # deals with Opera "feature" -- moodle utf8 fix
+ $string = preg_replace('/([^\xc3-\xcf])\xad+/', '\\1', $string); # deals with Opera "feature" -- moodle utf8 fix
$string2 = $string.'a';
while ($string != $string2)
/**
* Archive files and store the result in file storage
- * @param array $files array with zip paths as keys (archivepath=>ospathname or archivepath=>stored_file)
+ * @param array $files array with zip paths as keys (archivepath=>ospathname or archivepath=>stored_file)
* @param int $contextid
* @param string $filearea
* @param int $itemid
/**
* Archive files and store the result in os file
- * @param array $files array with zip paths as keys (archivepath=>ospathname or archivepath=>stored_file)
+ * @param array $files array with zip paths as keys (archivepath=>ospathname or archivepath=>stored_file)
* @param string $archivefile path to target zip file
* @return bool success
*/
/**
* Zip files and store the result in file storage
- * @param array $files array with full zip paths (including directory information) as keys (archivepath=>ospathname or archivepath/subdir=>stored_file)
+ * @param array $files array with full zip paths (including directory information) as keys (archivepath=>ospathname or archivepath/subdir=>stored_file)
* @param int $contextid
* @param string $filearea
* @param int $itemid
/**
* Zip files and store the result in os file
- * @param array $files array with zip paths as keys (archivepath=>ospathname or archivepath=>stored_file)
+ * @param array $files array with zip paths as keys (archivepath=>ospathname or archivepath=>stored_file)
* @param string $archivefile path to target zip file
* @return bool success
*/
$result .= rss_full_tag('link',3,false,$item->link);
$result .= rss_add_enclosures($item);
$result .= rss_full_tag('pubDate',3,false,gmdate('D, d M Y H:i:s',$item->pubdate).' GMT'); # MDL-12563
- //Include the author if exists
+ //Include the author if exists
if (isset($item->author)) {
//$result .= rss_full_tag('author',3,false,$item->author);
//We put it in the description instead because it's more important
*/
class moodle_simplepie extends SimplePie
{
- /**
+ /**
* Constructor - creates an instance of the SimplePie class
* with Moodle defaults.
*
- * @param string $feedurl optional URL of the feed
+ * @param string $feedurl optional URL of the feed
*/
function __construct($feedurl = null) {
}
/**
- * Reset RSS cache
+ * Reset RSS cache
*
* @return boolean success if cache clear or didn't exist
*/
$this->method = SIMPLEPIE_FILE_SOURCE_REMOTE | SIMPLEPIE_FILE_SOURCE_CURL;
$curl = new curl();
- $curl->setopt( array(
+ $curl->setopt( array(
'CURLOPT_HEADER' => true,
'CURLOPT_TIMEOUT' => $timeout,
'CURLOPT_CONNECTTIMEOUT' => $timeout ));
Local customisations directory
==============================
-This directory is the recommended place for local customisations.
+This directory is the recommended place for local customisations.
Wherever possible, customisations should be written using one of the
standard plug-in points like modules, blocks, auth plugins, themes, etc.
Custom event handlers
---------------------
Events intended primarily for communication "core --> plugins". (It should not
-be use in opposite direction!) In theory it could be also used for
+be use in opposite direction!) In theory it could be also used for
"plugin --> plugin" communication too. The list of core events is documented
in lib/db/events.php
$handlers = array (
'user_deleted' => array (
'handlerfile' => '/local/nicehack/lib.php',
- 'handlerfunction' => 'nicehack_userdeleted_handler',
+ 'handlerfunction' => 'nicehack_userdeleted_handler',
'schedule' => 'instant'
),
);
icon.gif: a 16x16 icon for the module
db/install.xml: an SQL dump of all the required db tables and data
-
+
index.php: a page to list all instances in a course
view.php: a page to view a particular instance
If you are a developer and interested in developing new Modules see:
-
+
Moodle Documentation: http://moodle.org/doc
Moodle Community: http://moodle.org/community
* rewrite trusstext support - new db table columns needed
* migrade all module features from mod_edit.php form to lib.php/modulename_supports() function
* implement new gradebook support (legacy 1.8.x grading not supported anymore)
-* migrate custom resource module subtypes into separate modules
+* migrate custom resource module subtypes into separate modules
optional - no changes needed in older code:
* portfolio support
-<?php
+<?php
// Outputs pictures from theme or core pix folder. Only used if $CFG->smartpix is
// turned on.
$matches=array(); // Reusable array variable for preg_match
-
+
// This does NOT use config.php. This is because doing that makes database requests
// which cause this to take longer (I benchmarked this at 16ms, 256ms with config.php)
// A version using normal Moodle functions is included in comment at end in case we
-// want to switch to it in future.
+// want to switch to it in future.
function error($text,$notfound=false) {
header($notfound ? 'HTTP/1.0 404 Not Found' : 'HTTP/1.0 500 Internal Server Error');
return $url;
}
}
-
+
// get query string
function get_query($name) {
if (!empty($_SERVER['REQUEST_URI'])) {
}
// Nicked from weblib then cutdown
/**
- * Extracts file argument either from file parameter or PATH_INFO.
+ * Extracts file argument either from file parameter or PATH_INFO.
* @param string $scriptname name of the calling script
* @return string file path (only safe characters)
*/
if (!empty($arr[1])) {
return makesafe(rawurldecode(strip_querystring($arr[1])));
}
-
+
error('Unexpected PHP set up. Turn off the smartpix config option.');
-}
-
+}
+
// We do need to get dirroot from config.php
if(!$config=@file_get_contents(dirname(__FILE__).'/../config.php')) {
error("Can't open config.php");
$file=$possibility;
} else {
// Is there a parent theme?
- while(true) {
+ while(true) {
require("$dirroot/theme/$theme/config.php"); // Sets up $THEME
if(!$THEME->parent) {
break;
- }
+ }
$theme=$THEME->parent;
if(file_exists($possibility="$dirroot/theme/$theme/pix/$path")) {
$file=$possibility;
// Found in parent theme
break;
- }
+ }
}
if(!$file) {
if(preg_match('|^mod/|',$path)) {
}
header('Last-Modified: '.gmdate('D, d M Y H:i:s',$filedate).' GMT');
-// As I'm not loading config table from DB, this is hardcoded here; expiry
+// As I'm not loading config table from DB, this is hardcoded here; expiry
// 4 hours, unless the hacky file reduceimagecache.dat exists in dataroot
if(file_exists($reducefile=$dataroot.'/reduceimagecache.dat')) {
$lifetime=file_read_contents($reducefile);
-} else {
+} else {
$lifetime=4*60*60;
}
fclose($handle);
// Slower Moodle-style version follows:
-
+
//// Outputs pictures from theme or core pix folder. Only used if $CFG->smartpix is
//// turned on.
//
//global $CFG;
//
//$matches=array(); // Reusable array variable for preg_match
-//
+//
//// Split path - starts with theme name, then actual image path inside pix
//$path=get_file_argument('smartpix.php');
//$match=array();
// $file=$possibility;
//} else {
// // Is there a parent theme?
-// while(true) {
+// while(true) {
// require("$CFG->dirroot/theme/$theme/config.php"); // Sets up $THEME
// if(!$THEME->parent) {
// break;
-// }
+// }
// $theme=$THEME->parent;
// if(file_exists($possibility="$CFG->dirroot/theme/$theme/pix/$path")) {
// $file=$possibility;
// // Found in parent theme
// break;
-// }
+// }
// }
// if(!$file) {
// if(preg_match('|^mod/|',$path)) {
$lifetime = 3600; // Seconds for files to remain in caches - 1 hour
// this is a big one big hack - NO_MOODLE_COOKIES is not compatible with capabilities MDL-7243
- // it should be replaced once we get to codes in urls
+ // it should be replaced once we get to codes in urls
$relativepath = get_file_argument();
$context = get_context_instance(CONTEXT_COURSE, $course->id);
$isuser = has_capability('moodle/course:view', $context, $userid);
}
-
+
//Check for "security" if !course->guest or course->password
if ($course->id != SITEID) {
if ((!$course->guest || $course->password) && (!$isuser)) {
// It's a security risk to carry that in $SESSION so we put up login form.
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/sso/hive/expired.php'));
echo $OUTPUT->header();
- echo $OUTPUT->notification('Your session has expired. Please log in again.');
+ echo $OUTPUT->notification('Your session has expired. Please log in again.');
?>
<form action="login.php" method="post" id="login">
<table border="0" align="center">
require_login();
- // get the login data
+ // get the login data
$frm = data_submitted();
// log back into Hive
- if (sso_user_login($frm->username, $frm->password)) {
+ if (sso_user_login($frm->username, $frm->password)) {
/// reopen Hive
redirect($CFG->wwwroot.'/mod/resource/type/repository/hive/openlitebrowse.php');
document.getElementById('id_relatedtags').style.width = '30%';
myAutoComp.allowBrowserAutocomplete = false;
myAutoComp.maxResultsDisplayed = 20;
- myAutoComp.delimChar = [","," "];
+ myAutoComp.delimChar = [","," "];
myAutoComp.formatResult = function(oResultData, sQuery, sResultMatch) {
return (sResultMatch);
};
print_error('tagsaredisabled', 'tag');
}
-$query = optional_param('query', '', PARAM_RAW);
+$query = optional_param('query', '', PARAM_RAW);
if ($similar_tags = tag_autocomplete($query)) {
foreach ($similar_tags as $tag) {
public function initApp():void{
moodleWebServices = new RemoteObject();
- var cs:ChannelSet = new ChannelSet();
+ var cs:ChannelSet = new ChannelSet();
cs.addChannel(new AMFChannel("myAmf", Application.application.parameters.amfurl));
- moodleWebServices.destination = "Dest";
+ moodleWebServices.destination = "Dest";
moodleWebServices.channelSet = cs;
moodleWebServices.showBusyCursor = true;
moodleWebServices.get_users.addEventListener('result', handleReturnGetUsers);
moodleWebServices.update_users.addEventListener('result', handleReturn);
moodleWebServices.create_users.addEventListener('result', handleReturn);
-
+
moodleWebServices.addEventListener('fault', handleFault);
moodleWebServices.addEventListener('result', handleReturn);
-
+
print_props('Application.application.parameters.amfurl', Application.application.parameters.amfurl);
print_props('moodleWebServices', moodleWebServices);
getUsers('');
import mx.events.DataGridEvent;
private function itemEditEndEvent(event:DataGridEvent):void {
print_props('event:DataGridEvent', event);
- var newData:String=
+ var newData:String=
TextInput(event.currentTarget.itemEditorInstance).text;
if (newData!=userlist.editedItemRenderer.data[event.dataField])
{
var invalid:Boolean = false;
vResult = usernameValidator.validate();
- if (vResult.type==ValidationResultEvent.INVALID)
+ if (vResult.type==ValidationResultEvent.INVALID)
invalid=true;
vResult = passwordValidator.validate();
- if (vResult.type==ValidationResultEvent.INVALID)
+ if (vResult.type==ValidationResultEvent.INVALID)
invalid=true;
vResult = firstnameValidator.validate();
- if (vResult.type==ValidationResultEvent.INVALID)
+ if (vResult.type==ValidationResultEvent.INVALID)
invalid=true;
vResult = lastnameValidator.validate();
- if (vResult.type==ValidationResultEvent.INVALID)
+ if (vResult.type==ValidationResultEvent.INVALID)
invalid=true;
vResult = emailValidator.validate();
- if (vResult.type==ValidationResultEvent.INVALID)
+ if (vResult.type==ValidationResultEvent.INVALID)
invalid=true;
if (invalid){
return;
}
var itemToAdd:Object=
{status:'to insert',
- username : username.text,
- idnumber : idnumber.text,
- firstname : firstname.text,
- lastname : lastname.text,
- email : email.text,
- password : password.text,
- auth : auth.text,
- confirmed : confirmed.text,
- timezone : timezone.text,
- country : country.text,
- emailstop : emailstop.text,
- theme : theme.text,
- lang : lang.text,
+ username : username.text,
+ idnumber : idnumber.text,
+ firstname : firstname.text,
+ lastname : lastname.text,
+ email : email.text,
+ password : password.text,
+ auth : auth.text,
+ confirmed : confirmed.text,
+ timezone : timezone.text,
+ country : country.text,
+ emailstop : emailstop.text,
+ theme : theme.text,
+ lang : lang.text,
mailformat : mailformat.text};
if (initDG==null){
initData(new Array(itemToAdd))
- <mx:DataGrid id ="userlist" itemEditEnd="itemEditEndEvent(event);" editable="true" width="100%" height="400"
- dataProvider="{initDG}" >
+ <mx:DataGrid id ="userlist" itemEditEnd="itemEditEndEvent(event);" editable="true" width="100%" height="400"
+ dataProvider="{initDG}" >
<mx:columns>
<mx:Button id="button_update_users" label="Call update_users" click="updateUsers();true;"/>
<mx:Button id="button_create_users" label="Call create_users" click="createUsers();true;"/>
</mx:HBox>
-
+
</mx:VBox>
<mx:Form width="500" defaultButton="{create_users}" label="Add A User">
ini_set('soap.wsdl_cache_enabled', '0');
require_once 'Zend/Soap/Server.php';
require_once 'Zend/Soap/AutoDiscover.php';
-
+
if (optional_param('wsdl', 0, PARAM_BOOL)) {
parent::__construct($simple, 'Zend_Soap_AutoDiscover');
} else {
} else {
$info = 'Unknown error';
}
-
+
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body><SOAP-ENV:Fault>