-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmanifests_controller.php
101 lines (92 loc) · 2.51 KB
/
manifests_controller.php
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
<?php
/**
* manifests class
*
* @package munkireport
* @author
**/
class Manifests_controller extends Module_controller
{
/*** Protect methods with auth! ****/
function __construct()
{
// Store module path
$this->module_path = dirname(__FILE__);
}
/**
* Default method
*
* @author avb
**/
function index()
{
echo "You've loaded the Manifests module!";
}
/**
* Get manifests statistics
*
*
**/
public function get_manifest_stats()
{
jsonView(
Manifests_model::selectRaw('manifest_name, COUNT(manifest_name) AS count')
->filter()
->groupBy('manifest_name')
->orderBy('count', 'desc')
->get()
->toArray()
);
}
/**
* Get catalogs statistics
*
*
**/
public function get_catalog_stats()
{
jsonView(
Manifests_model::selectRaw('catalogs, COUNT(catalogs) AS count')
->where('catalogs', '<>', '')
->filter()
->groupBy('catalogs')
->orderBy('count', 'desc')
->get()
->toArray()
);
}
/**
* Get self service manifest count widget
*
* @return void
* @author joncrain
*
**/
public function get_self_service()
{
jsonView(
Manifests_model::selectRAW('DISTINCT machine.computer_name, manifests.serial_number, manifest_name')
->join('machine', 'machine.serial_number', '=', 'manifests.serial_number')
// ->join('reportdata', 'reportdata.serial_number', '=', 'manifests.serial_number')
->where('manifest_name', 'LIKE', '%SelfServe%')
->filter()
->get()
->toArray()
);
}
/**
* Get manifests information for serial_number
*
* @param string $serial serial number
**/
public function get_manifests_data($serial_number = '')
{
jsonView(
Manifests_model::selectRaw('manifests.serial_number, manifest_name, catalogs, included_manifests, managed_installs, managed_uninstalls, optional_installs, managed_updates, featured_items, condition_check, conditional_items, display_name')
->where('manifests.serial_number', $serial_number)
->filter()
->get()
->toArray()
);
}
} // END class Manifests_controller