sparqapi/api/application/helpers/report_attachments_helper.php

67 lines
2.6 KiB
PHP

<?php
class report_attachments
{
protected $CI = '';
function __construct()
{
//$CI =&get_instance();
}
public function getReportAttchments($pdid,$random_string,$pd_master_details = array())
{
// print_r($pd_master_details);die();
$CI =&get_instance();
$CI->load->model('PD_Model');
// $CI->load->helper('photo_pdf_converter');
// $CI->load->helper('photo_zip_creator');
// $CI->load->helper('video_grabber_helper');
$CI->load->helper('url_shortener');
$uri = url_shortener::url_shorten($pdid,$random_string);
// if(!count($pd_master_details))
// {
// $pd_master_details = $CI->PD_Model->getPDMasterDetails($pdid,$random_string);
// }
// $img_pdf_aws_uri = (new photo_pdf_converter)->covertImgs2PDF($pd_master_details[0]['pd_id'],$pd_master_details[0]['random_string'],$pd_master_details);
// $img_zip_aws_uri = (new photo_zip_creator)->covertImgs2ZIP($pd_master_details[0]['pd_id'],$pd_master_details[0]['random_string'],$pd_master_details);
// $video_uri = (new video_grabber_helper)->grabAllVideo($pd_master_details[0]['pd_id'],$pd_master_details[0]['random_string'],$pd_master_details);
// print_r($video_uri) ;die();
$attachment = '<div id="page_break"></div><h2>Data Links</h2><p><a target="_blank" href="'.PDF_ATTACHEMENT_URL.$uri['ppdf'].'">Click here for Image PDF Link</a></p> <p> <a target="_blank" href="'.PDF_ATTACHEMENT_URL.$uri['zip'].'">Click here for Image ZIP Link</a> </p>';
if($pd_master_details[0]['fk_pd_type'] == 2 && count($uri['vdo']))// if smart pd
{
$attachment .='<h2>videos</h2>';
foreach ($uri['vdo'] as $key => $value)
{
$attachment .= '<p><a target="_blank" href="'.PDF_ATTACHEMENT_URL.$value['url'].'">'.$value['video_name'].'</a></p>';
}
}
$attachment.= '<br><br><br><p style="font-size:10px;text-align:center;">(Note all links will expire in 15 days from the date of report generation.)</p>';
return $attachment;
}
public function getSMCReportAttchments($pdid,$random_string,$pd_master_details = array())
{
$CI =&get_instance();
$CI->load->helper('url_shortener');
$uri = url_shortener::SMC_report_url_shorten($pdid,$random_string);
$attachment = '<div id="page_break">
</div><h2>Data Links</h2>
<p><a target="_blank" href="'.PDF_ATTACHEMENT_URL.$uri['ppdf'].'">Click here for Image PDF Link</a></p> <p> <a target="_blank" href="'.PDF_ATTACHEMENT_URL.$uri['zip'].'">Click here for Image ZIP Link</a> </p>';
$attachment.= '<br><br><br><p style="font-size:10px;text-align:center;">(Note all links will expire in 15 days from the date of report generation.)</p>';
return $attachment;
}
}
?>