enrolid, $course->startdate); $cont++; echo "
".$course->fullname." - ".$result; } echo "
$cont curso processado"; } function get_courses_withenroltimestartnull() { global $DB, $CFG; $sql = "SELECT DISTINCT c.id,ue.enrolid,c.startdate,c.fullname FROM {$CFG->prefix}enrol e INNER JOIN {$CFG->prefix}course c ON c.id= e.courseid INNER JOIN {$CFG->prefix}user_enrolments ue ON e.id=ue.enrolid WHERE ue.timestart =0 OR ue.timestart IS NULL"; $rows = $DB->get_records_sql($sql,null,0,500); return $rows; } function change_enrolwithnulltimestar($enrolid, $timestart) { if(empty($enrolid)){return null;} if(empty($timestart)){return null;} global $DB, $CFG; $sql = "UPDATE {$CFG->prefix}user_enrolments SET timestart=$timestart WHERE enrolid=$enrolid AND (timestart=0 OR timestart IS NULL)"; $r = $DB->execute($sql); return $r; } ?>