/** * Draws a form to move a site * @param \NGI $oldNgi NGI to which the site to be moved belongs * @return null */ function drawMoveSite(\NGI $oldNgi) { //Check the user has permission to see the page, will throw exception //if correct permissions are lacking checkUserIsAdmin(); //Get a list of sites and list of NGIs to select from $ngis = \Factory::getNgiService()->getNGIs(); $sites = $oldNgi->getSites(); //Put into an array to be passed to view $params = array('Ngis' => $ngis, 'sites' => $sites, 'OldNgi' => $oldNgi->getName()); show_view("admin/move_site.php", $params); }
/** * Creates an entry in the NGI archieve table, to enable auditing of * deletion. This code is designed to be run from within the try/catch * block within the single transaction of the delete NGI function. * Authorisation must have already been performed and the values come from * an existing object and so are assumed valid. May not work if unregistered * users are ever allowed to delete things. * @param \NGI $ngi * @param \User $user */ public function addNGIToArchive(\NGI $ngi, \User $user) { $archievedNgi = new \ArchivedNGI(); $archievedNgi->setDeletedBy($user->getCertificateDn()); $archievedNgi->setName($ngi->getName()); $archievedNgi->setOriginalCreationDate($ngi->getCreationDate()); $archievedNgi->setScopes($ngi->getScopeNamesAsString()); $projectNamesAsArray = array(); foreach ($ngi->getProjects() as $p) { $projectNamesAsArray[] = $p->getName(); } $projectNamesAsString = implode(", ", $projectNamesAsArray); $archievedNgi->setParentProjects($projectNamesAsString); $this->em->persist($archievedNgi); }