https://t.me/RX1948
Server : Apache/2.4.18 (Ubuntu)
System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64
User : oppastar ( 1041)
PHP Version : 7.0.33-0ubuntu0.16.04.15
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_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
Directory :  /var/www/iatax.com.au/public_html/application/controllers/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/iatax.com.au/public_html/application/controllers/admin/Testimonials.php
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Testimonials extends Admin_Controller {

	//this property is used for validating existing menu title on call back edit menu
	private $testimonials_current_id = NULL;
		
	function __construct() {
		parent::__construct();	 
		$this->load->model('testimonials_m');   
	}
		
	//this is to list all testimonials
	public function index() {
		//pagination in action. 50 results per page
		$this->load->library('pagination');
		$config['base_url'] = base_url() . 'admin/testimonials/index';
		$config['per_page'] = 50;
		$config["uri_segment"] = 4; 

		//get testimonials
		$this->data['testimonials'] = $this->testimonials_m->get_all_testimonials($config["per_page"], $this->uri->segment($config['uri_segment']));  

		//count testimonials
		$config['total_rows'] = $this->testimonials_m->record_count(); 
		$this->pagination->initialize($config);
	
		//load view
		$this->data['subview'] = 'admin/testimonials/index';
		$this->load->view('admin/templates/header', $this->data_header); 
		$this->load->view('admin/_layout_main', $this->data);
		$this->load->view('admin/templates/footer');	
    }
	
	//to add a new menu  
	public function add() {
	
		$this->data['testimonial'] = $this->testimonials_m->get_new();  
		
		//validation in action
		//validation check in action
		$rules = $this->testimonials_m->rules; 

		$config = $this->check_form_validation($rules, $_POST);
		
		$this->load->library('form_validation');
		$this->form_validation->set_error_delimiters('<div class="error">', '</div>'); //above is to add class to form validation error, to be styled
		$this->form_validation->set_rules($config); 

		if($this->form_validation->run($this) == TRUE) {
			
			$data = $this->process_data($_POST);
			
			$this->testimonials_m->add_testimonial($data); 

			$this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Testimonial Add Successful</p>');

			redirect('admin/testimonials');
			
		}  
		
		$this->data['subview'] = 'admin/testimonials/edit';
		$this->load->view('admin/templates/header', $this->data_header); 
		$this->load->view('admin/_layout_main', $this->data);
		$this->load->view('admin/templates/footer');
	}
	
	//to edit menu in admin
	public function edit($id = NULL) {

		//check if id exist. If not exist, show 404.
		$count = $this->testimonials_m->count_exist($id);
		
		if ($count == 0) { 
			//page not exist
			show_404();
		}	

		$this->testimonials_current_id = (int) $id;	

		$this->data['testimonial'] = $this->testimonials_m->get($id);	
		
		//validation check in action
		$rules = $this->testimonials_m->rules;
		$config = $this->check_form_validation($rules, $_POST);

		$this->load->library('form_validation');
		$this->form_validation->set_error_delimiters('<div class="error">', '</div>'); //above is to add class to form validation error, to be styled
		$this->form_validation->set_rules($config); 

		if($this->form_validation->run($this) == TRUE) {
			
			$data = $this->process_data($_POST);

			$this->testimonials_m->edit_testimonial($id, $data); 

			$this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">testimony Edit Successful</p>');
			
			redirect('admin/testimonials');
		} 
		
		$this->data['subview'] = 'admin/testimonials/edit';
		$this->load->view('admin/templates/header', $this->data_header); 
		$this->load->view('admin/_layout_main', $this->data);
		$this->load->view('admin/templates/footer');	
	}
	
	
	//to delete a testimony
	public function delete($id) {

		//check if id exist. If not exist, show 404.
		$count = $this->testimonials_m->count_exist($id);
		
		if ($count == 0) {  
			//page not exist 
			show_404(); 
		}		
		
		//delete testimony
		$this->testimonials_m->delete_testimonial($id);

		$this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Testimony Delete Successful</p>');
		redirect('admin/testimonials');
	}

	private function check_form_validation($config, $post_data) {
		return $config;
	}

	private function process_data($post_data) {

		$data = array(
			'author' => $this->security->xss_clean($post_data['author']),
			'quotes' => $this->security->xss_clean($post_data['quotes']),
			'rating' => $post_data['rating'],
			'status' => $post_data['status'],
		);

		return $data;		

	}
	
		
}

https://t.me/RX1948 - 2025