"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/web/lib/reports/hosts_and_users.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.

hosts_and_users.report.php  (fogproject-1.5.5):hosts_and_users.report.php  (fogproject-1.5.6)
<?php <?php
/** /**
* Reports hosts and the users within. * Reports hosts and the users within.
* *
* PHP version 5 * PHP version 5
* *
* @category Hosts_And_Users * @category Hosts_And_Users
* @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 <tommygunsster@gmail.com>
* @link https://fogproject.org
*/
/**
* Reports hosts and the users within.
*
* @category Hosts_And_Users
* @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 Hosts_And_Users extends ReportManagementPage class Hosts_And_Users extends ReportManagementPage
{ {
/** /**
* The page to display. * Display search page.
* *
* @return void * @return void
*/ */
public function file() public function file()
{ {
$this->title = _('FOG Host and Users - 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);
}
}
natcasesort($groupNames);
if (count($groupNames) > 0) {
$groupSelForm = self::selectForm(
'groupsearch',
$groupNames
);
unset($groupNames);
}
$fields = array(
'<label for="groupsearch">'
. _('Enter a group name to search for')
. '</label>' => $groupSelForm,
'<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>';
}
/**
* The page to display.
*
* @return void
*/
public function filePost()
{
$this->title =_('FOG Hosts and Users Login'); $this->title =_('FOG Hosts and Users Login');
$groupsearch = filter_input(
INPUT_POST,
'groupsearch'
);
if (!$groupsearch) {
$groupsearch = '%';
}
$locationsearch = filter_input(
INPUT_POST,
'locationsearch'
);
$sitesearch = filter_input(
INPUT_POST,
'sitesearch'
);
$csvHead = array( $csvHead = array(
_('Host ID') => 'id', _('Host ID') => 'id',
_('Host Name') => 'name', _('Host Name') => 'name',
_('Host Desc') => 'description', _('Host Desc') => 'description',
_('Host MAC') => 'mac', _('Host MAC') => 'mac',
_('Host Created') => 'createdTime', _('Host Created') => 'createdTime',
_('Image ID') => 'id', _('Image ID') => 'id',
_('Image Name') => 'name', _('Image Name') => 'name',
_('Image Desc') => 'description', _('Image Desc') => 'description',
_('AD Join') => 'useAD', _('AD Join') => 'useAD',
skipping to change at line 66 skipping to change at line 204
_('Host MAC'), _('Host MAC'),
_('Image Name'), _('Image Name'),
_('Login Users') _('Login Users')
); );
$this->templates = array( $this->templates = array(
'${host_name}', '${host_name}',
'${host_mac}', '${host_mac}',
'${image_name}', '${image_name}',
'${users}' '${users}'
); );
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);
}
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;
$imgID = $Image->id; $imgID = $Image->id;
$imgName = $Image->name; $imgName = $Image->name;
$imgDesc = $Image->description; $imgDesc = $Image->description;
unset($Image); unset($Image);
skipping to change at line 112 skipping to change at line 297
$this->ReportMaker->addCSVCell( $this->ReportMaker->addCSVCell(
( (
$Host->useAD == 1 ? $Host->useAD == 1 ?
_('Yes') : _('Yes') :
_('No') _('No')
) )
); );
break; break;
case _('Login Users'): case _('Login Users'):
$this->ReportMaker->addCSVCell( $this->ReportMaker->addCSVCell(
implode("\n", $Host->users) implode(
); ' ',
self::getSubObjectIDs(
'UserTracking',
array('hostID' => $Host->id),
'username'
)
)
);
break; break;
default: default:
$this->ReportMaker->addCSVCell($Host->$classGet); $this->ReportMaker->addCSVCell($Host->$classGet);
break; break;
} }
unset($classGet); unset($classGet);
} }
unset($Host); unset($Host);
$this->ReportMaker->endCSVLine(); $this->ReportMaker->endCSVLine();
} }
 End of changes. 7 change blocks. 
13 lines changed or deleted 207 lines changed or added

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