From c5be660bea75f165150240b9a59640f9b86f0e3a Mon Sep 17 00:00:00 2001 From: Vadimon Date: Sat, 30 Jan 2010 01:48:08 +0700 Subject: [PATCH] Managing category visibility in course/editcategory.php --- course/editcategory.php | 1 + course/editcategory_form.php | 4 ++++ lang/en_utf8/moodle.php | 3 +++ 3 files changed, 8 insertions(+), 0 deletions(-) diff --git a/course/editcategory.php b/course/editcategory.php index e0b940d..31694ff 100644 --- a/course/editcategory.php +++ b/course/editcategory.php @@ -52,6 +52,7 @@ if ($mform->is_cancelled()) { $newcategory->name = $data->name; $newcategory->description = $data->description; $newcategory->parent = $data->parent; // if $data->parent = 0, the new category will be a top-level category + $newcategory->visible = $data->visible; if (isset($data->theme) && !empty($CFG->allowcategorythemes)) { $newcategory->theme = $data->theme; diff --git a/course/editcategory_form.php b/course/editcategory_form.php index dc1fc5a..4bb42c9 100644 --- a/course/editcategory_form.php +++ b/course/editcategory_form.php @@ -26,6 +26,10 @@ class editcategory_form extends moodleform { $mform->addRule('name', get_string('required'), 'required', null); $mform->addElement('htmleditor', 'description', get_string('description')); $mform->setType('description', PARAM_RAW); + $choices = array(); + $choices['0'] = get_string('categoryvisibilityhide'); + $choices['1'] = get_string('categoryvisibilityshow'); + $mform->addElement('select', 'visible', get_string('categoryvisibility'), $choices); if (!empty($CFG->allowcategorythemes)) { $themes=array(); $themes[''] = get_string('forceno'); diff --git a/lang/en_utf8/moodle.php b/lang/en_utf8/moodle.php index e592f7f..db5747f 100644 --- a/lang/en_utf8/moodle.php +++ b/lang/en_utf8/moodle.php @@ -199,6 +199,9 @@ $string['categorydeleted'] = 'The category \'$a\' was deleted'; $string['categoryduplicate'] = 'A category named \'$a\' already exists!'; $string['categorymodifiedcancel'] = 'Category was modified! Please cancel and try again.'; $string['categoryname'] = 'Category name'; +$string['categoryvisibility'] = 'Visibility'; +$string['categoryvisibilityshow'] = 'Show'; +$string['categoryvisibilityhide'] = 'Hide'; $string['categoryupdated'] = 'The category \'$a\' was updated'; $string['changedpassword'] = 'Changed password'; $string['changepassword'] = 'Change password'; -- 1.6.5.1.1367.gcd48