PDF PREVIEW ISSUES #1
This commit is contained in:
parent
78942fa049
commit
9dc4a08c6e
@ -8086,9 +8086,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
{
|
||||
|
||||
|
||||
$this->load->helper('SYMLINKS');
|
||||
SYMLINKS::createSymLinks();
|
||||
die();
|
||||
|
||||
$pdid = $this->uri->segment(3);
|
||||
log_message('DEBUG',"getPDReportPDFpreview_post called ");//die();
|
||||
$random_string = $this->uri->segment(2);
|
||||
@ -8150,12 +8148,14 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
$pdf_doc = $this->pdfgenerator->generate($report_data, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait");
|
||||
//End of PDF Gen using DOM PDF
|
||||
$output_file2 = $this->external_path ."/pd_reports/" . $pdid . "/sample.pdf";
|
||||
$link = 'https://'. $this->config->item('full_server_name').'/ssa_external_data/'. ENVIRONMENT.'/pd_reports/'. $pdid . "/sample.pdf";
|
||||
$link_to_send = 'https://'. $this->config->item('full_server_name').'/ssa_external_data/'. ENVIRONMENT.'/pd_reports/'. $pdid . "/sample.pdf";
|
||||
|
||||
//$link_to_be_create = '/var/www/html/ssa_external_data/'. ENVIRONMENT.'/pd_reports/'. $pdid . "/sample.pdf";
|
||||
|
||||
file_put_contents($output_file2, $pdf_doc);
|
||||
//header("Access-Control-Allow-Methods: GET, OPTIONS");
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
|
||||
echo json_encode(array('link'=>$link));
|
||||
$this->load->helper('SYMLINKS');
|
||||
SYMLINKS::createSymLinks($pdid,$output_file2);
|
||||
echo json_encode(array('link'=>$link_to_send));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -6,10 +6,17 @@ class EXTERNAL_DIR_CHECK
|
||||
|
||||
|
||||
// Create the logger
|
||||
public static function checkExternalDirectory($pd_id = null) //$msg,$data,$log_type
|
||||
public static function checkExternalDirectory($pd_id = null,$path_to_check = null)
|
||||
{
|
||||
//echo 'EXTERNAL_DIR_CHECK called';
|
||||
$path = XLPATH;
|
||||
if($path_to_check == null)
|
||||
{
|
||||
$path = XLPATH;
|
||||
}
|
||||
else
|
||||
{
|
||||
$path = $path_to_check;
|
||||
}
|
||||
if(!file_exists($path))
|
||||
{
|
||||
mkdir($path,0777);
|
||||
|
||||
@ -6,13 +6,19 @@ class SYMLINKS
|
||||
|
||||
|
||||
|
||||
public static function createSymLinks($pd_id = null)
|
||||
public static function createSymLinks($pd_id = null,$output_file2 = null)
|
||||
{
|
||||
//echo SELF::checkOS();
|
||||
//check os
|
||||
if(SELF::checkOS() == 'LINUX')
|
||||
if(SELF::checkOS() === 'LINUX')
|
||||
{
|
||||
|
||||
$symbalic_path = $_SERVER['DOCUMENT_ROOT'].'/ssa_external_data/'.ENVIRONMENT;
|
||||
$link_to_be_create = '/var/www/html/ssa_external_data/'. ENVIRONMENT.'/pd_reports/'. $pd_id . "/sample.pdf";
|
||||
EXTERNAL_DIR_CHECK::checkExternalDirectory($pd_id,$symbalic_path);
|
||||
if(!file_exists($link_to_be_create))
|
||||
{
|
||||
symlink($output_file2,$link_to_be_create);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user