Skip to content

Commit

Permalink
test for has_capability before displaying choosecoursefile control as…
Browse files Browse the repository at this point in the history
… if user does not have permission then control is useless.
  • Loading branch information
jamiesensei committed Sep 10, 2007
1 parent 5b875eb commit 15b8358
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions question/import_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function definition() {
$mform->addElement('selectyesno', 'stoponerror', get_string('stoponerror', 'quiz'));
$mform->setDefault('stoponerror', 1);
$mform->setHelpButton('stoponerror', array('stoponerror', get_string('stoponerror', 'quiz'), 'quiz'));

//--------------------------------------------------------------------------------
$mform->addElement('header', 'importfileupload', get_string('importfileupload','quiz'));

Expand All @@ -59,11 +59,13 @@ function definition() {
$this->add_action_buttons(true, get_string('uploadthisfile'));

//--------------------------------------------------------------------------------
$mform->addElement('header', 'importfilearea', get_string('importfilearea','quiz'));
if (has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $COURSE->id))){
$mform->addElement('header', 'importfilearea', get_string('importfilearea','quiz'));

$mform->addElement('choosecoursefile', 'choosefile', get_string('choosefile','quiz'));
$mform->addElement('choosecoursefile', 'choosefile', get_string('choosefile','quiz'));
//--------------------------------------------------------------------------------
$this->add_action_buttons(true, get_string('importfromthisfile','quiz'));
$this->add_action_buttons(true, get_string('importfromthisfile','quiz'));
}
//--------------------------------------------------------------------------------
}
function get_importfile_name(){
Expand Down

0 comments on commit 15b8358

Please sign in to comment.