function items($name = '', $version = '') { $data['inventory_items'] = array(); $data['name'] = 'No item'; if ($name) { $name = rawurldecode($name); $inventory_item_obj = new Inventory_model(); $data['name'] = $name; if ($version) { $version = rawurldecode($version); $items = $inventory_item_obj->retrieve_many('name = ? AND version = ?', array($name, $version)); } else { $items = $inventory_item_obj->retrieve_many('name = ?', array($name)); } foreach ($items as $item) { $machine = new Machine_model($item->serial); $reportdata = new Reportdata_model($item->serial); $instance['serial'] = $item->serial; $instance['hostname'] = $machine->computer_name; $instance['username'] = $reportdata->console_user; $instance['version'] = $item->version; $instance['bundleid'] = $item->bundleid; $instance['bundlename'] = $item->bundlename; $instance['path'] = $item->path; $data['inventory_items'][] = $instance; } } $obj = new View(); $obj->view('inventory/inventoryitem_detail', $data); }
function items($name = '', $version = '') { // Protect this handler if (!$this->authorized()) { redirect('auth/login'); } $data['inventory_items'] = array(); $data['name'] = 'No item'; if ($name) { $name = rawurldecode($name); $inventory_item_obj = new Inventory_model(); $data['name'] = $name; if ($version) { $version = rawurldecode($version); $items = $inventory_item_obj->retrieve_many('name = ? AND version = ?', array($name, $version)); } else { $items = $inventory_item_obj->retrieve_many('name = ?', array($name)); } foreach ($items as $item) { $machine = new Machine_model($item->serial_number); // Check if authorized for this serial if (!$machine->id) { continue; } $reportdata = new Reportdata_model($item->serial_number); $instance['serial_number'] = $item->serial_number; $instance['hostname'] = $machine->computer_name; $instance['username'] = $reportdata->console_user; $instance['version'] = $item->version; $instance['bundleid'] = $item->bundleid; $instance['bundlename'] = $item->bundlename; $instance['path'] = $item->path; $data['inventory_items'][] = $instance; } } $obj = new View(); $obj->view('inventoryitem_detail', $data, $this->view_path); }
<p> <table class="inventory table table-striped table-bordered"> <thead> <tr> <th data-i18n="name">Name</th> <th data-i18n="version">Version</th> <th data-i18n="bundle_id">BundleID</th> <th data-i18n="path">Path</th> </tr> </thead> <tbody> <?php $inventoryitemobj = new Inventory_model(); ?> <?php foreach ($inventoryitemobj->retrieve_many('serial=?', array($serial_number)) as $item) { ?> <?php $name_url = url('module/inventory/items/' . rawurlencode($item->name)); ?> <?php $vers_url = $name_url . '/' . rawurlencode($item->version); ?> <tr> <td><a href='<?php echo $name_url; ?> '><?php echo $item->name; ?> </a></td>
$('#inv-count').html(oSettings.fnRecordsTotal()); } }); } ); </script> <h3>Inventory items <span id="inv-count" class='label label-primary'>…</span></h3> <table class='table table-striped table-condensed table-bordered'> <thead> <tr> <th>Name</th> <th>Version</th> </tr> </thead> <tbody> <?php $inventory_item_obj = new Inventory_model(); $items = $inventory_item_obj->select_all(); $inventory = array(); foreach ($items as $item) { $name = $item->name; $version = $item->version; $installs = $item->num_installs; $inventory[$name][$version] = $installs; } ?> <?php foreach ($inventory as $name => $value) { ?> <?php $name_url = url('module/inventory/items/' . rawurlencode($name)); ?>
$('#inv-count').html(oSettings.fnRecordsTotal()); } }); } ); </script> <h3>Inventory items <span id="inv-count" class='label label-primary'>…</span></h3> <table class='table table-striped table-condensed table-bordered'> <thead> <tr> <th>Name</th> <th>Version</th> </tr> </thead> <tbody> <?php $inventory_item_obj = new Inventory_model(); $items = $inventory_item_obj->select('name, version, COUNT(id) AS num_installs', '1 GROUP BY name, version'); $inventory = array(); foreach ($items as $item) { $name = $item['name']; $version = $item['version']; $installs = $item['num_installs']; $inventory[$name][$version] = $installs; } ?> <?php foreach ($inventory as $name => $value) { ?> <?php $name_url = url('module/inventory/items/' . rawurlencode($name)); ?>
<?php $appsToCheck = conf('apps_to_track'); $appsToChecksql = array(); $appsIndex = count($appsToCheck); $counter = 0; $group_filter = get_machine_group_filter('AND', 'm'); foreach ($appsToCheck as $string) { $appsToChecksql[] = "SELECT i.version, COUNT(i.version) as count\n FROM inventoryitem i\n LEFT JOIN reportdata m ON (m.serial_number = i.serial)\n WHERE i.name LIKE '{$string}'\n {$group_filter}\n GROUP BY i.version\n ORDER BY count DESC"; } ?> <?php while ($appsIndex != $counter) { $machine = new Inventory_model(); ?> <div class="col-lg-4 col-md-6"> <div class="panel panel-default"> <div class="panel-heading" data-container="body" title="Known versions of <?php echo $appsToCheck[$counter]; ?> "> <h3 class="panel-title"><i class="fa fa-tachometer"></i> <span data-i18n="<?php echo $appsToCheck[$counter]; ?> "><?php echo $appsToCheck[$counter]; ?> </span></h3> </div> <div class="list-group scroll-box">
public function add_project_materials() { Materials_model::insertMaterials(); $id = $this->input->get('project_id'); $data['id'] = $id; $data['record'] = Inventory_model::all(); $data['pageTitle'] = 'Add Materials - MSInc.'; $data['content'] = 'asset/add_project_materials'; $this->load->view($this->master_layout, $data); }