181 lines
5.8 KiB
PHP
Executable File
181 lines
5.8 KiB
PHP
Executable File
<?php
|
|
|
|
if (!defined('BASEPATH'))
|
|
exit('No direct script access allowed');
|
|
|
|
class master_schedule 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->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_schedule");
|
|
|
|
}
|
|
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_schedule");
|
|
|
|
}
|
|
public function editName(){
|
|
|
|
// var_dump($_POST);
|
|
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_schedule");
|
|
}
|
|
|
|
$rwid=$_GET['id'];
|
|
$data['id'] = $_GET['id'];
|
|
|
|
$this->load->model('Test_model');
|
|
$fldval = $this->Test_model->getWherevalue($rwid);
|
|
|
|
$data['datas'] = $fldval[0];
|
|
|
|
$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'];
|
|
$search = $this->input->post('search')['value'];
|
|
|
|
if ($limit == -1) {
|
|
if (!empty($search)) {
|
|
$data['name'] = $this->Test_model->getNameBysearch($search);
|
|
} else {
|
|
$data['name'] = $this->Test_model->name_list();
|
|
}
|
|
} else {
|
|
if (!empty($search)) {
|
|
$data['name'] = $this->Test_model->getNameByLimitBySearch($limit, $start, $search);
|
|
} else {
|
|
$data['name'] = $this->Test_model->getNameByLimit($limit, $start);
|
|
}
|
|
}
|
|
// var_dump($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_schedule/editName?id='. $data->id .'" ><i class="la la-edit"></i>' . lang('edit') .' </a>';
|
|
|
|
$options2 = '<a class="btn btn-danger" title="' . lang('delete') .'" href="master_schedule/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.'" '.($data->status == '0')?'':'checked'.' onclick="$(this).attr("value", this.checked ? 1 : 0)" type="checkbox"/>
|
|
// <label for="someSwitchOptionSuccess'.$slno.'" class="label-success"></label>
|
|
// </div>';
|
|
$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->week_day,
|
|
$data->from_time,
|
|
$data->to_time,
|
|
$switch,
|
|
$options1 . ' ' . $options2
|
|
);
|
|
$slno++;
|
|
}
|
|
|
|
// if (siz$data['name']) {
|
|
$output = array(
|
|
"draw" => intval($requestData['draw']),
|
|
"recordsTotal" => count($this->Test_model->name_list()),
|
|
"recordsFiltered" => count($this->Test_model->name_list()),
|
|
"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 */
|