Index: webform_report.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/webform_report/Attic/webform_report.inc,v
retrieving revision 1.1.2.27.2.6
diff -u -r1.1.2.27.2.6 webform_report.inc
--- webform_report.inc 18 Jun 2010 20:33:06 -0000 1.1.2.27.2.6
+++ webform_report.inc 24 Jun 2010 00:48:16 -0000
@@ -517,14 +517,35 @@
// handle file type
if ($type == 'file') {
- $tmp = unserialize($raw[0]);
+
$link = ' ';
- if (!empty($tmp['filename'])) {
- $link = '' .
- $tmp['filename'] . ' (' . (int) ($tmp['filesize'] / 1024) .' KB)' .
- '';
+ $text = '';
+
+ // new file handling in webforms 6.x-3.x - data is an id
+ if (is_numeric($raw[0])) {
+ // must load the webform file component handler
+ module_load_include('inc', 'webform', 'components/file');
+ $file = webform_get_file($raw[0]);
+ if (!empty($file->fid)) {
+ $text = webform_file_name($file->filepath);
+ $link = '' .
+ $text . '' .
+ ' (' . (int) ($file->filesize/1024) . ' KB)';
+ }
}
- $out = array('data' => $link, 'field' => $cid, 'sort' => $tmp['filepath']);
+ // file handling for prior versions of webforms - data is serialized fileinfo
+ else {
+ $tmp = unserialize($raw[0]);
+ if (!empty($tmp['filename'])) {
+ $text = $tmp['filename'];
+ $link = '' .
+ $text . '' .
+ ' (' . (int) ($tmp['filesize'] / 1024) .' KB)';
+ }
+ }
+
+ // output file column
+ $out = array('data' => $link, 'field' => $cid, 'sort' => $text);
}
// handle dates
@@ -532,10 +553,18 @@
$ts = 0;
// if report date
if ($cid > 0) {
- // if date was selected
- if ($raw[0] && $raw[1]) {
- // make timestamp, dates are stored month, day, year
- $ts = strtotime($raw[0] .'/'. $raw[1] .'/'. $raw[2]);
+ // handle webforms 6.x-3.x dates
+ if (count($raw) == 1) {
+ // date is stored as yyyy-mm-dd
+ $ts = strtotime($raw[0]);
+ }
+ // handle prior webforms versions
+ else {
+ // if date was selected
+ if ($raw[0] && $raw[1]) {
+ // make timestamp, dates are stored month, day, year
+ $ts = strtotime($raw[0] .'/'. $raw[1] .'/'. $raw[2]);
+ }
}
}
// otherwise get submission timestamp
@@ -557,10 +586,18 @@
else if ($type == 'time') {
$ts = 0;
if ($cid > 0) {
+ // handle webforms 6.x-3.x time
+ if (count($raw) == 1) {
+ // date is stored as hh:mm:ss
+ $ts = strtotime($raw[0]);
+ }
+ // handle prior webforms versions
+ else {
// if time was selected
- if ($raw[0] && $raw[1]) {
- // make timestamp, times are stored hh, mm, ampm
- $ts = strtotime($raw[0] . ':' . $raw[1] . $raw[2]);
+ if ($raw[0] && $raw[1]) {
+ // make timestamp, times are stored hh, mm, ampm
+ $ts = strtotime($raw[0] . ':' . $raw[1] . $raw[2]);
+ }
}
}
else {