mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
fixed issue MDL-14531
added an option to switch autonumbering on or off
This commit is contained in:
parent
914061abe1
commit
efc5916754
@ -146,7 +146,14 @@
|
||||
$itemclass = 'feedback_item_'.$item->typ;
|
||||
//get the instance of the item-class
|
||||
$itemobj = new $itemclass();
|
||||
$itemnr = $itemobj->print_analysed($item, $itemnr, $mygroupid);
|
||||
$itemnr++;
|
||||
if($feedback->autonumbering) {
|
||||
$printnr = $itemnr.'.';
|
||||
} else {
|
||||
$printnr = '';
|
||||
}
|
||||
$itemobj->print_analysed($item, $printnr, $mygroupid);
|
||||
// $itemnr = $itemobj->print_analysed($item, $itemnr, $mygroupid);
|
||||
echo '</table>';
|
||||
}
|
||||
}else {
|
||||
|
@ -169,7 +169,13 @@
|
||||
$itemclass = 'feedback_item_'.$item->typ;
|
||||
//get the instance of the item-class
|
||||
$itemobj = new $itemclass();
|
||||
$itemnr = $itemobj->print_analysed($item, $itemnr, $mygroupid, $coursefilter);
|
||||
$itemnr++;
|
||||
if($feedback->autonumbering) {
|
||||
$printnr = $itemnr.'.';
|
||||
} else {
|
||||
$printnr = '';
|
||||
}
|
||||
$itemobj->print_analysed($item, $printnr, $mygroupid, $coursefilter);
|
||||
if (eregi('rated$', $item->typ)) {
|
||||
echo '<tr><td colspan="2"><a href="#" onclick="setcourseitemfilter('.$item->id.',\''.$item->typ.'\'); return false;">'.
|
||||
get_string('sort_by_course', 'feedback').'</a></td></tr>';
|
||||
|
@ -62,6 +62,7 @@
|
||||
fwrite ($bf,full_tag("ANONYMOUS",4,false,$feedback->anonymous));
|
||||
fwrite ($bf,full_tag("EMAILNOTIFICATION",4,false,$feedback->email_notification));
|
||||
fwrite ($bf,full_tag("MULTIPLESUBMIT",4,false,$feedback->multiple_submit));
|
||||
fwrite ($bf,full_tag("AUTONUMBERING",4,false,$feedback->autonumbering));
|
||||
fwrite ($bf,full_tag("PAGEAFTERSUB",4,false,$feedback->page_after_submit));
|
||||
fwrite ($bf,full_tag("PUBLISHSTATS",4,false,$feedback->publish_stats));
|
||||
fwrite ($bf,full_tag("TIMEOPEN",4,false,$feedback->timeopen));
|
||||
|
@ -325,9 +325,9 @@
|
||||
}
|
||||
}
|
||||
echo '<tr>';
|
||||
if($feedbackitem->hasvalue == 1) {
|
||||
if($feedbackitem->hasvalue == 1 AND $feedback->autonumbering) {
|
||||
$itemnr++;
|
||||
echo '<td valign="top">' . $itemnr . '.) </td>';
|
||||
echo '<td valign="top">' . $itemnr . '. </td>';
|
||||
} else {
|
||||
echo '<td> </td>';
|
||||
}
|
||||
|
@ -300,9 +300,9 @@
|
||||
}
|
||||
}
|
||||
echo '<tr>';
|
||||
if($feedbackitem->hasvalue == 1) {
|
||||
if($feedbackitem->hasvalue == 1 AND $feedback->autonumbering) {
|
||||
$itemnr++;
|
||||
echo '<td valign="top">' . $itemnr . '.) </td>';
|
||||
echo '<td valign="top">' . $itemnr . '. </td>';
|
||||
} else {
|
||||
echo '<td> </td>';
|
||||
}
|
||||
|
@ -9,7 +9,8 @@
|
||||
<FIELD NAME="summary" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name" NEXT="anonymous"/>
|
||||
<FIELD NAME="anonymous" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="summary" NEXT="email_notification"/>
|
||||
<FIELD NAME="email_notification" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="anonymous" NEXT="multiple_submit"/>
|
||||
<FIELD NAME="multiple_submit" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="email_notification" NEXT="page_after_submit"/>
|
||||
<FIELD NAME="multiple_submit" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="email_notification" NEXT="autonumbering"/>
|
||||
<FIELD NAME="autonumbering" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="multiple_submit" NEXT="page_after_submit"/>
|
||||
<FIELD NAME="page_after_submit" TYPE="text" LENGTH="small" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="multiple_submit" NEXT="publish_stats"/>
|
||||
<FIELD NAME="publish_stats" TYPE="int" LENGTH="1" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="page_after_submit" NEXT="timeopen"/>
|
||||
<FIELD NAME="timeopen" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="publish_stats" NEXT="timeclose"/>
|
||||
|
@ -199,15 +199,14 @@ function xmldb_feedback_upgrade($oldversion=0) {
|
||||
$result = $result && insert_record('log_display', $new_log_display);
|
||||
}
|
||||
|
||||
/// And upgrade begins here. For each one, you'll need one
|
||||
/// block of code similar to the next one. Please, delete
|
||||
/// this comment lines once this file start handling proper
|
||||
/// upgrade code.
|
||||
|
||||
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
|
||||
/// $result = result of "/lib/ddllib.php" function calls
|
||||
/// }
|
||||
|
||||
if ($result && $oldversion < 2008042900) {
|
||||
/// Define field autonumbering to be added to feedback
|
||||
$table = new XMLDBTable('feedback');
|
||||
$field = new XMLDBField('autonumbering');
|
||||
$field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '1', 'multiple_submit');
|
||||
/// Launch add field2
|
||||
$result = $result && add_field($table, $field);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -248,9 +248,9 @@
|
||||
}
|
||||
echo '<tr>';
|
||||
//items without value only are labels
|
||||
if($feedbackitem->hasvalue == 1) {
|
||||
if($feedbackitem->hasvalue == 1 AND $feedback->autonumbering) {
|
||||
$itemnr++;
|
||||
echo '<td valign="top">' . $itemnr . '.) </td>';
|
||||
echo '<td valign="top">' . $itemnr . '. </td>';
|
||||
} else {
|
||||
echo '<td> </td>';
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ class feedback_item_captcha extends feedback_item_base {
|
||||
return '';
|
||||
}
|
||||
|
||||
function print_analysed($item, $itemnr = 0, $groupid = false, $courseid = false) {
|
||||
function print_analysed($item, $itemnr = '', $groupid = false, $courseid = false) {
|
||||
return $itemnr;
|
||||
}
|
||||
|
||||
|
@ -51,12 +51,12 @@ class feedback_item_base {
|
||||
|
||||
/**
|
||||
* @param $item the db-object from feedback_item
|
||||
* @param integer $itemnr
|
||||
* @param string $itemnr
|
||||
* @param integer $groupid
|
||||
* @param integer $courseid
|
||||
* @return integer the new itemnr
|
||||
*/
|
||||
function print_analysed($item, $itemnr = 0, $groupid = false, $courseid = false) {
|
||||
function print_analysed($item, $itemnr = '', $groupid = false, $courseid = false) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ class feedback_item_multichoice extends feedback_item_base {
|
||||
return $printval;
|
||||
}
|
||||
|
||||
function print_analysed($item, $itemnr = 0, $groupid = false, $courseid = false) {
|
||||
function print_analysed($item, $itemnr = '', $groupid = false, $courseid = false) {
|
||||
$sep_dec = get_string('separator_decimal', 'feedback');
|
||||
if(substr($sep_dec, 0, 2) == '[['){
|
||||
$sep_dec = FEEDBACK_DECIMAL;
|
||||
@ -146,9 +146,9 @@ class feedback_item_multichoice extends feedback_item_base {
|
||||
|
||||
$analysedItem = $this->get_analysed($item, $groupid, $courseid);
|
||||
if($analysedItem) {
|
||||
$itemnr++;
|
||||
// $itemnr++;
|
||||
$itemname = stripslashes($analysedItem[1]);
|
||||
echo '<tr><th colspan="2" align="left">'. $itemnr . '.) ' . $itemname .'</th></tr>';
|
||||
echo '<tr><th colspan="2" align="left">'. $itemnr . ' ' . $itemname .'</th></tr>';
|
||||
$analysedVals = $analysedItem[2];
|
||||
$pixnr = 0;
|
||||
foreach($analysedVals as $val) {
|
||||
@ -164,7 +164,7 @@ class feedback_item_multichoice extends feedback_item_base {
|
||||
echo '<tr><td align="left" valign="top">- ' . trim($val->answertext) . ':</td><td align="left" style="width: '.FEEDBACK_MAX_PIX_LENGTH.'"><img alt="'.$intvalue.'" src="'.$pix.'" height="5" width="'.$pixwidth.'" /> ' . $val->answercount . (($val->quotient > 0)?' ('. $quotient . ' %)':'').'</td></tr>';
|
||||
}
|
||||
}
|
||||
return $itemnr;
|
||||
// return $itemnr;
|
||||
}
|
||||
|
||||
function excelprint_item(&$worksheet, $rowOffset, $item, $groupid, $courseid = false) {
|
||||
|
@ -109,7 +109,7 @@ class feedback_item_multichoicerated extends feedback_item_base {
|
||||
return $printval;
|
||||
}
|
||||
|
||||
function print_analysed($item, $itemnr = 0, $groupid = false, $courseid = false) {
|
||||
function print_analysed($item, $itemnr = '', $groupid = false, $courseid = false) {
|
||||
$sep_dec = get_string('separator_decimal', 'feedback');
|
||||
if(substr($sep_dec, 0, 2) == '[['){
|
||||
$sep_dec = FEEDBACK_DECIMAL;
|
||||
@ -123,8 +123,8 @@ class feedback_item_multichoicerated extends feedback_item_base {
|
||||
$analysedItem = $this->get_analysed($item, $groupid, $courseid);
|
||||
if($analysedItem) {
|
||||
//echo '<table>';
|
||||
$itemnr++;
|
||||
echo '<tr><th colspan="2" align="left">'. $itemnr . '.) ' . stripslashes($analysedItem[1]) .'</th></tr>';
|
||||
// $itemnr++;
|
||||
echo '<tr><th colspan="2" align="left">'. $itemnr . ' ' . stripslashes($analysedItem[1]) .'</th></tr>';
|
||||
$analysedVals = $analysedItem[2];
|
||||
$pixnr = 0;
|
||||
$avg = 0.0;
|
||||
@ -146,7 +146,7 @@ class feedback_item_multichoicerated extends feedback_item_base {
|
||||
echo '<tr><td align="left" colspan="2"><b>'.get_string('average', 'feedback').': '.$avg.'</b></td></tr>';
|
||||
//echo '</table>';
|
||||
}
|
||||
return $itemnr;
|
||||
// return $itemnr;
|
||||
}
|
||||
|
||||
function excelprint_item(&$worksheet, $rowOffset, $item, $groupid, $courseid = false) {
|
||||
|
@ -68,7 +68,7 @@ class feedback_item_numeric extends feedback_item_base {
|
||||
return $value->value;
|
||||
}
|
||||
|
||||
function print_analysed($item, $itemnr = 0, $groupid = false, $courseid = false) {
|
||||
function print_analysed($item, $itemnr = '', $groupid = false, $courseid = false) {
|
||||
$sep_dec = get_string('separator_decimal', 'feedback');
|
||||
if(substr($sep_dec, 0, 2) == '[['){
|
||||
$sep_dec = FEEDBACK_DECIMAL;
|
||||
@ -84,16 +84,20 @@ class feedback_item_numeric extends feedback_item_base {
|
||||
|
||||
if(isset($values->data) AND is_array($values->data)) {
|
||||
//echo '<table>';2
|
||||
$itemnr++;
|
||||
echo '<tr><th colspan="2" align="left">'. $itemnr . '.) ' . stripslashes($item->name) .'</th></tr>';
|
||||
// $itemnr++;
|
||||
echo '<tr><th colspan="2" align="left">'. $itemnr . ' ' . stripslashes($item->name) .'</th></tr>';
|
||||
foreach($values->data as $value) {
|
||||
echo '<tr><td colspan="2" valign="top" align="left">- ' . $value . '</td></tr>';
|
||||
}
|
||||
//echo '</table>';
|
||||
$avg = number_format($values->avg, 2, $sep_dec, $sep_thous);
|
||||
if(isset($values->avg)) {
|
||||
$avg = number_format($values->avg, 2, $sep_dec, $sep_thous);
|
||||
} else {
|
||||
$avg = number_format(0, 2, $sep_dec, $sep_thous);
|
||||
}
|
||||
echo '<tr><td align="left" colspan="2"><b>'.get_string('average', 'feedback').': '.$avg.'</b></td></tr>';
|
||||
}
|
||||
return $itemnr;
|
||||
// return $itemnr;
|
||||
}
|
||||
|
||||
function excelprint_item(&$worksheet, $rowOffset, $item, $groupid, $courseid = false) {
|
||||
|
@ -58,18 +58,18 @@ class feedback_item_textarea extends feedback_item_base {
|
||||
return $value->value;
|
||||
}
|
||||
|
||||
function print_analysed($item, $itemnr = 0, $groupid = false, $courseid = false) {
|
||||
function print_analysed($item, $itemnr = '', $groupid = false, $courseid = false) {
|
||||
$values = feedback_get_group_values($item, $groupid, $courseid);
|
||||
if($values) {
|
||||
//echo '<table>';2
|
||||
$itemnr++;
|
||||
echo '<tr><th colspan="2" align="left">'. $itemnr . '.) ' . stripslashes_safe($item->name) .'</th></tr>';
|
||||
// $itemnr++;
|
||||
echo '<tr><th colspan="2" align="left">'. $itemnr . ' ' . stripslashes_safe($item->name) .'</th></tr>';
|
||||
foreach($values as $value) {
|
||||
echo '<tr><td valign="top" align="left">- </td><td align="left" valign="top">' . str_replace("\n", '<br />', $value->value) . '</td></tr>';
|
||||
}
|
||||
//echo '</table>';
|
||||
}
|
||||
return $itemnr;
|
||||
// return $itemnr;
|
||||
}
|
||||
|
||||
function excelprint_item(&$worksheet, $rowOffset, $item, $groupid, $courseid = false) {
|
||||
|
@ -57,18 +57,18 @@ class feedback_item_textfield extends feedback_item_base {
|
||||
return $value->value;
|
||||
}
|
||||
|
||||
function print_analysed($item, $itemnr = 0, $groupid = false, $courseid = false) {
|
||||
function print_analysed($item, $itemnr = '', $groupid = false, $courseid = false) {
|
||||
$values = feedback_get_group_values($item, $groupid, $courseid);
|
||||
if($values) {
|
||||
//echo '<table>';2
|
||||
$itemnr++;
|
||||
echo '<tr><th colspan="2" align="left">'. $itemnr . '.) ' . stripslashes_safe($item->name) .'</th></tr>';
|
||||
// $itemnr++;
|
||||
echo '<tr><th colspan="2" align="left">'. $itemnr . ' ' . stripslashes_safe($item->name) .'</th></tr>';
|
||||
foreach($values as $value) {
|
||||
echo '<tr><td colspan="2" valign="top" align="left">- ' . str_replace("\n", '<br />', $value->value) . '</td></tr>';
|
||||
}
|
||||
//echo '</table>';
|
||||
}
|
||||
return $itemnr;
|
||||
// return $itemnr;
|
||||
}
|
||||
|
||||
function excelprint_item(&$worksheet, $rowOffset, $item, $groupid, $courseid = false) {
|
||||
|
@ -69,10 +69,13 @@ class mod_feedback_mod_form extends moodleform_mod {
|
||||
$multiple_submit_value = $feedback->multiple_submit ? get_string('yes') : get_string('no');
|
||||
$mform->addElement('text', 'multiple_submit_static', get_string('multiple_submit', 'feedback'), array('size'=>'4','disabled'=>'disabled', 'value'=>$multiple_submit_value));
|
||||
$mform->addElement('hidden', 'multiple_submit', '');
|
||||
$mform->setHelpButton('multiple_submit_static', array('multiplesubmit', get_string('multiple_submit', 'feedback'), 'feedback'));
|
||||
}else {
|
||||
$mform->addElement('selectyesno', 'multiple_submit', get_string('multiple_submit', 'feedback'));
|
||||
$mform->setHelpButton('multiple_submit', array('multiplesubmit', get_string('multiple_submit', 'feedback'), 'feedback'));
|
||||
}
|
||||
$mform->setHelpButton('multiple_submit', array('multiplesubmit', get_string('multiple_submit', 'feedback'), 'feedback'));
|
||||
$mform->addElement('selectyesno', 'autonumbering', get_string('autonumbering', 'feedback'));
|
||||
$mform->setHelpButton('autonumbering', array('autonumbering', get_string('autonumbering', 'feedback'), 'feedback'));
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
$mform->addElement('header', 'aftersubmithdr', get_string('after_submit', 'feedback'));
|
||||
|
@ -72,9 +72,9 @@
|
||||
$itempos++;
|
||||
echo '<tr>';
|
||||
//Items without value only are labels
|
||||
if($feedbackitem->hasvalue == 1) {
|
||||
if($feedbackitem->hasvalue == 1 AND $feedback->autonumbering) {
|
||||
$itemnr++;
|
||||
echo '<td valign="top">' . $itemnr . '.) </td>';
|
||||
echo '<td valign="top">' . $itemnr . '. </td>';
|
||||
} else {
|
||||
echo '<td> </td>';
|
||||
}
|
||||
|
@ -54,6 +54,7 @@
|
||||
$feedback->anonymous = backup_todb($info['MOD']['#']['ANONYMOUS']['0']['#']);
|
||||
$feedback->email_notification = backup_todb($info['MOD']['#']['EMAILNOTIFICATION']['0']['#']);
|
||||
$feedback->multiple_submit = backup_todb($info['MOD']['#']['MULTIPLESUBMIT']['0']['#']);
|
||||
$feedback->autonumbering = backup_todb($info['MOD']['#']['AUTONUMBERING']['0']['#']);
|
||||
$feedback->page_after_submit = backup_todb($info['MOD']['#']['PAGEAFTERSUB']['0']['#']);
|
||||
$feedback->publish_stats = backup_todb($info['MOD']['#']['PUBLISHSTATS']['0']['#']);
|
||||
$feedback->timeopen = backup_todb($info['MOD']['#']['TIMEOPEN']['0']['#']);
|
||||
|
@ -266,9 +266,9 @@
|
||||
//get the values
|
||||
$value = get_record_select('feedback_value','completed ='.$feedbackcompleted->id.' AND item='.$feedbackitem->id);
|
||||
echo '<tr>';
|
||||
if($feedbackitem->hasvalue == 1) {
|
||||
if($feedbackitem->hasvalue == 1 AND $feedback->autonumbering) {
|
||||
$itemnr++;
|
||||
echo '<td valign="top">' . $itemnr . '.) </td>';
|
||||
echo '<td valign="top">' . $itemnr . '. </td>';
|
||||
} else {
|
||||
echo '<td> </td>';
|
||||
}
|
||||
|
@ -149,9 +149,9 @@
|
||||
//get the values
|
||||
$value = get_record_select('feedback_value','completed ='.$feedbackcompleted->id.' AND item='.$feedbackitem->id);
|
||||
echo '<tr>';
|
||||
if($feedbackitem->hasvalue == 1) {
|
||||
if($feedbackitem->hasvalue == 1 AND $feedback->autonumbering) {
|
||||
$itemnr++;
|
||||
echo '<td valign="top">' . $itemnr . '.) </td>';
|
||||
echo '<td valign="top">' . $itemnr . '. </td>';
|
||||
} else {
|
||||
echo '<td> </td>';
|
||||
}
|
||||
|
@ -101,9 +101,9 @@
|
||||
echo '<div align="center"><table>';
|
||||
foreach($templateitems as $templateitem){
|
||||
echo '<tr>';
|
||||
if($templateitem->hasvalue == 1) {
|
||||
if($templateitem->hasvalue == 1 AND $feedback->autonumbering) {
|
||||
$itemnr++;
|
||||
echo '<td valign="top">' . $itemnr . '.) </td>';
|
||||
echo '<td valign="top">' . $itemnr . '. </td>';
|
||||
} else {
|
||||
echo '<td> </td>';
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
*/
|
||||
|
||||
|
||||
$module->version = 2008042802; // The current module version (Date: YYYYMMDDXX)
|
||||
$module->version = 2008042900; // The current module version (Date: YYYYMMDDXX)
|
||||
$module->requires = 2007101503; // Requires this Moodle version
|
||||
$feedback_version_intern = 1; //this version is used for restore older backups
|
||||
$module->cron = 0; // Period for cron to check this module (secs)
|
||||
|
Loading…
x
Reference in New Issue
Block a user