Example #1
0
function displayRooms($curRoom)
{
    //global all variables
    global $locationForm, $tool;
    //make the tool bar for this page
    if ($_SESSION['access'] >= 50) {
        $toolNames = array("Edit Room", "Remove Room");
        $toolIcons = array("edit", "delete", "delete");
        $toolHandlers = array("handleEvent('location.php?action=editRooms&roomID=" . $_GET['roomID'] . "&locationID=" . $_GET['locationID'] . "&roomTypeID=" . $_GET['roomTypeID'] . "')", "handleEvent('location.php?action=removeRoom&roomID=" . $_GET['roomID'] . "&locationID=" . $_GET['locationID'] . "&roomTypeID=" . $_GET['roomTypeID'] . "')");
        echo $tool->createNewTools($toolNames, $toolIcons, $toolHandlers);
    }
    $roomHeader = array("Room Information");
    $roomTitle = array("Name", "Description", "Notes", "Room Number", "Location");
    $fieldType = array(2 => "text_are");
    $roomInfo = array($curRoom->get_name(), $curRoom->get_desc(), $curRoom->get_notes(), $curRoom->get_room_no(), $curRoom->get_location_name());
    if ($_GET['action'] == editRooms) {
        //THE CLIENT INFO
        $roomKey = array("name", "desc", "notes", "num");
        $fieldType = array(2 => "text_area", 4 => "static");
        $roomHeader = array("Room Info");
        $locationForm->setTitles($roomTitle);
        $locationForm->setData($roomInfo);
        $locationForm->setHeadings($roomHeader);
        $locationForm->setDatabase($roomKey);
        $locationForm->setUpdateValue("updateRoom");
        $locationForm->setFieldType($fieldType);
        echo $locationForm->editLocationForm();
    } else {
        if ($_GET['action'] == editRoomType) {
            $roomType = new RoomType($_GET['roomTypeID']);
            $roomTypeHeader = array("Room Type Info");
            $roomTypeKey = array("name", "desc");
            $roomTypeTitle = array("Name", "Description");
            $roomTypeInfo = array($roomType->get_name(), $roomType->get_desc());
            $locationForm->setTitles($roomTypeTitle);
            $locationForm->setData($roomTypeInfo);
            $locationForm->setHeadings($roomTypeHeader);
            $locationForm->setDatabase($roomTypeKey);
            $locationForm->setUpdateValue("updateRoomType");
            echo $locationForm->editLocationForm();
        } else {
            if ($_GET['action'] == showRooms) {
                //THE CLIENT INFO
                $locationForm->setTableWidth("1024px");
                $locationForm->setTitleWidth("50px");
                $locationForm->setTitles($roomTitle);
                $locationForm->setData($roomInfo);
                $locationForm->setHeadings($roomHeader);
                $locationForm->setSortable(false);
                $locationForm->setFirst(true);
                echo $locationForm->showInfoForm();
            }
        }
    }
}