function showAllServiceGroups() { require_once __DIR__ . '/../../../../lib/Gocdb_Services/Factory.php'; $scope = '%%'; if (!empty($_GET['scope'])) { $scope = $_GET['scope']; } $scopes = \Factory::getScopeService()->getScopes(); $sgKeyNames = ""; if (isset($_GET['sgKeyNames'])) { $sgKeyNames = $_GET['sgKeyNames']; } $sgKeyValues = ""; if (isset($_GET['selectedSGKeyValue'])) { $sgKeyValues = $_GET['selectedSGKeyValue']; } $sGroups = \Factory::getServiceGroupService()->getServiceGroups($scope, $sgKeyNames, $sgKeyValues); $exServ = \Factory::getExtensionsService(); /* Doctrine will provide keynames that are the same even when selecting distinct becase the object * is distinct even though the name is not unique. To avoid showing the same name repeatdly in the filter * we will load all the keynames into an array before making it unique */ $keynames = array(); foreach ($exServ->getServiceGroupExtensionsKeyNames() as $extension) { $keynames[] = $extension->getKeyName(); } $keynames = array_unique($keynames); $params['sGroups'] = $sGroups; $params['scopes'] = $scopes; $params['selectedScope'] = $scope; $params['selectedSGKeyName'] = $sgKeyNames; $params['selectedSGKeyValue'] = $sgKeyValues; $params['sgKeyName'] = $keynames; show_view("service_group/view_all.php", $params); }
/** * Draws the add NGI form * @return null */ function draw() { require_once __DIR__ . '/../../../../lib/Gocdb_Services/Factory.php'; //Check the user has permission to see the page, will throw exception //if correct permissions are lacking checkUserIsAdmin(); //Get the list of scopes to chose from and the minimum number that need to be selected $params['Scopes'] = \Factory::getScopeService()->getDefaultScopesSelectedArray(); $params['NumberOfScopesRequired'] = \Factory::getConfigService()->getMinimumScopesRequired('ngi'); //show the add NGI view show_view("admin/add_ngi.php", $params, "Add NGI"); }
function show_scopes() { //Check the user has permission to see the page, will throw exception //if correct permissions are lacking checkUserIsAdmin(); $scopes = \Factory::getScopeService()->getScopes(); $params['Scopes'] = $scopes; $dn = Get_User_Principle(); $user = \Factory::getUserService()->getUserByPrinciple($dn); $params['portalIsReadOnly'] = portalIsReadOnlyAndUserIsNotAdmin($user); show_view('admin/scopes.php', $params, 'Scopes'); die; }
function view_ngis() { require_once __DIR__ . '/../../../../lib/Gocdb_Services/Factory.php'; $scope = '%%'; if (!empty($_GET['scope'])) { $scope = $_GET['scope']; } $scopes = \Factory::getScopeService()->getScopes(); $ngis = \Factory::getNgiService()->getNGIs($scope); $params['ngis'] = $ngis; $params['scopes'] = $scopes; $params['selectedScope'] = $scope; show_view('ngi/view_ngis.php', $params, "NGIs"); }
/** * Draws the edit ngi form using the object ID passed in $_REQUEST * @param \User $user current user * @return null */ function draw(\User $user = null) { if (!isset($_REQUEST['id']) || !is_numeric($_REQUEST['id'])) { throw new Exception("An id must be specified"); } $serv = \Factory::getNgiService(); $ngi = $serv->getNgi($_REQUEST['id']); // Old way: //$serv->edit Authorization($ngi, $user); if (count($serv->authorizeAction(Action::EDIT_OBJECT, $ngi, $user)) == 0) { throw new Exception('You do not have permission to edit this NGI'); } $params = array('ngi' => $ngi); $params['scopes'] = \Factory::getScopeService()->getScopesSelectedArray($ngi->getScopes()); $params['numberOfScopesRequired'] = \Factory::getConfigService()->getMinimumScopesRequired('ngi'); show_view('ngi/edit_ngi.php', $params); }
function draw($user) { try { //\Factory::getServiceGroupService()->addAuthorization($user); if (is_null($user)) { throw new \Exception("Unregistered users can't create service groups."); } // If the user is registered they're allowed to add a service group $configService = \Factory::getConfigService(); $scopes = \Factory::getScopeService()->getDefaultScopesSelectedArray(); $numberScopesRequired = $configService->getMinimumScopesRequired('service_group'); $params = array('scopes' => $scopes, 'numberOfScopesRequired' => $numberScopesRequired); show_view("service_group/add_service_group.php", $params); } catch (Exception $e) { show_view("error.php", $e->getMessage()); die; } }
/** * Retrieves the new scopes data from a portal request and submit it to the * services layer's scope functions. * @return null */ function submit() { require_once __DIR__ . '/../../../../htdocs/web_portal/components/Get_User_Principle.php'; //Get the posted service type data $values = getScopeDataFromWeb(); //get the user data for the add scope function (so it can check permissions) $dn = Get_User_Principle(); $user = \Factory::getUserService()->getUserByPrinciple($dn); try { //function will through error if user does not have the correct permissions $scope = \Factory::getScopeService()->addScope($values, $user); $params = array('Name' => $scope->getName(), 'ID' => $scope->getId()); show_view("admin/added_scope.php", $params, "New scope succesffully created"); } catch (Exception $e) { show_view('error.php', $e->getMessage()); die; } }
/** * Draws the edit site form using the object ID passed in $_REQUEST * @param \User $user current user * @throws Exception * @return null */ function draw(\User $user = null) { if (!isset($_GET['id']) || !is_numeric($_GET['id'])) { throw new Exception("An id must be specified"); } $serv = \Factory::getSiteService(); $site = $serv->getSite($_GET['id']); /*Old way: try { \Factory::getSiteService()->edit Authorization($site, $user); } catch(Exception $e) { show_view('error.php', $e->getMessage()); die(); }*/ if (count($serv->authorizeAction(Action::EDIT_OBJECT, $site, $user)) == 0) { throw new Exception('You do not have permission to edit this Site'); } //else { print_r($serv->authorizeAction(Action::EDIT_OBJECT, $site, $user));} $countries = $serv->getCountries(); //$timezones = $serv->getTimezones(); // Deprecated - don't use the lookup values in the GocDB $timezones = DateTimeZone::listIdentifiers(); // get the standard values $prodStatuses = $serv->getProdStatuses(); //Remove SC and PPS infrastructures from drop down list (unless site has one of them). TODO: Delete this block once they no longer exist $SCInfrastructure = $serv->getProdStatusByName('SC'); $PPSInfrastructure = $serv->getProdStatusByName('PPS'); $hackprodStatuses = array(); foreach ($prodStatuses as $ps) { if ($ps != $SCInfrastructure and $ps != $PPSInfrastructure or $ps == $site->getInfrastructure()) { $hackprodStatuses[] = $ps; } } $prodStatuses = $hackprodStatuses; //delete up to here once pps and sc infrastructures have been removed from database $scopes = \Factory::getScopeService()->getScopesSelectedArray($site->getScopes()); //get parent scope ids to generate warning message in view $parentScopeIds = array(); foreach ($site->getNgi()->getScopes() as $scope) { $parentScopeIds[] = $scope->getId(); } $configServ = \Factory::getConfigService(); $numberScopesRequired = $configServ->getMinimumScopesRequired('site'); $params = array("site" => $site, "timezones" => $timezones, "countries" => $countries, "prodStatuses" => $prodStatuses, "scopes" => $scopes, "numberOfScopesRequired" => $numberScopesRequired, "parentScopeIds" => $parentScopeIds); show_view('site/edit_site.php', $params); }
/** * Draw the edit site form. * @param \User $user * @throws \Exception */ function draw(\User $user = null) { if (!isset($_REQUEST['id']) || !is_numeric($_REQUEST['id'])) { throw new Exception("An id must be specified"); } $id = $_REQUEST['id']; $serv = \Factory::getServiceService(); $se = $serv->getService($id); if (count(Factory::getServiceService()->authorizeAction(\Action::EDIT_OBJECT, $se, $user)) == 0) { throw new \Exception("You do not have permission over {$se}."); } $configservice = \Factory::getConfigService(); //get parent scope ids to generate warning message in view $params["parentScopeIds"] = array(); foreach ($se->getParentSite()->getScopes() as $scope) { $params["parentScopeIds"][] = $scope->getId(); } $params['se'] = $se; $params['serviceTypes'] = $serv->getServiceTypes(); $params['scopes'] = \Factory::getScopeService()->getScopesSelectedArray($se->getScopes()); $params['numberOfScopesRequired'] = $configservice->getMinimumScopesRequired('service'); show_view('service/edit_service.php', $params); }
function view_scope() { //Check the user has permission to see the page, will throw exception //if correct permissions are lacking checkUserIsAdmin(); if (!isset($_REQUEST['id']) || !is_numeric($_REQUEST['id'])) { throw new Exception("An id must be specified"); } $dn = Get_User_Principle(); $user = \Factory::getUserService()->getUserByPrinciple($dn); $serv = \Factory::getScopeService(); $scope = $serv->getScope($_REQUEST['id']); $params['Name'] = $scope->getName(); $params['Description'] = $scope->getDescription(); $params['ID'] = $scope->getId(); $params['NGIs'] = $serv->getNgisFromScope($scope); $params['Sites'] = $serv->getSitesFromScope($scope); $params['ServiceGroups'] = $serv->getServiceGroupsFromScope($scope); $params['Services'] = $serv->getServicesFromScope($scope); $params['portalIsReadOnly'] = portalIsReadOnlyAndUserIsNotAdmin($user); show_view("admin/scope.php", $params, $params['Name']); die; }
function drawSEs() { define("RECORDS_PER_PAGE", 30); require_once __DIR__ . '/../../../../lib/Gocdb_Services/Factory.php'; $seServ = \Factory::getServiceService(); $exServ = \Factory::getExtensionsService(); $startRecord = 1; if (isset($_REQUEST['record'])) { $startRecord = $_REQUEST['record']; } // Validation, ensure start record >= 1 if ($startRecord < 1) { $startRecord = 1; } $searchTerm = ""; if (!empty($_REQUEST['searchTerm'])) { $searchTerm = $_REQUEST['searchTerm']; } //strip leading and trailing whitespace off search term $searchTerm = strip_tags(trim($searchTerm)); if (1 === preg_match("/[';\"]/", $searchTerm)) { throw new Exception("Invalid char in search term"); } $serviceType = ""; if (isset($_REQUEST['serviceType'])) { $serviceType = $_REQUEST['serviceType']; } $production = ""; if (isset($_REQUEST['production'])) { $production = $_REQUEST['production']; } $monitored = ""; if (isset($_REQUEST['monitored'])) { $monitored = $_REQUEST['monitored']; } $scope = ""; if (isset($_REQUEST['scope'])) { $scope = $_REQUEST['scope']; } $ngi = ""; if (isset($_REQUEST['ngi'])) { $ngi = $_REQUEST['ngi']; } //must be done before the if certstatus in the block that sets $certStatus $showClosed = false; if (isset($_REQUEST['showClosed'])) { $showClosed = true; } $servKeyNames = ""; if (isset($_REQUEST['servKeyNames'])) { $servKeyNames = $_REQUEST['servKeyNames']; } $servKeyValues = ""; if (isset($_REQUEST['selectedServKeyValue'])) { $servKeyValues = $_REQUEST['selectedServKeyValue']; } $certStatus = ""; if (!empty($_REQUEST['certificationStatus'])) { $certStatus = $_REQUEST['certificationStatus']; //set show closed as true if production status selected is 'closed' - otherwise // there will be no results if ($certStatus == 'Closed') { $showClosed = true; } } $thisPage = 'index.php?Page_Type=Services'; if ($serviceType != "") { $thisPage .= '&serviceType=' . $serviceType; } if ($searchTerm != "") { $thisPage .= '&searchTerm=' . $searchTerm; } if ($production != "") { $thisPage .= '&production=' . $production; } if ($monitored != "") { $thisPage .= '&monitored=' . $monitored; } if ($scope != "") { $thisPage .= '&scope=' . $scope; } if ($ngi != "") { $thisPage .= '&ngi=' . $ngi; } if ($certStatus != "") { $thisPage .= '&certStatus=' . $certStatus; } if ($showClosed != "") { $thisPage .= '&showClosed=' . $showClosed; } if ($servKeyNames != "") { $thisPage .= '&servKeyNames=' . $servKeyNames; } if ($servKeyValues != "") { $thisPage .= '&servKeyValues=' . $servKeyValues; } if ($searchTerm != null || $searchTerm != "") { if (substr($searchTerm, 0, 1) != '%') { $searchTerm = '%' . $searchTerm; } if (substr($searchTerm, -1) != '%') { $searchTerm = $searchTerm . '%'; } } $numResults = $seServ->getSesCount($searchTerm, $serviceType, $production, $monitored, $scope, $ngi, $certStatus, $showClosed, $servKeyNames, $servKeyValues, null, null, false); $firstLink = $thisPage . "&record=1"; // Set the "previous" link if ($startRecord > RECORDS_PER_PAGE) { // Not showing the first page of results so enable the previous link $previousLink = $thisPage . "&record=" . ($startRecord - RECORDS_PER_PAGE); } else { // First page of results, disable previous button $previousLink = $thisPage . "&record=" . 0; } // Set the "Next" link // not the last page of results, normal next link if ($numResults - $startRecord > RECORDS_PER_PAGE) { $nextLink = $thisPage . "&record=" . ($startRecord + RECORDS_PER_PAGE); } else { // last page of results, disable next link $nextLink = $thisPage . '&record=' . ($numResults - RECORDS_PER_PAGE + 1); } $lastLink = $thisPage . "&record=" . ($numResults + 1 - RECORDS_PER_PAGE); // $startRecord + RECORDS_PER_PAGE "-1" because record 1 in the web portal == record 0 from DB $ses = $seServ->getSes($searchTerm, $serviceType, $production, $monitored, $scope, $ngi, $certStatus, $showClosed, $servKeyNames, $servKeyValues, $startRecord - 1, RECORDS_PER_PAGE, false); $endRecord = $startRecord + RECORDS_PER_PAGE - 1; /* Due to differences in counting, startRecord is still set to 1 * even if there are zero results. If this is the case it's * zero here to display accurately in the portal. */ if (count($ses) == 0) { $startRecord = 0; } /* Doctrine will provide keynames that are the same even when selecting distinct becase the object * is distinct even though the name is not unique. To avoid showing the same name repeatdly in the filter * we will load all the keynames into an array before making it unique */ $keynames = array(); foreach ($exServ->getServiceExtensionsKeyNames() as $extension) { $keynames[] = $extension->getKeyName(); } $keynames = array_unique($keynames); $serv = \Factory::getSiteService(); $params['scopes'] = \Factory::getScopeService()->getScopes(); $params['serviceTypes'] = $seServ->getServiceTypes(); $params['servKeyNames'] = $keynames; $params['selectedServiceType'] = $serviceType; $params['searchTerm'] = $searchTerm; $params['services'] = $ses; $params['totalServices'] = $numResults; $params['startRecord'] = $startRecord; $params['endRecord'] = $endRecord; $params['firstLink'] = $firstLink; $params['previousLink'] = $previousLink; $params['nextLink'] = $nextLink; $params['lastLink'] = $lastLink; $params['ngis'] = \Factory::getNgiService()->getNGIs(); $params['certStatuses'] = $serv->getCertStatuses(); $params['showClosed'] = $showClosed; $params['selectedProduction'] = $production; $params['selectedMonitored'] = $monitored; $params['selectedScope'] = $scope; $params['selectedNgi'] = $ngi; $params['selectedClosed'] = $showClosed; $params['selectedCertStatus'] = $certStatus; $params['selectedServKeyNames'] = $servKeyNames; $params['selectedServKeyValue'] = $servKeyValues; show_view("service/view_all.php", $params, "Services"); }
function remove_scope() { //The following line will be needed if this controller is ever used for non administrators: //checkPortalIsNotReadOnlyOrUserIsAdmin($user); //Check user has permission checkUserIsAdmin(); if (!isset($_REQUEST['id']) || !is_numeric($_REQUEST['id'])) { throw new Exception("An id must be specified"); } //Get the scope from the id $serv = \Factory::getScopeService(); $scope = $serv->getScope($_REQUEST['id']); //keep the name to display later $params['Name'] = $scope->getName(); //check to see if there are NGIs, Sites, Service Groups, & services, // with this scope tag. If there are, prevent deletion of it. $ngisWithScope = $serv->getNgisFromScope($scope); $sitesWithScope = $serv->getSitesFromScope($scope); $sGroupWithScope = $serv->getServiceGroupsFromScope($scope); $serviceWithScope = $serv->getServicesFromScope($scope); $deletionAllowed = true; if (sizeof($ngisWithScope) > 0) { $deletionAllowed = false; } if (sizeof($sitesWithScope) > 0) { $deletionAllowed = false; } if (sizeof($sGroupWithScope) > 0) { $deletionAllowed = false; } if (sizeof($serviceWithScope) > 0) { $deletionAllowed = false; } //Allow the deletion of scopes that are in use $scopeInUseOveride = false; if (isset($_REQUEST['ScopeInUseOveride'])) { if ($_REQUEST['ScopeInUseOveride'] == 'true') { $scopeInUseOveride = true; $deletionAllowed = true; } } if ($deletionAllowed) { //Delete the scope. This fuction will check the user is allowed to //perform this action and throw an error if not. $dn = Get_User_Principle(); $user = \Factory::getUserService()->getUserByPrinciple($dn); try { $serv->deleteScope($scope, $user, $scopeInUseOveride); } catch (\Exception $e) { show_view('error.php', $e->getMessage()); die; } show_view("admin/deleted_scope.php", $params, $params['Name'] . 'deleted'); } else { $params['ID'] = $scope->getId(); $params['NGIs'] = $ngisWithScope; $params['Sites'] = $sitesWithScope; $params['ServiceGroups'] = $sGroupWithScope; $params['Services'] = $serviceWithScope; show_view('admin/delete_scope_denied.php', $params, "Scope still in use"); } }
/** * Draw the add service form * @param \User $user current user * @return null */ function draw($user) { if (is_null($user)) { throw new Exception("Unregistered users can't add a service ."); } /* Optional site parameter is set if a user clicked * "add SE to this site" on the view site page */ $site = null; if (isset($_REQUEST['siteId'])) { $site = \Factory::getSiteService()->getSite($_REQUEST['siteId']); if ($site == null) { throw new Exception('Invalid site'); } if (count(\Factory::getSiteService()->authorizeAction(\Action::SITE_ADD_SERVICE, $site, $user)) == 0) { throw new Exception('You do not have permission to add a service to this site'); } } // Add sites which user has required action permission to array. $allUserSites = \Factory::getUserService()->getSitesFromRoles($user); $sites = array(); foreach ($allUserSites as $s) { if (count(\Factory::getSiteService()->authorizeAction(\Action::SITE_ADD_SERVICE, $s, $user)) != 0) { $sites[] = $s; } } //For admin users, return all sites instead. if ($user->isAdmin()) { $sites = \Factory::getSiteService()->getSitesBy(); } if (count($sites) == 0 and !$user->isAdmin()) { throw new Exception("You need at least one NGI or Site level role to add a new service."); } $serviceTypes = \Factory::getServiceService()->getServiceTypes(); //If a site has been specified get scopes wit that sites scopes selected, otherwise get the default if (!is_null($serviceTypes) && $site instanceof \Site) { $scopes = \Factory::getScopeService()->getScopesSelectedArray($site->getScopes()); } else { $scopes = \Factory::getScopeService()->getDefaultScopesSelectedArray(); } //get the number of scopes that we require $numberScopesRequired = \Factory::getConfigService()->getMinimumScopesRequired('service'); // remove the deprecated CE type (temp hack) foreach ($serviceTypes as $key => $st) { if ($st->getName() == "CE") { unset($serviceTypes[$key]); } } $params = array('sites' => $sites, 'serviceTypes' => $serviceTypes, 'scopes' => $scopes, 'site' => $site, 'numberOfScopesRequired' => $numberScopesRequired); //Check that there is at least one Site available before allowing a user to add a service. if ($params['sites'] == null) { show_view('error.php', "GocDB requires one or more Sites to be able to add a service."); } show_view("service/add_service.php", $params); }
/** * Draws a form to add a new site * @param \User $user current user * @return null */ function draw(\User $user = null) { if (is_null($user)) { throw new Exception("Unregistered users can't add a new site"); } $siteService = \Factory::getSiteService(); //try { $siteService->addAuthorization($user); //} catch(Exception $e) { show_view('error.php', $e->getMessage()); die(); } if ($user->isAdmin()) { // if user is admin, then get all NGIs $userNGIs = \Factory::getNgiService()->getNGIs(); } else { // otherwise, get only the NGIs the non-admin user has roles over that support add_site $userNGIs = \Factory::getNgiService()->getNGIsBySupportedAction(Action::NGI_ADD_SITE, $user); if (count($userNGIs) == 0) { show_view('error.php', "You do not have permission to add a new site." . " To add a new site you require a managing role over an NGI"); die; } } $countries = $siteService->getCountries(); //$timezones = $siteService->getTimezones(); // Deprecated - don't use the lookup values in the GocDB $timezones = DateTimeZone::listIdentifiers(); $prodStatuses = $siteService->getProdStatuses(); //Remove SC and PPS infrastructures from drop down list. TODO: Delete this block once they no longer exist $SCInfrastructure = $siteService->getProdStatusByName('SC'); $PPSInfrastructure = $siteService->getProdStatusByName('PPS'); $hackprodStatuses = array(); foreach ($prodStatuses as $ps) { if ($ps != $SCInfrastructure and $ps != $PPSInfrastructure) { $hackprodStatuses[] = $ps; } } $prodStatuses = $hackprodStatuses; //delete up to here once pps and sc infrastructures have been removed from database $certStatuses = $siteService->getCertStatuses(); $scopes = \Factory::getScopeService()->getDefaultScopesSelectedArray(); $numberOfScopesRequired = \Factory::getConfigService()->getMinimumScopesRequired('site'); //$dDashNgis = \Factory::getUserService()->getDDashNgis($user); $params = array('ngis' => $userNGIs, 'countries' => $countries, 'timezones' => $timezones, 'prodStatuses' => $prodStatuses, 'certStatuses' => $certStatuses, 'scopes' => $scopes, 'numberOfScopesRequired' => $numberOfScopesRequired); //Check that there is at least one NGI available before allowing an add site. if ($params['ngis'] == null) { show_view('error.php', "GocDB requires one or more NGI's to be able to add a site."); } show_view("site/add_site.php", $params); die; }
/** * Draws the edit service group form * @param \User $user Current User * @return null */ function draw(\User $user = null) { $serv = \Factory::getServiceGroupService(); if (!isset($_REQUEST['id']) || !is_numeric($_REQUEST['id'])) { throw new Exception("An id must be specified"); } // Get the service group $sg = $serv->getServiceGroup($_REQUEST['id']); //try { $serv->editAuthorization($sg, $user); } catch(Exception $e) { // show_view('error.php', $e->getMessage()); die(); } if (count($serv->authorizeAction(\Action::EDIT_OBJECT, $sg, $user)) == 0) { show_view('error.php', 'You do not have permission to edit this ServiceGroup'); die; } // If the user is registered they're allowed to add a service group $configService = \Factory::getConfigService(); $scopes = \Factory::getScopeService()->getScopesSelectedArray($sg->getScopes()); $numberScopesRequired = $configService->getMinimumScopesRequired('service_group'); $params = array('serviceGroup' => $sg, 'scopes' => $scopes, 'numberOfScopesRequired' => $numberScopesRequired); show_view("service_group/edit_service_group.php", $params, "Edit " . $sg->getName()); }
function show_help() { $params['Scopes'] = \Factory::getScopeService()->getScopes(); show_view("scope_help.php", $params, "Scopes"); }
function showAllSites() { require_once __DIR__ . '/../../../../lib/Gocdb_Services/Factory.php'; $exServ = \Factory::getExtensionsService(); // Do we really need to validate the URL parameter values, as the query // to the DB always uses bind variables to protect against injection? require_once __DIR__ . '/../../../../lib/Gocdb_Services/Validate.php'; $validatorService = new \org\gocdb\services\Validate(); $ngi = '%%'; if (!empty($_GET['NGI'])) { $ngi = $_GET['NGI']; if (!$validatorService->validate('ngi', 'NAME', $ngi)) { throw new Exception("Invalid NGI parameter value"); } } $prodStatus = '%%'; if (!empty($_GET['prodStatus'])) { $prodStatus = $_GET['prodStatus']; } //must be done before the if certstatus in the block that sets $certStatus $showClosed = false; if (isset($_GET['showClosed'])) { $showClosed = true; } $certStatus = '%%'; if (!empty($_GET['certStatus'])) { $certStatus = $_GET['certStatus']; //set show closed as true if production status selected is 'closed' - otherwise // there will be no results if ($certStatus == 'Closed') { $showClosed = true; } } // Site extension property key name $siteKeyNames = ""; if (isset($_GET['siteKeyNames'])) { $siteKeyNames = $_GET['siteKeyNames']; } // Site extension property key value $siteKeyValues = ""; if (isset($_GET['selectedSiteKeyValue'])) { $siteKeyValues = $_GET['selectedSiteKeyValue']; } $scope = '%%'; if (!empty($_GET['scope'])) { $scope = $_GET['scope']; } $serv = \Factory::getSiteService(); $params['scopes'] = \Factory::getScopeService()->getScopes(); $params['sites'] = $serv->getSitesBy($ngi, $prodStatus, $certStatus, $scope, $showClosed, null, $siteKeyNames, $siteKeyValues); $params['NGIs'] = $serv->getNGIs(); $params['prodStatuses'] = $serv->getProdStatuses(); //Remove SC and PPS infrastructures from drop down list. TODO: Delete this block once they no longer exist $SCInfrastructure = $serv->getProdStatusByName('SC'); $PPSInfrastructure = $serv->getProdStatusByName('PPS'); $productionStatuses = array(); foreach ($params['prodStatuses'] as $ps) { if ($ps != $SCInfrastructure and $ps != $PPSInfrastructure) { $productionStatuses[] = $ps; } } $params['prodStatuses'] = $productionStatuses; //delete up to here once pps and sc infrastructures have been removed from database /* Doctrine will provide keynames that are the same even when selecting distinct becase the object * is distinct even though the name is not unique. To avoid showing the same name repeatdly in the filter * we will load all the keynames into an array before making it unique */ $keynames = array(); foreach ($exServ->getSiteExtensionsKeyNames() as $extension) { $keynames[] = $extension->getKeyName(); } $keynames = array_unique($keynames); $params['selectedNgi'] = $ngi; $params['certStatuses'] = $serv->getCertStatuses(); $params['selectedProdStatus'] = $prodStatus; $params['selectedCertStatus'] = $certStatus; $params['selectedScope'] = $scope; $params['showClosed'] = $showClosed; $params['siteKeyNames'] = $keynames; $params['selectedSiteKeyNames'] = $siteKeyNames; $params['selectedSiteKeyValue'] = $siteKeyValues; show_view("site/view_all.php", $params, "Sites"); }