require_once('initialize.php');
import('form.Form');
-import('ttTeamHelper');
+import('ttAdmin');
-// Access check.
+// Access checks.
if (!ttAccessAllowed('administer_site')) {
header('Location: access_denied.php');
exit();
}
-
$group_id = (int)$request->getParameter('id');
-$team_details = ttTeamHelper::getTeamDetails($group_id);
-$team_name = $team_details['team_name'];
+$group_name = ttAdmin::getGroupName($group_id);
+if (!($group_id && $group_name)) {
+ header('Location: access_denied.php');
+ exit();
+}
+// End of access checks.
-$form = new Form('teamForm');
+$form = new Form('groupForm');
$form->addInput(array('type'=>'hidden','name'=>'id','value'=>$group_id));
$form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->get('label.delete')));
$form->addInput(array('type'=>'submit','name'=>'btn_cancel','value'=>$i18n->get('button.cancel')));
if ($request->isPost()) {
if ($request->getParameter('btn_delete')) {
- import('ttAdmin');
- $admin = new ttAdmin();
- $result = $admin->markGroupDeleted($group_id);
- if ($result) {
+ if (ttAdmin::markGroupDeleted($group_id)) {
header('Location: admin_groups.php');
exit();
} else
}
} // isPost
-$smarty->assign('team_to_delete', $team_name);
+$smarty->assign('group_to_delete', $group_name);
$smarty->assign('forms', array($form->getName()=>$form->toArray()));
$smarty->assign('title', $i18n->get('title.delete_group'));
$smarty->assign('content_page_name', 'admin_group_delete.tpl');