Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions class/ResidenceHallMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,6 @@ public function __construct()
$residenceHallCmd->setOnSelectCmd(CommandFactory::getCommand('EditResidenceHallView'));
$this->addCommand('Edit a residence hall', $residenceHallCmd);
}
if(Current_User::allow('hms', 'floor_view')){
$floorCmd = CommandFactory::getCommand('SelectFloor');
$floorCmd->setTitle('Edit a Floor');
$floorCmd->setOnSelectCmd(CommandFactory::getCommand('EditFloorView'));
$this->addCommand('Edit a floor', $floorCmd);
}
if(Current_User::allow('hms', 'room_view')){
$roomCmd = CommandFactory::getCommand('SelectRoom');
$roomCmd->setTitle('Edit a Room');
$roomCmd->setOnSelectCmd(CommandFactory::getCommand('EditRoomView'));
$this->addCommand('Edit a room', $roomCmd);
}
if(Current_User::allow('hms', 'bed_view')){
$bedCmd = CommandFactory::getCommand('SelectBed');
$bedCmd->setTitle('Edit a Bed');
$bedCmd->setOnSelectCmd(CommandFactory::getCommand('EditBedView'));
$this->addCommand('Edit a bed', $bedCmd);
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions class/SelectHallView.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public function show()
{
$tpl = array();

javascript('jquery');
javascriptMod('hms', 'hall_editor');

$tpl['TITLE'] = $this->title;
$tpl['TERM'] = Term::getPrintableSelectedTerm();

Expand Down
22 changes: 10 additions & 12 deletions class/command/AjaxGetBedsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class AjaxGetBedsCommand extends Command {
private $roomId;

public function getRequestVars(){
return array('action'=>'AjaxGetFloors');
return array('action'=>'AjaxGetBeds');
}

public function execute(CommandContext $context)
Expand All @@ -19,20 +19,18 @@ public function execute(CommandContext $context)

$room = new HMS_Room($context->get('roomId'));

$beds = $room->get_beds();
$bedsResult = $room->get_beds();

$json_beds = array();
$json_beds[0] = 'Select...';
$beds = array();
$i = 0;

foreach ($beds as $bed){
if($bed->room_change_reserved != 0){
//Cannot assign to reserved rooms
continue;
}
$json_beds[$bed->id] = $bed->bed_letter;
foreach ($bedsResult as $bed)
{
$beds[$i]['bed_letter'] = strtoupper($bed->getBedroomLabel()) . $bed->getLetter();
$beds[$i]['bed_id'] = $bed->getId();
$i++;
}

$context->setContent(json_encode($json_beds));
$context->setContent(json_encode($beds));
}
}

33 changes: 14 additions & 19 deletions class/command/AjaxGetFloorsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,21 @@ public function execute(CommandContext $context)

$hall = new HMS_Residence_Hall($context->get('hallId'));

$floors = $hall->get_floors();

#test($floors, 1);

$json_floors = array();
$json_floors[0] = 'Select...';

foreach ($floors as $floor){
unset($text);

$text = $floor->floor_number;

if($hall->gender_type == COED && $floor->gender_type != COED){
$text .= (' (' . HMS_Util::formatGender($floor->gender_type) . ')');
}

$json_floors[$floor->id] = $text;
$floorsResult = $hall->getFloors();

$floors = array();
$i = 0;

foreach ($floorsResult as $floor)
{
if(!empty($floor->get_rooms()))
{
$floors[$i]['floor_number'] = $floor->getFloorNumber();
$floors[$i]['floor_id'] = $floor->getId();
$i++;
}
}

$context->setContent(json_encode($json_floors));
$context->setContent(json_encode($floors));
}
}

34 changes: 34 additions & 0 deletions class/command/AjaxGetHallsCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

PHPWS_Core::initModClass('hms', 'Command.php');

class AjaxGetHallsCommand extends Command {

private $floorId;

public function getRequestVars(){
return array('action'=>'AjaxGetHalls');
}

public function execute(CommandContext $context)
{
PHPWS_Core::initModClass('hms', 'HMS_Floor.php');

$term = Term::getSelectedTerm();

$hallsResults = ResidenceHallFactory::getHallsForTerm($term);

$halls = array();

$i = 0;

foreach ($hallsResults as $hall)
{
$halls[$i]['hall_name'] = $hall->getHallName();
$halls[$i]['hall_id'] = $hall->getId();
$i++;
}

$context->setContent(json_encode($halls));
}
}
68 changes: 60 additions & 8 deletions class/command/AjaxGetRoomsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class AjaxGetRoomsCommand extends Command {
private $floorId;

public function getRequestVars(){
return array('action'=>'AjaxGetFloors');
return array('action'=>'AjaxGetRooms');
}

public function execute(CommandContext $context)
Expand All @@ -19,16 +19,68 @@ public function execute(CommandContext $context)

$floor = new HMS_Floor($context->get('floorId'));

$rooms = $floor->get_rooms();
$roomsResult = $floor->get_rooms();

$json_rooms = array();
$json_rooms[0] = 'Select...';
$rooms = array();
$i = 0;

foreach ($rooms as $room){
$json_rooms[$room->id] = $room->room_number;
foreach ($roomsResult as $room)
{
$text = $room->getRoomNumber();

if($floor->gender_type == COED){
$text .= (' (' . HMS_Util::formatGender($room->gender_type) . ')');
}

if($room->ra == 1){
$text .= (' (RA)');
}

if($room->reserved == 1)
{
$text .= (' (Reserved)');
}

if($room->offline == 1)
{
$text .= (' (Offline)');
}

if($room->private == 1)
{
$text .= (' (Private)');
}

if($room->overflow == 1)
{
$text .= (' (Overflow)');
}

if($room->parlor == 1)
{
$text .= (' (Parlor)');
}

if($room->ada == 1)
{
$text .= (' (ADA)');
}

if($room->hearing_impaired == 1)
{
$text .= (' (Hearing Impaired)');
}

if($room->bath_en_suite)
{
$text .= (' (Bath En Suite)');
}

$rooms[$i]['room_number'] = $text;
$rooms[$i]['room_id'] = $room->getId();
$i++;
}

$context->setContent(json_encode($json_rooms));
$context->setContent(json_encode($rooms));
}
}

Loading