2 // Edit the introduction of a section
4 require_once("../config.php");
5 require_once("lib.php");
7 require_variable($id); // Week ID
11 if (! $section = get_record("course_sections", "id", $id)) {
12 error("Course section is incorrect");
15 if (! $course = get_record("course", "id", $section->course)) {
16 error("Could not find the course!");
19 if (!isteacher($course->id)) {
20 error("Only teachers can edit this!");
24 /// If data submitted, then process and store.
26 if ($form = data_submitted()) {
30 if (! set_field("course_sections", "summary", $form->summary, "id", $section->id)) {
31 error("Could not update the summary!");
34 add_to_log($course->id, "course", "editsection", "editsection.php?id=$section->id", "$section->section");
36 redirect("view.php?id=$course->id");
40 /// Otherwise fill and print the form.
46 $usehtmleditor = can_use_html_editor();
48 $sectionname = get_string("name$course->format");
49 $stredit = get_string("edit", "", " $sectionname $section->section");
51 print_header("$course->shortname: $stredit", "$course->fullname",
52 "<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A>
55 print_heading(get_string("summaryof", "", "$sectionname $form->section"));
56 print_simple_box_start("center", "", "$THEME->cellheading");
57 include("editsection.html");
58 print_simple_box_end();
63 print_footer($course);