Improvements in how incoming parameters are handled, how $editing is handled.

More consistency across course formats for editing stuff, using $PAGE.

Also a "bugfix": when turning editing off, cancel moving an activity if you
were in the middle of doing so.
This commit is contained in:
defacer
2005-02-12 13:09:18 +00:00
parent ff0c7de0b0
commit a3f24f7cc5
4 changed files with 30 additions and 27 deletions
+3 -3
View File
@@ -18,9 +18,9 @@
$preferred_width_right = min($preferred_width_right, BLOCK_R_MAX_WIDTH);
$preferred_width_right = max($preferred_width_right, BLOCK_R_MIN_WIDTH);
$strgroups = get_string("groups");
$strgroupmy = get_string("groupmy");
$editing = isediting($course->id);
$strgroups = get_string('groups');
$strgroupmy = get_string('groupmy');
$editing = $PAGE->user_is_editing();
echo '<table id="layout-table">';
echo '<tr>';
+9 -7
View File
@@ -38,13 +38,15 @@
}
}
$streditsummary = get_string("editsummary");
$stradd = get_string("add");
$stractivities = get_string("activities");
$strshowalltopics = get_string("showalltopics");
$strtopic = get_string("topic");
$strgroups = get_string("groups");
$strgroupmy = get_string("groupmy");
$streditsummary = get_string('editsummary');
$stradd = get_string('add');
$stractivities = get_string('activities');
$strshowalltopics = get_string('showalltopics');
$strtopic = get_string('topic');
$strgroups = get_string('groups');
$strgroupmy = get_string('groupmy');
$editing = $PAGE->user_is_editing();
if ($editing) {
$strstudents = moodle_strtolower($course->students);
$strtopichide = get_string("topichide", "", $strstudents);
+9 -7
View File
@@ -31,13 +31,15 @@
$news = forum_get_course_forum($course->id, "news");
}
$streditsummary = get_string("editsummary");
$stradd = get_string("add");
$stractivities = get_string("activities");
$strshowallweeks = get_string("showallweeks");
$strweek = get_string("week");
$strgroups = get_string("groups");
$strgroupmy = get_string("groupmy");
$streditsummary = get_string('editsummary');
$stradd = get_string('add');
$stractivities = get_string('activities');
$strshowallweeks = get_string('showallweeks');
$strweek = get_string('week');
$strgroups = get_string('groups');
$strgroupmy = get_string('groupmy');
$editing = $PAGE->user_is_editing();
if ($editing) {
$strstudents = moodle_strtolower($course->students);
$strweekhide = get_string("weekhide", "", $strstudents);
+9 -10
View File
@@ -8,6 +8,7 @@
$id = optional_param('id', 0, PARAM_INT);
$name = optional_param('name');
$edit = optional_param('edit');
$idnumber = optional_param('idnumber');
$blockaction = optional_param('blockaction');
@@ -47,19 +48,17 @@
$USER->editing = false;
}
$editing = false;
if (isteacheredit($course->id)) {
if (isset($edit)) {
if ($edit == "on") {
$USER->editing = true;
} else if ($edit == "off") {
$USER->editing = false;
if ($PAGE->user_allowed_editing()) {
if ($edit == 'on') {
$USER->editing = true;
} else if ($edit == 'off') {
$USER->editing = false;
if(!empty($USER->activitycopy) && $USER->activitycopycourse == $course->id) {
$USER->activitycopy = false;
$USER->activitycopycourse = NULL;
}
}
$editing = $USER->editing;
if (isset($hide) && confirm_sesskey()) {
set_section_visible($course->id, $hide, '0');
}