function _webform_analysis_countdown in Webform Countdown 7
Same name and namespace in other branches
- 7.2 webform_countdown.module \_webform_analysis_countdown()
Implements _webform_analysis_component().
File
- ./
webform_countdown.module, line 225 - Webform countdown code module.
Code
function _webform_analysis_countdown($component, $sids = array()) {
$query = db_select('webform_submitted_data', 'wsd', array(
'fetch' => PDO::FETCH_ASSOC,
))
->fields('wsd', array(
'data',
))
->condition('nid', $component['nid'])
->condition('cid', $component['cid']);
if (count($sids)) {
$query
->condition('sid', $sids, 'IN');
}
$nonblanks = 0;
$submissions = 0;
$result = $query
->execute();
foreach ($result as $data) {
if (drupal_strlen(trim($data['data'])) > 0) {
$nonblanks++;
}
$submissions++;
}
$rows[0] = array(
t('Left Blank'),
$submissions - $nonblanks,
);
$rows[1] = array(
t('User entered value'),
$nonblanks,
);
return $rows;
}