function views_data_export_plugin_display_export::execute_normal in Views data export 6.3
Same name and namespace in other branches
- 6 plugins/views_data_export_plugin_display_export.inc \views_data_export_plugin_display_export::execute_normal()
- 6.2 plugins/views_data_export_plugin_display_export.inc \views_data_export_plugin_display_export::execute_normal()
- 7.4 plugins/views_data_export_plugin_display_export.inc \views_data_export_plugin_display_export::execute_normal()
- 7 plugins/views_data_export_plugin_display_export.inc \views_data_export_plugin_display_export::execute_normal()
- 7.3 plugins/views_data_export_plugin_display_export.inc \views_data_export_plugin_display_export::execute_normal()
Compiles the next chunk of the output file
1 call to views_data_export_plugin_display_export::execute_normal()
- views_data_export_plugin_display_export::execute in plugins/
views_data_export_plugin_display_export.inc - Execute this display handler.
File
- plugins/
views_data_export_plugin_display_export.inc, line 282 - Contains the bulk export display plugin.
Class
- views_data_export_plugin_display_export
- The plugin that batches its rendering.
Code
function execute_normal() {
// Pass through to our render method,
$output = $this->view
->render();
// Append what was rendered to the output file.
$this
->outputfile_write($output);
// Store for convenience.
$state =& $this->batched_execution_state;
$sandbox =& $state->sandbox;
// Update progress measurements & move our state forward
switch ($state->batch_state) {
case VIEWS_DATA_EXPORT_BODY:
// Remove rendered results from our index
if (count($this->view->result) && !empty($sandbox['weight_field_alias'])) {
$last = end($this->view->result);
db_query('DELETE FROM {' . $this
->index_tablename() . '} WHERE ' . $sandbox['weight_field_alias'] . ' <= %d', $last->{$sandbox['weight_field_alias']});
// Update progress.
$progress = db_result(db_query('SELECT COUNT(*) FROM {' . $this
->index_tablename() . '}'));
$progress = 0.99 - $progress / $sandbox['max'] * 0.99;
$progress = (int) floor($progress * 100000);
$progress = $progress / 100000;
$sandbox['finished'] = $progress;
}
else {
// No more results.
$progress = 0.99;
$state->batch_state = VIEWS_DATA_EXPORT_FOOTER;
}
break;
case VIEWS_DATA_EXPORT_HEADER:
$sandbox['finished'] = 0;
$state->batch_state = VIEWS_DATA_EXPORT_BODY;
break;
case VIEWS_DATA_EXPORT_FOOTER:
$sandbox['finished'] = 1;
$state->batch_state = VIEWS_DATA_EXPORT_FINISHED;
break;
}
// Create a more helpful exporting message.
$sandbox['message'] = $this
->compute_time_remaining($sandbox['started'], $sandbox['finished']);
}