| Server IP : 103.161.17.216 / Your IP : 216.73.216.1 Web Server : nginx/1.18.0 System : Linux tipsysaigoncharming 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : www-data ( 33) PHP Version : 7.4.3-4ubuntu2.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/app.houseland.info/application/libraries/gdpr/ |
Upload File : |
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Gdpr_proposals
{
private $ci;
public function __construct()
{
$this->ci = &get_instance();
}
public function export($rel_id, $rel_type)
{
// $readProposalsDir = '';
// $tmpDir = get_temp_dir();
if (!class_exists('proposals_model')) {
$this->ci->load->model('proposals_model');
}
$this->ci->db->where('rel_id', $rel_id);
$this->ci->db->where('rel_type', $rel_type);
$proposals = $this->ci->db->get(db_prefix().'proposals')->result_array();
$this->ci->db->where('show_on_client_portal', 1);
$this->ci->db->where('fieldto', 'proposal');
$this->ci->db->order_by('field_order', 'asc');
$custom_fields = $this->ci->db->get(db_prefix().'customfields')->result_array();
/*
if (count($proposals) > 0) {
$uniqueIdentifier = $tmpDir . $rel_id . time() . '-proposals';
$readProposalsDir = $uniqueIdentifier;
}*/
$this->ci->load->model('currencies_model');
foreach ($proposals as $proposaArrayKey => $proposal) {
// $proposal['attachments'] = _prepare_attachments_array_for_export($this->ci->proposals_model->get_attachments($proposal['id']));
// $proposals[$proposaArrayKey] = parse_proposal_content_merge_fields($proposal);
$proposals[$proposaArrayKey]['country'] = get_country($proposal['country']);
$proposals[$proposaArrayKey]['currency'] = $this->ci->currencies_model->get($proposal['currency']);
$proposals[$proposaArrayKey]['items'] = _prepare_items_array_for_export(get_items_by_type('proposal', $proposal['id']), 'proposal');
$proposals[$proposaArrayKey]['comments'] = $this->ci->proposals_model->get_comments($proposal['id']);
$proposals[$proposaArrayKey]['views'] = get_views_tracking('proposal', $proposal['id']);
$proposals[$proposaArrayKey]['tracked_emails'] = get_tracked_emails($proposal['id'], 'proposal');
$proposals[$proposaArrayKey]['additional_fields'] = [];
foreach ($custom_fields as $cf) {
$proposals[$proposaArrayKey]['additional_fields'][] = [
'name' => $cf['name'],
'value' => get_custom_field_value($proposal['id'], $cf['id'], 'proposal'),
];
}
/* $tmpProposalsDirName = $uniqueIdentifier;
if (!is_dir($tmpProposalsDirName)) {
mkdir($tmpProposalsDirName, 0755);
}
$tmpProposalsDirName = $tmpProposalsDirName . '/' . $proposal['id'];
mkdir($tmpProposalsDirName, 0755);*/
/* if (count($proposal['attachments']) > 0 || !empty($proposal['signature'])) {
$attachmentsDir = $tmpProposalsDirName . '/attachments';
mkdir($attachmentsDir, 0755);
foreach ($proposal['attachments'] as $att) {
xcopy(get_upload_path_by_type('proposal') . $proposal['id'] . '/' . $att['file_name'], $attachmentsDir . '/' . $att['file_name']);
}
if (!empty($proposal['signature'])) {
xcopy(get_upload_path_by_type('proposal') . $proposal['id'] . '/' . $proposal['signature'], $attachmentsDir . '/' . $proposal['signature']);
}
}*/
// unset($proposal['id']);
// $fp = fopen($tmpProposalsDirName . '/proposal.json', 'w');
// fwrite($fp, json_encode($proposal, JSON_PRETTY_PRINT));
// fclose($fp);
}
return $proposals;
}
}