示例#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);
     }
 }
示例#2
0
 /**
  * A private method to display the report generation screen for a
  * report plugin to the UI.
  *
  * @access private
  * @param Plugins_Reports $oPlugin The plugin to display.
  * @param string $reportIdentifier The string identifying the report.
  * @param int $errorCode error code given by last report generation
  */
 function _groupReportPluginGeneration($oPlugin, $reportIdentifier, $errorCode = null)
 {
     $aInfo = $oPlugin->info();
     if (!empty($errorCode)) {
         $errorMessage = $oPlugin->getErrorMessage($errorCode);
     }
     // Print the report introduction
     $this->_displayReportIntroduction($aInfo['plugin-export'], $aInfo['plugin-name'], $aInfo['plugin-description'], $errorMessage);
     // Get the plugins generation parameter details
     if ($aPluginInfo = $aInfo['plugin-import']) {
         // Print the start of the report execution submission form
         $this->_displayParameterListHeader();
         foreach ($aPluginInfo as $key => $aParameters) {
             // Print the report generation parameter
             $oField =& $this->oFieldFactory->newField($aParameters['type']);
             $oField->_name = $key;
             if (!is_null($aParameters['default'])) {
                 $oField->setValue($aParameters['default']);
             }
             $oField->setValueFromArray($aParameters);
             if (!is_null($aParameters['field_selection_names'])) {
                 $oField->_fieldSelectionNames = $aParameters['field_selection_names'];
             }
             if (!is_null($aParameters['size'])) {
                 $oField->_size = $aParameters['size'];
             }
             if (!is_null($aParameters['filter'])) {
                 $oField->setFilter($aParameters['filter']);
             }
             $this->_displayParameterBreak();
             echo "<tr><td width='30'>&nbsp;</td><td>{$aParameters['title']}</td><td>";
             $oField->_tabIndex = $this->tabindex;
             $oField->display();
             $this->tabindex = $oField->_tabIndex;
             echo "</td></tr>";
         }
         // Print a parameter break line
         $this->_displayParameterBreak();
         // Print the end of the report execution submission form
         $this->_displayParameterListFooter($reportIdentifier);
     }
     // Print the closing table info
     $this->_displayReportInformationFooter();
 }