/** * Function exports the report in a Excel sheet * @param Vtiger_Request $request */ function GetXLS(Vtiger_Request $request) { $recordId = $request->get('record'); error_reporting(0); //error_reporting(63);ini_set("display_errors",1); if (ITS4YouReports::isStoredITS4YouReport() === true) { $ogReport = ITS4YouReports::getStoredITS4YouReport(); } else { $ogReport = new ITS4YouReports(); } $generateObj = new GenerateObj($ogReport); $report_data = $generateObj->GenerateReport($recordId, "XLS"); //ITS4YouReports::sshow($report_data); //exit; $rootDirectory = vglobal('root_directory'); $tmpDir = vglobal('tmp_dir'); $tempFileName = tempnam($rootDirectory . $tmpDir, 'xls'); $fileName = $ogReport->reportname . '.xls'; $default_charset = vglobal("default_charset"); $fileName = html_entity_decode($fileName, ENT_QUOTES, $default_charset); $generateObj->writeReportToExcelFile($tempFileName, $report_data); //ITS4YouReports::sshow($report_data); //exit; if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) { header('Pragma: public'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); } header('Content-Type: application/x-msexcel'); header('Content-Length: ' . @filesize($tempFileName)); header('Content-disposition: attachment; filename="' . $fileName . '"'); $fp = fopen($tempFileName, 'rb'); fpassthru($fp); //unlink($tempFileName); //echo "<pre>";print_r($report_data);echo "</pre>"; }
public static function getInstance($reportid) { if (!isset(self::$instances[$reportid])) { if (ITS4YouReports::isStoredITS4YouReport() === true) { $ogReport = ITS4YouReports::getStoredITS4YouReport(); } else { $ogReport = new ITS4YouReports(); } self::$instances[$reportid] = new GenerateObj($ogReport); } return self::$instances[$reportid]; }
public function getITS4YouReport($ogReport = "") { if (!isset($ogReport) || $ogReport == "") { if (ITS4YouReports::isStoredITS4YouReport() === true) { //ITS4YouReports::sshow("STORED"); $ogReport = ITS4YouReports::getStoredITS4YouReport(); } else { //ITS4YouReports::sshow("NOT STORED"); $ogReport = new ITS4YouReports(); } } return $ogReport; }
public function getStoredITS4YouReport() { $r4u_sesstion_name = ITS4YouReports::getITS4YouReportStoreName(); $request = new Vtiger_Request($_REQUEST, $_REQUEST); // used to unlink sessioned reports ! if ($request->has("refresh") && $request->get('refresh') === "true") { ITS4YouReports::sshow(ITS4YouReports::unsetITS4YouReportsSerialize($r4u_sesstion_name)); } // to unlink all if ($request->has("mode") && $request->get('mode') === "ChangeSteps") { $run_construct = false; } else { if ($request->has("view") && $request->get('view') === "Edit" && isset($_SESSION[$r4u_sesstion_name])) { $run_construct = false; } else { $run_construct = true; } } $return_obj = new ITS4YouReports($run_construct); if (ITS4YouReports::isStoredITS4YouReport() === true) { $return_obj = unserialize($_SESSION[$r4u_sesstion_name]); } if (isset($return_obj->reportinformations["deleted"]) && $return_obj->reportinformations["deleted"] !== 0 && $return_obj->reportinformations["deleted"] !== "0") { die("<br><br><center>" . vtranslate('LBL_RECORD_DELETE') . " <a href='javascript:window.history.back()'>" . vtranslate('LBL_GO_BACK') . ".</a></center>"); } if ($request->has("record") && !$request->isEmpty("record")) { $return_obj->primarymoduleid = $return_obj->reportinformations["primarymodule"]; $return_obj->primarymodule = vtlib_getModuleNameById($return_obj->primarymoduleid); } return $return_obj; }