芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/www/cepali/analytics/classes/local/time_splitting/upcoming_periodic.php
. /** * Time splitting method that generates predictions periodically. * * @package core_analytics * @copyright 2019 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ namespace core_analytics\local\time_splitting; defined('MOODLE_INTERNAL') || die(); /** * Time splitting method that generates predictions periodically. * * @package core_analytics * @copyright 2019 David Monllao {@link http://www.davidmonllao.com} * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ abstract class upcoming_periodic extends periodic { /** * The next range indicator calculations should be based on upcoming dates. * * @param \DateTimeImmutable $next * @return array */ protected function get_next_range(\DateTimeImmutable $next) { $start = $next->getTimestamp(); $end = $next->add($this->periodicity())->getTimestamp(); return [ 'start' => $start, 'end' => $end, 'time' => $start ]; } /** * Whether to cache or not the indicator calculations. * @return bool */ public function cache_indicator_calculations(): bool { return false; } /** * Overriden as these time-splitting methods are based on future dates. * * @return bool */ public function valid_for_evaluation(): bool { return false; } /** * Get the start of the first time range. * * Overwriten to start generating predictions about upcoming stuff from time(). * * @return int A timestamp. */ protected function get_first_start() { global $DB; $cache = \cache::make('core', 'modelfirstanalyses'); $key = $this->modelid . '_' . $this->analysable->get_id(); $firstanalysis = $cache->get($key); if (!empty($firstanalysis)) { return $firstanalysis; } // This analysable has not yet been analysed, the start is therefore now (-1 so ready_to_predict can be executed). return time() - 1; } }