📁 PHP Dosya Yöneticisi
/
/
home
/
demodesigncom
/
e-ticaretv11.demodesign.com.tr
/
catalog
/
controller
/
emticket
📝
emticket.php
← Geri Dön
<?php class ControllerEmticketEmticket extends Controller { private $error = array(); public function index() { if (!$this->customer->isLogged()) { //$this->session->data['redirect'] = $this->url->link('emticket/emticket', '', true); //$this->response->redirect($this->url->link('account/login', '', true)); } $this->load->language('emticket/emticket'); $this->load->model('emticket/knowledge'); $this->load->model('tool/image'); $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home') ); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_register'), 'href' => $this->url->link('emticket/emticket', '', true) ); if (isset($this->session->data['success'])) { $data['success'] = $this->session->data['success']; unset($this->session->data['success']); } else { $data['success'] = ''; } $data['heading_title'] = $this->language->get('heading_title'); $data['text_no_sections'] = $this->language->get('text_no_sections'); $this->document->setTitle($this->language->get('mheading_title')); $data['add'] = $this->url->link('emticket/emticket/add'); $data['recent'] = $this->url->link('emticket/myticket'); $data['knowledge'] = $this->url->link('emticket/knowledge'); // Config Settings if ($this->request->server['HTTPS']) { $server = $this->config->get('config_ssl'); } else { $server = $this->config->get('config_url'); } $data['ticket_setting'] = $this->config->get('emticketsetting_status'); if(isset($data['ticket_setting']['tickethome_description'])){ $ticket_name = $data['ticket_setting']['tickethome_description'][$this->config->get('config_language_id')]['name']; $ticket_meta_title = $data['ticket_setting']['tickethome_description'][$this->config->get('config_language_id')]['meta_title']; $ticket_meta_description = $data['ticket_setting']['tickethome_description'][$this->config->get('config_language_id')]['meta_description']; $ticket_meta_keyword = $data['ticket_setting']['tickethome_description'][$this->config->get('config_language_id')]['meta_keyword']; $this->document->setTitle($ticket_meta_title); $this->document->setDescription($ticket_meta_description); $this->document->setKeywords($ticket_meta_keyword); } $data['ticket_name'] = (isset($ticket_name) && $ticket_name!="") ? $ticket_name : ''; $data['banner'] = ''; if($data['ticket_setting']['banner']!=""){ if (is_file(DIR_IMAGE .$data['ticket_setting']['banner'])) { $data['banner'] = $server . 'image/' .$data['ticket_setting']['banner']; } else { $data['banner'] = ''; } } // Config Settings // Fetching Sections $sections = $this->model_emticket_knowledge->getSections(); $data['sections'] = array(); if(!empty($sections)){ foreach($sections as $section){ if($section['image']!=""){ $image = $this->model_tool_image->resize($section['image'],90,90); } else{ $image = $this->model_tool_image->resize('placeholder.png',90,90); } $articles = $this->model_emticket_knowledge->getArticleBySectionId($section['section_id']); if(!empty($articles)){ foreach($articles as $key => $article){ $articles[$key]['description'] = html_entity_decode($article['description'], ENT_QUOTES, 'UTF-8'); } } $data['sections'][] = array( 'section_id' => $section['section_id'], 'sort_order' => $section['sort_order'], 'status' => $section['status'], 'name' => $section['name'], 'image' => $image, 'articles' => $articles, 'description' => html_entity_decode($section['description'], ENT_QUOTES, 'UTF-8'), 'meta_title' => $section['meta_title'], 'meta_description' => $section['meta_description'], 'meta_keyword' => $section['meta_keyword'], 'date_added' => date_format(date_create($section['date_added']),'Y/M/d h:i A'), 'date_modified' => date_format(date_create($section['date_modified']),'Y/M/d h:i A'), 'view' => $this->url->link('emticket/knolwdge_section', '§ion_id=' . $section['section_id'] , true) ); } } // Fetching Sections $data['column_left'] = $this->load->controller('common/column_left'); $data['column_right'] = $this->load->controller('common/column_right'); $data['content_top'] = $this->load->controller('common/content_top'); $data['content_bottom'] = $this->load->controller('common/content_bottom'); $data['footer'] = $this->load->controller('common/footer'); $data['header'] = $this->load->controller('common/header'); $this->response->setOutput($this->load->view('emticket/emticket', $data)); } public function add() { if (!$this->customer->isLogged()) { // $this->session->data['redirect'] = $this->url->link('emticket/emticket/add', '', true); // $this->response->redirect($this->url->link('account/login', '', true)); } if ($this->customer->isLogged()) { $data['logged'] = $this->customer->getId(); } else{ $data['logged'] = 0; } $this->load->language('emticket/emticket'); // Ticket Setting $ticket_setting = $this->config->get('emticketsetting_status'); // 11-1-21 guest customer ticket add if(!isset($ticket_setting['who_create_ticket'])){ if (!$this->customer->isLogged()) { $this->session->data['redirect'] = $this->url->link('emticket/emticket/add', '', true); $this->response->redirect($this->url->link('account/login', '', true)); } } // 11-1-21 guest customer ticket add $meta_title = $this->language->get('heading_title'); if(isset($ticket_setting['createticket_description'])){ $createticket_name = $ticket_setting['createticket_description'][$this->config->get('config_language_id')]['name']; $meta_title = $ticket_setting['createticket_description'][$this->config->get('config_language_id')]['meta_title']; $meta_description = $ticket_setting['createticket_description'][$this->config->get('config_language_id')]['meta_description']; $meta_keyword = $ticket_setting['createticket_description'][$this->config->get('config_language_id')]['meta_keyword']; $this->document->setDescription($meta_description); $this->document->setKeywords($meta_keyword); } $this->document->setTitle($meta_title); $data['heading_title'] = $this->language->get('heading_title'); $data['heading_title'] = (isset($createticket_name) && $createticket_name!="") ? $createticket_name : $this->language->get('heading_title'); // Ticket Setting $this->load->language('emticket/emticket'); $this->document->addScript('catalog/view/javascript/jquery/datetimepicker/moment.js'); $this->document->addScript('catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.js'); $this->document->addStyle('catalog/view/javascript/jquery/datetimepicker/bootstrap-datetimepicker.min.css'); $this->load->model('emticket/emticket'); if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) { $tstatus = ""; if($ticket_setting['tstatus']){ $tstatus = $ticket_setting['tstatus']; } $customer_id = $this->model_emticket_emticket->addTicket($tstatus,$this->request->post); $this->session->data['success'] = $this->language->get('text_success'); if($data['logged']){ $this->response->redirect($this->url->link('emticket/myticket')); } else { $this->response->redirect($this->url->link('emticket/emticket')); } } $data['breadcrumbs'] = array(); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home') ); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_register'), 'href' => $this->url->link('emticket/emticket', '', true) ); $data['breadcrumbs'][] = array( 'text' => $this->language->get('text_add'), 'href' => $this->url->link('emticket/emticket/add', '', true) ); $data['text_account_already'] = sprintf($this->language->get('text_account_already'), $this->url->link('account/login', '', true)); $data['text_your_details'] = $this->language->get('text_your_details'); $data['text_ticket_details'] = $this->language->get('text_ticket_details'); $data['text_yes'] = $this->language->get('text_yes'); $data['text_no'] = $this->language->get('text_no'); $data['text_select'] = $this->language->get('text_select'); $data['text_none'] = $this->language->get('text_none'); $data['text_loading'] = $this->language->get('text_loading'); $data['text_attachment'] = $this->language->get('text_attachment'); $data['entry_firstname'] = $this->language->get('entry_firstname'); $data['entry_lastname'] = $this->language->get('entry_lastname'); $data['entry_email'] = $this->language->get('entry_email'); $data['entry_telephone'] = $this->language->get('entry_telephone'); $data['entry_subject'] = $this->language->get('entry_subject'); $data['entry_message'] = $this->language->get('entry_message'); $data['entry_department'] = $this->language->get('entry_department'); $data['entry_priority'] = $this->language->get('entry_priority'); $data['entry_attachment'] = $this->language->get('entry_attachment'); $data['button_continue'] = $this->language->get('button_continue'); $data['button_upload'] = $this->language->get('button_upload'); if (isset($this->error['warning'])) { $data['error_warning'] = $this->error['warning']; } else { $data['error_warning'] = ''; } if (isset($this->error['firstname'])) { $data['error_firstname'] = $this->error['firstname']; } else { $data['error_firstname'] = ''; } if (isset($this->error['lastname'])) { $data['error_lastname'] = $this->error['lastname']; } else { $data['error_lastname'] = ''; } if (isset($this->error['email'])) { $data['error_email'] = $this->error['email']; } else { $data['error_email'] = ''; } if (isset($this->error['telephone'])) { $data['error_telephone'] = $this->error['telephone']; } else { $data['error_telephone'] = ''; } if (isset($this->error['message'])) { $data['error_message'] = $this->error['message']; } else { $data['error_message'] = ''; } if (isset($this->error['subject'])) { $data['error_subject'] = $this->error['subject']; } else { $data['error_subject'] = ''; } if (isset($this->error['department'])) { $data['error_department'] = $this->error['department']; } else { $data['error_department'] = ''; } if (isset($this->error['priority'])) { $data['error_priority'] = $this->error['priority']; } else { $data['error_priority'] = ''; } // fetching priority and department $this->load->model('emticket/emticket'); $data['departments'] = array(); $departments = $this->model_emticket_emticket->getDepartments(); foreach ($departments as $department) { $department_description = $this->model_emticket_emticket->getDepartmentDescriptions($department['department_id']); $data['departments'][] = array( 'department_id' => $department['department_id'], 'name' => $department_description[(int)$this->config->get('config_language_id')]['name'], 'sort_order' => $department['sort_order'], ); } $priorities = $this->model_emticket_emticket->getPrioritys(); foreach ($priorities as $priority) { $info = json_decode($priority['info'], true); $data['priorities'][] = array( 'priority_id' => $priority['priority_id'], 'name' => $info[(int)$this->config->get('config_language_id')]['name'], 'sort_order' => $priority['sort_order'], ); } // fetching priority and department // attachments $this->load->model('tool/upload'); if (isset($this->request->get['ticket_id'])){ $attachments = $this->model_emticket_tickets->getTicketAttachments($this->request->get['ticket_id']); } else { $attachments = array(); } $data['attachments'] = array(); // attachments in post (case of other errors) if (isset($this->request->post['attachments'])) { $attachments = array(); foreach($this->request->post['attachments'] as $atatchss){ $attachments[] = array( 'code' => $atatchss ); } } else if($this->request->post){ $attachments = array(); } // attachments in post (case of other errors) foreach($attachments as $attachment){ $file_info = $this->model_tool_upload->getUploadByCode($attachment['code']); $data['attachments'][] = array( 'upload_id' => $file_info['upload_id'], 'name' => $file_info['name'], 'code' => $file_info['code'], 'filename' => $file_info['filename'], 'date_added' => $file_info['date_added'], 'download' => $this->url->link('emticket/emticketview/download', '&id=' . $file_info['upload_id'] , true) ); } // attachments $data['action'] = $this->url->link('emticket/emticket/add', '', true); if (isset($this->request->post['firstname'])) { $data['firstname'] = $this->request->post['firstname']; } else { $data['firstname'] = ''; } if (isset($this->request->post['lastname'])) { $data['lastname'] = $this->request->post['lastname']; } else { $data['lastname'] = ''; } if (isset($this->request->post['email'])) { $data['email'] = $this->request->post['email']; } else { $data['email'] = ''; } if (isset($this->request->post['telephone'])) { $data['telephone'] = $this->request->post['telephone']; } else { $data['telephone'] = ''; } if (isset($this->request->post['subject'])) { $data['subject'] = $this->request->post['subject']; } else { $data['subject'] = ''; } if (isset($this->request->post['company'])) { $data['company'] = $this->request->post['company']; } else { $data['company'] = ''; } if (isset($this->request->post['message'])) { $data['message'] = $this->request->post['message']; } else { $data['message'] = ''; } if (isset($this->request->post['priority'])) { $data['priority'] = $this->request->post['priority']; } else { $data['priority'] = $ticket_setting['priority']; } if (isset($this->request->post['department'])) { $data['department'] = $this->request->post['department']; } else { $data['department'] = ''; } // Captcha if ($this->config->get($this->config->get('config_captcha') . '_status') && in_array('register', (array)$this->config->get('config_captcha_page'))) { $data['captcha'] = $this->load->controller('extension/captcha/' . $this->config->get('config_captcha'), $this->error); } else { $data['captcha'] = ''; } $data['column_left'] = $this->load->controller('common/column_left'); $data['column_right'] = $this->load->controller('common/column_right'); $data['content_top'] = $this->load->controller('common/content_top'); $data['content_bottom'] = $this->load->controller('common/content_bottom'); $data['footer'] = $this->load->controller('common/footer'); $data['header'] = $this->load->controller('common/header'); $this->response->setOutput($this->load->view('emticket/ticket_add', $data)); } private function validate() { if (!$this->customer->isLogged()) { if ((utf8_strlen(trim($this->request->post['firstname'])) < 1) || (utf8_strlen(trim($this->request->post['firstname'])) > 32)) { $this->error['firstname'] = $this->language->get('error_firstname'); } if ((utf8_strlen(trim($this->request->post['lastname'])) < 1) || (utf8_strlen(trim($this->request->post['lastname'])) > 32)) { $this->error['lastname'] = $this->language->get('error_lastname'); } if ((utf8_strlen($this->request->post['email']) > 96) || !filter_var($this->request->post['email'], FILTER_VALIDATE_EMAIL)) { $this->error['email'] = $this->language->get('error_email'); } /* if ((utf8_strlen($this->request->post['telephone']) < 3) || (utf8_strlen($this->request->post['telephone']) > 32)) { $this->error['telephone'] = $this->language->get('error_telephone'); } */ } if ((utf8_strlen(trim($this->request->post['message'])) < 10) || (utf8_strlen(trim($this->request->post['message'])) > 2000)) { $this->error['message'] = $this->language->get('error_message'); } if ((utf8_strlen(trim($this->request->post['subject'])) < 5) || (utf8_strlen(trim($this->request->post['subject'])) > 128)) { $this->error['subject'] = $this->language->get('error_subject'); } if ((utf8_strlen(trim($this->request->post['priority'])) =="")) { $this->error['priority'] = $this->language->get('error_priority'); } if ((utf8_strlen(trim($this->request->post['department'])) =="")) { $this->error['department'] = $this->language->get('error_department'); } // Captcha if ($this->config->get($this->config->get('config_captcha') . '_status') && in_array('register', (array)$this->config->get('config_captcha_page'))) { $captcha = $this->load->controller('extension/captcha/' . $this->config->get('config_captcha') . '/validate'); if ($captcha) { $this->error['captcha'] = $captcha; } } return !$this->error; } }
💾 Kaydet
İptal
📝 Yeniden Adlandır
İptal
Kaydet
🔐 Dosya İzinleri (chmod)
İzin Değeri:
Hızlı Seçim:
777
755
644
600
777
= Herkes okur/yazar/çalıştırır
755
= Sahip tam, diğerleri okur/çalıştırır
644
= Sahip okur/yazar, diğerleri okur
600
= Sadece sahip okur/yazar
İptal
Uygula