moodle/course/editsection.php

66 lines
1.7 KiB
PHP
Raw Normal View History

2002-06-25 11:46:12 +00:00
<?PHP // $Id$
// Edit the introduction of a section
2002-06-25 11:46:12 +00:00
require_once("../config.php");
require_once("lib.php");
2002-06-25 11:46:12 +00:00
require_variable($id); // Week ID
require_login();
2002-06-25 11:46:12 +00:00
if (! $section = get_record("course_sections", "id", $id)) {
error("Course section is incorrect");
}
if (! $course = get_record("course", "id", $section->course)) {
error("Could not find the course!");
}
if (!isteacher($course->id)) {
error("Only teachers can edit this!");
}
/// If data submitted, then process and store.
if ($form = data_submitted()) {
2002-06-25 11:46:12 +00:00
$timenow = time();
if (! set_field("course_sections", "summary", $form->summary, "id", $section->id)) {
2002-06-25 11:46:12 +00:00
error("Could not update the summary!");
}
add_to_log($course->id, "course", "editsection", "editsection.php?id=$section->id", "$section->section");
redirect("view.php?id=$course->id");
exit;
}
/// Otherwise fill and print the form.
2003-01-02 15:25:51 +00:00
if (empty($form)) {
2002-06-25 11:46:12 +00:00
$form = $section;
}
$usehtmleditor = can_use_html_editor();
$sectionname = get_string("name$course->format");
2002-08-04 02:10:00 +00:00
$stredit = get_string("edit", "", " $sectionname $section->section");
2002-06-25 11:46:12 +00:00
print_header("$course->shortname: $stredit", "$course->fullname",
"<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A>
-> $stredit");
2002-06-25 11:46:12 +00:00
print_heading(get_string("summaryof", "", "$sectionname $form->section"));
print_simple_box_start("center", "", "$THEME->cellheading");
2002-06-25 11:46:12 +00:00
include("editsection.html");
print_simple_box_end();
2002-06-25 11:46:12 +00:00
if ($usehtmleditor) {
use_html_editor("summary");
}
2002-06-25 11:46:12 +00:00
print_footer($course);
?>