public function execute(CommandContext $context) { PHPWS_Core::initModClass('hms', 'LotteryApplication.php'); PHPWS_Core::initModClass('hms', 'HousingApplication.php'); // Check permissions if (!Current_User::allow('hms', 'special_interest_approval')) { PHPWS_Core::initModClass('hms', 'exception/PermissionException.php'); throw new PermissionException('You do not have permission to approve special interest group requests.'); } // Must have ID and group name set. if (is_null($context->get('id'))) { throw new InvalidArgumentException('Missing application id.'); } if (is_null($context->get('group'))) { throw new InvalidArgumentException('Missing interest group name.'); } // Load up application. $app = new LotteryApplication($context->get('id')); // Unset proper preference in student's application. switch ($context->get('group')) { case 'watauga_global': $app->setWataugaGlobalPref(0); break; case 'honors': $app->setHonorsPref(0); break; case 'teaching': $app->setTeachingFellowsPref(0); break; case 'sorority': $app->setSororityPref(0); break; case 'special_needs': $app->setPhysicalDisability(0); $app->setPsychDisability(0); $app->setMedicalNeed(0); $app->setGenderNeed(0); break; } // Save, notify, and buh-bye $app->save(); NQ::simple('hms', hms\NotificationView::SUCCESS, "Denied {$app->getUsername()}"); $cmd = CommandFactory::getCommand('ShowSpecialInterestGroupApproval'); $cmd->setGroup($context->get('group')); $cmd->redirect(); }