Merge branch 'MDL-45543-master' of git://github.com/ankitagarwal/moodle
This commit is contained in:
@@ -180,7 +180,7 @@ abstract class condition extends tree_node {
|
||||
*
|
||||
* Default implementation returns false.
|
||||
*
|
||||
* @param stdClass $course Moodle course object
|
||||
* @param \stdClass $course Moodle course object
|
||||
* @param int $cmid ID of activity whose completion value is considered
|
||||
* @return boolean True if the availability of something else may rely on it
|
||||
*/
|
||||
|
||||
@@ -46,7 +46,7 @@ abstract class frontend {
|
||||
*
|
||||
* Default returns true.
|
||||
*
|
||||
* @param stdClass $course Course object
|
||||
* @param \stdClass $course Course object
|
||||
* @param \cm_info $cm Course-module currently being edited (null if none)
|
||||
* @param \section_info $section Section currently being edited (null if none)
|
||||
*/
|
||||
@@ -73,7 +73,7 @@ abstract class frontend {
|
||||
*
|
||||
* Default returns no parameters.
|
||||
*
|
||||
* @param stdClass $course Course object
|
||||
* @param \stdClass $course Course object
|
||||
* @param \cm_info $cm Course-module currently being edited (null if none)
|
||||
* @param \section_info $section Section currently being edited (null if none)
|
||||
* @return array Array of parameters for the JavaScript function
|
||||
@@ -95,7 +95,7 @@ abstract class frontend {
|
||||
/**
|
||||
* Includes JavaScript for the main system and all plugins.
|
||||
*
|
||||
* @param stdClass $course Course object
|
||||
* @param \stdClass $course Course object
|
||||
* @param \cm_info $cm Course-module currently being edited (null if none)
|
||||
* @param \section_info $section Section currently being edited (null if none)
|
||||
*/
|
||||
|
||||
@@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
abstract class info {
|
||||
/** @var stdClass Course */
|
||||
/** @var \stdClass Course */
|
||||
protected $course;
|
||||
|
||||
/** @var \course_modinfo Modinfo (available only during some functions) */
|
||||
@@ -52,10 +52,10 @@ abstract class info {
|
||||
/**
|
||||
* Constructs with item details.
|
||||
*
|
||||
* @param stdClass $course Course object
|
||||
* @param \stdClass $course Course object
|
||||
* @param int $visible Value of visible flag (eye icon)
|
||||
* @param string $availability Availability definition (JSON format) or null
|
||||
* @throws coding_exception If data is not valid JSON format
|
||||
* @throws \coding_exception If data is not valid JSON format
|
||||
*/
|
||||
public function __construct($course, $visible, $availability) {
|
||||
// Set basic values.
|
||||
@@ -67,7 +67,7 @@ abstract class info {
|
||||
/**
|
||||
* Obtains the course associated with this availability information.
|
||||
*
|
||||
* @return stdClass Moodle course object
|
||||
* @return \stdClass Moodle course object
|
||||
*/
|
||||
public function get_course() {
|
||||
return $this->course;
|
||||
@@ -128,7 +128,7 @@ abstract class info {
|
||||
* @param string $availability Availability string in JSON format
|
||||
* @param boolean $lax If true, throw exceptions only for invalid structure
|
||||
* @return tree Availability tree
|
||||
* @throws coding_exception If data is not valid JSON format
|
||||
* @throws \coding_exception If data is not valid JSON format
|
||||
*/
|
||||
protected function decode_availability($availability, $lax) {
|
||||
// Decode JSON data.
|
||||
@@ -306,7 +306,7 @@ abstract class info {
|
||||
*
|
||||
* @param string $restoreid Restore identifier
|
||||
* @param int $courseid Target course id
|
||||
* @param base_logger $logger Logger for any warnings
|
||||
* @param \base_logger $logger Logger for any warnings
|
||||
*/
|
||||
public function update_after_restore($restoreid, $courseid, \base_logger $logger) {
|
||||
$tree = $this->get_availability_tree();
|
||||
@@ -342,7 +342,7 @@ abstract class info {
|
||||
* function does that for the conditional availability data for all
|
||||
* modules and sections on the course.
|
||||
*
|
||||
* @param int|stdClass $courseorid Course id or object
|
||||
* @param int|\stdClass $courseorid Course id or object
|
||||
* @param string $table Table name e.g. 'course_modules'
|
||||
* @param int $oldid Previous ID
|
||||
* @param int $newid New ID
|
||||
@@ -407,7 +407,7 @@ abstract class info {
|
||||
* groupmembersonly field for modules. This is off by default because
|
||||
* we are not yet moving the groupmembersonly option into this new API.
|
||||
*
|
||||
* @param stdClass $rec Object possibly containing legacy fields
|
||||
* @param \stdClass $rec Object possibly containing legacy fields
|
||||
* @param bool $section True if this is a section
|
||||
* @param bool $modgroupmembersonly True if groupmembersonly is converted for mods
|
||||
* @return string|null New availability value or null if none
|
||||
@@ -468,7 +468,7 @@ abstract class info {
|
||||
* that it has an AND tree with one or more conditions.
|
||||
*
|
||||
* @param string|null $availability Current availability conditions
|
||||
* @param stdClass $rec Object containing information from old table
|
||||
* @param \stdClass $rec Object containing information from old table
|
||||
* @param bool $show True if 'show' option should be enabled
|
||||
* @return string New availability conditions
|
||||
*/
|
||||
@@ -501,7 +501,7 @@ abstract class info {
|
||||
* that it has an AND tree with one or more conditions.
|
||||
*
|
||||
* @param string|null $availability Current availability conditions
|
||||
* @param stdClass $rec Object containing information from old table
|
||||
* @param \stdClass $rec Object containing information from old table
|
||||
* @param bool $show True if 'show' option should be enabled
|
||||
* @return string New availability conditions
|
||||
*/
|
||||
@@ -598,8 +598,8 @@ abstract class info {
|
||||
* object.
|
||||
*
|
||||
* @param string $info Info string
|
||||
* @param int|stdClass $courseorid
|
||||
* @return Correctly formatted info string
|
||||
* @param int|\stdClass $courseorid
|
||||
* @return string Correctly formatted info string
|
||||
*/
|
||||
public static function format_info($info, $courseorid) {
|
||||
// Don't waste time if there are no special tags.
|
||||
@@ -624,7 +624,7 @@ abstract class info {
|
||||
* JS (using the non-JS version instead, which causes a page reload) if a
|
||||
* completion tickbox value may affect a conditional activity.
|
||||
*
|
||||
* @param stdClass $course Moodle course object
|
||||
* @param \stdClass $course Moodle course object
|
||||
* @param int $cmid Course-module id
|
||||
* @return bool True if this is used in a condition, false otherwise
|
||||
*/
|
||||
|
||||
@@ -63,7 +63,7 @@ class info_module extends info {
|
||||
/**
|
||||
* Gets the course-module object. Intended for use by conditions.
|
||||
*
|
||||
* @return cm_info Course module
|
||||
* @return \cm_info Course module
|
||||
*/
|
||||
public function get_course_module() {
|
||||
return $this->cm;
|
||||
@@ -130,11 +130,11 @@ class info_module extends info {
|
||||
* disabled, and you supply a $cm object with necessary fields, and you
|
||||
* don't check course access.
|
||||
*
|
||||
* @param int|stdClass|cm_info $cmorid Object or id representing activity
|
||||
* @param int|\stdClass|\cm_info $cmorid Object or id representing activity
|
||||
* @param int $userid User id (0 = current user)
|
||||
* @param bool $checkcourse If true, checks whether the user has course access
|
||||
* @return bool True if the activity is visible to the specified user
|
||||
* @throws moodle_exception If the cmid doesn't exist
|
||||
* @throws \moodle_exception If the cmid doesn't exist
|
||||
*/
|
||||
public static function is_user_visible($cmorid, $userid = 0, $checkcourse = true) {
|
||||
global $USER, $DB, $CFG;
|
||||
|
||||
@@ -65,7 +65,7 @@ class info_section extends info {
|
||||
/**
|
||||
* Gets the section object. Intended for use by conditions.
|
||||
*
|
||||
* @return section_info Section
|
||||
* @return \section_info Section
|
||||
*/
|
||||
public function get_section() {
|
||||
return $this->section;
|
||||
|
||||
@@ -128,11 +128,11 @@ class tree extends tree_node {
|
||||
* coding_exception (if $lax is false).
|
||||
*
|
||||
* @see decode_availability
|
||||
* @param stdClass $structure Structure (decoded from JSON)
|
||||
* @param \stdClass $structure Structure (decoded from JSON)
|
||||
* @param boolean $lax If true, throw exceptions only for invalid structure
|
||||
* @param boolean $root If true, this is the root tree
|
||||
* @return tree Availability tree
|
||||
* @throws coding_exception If data is not valid structure
|
||||
* @throws \coding_exception If data is not valid structure
|
||||
*/
|
||||
public function __construct($structure, $lax = false, $root = true) {
|
||||
$this->root = $root;
|
||||
@@ -389,12 +389,12 @@ class tree extends tree_node {
|
||||
* for display to staff.
|
||||
*
|
||||
* @param info $info Information about location of condition tree
|
||||
* @throws coding_exception If you call on a non-root tree
|
||||
* @throws \coding_exception If you call on a non-root tree
|
||||
* @return string HTML data (empty string if none)
|
||||
*/
|
||||
public function get_full_information(info $info) {
|
||||
if (!$this->root) {
|
||||
throw new coding_exception('Only supported on root item');
|
||||
throw new \coding_exception('Only supported on root item');
|
||||
}
|
||||
return $this->get_full_information_recursive(false, $info, null, true);
|
||||
}
|
||||
@@ -406,12 +406,12 @@ class tree extends tree_node {
|
||||
*
|
||||
* @param info $info Information about location of condition tree
|
||||
* @param result $result Result object
|
||||
* @throws coding_exception If you call on a non-root tree
|
||||
* @throws \coding_exception If you call on a non-root tree
|
||||
* @return string HTML data (empty string if none)
|
||||
*/
|
||||
public function get_result_information(info $info, result $result) {
|
||||
if (!$this->root) {
|
||||
throw new coding_exception('Only supported on root item');
|
||||
throw new \coding_exception('Only supported on root item');
|
||||
}
|
||||
return $this->get_full_information_recursive(false, $info, $result, true);
|
||||
}
|
||||
@@ -530,7 +530,7 @@ class tree extends tree_node {
|
||||
$negative = true;
|
||||
break;
|
||||
default:
|
||||
throw new coding_exception('Unknown operator');
|
||||
throw new \coding_exception('Unknown operator');
|
||||
}
|
||||
switch($this->op) {
|
||||
case self::OP_AND:
|
||||
@@ -542,7 +542,7 @@ class tree extends tree_node {
|
||||
$andoperator = false;
|
||||
break;
|
||||
default:
|
||||
throw new coding_exception('Unknown operator');
|
||||
throw new \coding_exception('Unknown operator');
|
||||
}
|
||||
|
||||
// Select NOT (or not) for children. It flips if this is a 'not' group.
|
||||
|
||||
@@ -78,7 +78,7 @@ abstract class tree_node {
|
||||
/**
|
||||
* Saves tree data back to a structure object.
|
||||
*
|
||||
* @return stdClass Structure object (ready to be made into JSON format)
|
||||
* @return \stdClass Structure object (ready to be made into JSON format)
|
||||
*/
|
||||
public abstract function save();
|
||||
|
||||
@@ -152,11 +152,11 @@ abstract class tree_node {
|
||||
* @param \core_availability\info $info Item we're checking
|
||||
* @param capability_checker $checker
|
||||
* @return array Filtered version of input array
|
||||
* @throws coding_exception If called on a condition that doesn't apply to user lists
|
||||
* @throws \coding_exception If called on a condition that doesn't apply to user lists
|
||||
*/
|
||||
public function filter_user_list(array $users, $not,
|
||||
\core_availability\info $info, capability_checker $checker) {
|
||||
throw new coding_exception('Not implemented (do not call unless '.
|
||||
throw new \coding_exception('Not implemented (do not call unless '.
|
||||
'is_applied_to_user_lists is true)');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,8 +48,8 @@ class condition extends \core_availability\condition {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param stdClass $structure Data structure from JSON decode
|
||||
* @throws coding_exception If invalid data structure.
|
||||
* @param \stdClass $structure Data structure from JSON decode
|
||||
* @throws \coding_exception If invalid data structure.
|
||||
*/
|
||||
public function __construct($structure) {
|
||||
// Get cmid.
|
||||
@@ -212,7 +212,7 @@ class condition extends \core_availability\condition {
|
||||
* Used in course/lib.php because we need to disable the completion JS if
|
||||
* a completion value affects a conditional activity.
|
||||
*
|
||||
* @param stdClass $course Moodle course object
|
||||
* @param \stdClass $course Moodle course object
|
||||
* @param int $cmid Course-module id
|
||||
* @return bool True if this is used in a condition, false otherwise
|
||||
*/
|
||||
|
||||
@@ -52,8 +52,8 @@ class condition extends \core_availability\condition {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param stdClass $structure Data structure from JSON decode
|
||||
* @throws coding_exception If invalid data structure.
|
||||
* @param \stdClass $structure Data structure from JSON decode
|
||||
* @throws \coding_exception If invalid data structure.
|
||||
*/
|
||||
public function __construct($structure) {
|
||||
// Get direction.
|
||||
|
||||
@@ -74,7 +74,7 @@ class frontend extends \core_availability\frontend {
|
||||
* Given a timestamp, obtains corresponding field values.
|
||||
*
|
||||
* @param int $time Timestamp
|
||||
* @return stdClass Object with fields for year, month, day, hour, minute
|
||||
* @return \stdClass Object with fields for year, month, day, hour, minute
|
||||
*/
|
||||
public static function get_fields_from_time($time) {
|
||||
$calendartype = \core_calendar\type_factory::get_calendar_instance();
|
||||
|
||||
@@ -46,8 +46,8 @@ class condition extends \core_availability\condition {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param stdClass $structure Data structure from JSON decode
|
||||
* @throws coding_exception If invalid data structure.
|
||||
* @param \stdClass $structure Data structure from JSON decode
|
||||
* @throws \coding_exception If invalid data structure.
|
||||
*/
|
||||
public function __construct($structure) {
|
||||
// Get grade item id.
|
||||
|
||||
@@ -43,8 +43,8 @@ class condition extends \core_availability\condition {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param stdClass $structure Data structure from JSON decode
|
||||
* @throws coding_exception If invalid data structure.
|
||||
* @param \stdClass $structure Data structure from JSON decode
|
||||
* @throws \coding_exception If invalid data structure.
|
||||
*/
|
||||
public function __construct($structure) {
|
||||
// Get group id.
|
||||
|
||||
@@ -46,8 +46,8 @@ class condition extends \core_availability\condition {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param stdClass $structure Data structure from JSON decode
|
||||
* @throws coding_exception If invalid data structure.
|
||||
* @param \stdClass $structure Data structure from JSON decode
|
||||
* @throws \coding_exception If invalid data structure.
|
||||
*/
|
||||
public function __construct($structure) {
|
||||
// Get grouping id.
|
||||
|
||||
@@ -73,8 +73,8 @@ class condition extends \core_availability\condition {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param stdClass $structure Data structure from JSON decode
|
||||
* @throws coding_exception If invalid data structure.
|
||||
* @param \stdClass $structure Data structure from JSON decode
|
||||
* @throws \coding_exception If invalid data structure.
|
||||
*/
|
||||
public function __construct($structure) {
|
||||
// Get operator.
|
||||
|
||||
Reference in New Issue
Block a user