dirroot/course/lib.php"); //require_once("lib.php") // this is code from course/mod.php if (! $cm = get_record("course_modules", "id", $_GET['update'])) { error("This course module doesn't exist"); } if (! $course = get_record("course", "id", $cm->course)) { error("This course doesn't exist"); } if (!isteacher($course->id)) { error("You can't modify this record!"); } if (! $module = get_record("modules", "id", $cm->module)) { error("This module doesn't exist"); } if (! $form = get_record($module->name, "id", $cm->instance)) { error("The required instance of this module doesn't exist"); } if (! $cw = get_record("course_sections", "id", $cm->section)) { error("This course section doesn't exist"); } if (isset($return)) { $SESSION->returnpage = "$CFG->wwwroot/mod/$module->name/view.php?id=$cm->id"; } $form->coursemodule = $cm->id; $form->section = $cm->section; // The section ID $form->course = $course->id; $form->module = $module->id; $form->modulename = $module->name; $form->instance = $cm->instance; $form->mode = "update"; $sectionname = get_string("name$course->format"); $fullmodulename = strtolower(get_string("modulename", $module->name)); if ($form->section) { $heading->what = $fullmodulename; $heading->in = "$sectionname $cw->section"; $pageheading = get_string("updatingain", "moodle", $heading); } else { $pageheading = get_string("updatinga", "moodle", $fullmodulename); } $streditinga = get_string("editinga", "moodle", $fullmodulename); $strmodulenameplural = get_string("modulenameplural", $module->name); if ($module->name == "label") { $focuscursor = ""; } else { $focuscursor = "form.name"; } if ($course->category) { print_header("$course->shortname: $streditinga", "$course->fullname", "wwwroot/course/view.php?id=$course->id\">$course->shortname -> wwwroot/mod/$module->name/index.php?id=$course->id\">$strmodulenameplural -> $streditinga", $focuscursor, "", false); } else { print_header("$course->shortname: $streditinga", "$course->fullname", "$streditinga", $focuscursor, "", false); } $icon = "modpixpath/$module->name/icon.gif\"> "; print_heading_with_help($pageheading, "mods", $module->name, $icon); print_simple_box_start("center", "", "$THEME->cellheading"); // this information is included below instead // include_once($modform); // error_reporting(E_ALL); // if we're adding a new instance if (empty($form->id)) { if (isset($CFG->attendance_dynsection) && ($CFG->attendance_dynsection == "1")) { $form->dynsection = 1; } if (isset($CFG->attendance_autoattend) && ($CFG->attendance_autoattend == "1")) { $form->autoattend = 1; } if (isset($CFG->attendance_grade) && ($CFG->attendance_grade == "1")) { $form->grade = 1; } $form->maxgrade = isset($CFG->attendance_maxgrade)?$CFG->attendance_maxgrade:0; $form->hours = isset($CFG->attendance_default_hours)?$CFG->attendance_default_hours:1; $form->day = time(); $form->notes = ""; } ?>
wwwroot/course/mod.php"; ?>">
"> "> id)) { // get the list of attendance records for all hours of the given day and // put it in the array for use in the attendance table $rolls = get_records("attendance_roll", "dayid", $form->id); if ($rolls) { foreach ($rolls as $roll) { $sroll[$roll->userid][$roll->hour]->status=$roll->status; $sroll[$roll->userid][$roll->hour]->notes=$roll->notes; } } // get the list of students along with student ID field // get back array of stdclass objects in sorted order, with members: // id, username,firstname,lastname,maildisplay,mailformat,email,city,country, // lastaccess,lastlogin,picture (picture is null, 0, or 1), idnumber // build the table for attendance roll // this is the wrapper table echo "". "
"; // this is the main table echo ""; if ($form->hours >1) { echo "\n"; for($i=1;$i<=$form->hours;$i++) { echo "\n"; } echo "\n"; } // if more than one hour for each day echo "\n"; echo "\n"; echo "\n"; $P=get_string("presentshort","attendance"); $T=get_string("tardyshort","attendance"); $A=get_string("absentshort","attendance"); // generate the headers for the attendance hours for($i=1;$i<=$form->hours;$i++) { echo "\n"; echo "\n"; echo "\n"; } echo "\n"; $table->head = array("Last Name","First Name","ID", get_string("presentlong","attendance"), get_string("tardylong","attendance"), get_string("absentlong","attendance")); $table->align = array("left", "left", "left", "center","center","center"); $table->wrap = array("nowrap", "nowrap", "nowrap", "nowrap", "nowrap", "nowrap"); $table->width = "80"; $students = attendance_get_course_students($form->course, "u.lastname ASC"); $i=0; if ($students) foreach ($students as $student) { echo "\n"; echo "\n"; echo "\n"; for($j=1;$j<=$form->hours;$j++) { // set the attendance defaults for each student $r1c=$r2c=$r3c=" "; $rollstatus = (($form->edited==0)?$CFG->attendance_default_student_status: ((isset($sroll[$student->id][$j]->status)?$sroll[$student->id][$j]->status:0))); if ($rollstatus==1) {$r2c="checked";} elseif ($rollstatus==2) {$r3c="checked";} else {$r1c="checked";} $radio1="id."_".$j."\" value=\"0\" ".$r1c.">"; $radio2="id."_".$j."\" value=\"1\" ".$r2c.">"; $radio3="id."_".$j."\" value=\"2\" ".$r3c.">"; echo "\n"; echo "\n"; echo "\n"; } // for loop echo "\n"; // $radio1="id."\" value=\"0\" checked>"; // $radio2="id."\" value=\"1\">"; // $radio3="id."\" value=\"2\">"; // $table->data[$i]=array($student->lastname, $student->firstname, // $student->idnumber, $radio1,$radio2,$radio3); // $i++; } // doing the table manually now // print_table($table); // ending for both the tables echo "
". "Hours:". "$i
Last NameFirst NameID".$P."".$T."".$A."
".$student->lastname."".$student->firstname."".$student->idnumber."".$radio1."".$radio2."".$radio3."
\n"; } // if ($form->id) ?>
course . "§ion=".$form->section ."\">Add multiple rolls

"; ?> "> ">