Moodle 1.8.2+ and Questionnaire v2007010801.
When exporting the questionnaire, into the CSV file, not appear the answers of "Date" questions. The rest of the data are present in CSV file.
Also, this date fields are displayed correctly in "View by Response" and "View all Responses".
No errors in httpd's log.
Exporting the questionnaire with responses to other Moodle (1.6.4+) with the same Questionnaire's version (v2007010801), dates are exported correctly to CSV.
Any idea?
Hello,
I had the same problem and this is what I did.
Go to your locallib.php file. Find the line that says:
// --------------------- response_date ---------------------
A few lines below there is a foreach loop:
foreach ($row as $key => $val) {
if (!is_numeric($key)) {
// convert date from yyyy-mm-dd database format to actual QUESTIONNAIREDATEFORMAT
if (preg_match('/\d\d\d\d-\d\d-\d\d/', $val)) {
$dateparts = split('-', $val);
$val = mktime(0, 0, 0, $dateparts[1], $dateparts[2], $dateparts[0]); // Unix timestamp
$val = userdate ( $val, QUESTIONNAIREDATEFORMAT);
$newrow[] = $val; // JR JR 1945-03-14
}
}
}
Change this code for:
foreach ($row as $key => $val) {
if (!is_numeric($key)) {
// convert date from yyyy-mm-dd database format to actual QUESTIONNAIREDATEFORMAT
if (preg_match('/\d\d\d\d-\d\d-\d\d/', $val)) {
$dateparts = split('-', $val);
$val = mktime(0, 0, 0, $dateparts[1], $dateparts[2], $dateparts[0]); // Unix timestamp
$val = userdate ( $val, QUESTIONNAIREDATEFORMAT);
$newrow[] = $val; // JR JR 1945-03-14
} else {
$newrow[] = $val;
}
}
}
I only added an else, as you can see. I hope this helps.
Carlos
I had the same problem and this is what I did.
Go to your locallib.php file. Find the line that says:
// --------------------- response_date ---------------------
A few lines below there is a foreach loop:
foreach ($row as $key => $val) {
if (!is_numeric($key)) {
// convert date from yyyy-mm-dd database format to actual QUESTIONNAIREDATEFORMAT
if (preg_match('/\d\d\d\d-\d\d-\d\d/', $val)) {
$dateparts = split('-', $val);
$val = mktime(0, 0, 0, $dateparts[1], $dateparts[2], $dateparts[0]); // Unix timestamp
$val = userdate ( $val, QUESTIONNAIREDATEFORMAT);
$newrow[] = $val; // JR JR 1945-03-14
}
}
}
Change this code for:
foreach ($row as $key => $val) {
if (!is_numeric($key)) {
// convert date from yyyy-mm-dd database format to actual QUESTIONNAIREDATEFORMAT
if (preg_match('/\d\d\d\d-\d\d-\d\d/', $val)) {
$dateparts = split('-', $val);
$val = mktime(0, 0, 0, $dateparts[1], $dateparts[2], $dateparts[0]); // Unix timestamp
$val = userdate ( $val, QUESTIONNAIREDATEFORMAT);
$newrow[] = $val; // JR JR 1945-03-14
} else {
$newrow[] = $val;
}
}
}
I only added an else, as you can see. I hope this helps.
Carlos
Hi Carlos,
Please note that this bug has been corrected in latest version of Questionnaire module. I still need a little time to merge all recent fixes and improvements into 1.7 and 1.8 versions, but note that latest version will work with moodle 1.7 and 1.8.
Joseph
Please note that this bug has been corrected in latest version of Questionnaire module. I still need a little time to merge all recent fixes and improvements into 1.7 and 1.8 versions, but note that latest version will work with moodle 1.7 and 1.8.
Joseph
Thanks for your information.
Cheers,
Carlos
Cheers,
Carlos
Hello,
Resolved fixed. Great !!
Thank you very much to both.
Alfonso
Resolved fixed. Great !!
Thank you very much to both.
Alfonso