示例#1
0
 /**
  * A private method to generate a report plugin.
  *
  * @access private
  * @param Plugins_Reports $oPlugin The report plugin.
  *
  * @TODO Extend to allow use of other report writers, if required.
  */
 function _runReport($oPlugin)
 {
     if (!$oPlugin->isAllowedToExecute()) {
         // User cannot execute this report
         OX_Admin_Redirect::redirect('report-index.php');
     }
     $aInfo = $oPlugin->info();
     // Get the variables for running the report plugin
     $aVariables = $this->_getVariablesForReport($aInfo['plugin-import']);
     // Set the Excel Report writer
     $oWriter = new OA_Admin_ExcelWriter();
     $oPlugin->useReportWriter($oWriter);
     // Generate the report by calling the report plugin's
     // execute method with the required variables
     $aCallback = array(&$oPlugin, 'execute');
     $result = call_user_func_array($aCallback, $aVariables);
     if (!empty($result)) {
         OX_Admin_Redirect::redirect('report-generation.php?report=' . $oPlugin->getComponentIdentifier() . '&error=' . $result);
     }
 }