-<?php //$Id$
-
-/***
- *** olson_to_timezones ($filename)
- ***
- *** Parses the olson files for Zones and DST rules.
- *** It updates the Moodle database with the Zones/DST rules
- ***
- *** Returns true/false
- ***
+<?php
+
+// 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
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// 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/>.
+
+/**
+ * @package moodlecore
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+/**
+ * olson_to_timezones ($filename)
+ *
+ * Parses the olson files for Zones and DST rules.
+ * It updates the Moodle database with the Zones/DST rules
+ *
+ * @param string $filename
+ * @return bool true/false
+ *
*/
function olson_to_timezones ($filename) {
}
-/***
- *** olson_simple_rule_parser($filename)
- ***
- *** Parses the olson files for DST rules.
- *** It's a simple implementation that simplifies some fields
- ***
- *** Returns a multidimensional array, or false on error
- ***
+/**
+ * olson_simple_rule_parser($filename)
+ *
+ * Parses the olson files for DST rules.
+ * It's a simple implementation that simplifies some fields
+ *
+ * @return array a multidimensional array, or false on error
+ *
*/
function olson_simple_rule_parser ($filename) {
return $moodle_rules;
}
-/***
- *** olson_simple_zone_parser($filename)
- ***
- *** Parses the olson files for zone info
- ***
- *** Returns a multidimensional array, or false on error
- ***
+/**
+ * olson_simple_zone_parser($filename)
+ *
+ * Parses the olson files for zone info
+ *
+ * @return array a multidimensional array, or false on error
+ *
*/
function olson_simple_zone_parser ($filename) {
return $zones;
}
-/***
- *** olson_parse_offset($offset)
- ***
- *** parses time offsets from the GMTOFF and SAVE
- *** fields into +/-MINUTES
+/**
+ * olson_parse_offset($offset)
+ *
+ * parses time offsets from the GMTOFF and SAVE
+ * fields into +/-MINUTES
+ *
+ * @return int
*/
function olson_parse_offset ($offset) {
$offset = trim($offset);
}
-/***
- *** olson_parse_on_($on)
- ***
- *** see `man zic`. This function translates the following formats
- *** 5 the fifth of the month
- *** lastSun the last Sunday in the month
- *** lastMon the last Monday in the month
- *** Sun>=8 first Sunday on or after the eighth
- *** Sun<=25 last Sunday on or before the 25th
- ***
- *** to a moodle friendly format. Returns an array with:
- ***
- *** startday: the day of the month that we start counting from.
- *** if negative, it means we start from that day and
- *** count backwards. since -1 would be meaningless,
- *** it means "end of month and backwards".
- *** weekday: the day of the week that we must find. we will
- *** scan days from the startday until we find the
- *** first such weekday. 0...6 = Sun...Sat.
- *** -1 means that any day of the week will do,
- *** effectively ending the search on startday.
- *** skipweeks:after finding our end day as outlined above,
- *** skip this many weeks. this enables us to find
- *** "the second sunday >= 10". usually will be 0.
+/**
+ * olson_parse_on_($on)
+ *
+ * see `man zic`. This function translates the following formats
+ * 5 the fifth of the month
+ * lastSun the last Sunday in the month
+ * lastMon the last Monday in the month
+ * Sun>=8 first Sunday on or after the eighth
+ * Sun<=25 last Sunday on or before the 25th
+ *
+ * to a moodle friendly format. Returns an array with:
+ *
+ * startday: the day of the month that we start counting from.
+ * if negative, it means we start from that day and
+ * count backwards. since -1 would be meaningless,
+ * it means "end of month and backwards".
+ * weekday: the day of the week that we must find. we will
+ * scan days from the startday until we find the
+ * first such weekday. 0...6 = Sun...Sat.
+ * -1 means that any day of the week will do,
+ * effectively ending the search on startday.
+ * skipweeks:after finding our end day as outlined above,
+ * skip this many weeks. this enables us to find
+ * "the second sunday >= 10". usually will be 0.
*/
function olson_parse_on ($on) {
}
-/***
- *** olson_parse_at($at, $set, $gmtoffset)
- ***
- *** see `man zic`. This function translates
- ***
- *** 2 time in hours
- *** 2:00 time in hours and minutes
- *** 15:00 24-hour format time (for times after noon)
- *** 1:28:14 time in hours, minutes, and seconds
- ***
- *** Any of these forms may be followed by the letter w if the given
- *** time is local "wall clock" time, s if the given time is local
- *** "standard" time, or u (or g or z) if the given time is univer-
- *** sal time; in the absence of an indicator, wall clock time is
- *** assumed.
- ***
- *** returns a moodle friendly $at, in GMT, which is what Moodle wants
- ***
- ***
+/**
+ * olson_parse_at($at, $set, $gmtoffset)
+ *
+ * see `man zic`. This function translates
+ *
+ * 2 time in hours
+ * 2:00 time in hours and minutes
+ * 15:00 24-hour format time (for times after noon)
+ * 1:28:14 time in hours, minutes, and seconds
+ *
+ * Any of these forms may be followed by the letter w if the given
+ * time is local "wall clock" time, s if the given time is local
+ * "standard" time, or u (or g or z) if the given time is univer-
+ * sal time; in the absence of an indicator, wall clock time is
+ * assumed.
+ *
+ * @return string a moodle friendly $at, in GMT, which is what Moodle wants
+ *
+ *
*/
function olson_parse_at ($at, $set = 'set', $gmtoffset) {
-<?php // $Id$
-
-///////////////////////////////////////////////////////////////////////////
-// //
-// NOTICE OF COPYRIGHT //
-// //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.org //
-// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com //
-// //
-// This program 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 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// 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: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
+<?php
+
+// 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
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// 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 file contains the moodle_page class. There is normally a single instance
* of this class in the $PAGE global variable. This class is a central reporitory
* of information about the page we are building up to send back to the user.
*
- * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
- * @package pages
+ * @package moodlecore
+ * @subpackage pages
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* except keep track of information, however, it serves as the access point to
* some more significant components like $PAGE->theme, $PAGE->requires,
* $PAGE->blocks, etc.
+ *
+ * @package moodlecore
+ * @subpackage pages
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class moodle_page {
/**#@+ Tracks the where we are in the generation of the page. */
/**
* Please do not call this method directly, use the ->course syntax. @see __get().
+ *
+ * @global object
* @return object the current course that we are inside - a row from the
* course table. (Also available as $COURSE global.) If we are not inside
* an actual course, this will be the site course.
* @deprecated since Moodle 2.0
* Parent class from which all Moodle page classes derive
*
- * @package pages
+ * @package moodlecore
+ * @subpackage pages
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class page_base extends moodle_page {
/**
* Although this does nothing, this class declaration should be left for now
* since there may be legacy class doing class page_... extends page_course
*
- * @package pages
+ * @package moodlecore
+ * @subpackage pages
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class page_course extends page_base {
}
* @deprecated since Moodle 2.0
* Class that models the common parts of all activity modules
*
- * @package pages
+ * @package moodlecore
+ * @subpackage pages
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class page_generic_activity extends page_base {
// Although this function is deprecated, it should be left here because
-<?php // $Id$
+<?php
-///////////////////////////////////////////////////////////////////////////
-// //
-// NOTICE OF COPYRIGHT //
-// //
-// Moodle - Modular Object-Oriented Dynamic Learning Environment //
-// http://moodle.org //
-// //
-// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com //
-// //
-// This program 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 2 of the License, or //
-// (at your option) any later version. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// 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: //
-// //
-// http://www.gnu.org/copyleft/gpl.html //
-// //
-///////////////////////////////////////////////////////////////////////////
+// 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
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// 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/>.
/**
* pdflib.php - Moodle PDF library
* with TCPDF.
*
* Example usage:
+ * <code>
* $doc = new pdf;
* $doc->setPrintHeader(false);
* $doc->setPrintFooter(false);
* $doc->AddPage();
* $doc->Write(5, 'Hello World!');
* $doc->Output();
- *
- * @author Vy-Shane Sin Fat
- * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
+ * </code>
+ *
* @package moodlecore
+ * @copyright Vy-Shane Sin Fat
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-/// Includes
+/** Includes */
require_once(dirname(__FILE__).'/tcpdf/tcpdf.php');
/**
* Wrapper class that extends TCPDF (lib/tcpdf/tcpdf.php).
* Moodle customisations are done here.
+ *
+ * @package moodlecore
+ * @copyright Vy-Shane Sin Fat
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class pdf extends TCPDF {
/**
* Return fonts path
* Overriding TCPDF::_getfontpath()
+ *
+ * @global object
*/
protected function _getfontpath() {
global $CFG;
<?php
+
+// 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
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// 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/>.
+
/**
- * Moodle - Modular Object-Oriented Dynamic Learning Environment
- * http://moodle.org
- * Copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com
- *
- * This program 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 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * 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 this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * @package moodle
- * @subpackage portfolio
- * @author Penny Leach <penny@catalyst.net.nz>
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL
- * @copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com
- *
* This file contains all global functions to do with manipulating portfolios
* everything else that is logically namespaced by class is in its own file
* in lib/portfolio/ directory.
+ *
+ * Major Contributors
+ * - Penny Leach <penny@catalyst.net.nz>
+ *
+ * @package moodlecore
+ * @subpackage portfolio
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-// require all the sublibraries first.
+/** require all the sublibraries first. */
require_once($CFG->libdir . '/portfolio/constants.php'); // all the constants for time, export format etc.
require_once($CFG->libdir . '/portfolio/exceptions.php'); // exception classes used by portfolio code
require_once($CFG->libdir . '/portfolio/formats.php'); // the export format hierarchy
require_once($CFG->libdir . '/portfolio/caller.php'); // the base classes for calling code
/**
-* use this to add a portfolio button or icon or form to a page
-*
-* These class methods do not check permissions. the caller must check permissions first.
-* Later, during the export process, the caller class is instantiated and the check_permissions method is called
-*
-* This class can be used like this:
-* $button = new portfolio_add_button();
-* $button->set_callback_options('name_of_caller_class', array('id' => 6), '/your/mod/lib.php');
-* $button->render(PORTFOLIO_ADD_FULL_FORM, get_string('addeverythingtoportfolio', 'yourmodule'));
-*
-* or like this:
-* $button = new portfolio_add_button(array('callbackclass' => 'name_of_caller_class', 'callbackargs' => array('id' => 6), 'callbackfile' => '/your/mod/lib.php'));
-* $somehtml .= $button->to_html(PORTFOLIO_ADD_TEXT_LINK);
-*
-* See http://docs.moodle.org/en/Development:Adding_a_Portfolio_Button_to_a_page for more information
+ * use this to add a portfolio button or icon or form to a page
+ *
+ * These class methods do not check permissions. the caller must check permissions first.
+ * Later, during the export process, the caller class is instantiated and the check_permissions method is called
+ *
+ * This class can be used like this:
+ * <code>
+ * $button = new portfolio_add_button();
+ * $button->set_callback_options('name_of_caller_class', array('id' => 6), '/your/mod/lib.php');
+ * $button->render(PORTFOLIO_ADD_FULL_FORM, get_string('addeverythingtoportfolio', 'yourmodule'));
+ * </code>
+ *
+ * or like this:
+ * <code>
+ * $button = new portfolio_add_button(array('callbackclass' => 'name_of_caller_class', 'callbackargs' => array('id' => 6), 'callbackfile' => '/your/mod/lib.php'));
+ * $somehtml .= $button->to_html(PORTFOLIO_ADD_TEXT_LINK);
+ * </code>
+ *
+ * See {@link http://docs.moodle.org/en/Development:Adding_a_Portfolio_Button_to_a_page} for more information
+ *
+ * @package moodlecore
+ * @subpackage portfolio
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class portfolio_add_button {
}
/**
-* helper function to rethrow a caught portfolio_exception as an export exception
-*
-* used because when a portfolio_export exception is thrown the export is cancelled
-*
-* @param portfolio_exporter $exporter current exporter object
-* @param exception $exception exception to rethrow
-*
-* @return void
-* @throws portfolio_export_exceptiog
-*/
+ * helper function to rethrow a caught portfolio_exception as an export exception
+ *
+ * used because when a portfolio_export exception is thrown the export is cancelled
+ *
+ * throws portfolio_export_exceptiog
+ *
+ * @param portfolio_exporter $exporter current exporter object
+ * @param exception $exception exception to rethrow
+ *
+ * @return void
+ */
function portfolio_export_rethrow_exception($exporter, $exception) {
throw new portfolio_export_exception($exporter, $exception->errorcode, $exception->module, $exception->link, $exception->a);
}
* try and determine expected_time for purely file based exports
* or exports that might include large file attachments.
*
+ * @global object
* @param mixed $totest - either an array of stored_file objects or a single stored_file object
-*
* @return constant PORTFOLIO_TIME_XXX
*/
function portfolio_expected_time_file($totest) {
* try and determine expected_time for purely database based exports
* or exports that might include large parts of a database
*
+ * @global object
* @param integer $recordcount - number of records trying to export
-*
* @return constant PORTFOLIO_TIME_XXX
*/
function portfolio_expected_time_db($recordcount) {
return PORTFOLIO_TIME_HIGH;
}
+/**
+ * @global object
+ */
function portfolio_insane_notify_admins($insane, $instances=false) {
global $CFG;
<?php
+// 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
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// 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/>.
+
+/**
+ * @package moodlecore
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+/** Includes */
require_once('Console/Getopt.php');
/**
-* Profiler adapted from Pear::APD's pprofp script. Not quite there yet, I need
-* to get this to accept a similar list of arguments as the script does,
-* and process them the same way. Also make sure that the file being loaded
-* is the right one. Also support multiple pids used in one page load (up to 4 so far).
-* Then output all this in a nicely formatted table.
-*/
+ * Profiler adapted from Pear::APD's pprofp script. Not quite there yet, I need
+ * to get this to accept a similar list of arguments as the script does,
+ * and process them the same way. Also make sure that the file being loaded
+ * is the right one. Also support multiple pids used in one page load (up to 4 so far).
+ * Then output all this in a nicely formatted table.
+ *
+ * @package moodlecore
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class Profiler
{
var $stimes;
* WARNING: If you switch cleanup off, profiling data will
* accumulate from one pageload to the next.
*
+ * @global object
+ * @global object
* @param boolean $cleanup Whether to delete pprof files or not.
* @return String Profiling raw data
*/
* Returns profiling information gathered using APD functions.
* Accepts a numerical array of command-line arguments.
*
- * @usage Profiler::get_profiling($args)
+ * Profiler::get_profiling($args)
* Sort options
* -a Sort by alphabetic names of subroutines.
* -l Sort by number of calls to subroutines
-<?php // $Id$
+<?php
+
+// 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
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// 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/>.
+
/**
* Code for handling and processing questions
*
* TODO: separate those functions which form part of the API
* from the helper functions.
*
- * @author Martin Dougiamas and many others. This has recently been completely
- * rewritten by Alex Smith, Julian Sedding and Gustav Delius as part of
- * the Serving Mathematics project
- * {@link http://maths.york.ac.uk/serving_maths}
- * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
- * @package question
+ * Major Contributors
+ * - Alex Smith, Julian Sedding and Gustav Delius {@link http://maths.york.ac.uk/serving_maths}
+ *
+ * @package moodlecore
+ * @subpackage question
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/// CONSTANTS ///////////////////////////////////
define('QUESTION_FLAGSEDITABLE', 2);
/**#@-*/
-/// GLOBAL VARAIBLES //////////////////
+/**
+ * GLOBAL VARAIBLES
+ * @global array $QTYPES
+ * @name $QTYPES
+ */
global $QTYPES;
/**
* Array holding question type objects. Initialised via calls to
/**
* Add a new question type to the various global arrays above.
*
+ * @global object
* @param object $qtype An instance of the new question type class.
*/
function question_register_questiontype($qtype) {
* The array returned will only hold the names of all the question types that the user should
* be able to create directly. Some internal question types like random questions are excluded.
*
+ * @global object
* @return array an array of question type names translated to the user's language.
*/
function question_type_menu() {
/**
* Save a new question type order to the config_plugins table.
+ * @global object
* @param $neworder An arra $index => $qtype. Indices should start at 0 and be in order.
* @param $config get_config('question'), if you happen to have it around, to save one DB query.
*/
/**
* This holds the options that are set by the course module
+ *
+ * @package moodlecore
+ * @subpackage question
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class cmoptions {
/**
/**
* Returns an array of names of activity modules that use this question
*
+ * @global object
+ * @global object
* @param object $questionid
* @return array of strings
*/
* question categories contain any questions. This will return true even if all the questions are
* hidden.
*
+ * @global object
* @param mixed $context either a context object, or a context id.
* @return boolean whether any of the question categories beloning to this context have
* any questions in them.
/**
* Tests whether a category is in use by any activity module
*
+ * @global object
* @return boolean
* @param integer $categoryid
* @param boolean $recursive Whether to examine category children recursively
/**
* Deletes all data associated to an attempt from the database
*
+ * @global object
+ * @global object
* @param integer $attemptid The id of the attempt being deleted
*/
function delete_attempt($attemptid) {
* Deletes question and all associated data from the database
*
* It will not delete a question if it is used by an activity module
+ *
+ * @global object
+ * @global object
* @param object $question The question being deleted
*/
function delete_question($questionid) {
/**
* All question categories and their questions are deleted for this course.
*
+ * @global object
* @param object $mod an object representing the activity
* @param boolean $feedback to specify if the process must output a summary of its work
* @return boolean
* 1/ All question categories and their questions are deleted for this course category.
* 2/ All questions are moved to new category
*
+ * @global object
* @param object $category course category object
* @param object $newcategory empty means everything deleted, otherwise id of category where content moved
* @param boolean $feedback to specify if the process must output a summary of its work
/**
* Enter description here...
*
+ * @global object
* @param string $questionids list of questionids
* @param object $newcontext the context to create the saved category in.
* @param string $oldplace a textual description of the think being deleted, e.g. from get_context_name
/**
* All question categories and their questions are deleted for this activity.
*
+ * @global object
* @param object $cm the course module object representing the activity
* @param boolean $feedback to specify if the process must output a summary of its work
* @return boolean
* acutally moving questions and associated data. However, callers of this function also have to
* do other work, which is why you should not call this method directly from outside the questionbank.
*
+ * @global object
* @param string $questionids a comma-separated list of question ids.
* @param integer $newcategory the id of the category to move to.
*/
}
/**
+ * @global object
+ * @global object
* @param array $row tab objects
* @param question_edit_contexts $contexts object representing contexts available from this context
* @param string $querystring to append to urls
* See, for example, the usage in mod/quiz/attemptlib.php, and
* read the code below to see how the SQL is assembled. Throws exceptions on error.
*
+ * @global object
+ * @global object
* @param array $questionids array of question ids.
* @param string $extrafields extra SQL code to be added to the query.
* @param string $join extra SQL code to be added to the query.
/**
* Private function to factor common code out of get_question_options().
*
+ * @global object
+ * @global object
* @param object $question the question to tidy.
* @param boolean $loadtags load the question tags from the tags table. Optional, default false.
* @return boolean true if successful, else false.
/**
* Load the basic state information for
*
+ * @global object
* @param integer $attemptid the attempt id to load the states for.
* @return array an array of state data from the database, you will subsequently
* need to call question_load_states to get fully loaded states that can be
* question_preload_states, creating new states for any question where there
* is not a state in the database.
*
+ * @global object
+ * @global object
* @param array $questions the questions to load state for.
* @param array $states the partially loaded states this array is updated.
* @param object $cmoptions options from the module we are loading the states for. E.g. $quiz.
/**
* Load a particular previous state of a question.
*
+ * @global object
* @param array $question The question to load the state for.
* @param object $cmoptions Options from the specifica activity module, e.g. $quiz.
* @param object $attempt The attempt for which the question sessions are to be loaded.
*
* Extends the state objects for a question by calling
* {@link restore_session_and_responses()}
+ *
+ * @global object
* @param object $question The question for which the state is needed
* @param object $state The state as loaded from the database
* @return boolean Represents success or failure
* to the answer field of the database table. The information in the
* question_sessions table is updated.
* The question type specific data is then saved.
+ *
+ * @global array
+ * @global object
* @return mixed The id of the saved or updated state or false
* @param object $question The question for which session is to be saved.
* @param object $state The state information to be saved. In particular the
/**
* Returns the html for question feedback image.
+ *
+ * @global object
* @param float $fraction value representing the correctness of the user's
* response to a question.
* @param boolean $selected whether or not the answer is the one that the
* This is used when a question is changed and old student
* responses need to be marked with the new version of a question.
*
-* TODO: Make sure this is not quiz-specific
+* @todo Make sure this is not quiz-specific
*
+ * @global object
* @return boolean Indicates whether the grade has changed
* @param object $question A question object
* @param object $attempt The attempt, in which the question needs to be regraded.
/**
* Processes an array of student responses, grading and saving them as appropriate
*
+ * @global array
* @param object $question Full question object, passed by reference
* @param object $state Full state object, passed by reference
* @param object $action object with the fields ->responses which
/**
* Print the icon for the question type
*
+ * @global array
+ * @global object
* @param object $question The question object for which the icon is required
* only $question->qtype is used.
* @param boolean $return If true the functions returns the link as a string
/**
* Returns a html link to the question image if there is one
*
+ * @global object
+ * @global object
* @return string The html image tag or the empy string if there is no image.
* @param object $question The question object
*/
return $img;
}
+/**
+ * @global array
+ */
function question_print_comment_fields($question, $state, $prefix, $cmoptions, $caption = '') {
global $QTYPES;
$idprefix = preg_replace('/[^-_a-zA-Z0-9]/', '', $prefix);
* database. $state is only updated in memory, it is up to the call to store
* that, if appropriate.
*
+ * @global object
* @param object $question the question
* @param object $state the state to be updated.
* @param object $attempt the attempt the state belongs to, to be updated.
* the question code needs to also have a unique id by which to identify all these
* attempts. Hence a module, when creating a new attempt, calls this function and
* stores the return value in the 'uniqueid' field of its attempts table.
+ *
+ * @global object
*/
function question_new_attempt_uniqueid($modulename='quiz') {
global $DB;
}
/**
+ *
+ * @global object
* @return string An inline script that creates a JavaScript object storing
* various strings and bits of configuration that the scripts in qengine.js need
* to get from PHP.
* Get the HTML that needs to be included in the head tag when the
* questions in $questionlist are printed in the gives states.
*
+ * @global object
+ * @global array
* @param array $questionlist a list of questionids of the questions what will appear on this page.
* @param array $questions an array of question objects, whose keys are question ids.
* Must contain all the questions in $questionlist
* Like @see{get_html_head_contributions} but for the editing page
* question/question.php.
*
+ * @global array
* @param $question A question object. Only $question->qtype is used.
* @return string some HTML code that can go inside the head tag.
*/
* Prints a question
*
* Simply calls the question type specific print_question() method.
+ *
+ * @global array
* @param object $question The question to be rendered.
* @param object $state The state to render the question in.
* @param integer $number The number for this question.
* Saves question options
*
* Simply calls the question type specific save_question_options() method.
+ *
+ * @global array
*/
function save_question_options($question) {
global $QTYPES;
* Gets all teacher stored answers for a given question
*
* Simply calls the question type specific get_all_responses() method.
+ *
+ * @global array
*/
// ULPGC ecastro
function get_question_responses($question, $state) {
* Gets the response given by the user in a particular state
*
* Simply calls the question type specific get_actual_response() method.
+ *
+ * @global array
*/
// ULPGC ecastro
function get_question_actual_response($question, $state) {
/**
* TODO: document this
+ *
+ * @global array
*/
// ULPGc ecastro
function get_question_fraction_grade($question, $state) {
return $r;
}
/**
+ * @global array
* @return integer grade out of 1 that a random guess by a student might score.
*/
// ULPGc ecastro
* returns the categories with their names ordered following parent-child relationships
* finally it tries to return pending categories (those being orphaned, whose parent is
* incorrect) to avoid missing any category from original array.
+ *
+ * @global object
*/
function sort_categories_by_tree(&$categories, $id = 0, $level = 1) {
global $DB;
}
/**
+ * @global object
* @param integer $contextid a context id.
* @return object the default question category for that context, or false if none.
*/
}
/**
+ * @global object
+ * @global object
* @param object $context a context
* @return string A URL for editing questions in this context.
*/
* Gets the default category in the most specific context.
* If no categories exist yet then default ones are created in all contexts.
*
+ * @global object
* @param array $contexts The context objects for this context and all parent contexts.
* @return object The default category - the category in the course context
*/
* Get all the category objects, including a count of the number of questions in that category,
* for all the categories in the lists $contexts.
*
+ * @global object
* @param mixed $contexts either a single contextid, or a comma-separated list of context ids.
* @param string $sortorder used as the ORDER BY clause in the select statement.
* @return array of category objects.
/**
* Output an array of question categories.
+ * @global object
*/
function question_category_options($contexts, $top = false, $currentcat = 0, $popupform = false, $nochildrenof = -1) {
global $CFG;
/**
* Returns a comma separated list of ids of the category and all subcategories
+ * @global object
*/
function question_categorylist($categoryid) {
global $DB;
/**
* Get list of available import or export formats
+ *
+ * @global object
* @param string $type 'import' if import list, otherwise export list assumed
* @return array sorted list of import/export formats available
-**/
+ */
function get_import_export_formats( $type ) {
global $CFG;
return $export_name;
}
+
+/**
+ * @package moodlecore
+ * @subpackage question
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
class context_to_string_translator{
/**
* @var array used to translate between contextids and strings for this context.
/**
* Check capability on category
+ *
+ * @global object
+ * @global object
* @param mixed $question object or id
* @param string $cap 'add', 'edit', 'view', 'use', 'move'
* @param integer $cachecat useful to cache all question records in a category
return true;
}
+/**
+ * @global object
+ */
function question_file_links_base_url($courseid){
global $CFG;
$baseurl = preg_quote("$CFG->wwwroot/file.php", '!');
return $baseurl;
}
-/*
+/**
* Find all course / site files linked to in a piece of html.
+ * @global object
* @param string html the html to search
* @param int course search for files for courseid course or set to siteid for
* finding site files.
/**
* Check that url doesn't point anywhere it shouldn't
*
+ * @global object
* @param $url string relative url within course files directory
* @return mixed boolean false if not OK or cleaned URL as string if OK
*/
/**
* Find all course / site files linked to in a piece of html.
+ *
+ * @global object
* @param string html the html to search
* @param int course search for files for courseid course or set to siteid for
* finding site files.
return $newhtml;
}
+/**
+ * @global object
+ */
function get_filesdir_from_context($context){
global $DB;
/**
* Update the flagged state of a particular question session.
*
+ * @global object
* @param integer $sessionid question_session id.
* @param boolean $newstate the new state for the flag.
* @return boolean success or failure.
/**
* Update the flagged state of all the questions in an attempt, where a new .
*
+ * @global object
* @param integer $sessionid question_session id.
* @param boolean $newstate the new state for the flag.
* @return boolean success or failure.
}
/**
+ *
+ * @global object
* @param integer $attemptid the question_attempt id.
* @param integer $questionid the question id.
* @param integer $sessionid the question_session id.
<?php
-/*
+
+/**
* This is a PHP library that handles calling reCAPTCHA.
* - Documentation and latest version
- * http://recaptcha.net/plugins/php/
+ * {@link http://recaptcha.net/plugins/php/}
* - Get a reCAPTCHA API Key
- * http://recaptcha.net/api/getkey
+ * {@link http://recaptcha.net/api/getkey}
* - Discussion group
- * http://groups.google.com/group/recaptcha
+ * {@link http://groups.google.com/group/recaptcha}
*
- * Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net
+ * Copyright (c) 2007 reCAPTCHA -- {@link http://recaptcha.net}
* AUTHORS:
* Mike Crawford
* Ben Maurer
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
+ *
+ * @package moodlecore
+ * @copyright (c) 2007 reCAPTCHA -- {@link http://recaptcha.net}
*/
/**
/**
* Submits an HTTP POST to a reCAPTCHA server
+ *
+ * @global object
* @param string $host
* @param string $path
* @param array $data
* Gets the challenge HTML (javascript and non-javascript version).
* This is called from the browser, and the resulting reCAPTCHA HTML widget
* is embedded within the HTML form it was called from.
+ *
+ * @global object
* @param string $pubkey A public key for reCAPTCHA
* @param string $error The error given by reCAPTCHA (optional, default is null)
* @param boolean $use_ssl Should the request be made over ssl? (optional, default is false)
/**
* A ReCaptchaResponse is returned from recaptcha_check_answer()
+ *
+ * @package moodlecore
+ * @copyright (c) 2007 reCAPTCHA -- {@link http://recaptcha.net}
*/
class ReCaptchaResponse {
var $is_valid;
-<?php // $Id$
- // This file contains all the common stuff to be used in RSS System
+<?php
+
+// 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
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// 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 file contains all the common stuff to be used in RSS System
+ *
+ * @package moodlecore
+ * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
/**
* This function returns the icon (from theme) with the link to rss/file.php
+ *
+ * @global object
+ * @global object
*/
function rss_get_link($courseid, $userid, $modulename, $id, $tooltiptext='') {
/**
* This function returns the URL for the RSS XML file.
+ *
+ * @global object
*/
function rss_get_url($courseid, $userid, $modulename, $id) {
global $CFG;
* This function iterates over each module in the server to see if
* it supports generating rss feeds, searching for a MODULENAME_rss_feeds()
* function and invoking it foreach activity as necessary
+ *
+ * @global object
+ * @global object
*/
function cron_rss_feeds () {
global $CFG, $DB;
/**
* This function saves to file the rss feed specified in the parameters
+ *
+ * @global object
*/
function rss_save_file($modname, $mod, $result) {
global $CFG;
/**
* This function return all the common headers for every rss feed in the site
+ *
+ * @global object
+ * @global object
*/
function rss_standard_header($title = NULL, $link = NULL, $description = NULL) {
global $CFG, $USER;
/**
* Prints or returns a form for managing rss feed entries.
+ *
+ * @global object
+ * @global object
+ * @global int
+ * @global string
* @param string $act The current action. If "rssedit" then and "update" button is used, otherwise "add" is used.
* @param string $url The url of the feed that is being updated or NULL
* @param int $rssid The dataabse id of the feed that is being updated or NULL
/**
-* Adds RSS Media Enclosures for "podcasting" by examining links to media files,
-* and attachments which are media files. Please note that the RSS that is
-* produced cannot be strictly valid for the linked files, since we do not know
-* the files' sizes and cannot include them in the "length" attribute. At
-* present, the validity (and therefore the podcast working in most software)
-* can only be ensured for attachments, and not for links.
-* Note also that iTunes does some things very badly - one thing it does is
-* refuse to download ANY of your files if you're using "file.php?file=blah"
-* and can't use the more elegant "file.php/blah" slasharguments setting. It
-* stops after ".php" and assumes the files are not media files, despite what
-* is specified in the "type" attribute. Dodgy coding all round!
-*
-* @param $item object representing an RSS item
-* @return string RSS enclosure tags
-* @author Hannes Gassert <hannes@mediagonal.ch>
-* @author Dan Stowell
-*/
+ * Adds RSS Media Enclosures for "podcasting" by examining links to media files,
+ * and attachments which are media files. Please note that the RSS that is
+ * produced cannot be strictly valid for the linked files, since we do not know
+ * the files' sizes and cannot include them in the "length" attribute. At
+ * present, the validity (and therefore the podcast working in most software)
+ * can only be ensured for attachments, and not for links.
+ * Note also that iTunes does some things very badly - one thing it does is
+ * refuse to download ANY of your files if you're using "file.php?file=blah"
+ * and can't use the more elegant "file.php/blah" slasharguments setting. It
+ * stops after ".php" and assumes the files are not media files, despite what
+ * is specified in the "type" attribute. Dodgy coding all round!
+ *
+ * Authors
+ * - Hannes Gassert <hannes@mediagonal.ch>
+ * - Dan Stowell
+ *
+ * @global object
+ * @param $item object representing an RSS item
+ * @return string RSS enclosure tags
+ */
function rss_add_enclosures($item){
global $CFG;