fixed typos in $string['configshowtimes']
[moodle.git] / course / editsection.php
blob2e7437b06377f98f319fc7d572349373213e5ac0
1 <?php // $Id$
2 // Edit the introduction of a section
4 require_once("../config.php");
5 require_once("lib.php");
7 $id = required_param('id',PARAM_INT); // Week ID
9 require_login();
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() and confirm_sesskey()) {
28 $timenow = time();
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");
37 exit;
40 /// Otherwise fill and print the form.
42 if (empty($form)) {
43 $form = $section;
44 } else {
45 $form = stripslashes_safe($form);
48 // !! no db access using data from $form beyond this point !!
50 $usehtmleditor = can_use_html_editor();
52 /// Inelegant hack for bug 3408
53 if ($course->format == 'site') {
54 $sectionname = get_string('site');
55 $stredit = get_string('edit', '', " $sectionname");
56 $strsummaryof = get_string('summaryof', '', " $sectionname");
57 } else {
58 $sectionname = get_string("name$course->format");
59 $stredit = get_string('edit', '', " $sectionname $section->section");
60 $strsummaryof = get_string('summaryof', '', " $sectionname $form->section");
63 print_header_simple($stredit, '', $stredit);
65 print_heading($strsummaryof);
66 print_simple_box_start('center');
67 include('editsection.html');
68 print_simple_box_end();
70 if ($usehtmleditor) {
71 use_html_editor("summary");
73 print_footer($course);