?
Current Path : /home1/savoy/public_html/unova.in/test/application/controllers/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : /home1/savoy/public_html/unova.in/test/application/controllers/admin.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?> <?php class Admin extends MY_Controller { public function __construct() { parent::MY_Controller(); $this->load->model('adminmodel'); $this->load->model('mastermodel'); $this->load->library('Fpaginate'); } function home() { $_SESSION['admin_page']='home'; $data['reminder']=$this->mastermodel->getdatas('reminder'); $this->load->view('admin/home',$data); } function insert_reminder() { $postdata = $this->mastermodel->get_post_values(); $this->adminmodel->insert_reminder($postdata); $data['reminder']=$this->mastermodel->getdatas('reminder'); $this->load->view('admin/home',$data); } function programme($pagenum="1") { $_SESSION['admin_page']='programme'; $perpage= $this->config->item('perpage'); $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } $output=$this->mastermodel->getdatas('programme','order','',$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['programmes']=$output['results']; $this->load->view('admin/programme',$data); } function programme_registration($program_id,$pagenum="1") { $_SESSION['admin_page']='programme'; $perpage= $this->config->item('perpage'); $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } $output=$this->mastermodel->get_data('programme_registration',$program_id,'programme_id','datetime','asc',$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['registration']=$output['results']; $this->load->view('admin/programme-registrations',$data); } function training($pagenum="1") { $_SESSION['admin_page']='training'; $perpage= $this->config->item('perpage'); $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } $output=$this->mastermodel->getdatas('training','order','',$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['training']=$output['results']; $this->load->view('admin/training',$data); } function coaching($pagenum="1") { $_SESSION['admin_page']='coaching'; $perpage= $this->config->item('perpage'); $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } $output=$this->mastermodel->getdatas('coaching','order','',$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['coaching']=$output['results']; $this->load->view('admin/coaching',$data); } function leadership($pagenum="1") { $_SESSION['admin_page']='leadership'; $perpage= $this->config->item('perpage'); $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } $output=$this->mastermodel->getdatas(' leadership_workshops','order','',$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['coaching']=$output['results']; $this->load->view('admin/leadership',$data); } function training_registration($training_id,$pagenum="1") { $_SESSION['admin_page']='training'; $perpage= $this->config->item('perpage'); $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } $output=$this->mastermodel->get_data('training_registration',$training_id,'training_id','datetime','asc',$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['registration']=$output['results']; $this->load->view('admin/training-registrations',$data); } function coaching_registration($coaching_id,$pagenum="1") { $_SESSION['admin_page']='coaching'; $perpage= $this->config->item('perpage'); $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } $output=$this->mastermodel->get_data('coaching_registration',$coaching_id,'coaching_id','datetime','asc',$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['registration']=$output['results']; $this->load->view('admin/coaching-registrations',$data); } function leadership_registration($workshop_id,$pagenum="1") { $_SESSION['admin_page']='leadership'; $perpage= $this->config->item('perpage'); $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } $output=$this->mastermodel->get_data('workshop_registration',$workshop_id,'workshop_id','datetime','asc',$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['registration']=$output['results']; $this->load->view('admin/leadership-registrations',$data); } function contact($pagenum="1") { $_SESSION['admin_page']='contact'; $perpage= $this->config->item('perpage'); $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } $output=$this->mastermodel->getdatas('contact','datetime','',$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['registration']=$output['results']; $this->load->view('admin/contact',$data); } function feedback($pagenum="1") { $_SESSION['admin_page']='feedback'; $perpage= $this->config->item('perpage'); $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } $output=$this->mastermodel->getdatas('feedback','datetime','',$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['registration']=$output['results']; $this->load->view('admin/feedback',$data); } function testimonial($pagenum="1") { $_SESSION['admin_page']='testimonial'; $perpage= $this->config->item('perpage'); $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } $output=$this->mastermodel->getdatas('testimonial','sort','',$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['testimonials']=$output['results']; $this->load->view('admin/testimonial',$data); } function quote() { $_SESSION['admin_page']='quote'; $data['quote']=$this->mastermodel->get_data_srow('quote','1','quote_id'); $this->load->view('admin/quote',$data); } function gallery($pagenum="1") { $_SESSION['admin_page']='gallery'; $perpage= $this->config->item('perpage'); $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } $output=$this->mastermodel->getdatas('gallery','sort','',$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['gallery']=$output['results']; $this->load->view('admin/gallery',$data); } function add_gallery() { $_SESSION['admin_page']='gallery'; $this->load->library('image_moo') ; $data['upload_path'] = $upload_path = "assets/images/gallery/normal/" ; $data['destination_thumbs'] = $destination_thumbs = "assets/images/gallery/thumbs/" ; $data['large_photo_exists'] = $data['thumb_photo_exists'] = $data['error'] = NULL ; $data['thumb_width'] = "75"; $data['thumb_height'] = "75"; $data['img']['image_width']="500"; $data['img']['image_height']="500"; if (!empty($_POST['upload'])) { $config['upload_path'] = $upload_path ; $config['allowed_types']= 'gif|jpg|png|jpeg'; $config['max_size'] = '2000'; $config['max_width'] = '451'; $config['max_height'] = '451'; $this->load->library('upload', $config); if ($this->upload->do_upload("image")) { $data['img'] = $this->upload->data(); $data['large_photo_exists'] = "<img src=\"".base_url() . $upload_path.$data['img']['file_name']."\" alt=\"Large Image\"/>"; } } elseif (!empty($_POST['upload_thumbnail'])) { $postdata = $this->mastermodel->get_post_values(); $x1 = $this->input->post('x1',TRUE) ; $y1 = $this->input->post('y1',TRUE) ; $x2 = $this->input->post('x2',TRUE) ; $y2 = $this->input->post('y2',TRUE) ; $w = $this->input->post('w',TRUE) ; $h = $this->input->post('h',TRUE) ; $file_name = $this->input->post('file_name',TRUE) ; $postdata['filename']=$file_name; if ($file_name) { $this->image_moo ->load($upload_path . $file_name) ->crop($x1,$y1,$x2,$y2) ->save($destination_thumbs . $file_name) ; $res= $this->adminmodel->add_gallery($postdata); if ($this->image_moo->errors) { $data['error'] = $this->image_moo->display_errors() ; } else { $data['thumb_photo_exists'] = "<img src=\"".base_url() . $destination_thumbs . $file_name."\" alt=\"Thumbnail Image\"/>"; $data['large_photo_exists'] = "<img src=\"".base_url() . $upload_path.$file_name."\" alt=\"Large Image\"/>"; } } redirect('admin/gallery'); } $this->load->view('admin/add_gallery',$data); } function add_programme() { $_SESSION['admin_page']='programme'; $postdata = $this->mastermodel->get_post_values(); if(isset($_POST['savep'])) { $res= $this->adminmodel->add_programme($postdata); redirect('admin/programme'); } $this->load->view('admin/add_programme'); } function add_training() { $_SESSION['admin_page']='training'; $postdata = $this->mastermodel->get_post_values(); if(isset($_POST['savep'])) { $res= $this->adminmodel->add_training($postdata); redirect('admin/training'); } $this->load->view('admin/add_training'); } function add_coaching() { $_SESSION['admin_page']='coaching'; $postdata = $this->mastermodel->get_post_values(); if(isset($_POST['savep'])) { $res= $this->adminmodel->add_coaching($postdata); redirect('admin/coaching'); } $this->load->view('admin/add_coaching'); } function add_testimonial() { $_SESSION['admin_page']='testimonial'; $postdata = $this->mastermodel->get_post_values(); if(isset($_POST['savep'])) { $res= $this->adminmodel->add_testimonial($postdata); redirect('admin/testimonial'); } $this->load->view('admin/add_testimonial'); } function update_testimonial($id="") { $_SESSION['admin_page']='testimonial'; if(isset($_POST['savep'])) { $postdata = $this->mastermodel->get_post_values(); $res= $this->adminmodel->update_testimonial($postdata); redirect('admin/testimonial'); } $data['testimonial']=$this->mastermodel->get_data_srow('testimonial',$id,'id'); $this->load->view('admin/update_testimonial',$data); } function update_programme($id="") { $_SESSION['admin_page']='programme'; if(isset($_POST['savep'])) { $postdata = $this->mastermodel->get_post_values(); $res= $this->adminmodel->update_programme($postdata); redirect('admin/programme'); } $data['programs']=$this->mastermodel->get_data_srow('programme',$id,'programme_id'); $this->load->view('admin/update_programme',$data); } function update_training($id="") { $_SESSION['admin_page']='training'; if(isset($_POST['savep'])) { $postdata = $this->mastermodel->get_post_values(); $res= $this->adminmodel->update_training($postdata); redirect('admin/training'); } $data['programs']=$this->mastermodel->get_data_srow('training',$id,'training_id'); $this->load->view('admin/update_training',$data); } function update_coaching($id="") { $_SESSION['admin_page']='coaching'; if(isset($_POST['savep'])) { $postdata = $this->mastermodel->get_post_values(); $res= $this->adminmodel->update_coaching($postdata); redirect('admin/coaching'); } $data['programs']=$this->mastermodel->get_data_srow('coaching',$id,'coaching_id'); $this->load->view('admin/update_coaching',$data); } function update_gallery($id="") { $_SESSION['admin_page']='gallery'; if(isset($_POST['savep'])) { $postdata = $this->mastermodel->get_post_values(); $res= $this->adminmodel->update_gallery($postdata); redirect('admin/gallery'); } $data['gallery']=$this->mastermodel->get_data_srow('gallery',$id,'id'); $this->load->view('admin/update_gallery',$data); } function update_quote() { $_SESSION['admin_page']='quote'; $postdata = $this->mastermodel->get_post_values(); $this->adminmodel->update_quote($postdata); $data['quote']=$this->mastermodel->get_data_srow('quote','1','quote_id'); $this->load->view('admin/quote',$data); } function settings() { $_SESSION['admin_page']='settings'; $this->load->view('admin/settings'); } function update_password() { $_SESSION['admin_page']='settings'; $postdata = $this->mastermodel->get_post_values(); $this->adminmodel->update_password($postdata); $this->load->view('admin/settings'); } // function delete_testimonial($testid) // { // $_SESSION['admin_page']='testimonial'; // $doc = new DOMDocument(); // $doc->load(base_url().'/assets/js/testimonials.xml'); // $thedocument = $doc->documentElement; // $list = $thedocument->getElementsByTagName('quotes'); // $nodeToRemove = $testid; // foreach ($list as $domElement){ // $attrValue = $domElement->getAttribute('time'); // if ($attrValue == 'VALUEYOUCAREABOUT') { // $nodeToRemove = $domElement; //will only remember last one- but this is just an example :) // } // } // // //Now remove it. // if ($nodeToRemove != null) // $thedocument->removeChild($nodeToRemove); // // echo $doc->saveXML(); // // $doc = new DOMDocument(); // $doc->load(base_url().'/assets/js/testimonials.xml'); // $data['quotes'] = $doc->getElementsByTagName("quotes"); // $this->load->view('admin/testimonial',$data); // } public function logout() { session_destroy(); redirect('site/login'); } function deletegallery($field,$id) { $imgdet=$this->mastermodel->get_data_srow('gallery',$id,'id'); $this->mastermodel->deletedata('gallery',$field,$id); try { $res=$this->mastermodel->deletedata('gallery',$field,$id); if($res==1) { unlink('assets/images/gallery/normal/'.$imgdet->image.''); unlink('assets/images/gallery/thumbs/'.$imgdet->image.''); } else { throw new Exception("Error"); } redirect('admin/gallery'); } catch(Exception $exception) { redirect('admin/gallery'); } } function delete($table,$field,$id,$function) { $this->mastermodel->deletedata($table,$field,$id); try { $res=$this->mastermodel->deletedata($table,$field,$id); if($res!=1) { throw new Exception("Error"); } redirect('admin/'.$function); } catch(Exception $exception) { redirect('admin/'.$function); } } } ?>