~ubuntu-branches/ubuntu/jaunty/moodle/jaunty

« back to all changes in this revision

Viewing changes to course/editcategory_form.php

  • Committer: Bazaar Package Importer
  • Author(s): Jordan Mantha, Matt Oquist
  • Date: 2009-02-25 15:16:22 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20090225151622-0ekt1liwhv2obfza
Tags: 1.9.4.dfsg-0ubuntu1
* Merge with Debian git (Closes LP: #322961, #239481, #334611):
  - use Ubuntu's smarty lib directory for linking
  - use internal yui library 
  - add update-notifier support back in

[Matt Oquist]
  * renamed prerm script
  * significantly rewrote postinst and other maintainer scripts to improve
    user experience and package maintainability
    (Closes LP: #225662, #325450, #327843, #303078, #234609)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php 
 
2
require_once ($CFG->dirroot.'/course/moodleform_mod.php');
 
3
class editcategory_form extends moodleform {
 
4
 
 
5
    // form definition
 
6
    function definition() {
 
7
        global $CFG;
 
8
        $mform =& $this->_form;
 
9
        $category = $this->_customdata;
 
10
 
 
11
        // get list of categories to use as parents, with site as the first one
 
12
        $options = array(get_string('top'));
 
13
        $parents = array();
 
14
        if ($category->id) {
 
15
            // Editing an existing category.
 
16
            make_categories_list($options, $parents, 'moodle/category:manage', $category->id);
 
17
            $strsubmit = get_string('savechanges');
 
18
        } else {
 
19
            // Making a new category
 
20
            make_categories_list($options, $parents, 'moodle/category:manage');
 
21
            $strsubmit = get_string('createcategory');
 
22
        }
 
23
 
 
24
        $mform->addElement('select', 'parent', get_string('parentcategory'), $options);
 
25
        $mform->addElement('text', 'name', get_string('categoryname'), array('size'=>'30'));
 
26
        $mform->addRule('name', get_string('required'), 'required', null);
 
27
        $mform->addElement('htmleditor', 'description', get_string('description'));
 
28
        $mform->setType('description', PARAM_RAW);
 
29
        if (!empty($CFG->allowcategorythemes)) {
 
30
            $themes=array();
 
31
            $themes[''] = get_string('forceno');
 
32
            $themes += get_list_of_themes();
 
33
            $mform->addElement('select', 'theme', get_string('forcetheme'), $themes);
 
34
        }
 
35
        $mform->setHelpButton('description', array('writing', 'richtext'), false, 'editorhelpbutton');
 
36
 
 
37
        $mform->addElement('hidden', 'id', 0);
 
38
        $mform->setType('id', PARAM_INT);
 
39
        $mform->setDefault('id', $category->id);
 
40
 
 
41
        $this->add_action_buttons(true, $strsubmit);
 
42
    }
 
43
 
44
?>