DialModeController.php
2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php namespace App\Http\Controllers;
use Auth;
use Input;
use Response;
use App\Models\Notification;
use App\Jobs\KHRMSLib;
use App\Models\User;
use DB;
class DialModeController extends Controller {
public function __construct()
{
$this->middleware('auth');
$this->middleware('module_access');
}
public function index()
{
return view('layout.module.dialmode.index');
}
public function create()
{
}
public function store()
{
}
public function show($id)
{
}
public function edit($id)
{
}
public function update($id)
{
}
public function dialmodeview()
{
$data = array();
$client = array();
$data['wakka'] = new KHRMSLib();
$dashboarduser=Auth::user();
if($dashboarduser->usertype != 'Admin'){
$allusers=User::where(function ($query) use($dashboarduser) {
$query->where('supervisor','=',$dashboarduser->username)
->orWhere('lteam2','=',$dashboarduser->username)
->orWhere('lteam','=',$dashboarduser->username);
})->get();
}else
{
$allusers=DB::table('users')->select('*')->get();
}
foreach($allusers as $alluser)
{
$usrData = json_decode($alluser->data);
$usrHRMSData = unserialize($usrData->hrmsdata);
if($usrHRMSData['clientsownerlist']&&$usrHRMSData['clientsownerlist']!='null')
$client[] = $usrHRMSData['clientsownerlist'];
$username[] = $alluser->username;
}
$data['client'] = $client;
$data['username'] = $username;
return view('layout.module.dialmode.index',$data);
}
public function dialmodeassign()
{
$agentsNewArr = array();
$agents = Input::get('agents');
$dialmodeassign = Input::get('dialmodeassign');
$agentsArr = explode(",", $agents);
foreach ($agentsArr as $key => $agent)
{
DB::statement("update users set updated_at='".date("Y-m-d H:i:s")."',dialmode_assign='$dialmodeassign' where username='$agent'");
}
return;
}
public function dashboard()
{
//echo "OK";
}
}