/** * Create edit popup * @param Rank $p_oRank * @return string Code HTML */ private function createEditPopup($p_oRank) { $oPopup = new View('popup'); $oPopup->addData('id', $p_oRank->getId()); $oPopup->addData('buttonstyle', 'btn-primary'); $oPopup->addData('buttonicon', 'fa-edit'); $oPopup->addData('buttontext', Language::translate('RANKS_ADMIN_EDIT_EDIT')); $oPopup->addData('title', Language::translate('RANKS_ADMIN_EDIT_TITLE')); $oFormEdit = new FormGenerator(); $oFormEdit->setAction('index.php?p=adminranks&edit=' . $p_oRank->getId()); $oFormEdit->addInput(Language::translate('RANKS_ADMIN_EDIT_NAME'), 'name', true, false, 'text', '', $p_oRank->getName()); $oFormEdit->addCheckbox(Language::translate('RANKS_ADMIN_EDIT_DEFAULT'), 'default', $p_oRank->isDefault()); $oFormEdit->addCheckbox(Language::translate('RANKS_ADMIN_EDIT_DEL'), 'delete'); $oFormEdit->create(); $oPopup->addData('content', $oFormEdit->getCode()); $oPopup->create(); return $oPopup->getCode(); }
if ($do == 'create') { extract($_POST); Rank::create($name, $division, $abbrev, $paygrade); Event::addEvent('Rank ' . $name . ' has been created.', $_SESSION['user'], 1); } } } else { if ($action == 'delete') { if ($do == 'none') { ?> <a onclick="load('ranks', 'delete', 'delete', {id: '<?php echo $_GET['id']; ?> '})">Continue?</a> (<b>NOTE:</b> This action cannot be reversed!) <?php } else { if ($do == 'delete') { $ranks = new Rank($_GET['id']); $ranks->delete(); Event::addEvent('Rank ' . $ranks->getName() . ' has been deleted.', $_SESSION['user'], 3); ?> <script> load('ranks', 'none', 'none', {}); </script> <?php } } } } } }