|
Server : LiteSpeed System : Linux terra.hostitbro.com 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64 User : outerorb ( 1091) PHP Version : 8.1.34 Disable Function : mail Directory : /home2/outerorb/crm.outerorbittech.com/application/controllers/ | |
|
Path: /home2/outerorb/crm.outerorbittech.com/application/controllers/User.php
Size: 2.74 KB
Permissions: 0664
<?php
defined('BASEPATH') or exit('No direct script access allowed');
class User extends CI_Controller
{
function __construct()
{
parent::__construct();
}
public function user_list()
{
$data['title'] = 'User List';
$data['datatable'] = true;
$data['user'] = $this->Master_model->get_users();
$this->template->load('pages/user', 'user_list', $data);
}
public function edit($id)
{
$data['title'] = 'User List';
$data['user'] = $this->db->get_where('register', array('id' => $id))->row();
$this->template->load('pages/user', 'edit', $data);
}
public function edit_user()
{
$user = $this->input->post();
$id = $this->input->post('id');
unset($user['mobile']);
$this->db->where('id', $id);
$update = $this->db->update('register', $user);
if ($update == true) {
$this->session->set_flashdata('msg', "Update Succesfully!");
} else {
$this->session->set_flashdata('err_msg', $update['message']);
}
redirect('user/edit/' . $id);
}
public function attendence()
{
$count = 1;
$month = date("t");
$cur_month = date("m");
$cur_year = date("Y");
$emp = $this->db->get_where('emp', array('status' => 1))->result_array();
foreach ($emp as $e) {
while ($count <= $month) {
$ar['emp_id'] = $e['id'];
$ar['date'] = date('Y-m-' . $count);
$ar['month'] = $cur_month;
$ar['year'] = $cur_year;
$ar['created_at'] = date('Y-m-d H:i:s');
$this->db->insert('attendence', $ar);
$count++;
}
}
}
public function emp_holidy()
{
$cur_month = date("m");
$atten = $this->db->get_where('attendence', array('month' => $cur_month))->result_array();
if (!empty($atten)) {
foreach ($atten as $at) {
$holiday = $this->db->get_where('holidays', array('status' => 1, 'date' => $at['date']))->row_array();
$ar['in_time'] = date('H:i:s');
$ar['out_time'] = date('H:i:s');
if (!empty($holiday)) {
$this->db->where('date', $at['date']);
$date = $this->db->update('attendence', $ar);
}
$dt = $at['date'];
$dt1 = strtotime($dt);
$dt2 = date("l", $dt1);
if($dt2=='Sunday')
{
$this->db->where('date', $at['date']);
$date = $this->db->update('attendence', $ar);
}
}
}
}
}