Révision 8c72e82a
Ajouté par Assos Assos il y a environ 7 ans
drupal7/sites/all/modules/webform/includes/webform.report.inc | ||
---|---|---|
130 | 130 |
/** |
131 | 131 |
* Theme the list of links for selecting the number of results per page. |
132 | 132 |
* |
133 |
* @param $total_count |
|
134 |
* The total number of results available. |
|
135 |
* @param $pager_count |
|
136 |
* The current number of results displayed per page. |
|
133 |
* @param array $variables |
|
134 |
* Array with keys: |
|
135 |
* - "total_count": The total number of results available. |
|
136 |
* - "pager_count": The current number of results displayed per page. |
|
137 |
* |
|
138 |
* @return string |
|
139 |
* Pager. |
|
137 | 140 |
*/ |
138 | 141 |
function theme_webform_results_per_page($variables) { |
139 | 142 |
$total_count = $variables['total_count']; |
... | ... | |
262 | 265 |
* The total number of submissions to this webform. |
263 | 266 |
* @param $pager_count |
264 | 267 |
* The number of results to be shown per page. |
268 |
* |
|
269 |
* @return string |
|
270 |
* HTML string with result data. |
|
265 | 271 |
*/ |
266 | 272 |
function theme_webform_results_table($variables) { |
267 | 273 |
drupal_add_library('webform', 'admin'); |
... | ... | |
444 | 450 |
'#type' => 'container', |
445 | 451 |
'warning' => array( |
446 | 452 |
'#markup' => '<p>' . |
447 |
t('<strong>Warning:</strong> Opening delimited text files with spreadsheet applications may expose you to <a href="!link">formula injection</a> or other security vulnerabilities. When the submissions contain data from untrusted users and the downloaded file will be used with spreadsheets, use Microsoft Excel format.',
|
|
448 |
array('!link' => url('https://www.google.com/search?q=spreadsheet+formula+injection'))) .
|
|
449 |
'</p>',
|
|
453 |
t('<strong>Warning:</strong> Opening delimited text files with spreadsheet applications may expose you to <a href="!link">formula injection</a> or other security vulnerabilities. When the submissions contain data from untrusted users and the downloaded file will be used with spreadsheets, use Microsoft Excel format.', |
|
454 |
array('!link' => url('https://www.google.com/search?q=spreadsheet+formula+injection'))) . |
|
455 |
'</p>', |
|
450 | 456 |
), |
451 | 457 |
'delimiter' => array( |
452 | 458 |
'#type' => 'select', |
... | ... | |
766 | 772 |
$element['range_type']['range_serial']['#theme_wrappers'] = array('webform_inline_radio'); |
767 | 773 |
$last_serial = $download_info['serial'] ? $download_info['serial'] : drupal_placeholder(t('none')); |
768 | 774 |
$element['range_type']['range_serial']['#title'] = t('Submissions by number from !start and optionally to: !end (Last downloaded: !serial)', |
769 |
array('!start' => drupal_render($element['start']), '!end' => drupal_render($element['end']), '!serial' => $last_serial));
|
|
775 |
array('!start' => drupal_render($element['start']), '!end' => drupal_render($element['end']), '!serial' => $last_serial)); |
|
770 | 776 |
|
771 | 777 |
// date range |
772 | 778 |
$element['range_type']['range_date']['#theme_wrappers'] = array('webform_inline_radio'); |
... | ... | |
856 | 862 |
*/ |
857 | 863 |
function webform_export_batch_size($node) { |
858 | 864 |
// Start the batch size at 50,000 per batch, but divide by number of |
859 |
// components in the form. e.g. If a form had 10 components, it would
|
|
865 |
// components in the form. For example, if a form had 10 components, it would
|
|
860 | 866 |
// export 5,000 submissions at a time. |
861 | 867 |
$batch_size = ceil(50000 / max(1, count($node->webform['components']))); |
862 | 868 |
|
... | ... | |
1058 | 1064 |
* @param array $options |
1059 | 1065 |
* A list of options that define the output format. These are generally passed |
1060 | 1066 |
* through from the GUI interface. |
1061 |
* @param $serial_start |
|
1067 |
* @param int $serial_start
|
|
1062 | 1068 |
* The starting position for the Serial column in the output. |
1063 | 1069 |
* @param $last_sid |
1064 | 1070 |
* If set to a non-NULL value, the last sid will be returned. |
1065 | 1071 |
* |
1066 |
* @return $rows |
|
1072 |
* @return array $rows
|
|
1067 | 1073 |
* An array of rows built according to the provided $serial_start and |
1068 | 1074 |
* $pager_count variables. Note that the current page number is determined |
1069 | 1075 |
* by the super-global $_GET['page'] variable. |
... | ... | |
1102 | 1108 |
* @param array $submissions |
1103 | 1109 |
* An associative array of loaded submissions, indexed by sid. |
1104 | 1110 |
* |
1105 |
* @return $rows |
|
1111 |
* @return array $rows
|
|
1106 | 1112 |
* An array of rows built according to the provided $serial_start and |
1107 | 1113 |
* $pager_count variables. Note that the current page number is determined |
1108 | 1114 |
* by the super-global $_GET['page'] variable. |
... | ... | |
1165 | 1171 |
* |
1166 | 1172 |
* @param $options |
1167 | 1173 |
* Filter down the list of columns based on a provided column list. |
1174 |
* |
|
1175 |
* @return array |
|
1176 |
* List of generic columns plus columns added by other modules |
|
1168 | 1177 |
*/ |
1169 | 1178 |
function webform_results_download_submission_information($node, $options = array()) { |
1170 | 1179 |
$submission_information = module_invoke_all('webform_results_download_submission_information_info'); |
... | ... | |
1255 | 1264 |
* @param array $options |
1256 | 1265 |
* A list of options that define the output format. These are generally passed |
1257 | 1266 |
* through from the GUI interface. |
1267 |
* |
|
1268 |
* @return array |
|
1269 |
* Option for creating downloadable version of the webform data. |
|
1258 | 1270 |
*/ |
1259 | 1271 |
function webform_results_download_default_options($node, $format) { |
1260 | 1272 |
$submission_information = webform_results_download_submission_information($node); |
... | ... | |
1291 | 1303 |
function webform_results_download($node, $export_info) { |
1292 | 1304 |
// If the exporter provides a custom download method, use that. |
1293 | 1305 |
if (method_exists($export_info['exporter'], 'download')) { |
1294 |
$export_info['exporter']->download($node); |
|
1306 |
$export_info['exporter']->download($node, $export_info);
|
|
1295 | 1307 |
} |
1296 | 1308 |
// Otherwise use the set_headers() method to set headers and then read in the |
1297 | 1309 |
// file directly. Delete it when complete. |
... | ... | |
1301 | 1313 |
$export_name = t('Untitled'); |
1302 | 1314 |
} |
1303 | 1315 |
$export_info['exporter']->set_headers($export_name); |
1316 |
ob_clean(); |
|
1304 | 1317 |
@readfile($export_info['file_name']); // The @ makes it silent. |
1305 | 1318 |
@unlink($export_info['file_name']); // Clean up, the @ makes it silent. |
1306 | 1319 |
} |
... | ... | |
1345 | 1358 |
* @param $node |
1346 | 1359 |
* The webform $node whose export file is being downloaded. |
1347 | 1360 |
* |
1348 |
* @return |
|
1361 |
* @return null|string
|
|
1349 | 1362 |
* Either an export file is downloaded with the appropriate HTTP headers set, |
1350 | 1363 |
* or an error page is shown if now export is available to download. |
1351 | 1364 |
*/ |
... | ... | |
1439 | 1452 |
$query->fields('u', array('name')); |
1440 | 1453 |
$query->fields('ws'); |
1441 | 1454 |
|
1455 |
if (!empty($options['sids'])) { |
|
1456 |
$query->condition('ws.sid', $options['sids'], 'IN'); |
|
1457 |
} |
|
1458 |
|
|
1442 | 1459 |
$submissions = webform_get_submissions_load($query); |
1443 | 1460 |
|
1444 | 1461 |
$rows = webform_results_download_rows_process($node, $options, $context['sandbox']['serial'], $submissions); |
... | ... | |
1563 | 1580 |
* A webform component. If passed in, additional information may be returned |
1564 | 1581 |
* relating specifically to that component's analysis, such as a list of |
1565 | 1582 |
* "Other" values within a select list. |
1583 |
* |
|
1584 |
* @return string |
|
1585 |
* Provides a simple analysis of all submissions to a webform. |
|
1566 | 1586 |
*/ |
1567 | 1587 |
function webform_results_analysis($node, $sids = array(), $analysis_component = NULL) { |
1568 | 1588 |
if (!is_array($sids)) { |
... | ... | |
1672 | 1692 |
* of header labels. |
1673 | 1693 |
* - table_rows: If this component has a table that should be rendered, an |
1674 | 1694 |
* array of values |
1695 |
* |
|
1696 |
* @return string |
|
1675 | 1697 |
*/ |
1676 | 1698 |
function theme_webform_analysis_component_basic($variables) { |
1677 | 1699 |
$data = $variables['data']; |
... | ... | |
1870 | 1892 |
* The user id of the user whose last download information should be used, |
1871 | 1893 |
* or the current user if NULL. This is unrelated to which user submitted |
1872 | 1894 |
* the submissions. |
1895 |
* |
|
1896 |
* @return QueryAlterableInterface |
|
1873 | 1897 |
*/ |
1874 | 1898 |
function webform_download_sids_query($nid, $range_options, $uid = NULL) { |
1875 | 1899 |
$query = db_select('webform_submissions', 'ws') |
Formats disponibles : Unified diff
Weekly update of contrib modules