function InitTemplateParser()
{
    global $page, $gl_root_path, $content;
    // -----------------------------------------------
    // Create Template Object and set some variables for the templates
    // -----------------------------------------------
    $page = new Template();
    $page->set_path($gl_root_path . "templates/");
    // Append correct Character encoding to HTML Header
    $content['EXTRA_METATAGS'] .= '<meta http-equiv="Content-Type" content="text/html; charset=' . $content['HeaderDefaultEncoding'] . '" />';
}
Example #2
0
 /**
  *	Helper function using the template parser to create the report
  */
 public function CreateReportFromData()
 {
     // Create new template parser
     $page = new Template();
     $page->set_path($gl_root_path . "classes/reports/");
     // Run Parser
     $page->parser($this->_reportcontent, $this->_baseFileName);
     // Return result!
     return $page->result();
 }
 $reportIncludePath = $myReportObj->GetReportIncludePath();
 // Include Custom language file if available
 $myReportObj->InitReportLanguageFile($reportIncludePath);
 // Now start the processing part!
 $res = $myReportObj->startDataProcessing();
 if ($res != SUCCESS) {
     $content['error_occured'] = true;
     $content['error_details'] = GetAndReplaceLangStr($content['LN_GEN_ERROR_REPORTGENFAILED'], $mySavedReport['customTitle'], GetErrorMessage($res));
     if (isset($extraErrorDescription)) {
         $content['error_details'] .= "<br><br>" . GetAndReplaceLangStr($content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
     }
 } else {
     // --- Perform report output
     // Init template Parser
     $page = new Template();
     $page->set_path($reportIncludePath);
     // Parse template
     $page->parser($content, $myReportObj->GetBaseFileName());
     // Output the result
     $res = $myReportObj->OutputReport($page->result(), $szErrorStr);
     if ($res == SUCCESS && $myReportObj->GetOutputTarget() != REPORT_TARGET_STDOUT) {
         // Output wasn't STDOUT, so we need to display what happened to the user
         $content['report_success'] = true;
         $content['error_details'] = GetAndReplaceLangStr($content["LN_GEN_SUCCESS_REPORTWASGENERATED_DETAILS"], $szErrorStr);
     } else {
         if ($res == ERROR) {
             // Output failed, display what happened to the user
             $content['error_occured'] = true;
             $content['error_details'] = GetAndReplaceLangStr($content["LN_GEN_ERROR_REPORTFAILEDTOGENERATE"], $szErrorStr);
             if (isset($extraErrorDescription)) {
                 $content['error_details'] .= "<br><br>" . GetAndReplaceLangStr($content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
Example #4
0
function RunReport()
{
    global $content, $gl_root_path;
    // Get Reference to report!
    $myReport = $content['REPORTS'][$content['reportid']];
    // Get reference to savedreport
    $mySavedReport = $myReport['SAVEDREPORTS'][$content['savedreportid']];
    // Get Objectreference to report
    $myReportObj = $myReport["ObjRef"];
    // Set SavedReport Settings!
    $myReportObj->InitFromSavedReport($mySavedReport);
    //Debug Output
    PrintHTMLDebugInfo(DEBUG_INFO, "RunReport", GetAndReplaceLangStr($content["LN_CMD_RUNREPORT"], $mySavedReport['customTitle']));
    // Perform check
    $res = $myReportObj->verifyDataSource();
    if ($res != SUCCESS) {
        // Print error and die!
        $szError = GetAndReplaceLangStr($content['LN_GEN_ERROR_REPORTGENFAILED'], $mySavedReport['customTitle'], GetAndReplaceLangStr(GetErrorMessage($res), $mySavedReport['sourceid']));
        if (isset($extraErrorDescription)) {
            $szError .= "<br><br>" . GetAndReplaceLangStr($content['LN_SOURCES_ERROR_EXTRAMSG'], $extraErrorDescription);
        }
        DieWithErrorMsg($szError);
    } else {
        // Call processing part now!
        $res = $myReportObj->startDataProcessing();
        if ($res != SUCCESS) {
            DieWithErrorMsg(GetAndReplaceLangStr($content['LN_GEN_ERROR_REPORTGENFAILED'], $mySavedReport['customTitle'], GetErrorMessage($res)));
        } else {
            // --- Perform report output
            // Init IncludePath
            $reportIncludePath = $myReportObj->GetReportIncludePath();
            // Include Custom language file if available
            $myReportObj->InitReportLanguageFile($reportIncludePath);
            // Init template Parser
            $page = new Template();
            $page->set_path($reportIncludePath);
            // Parse template
            $page->parser($content, $myReportObj->GetBaseFileName());
            // Output the result
            $res = $myReportObj->OutputReport($page->result(), $szErrorStr);
            if ($res == SUCCESS && $myReportObj->GetOutputTarget() != REPORT_TARGET_STDOUT) {
                //Debug Output
                PrintHTMLDebugInfo(DEBUG_INFO, "RunReport", GetAndReplaceLangStr($content["LN_GEN_SUCCESS_REPORTWASGENERATED_DETAILS"], $szErrorStr));
            } else {
                if ($res == ERROR) {
                    // Debug Error
                    PrintHTMLDebugInfo(DEBUG_ERROR, "RunReport", GetAndReplaceLangStr($content["LN_GEN_ERROR_REPORTFAILEDTOGENERATE"], $szErrorStr));
                }
            }
            // ---
        }
    }
}