MDL-21227 - convert Feedback to new files api

This commit is contained in:
Andreas Grabs 2010-04-27 08:30:30 +00:00
parent 873f2e0faa
commit 4f37db419b
2 changed files with 43 additions and 3 deletions

View File

@ -46,7 +46,7 @@
require_capability('mod/feedback:edititems', $context);
$mform = new mod_feedback_import_form();
$mform = new feedback_import_form();
$newformdata = array('id'=>$id,
'deleteolditems'=>'1',
'action'=>'choosefile',
@ -98,6 +98,9 @@
$PAGE->set_title(format_string($feedback->name));
echo $OUTPUT->header();
/// print the tabs
include('tabs.php');
/// Print the main part of the page
///////////////////////////////////////////////////////////////////////////
@ -115,9 +118,9 @@
$mform->display();
echo $OUTPUT->container_start('mdl-align');
// echo $OUTPUT->container_start('mdl-align');
// echo $OUTPUT->single_button(new moodle_url('edit.php', array('id'=>$id, 'do_show'=>'templates')), get_string('cancel'));
echo $OUTPUT->container_end();
// echo $OUTPUT->container_end();
echo $OUTPUT->footer();
function feedback_load_xml_data($xmlcontent) {

View File

@ -0,0 +1,37 @@
<?php
/**
* prints the forms to choose an xml-template file to import items
*
* @author Andreas Grabs
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package feedback
*/
require_once $CFG->libdir.'/formslib.php';
class feedback_import_form extends moodleform {
function definition() {
global $CFG;
$mform =& $this->_form;
//headline
$mform->addElement('header', 'general', '');
$strdeleteolditmes = get_string('delete_old_items', 'feedback').' ('.get_string('oldvalueswillbedeleted','feedback').')';
$strnodeleteolditmes = get_string('append_new_items', 'feedback').' ('.get_string('oldvaluespreserved','feedback').')';
$deleteolditemsarray = array();
$mform->addElement('radio', 'deleteolditems', $strdeleteolditmes, '', true);
$mform->addElement('radio', 'deleteolditems', $strnodeleteolditmes);
$mform->addGroup($deleteolditemsarray, 'deleteolditemsarray', '', array(''), false);
// hidden elements
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$mform->addElement('filepicker', 'choosefile', get_string('file'), null, array('maxbytes' => $CFG->maxbytes, 'filetypes' => '*'));
//-------------------------------------------------------------------------------
// buttons
$this->add_action_buttons(true, get_string('yes'));
}
}