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

« back to all changes in this revision

Viewing changes to mod/data/mod_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:
6
6
    function definition() {
7
7
 
8
8
        global $CFG;
9
 
        $mform    =& $this->_form;
 
9
        $mform =& $this->_form;
10
10
 
11
11
//-------------------------------------------------------------------------------
12
12
        $mform->addElement('header', 'general', get_string('general', 'form'));
13
13
 
14
14
        $mform->addElement('text', 'name', get_string('name'), array('size'=>'64'));
15
 
        $mform->setType('name', PARAM_TEXT);
 
15
        if (!empty($CFG->formatstringstriptags)) {
 
16
            $mform->setType('name', PARAM_TEXT);
 
17
        } else {
 
18
            $mform->setType('name', PARAM_CLEAN);
 
19
        }
16
20
        $mform->addRule('name', null, 'required', null, 'client');
17
21
 
18
22
        $mform->addElement('htmleditor', 'intro', get_string('intro', 'data'));
29
33
        $mform->addElement('date_selector', 'timeviewto', get_string('viewtodate', 'data'), array('optional'=>true));
30
34
 
31
35
 
32
 
        $countoptions=  array(0=>get_string('none'))+
 
36
        $countoptions = array(0=>get_string('none'))+
33
37
                        (array_combine(range(1, DATA_MAX_ENTRIES),//keys
34
38
                                        range(1, DATA_MAX_ENTRIES)));//values
35
39
        $mform->addElement('select', 'requiredentries', get_string('requiredentries', 'data'), $countoptions);
41
45
        $mform->addElement('select', 'maxentries', get_string('maxentries', 'data'), $countoptions);
42
46
        $mform->setHelpButton('maxentries', array('maxentries', get_string('maxentries', 'data'), 'data'));
43
47
 
44
 
        $ynoptions = array( 0 => get_string('no'), 1 => get_string('yes'));
 
48
        $ynoptions = array(0 => get_string('no'), 1 => get_string('yes'));
45
49
        $mform->addElement('select', 'comments', get_string('comments', 'data'), $ynoptions);
46
50
        $mform->setHelpButton('comments', array('comments', get_string('allowcomments', 'data'), 'data'));
47
51
 
48
52
        $mform->addElement('select', 'approval', get_string('requireapproval', 'data'), $ynoptions);
49
53
        $mform->setHelpButton('approval', array('requireapproval', get_string('requireapproval', 'data'), 'data'));
50
54
 
51
 
        $mform->addElement('select', 'rssarticles', get_string('numberrssarticles', 'data') , $countoptions);
 
55
        if($CFG->enablerssfeeds && $CFG->data_enablerssfeeds){
 
56
            $mform->addElement('select', 'rssarticles', get_string('numberrssarticles', 'data') , $countoptions);
 
57
        }
52
58
 
53
 
        $mform->addElement('checkbox', 'assessed', get_string("allowratings", "data") , get_string('ratingsuse', 'data'));
 
59
        $mform->addElement('checkbox', 'assessed', get_string('allowratings', 'data') , get_string('ratingsuse', 'data'));
54
60
 
55
61
        $mform->addElement('modgrade', 'scale', get_string('grade'), false);
56
62
        $mform->disabledIf('scale', 'assessed');
57
63
 
58
64
 
59
 
        $this->standard_coursemodule_elements();
 
65
        $this->standard_coursemodule_elements(array('groups'=>true, 'groupings'=>true, 'groupmembersonly'=>true));
60
66
 
61
67
//-------------------------------------------------------------------------------
62
68
        // buttons
63
69
        $this->add_action_buttons();
64
70
    }
65
71
 
 
72
    function data_preprocessing(&$default_values){
 
73
        if (empty($default_values['scale'])){
 
74
            $default_values['assessed'] = 0;
 
75
        }        
 
76
    }
66
77
 
67
78
}
68
 
?>
 
 
b'\\ No newline at end of file'
 
79
?>