function webform_download_last_download_info in Webform 7.4
Same name and namespace in other branches
- 6.3 includes/webform.report.inc \webform_download_last_download_info()
- 7.3 includes/webform.report.inc \webform_download_last_download_info()
Get this user's last download information, including the SID and timestamp.
This function provides an array of information about the last download that a user had for a particular Webform node. Currently it only returns an array with two keys:
- sid: The last submission ID that was downloaded.
- requested: The timestamp of the last download request.
Parameters
$nid: The Webform NID.
$uid: The user account ID for which to retrieve download information.
Return value
array|false An array of download information or FALSE if this user has never downloaded results for this particular node.
3 calls to webform_download_last_download_info()
- WebformSubmissionTestCase::testWebformSubmissionFunctions in tests/
WebformSubmissionTestCase.test - Test Webform submission utility functions.
- webform_download_sids_query in includes/
webform.report.inc - Given a set of range options, return an unexecuted select query.
- webform_results_download_range_after_build in includes/
webform.report.inc - FormAPI after build function for the download range fieldset.
File
- includes/
webform.report.inc, line 2082 - This file includes helper functions for creating reports for webform.module.
Code
function webform_download_last_download_info($nid, $uid = NULL) {
$uid = isset($uid) ? $uid : $GLOBALS['user']->uid;
$query = db_select('webform_last_download', 'wld');
$query
->leftJoin('webform_submissions', 'wfs', 'wld.sid = wfs.sid');
$info = $query
->fields('wld')
->fields('wfs', array(
'serial',
))
->condition('wld.nid', $nid)
->condition('wld.uid', $uid)
->execute()
->fetchAssoc();
return $info;
}