Permalink
Browse files

Major changes throughout to change "week" notation to "section" notat…

…ion.

Sections covers "weeks", "topics" and anything else that may come along.
Note, again, some databases have changed esp course_weeks -> course_sections
and several fields called "week" are now "section.  Also course no longer
has an enddate, but instead has a numsections field.
  • Loading branch information...
1 parent 578fdd0 commit b5fe4c935deb57be765d6e944bfb54e2e77b9480 martin committed Jun 25, 2002
View
@@ -32,8 +32,8 @@
"8" => "8 news items",
"9" => "9 news items",
"10" => "10 news items");
- choose_from_menu ($options, "format", "$form->format");
- formerr($err["format"]);
+ choose_from_menu ($options, "newsitems", "$form->newsitems");
+ formerr($err["newsitems"]);
?>
</td>
</tr>
View
@@ -49,7 +49,7 @@
$form = $course;
} else {
$form->category = 0;
- $form->format = 1;
+ $form->newsitems = 1;
}
print_header("Admin: Setting up site", "Administration: Setting up site",
View
@@ -49,6 +49,26 @@
</td>
</tr>
<tr valign=top>
+ <td><P>News items to show:</td>
+ <td><?
+ $options = array("0" => "0 news items",
+ "1" => "1 news item",
+ "2" => "2 news items",
+ "3" => "3 news items",
+ "4" => "4 news items",
+ "5" => "5 news items",
+ "6" => "6 news items",
+ "7" => "7 news items",
+ "8" => "8 news items",
+ "9" => "9 news items",
+ "10" => "10 news items");
+ choose_from_menu ($options, "newsitems", "$form->newsitems");
+ formerr($err["newsitems"]);
+ ?>
+ </td>
+</tr>
+
+<tr valign=top>
<td><P>Word for teacher:</td>
<td><input type="text" name="teacher" size=25 value="<? p($form->teacher) ?>">
(eg Teacher, Tutor, Facilitator etc) <? formerr($err["teacher"]) ?>
@@ -70,12 +90,13 @@
?></td>
</tr>
<tr valign=top>
- <td><P>End date:</td>
+ <td><P>Number of weeks/topics:</td>
<td><?
- choose_from_menu ($form->days, "endday", "$form->endday");
- choose_from_menu ($form->months, "endmonth", "$form->endmonth");
- choose_from_menu ($form->years, "endyear", "$form->endyear");
- formerr($err["enddate"]);
+ for ($i=1; $i<=20; $i++) {
+ $sectionmenu[$i] = "$i";
+ }
+ choose_from_menu ($sectionmenu, "numsections", "$form->numsections");
+ formerr($err["numsections"]);
?></td>
</tr>
<tr>
View
@@ -35,7 +35,6 @@
$form = (object)$HTTP_POST_VARS;
$form->startdate = mktime(0,0,0,(int)$form->startmonth,(int)$form->startday,(int)$form->startyear);
- $form->enddate = mktime(0,0,0,(int)$form->endmonth,(int)$form->endday,(int)$form->endyear);
validate_form($course, $form, $err);
@@ -55,10 +54,10 @@
$form->timecreated = time();
if ($newid = insert_record("course", $form)) { // Set up new course
- $week->course = $newid; // Create a default week.
- $week->week = 0;
- $week->timemodified = time();
- $week->id = insert_record("course_weeks", $week);
+ $section->course = $newid; // Create a default section.
+ $section->section = 0;
+ $section->timemodified = time();
+ $section->id = insert_record("course_sections", $section);
add_to_log($newid, "course", "new", "view.php?id=$newid", "");
redirect("$CFG->wwwroot/admin/teacher.php?id=$newid", "Changes saved");
@@ -81,16 +80,16 @@
if ($course) {
$form = $course;
$ts = getdate($course->startdate);
- $te = getdate($course->enddate);
} else {
$ts = getdate(time() + 3600 * 24);
- $te = getdate(time() + 3600 * 24 * 7 * 16);
$form->teacher = "Facilitator";
$form->student = "Student";
$form->fullname = "Course Fullname 101";
$form->shortname = "CF101";
$form->summary = "Write a concise and interesting paragraph here that explains what this course is about.";
- $form->format = 0;
+ $form->format = "weeks";
+ $form->numsections = 10;
+ $form->newsitems = 5;
$form->category = 1;
}
@@ -109,7 +108,7 @@
for ($i=1;$i<=12;$i++) {
$form->months[$i] = date("F", mktime(0,0,0,$i,1,2000));
}
- for ($i=2000;$i<=2005;$i++) {
+ for ($i=2000;$i<=2010;$i++) {
$form->years[$i] = $i;
}
@@ -155,14 +154,6 @@ function validate_form($course, &$form, &$err) {
if (empty($form->student))
$err["student"] = "Must choose something";
- if ($form->startdate > $form->enddate)
- $err["startdate"] = "Starts after it ends!";
-
-# if (($form->startdate < time()) && ($course->format <> $form->format)) {
-# $err["format"] = "Can't change the format now";
-# $form->format = $course->format;
-# }
-
if (! $form->category)
$err["category"] = "You need to choose a category";
View
@@ -3,15 +3,15 @@
$MAXNEWSDISPLAY = 4;
$FORMATS = array (
- "1" => "Weekly layout",
- "2" => "Social layout",
- "3" => "Topics layout"
+ "weeks" => "Weekly layout",
+ "social" => "Social layout",
+ "topics" => "Topics layout"
);
$SECTION = array (
- "1" => "week",
- "2" => "section",
- "3" => "topic"
+ "weeks" => "week",
+ "social" => "section",
+ "topics" => "topic"
);
Oops, something went wrong.

0 comments on commit b5fe4c9

Please sign in to comment.