| 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_tickets
{
private $ci;
public function __construct()
{
$this->ci = &get_instance();
}
public function export($contact_id)
{
$this->ci->load->model('tickets_model');
$this->ci->db->where('contactid', $contact_id);
$tickets = $this->ci->db->get(db_prefix().'tickets')->result_array();
$this->ci->db->where('show_on_client_portal', 1);
$this->ci->db->where('fieldto', 'tickets');
$this->ci->db->order_by('field_order', 'asc');
$custom_fields = $this->ci->db->get(db_prefix().'customfields')->result_array();
foreach ($tickets as $ticketKey => $ticket) {
$this->ci->db->where('ticketid', $ticket['ticketid']);
$tickets[$ticketKey]['replies'] = $this->ci->db->get(db_prefix().'ticket_replies')->result_array();
$this->ci->db->where('departmentid', $ticket['department']);
$dept = $this->ci->db->get(db_prefix().'departments')->row();
if ($dept) {
$tickets[$ticketKey]['department_name'] = $dept->name;
}
$this->ci->db->where('priorityid', $ticket['priority']);
$priority = $this->ci->db->get(db_prefix().'tickets_priorities')->row();
if ($priority) {
$tickets[$ticketKey]['priority_name'] = $priority->name;
}
$this->ci->db->where('ticketstatusid', $ticket['status']);
$status = $this->ci->db->get(db_prefix().'tickets_status')->row();
if ($status) {
$tickets[$ticketKey]['status_name'] = $status->name;
}
$this->ci->db->where('serviceid', $ticket['service']);
$service = $this->ci->db->get(db_prefix().'services')->row();
if ($service) {
$tickets[$ticketKey]['service_name'] = $service->name;
}
$tickets[$ticketKey]['additional_fields'] = [];
foreach ($custom_fields as $cf) {
$tickets[$ticketKey]['additional_fields'][] = [
'name' => $cf['name'],
'value' => get_custom_field_value($ticket['ticketid'], $cf['id'], 'tickets'),
];
}
}
return $tickets;
}
}