class/Command/LotteryShowConfirmCommand.php
<?php
namespace Homestead\Command;
use \Homestead\LotteryConfirmView;
class LotteryShowConfirmCommand extends Command {
private $roomId;
private $roommates;
private $mealPlan;
public function setRoomId($id){
$this->roomId = $id;
}
public function setRoommates($roommates){
$this->roommates = $roommates;
}
public function setMealPlan($plan){
$this->mealPlan = $plan;
}
public function getRequestVars(){
$vars = array('action'=>'LotteryShowConfirm');
$vars['roomId'] = $this->roomId;
$vars['mealPlan'] = $this->mealPlan;
$vars['roommates'] = $this->roommates;
return $vars;
}
public function execute(CommandContext $context)
{
$roomId = $context->get('roomId');
$roommates = $context->get('roommates');
$mealPlan = $context->get('mealPlan');
if(empty($mealPlan) && !empty($context->get('meal_plan'))){
$mealPlan = $context->get('meal_plan');
}else{
$mealPlan = '1';
}
$term = \PHPWS_Settings::get('hms', 'lottery_term');
$view = new LotteryConfirmView($roomId, $mealPlan, $roommates, $term);
$context->setContent($view->show());
}
}