|
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/modules/career/controllers/admin/ |
Upload File : |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Career extends Admin_Controller {
function __construct() {
parent::__construct();
$this->load->helper('form');
$this->load->library('upload');
}
public function landing_icon(){
echo "
<div class='col-xs-4 col-sm-3 col-md-2 col-lg-2 iconThumbnail'>
<p style='text-align:center;'>
<a href='".base_url('career/admin/career')."'>
<img src='".base_url('uploads/career/career-icon.jpg')."' width='60%' alt='Career' title='Career'>
</a><br>
Career
</p>
</div>
";
}
//this is to list all blog
public function index() {
if (isset($_POST['submit'])) {
//check & processing image banner upload files
if ($_FILES['userfile']['size'] !== 0) {
//get max image width and height from configuration table
$this->db->select('blog_image_width, blog_image_height')->from('configuration')->where('id_configuration', 1);
$image_dimension = $this->db->get()->row();
$gallery_banner['upload_path'] = './uploads/career/';
$gallery_banner['allowed_types'] = 'jpg|png';
$gallery_banner['max_size'] = '500';
$gallery_banner['max_width'] = $image_dimension->blog_image_width;
$gallery_banner['max_height'] = $image_dimension->blog_image_height;
$this->upload->initialize($gallery_banner);
if ( ! $this->upload->do_upload('userfile')) {
$this->session->set_flashdata('banner_error', '<br>
<p style="background:red; color:white; padding:5px; font-weight:bold;">'.strip_tags($this->upload->display_errors()).'</p>');
redirect('career/admin/career');
} else {
$image = $this->upload->data();
$image_filename = $image['file_name'];
$data = array(
'career_landingpage_image' => $image['file_name'],
);
$this->db->where('id_configuration', 1);
$this->db->update('configuration', $data);
}
}
$data = array(
'career_landingpage_title' => $this->security->xss_clean($this->input->post('career_landingpage_title'))
);
$this->db->where('id_configuration', 1);
$this->db->update('configuration', $data);
$this->session->set_flashdata('success', '<br><p style="background:green; color:white; padding:5px; font-weight:bold;">Career Landing Page Edit Successful</p>');
}
//get landingpage banner image, description and link
$this->db->select('career_landingpage_image, career_landingpage_title')->from('configuration')->where('id_configuration', 1);
$this->data['landingpage'] = $this->db->get()->row();
//get all career potition
$this->data['careers'] = $this->db->select('*')->from('career')->order_by('id','DESC')->get()->result();
//load view
$this->data['subview'] = 'admin/career';
$this->load->view('admin/templates/header', $this->data_header);
$this->load->view('admin/_layout_main', $this->data);
$this->load->view('admin/templates/footer');
}
public function add_career(){
/*cek same career title*/
$cek_career_title = $this->db->select('id')->from('career')->where('career_title',$this->security->xss_clean($this->input->post('career_title')))->get()->row();
if($cek_career_title != null){
$this->session->set_flashdata('success', '<br>
<p style="background:red; color:white; padding:5px; font-weight:bold;">Career Already Exist !</p>');
redirect('career/admin/career');
}
/*cek same career title*/
$data = array(
'career_title' => $this->security->xss_clean($this->input->post('career_title')),
'career_description' => $this->security->xss_clean($this->input->post('career_description'))
);
$this->db->insert('career',$data);
$this->session->set_flashdata('success', '<br>
<p style="background:green; color:white; padding:5px; font-weight:bold;">Add Career Successful !</p>');
redirect('career/admin/career');
}
public function edit_career($id = null){
if($id == null){show_404();}
/*cek same career title*/
$cek_career_title = $this->db->select('id')->from('career')->where('career_title',$this->security->xss_clean($this->input->post('career_title')))->where('id !=',$id)->get()->row();
if($cek_career_title != null){
$this->session->set_flashdata('success', '<br>
<p style="background:red; color:white; padding:5px; font-weight:bold;">Career Already Exist !</p>');
redirect('career/admin/career');
}
/*cek same career title*/
$data = array(
'career_title' => $this->security->xss_clean($this->input->post('career_title')),
'career_description' => $this->security->xss_clean($this->input->post('career_description'))
);
$this->db->where('id',$id);
$this->db->update('career',$data);
$this->session->set_flashdata('success', '<br>
<p style="background:green; color:white; padding:5px; font-weight:bold;">Update Career Successful !</p>');
redirect('career/admin/career');
}
public function delete_career($id = null){
if($id == null){show_404();}
$this->db->where('id',$id);
$this->db->delete('career');
$this->session->set_flashdata('success', '<br>
<p style="background:green; color:white; padding:5px; font-weight:bold;">Delete Career Successful !</p>');
redirect('career/admin/career');
}
public function candidate(){
//get landingpage banner image, description and link
$this->db->select('career_landingpage_image, career_landingpage_title')->from('configuration')->where('id_configuration', 1);
$this->data['landingpage'] = $this->db->get()->row();
//get all candidate
$this->data['candidats'] = $this->db->select('*')->from('career_candidate')->order_by('id','DESC')->get()->result();
//load view
$this->data['subview'] = 'admin/candidate';
$this->load->view('admin/templates/header', $this->data_header);
$this->load->view('admin/_layout_main', $this->data);
$this->load->view('admin/templates/footer');
}
}