| Server IP : 103.234.187.230 / Your IP : 216.73.216.216 Web Server : Apache System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/adeetieadmin/application/modules/gallery/controllers/ |
Upload File : |
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Gallery extends MY_Controller
{
public function __construct()
{
parent::__construct();
$groups = array('superadmin','admin');
if (!$this->ion_auth->logged_in() || !$this->ion_auth->in_group($groups))
{
redirect('auth/login', 'refresh');
}
$this->load->model('gallery/gallery_model');
}
public function index()
{
$this->data['details']=$this->db->select('*')->where('status!=',2)->order_by('id','DESC')->get(TBL_MEDIA)->result();
$this->data['bread_crumb']=render_bread_crumb(array('dashboard'=>'Dashboard','media'=>'Gallery'));
$this->data['page']='index';
$this->_render_page(get_template(),$this->data);
}
/**delte images
*
*/
public function bulk_actions()
{
if($this->input->post("ids"))
{
$ids=$this->input->post("ids");
$data=array('status'=>2);
$this->db->where_in('id', $ids);
$this->db->update(TBL_MEDIA,$data);
if($this->db->affected_rows())
{
if(count($ids)>1)
{
$this->session->set_flashdata('message','Images are deleted !');
redirect(base_url().'gallery');
}
else if(count($ids)==1)
{
$this->session->set_flashdata('message','Image is deleted !');
redirect(base_url().'gallery');
}
}
}
}
public function addedit($id='')
{
$id = (isset($_POST['id']) ? $_POST['id'] : $id ); // If available from post (edit-case)
$new = ($id=='' ? TRUE : FALSE );
if(isset($_POST['zed-save']))
{
$data['media_title']=$this->input->post('g_title');
$data['media_type']=$this->input->post('media_type');
$data['media_name']=basename(gallery_upload('g_image'));
$data['media_slug']=gallery_upload('g_image');
$data['media_caption']=$this->input->post('g_caption');
$data['link']=$this->input->post('link');
$data['media_seo_alt_text']=$this->input->post('g_seo_alt_text');
if($new)
{
$data['created_on']=global_datetime();
$data['created_by']=$this->ion_auth->user()->row()->id;
}
else
{
$data['modified_on']=global_datetime();
$data['modified_by']=$this->ion_auth->user()->row()->id;
}
if($new)
{
$result=$this->gallery_model->insertimage($data);
if($result)
{
$this->session->set_flashdata('message', 'New Image added successfully !');
redirect(base_url().'gallery');
}
}
else
{
$result=$this->gallery_model->updateimage($id,$data);
if($result)
{
$this->session->set_flashdata('message', 'Image Updated successfully!');
redirect(base_url().'gallery');
}
}
}
if(!$new)
{
$this->data['details'] = $this->gallery_model->selectimage($id);
}
$this->data['bread_crumb']=render_bread_crumb(array('dashboard'=>'Dashboard','gallery'=>'Gallery','addimage'=>'Add Image'));
$this->data['page']='addedit';
$this->_render_page(get_template(),$this->data);
}
}