%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: Chandni Gupta
*/
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Manageevents extends ADMIN_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('Common_model');
}
public function index()
{
$this->login_check();
$data = array();
$head = array();
$head['title'] = 'Administration - Manage Events';
$head['description'] = '!';
$head['keywords'] = '';
// Delete Testimonials
if (isset($_GET['delete'])) {
$this->Common_model->deleteRecords($_GET['delete'],'id','su_eventdetails');
$this->session->set_flashdata('result_delete', 'Events is deleted!');
$this->saveHistory('Delete Events id - ' . $_GET['delete']);
redirect('admin/manageevents/manageevents');
}
// Get Events
$search_string = '';
if($_POST['Search']) { $search_string = $_POST['str'];}
$data['eventDetails'] = $this->Common_model->getRecords(NULL,'su_eventdetails');
$this->load->view('_parts/header', $head);
$this->load->view('manageevents/manageevents', $data);
$this->load->view('_parts/footer');
$this->saveHistory('Go to Manage Events');
}
public function addevent()
{
$this->login_check();
$data = array();
$head = array();
$head['title'] = 'Administration - Add Event';
$head['description'] = '!';
$head['keywords'] = '';
if (isset($_POST['submit']))
{
$this->form_validation->set_rules('display_name', 'Display Name', 'trim|required');
$this->form_validation->set_rules('description', 'Description', 'trim|required');
$this->form_validation->set_rules('terms_condition', 'Terms & Condition', 'trim|required');
$this->form_validation->set_rules('status', 'Status', 'trim|required');
if ($this->form_validation->run($this))
{
$_POST['display_name'] = seo_friendly_url($_POST['display_name']);
$_POST['description'] = seo_friendly_url_desc($_POST['description']);
$_POST['terms_condition'] = seo_friendly_url_desc($_POST['terms_condition']);
$_POST['slug'] = str_replace(array(" ","'","&"),"-",valid_seo_friendly_url(strtolower($_POST['slug'])));
$_POST['event_banner'] = $this->uploadImage();
$_POST['event_video'] = $this->uploadVideoImage();
unset($_POST['submit']);
if($_POST['event_banner']=='' && $_POST['old_image']!='') { $_POST['event_banner']= $_POST['old_image']; } unset($_POST['old_image']);
if($_POST['old_video_image']!='' && $_POST['event_video']==''){ $_POST['event_video'] = $_POST['old_video_image']; } unset($_POST['old_video_image']);
$resp = $this->Common_model->setRecords($_POST,'su_eventdetails');
$this->session->set_flashdata('result_publish', 'Event Added Successfully');
if ($id == 0) {
$this->saveHistory('Event Added Successfully');
} else {
$this->saveHistory('Event Updated Successfully');
}
redirect('admin/manageevents');
}
}
// Get Testimonials List
if($_GET['edit']>0){
$_POST = $this->Common_model->getRecords($_GET['edit'],'su_eventdetails');
}
// Get Event List
$data['sectionArray'] = $this->Common_model->getSections();
$this->load->view('_parts/header', $head);
$this->load->view('manageevents/addevent', $data);
$this->load->view('_parts/footer');
$this->saveHistory('Go to Add New Event');
}
/*
* Function : uploadImage
*/
private function uploadImage()
{
$config['upload_path'] = './attachments/banner_images/';
$config['allowed_types'] = $this->allowed_img_types;
$this->load->library('upload', $config);
$this->upload->initialize($config);
if (!$this->upload->do_upload('event_banner')) {
log_message('error', 'Image Upload Error: ' . $this->upload->display_errors());
}
$img = $this->upload->data();
// Resize Image
if(!empty($img['file_name'])) {
resizeImage($img['file_name'],'300','300','attachments/banner_images');
}
return $img['file_name'];
}
/*
* Function : uploadVideoImage
* Description : Upload the banner Video
*/
private function uploadVideoImage()
{
$config['upload_path'] = './attachments/banner_images/';
$config['allowed_types'] = $this->allowed_img_types;
$this->load->library('upload', $config);
$this->upload->initialize($config);
if (!$this->upload->do_upload('event_video')) {
log_message('error', 'Image Upload Error: ' . $this->upload->display_errors());
}
$img = $this->upload->data();
return $img['file_name'];
}
}