function _webform_analysis_time in Webform 6.3
Same name and namespace in other branches
- 7.4 components/time.inc \_webform_analysis_time()
- 7.3 components/time.inc \_webform_analysis_time()
Implements _webform_analysis_component().
File
- components/
time.inc, line 333 - Webform module time component.
Code
function _webform_analysis_time($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));
$times = array();
$submissions = 0;
while ($row = db_fetch_array($result)) {
$submissions++;
if ($row['data']) {
$times[] = webform_date_array($row['data']);
}
}
// Display stats.
$nonblanks = count($times);
$rows[0] = array(
t('Left Blank'),
$submissions - $nonblanks,
);
$rows[1] = array(
t('User entered value'),
$nonblanks,
);
return $rows;
}