186 lines
5.6 KiB
PHP
Executable File
186 lines
5.6 KiB
PHP
Executable File
<?php
|
|
|
|
if (!defined('BASEPATH'))
|
|
exit('No direct script access allowed');
|
|
|
|
class master_timeslot extends MX_Controller {
|
|
|
|
function __construct() {
|
|
parent::__construct();
|
|
|
|
|
|
}
|
|
|
|
public function index() {
|
|
|
|
$this->load->model('Test_model');
|
|
$data['sdata'] = $this->Test_model->name_list();
|
|
|
|
$this->load->view('home/dashboard'); // just the header file
|
|
|
|
$this->load->view('namelist',$data);
|
|
$this->load->view('home/master_assets');
|
|
$this->load->view('home/footer'); // just the header file
|
|
}
|
|
public function addnew()
|
|
{
|
|
$this->load->library('form_validation');
|
|
$this->form_validation->set_rules('slot_name', 'Slot Name', 'trim|required|min_length[2]|max_length[100]|xss_clean');
|
|
|
|
if ($this->form_validation->run() == FALSE) {
|
|
redirect("master_timeslot");
|
|
}
|
|
else{
|
|
$this->load->model('Test_model');
|
|
$this->Test_model->save_name($_POST);
|
|
$this->load->library('session');
|
|
$this->session->set_flashdata('added','The name is successfully updated');
|
|
redirect("master_timeslot");
|
|
}
|
|
}
|
|
public function deleteName()
|
|
{
|
|
$id = $_GET['id'];
|
|
|
|
$this->load->model('Test_model');
|
|
$this->Test_model->delete_name($id);
|
|
$this->load->library('session');
|
|
$this->session->set_flashdata('deleted','The name is successfully updated');
|
|
redirect("master_timeslot");
|
|
|
|
}
|
|
public function editName(){
|
|
|
|
//echo '<pre>';print_r($_POST);die;
|
|
if(isset($_POST) && $_POST['submit']=='editSlot'){
|
|
// echo 7;
|
|
$id = $_GET['id'];
|
|
|
|
$this->load->model('Test_model');
|
|
$this->Test_model->edit_name($_POST,$id);
|
|
$this->load->library('session');
|
|
$this->session->set_flashdata('edited','The name is successfully updated');
|
|
redirect("master_timeslot");
|
|
}
|
|
|
|
$rwid=$_GET['id'];
|
|
$data['id'] = $_GET['id'];
|
|
|
|
$this->load->model('Test_model');
|
|
$fldval = $this->Test_model->getWherevalue($rwid);
|
|
//echo '<pre>';print_r($fldval);die;
|
|
$data['value'] = $fldval->name;
|
|
$data['startTime'] = $fldval->startTime;
|
|
$data['endTime'] = $fldval->endTime;
|
|
|
|
$this->load->view('home/dashboard');
|
|
$this->load->view('home/master_assets');
|
|
// just the header file
|
|
$this->load->view('editname',$data);
|
|
$this->load->view('home/footer'); // just the header file
|
|
|
|
|
|
}
|
|
|
|
public function duplicateCheck()
|
|
{
|
|
$this->load->model('Test_model');
|
|
$res = $this->Test_model->duplicate_entry($_POST);
|
|
echo $res;
|
|
}
|
|
|
|
|
|
public function statusChange(){
|
|
$this->load->model('Test_model');
|
|
$res = $this->Test_model->status_change($_POST);
|
|
echo $res;
|
|
}
|
|
|
|
public function getList()
|
|
{
|
|
$this->load->model('Test_Model');
|
|
$requestData = $_REQUEST;
|
|
$start = $requestData['start'];
|
|
$limit = $requestData['length'];
|
|
|
|
$orderColumn=$requestData['order'][0]['column'];
|
|
$orderType=$requestData['order'][0]['dir'];
|
|
|
|
$search = $this->input->post('search')['value'];
|
|
|
|
|
|
if (!empty($search)) {
|
|
$data['name'] = $this->Test_Model->getNameByLimitBySearch($limit, $start, $search,$orderColumn, $orderType);
|
|
} else {
|
|
$data['name'] = $this->Test_Model->getNameByLimit($limit, $start, $orderColumn, $orderType);
|
|
}
|
|
|
|
$listCount = sizeof($data['name']);
|
|
|
|
|
|
|
|
|
|
foreach ($data['name'] as $data) {
|
|
|
|
static $slno = 1;
|
|
|
|
$statusChk = '';
|
|
if($data->status == "0"){
|
|
$statusChk = '';
|
|
}else{
|
|
$statusChk = 'checked';
|
|
}
|
|
|
|
|
|
$options1 = '<a class="btn btn-primary" title="' . lang('Edit') .'" href="master_timeslot/editName?id='. $data->id .'" ><i class="la la-edit"></i>' . lang('edit') .' </a>';
|
|
$options2 = '<a class="btn btn-danger" title="' . lang('delete') .'" href="master_timeslot/deleteName?id=' . $data->id .'" onclick="return validateConfirm()"><i class="la la-trash"></i> ' . lang('delete') .'</a>';
|
|
|
|
$switch = '<div class="material-switch ">
|
|
<input id="someSwitchOptionSuccess'.$slno.'" attrid="'.$data->id.'" class="switchValue" name="someSwitchOption001" value="'.$data->status.'" onclick="changeStatus(this)" type="checkbox" '.$statusChk.' />
|
|
|
|
<label for="someSwitchOptionSuccess'.$slno.'" class="label-success"></label>
|
|
</div>';
|
|
|
|
|
|
$info[] = array(
|
|
$slno,
|
|
$data->name,
|
|
$data->startTime,
|
|
$data->endTime,
|
|
$switch,
|
|
$options1 . ' ' . $options2
|
|
);
|
|
$slno++;
|
|
}
|
|
|
|
|
|
if ($listCount > 0) {
|
|
$output = array(
|
|
"draw" => intval($requestData['draw']),
|
|
"recordsTotal" => $listCount,
|
|
"recordsFiltered" => $listCount,
|
|
"data" => $info
|
|
);
|
|
}
|
|
else {
|
|
$output = array(
|
|
// "draw" => 1,
|
|
"recordsTotal" => 0,
|
|
"recordsFiltered" => 0,
|
|
"data" => []
|
|
);
|
|
}
|
|
|
|
|
|
echo json_encode($output);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
/* End of file accountant.php */
|
|
/* Location: ./application/modules/accountant/controllers/accountant.php */
|