function _webform_analysis_date in Webform 7.3
Same name and namespace in other branches
- 6.3 components/date.inc \_webform_analysis_date()
- 7.4 components/date.inc \_webform_analysis_date()
Implements _webform_analysis_component().
File
- components/
date.inc, line 375 - Webform module date component.
Code
function _webform_analysis_date($component, $sids = array()) {
$query = db_select('webform_submitted_data', 'wsd', array(
'fetch' => PDO::FETCH_ASSOC,
))
->fields('wsd', array(
'no',
'data',
))
->condition('nid', $component['nid'])
->condition('cid', $component['cid'])
->orderBy('sid');
if (count($sids)) {
$query
->condition('sid', $sids, 'IN');
}
$result = $query
->execute();
$dates = array();
$submissions = 0;
foreach ($result as $row) {
$submissions++;
if ($row['data']) {
$dates[] = webform_date_array($row['data']);
}
}
// Display stats.
$nonblanks = count($dates);
$rows[0] = array(
t('Left Blank'),
$submissions - $nonblanks,
);
$rows[1] = array(
t('User entered value'),
$nonblanks,
);
return $rows;
}