Revision 76bdcd04
Added by Assos Assos almost 6 years ago
drupal7/sites/all/modules/webform/includes/webform.report.inc | ||
---|---|---|
113 | 113 |
* @param object $node |
114 | 114 |
* Loaded webform node. |
115 | 115 |
* @param string $view_id |
116 |
* machine_id of the view, such as webform_results or webform_submissions. |
|
116 |
* The machine_id of the view, such as webform_results or webform_submissions.
|
|
117 | 117 |
* |
118 | 118 |
* @return object|null |
119 | 119 |
* The loaded view. |
... | ... | |
251 | 251 |
} |
252 | 252 |
|
253 | 253 |
/** |
254 |
* |
|
254 |
* Theme function for the Webform results table header.
|
|
255 | 255 |
*/ |
256 | 256 |
function theme_webform_results_table_header($variables) { |
257 | 257 |
return array( |
... | ... | |
369 | 369 |
} |
370 | 370 |
|
371 | 371 |
/** |
372 |
* |
|
372 |
* Form submit handler.
|
|
373 | 373 |
*/ |
374 | 374 |
function webform_results_clear_form_submit($form, &$form_state) { |
375 | 375 |
$nid = $form_state['values']['nid']; |
... | ... | |
686 | 686 |
case 'range_date': |
687 | 687 |
// Download Start-end range of submissions. |
688 | 688 |
// Start submission time. |
689 |
$start_date = strtotime($element['start_date']['#value']); |
|
689 |
$format = webform_date_format('short'); |
|
690 |
$start_date = DateTime::createFromFormat($format, $element['start_date']['#value']); |
|
690 | 691 |
if ($element['start_date']['#value'] == '') { |
691 | 692 |
form_error($element['start_date'], t('Start date range is required.')); |
692 | 693 |
} |
... | ... | |
694 | 695 |
form_error($element['start_date'], t('Start date range is not in a valid format.')); |
695 | 696 |
} |
696 | 697 |
// End submission time. |
697 |
$end_date = strtotime($element['end_date']['#value']);
|
|
698 |
$end_date = DateTime::createFromFormat($format, $element['end_date']['#value']);
|
|
698 | 699 |
if ($element['end_date']['#value'] != '') { |
699 | 700 |
if ($end_date === FALSE) { |
700 | 701 |
form_error($element['end_date'], t('End date range is not in a valid format.')); |
... | ... | |
1559 | 1560 |
); |
1560 | 1561 |
|
1561 | 1562 |
if (isset($_SESSION)) { |
1562 |
// UI exection. Defer resetting last-downloaded sid until download page. |
|
1563 |
// Set a session variable containing the information referencing the exported
|
|
1564 |
// file. A cookie is also set to allow the browser to ensure the redirect |
|
1565 |
// to the file only happens one time.
|
|
1563 |
// UI exection. Defer resetting last-downloaded sid until download page. Set
|
|
1564 |
// a session variable containing the information referencing the exported |
|
1565 |
// file. A cookie is also set to allow the browser to ensure the redirect to
|
|
1566 |
// the file only happens one time. |
|
1566 | 1567 |
$_SESSION['webform_export_info'] = $export_info; |
1567 | 1568 |
$params = session_get_cookie_params(); |
1568 | 1569 |
setcookie('webform_export_info', '1', REQUEST_TIME + 120, $params['path'], $params['domain'], $params['secure'], FALSE); |
... | ... | |
1965 | 1966 |
|
1966 | 1967 |
case 'range_date': |
1967 | 1968 |
$date_field = $range_options['completion_type'] == 'finished' ? 'ws.completed' : 'ws.submitted'; |
1968 |
$query->condition($date_field, strtotime($range_options['start_date']), '>='); |
|
1969 |
if ($range_options['end_date'] != '' && ($end_time = strtotime($range_options['end_date'])) !== FALSE) { |
|
1970 |
if ($end_time == strtotime('midnight', $end_time)) { |
|
1971 |
// Full day specified |
|
1972 |
// 86400 is a full day of seconds. |
|
1973 |
$end_time += 86399; |
|
1974 |
} |
|
1975 |
$query->condition($date_field, $end_time, '<='); |
|
1969 |
$format = webform_date_format('short'); |
|
1970 |
$start_date = DateTime::createFromFormat($format, $range_options['start_date']); |
|
1971 |
$start_date->setTime(0, 0, 0); |
|
1972 |
$query->condition($date_field, $start_date->getTimestamp(), '>='); |
|
1973 |
$end_time = DateTime::createFromFormat($format, $range_options['end_date']); |
|
1974 |
if ($range_options['end_date'] != '' && ($end_time !== FALSE)) { |
|
1975 |
// Check for the full day's submissions. |
|
1976 |
$end_time->setTime(23, 59, 59); |
|
1977 |
$query->condition($date_field, $end_time->getTimestamp(), '<='); |
|
1976 | 1978 |
} |
1977 | 1979 |
$query->orderBy($date_field, 'ASC'); |
1978 | 1980 |
break; |
Also available in: Unified diff
Weekly update of contrib modules