Renamed from editweek to editsection
[moodle.git] / course / editsection.php
CommitLineData
578fdd0a 1<?PHP // $Id$
2
3 require("../config.php");
4 require("lib.php");
5
6 require_variable($id); // Week ID
7
8 if (! $section = get_record("course_sections", "id", $id)) {
9 error("Course section is incorrect");
10 }
11
12 if (! $course = get_record("course", "id", $section->course)) {
13 error("Could not find the course!");
14 }
15
16 require_login($course->id);
17
18 if (!isteacher($course->id)) {
19 error("Only teachers can edit this!");
20 }
21
22
23/// If data submitted, then process and store.
24
25 if (match_referer() && isset($HTTP_POST_VARS)) {
26
27 $timenow = time();
28
29 if (! set_field("course_sections", "summary", $summary, "id", $section->id)) {
30 error("Could not update the summary!");
31 }
32
33 add_to_log($course->id, "course", "editsection", "editsection.php?id=$section->id", "$section->section");
34
35 redirect("view.php?id=$course->id");
36 exit;
37 }
38
39/// Otherwise fill and print the form.
40
41 if (! $form ) {
42 $form = $section;
43 }
44
45 $sectionname = $SECTION[$course->format];
46
47 print_header("Edit $sectionname $section->section", "Edit $sectionname $section->section", "", "form.summary");
48
49 include("editsection.html");
50
51 print_footer($course);
52
53?>