MDL-24316 adding support for stealth sections on course edit page - work in progress, we need to decide how to visualise it and what lang strings to use

This commit is contained in:
Petr Skoda
2010-10-13 20:17:56 +00:00
parent 4d4d20e7a2
commit 4cac68ab13
2 changed files with 71 additions and 0 deletions
+36
View File
@@ -25,6 +25,8 @@
* @package
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir.'/filelib.php');
$topic = optional_param('topic', -1, PARAM_INT);
@@ -87,6 +89,7 @@ if (ismoving($course->id)) {
$section = 0;
$thissection = $sections[$section];
unset($sections[0]);
if ($thissection->summary or $thissection->sequence or $PAGE->user_is_editing()) {
@@ -249,8 +252,41 @@ while ($section <= $course->numsections) {
echo "</li>\n";
}
unset($sections[$section]);
$section++;
}
if ($PAGE->user_is_editing() && has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $course->id))) {
// print stealth sections if present
$modinfo = get_fast_modinfo($course);
foreach ($sections as $section=>$thissection) {
if (empty($modinfo->sections[$section])) {
continue;
}
$strstealth = 'Invisible topic'; //TODO: MDL-24316 to be localised after we decide how to call this (skodak)
echo '<li id="section-'.$section.'" class="section main clearfix stealth hidden">'; //'<div class="left side">&nbsp;</div>';
echo '<div class="left side">';
echo $strstealth;
echo '</div>';
// Note, 'right side' is BEFORE content.
echo '<div class="right side">';
echo $strstealth;
echo '</div>';
echo '<div class="content">';
print_section($course, $thissection, $mods, $modnamesused);
echo '<br />';
if ($PAGE->user_is_editing()) {
print_section_add_menus($course, $section, $modnames);
}
echo '</div>';
echo "</li>\n";
}
}
echo "</ul>\n";
if (!empty($sectionmenu)) {
+35
View File
@@ -24,6 +24,8 @@
* @package
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir.'/filelib.php');
$week = optional_param('week', -1, PARAM_INT);
@@ -79,6 +81,7 @@
$section = 0;
$thissection = $sections[$section];
unset($sections[0]);
if ($thissection->summary or $thissection->sequence or $PAGE->user_is_editing()) {
@@ -248,9 +251,41 @@
echo "</li>\n";
}
unset($sections[$section]);
$section++;
$weekdate = $nextweekdate;
}
if ($PAGE->user_is_editing() && has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $course->id))) {
// print stealth sections if present
$modinfo = get_fast_modinfo($course);
foreach ($sections as $section=>$thissection) {
if (empty($modinfo->sections[$section])) {
continue;
}
$strstealth = 'Invisible week'; //TODO: MDL-24316 to be localised after we decide how to call this (skodak)
echo '<li id="section-'.$section.'" class="section main clearfix stealth hidden">'; //'<div class="left side">&nbsp;</div>';
echo '<div class="left side">';
echo $strstealth;
echo '</div>';
// Note, 'right side' is BEFORE content.
echo '<div class="right side">';
echo $strstealth;
echo '</div>';
echo '<div class="content">';
print_section($course, $thissection, $mods, $modnamesused);
echo '<br />';
if ($PAGE->user_is_editing()) {
print_section_add_menus($course, $section, $modnames);
}
echo '</div>';
echo "</li>\n";
}
}
echo "</ul>\n";
if (!empty($sectionmenu)) {