Moved to PHP folder
This commit is contained in:
96
php/application/controllers/admin/Admin.php
Normal file
96
php/application/controllers/admin/Admin.php
Normal file
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Admin extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->library('session');
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
$this->load->library('form_validation');
|
||||
$this->load->library('userauth');
|
||||
$this->load->library('password');
|
||||
$this->load->model('Admin_model');
|
||||
$this->load->helper('cookie');
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->load->view('admin/login');
|
||||
}
|
||||
|
||||
public function dashboard()
|
||||
{
|
||||
$this->userauth->logged_in();
|
||||
$data['class'] = $this->Admin_model->totalrows('tbl_classname','*');
|
||||
$data['creates'] = $this->Admin_model->totalrows('tbl_classform','*');
|
||||
$data['users'] = $this->Admin_model->totalrows('tbl_usermaster','*');
|
||||
$data['list'] = $this->Admin_model->totalrows('tbl_regmaster','*');
|
||||
$this->load->view('admin/dashboard',$data);
|
||||
}
|
||||
|
||||
public function login()
|
||||
{
|
||||
|
||||
$data['username'] = get_cookie('swebin_user_ad');
|
||||
$data['password'] = $this->password->decrypt_password(get_cookie('swebin_sec'));
|
||||
|
||||
$this->form_validation->set_rules('username', 'username', 'trim|required');
|
||||
$this->form_validation->set_rules('password', 'password', 'trim|required');
|
||||
|
||||
if ($this->form_validation->run() == FALSE)
|
||||
{
|
||||
$this->load->view('admin/login',$data);
|
||||
}
|
||||
else
|
||||
{
|
||||
$username = $this->input->post('username');
|
||||
$password_input = $this->input->post('password');
|
||||
$remember_me = $this->input->post('remember_me');
|
||||
$password = $this->password->encrypt_password($password_input);
|
||||
|
||||
if($remember_me)
|
||||
{
|
||||
$expire = time()+365*60*60*24;
|
||||
|
||||
set_cookie('abc_user',$username, $expire);
|
||||
set_cookie('abc_password',$password, $expire);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete_cookie('abc_user');
|
||||
delete_cookie('abc_password');
|
||||
}
|
||||
|
||||
|
||||
$data = $this->Admin_model->login_valid($username,$password);
|
||||
|
||||
if($data)
|
||||
{
|
||||
$this->session->set_userdata('user_id',$data['user_id']);
|
||||
$this->session->set_userdata('user_name',$data['user_name']);
|
||||
$this->session->set_userdata('user_type',$data['user_type']);
|
||||
|
||||
redirect('admin/dashboard');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set_flashdata('login_failed', 'Error Occur. Login Failed..!');
|
||||
$this->load->view('admin/login',$data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
$this->session->sess_destroy();
|
||||
redirect('admin', 'refresh');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
258
php/application/controllers/admin/Classsetting.php
Normal file
258
php/application/controllers/admin/Classsetting.php
Normal file
@ -0,0 +1,258 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Classsetting extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
$this->load->library('form_validation');
|
||||
$this->load->library('userauth');
|
||||
$this->load->library('password');
|
||||
$this->load->model('Class_model');
|
||||
}
|
||||
|
||||
public function cl_name()
|
||||
{
|
||||
$this->userauth->logged_in();
|
||||
$data['all_class']=$this->Class_model->all_class();
|
||||
$this->load->view('admin/classsetting-names',$data);
|
||||
}
|
||||
|
||||
public function cl_locations()
|
||||
{
|
||||
$this->userauth->logged_in();
|
||||
$data['all_locations']=$this->Class_model->all_locations();
|
||||
$this->load->view('admin/classsetting-location',$data);
|
||||
}
|
||||
|
||||
public function cl_instructors()
|
||||
{
|
||||
$this->userauth->logged_in();
|
||||
$data['all_instructors']=$this->Class_model->all_instructors();
|
||||
$this->load->view('admin/classsetting-instructor',$data);
|
||||
}
|
||||
|
||||
//CLASS
|
||||
|
||||
//manage class
|
||||
|
||||
public function manage_class()
|
||||
{
|
||||
$class_name = array('class_name'=>$this->input->post('class_name'));
|
||||
$action = $this->input->post('submit');
|
||||
if($action == "Add")
|
||||
{
|
||||
$data = $this->Class_model->create_class($class_name);
|
||||
if($data)
|
||||
{
|
||||
$this->session->set_flashdata('success_msg','Class Created Successfully');
|
||||
redirect('admin/class-name');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set_flashdata('error_msg','Error Occur');
|
||||
redirect('admin/class-name');
|
||||
}
|
||||
}
|
||||
elseif($action == "Update")
|
||||
{
|
||||
$class_id = $this->input->post('class_id');
|
||||
$data = $this->Class_model->update_class($class_name,$class_id);
|
||||
if($data)
|
||||
{
|
||||
$this->session->set_flashdata('success_msg','Class Updated Successfully');
|
||||
redirect('admin/class-name');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set_flashdata('error_msg','Error Occur');
|
||||
redirect('admin/class-name');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//end manage class
|
||||
|
||||
//return class
|
||||
|
||||
public function return_class($class_id)
|
||||
{
|
||||
$this->userauth->logged_in();
|
||||
$return_class = $this->Class_model->return_class($class_id);
|
||||
$data['class_id']=$return_class->class_id;
|
||||
$data['class_name']=$return_class->class_name;
|
||||
$data['all_class']=$this->Class_model->all_class();
|
||||
$this->load->view('admin/classsetting-names',$data);
|
||||
}
|
||||
|
||||
//end return class
|
||||
|
||||
//delete class
|
||||
|
||||
function delete_class($class_id)
|
||||
{
|
||||
$delete_class = $this->Class_model->delete_class($class_id);
|
||||
if($delete_class)
|
||||
{
|
||||
$this->session->set_flashdata('success_msg','Class Deleted Successfully');
|
||||
redirect('admin/class-name');
|
||||
} else {
|
||||
$this->session->set_flashdata('error_msg','Error Occur');
|
||||
redirect('admin/class-name');
|
||||
}
|
||||
}
|
||||
|
||||
//end delete class
|
||||
|
||||
|
||||
//LOCATION
|
||||
|
||||
//manage location
|
||||
|
||||
public function manage_location()
|
||||
{
|
||||
$location_name = array('locat_name'=>$this->input->post('locat_name'));
|
||||
$action = $this->input->post('submit');
|
||||
if($action == "Add")
|
||||
{
|
||||
$data = $this->Class_model->create_location($location_name);
|
||||
if($data)
|
||||
{
|
||||
$this->session->set_flashdata('success_msg','Location Created Successfully');
|
||||
redirect('admin/class-locations');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set_flashdata('error_msg','Error Occur');
|
||||
redirect('admin/class-locations');
|
||||
}
|
||||
}
|
||||
elseif($action == "Update")
|
||||
{
|
||||
$locat_id = $this->input->post('locat_id');
|
||||
$data = $this->Class_model->update_location($location_name,$locat_id);
|
||||
if($data)
|
||||
{
|
||||
$this->session->set_flashdata('success_msg','Location Updated Successfully');
|
||||
redirect('admin/class-locations');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set_flashdata('error_msg','Error Occur');
|
||||
redirect('admin/class-locations');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//end location class
|
||||
|
||||
//return location
|
||||
|
||||
public function return_location($locat_id)
|
||||
{
|
||||
$this->userauth->logged_in();
|
||||
$return_location = $this->Class_model->return_location($locat_id);
|
||||
$data['locat_id']=$return_location->locat_id;
|
||||
$data['locat_name']=$return_location->locat_name;
|
||||
$data['all_locations']=$this->Class_model->all_locations();
|
||||
$this->load->view('admin/classsetting-location',$data);
|
||||
}
|
||||
|
||||
//end return location
|
||||
|
||||
//delete location
|
||||
|
||||
function delete_location($locat_id)
|
||||
{
|
||||
$delete_location = $this->Class_model->delete_location($locat_id);
|
||||
if($delete_location)
|
||||
{
|
||||
$this->session->set_flashdata('success_msg','Location Deleted Successfully');
|
||||
redirect('admin/class-locations');
|
||||
} else {
|
||||
$this->session->set_flashdata('error_msg','Error Occur');
|
||||
redirect('admin/class-locations');
|
||||
}
|
||||
}
|
||||
|
||||
//end delete location
|
||||
|
||||
//INSTRUCTORS
|
||||
|
||||
//manage Instructors
|
||||
|
||||
public function manage_instructor()
|
||||
{
|
||||
$instructor_name = array('instr_name'=>$this->input->post('instr_name'));
|
||||
$action = $this->input->post('submit');
|
||||
if($action == "Add")
|
||||
{
|
||||
$data = $this->Class_model->create_instructors($instructor_name);
|
||||
if($data)
|
||||
{
|
||||
$this->session->set_flashdata('success_msg','Instructor Added Successfully');
|
||||
redirect('admin/class-instructors');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set_flashdata('error_msg','Error Occur');
|
||||
redirect('admin/class-instructors');
|
||||
}
|
||||
}
|
||||
elseif($action == "Update")
|
||||
{
|
||||
$instr_id = $this->input->post('instr_id');
|
||||
$data = $this->Class_model->update_instructors($instructor_name,$instr_id);
|
||||
if($data)
|
||||
{
|
||||
$this->session->set_flashdata('success_msg','Instructors Updated Successfully');
|
||||
redirect('admin/class-instructors');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set_flashdata('error_msg','Error Occur');
|
||||
redirect('admin/class-instructors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//end manage instructors
|
||||
|
||||
//return instructors
|
||||
|
||||
public function return_instructors($instr_id)
|
||||
{
|
||||
$this->userauth->logged_in();
|
||||
$return_instructors = $this->Class_model->return_instructors($instr_id);
|
||||
$data['instr_id']=$return_instructors->instr_id;
|
||||
$data['instr_name']=$return_instructors->instr_name;
|
||||
$data['all_instructors']=$this->Class_model->all_instructors();
|
||||
$this->load->view('admin/classsetting-instructor',$data);
|
||||
}
|
||||
|
||||
//end return instructors
|
||||
|
||||
//delete instructors
|
||||
|
||||
function delete_instructors($instr_id)
|
||||
{
|
||||
$delete_instructors = $this->Class_model->delete_instructors($instr_id);
|
||||
if($delete_instructors)
|
||||
{
|
||||
$this->session->set_flashdata('success_msg','Instructor Deleted Successfully');
|
||||
redirect('admin/class-instructors');
|
||||
} else {
|
||||
$this->session->set_flashdata('error_msg','Error Occur');
|
||||
redirect('admin/class-instructors');
|
||||
}
|
||||
}
|
||||
|
||||
//end delete instructors
|
||||
|
||||
}
|
||||
|
||||
?>
|
222
php/application/controllers/admin/Createclass.php
Normal file
222
php/application/controllers/admin/Createclass.php
Normal file
@ -0,0 +1,222 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Createclass extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
$this->load->library('form_validation');
|
||||
$this->load->model('Create_model');
|
||||
$this->load->library('userauth');
|
||||
}
|
||||
|
||||
public function cl_create()
|
||||
{
|
||||
$this->userauth->logged_in();
|
||||
$data['class_name']=$this->Create_model->getData('tbl_classname');
|
||||
$data['class_instructor']=$this->Create_model->getData('tbl_instructors');
|
||||
$data['class_location']=$this->Create_model->getData('tbl_classlocations');
|
||||
$data['all_class']=$this->Create_model->getAll();
|
||||
$this->load->view('admin/class-create',$data);
|
||||
}
|
||||
|
||||
public function manage_create()
|
||||
{
|
||||
$action = $this->input->post('submit');
|
||||
|
||||
$form_data = array('class_id'=>$this->input->post('class_id'),
|
||||
'class_seats'=>$this->input->post('class_seats'),
|
||||
'remain_seats'=>$this->input->post('class_seats'),
|
||||
'instr_id'=>$this->input->post('instr_id'),
|
||||
'class_hours'=>$this->input->post('class_hours'),
|
||||
'class_registrants'=>implode(",",$this->input->post('class_registrants')),
|
||||
'class_price_m'=>$this->input->post('class_price_m'),
|
||||
'class_price_m2'=>$this->input->post('class_price_m2'),
|
||||
'class_price_n'=>$this->input->post('class_price_n'),
|
||||
'class_price_n2'=>$this->input->post('class_price_n2'),
|
||||
'class_price_s'=>$this->input->post('class_price_s'),
|
||||
'class_day'=>implode(',', (array) $this->input->post('class_day')),
|
||||
'calss_start_date'=>date("y-m-d",strtotime($this->input->post('calss_start_date'))),
|
||||
'calss_end_date'=>date("y-m-d",strtotime($this->input->post('calss_end_date'))),
|
||||
'calss_start_time'=>date('H:i:s',strtotime($this->input->post('calss_start_time'))),
|
||||
'calss_end_time'=>date('H:i:s',strtotime($this->input->post('calss_end_time'))),
|
||||
'locat_id'=>$this->input->post('locat_id'),
|
||||
'class_room'=>$this->input->post('class_room'),
|
||||
'class_address'=>$this->input->post('class_address'),
|
||||
'class_city'=>$this->input->post('class_city'),
|
||||
'class_state'=>$this->input->post('class_state'),
|
||||
'class_code'=>$this->input->post('class_code'),
|
||||
'class_phone'=>$this->input->post('class_phone'),
|
||||
'class_description'=>$this->input->post('class_description'));
|
||||
|
||||
if($action == "Add")
|
||||
{
|
||||
$data = $this->Create_model->insertRow('tbl_classform',$form_data);
|
||||
if($data)
|
||||
{
|
||||
$this->session->set_flashdata('success_msg','Class Added Successfully');
|
||||
redirect('admin/create-class');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set_flashdata('error_msg','Error Occur');
|
||||
redirect('admin/create-class');
|
||||
}
|
||||
}
|
||||
elseif($action == "Update")
|
||||
{
|
||||
$form_id = $this->input->post('form_id');
|
||||
$data = $this->Create_model->updateRow('tbl_classform','form_id',$form_id,$form_data);
|
||||
if($data)
|
||||
{
|
||||
$this->session->set_flashdata('success_msg','Class Updated Successfully');
|
||||
redirect('admin/create-class');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set_flashdata('error_msg','Error Occur');
|
||||
redirect('admin/create-class');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*Return form*/
|
||||
|
||||
public function return_form($form_id)
|
||||
{
|
||||
$this->userauth->logged_in();
|
||||
$return_form = $this->Create_model->returnForm($form_id);
|
||||
$data['form_id']=$return_form->form_id;
|
||||
$data['class_name']=$return_form->class_name;
|
||||
$data['class_id']=$return_form->class_id;
|
||||
|
||||
$data['class_seats']=$return_form->class_seats;
|
||||
$data['instr_name']=$return_form->instr_name;
|
||||
$data['instr_id']=$return_form->instr_id;
|
||||
|
||||
$data['class_hours']=$return_form->class_hours;
|
||||
$data['class_registrants']=explode(",",$return_form->class_registrants);
|
||||
$data['class_price_m']=$return_form->class_price_m;
|
||||
$data['class_price_m2']=$return_form->class_price_m2;
|
||||
$data['class_price_n']=$return_form->class_price_n;
|
||||
$data['class_price_n2']=$return_form->class_price_n2;
|
||||
$data['class_price_s']=$return_form->class_price_s;
|
||||
$data['class_day']=explode(",",$return_form->class_day);
|
||||
|
||||
$data['calss_start_date']=date("d-m-Y",strtotime($return_form->calss_start_date));
|
||||
$data['calss_end_date']=date("d-m-Y",strtotime($return_form->calss_end_date));
|
||||
|
||||
$data['calss_start_time'] = date('h:i A',strtotime($return_form->calss_start_time));
|
||||
$data['calss_end_time'] = date('h:i A',strtotime($return_form->calss_end_time));
|
||||
|
||||
$data['locat_id']=$return_form->locat_id;
|
||||
$data['locat_name']=$return_form->locat_name;
|
||||
|
||||
$data['class_room']=$return_form->class_room;
|
||||
$data['class_address']=$return_form->class_address;
|
||||
$data['class_city']=$return_form->class_city;
|
||||
$data['class_state']=$return_form->class_state;
|
||||
$data['class_code']=$return_form->class_code;
|
||||
$data['class_phone']=$return_form->class_phone;
|
||||
$data['class_description']=$return_form->class_description;
|
||||
|
||||
$data['class_name']=$this->Create_model->getData('tbl_classname');
|
||||
$data['class_instructor']=$this->Create_model->getData('tbl_instructors');
|
||||
$data['class_location']=$this->Create_model->getData('tbl_classlocations');
|
||||
$data['all_class']=$this->Create_model->getAll();
|
||||
$this->load->view('admin/class-create',$data);
|
||||
}
|
||||
|
||||
/*Delete Form*/
|
||||
|
||||
function delete_form($form_id="")
|
||||
{
|
||||
if($form_id!="")
|
||||
{
|
||||
$delete_class = $this->Create_model->deleteForm('tbl_classform','form_id',$form_id); /*Delete Class By ID*/
|
||||
if($delete_class)
|
||||
{
|
||||
$this->session->set_flashdata('success_msg','Class Deleted Successfully');
|
||||
redirect('admin/create-class');
|
||||
} else {
|
||||
$this->session->set_flashdata('error_msg','Error Occur');
|
||||
redirect('admin/create-class');
|
||||
}
|
||||
}
|
||||
elseif(!empty($this->input->post('check_id')))
|
||||
{
|
||||
$action = $this->input->post('action');
|
||||
$check_id = array();
|
||||
$check_id = $this->input->post('check_id');
|
||||
|
||||
if($action=='delete') /*Delete Multiple Classes*/
|
||||
{
|
||||
foreach ($check_id as $key => $value)
|
||||
{
|
||||
$delete_class = $this->Create_model->deleteForm('tbl_classform','form_id',$value);
|
||||
}
|
||||
if($delete_class)
|
||||
{
|
||||
$this->session->set_flashdata('success_msg','Records Deleted Successfully');
|
||||
redirect('admin/create-class');
|
||||
} else {
|
||||
$this->session->set_flashdata('error_msg','Error Occur');
|
||||
redirect('admin/create-class');
|
||||
}
|
||||
}
|
||||
elseif ($action=='duplicate') /*Duplicate Class*/
|
||||
{
|
||||
foreach ($check_id as $key => $value)
|
||||
{
|
||||
$duplicate_class = $this->Create_model->returnForm($value);
|
||||
$form_data = array('class_id'=>$duplicate_class->class_id,
|
||||
'class_seats'=>$duplicate_class->class_seats,
|
||||
'remain_seats'=>$duplicate_class->class_seats,
|
||||
'instr_id'=>$duplicate_class->instr_id,
|
||||
'class_hours'=>$duplicate_class->class_hours,
|
||||
'class_registrants'=>$duplicate_class->class_registrants,
|
||||
'class_price_m'=>$duplicate_class->class_price_m,
|
||||
'class_price_m2'=>$duplicate_class->class_price_m2,
|
||||
'class_price_n'=>$duplicate_class->class_price_n,
|
||||
'class_price_n2'=>$duplicate_class->class_price_n2,
|
||||
'class_price_s'=>$duplicate_class->class_price_s,
|
||||
'class_day'=>$duplicate_class->class_day,
|
||||
'calss_start_date'=>$duplicate_class->calss_start_date,
|
||||
'calss_end_date'=>$duplicate_class->calss_end_date,
|
||||
'calss_start_time'=>$duplicate_class->calss_start_time,
|
||||
'calss_end_time'=>$duplicate_class->calss_end_time,
|
||||
'locat_id'=>$duplicate_class->locat_id,
|
||||
'class_room'=>$duplicate_class->class_room,
|
||||
'class_address'=>$duplicate_class->class_address,
|
||||
'class_city'=>$duplicate_class->class_city,
|
||||
'class_state'=>$duplicate_class->class_state,
|
||||
'class_code'=>$duplicate_class->class_code,
|
||||
'class_phone'=>$duplicate_class->class_phone,
|
||||
'class_description'=>$duplicate_class->class_description);
|
||||
$data = $this->Create_model->insertRow('tbl_classform',$form_data);
|
||||
}
|
||||
if ($data)
|
||||
{
|
||||
$this->session->set_flashdata('success_msg','Duplicated Successfully');
|
||||
redirect('admin/create-class');
|
||||
} else {
|
||||
$this->session->set_flashdata('error_msg','Error Occur');
|
||||
redirect('admin/create-class');
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set_flashdata('error_msg','Select Records First.');
|
||||
redirect('admin/create-class');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
59
php/application/controllers/admin/Order_list.php
Normal file
59
php/application/controllers/admin/Order_list.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Order_list extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
$this->load->library('form_validation');
|
||||
$this->load->library('password');
|
||||
$this->load->model('Orderlist_model');
|
||||
// $this->load->view('review-order');
|
||||
}
|
||||
|
||||
public function list_order()
|
||||
{
|
||||
|
||||
|
||||
$data['all_order']=$this->Orderlist_model->get_order();
|
||||
$this->load->view('admin/order-list',$data);
|
||||
}
|
||||
|
||||
|
||||
public function review_orderList($reg_id)
|
||||
{
|
||||
|
||||
|
||||
$data['order']=$this->Orderlist_model->review_order($reg_id);
|
||||
$data['return_class']=$this->Orderlist_model->return_class($reg_id);
|
||||
$data['registrants']=$this->Orderlist_model->return_attendee($reg_id);
|
||||
$this->load->view('front/review',$data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function delet_list($reg_name)
|
||||
{
|
||||
|
||||
$delete_list = $this->Orderlist_model->delet_list($reg_name);
|
||||
if($delete_list)
|
||||
{
|
||||
$this->session->set_flashdata('success_msg','User Deleted Successfully');
|
||||
$data['all_order']=$this->Orderlist_model->get_order();
|
||||
$this->load->view('admin/order-list',$data);
|
||||
} else {
|
||||
$this->session->set_flashdata('error_msg','Error Occur');
|
||||
$data['all_order']=$this->Orderlist_model->get_order();
|
||||
$this->load->view('admin/order-list',$data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
140
php/application/controllers/admin/Orderlist.php
Normal file
140
php/application/controllers/admin/Orderlist.php
Normal file
@ -0,0 +1,140 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Orderlist extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
$this->load->library("pagination");
|
||||
$this->load->model('Orderlist_model');
|
||||
$this->load->library('userauth');
|
||||
}
|
||||
|
||||
public function list_order()
|
||||
{
|
||||
$this->userauth->logged_in();
|
||||
$config = array();
|
||||
$config["base_url"] = base_url() . "admin/order-list";
|
||||
$total_row = $this->Orderlist_model->record_count();
|
||||
$config["total_rows"] = $total_row;
|
||||
$config["per_page"] = 20;
|
||||
$config['use_page_numbers'] = TRUE;
|
||||
$config['num_links'] = $total_row;
|
||||
$config['cur_tag_open'] = '<a class="current">';
|
||||
$config['cur_tag_close'] = '</a>';
|
||||
$config['next_link'] = '»';
|
||||
$config['prev_link'] = '«';
|
||||
|
||||
$this->pagination->initialize($config);
|
||||
if($this->uri->segment(3)){
|
||||
$page = ($this->uri->segment(3)) ;
|
||||
}
|
||||
else{
|
||||
$page = 0;
|
||||
}
|
||||
$data["all_order"] = $this->Orderlist_model->get_order($config["per_page"], $page);
|
||||
|
||||
$str_links = $this->pagination->create_links();
|
||||
$data["links"] = explode(' ',$str_links );
|
||||
$this->load->view('admin/order-list',$data);
|
||||
}
|
||||
|
||||
public function order_search()
|
||||
{
|
||||
$orderno = $this->input->post('orderno');
|
||||
$fromedate = date("Y-m-d",strtotime($this->input->post('fromedate')));
|
||||
$todate = date("Y-m-d",strtotime($this->input->post('todate')));
|
||||
$data['all_order'] = $this->Orderlist_model->ordersearch($orderno,$fromedate,$todate);
|
||||
if($data['all_order']==array())
|
||||
{
|
||||
$this->session->set_flashdata('error_msg','No Order For The Given Data.');
|
||||
redirect('admin/order-list');
|
||||
}
|
||||
$str_links = $this->pagination->create_links();
|
||||
$data["links"] = explode(' ',$str_links );
|
||||
$this->load->view('admin/order-list',$data);
|
||||
}
|
||||
|
||||
public function review_orderList($reg_id,$type)
|
||||
{
|
||||
$this->userauth->logged_in();
|
||||
$master = $this->Orderlist_model->review_order($reg_id);
|
||||
$data['return_class']=$this->Orderlist_model->return_class($reg_id);
|
||||
$data['member']=$this->Orderlist_model->returnAttende('tbl_attendee','reg_id','reg_m_type',$reg_id,'M');
|
||||
$data['member2']=$this->Orderlist_model->returnAttende('tbl_attendee','reg_id','reg_m_type',$reg_id,'M2');
|
||||
$data['nonmember']=$this->Orderlist_model->returnAttende('tbl_attendee','reg_id','reg_m_type',$reg_id,'N');
|
||||
$data['nonmember2']=$this->Orderlist_model->returnAttende('tbl_attendee','reg_id','reg_m_type',$reg_id,'N2');
|
||||
$data['semember']=$this->Orderlist_model->returnAttende('tbl_attendee','reg_id','reg_m_type',$reg_id,'S');
|
||||
$data['mcount'] = count($data['member']);
|
||||
$data['mcount2'] = count($data['member2']);
|
||||
$data['ncount'] = count($data['nonmember']);
|
||||
$data['ncount2'] = count($data['nonmember2']);
|
||||
$data['scount'] = count($data['semember']);
|
||||
|
||||
$data['reg_date'] = date("d-m-Y",strtotime($master->reg_date));
|
||||
$data['card_holder_name'] = $master->card_holder_name;
|
||||
$data['payment_type'] = $master->payment_type;
|
||||
$data['address'] = $master->street_adrs;
|
||||
$data['phone_no'] = $master->phone_no;
|
||||
$data['email_id'] = $master->email_id;
|
||||
$data['class_count'] = $master->reg_class_count;
|
||||
$data['att_count'] = $master->att_total_count;
|
||||
$data['card_number'] = $master->card_number;
|
||||
$data['card_type'] = $master->card_type;
|
||||
$data['status'] = $master->status;
|
||||
|
||||
|
||||
|
||||
$data['reg_total'] = $master->reg_total;
|
||||
$data['orderno'] = $master->reg_id;
|
||||
|
||||
|
||||
$data['type'] = $type;
|
||||
$this->load->view('admin/view-order',$data);
|
||||
}
|
||||
|
||||
public function delete_list($reg_id)
|
||||
{
|
||||
$delete_list = $this->Orderlist_model->delete_list($reg_id);
|
||||
if($delete_list)
|
||||
{
|
||||
$this->session->set_flashdata('success_msg','Order Deleted Successfully');
|
||||
redirect('admin/order-list');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set_flashdata('error_msg','Error Occur');
|
||||
redirect('admin/order-list');
|
||||
}
|
||||
}
|
||||
|
||||
function update_status($reg_id)
|
||||
{
|
||||
$return_reg = $this->Orderlist_model->return_reg($reg_id);
|
||||
if($return_reg->status == "unpaid")
|
||||
{
|
||||
$update = $this->Orderlist_model->update_status("paid",$reg_id);
|
||||
if($update)
|
||||
{
|
||||
$this->session->set_flashdata('success_msg','Updated Successfully');
|
||||
redirect('admin/order-list');
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->session->set_flashdata('error_msg','Error Occur');
|
||||
redirect('admin/order-list');
|
||||
}
|
||||
}else
|
||||
{
|
||||
$this->session->set_flashdata('error_msg','Already Paid');
|
||||
redirect('admin/order-list');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
154
php/application/controllers/admin/User.php
Normal file
154
php/application/controllers/admin/User.php
Normal file
@ -0,0 +1,154 @@
|
||||
<?php
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class User extends CI_Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->helper('url');
|
||||
$this->load->helper('form');
|
||||
$this->load->library('form_validation');
|
||||
$this->load->library('password');
|
||||
$this->load->model('User_model');
|
||||
$this->load->library('userauth');
|
||||
}
|
||||
|
||||
public function admin_user()
|
||||
{
|
||||
$this->userauth->logged_admin();
|
||||
$data['all_users']=$this->User_model->get_user();
|
||||
$this->load->view('admin/admin-users',$data);
|
||||
}
|
||||
|
||||
//add user
|
||||
public function add_user()
|
||||
{
|
||||
$password = $this->password->encrypt_password($this->input->post('user_password'));
|
||||
$user_id = $this->input->post('user_id');
|
||||
$user= array('user_name'=>$this->input->post('user_name'),
|
||||
'user_password'=>$password);
|
||||
$action = $this->input->post('submit');
|
||||
$check_user=$this->User_model->check_user($user['user_name']);
|
||||
|
||||
if($action == "Add")
|
||||
{
|
||||
if($check_user)
|
||||
{
|
||||
$user_data =$this->User_model->add_user($user);
|
||||
if($user_data)
|
||||
{
|
||||
$this->session->set_flashdata('success_msg','User Added Successfully');
|
||||
redirect('admin/admin-user');
|
||||
} else {
|
||||
$this->session->set_flashdata('error_msg','Error Occur');
|
||||
redirect('admin/admin-user');
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->session->set_flashdata('error_msg', 'User Already Exists.');
|
||||
redirect('admin/admin-user');
|
||||
}
|
||||
}
|
||||
if($action == "Update")
|
||||
{
|
||||
$return_user = $this->User_model->return_user($user_id);
|
||||
if($check_user)
|
||||
{
|
||||
$name = $this->input->post('user_name');
|
||||
$msg_type = "success_msg";
|
||||
$msg = "User Updated Successfully.";
|
||||
}
|
||||
else
|
||||
{
|
||||
$name = $return_user->user_name;
|
||||
if($this->input->post('user_name') == $return_user->user_name)
|
||||
{
|
||||
$msg_type = "success_msg";
|
||||
$msg = "User Updated Successfully.";
|
||||
}
|
||||
else
|
||||
{
|
||||
$msg_type = "error_msg";
|
||||
$msg = "User Already Exists.";
|
||||
}
|
||||
|
||||
}
|
||||
$update_data= array('user_name'=>$name,
|
||||
'user_password'=>$password);
|
||||
$user_update = $this->User_model->update_user($update_data,$user_id);
|
||||
if($user_update)
|
||||
{
|
||||
$this->session->set_flashdata($msg_type,$msg);
|
||||
redirect('admin/admin-user');
|
||||
} else {
|
||||
$this->session->set_flashdata('error_msg','Error Occur');
|
||||
redirect('admin/admin-user');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//end add user
|
||||
|
||||
//return user
|
||||
|
||||
public function return_user($user_id)
|
||||
{
|
||||
$this->userauth->logged_admin();
|
||||
$return_user = $this->User_model->return_user($user_id);
|
||||
$data['user_id']=$return_user->user_id;
|
||||
$data['user_name']=$return_user->user_name;
|
||||
$data['user_password'] = $this->password->decrypt_password($return_user->user_password);
|
||||
$data['all_users']=$this->User_model->get_user();
|
||||
$this->load->view('admin/admin-users',$data);
|
||||
}
|
||||
|
||||
//end return user
|
||||
|
||||
//delete user
|
||||
|
||||
function delete_user($user_id)
|
||||
{
|
||||
$delete_user = $this->User_model->delete_user($user_id);
|
||||
if($delete_user)
|
||||
{
|
||||
$this->session->set_flashdata('success_msg','User Deleted Successfully');
|
||||
redirect('admin/admin-user');
|
||||
} else {
|
||||
$this->session->set_flashdata('error_msg','Error Occur');
|
||||
redirect('admin/admin-user');
|
||||
}
|
||||
}
|
||||
|
||||
//end delete user
|
||||
|
||||
//update status
|
||||
|
||||
function update_status($user_id)
|
||||
{
|
||||
$return_user = $this->User_model->return_user($user_id);
|
||||
$data['user_id']=$return_user->user_id;
|
||||
$data['user_status']=$return_user->user_status;
|
||||
if($return_user->user_type !="admin")
|
||||
{
|
||||
if($data['user_status']=="active")
|
||||
{
|
||||
$status ="inactive";
|
||||
}
|
||||
elseif($data['user_status']=="inactive")
|
||||
{
|
||||
$status ="active";
|
||||
}
|
||||
$data['user_id']=$user_id;
|
||||
$this->User_model->update_status($status,$user_id);
|
||||
}
|
||||
else { $this->session->set_flashdata('error_msg',"Admin Can't Be Inactive."); }
|
||||
redirect('admin/admin-user');
|
||||
}
|
||||
|
||||
//end update status
|
||||
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user