%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php
/*
* @Author: Sharda Tech Pvt. Ltd.
*/
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Managehistory extends ADMIN_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('Common_model');
}
public function index()
{
$this->login_check();
if (isset($_GET['delete'])) {
$this->Common_model->deleteRecords($_GET['delete'],'id','history');
$this->session->set_flashdata('success', 'Data is deleted!');
redirect('admin/managehistory');
}
$data = array();
$head = array();
$head['title'] = 'Administration - Manage History';
$head['description'] = '!';
$head['keywords'] = '';
// Validate the form
$this->form_validation->set_rules('title', 'Title', 'trim|required');
//$this->form_validation->set_rules('slug', 'Slug', 'trim|required');
$this->form_validation->set_rules('status', 'Status', 'trim|required');
if ($this->form_validation->run($this)) {
$_POST['slug'] = seo_friendly_url(str_replace(" ","-",strtolower($_POST['slug'])));
$_POST['description'] = seo_friendly_url($_POST['description']);
$_POST['history_image'] = $this->uploadImage();
if($_POST['old_image']!='' && $_POST['history_image']==''){ $_POST['history_image'] = $_POST['old_image']; } unset($_POST['old_image']);
$this->Common_model->setRecords($_POST, 'history');
$this->saveHistory('upload new file - ' . $_POST['title']);
redirect('admin/managehistory');
}
if(isset($_GET['edit'])) {
$_POST = $this->Common_model->getRecords($_GET['edit'], 'history');
}
// Get All SU Banners
$data['historyRecords'] = $this->Common_model->getRecords(NULL, 'history');
$this->load->view('_parts/header', $head);
$this->load->view('managehistory/managehistory', $data);
$this->load->view('_parts/footer');
$this->saveHistory('Go to History');
}
/*
* Function : uploadImage
* Description : Upload the banner image
*/
private function uploadImage()
{
$config['upload_path'] = './attachments/history_images/';
$config['allowed_types'] = $this->allowed_img_types;
$this->load->library('upload', $config);
$this->upload->initialize($config);
if (!$this->upload->do_upload('history_image')) {
log_message('error', 'Image Upload Error: ' . $this->upload->display_errors());
}
$img = $this->upload->data();
// if(!empty($img['file_name'])) {
// resizeImage($img['file_name'],'300','300','attachments/awards_images');
// }
return $img['file_name'];
}
}