function _webform_analysis_time in Webform 7.4
Same name and namespace in other branches
- 6.3 components/time.inc \_webform_analysis_time()
- 7.3 components/time.inc \_webform_analysis_time()
Implements _webform_analysis_component().
File
- components/
time.inc, line 409 - Webform module time component.
Code
function _webform_analysis_time($component, $sids = array(), $single = FALSE, $join = NULL) {
$query = db_select('webform_submitted_data', 'wsd', array(
'fetch' => PDO::FETCH_ASSOC,
))
->fields('wsd', array(
'no',
'data',
))
->condition('wsd.nid', $component['nid'])
->condition('wsd.cid', $component['cid'])
->orderBy('wsd.sid');
if (count($sids)) {
$query
->condition('wsd.sid', $sids, 'IN');
}
if ($join) {
$query
->innerJoin($join, 'ws2_', 'wsd.sid = ws2_.sid');
}
$result = $query
->execute();
$times = array();
$submissions = 0;
foreach ($result as $row) {
$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 array(
'table_rows' => $rows,
);
}