host_list.report.php (fogproject-1.5.7) | : | host_list.report.php (fogproject-1.5.8) | ||
---|---|---|---|---|
skipping to change at line 49 | skipping to change at line 49 | |||
$this->attributes | $this->attributes | |||
); | ); | |||
$this->templates = array( | $this->templates = array( | |||
'${field}', | '${field}', | |||
'${input}' | '${input}' | |||
); | ); | |||
$this->attributes = array( | $this->attributes = array( | |||
array('class' => 'col-xs-4'), | array('class' => 'col-xs-4'), | |||
array('class' => 'col-xs-8 form-group') | array('class' => 'col-xs-8 form-group') | |||
); | ); | |||
$fields = array(); | ||||
$groupNames = self::getSubObjectIDs( | $groupNames = self::getSubObjectIDs( | |||
'Group', | 'Group', | |||
'', | '', | |||
'name' | 'name' | |||
); | ); | |||
$groupNames = array_values( | if (is_array($groupNames) && count($groupNames) > 0) { | |||
array_filter( | $groupNames = array_values( | |||
array_unique( | array_filter( | |||
(array)$groupNames | array_unique( | |||
) | (array)$groupNames | |||
) | ) | |||
); | ) | |||
); | ||||
natcasesort($groupNames); | ||||
$groupSelForm = self::selectForm( | ||||
'groupsearch', | ||||
$groupNames | ||||
); | ||||
unset($groupNames); | ||||
$fields += array('<label for="groupsearch">' | ||||
. _('Enter a group name to search for') | ||||
. '</label>' => $groupSelForm | ||||
); | ||||
} | ||||
if (in_array('location', (array)self::$pluginsinstalled)) { | if (in_array('location', (array)self::$pluginsinstalled)) { | |||
$locationNames = self::getSubObjectIDs( | $locationNames = self::getSubObjectIDs( | |||
'Location', | 'Location', | |||
'', | '', | |||
'name' | 'name' | |||
); | ); | |||
natcasesort($locationNames); | if (is_array($locationNames) && count($locationNames) > 0) { | |||
if (count($locationNames) > 0) { | natcasesort($locationNames); | |||
$locationSelForm = self::selectForm( | $locationSelForm = self::selectForm( | |||
'locationsearch', | 'locationsearch', | |||
$locationNames | $locationNames | |||
); | ); | |||
unset($locationNames); | unset($locationNames); | |||
$fields += array('<label for="locationsearch">' | ||||
. _('Enter a location name to search for') | ||||
. '</label>' => $locationSelForm | ||||
); | ||||
} | } | |||
} | } | |||
if (in_array('site', (array)self::$pluginsinstalled)) { | if (in_array('site', (array)self::$pluginsinstalled)) { | |||
$siteNames = self::getSubObjectIDs( | $siteNames = self::getSubObjectIDs( | |||
'site', | 'site', | |||
'', | '', | |||
'name' | 'name' | |||
); | ); | |||
natcasesort($siteNames); | if (is_array($siteNames) && count($siteNames) > 0) { | |||
if (count($siteNames) > 0) { | natcasesort($siteNames); | |||
$siteSelForm = self::selectForm( | $siteSelForm = self::selectForm( | |||
'sitesearch', | 'sitesearch', | |||
$siteNames | $siteNames | |||
); | ); | |||
unset($siteNames); | unset($siteNames); | |||
} | $fields += array('<label for="sitesearch">' | |||
} | . _('Enter a site name to search for') | |||
natcasesort($groupNames); | . '</label>' => $siteSelForm | |||
if (count($groupNames) > 0) { | ||||
$groupSelForm = self::selectForm( | ||||
'groupsearch', | ||||
$groupNames | ||||
); | ); | |||
unset($groupNames); | } | |||
} | } | |||
$fields = array( | $fields += array('<label for="hostpattern">' | |||
'<label for="groupsearch">' | . _('Search pattern') . '</label>' | |||
. _('Enter a group name to search for') | => '<input type="text" name="hostpattern" placeholder="Search... lea | |||
. '</label>' => $groupSelForm, | ve empty for all elements" class="form-control" />' | |||
'<label for="performsearch">' | ) + array('<label for="performsearch">' | |||
. _('Perform search') | . _('Perform search') | |||
. '</label>' => '<button type="submit" name="performsearch" ' | . '</label>' => '<button type="submit" name="performsearch" ' | |||
. 'class="btn btn-info btn-block" id="performsearch">' | . 'class="btn btn-info btn-block" id="performsearch">' | |||
. _('Search') | . _('Search') | |||
. '</button>' | . '</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); | array_walk($fields, $this->fieldsToData); | |||
echo '<div class="col-xs-9">'; | echo '<div class="col-xs-9">'; | |||
echo '<div class="panel panel-info">'; | echo '<div class="panel panel-info">'; | |||
echo '<div class="panel-heading text-center">'; | echo '<div class="panel-heading text-center">'; | |||
echo '<h4 class="title">'; | echo '<h4 class="title">'; | |||
echo $this->title; | echo $this->title; | |||
echo '</h4>'; | echo '</h4>'; | |||
echo '</div>'; | echo '</div>'; | |||
echo '<div class="panel-body">'; | echo '<div class="panel-body">'; | |||
echo '<form class="form-horizontal" method="post" action="' | echo '<form class="form-horizontal" method="post" action="' | |||
skipping to change at line 165 | skipping to change at line 152 | |||
* | * | |||
* @return void | * @return void | |||
*/ | */ | |||
public function filePost() | public function filePost() | |||
{ | { | |||
$this->title = _('Host Listing Export'); | $this->title = _('Host Listing Export'); | |||
$groupsearch = filter_input( | $groupsearch = filter_input( | |||
INPUT_POST, | INPUT_POST, | |||
'groupsearch' | 'groupsearch' | |||
); | ); | |||
if (!$groupsearch) { | ||||
$groupsearch = '%'; | ||||
} | ||||
$locationsearch = filter_input( | $locationsearch = filter_input( | |||
INPUT_POST, | INPUT_POST, | |||
'locationsearch' | 'locationsearch' | |||
); | ); | |||
$sitesearch = filter_input( | $sitesearch = filter_input( | |||
INPUT_POST, | INPUT_POST, | |||
'sitesearch' | 'sitesearch' | |||
); | ); | |||
$hostpattern = filter_input( | ||||
INPUT_POST, | ||||
'hostpattern' | ||||
); | ||||
if (!$hostpattern) { | ||||
$hostpattern = '%'; | ||||
} else { | ||||
$hostpattern = '%' . $hostpattern . '%'; | ||||
} | ||||
$csvHead = array( | $csvHead = array( | |||
_('Host ID') => 'id', | _('Host ID') => 'id', | |||
_('Host Name') => 'name', | _('Host Name') => 'name', | |||
_('Host Desc') => 'description', | _('Host Desc') => 'description', | |||
_('Host MAC') => 'primac', | _('Host MAC') => 'primac', | |||
_('Host Created') => 'createdTime', | _('Host Created') => 'createdTime', | |||
_('Host AD Join') => 'useAD', | _('Host AD Join') => 'useAD', | |||
_('Host AD OU') => 'ADOU', | _('Host AD OU') => 'ADOU', | |||
_('Host AD Domain') => 'ADDomain', | _('Host AD Domain') => 'ADDomain', | |||
_('Host Kernel') => 'kernel', | _('Host Kernel') => 'kernel', | |||
skipping to change at line 208 | skipping to change at line 201 | |||
$this->headerData = array( | $this->headerData = array( | |||
_('Hostname'), | _('Hostname'), | |||
_('Host MAC'), | _('Host MAC'), | |||
_('Image Name'), | _('Image Name'), | |||
); | ); | |||
$this->templates = array( | $this->templates = array( | |||
'${host_name}', | '${host_name}', | |||
'${host_mac}', | '${host_mac}', | |||
'${image_name}', | '${image_name}', | |||
); | ); | |||
$groupIDs = self::getSubObjectIDs( | $groupHostIDs = array(); | |||
'Group', | if ($groupsearch) { | |||
array('name' => $groupsearch), | $groupIDs = self::getSubObjectIDs( | |||
'id' | 'Group', | |||
); | array('name' => $groupsearch), | |||
'id' | ||||
$groupHostIDs = self::getSubObjectIDs( | ); | |||
'GroupAssociation', | $groupHostIDs = self::getSubObjectIDs( | |||
array('groupID' => $groupIDs), | 'GroupAssociation', | |||
'hostID' | array('groupID' => $groupIDs), | |||
); | 'hostID' | |||
); | ||||
} | ||||
if (in_array('location', (array)self::$pluginsinstalled) && $locationsea rch) { | if (in_array('location', (array)self::$pluginsinstalled) && $locationsea rch) { | |||
$locationIDs = self::getSubObjectIDs( | $locationIDs = self::getSubObjectIDs( | |||
'Location', | 'Location', | |||
array('name' => $locationsearch), | array('name' => $locationsearch), | |||
'id' | 'id' | |||
); | ); | |||
$locationHostIDs = self::getSubObjectIDs( | $locationHostIDs = self::getSubObjectIDs( | |||
'LocationAssociation', | 'LocationAssociation', | |||
array('locationID' => $locationIDs), | array('locationID' => $locationIDs), | |||
'hostID' | 'hostID' | |||
); | ); | |||
$groupHostIDs = array_intersect($locationHostIDs, $groupHostIDs); | $groupHostIDs = array_intersect($locationHostIDs, $groupHostIDs); | |||
} | } | |||
if (in_array('site', (array)self::$pluginsinstalled) && $sitesearch) { | if (in_array('site', (array)self::$pluginsinstalled) && $sitesearch) { | |||
$siteIDs = self::getSubObjectIDs( | $siteIDs = self::getSubObjectIDs( | |||
'Site', | 'Site', | |||
array('name' => $sitesearch), | array('name' => $sitesearch), | |||
'id' | 'id' | |||
); | ); | |||
$siteHostIDs = self::getSubObjectIDs( | $siteHostIDs = self::getSubObjectIDs( | |||
'SiteHostAssociation', | 'SiteHostAssociation', | |||
array('siteID' => $siteIDs), | array('siteID' => $siteIDs), | |||
'hostID' | 'hostID' | |||
); | ); | |||
$groupHostIDs = array_intersect($siteHostIDs, $groupHostIDs); | $groupHostIDs = array_intersect($siteHostIDs, $groupHostIDs); | |||
} | } | |||
Route::listem( | if ($groupsearch) { | |||
'host', | Route::listem( | |||
'name', | 'host', | |||
'false', | 'name', | |||
array( | 'false', | |||
'id' => $groupHostIDs | array( | |||
) | 'id' => $groupHostIDs, | |||
); | 'name' => $hostpattern | |||
) | ||||
); | ||||
} else { | ||||
Route::listem( | ||||
'host', | ||||
'name', | ||||
'false', | ||||
array('name' => $hostpattern) | ||||
); | ||||
} | ||||
$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 307 | skipping to change at line 312 | |||
} | } | |||
$this->ReportMaker->appendHTML($this->process(12)); | $this->ReportMaker->appendHTML($this->process(12)); | |||
echo '<div class="col-xs-9">'; | echo '<div class="col-xs-9">'; | |||
echo '<div class="panel panel-info">'; | echo '<div class="panel panel-info">'; | |||
echo '<div class="panel-heading text-center">'; | echo '<div class="panel-heading text-center">'; | |||
echo '<h4 class="title">'; | echo '<h4 class="title">'; | |||
echo $this->title; | echo $this->title; | |||
echo '</h4>'; | echo '</h4>'; | |||
echo '</div>'; | echo '</div>'; | |||
echo '<div class="panel-body">'; | echo '<div class="panel-body">'; | |||
if (count($this->data) > 0) { | if (is_array($this->data) && count($this->data) > 0) { | |||
echo '<div class="text-center">'; | echo '<div class="text-center">'; | |||
printf( | printf( | |||
$this->reportString, | $this->reportString, | |||
'HostList', | 'HostList', | |||
_('Export CSV'), | _('Export CSV'), | |||
_('Export CSV'), | _('Export CSV'), | |||
self::$csvfile, | self::$csvfile, | |||
'HostList', | 'HostList', | |||
_('Export PDF'), | _('Export PDF'), | |||
_('Export PDF'), | _('Export PDF'), | |||
End of changes. 18 change blocks. | ||||
77 lines changed or deleted | 83 lines changed or added |