function _webform_analysis_date in Webform 6.3
Same name and namespace in other branches
- 7.4 components/date.inc \_webform_analysis_date()
- 7.3 components/date.inc \_webform_analysis_date()
Implements _webform_analysis_component().
File
- components/
date.inc, line 366 - Webform module date component.
Code
function _webform_analysis_date($component, $sids = array()) {
$placeholders = count($sids) ? array_fill(0, count($sids), "'%s'") : array();
$sidfilter = count($sids) ? " AND sid in (" . implode(",", $placeholders) . ")" : "";
$query = 'SELECT no,data ' . ' FROM {webform_submitted_data} ' . ' WHERE nid = %d ' . ' AND cid = %d ' . $sidfilter . ' ORDER BY sid ASC ';
$result = db_query($query, array_merge(array(
$component['nid'],
$component['cid'],
), $sids));
$dates = array();
$submissions = 0;
while ($row = db_fetch_array($result)) {
$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;
}