/** * Run MyCourse recommendations cron. * If it is the first time the task is executed for the given course, then, $this->import_data is called, to import * the data from core tables (actually, the need for the importation is decided by database_helper->has_data_to_be_imported). */ public function execute() { $trace = new \text_progress_trace(); $this->initialize($trace); $coursestorecommend = $this->db->get_selected_active_courses($trace); $trace->output('[mycourse ' . date('d/m/Y H:i:s') . ']: Selected active courses for which recommendations will be ' . 'created:'); foreach ($coursestorecommend as $course) { $trace->output("[mycourse]:\t- {$course->courseid}"); } foreach ($coursestorecommend as $course) { $importdata = $this->db->has_data_to_be_imported($course->courseid); if ($importdata) { $this->import_data($course->courseid); } $week = $this->get_current_week(); $trace->output("[mycourse " . date('d/m/Y H:i:s') . "]: Current week: {$week}"); $this->recommendator->create_recommendations($course->courseid, $week, $trace); } $trace->output('[mycourse ' . date('d/m/Y H:i:s') . ']: "MyCourse Recommendations" task execution finished.'); }
public function __construct($associator) { parent::__construct($associator); null; // The codechecker will throw a warning if we don't do something more apart from calling parent's constructor... }