See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401]
Date condition.
Copyright: | 2014 The Open University |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 307 lines (11 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
condition:: (16 methods):
__construct()
save()
get_json()
is_available()
is_available_for_all()
get_logical_direction()
get_description()
get_standalone_description()
get_either_description()
get_debug_string()
get_time()
set_current_time_for_test()
show_time()
is_midnight()
update_after_restore()
update_all_dates()
__construct($structure) X-Ref |
Constructor. param: \stdClass $structure Data structure from JSON decode |
save() X-Ref |
No description |
get_json($direction, $time) X-Ref |
Returns a JSON object which corresponds to a condition of this type. Intended for unit testing, as normally the JSON values are constructed by JavaScript code. param: string $direction DIRECTION_xx constant param: int $time Time in epoch seconds return: stdClass Object representing condition |
is_available($not, \core_availability\info $info, $grabthelot, $userid) X-Ref |
No description |
is_available_for_all($not = false) X-Ref |
No description |
get_logical_direction($not) X-Ref |
Obtains the actual direction of checking based on the $not value. param: bool $not True if condition is negated return: string Direction constant |
get_description($full, $not, \core_availability\info $info) X-Ref |
No description |
get_standalone_description($full, $not, \core_availability\info $info) X-Ref |
No description |
get_either_description($not, $standalone) X-Ref |
Shows the description using the different lang strings for the standalone version or the full one. param: bool $not True if NOT is in force param: bool $standalone True to use standalone lang strings |
get_debug_string() X-Ref |
No description |
get_time() X-Ref |
Gets time. This function is implemented here rather than calling time() so that it can be overridden in unit tests. (Would really be nice if Moodle had a generic way of doing that, but it doesn't.) return: int Current time (seconds since epoch) |
set_current_time_for_test($forcetime = 0) X-Ref |
Forces the current time for unit tests. param: int $forcetime Time to return from the get_time function |
show_time($time, $dateonly, $until = false) X-Ref |
Shows a time either as a date or a full date and time, according to user's timezone. param: int $time Time param: bool $dateonly If true, uses date only param: bool $until If true, and if using date only, shows previous date return: string Date |
is_midnight($time) X-Ref |
Checks whether a given time refers exactly to midnight (in current user timezone). param: int $time Time return: bool True if time refers to midnight, false otherwise |
update_after_restore($restoreid, $courseid, \base_logger $logger, $name) X-Ref |
No description |
update_all_dates($courseid, $timeshift) X-Ref |
Changes all date restrictions on a course by the specified shift amount. Used by the course reset feature. param: int $courseid Course id param: int $timeshift Offset in seconds |