diff --git a/mod/attendance/teacheredit.php b/mod/attendance/teacheredit.php
new file mode 100755
index 00000000000..b93308074f3
--- /dev/null
+++ b/mod/attendance/teacheredit.php
@@ -0,0 +1,233 @@
+
+
+
+
+
+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 = "";
+}
+ ?>
+
| id."\">"; - echo "$strviewall |
| id."\">"; - echo "$strviewweek |
";
+ if (isteacher($course->id)) {
+ echo "id."&return=true\">$strteacheredit
";
+ }
+ echo "id."\">$strviewall
";
+ echo "id."\">$strviewweek