public function execute(CommandContext $context) { if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'run_hall_overview')) { PHPWS_Core::initModClass('hms', 'exception/PermissionException.php'); throw new PermissionException('You do not have permission to see the Hall Overview.'); } PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php'); PHPWS_Core::initModClass('hms', 'HallOverview.php'); $hallId = $context->get('hallId'); if (!isset($hallId)) { throw new InvalidArgumentException('Missing hall ID.'); } $hall = new HMS_Residence_Hall($hallId); $hallOverview = new HallOverview($hall, TRUE); $context->setContent($hallOverview->show()); }
public function execute(CommandContext $context) { if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'run_hall_overview')) { PHPWS_Core::initModClass('hms', 'exception/PermissionException.php'); throw new PermissionException('You do not have permission to see the Hall Overview.'); } PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php'); PHPWS_Core::initModClass('hms', 'HallOverview.php'); $hallId = $context->get('hallId'); if (!isset($hallId)) { throw new InvalidArgumentException('Missing hall ID.'); } $hall = new HMS_Residence_Hall($hallId); // Check for a hall/term mismatch, since halls are indexed by ID and not by name & term if ($hall->term != Term::getSelectedTerm()) { $hallOverviewCmd = CommandFactory::getCommand('SelectResidenceHall'); $hallOverviewCmd->setTitle('Edit a Residence Hall'); $hallOverviewCmd->setOnSelectCmd(CommandFactory::getCommand('HallOverview')); $hallOverviewCmd->redirect(); } $hallOverview = new HallOverview($hall); $context->setContent($hallOverview->show()); }