existing questions now can be saved as new question

This commit is contained in:
Andreas Grabs 2010-06-04 21:12:27 +00:00
parent 6cc1599e09
commit 9e1aed5330
9 changed files with 38 additions and 0 deletions

View File

@ -73,6 +73,7 @@ abstract class feedback_item_form extends moodleform {
$buttonarray = array();
if(!empty($item->id)){
$buttonarray[] = &$mform->createElement('submit', 'update_item', get_string('update_item', 'feedback'));
$buttonarray[] = &$mform->createElement('submit', 'clone_item', get_string('save_as_new_item', 'feedback'));
}else{
$buttonarray[] = &$mform->createElement('submit', 'save_item', get_string('save_item', 'feedback'));
}

View File

@ -68,6 +68,11 @@ class feedback_item_info extends feedback_item_base {
return false;
}
if($item->clone_item) {
$item->id = ''; //to clone this item
$item->position++;
}
$item->hasvalue = $this->get_hasvalue();
if(!$item->id) {
$item->id = $DB->insert_record('feedback_item', $item);

View File

@ -81,6 +81,12 @@ class feedback_item_label extends feedback_item_base {
if(!$item = $this->item_form->get_data()) {
return false;
}
if($item->clone_item) {
$item->id = ''; //to clone this item
$item->position++;
}
$item->presentation = '';
$item->hasvalue = $this->get_hasvalue();

View File

@ -77,6 +77,11 @@ class feedback_item_multichoice extends feedback_item_base {
return false;
}
if($item->clone_item) {
$item->id = ''; //to clone this item
$item->position++;
}
$this->set_ignoreempty($item, $item->ignoreempty);
$this->set_hidenoselect($item, $item->hidenoselect);

View File

@ -82,6 +82,11 @@ class feedback_item_multichoicerated extends feedback_item_base {
return false;
}
if($item->clone_item) {
$item->id = ''; //to clone this item
$item->position++;
}
$this->set_ignoreempty($item, $item->ignoreempty);
$this->set_hidenoselect($item, $item->hidenoselect);

View File

@ -82,6 +82,11 @@ class feedback_item_numeric extends feedback_item_base {
return false;
}
if($item->clone_item) {
$item->id = ''; //to clone this item
$item->position++;
}
$item->hasvalue = $this->get_hasvalue();
if(!$item->id) {
$item->id = $DB->insert_record('feedback_item', $item);

View File

@ -73,6 +73,11 @@ class feedback_item_textarea extends feedback_item_base {
return false;
}
if($item->clone_item) {
$item->id = ''; //to clone this item
$item->position++;
}
$item->hasvalue = $this->get_hasvalue();
if(!$item->id) {
$item->id = $DB->insert_record('feedback_item', $item);

View File

@ -73,6 +73,11 @@ class feedback_item_textfield extends feedback_item_base {
return false;
}
if($item->clone_item) {
$item->id = ''; //to clone this item
$item->position++;
}
$item->hasvalue = $this->get_hasvalue();
if(!$item->id) {
$item->id = $DB->insert_record('feedback_item', $item);

View File

@ -227,6 +227,7 @@ $string['resetting_feedbacks'] = 'Resetting feedbacks';
$string['response_nr'] = 'Response Nr.';
$string['responses'] = 'Responses';
$string['responsetime'] = 'Responsestime';
$string['save_as_new_item'] = 'Save as new question';
$string['save_as_new_template'] = 'Save as new template';
$string['save_entries'] = 'Submit your answers';
$string['save_item'] = 'Save question';