sparqapi/api/application/helpers/report_attachments_helper.php

48 lines
1.7 KiB
PHP

<?php
class report_attachments
{
protected $CI = '';
function __construct()
{
//$CI =&get_instance();
}
public function getReportAttchments($pdid,$random_string,$pd_master_details = array())
{
//echo 'this is from daiu';
$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');
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="'.$img_pdf_aws_uri.'">Click here for Image PDF Link</a></p> <p> <a target="_blank" href="'.$img_zip_aws_uri.'">Click here for Image ZIP Link</a> </p>';
if($pd_master_details[0]['fk_pd_type'] == 2 && count($video_uri))// if smart pd
{
$attachment .='<h2>videos</h2>';
foreach ($video_uri as $key => $value)
{
$attachment .= '<p><a target="_blank" href="'.$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 7 days from the date of report generation.)</p>';
return $attachment;
}
}
?>