libdir.'/blocklib.php'); require_once('lib.php'); $courseid = required_param('course', PARAM_INT); // Course id $attsid = required_param('attsid'); $sort = optional_param('sort','lastname'); if (! $course = get_record('course', 'id', $courseid)) { error(get_string('courseidwrong','block_autoattend')); } require_login($course->id); if (!isteacher($course->id)) { error(get_string('notaccessstudent','block_autoattend')); } if (! $user = get_record("user", "id", $USER->id) ) { error(get_string('nosuchuser','block_autoattend')); } /// Print headers if ($course->category) { print_header(get_string('updatesessionattend','block_autoattend'). ' ' . get_string('autoattend','block_autoattend'), $course->fullname, "wwwroot}/course/view.php?id=$course->id\">$course->shortname -> ". "id\">".get_string('autoattend','block_autoattend')." -> ". get_string('updatesessionattend','block_autoattend'),"", "", true, " ", navmenu($course)); } else { print_header("$course->shortname: ".get_string('autoattend','block_autoattend'), $course->fullname, get_string('autoattend','block_autoattend'), "", "", true, " ", navmenu($course)); } echo ""; if (!$sessdata = get_record('autoattend_sessions', 'id', $attsid) ) { error(get_string('reqinfomiss', 'block_autoattend'), "index.php?course=".$courseid); } $update = count_records('autoattend_students', 'attsid', $attsid); if ($update) { print_heading(get_string('update','block_autoattend').'   ' . get_string('attendforsession','block_autoattend').' :: ' .$course->fullname); } else { print_heading(get_string('attendforsession','block_autoattend').' :: ' .$course->fullname); } $sort = $sort == 'firstname' ? 'firstname' : 'lastname'; if ($currentgroup = setup_and_print_groups($course, VISIBLEGROUPS, "updateAttendance.php?course={$course->id}&attsid=$attsid &sort=$sort")) { $students = get_group_users($currentgroup); } else { $students = get_course_students($course->id, "u.$sort ASC"); } $table->data[][] = get_string('sessiondate','block_autoattend').': '. ''.strftime(get_string('strftimedmyw', 'block_autoattend'), $sessdata->sessdate)."  ". strftime(get_string('strftimehourmin', 'block_autoattend'), $sessdata->starttime)."-". strftime(get_string('strftimehourmin', 'block_autoattend'), $sessdata->endtime).''. "  ". get_string('callmethod', 'block_autoattend').': '. ''.get_string($sessdata->method.'methodfull', 'block_autoattend')." ".''. "  ". get_string('description', 'block_autoattend').': '. ''.' "'.($sessdata->description ? $sessdata->description : get_string('nodescription', 'block_autoattend')).'"'; $help = helpbutton('updatesessionattend', get_string('updatesessionatten', 'block_autoattend'), 'block_autoattend', true, false, '', true); print_simple_box_start('center', '98%', '', 5, 'generalbox', 'notice'); echo '

'; echo get_string('updatesessionattend','block_autoattend').$help; echo '

'; print_table($table); echo '
'; $settings = autoattend_get_settings($course->id); $i = 0; foreach($settings as $set) { $cell = $i + 3; $status = get_string($set->status.'acronym', 'block_autoattend'); $tabhead[] = "$status"; $i++; } $tabhead[] = get_string('callmethod', 'block_autoattend'); $tabhead[] = get_string('ipaddress', 'block_autoattend'); $tabhead[] = get_string('remarks', 'block_autoattend'); $firstname = "id}&attsid=$attsid &sort=firstname\">".get_string('firstname').''; $lastname = "id}&attsid=$attsid &sort=lastname\">".get_string('lastname').''; if ($CFG->fullnamedisplay == 'lastname firstname') { // for better view (dlnsk) $fullnamehead = "$lastname / $firstname"; } else { $fullnamehead = "$firstname / $lastname"; } if ($students) { unset($table); $table->width = '0%'; $table->head [] = '#'; $table->align[] = 'center'; $table->size [] = '20px'; $table->head [] = ''; $table->align[] = ''; $table->size [] = '1px'; $table->head [] = $fullnamehead; $table->align[] = 'left'; $table->size [] = ''; $table->wrap [2]= 'nowrap'; foreach ($tabhead as $hd) { $table->head [] = $hd; $table->align[] = 'center'; $table->size [] = '20px'; $table->wrap [] = 'nowrap'; } $i = 0; foreach($students as $student) { $i++; $att = get_record('autoattend_students', 'attsid', $attsid, 'studentid', $student->id); $table->data[$student->id][] = $i; $table->data[$student->id][] = print_user_picture($student->id, $course->id, $student->picture, 20, true, true); $table->data[$student->id][] = "id}&student={$student->id}\">". fullname($student).''; if ($att) { $status = $att->status; $called = $att->called; } else { $status = 'Y'; $called = 'D'; } foreach($settings as $set) { $table->data[$student->id][] = 'status==$status ? 'checked' : '').'>'; } $table->data[$student->id][] = ''. get_string($called.'methodfull', 'block_autoattend'); $table->data[$student->id][] = $att->ipaddress ? $att->ipaddress : get_string('novalue', 'block_autoattend'); $table->data[$student->id][] = ''; } echo '
'; print_table($table); echo '
'; echo ''; echo ''; echo ''; echo '
'; echo ''; echo '  '; echo ''; echo '  '; echo ''; echo '
'; echo '
'; } else { print_heading(get_string('nothingtodisplay'), 'center'); } echo '
  '.get_string('status','block_autoattend').':
'; foreach($settings as $set) { $status = get_string($set->status.'acronym', 'block_autoattend'); $desc = get_string($set->status.'acronymfull', 'block_autoattend'); echo '    '.$status.' - '.$desc.'
'; } print_simple_box_end(); print_footer($course); ?>