"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/web/lib/reports/inventory_report.report.php" between
fogproject-1.5.5.tar.gz and fogproject-1.5.6.tar.gz

About: FOG is a Linux-based network computer cloning solution for Windows, Mac OSX and various Linux distributions that ties together a few open-source tools with a PHP-based web interface. FOG doesn’t use any boot disks, or CDs; everything is done via TFTP and PXE.

inventory_report.report.php  (fogproject-1.5.5):inventory_report.report.php  (fogproject-1.5.6)
<?php <?php
/** /**
* Prints the inventory of all items. * Prints the inventory of all items.
* *
* PHP Version 5 * PHP Version 5
* *
* @category Inventory_Report * @category Inventory_Report
* @package FOGProject * @package FOGProject
* @author Tom Elliott <tommygunsster@gmail.com> * @author Tom Elliott <tommygunsster@gmail.com>
* @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @author Fernando Gietz <fernando.gietz@gmail.com>
* @link https://fogproject.org
*/
/**
* Prints the inventory of all items.
*
* @category Inventory_Report
* @package FOGProject
* @author Tom Elliott <tommygunsster@gmail.com>
* @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link https://fogproject.org * @link https://fogproject.org
*/ */
class Inventory_Report extends ReportManagementPage class Inventory_Report extends ReportManagementPage
{ {
/** /**
* Display page. * Display search page.
* *
* @return void * @return void
*/ */
public function file() public function file()
{ {
$this->title = _('FOG Host Inventory - Search');
unset(
$this->data,
$this->form,
$this->headerData,
$this->templates,
$this->attributes
);
$this->templates = array(
'${field}',
'${input}'
);
$this->attributes = array(
array('class' => 'col-xs-4'),
array('class' => 'col-xs-8 form-group')
);
$groupNames = self::getSubObjectIDs(
'Group',
'',
'name'
);
$groupNames = array_values(
array_filter(
array_unique(
(array)$groupNames
)
)
);
if (in_array('location', (array)self::$pluginsinstalled)) {
$locationNames = self::getSubObjectIDs(
'Location',
'',
'name'
);
natcasesort($locationNames);
if (count($locationNames) > 0) {
$locationSelForm = self::selectForm(
'locationsearch',
$locationNames
);
unset($locationNames);
}
}
if (in_array('site', (array)self::$pluginsinstalled)) {
$siteNames = self::getSubObjectIDs(
'site',
'',
'name'
);
natcasesort($siteNames);
if (count($siteNames) > 0) {
$siteSelForm = self::selectForm(
'sitesearch',
$siteNames
);
unset($siteNames);
}
}
$sysproductNames = self::getSubObjectIDs(
'inventory',
'',
'sysproduct'
);
$sysproductNames = array_values(
array_filter(
array_unique(
(array)$sysproductNames
)
)
);
natcasesort($groupNames);
natcasesort($sysproductNames);
if (count($groupNames) > 0) {
$groupSelForm = self::selectForm(
'groupsearch',
$groupNames
);
unset($groupNames);
}
if (count($sysproductNames) > 0) {
$sysproductSelForm = self::selectForm(
'sysproductsearch',
$sysproductNames
);
unset($sysproductNames);
}
$fields = array(
'<label for="groupsearch">'
. _('Enter a group name to search for')
. '</label>' => $groupSelForm,
'<label for="sysproductsearch">'
. _('Enter a model name to search for')
. '</label>' => $sysproductSelForm,
'<label for="performsearch">'
. _('Perform search')
. '</label>' => '<button type="submit" name="performsearch" '
. 'class="btn btn-info btn-block" id="performsearch">'
. _('Search')
. '</button>'
);
if (in_array('location', (array)self::$pluginsinstalled)) {
self::arrayInsertAfter(
'<label for="groupsearch">'
. _('Enter a group name to search for')
. '</label>',
$fields,
'<label for="locationsearch">'
. _('Enter a location name to search for')
. '</label>',
$locationSelForm
);
}
if (in_array('site', (array)self::$pluginsinstalled)) {
self::arrayInsertAfter(
'<label for="groupsearch">'
. _('Enter a group name to search for')
. '</label>',
$fields,
'<label for="sitesearch">'
. _('Enter a site name to search for')
. '</label>',
$siteSelForm
);
}
array_walk($fields, $this->fieldsToData);
echo '<div class="col-xs-9">';
echo '<div class="panel panel-info">';
echo '<div class="panel-heading text-center">';
echo '<h4 class="title">';
echo $this->title;
echo '</h4>';
echo '</div>';
echo '<div class="panel-body">';
echo '<form class="form-horizontal" method="post" action="'
. $this->formAction
. '">';
$this->render(12);
echo '</form>';
echo '</div>';
echo '</div>';
echo '</div>';
}
/**
* Display page.
*
* @return void
*/
public function filePost()
{
$this->title = _('Full Inventory Export'); $this->title = _('Full Inventory Export');
$groupsearch = filter_input(
INPUT_POST,
'groupsearch'
);
if (!$groupsearch) {
$groupsearch = '%';
}
$locationsearch = filter_input(
INPUT_POST,
'locationsearch'
);
$sitesearch = filter_input(
INPUT_POST,
'sitesearch'
);
$sysproductsearch = filter_input(
INPUT_POST,
'sysproductsearch'
);
if (!$sysproductsearch) {
$sysproductsearch = '%';
}
array_walk( array_walk(
self::$inventoryCsvHead, self::$inventoryCsvHead,
function (&$classGet, &$csvHeader) { function (&$classGet, &$csvHeader) {
$this->ReportMaker->addCSVCell($csvHeader); $this->ReportMaker->addCSVCell($csvHeader);
unset($classGet, $csvHeader); unset($classGet, $csvHeader);
} }
); );
$this->ReportMaker->endCSVLine(); $this->ReportMaker->endCSVLine();
$this->headerData = array( $this->headerData = array(
_('Host name'), _('Host name'),
skipping to change at line 58 skipping to change at line 227
'${memory}', '${memory}',
'${sysprod}', '${sysprod}',
'${sysser}' '${sysser}'
); );
$this->attributes = array( $this->attributes = array(
array(), array(),
array(), array(),
array(), array(),
array() array()
); );
Route::listem('host');
$groupIDs = self::getSubObjectIDs(
'Group',
array('name' => $groupsearch),
'id'
);
$groupHostIDs = self::getSubObjectIDs(
'GroupAssociation',
array('groupID' => $groupIDs),
'hostID'
);
if (in_array('location', (array)self::$pluginsinstalled) && $locationsea
rch) {
$locationIDs = self::getSubObjectIDs(
'Location',
array('name' => $locationsearch),
'id'
);
$locationHostIDs = self::getSubObjectIDs(
'LocationAssociation',
array('locationID' => $locationIDs),
'hostID'
);
$groupHostIDs = array_intersect($locationHostIDs, $groupHostIDs);
}
if (in_array('site', (array)self::$pluginsinstalled) && $sitesearch) {
$siteIDs = self::getSubObjectIDs(
'Site',
array('name' => $sitesearch),
'id'
);
$siteHostIDs = self::getSubObjectIDs(
'SiteHostAssociation',
array('siteID' => $siteIDs),
'hostID'
);
$groupHostIDs = array_intersect($siteHostIDs, $groupHostIDs);
}
$sysproductIDs = self::getSubObjectIDs(
'Inventory',
array('sysproduct' => $sysproductsearch),
'hostID'
);
$groupHostIDs = array_intersect($sysproductIDs, $groupHostIDs);
Route::listem(
'host',
'name',
'false',
array(
'id' => $groupHostIDs
)
);
$Hosts = json_decode( $Hosts = json_decode(
Route::getData() Route::getData()
); );
$Hosts = $Hosts->hosts; $Hosts = $Hosts->hosts;
foreach ((array)$Hosts as &$Host) { foreach ((array)$Hosts as &$Host) {
$Image = $Host->image; $Image = $Host->image;
$Inventory = $Host->inventory; $Inventory = $Host->inventory;
$this->data[] = array( $this->data[] = array(
'host_name' => $Host->name, 'host_name' => $Host->name,
'host_mac' => $Host->primac, 'host_mac' => $Host->primac,
 End of changes. 6 change blocks. 
11 lines changed or deleted 234 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)