mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
merge the items dropdown, radio and check to multiplechoice item
merge the items dropdownrated, radiorated to multiplechoicerated item the creating or editing of an item now use the formslib
This commit is contained in:
parent
13b31d6f9d
commit
6ee09cfe8b
25 changed files with 1342 additions and 1708 deletions
|
@ -8,49 +8,30 @@ class feedback_item_textarea extends feedback_item_base {
|
|||
|
||||
}
|
||||
|
||||
function show_edit($item, $usehtmleditor = false) {
|
||||
function show_edit($item) {
|
||||
global $CFG;
|
||||
|
||||
$item->presentation=empty($item->presentation)?'':$item->presentation;
|
||||
require_once('textarea_form.php');
|
||||
|
||||
$item_form = new feedback_textarea_form();
|
||||
|
||||
?>
|
||||
<table>
|
||||
<tr>
|
||||
<th colspan="2"><?php print_string('textarea', 'feedback');?>
|
||||
(<input type="checkbox" name="required" value="1" <?php
|
||||
$item->required=isset($item->required)?$item->required:0;
|
||||
echo ($item->required == 1?'checked="checked"':'');
|
||||
?> /> <?php print_string('required', 'feedback');?>)
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print_string('item_name', 'feedback');?></td>
|
||||
<td><input type="text" id="itemname" name="itemname" size="40" maxlength="255" value="<?php echo isset($item->name)?htmlspecialchars(stripslashes_safe($item->name)):'';?>" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print_string('textarea_width', 'feedback');?></td>
|
||||
<td>
|
||||
<select name="itemwidth">
|
||||
<?php
|
||||
//Dropdown-Items fuer die Textareabreite
|
||||
$widthAndHeight = explode('|',$item->presentation);
|
||||
feedback_print_numeric_option_list(5, 80, $widthAndHeight[0]?$widthAndHeight[0]:30, 5);
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php print_string('textarea_height', 'feedback');?></td>
|
||||
<td>
|
||||
<select name="itemheight">
|
||||
<?php
|
||||
//Dropdown-Items fuer die Textareahoehe
|
||||
feedback_print_numeric_option_list(5, 40, $widthAndHeight[1], 5);
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
$item->presentation = empty($item->presentation) ? '' : $item->presentation;
|
||||
$item->name = empty($item->name) ? '' : $item->name;
|
||||
|
||||
$item->required = isset($item->required) ? $item->required : 0;
|
||||
if($item->required) {
|
||||
$item_form->requiredcheck->setValue(true);
|
||||
}
|
||||
|
||||
$item_form->itemname->setValue($item->name);
|
||||
|
||||
$widthAndHeight = explode('|',$item->presentation);
|
||||
$itemwidth = isset($widthAndHeight[0]) ? $widthAndHeight[0] : 30;
|
||||
$itemheight = isset($widthAndHeight[1]) ? $widthAndHeight[1] : 5;
|
||||
$item_form->selectwith->setValue($itemwidth);
|
||||
$item_form->selectheight->setValue($itemheight);
|
||||
|
||||
return $item_form;
|
||||
}
|
||||
|
||||
//liefert eine Struktur ->name, ->data = array(mit Antworten)
|
||||
|
|
32
mod/feedback/item/textarea/textarea_form.php
Normal file
32
mod/feedback/item/textarea/textarea_form.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
require_once $CFG->libdir.'/formslib.php';
|
||||
|
||||
class feedback_textarea_form extends moodleform {
|
||||
var $type = "textarea";
|
||||
var $requiredcheck;
|
||||
var $itemname;
|
||||
var $selectwith;
|
||||
var $selectheight;
|
||||
|
||||
function definition() {
|
||||
$mform =& $this->_form;
|
||||
|
||||
$mform->addElement('header', 'general', get_string($this->type, 'feedback'));
|
||||
$this->requiredcheck = $mform->addElement('checkbox', 'required', get_string('required', 'feedback'));
|
||||
|
||||
$this->itemname = $mform->addElement('text', 'itemname', get_string('item_name', 'feedback'), array('size="40"','maxlength="255"'));
|
||||
|
||||
$this->selectwith = $mform->addElement('select',
|
||||
'itemwidth',
|
||||
get_string('textarea_width', 'feedback').' ',
|
||||
array_slice(range(0,80),5,80,true));
|
||||
|
||||
$this->selectheight = $mform->addElement('select',
|
||||
'itemheight',
|
||||
get_string('textarea_height', 'feedback').' ',
|
||||
array_slice(range(0,40),5,40,true));
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue