libdir.'/blocklib.php'); require_once('lib.php'); $courseid = required_param('course', PARAM_INT); $userid = required_param('userid', PARAM_INT); 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", $userid) ) { error(get_string('nosuchuser','block_autoattend')); } /// Print headers if ($course->category) { print_header(get_string('updateuserattend','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('updateuserattend','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 ""; $summary = autoattend_get_usersummary($course->id, $user->id); $attitems = $summary['attitems']; if (!$attitems) { error(get_string('reqinfomiss', 'block_autoattend'), "index.php?course=".$courseid); } // Title print_heading(get_string('update','block_autoattend').'   ' . get_string('attendforuser','block_autoattend').' :: ' .$course->fullname); // Sub Title $complete = $summary['complete']; $settings = $summary['settings']; $useratt = ''; foreach($settings as $set) { $desc = get_string($set->status.'acronymfull', 'block_autoattend'); $useratt .= $desc.':'.$summary[$set->status].''.'  '; } //$desc = get_string('Yacronymfull', 'block_autoattend'); //$useratt .= $desc.':'.$summary['Y'].''.'  '; $percent = $summary['percent'].'%'; $grade = $summary['grade']; $maxgrade = $summary['maxgrade']; $table->data[][] = print_user_picture($student->id, $course->id, $user->picture, 40, true, true).'
'. "id}&student={$user->id}\">".fullname($user).''. '  '. get_string('sessionscompleted','block_autoattend').":$complete". '  '.$useratt. get_string('attendpercent','block_autoattend').":$percent". '  '. get_string('attendgrade', 'block_autoattend').":$grade/$maxgrade"; $help = helpbutton ('updateuserattend', get_string('updateuserattend','block_autoattend'), 'block_autoattend', true, false, '', true); print_simple_box_start('center', '98%', '', 5, 'generalbox', 'notice'); echo '

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

'; print_table($table); echo '
'; // Display Attendance Table $i = 0; foreach($settings as $set) { $cell = $i + 5; $status = get_string($set->status.'acronym', 'block_autoattend'); $tabhead[] = "$status"; $i++; } if ($attitems) { unset($table); $table->width = '0%'; $table->head [] = '#'; $table->align[] = 'center'; $table->size [] = '20px'; $table->head [] = get_string('sessiondate', 'block_autoattend'); $table->align[] = 'center'; $table->size [] = ''; $table->head [] = get_string('starttime', 'block_autoattend'); $table->align[] = 'center'; $table->size [] = ''; $table->head [] = get_string('endtime', 'block_autoattend'); $table->align[] = 'center'; $table->size [] = ''; $table->head [] = get_string('description', 'block_autoattend'); $table->align[] = 'left'; $table->size [] = ''; foreach ($tabhead as $hd) { $table->head [] = $hd; $table->align[] = 'center'; $table->size [] = '20px'; } $table->head [] = get_string('callmethod', 'block_autoattend'); $table->align[] = 'center'; $table->size [] = ''; $table->head [] = get_string('ipaddress', 'block_autoattend'); $table->align[] = 'center'; $table->size [] = ''; $table->head [] = get_string('remarks','block_autoattend'); $table->align[] = 'left'; $table->size [] = ''; $i = 0; foreach($attitems as $att) { $i++; $table->data[$att->attsid][] = $i; $table->data[$att->attsid][] = strftime(get_string('strftimedmyw', 'block_autoattend'), $att->sessdate); $table->data[$att->attsid][] = strftime(get_string('strftimehourmin', 'block_autoattend'), $att->starttime); $table->data[$att->attsid][] = strftime(get_string('strftimehourmin', 'block_autoattend'), $att->endtime); $table->data[$att->attsid][] = ($att->description ? $att->description : get_string('nodescription', 'block_autoattend')); foreach($settings as $set) { $table->data[$att->attsid][] = 'status==$att->status ? 'checked' : '').'>'; } $table->data[$att->attsid][] = ''. get_string($att->called.'methodfull', 'block_autoattend'); $table->data[$att->attsid][] = $att->ipaddress ? $att->ipaddress : get_string('novalue','block_autoattend'); $table->data[$att->attsid][] = ''; } 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); ?>