if (!$user) { print_error('nosuchuser', 'block_autoattend'); } // $context = jbxl_get_course_context($course->id); $isassist = false; $isteacher = jbxl_is_teacher($USER->id, $context); if (!$isteacher) { $isassist = jbxl_is_assistant($USER->id, $context); } $settings = autoattend_get_grade_settings($courseid); // // DownLoad (Excel or Text Format) if ($isteacher or $isassist) { $classes = autoattend_get_session_classes($course->id); $datas = autoattend_make_download_data($course->id, $classes, $classid, $viewmode, $current, 'all', null, $sort, $order); if ($action == 'excel') { jbxl_download_data('xls', $datas); die; } else { if ($action == 'text') { jbxl_download_data('txt', $datas); die; } } } ///////////////////////////////////////////////////// if ($refresh) { autoattend_update_sessions($courseid); } // Print header
} // $context = jbxl_get_course_context($course->id); $isstudent = false; $isassist = false; $isteacher = jbxl_is_teacher($USER->id, $context); if (!$isteacher) { $isassist = jbxl_is_assistant($USER->id, $context); if (!$isassist) { $isstudent = jbxl_is_student($USER->id, $context); } } // DownLoad (Excel or Text Format) if ($isteacher or $isassist) { $classes = autoattend_get_session_classes($course->id); $datas = autoattend_make_download_data($course->id, $classes, $classid); if ($action == 'excel') { jbxl_download_data('xls', $datas); die; } else { if ($action == 'text') { jbxl_download_data('txt', $datas); die; } } } ////////////////////////////////////////////////////////////////////////////////////////// // Print Header // $title = $course->shortname . ': ' . get_string('autoattend', 'block_autoattend'); $PAGE->set_title($title);
function autoattend_email2teachers_attend($sess) { global $CFG, $DB, $TIME_OFFSET; if (file_exists($CFG->dirroot . '/mod/autoattendmod/locallib.php')) { require_once $CFG->dirroot . '/mod/autoattendmod/locallib.php'; // if (function_exists('autoattendmod_send_email_teachers')) { if (!file_exists($CFG->tempdir . '/autoattend')) { mkdir($CFG->tempdir . '/autoattend'); } // $courseid = $sess->courseid; $course = $DB->get_record('course', array('id' => $courseid)); $classes = autoattend_get_session_classes($courseid); $daytime = strftime(get_string('strftimedmyw', 'block_autoattend'), $sess->sessdate + $TIME_OFFSET); $pathname = $CFG->tempdir . '/autoattend/attendance_' . $sess->id . '_' . date('YmdHis') . '.$$$'; $filename = get_string('attendance', 'block_autoattend') . '_' . $course->fullname . '_' . $daytime . '.csv'; $datas = autoattend_make_download_data($courseid, $classes, 0, 'all', 0, $sess->id); jbxl_save_csv_file($datas, $pathname); $info = new stdClass(); $info->shortname = $course->shortname; $info->fullname = $course->fullname; $info->date = $daytime; $posttext = autoattend_email_text_attend($info); $posthtml = autoattend_email_html_attend($info); $subject = get_string('attenddata', 'block_autoattend') . ': ' . $course->fullname . ': ' . $daytime; autoattendmod_send_email_teachers($courseid, $subject, $posttext, $posthtml, $pathname, $filename); unlink($pathname); } } return; }