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

« back to all changes in this revision

Viewing changes to question/type/random/edit_random_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:
5
5
 * @copyright © 2007 Jamie Pratt
6
6
 * @author Jamie Pratt me@jamiep.org
7
7
 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
8
 
 * @package questions
 
8
 * @package questionbank
 
9
 * @subpackage questiontypes
9
10
 */
10
11
 
11
12
/**
30
31
        // Standard fields at the start of the form.
31
32
        $mform->addElement('header', 'generalheader', get_string("general", 'form'));
32
33
 
33
 
        $mform->addElement('questioncategory', 'category', get_string('category', 'quiz'),
34
 
                array('courseid' => $COURSE->id, 'published' => true, 'only_editable' => true));
35
 
 
36
 
        $mform->addElement('text', 'name', get_string('questionname', 'quiz'),
37
 
                array('size' => 50));
38
 
        $mform->setType('name', PARAM_TEXT);
39
 
        $mform->addRule('name', null, 'required', null, 'client');
 
34
        $mform->addElement('questioncategory', 'category', get_string('category', 'quiz'), 
 
35
                array('contexts' => $this->contexts->having_cap('moodle/question:useall')));
40
36
 
41
37
        $mform->addElement('advcheckbox', 'questiontext', get_string("recurse", "quiz"), null, null, array(0, 1));
42
38
 
56
52
        $mform->addElement('hidden', 'versioning');
57
53
        $mform->setType('versioning', PARAM_BOOL);
58
54
 
 
55
        $mform->addElement('hidden', 'cmid');
 
56
        $mform->setType('cmid', PARAM_INT);
 
57
        $mform->setDefault('cmid', 0);
 
58
 
 
59
        $mform->addElement('hidden', 'courseid');
 
60
        $mform->setType('courseid', PARAM_INT);
 
61
        $mform->setDefault('courseid', 0);
 
62
 
 
63
        $mform->addElement('hidden', 'returnurl');
 
64
        $mform->setType('returnurl', PARAM_LOCALURL);
 
65
        $mform->setDefault('returnurl', 0);
 
66
 
59
67
        $buttonarray = array();
60
68
        $buttonarray[] = &$mform->createElement('submit', 'submitbutton', get_string('savechanges'));
61
69
 
63
71
        $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
64
72
        $mform->closeHeaderBefore('buttonar');
65
73
    }
66
 
 
67
 
    function set_data($question) {
68
 
        if (empty($question->name)) {
69
 
            $question->name = get_string("random", "quiz");
70
 
        }
71
 
        parent::set_data($question);
 
74
    function validation($fromform, $files) {
 
75
        //validation of category
 
76
        //is not relevant for this question type
 
77
        return array();
72
78
    }
73
 
 
74
79
    function qtype() {
75
80
        return 'random';
76
81
    }