[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Source view] [Print] [Project Stats]
Used to be used for tracking conditions that apply before activities are displayed to students ('conditional availability'). Now replaced by the availability API. This library is a stub; some functions still work while others throw exceptions. New code should not rely on the classes, functions, or constants defined here.
Copyright: | 2014 The Open University |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 538 lines (21 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
condition_info:: (5 methods):
__construct()
fill_availability_conditions()
get_full_course_module()
update_cm_from_form()
completion_value_used_as_condition()
condition_info_section:: (17 methods):
__construct()
fill_availability_conditions()
get_full_section()
update_section_from_form()
get_condition_user_field_operators()
get_condition_user_fields()
add_completion_condition()
add_user_field_condition()
add_grade_condition()
wipe_conditions()
get_availability_info()
get_full_information()
is_available()
show_availability()
inform_grade_changed()
wipe_session_cache()
init_global_cache()
Class: condition_info - X-Ref
Core class to handle conditional activities.__construct($cm, $expectingmissing = CONDITION_MISSING_NOTHING,$loaddata=true) X-Ref |
Constructs with course-module details. param: object $cm Moodle course-module object. Required ->id, ->course param: int $expectingmissing Used to control whether or not a developer param: bool $loaddata If you need a 'write-only' object, set this value |
fill_availability_conditions($cm) X-Ref |
Adds the extra availability conditions (if any) into the given course-module (or section) object. This function may be called statically (for the editing form) or dynamically. param: object $cm Moodle course-module data object |
get_full_course_module() X-Ref |
Gets the course-module object with full necessary data to determine availability. return: object Course-module object with full data |
update_cm_from_form($cm, $fromform, $wipefirst=true) X-Ref |
Used to update a table (which no longer exists) based on form data (which is no longer used). Should only have been called from core code. Now removed (throws exception). param: object $cm Course-module with as much data as necessary, min id param: object $fromform Data from form param: bool $wipefirst If true, wipes existing conditions |
completion_value_used_as_condition($course, $cm) X-Ref |
Used to be used in course/lib.php because we needed to disable the completion JS if a completion value affects a conditional activity. Should only have been called from core code. Now removed (throws exception). param: object $course Moodle course object param: object $item Moodle course-module |
Class: condition_info_section - X-Ref
Handles conditional access to sections.__construct($section, $expectingmissing = CONDITION_MISSING_NOTHING,$loaddata=true) X-Ref |
Constructs with course-module details. param: object $section Moodle section object. Required ->id, ->course param: int $expectingmissing Used to control whether or not a developer param: bool $loaddata If you need a 'write-only' object, set this value |
fill_availability_conditions($section) X-Ref |
Adds the extra availability conditions (if any) into the given course-module (or section) object. This function may be called statically (for the editing form) or dynamically. param: object $section Moodle section data object |
get_full_section() X-Ref |
Gets the section object with full necessary data to determine availability. return: section_info Section object with full data |
update_section_from_form($section, $fromform, $wipefirst=true) X-Ref |
Utility function that used to be called by modedit.php; updated a table (that no longer exists) based on the module form data. Should only have been called from core code. Now removed (throws exception). param: object $section Section object, must at minimum contain id param: object $fromform Data from form param: bool $wipefirst If true, wipes existing conditions |
get_condition_user_field_operators() X-Ref |
The operators that provide the relationship between a field and a value. |
get_condition_user_fields($formatoptions = null) X-Ref |
Returns list of user fields that can be compared. If you specify $formatoptions, then format_string will be called on the custom field names. This is necessary for multilang support to work so you should include this parameter unless you are going to format the text later. param: array $formatoptions Passed to format_string if provided |
add_completion_condition($cmid, $requiredcompletion) X-Ref |
Adds to the database a condition based on completion of another module. Should only have been called from core and test code. Now removed (throws exception). param: int $cmid ID of other module param: int $requiredcompletion COMPLETION_xx constant |
add_user_field_condition($field, $operator, $value) X-Ref |
Adds user fields condition Should only have been called from core and test code. Now removed (throws exception). param: mixed $field numeric if it is a user profile field, character param: int $operator specifies the relationship between field and value param: char $value the value of the field |
add_grade_condition($gradeitemid, $min, $max, $updateinmemory=false) X-Ref |
Adds to the database a condition based on the value of a grade item. Should only have been called from core and test code. Now removed (throws exception). param: int $gradeitemid ID of grade item param: float $min Minimum grade (>=), up to 5 decimal points, or null if none param: float $max Maximum grade (<), up to 5 decimal points, or null if none param: bool $updateinmemory If true, updates data in memory; otherwise, |
wipe_conditions() X-Ref |
Erases from the database all conditions for this activity. Should only have been called from core and test code. Now removed (throws exception). |
get_availability_info() X-Ref |
Integration point with new API; obtains the new class for this item. return: \core_availability\info Availability info for item |
get_full_information($modinfo=null) X-Ref |
Obtains a string describing all availability restrictions (even if they do not apply any more). param: course_modinfo|null $modinfo Usually leave as null for default. Specify when return: string Information string (for admin) about all restrictions on |
is_available(&$information, $grabthelot=false, $userid=0, $modinfo=null) X-Ref |
Determines whether this particular item is currently available according to these criteria. - This does not include the 'visible' setting (i.e. this might return true even if visible is false); visible is handled independently. - This does not take account of the viewhiddenactivities capability. That should apply later. param: string $information If the item has availability restrictions, param: bool $grabthelot Performance hint: if true, caches information param: int $userid If set, specifies a different user ID to check availability for param: course_modinfo|null $modinfo Usually leave as null for default. Specify when return: bool True if this item is available to the user, false otherwise |
show_availability() X-Ref |
Checks whether availability information should be shown to normal users. This information no longer makes sense with the new system because there are multiple show options. (I doubt anyone much used this function anyhow!) return: bool True if information about availability should be shown to |
inform_grade_changed($grade, $deleted) X-Ref |
Used to be called by grade code to inform the completion system when a grade was changed. This function should not have ever been used outside the grade API, so it now just throws an exception. param: grade_grade $grade param: bool $deleted |
wipe_session_cache() X-Ref |
Used to be used for testing. |
init_global_cache() X-Ref |
Initialises the global cache |
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |