| Server IP : 162.214.74.102 / Your IP : 216.73.217.103 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/lrsys/public_html/lrsys_projetos/sopizzas/application/controllers/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
session_start(); //we need to call PHP's session object to access it through CI
class Faqmanagement extends MY_Controller {
function __construct()
{
parent::__construct();
$this->load->helper("url");
$this->load->helper('form');
$this->load->library('form_validation');
$this->load->library('javascript');
$this->perPage = ROW_PER_PAGE;
$this->load->model('faqmanagement_model');
$this->load->library('Ajax_pagination');
$session_data = $this->session->userdata('logged_in');
//if(empty($session_data)) { redirect('superadmin', 'refresh'); }
if($this->session->userdata('user_language'))
{
$language = $this->session->userdata('user_language');
}
else
{
$language = $this->config->item("language");
}
$data['user_language'] = $language;
$this->lang->load('superAdmin', $language);
}
function index( $offset = 0 )
{
if ($this->input->server('REQUEST_METHOD') == 'POST') {
if ($this->input->post('EditId') == '') {
$this->addFaq();
}
else {
$this->editFaq();
}
}
else {
$SearchBy = '';
//total rows count
$totalRec = count($this->faqmanagement_model->get_faq_list());
//pagination configuration
$config['target'] = '#postList';
$config['base_url'] = base_url().'state/ajaxPaginationData/'.$SearchBy;
$config['total_rows'] = $totalRec;
$config['per_page'] = $this->perPage;
$this->ajax_pagination->initialize($config);
//get the posts data
$data['FaqList'] = $this->faqmanagement_model->get_faq_list(array('limit'=>$this->perPage), $SearchBy);
$data['title']="Faq Management";
$data['page']="faq";
$this->load->view('superadmin/header',$data);
$this->load->view('superadmin/main-sidebar');
$this->load->view('superadmin/faq_management_list');
$this->load->view('superadmin/footer');
}
}
function showFaq() {
$my_id = $this->input->post('id');
$ShowPageFaq = $this->faqmanagement_model->show_page_faq($my_id);
$data['ShowPageFaq'] = $ShowPageFaq;
echo json_encode($data);
}
function addFaq() {
$now = date('Y-m-d H:i:s');
$this->db->trans_start();
$data_in = array(
'question' => $this->input->post('question'),
'answer' => $this->input->post('answer'),
'addeddate' => $now
);
$this->db->insert('rt_faq', $data_in);
$this->db->trans_complete();
$this->session->set_flashdata('success_msg', 'FAQ is successfully saved');
redirect('superadmin/faqmanagement', 'refresh');
}
function editFaq() {
$EditId = $this->input->post('EditId');
$this->db->trans_start();
$data_up = array(
'question' => $this->input->post('question'),
'answer' => $this->input->post('answer')
);
$this->db->where('faq_id', $EditId);
$this->db->update('rt_faq', $data_up);
$this->db->trans_complete();
$this->session->set_flashdata('success_msg', 'FAQ is successfully updated');
redirect('superadmin/faqmanagement', 'refresh');
}
}