public function execute() { PHPWS_Core::initModClass('hms', 'HousingApplication.php'); PHPWS_Core::initModClass('hms', 'HMS_Util.php'); // Select all cancelled apps for the given term $db = new PHPWS_DB('hms_new_application'); $db->addWhere('cancelled', 1); $db->addWhere('term', $this->term); $results = $db->select(); // Initialize storage for processed rows $this->rows = array(); // Get friendly cancellation reasons from HousingApplication $reasons = HousingApplication::getCancellationReasons(); // Process and store each result foreach ($results as $app) { $row = array(); $row['bannerId'] = $app['banner_id']; $row['username'] = $app['username']; $row['gender'] = HMS_Util::formatGender($app['gender']); $row['application_term'] = $app['application_term']; $row['student_type'] = $app['student_type']; $row['cancelled_reason'] = $reasons[$app['cancelled_reason']]; $row['cancelled_on'] = HMS_Util::get_long_date($app['cancelled_on']); $row['cancelled_by'] = $app['cancelled_by']; $this->rows[] = $row; } }
public function execute() { PHPWS_Core::initModClass('hms', 'HMS_Util.php'); $term = $this->term; $db = new PHPWS_DB('hms_checkin'); // Join hall structure $db->addJoin('', 'hms_checkin', 'hms_hall_structure', 'bed_id', 'bedid'); $db->addColumn('hms_checkin.banner_id'); $db->addColumn('hms_checkin.checkin_date'); $db->addColumn('hms_hall_structure.hall_name'); $db->addColumn('hms_hall_structure.room_number'); $db->addWhere('hms_checkin.term', $term); $db->addWhere('hms_checkin.checkout_date', null, 'IS NULL'); // Sort by hall, then room number $db->addOrder(array('hms_hall_structure.hall_name ASC', 'hms_hall_structure.room_number ASC')); $results = $db->select(); if (PHPWS_Error::isError($results)) { throw new DatabaseException($results->toString()); } // Post-processing, cleanup, making it pretty foreach ($results as $row) { // Updates counts $this->total++; $row['checkin_date'] = HMS_Util::get_short_date_time($row['checkin_date']); // Copy the cleaned up row to the member var for data $this->data[] = $row; } }
public function show() { $tpl = array(); $tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate); $tpl['STATUS'] = ""; if (time() < $this->startDate) { $tpl['ICON'] = FEATURE_NOTYET_ICON; $tpl['BEGIN_DEADLINE'] = HMS_Util::getFriendlyDate($this->startDate); } else { if (time() > $this->endDate) { $tpl['ICON'] = FEATURE_LOCKED_ICON; // fade out header $tpl['STATUS'] = "locked"; $tpl['END_DEADLINE'] = HMS_Util::getFriendlyDate($this->endDate); } else { if (is_null($this->profile)) { $tpl['ICON'] = FEATURE_OPEN_ICON; $tpl['NO_PROFILE'] = ''; } else { $tpl['ICON'] = FEATURE_COMPLETED_ICON; $searchCmd = CommandFactory::getCommand('ShowRoommateProfileSearch'); $searchCmd->setTerm($this->term); $tpl['SEARCH_ROOMMATES'] = $searchCmd->getLink('Search roommate profiles.'); } } } return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/searchProfilesMenuBlock.tpl'); }
public function show() { PHPWS_Core::initModClass('hms', 'HMS_Util.php'); $tpl = array(); $tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate); $tpl['STATUS'] = ""; if (!is_null($this->application) && $this->application->getApplicationType() == 'offcampus_waiting_list') { $tpl['ICON'] = FEATURE_COMPLETED_ICON; $tpl['ALREADY_APPLIED'] = ""; } else { if (time() < $this->startDate) { $tpl['ICON'] = FEATURE_NOTYET_ICON; $tpl['BEGIN_DEADLINE'] = HMS_Util::getFriendlyDate($this->startDate); } else { if (time() > $this->endDate) { $tpl['ICON'] = FEATURE_LOCKED_ICON; // fade out header $tpl['STATUS'] = "locked"; $tpl['END_DEADLINE'] = HMS_Util::getFriendlyDate($this->endDate); } else { //TODO $tpl['ICON'] = FEATURE_OPEN_ICON; $waitListCommand = CommandFactory::getCommand('ShowOffCampusWaitListApplication'); $waitListCommand->setTerm($this->term); $tpl['WAIT_LIST_LINK'] = $waitListCommand->getLink('Apply to the waiting list'); } } } return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/OffCampusWaitingListMenuBlock.tpl'); }
public function execute(CommandContext $context) { if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'search')) { PHPWS_Core::initModClass('hms', 'exception/PermissionException.php'); throw new PermissionException('You do not have permission to lookup student names!'); } $student = null; $error = new JsonError(403); $username = $context->get('username'); $banner_id = (int) $context->get('banner_id'); try { if ($banner_id) { $student = StudentFactory::getStudentByBannerID($banner_id, Term::getSelectedTerm()); } elseif (!empty($username)) { $student = StudentFactory::getStudentByUsername($username, Term::getSelectedTerm()); } else { $error->setMessage('Did not receive Banner ID or user name.'); $context->setContent(json_encode($error)); } $student->gender_string = HMS_Util::formatGender($student->gender); $context->setContent(json_encode($student)); } catch (\StudentNotFoundException $e) { $error->setMessage($e->getMessage()); $context->setContent(json_encode($error)); } }
public function execute() { PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php'); PHPWS_Core::initModClass('hms', 'HMS_Util.php'); $halls = HMS_Residence_Hall::get_halls($this->term); $rows = array(); foreach ($halls as $hall) { if ($hall->count_avail_lottery_rooms('1') || $hall->count_avail_lottery_rooms('0')) { $row = array(); $row['HALL_NAME'] = $hall->getHallName(); $row['MALE_FREE'] = $hall->count_avail_lottery_rooms('1'); $row['FEMALE_FREE'] = $hall->count_avail_lottery_rooms('0'); $rooms = $hall->get_rooms(); $roomRows = ""; foreach ($rooms as $room) { if ($room->count_avail_lottery_beds() > 0) { $roomRow = "<tr><td>"; $roomRow = $roomRow . $room->getRoomNumber(); $roomRow = $roomRow . "</td><td>"; $roomRow = $roomRow . HMS_Util::formatGender($room->getGender()); $roomRow = $roomRow . "</td><td>"; $roomRow = $roomRow . $room->count_avail_lottery_beds(); $roomRow = $roomRow . "</td></tr>"; $roomRows = $roomRows . $roomRow; } } $row['ROOMS'] = $roomRows; $rows[] = $row; } } $this->data = $rows; }
public function show() { PHPWS_Core::initModClass('hms', 'HMS_Util.php'); $tpl = array(); $tpl['TITLE'] = 'Edit Move-in Times'; $form = new PHPWS_Form(); $form->addDropBox('begin_day', HMS_Util::get_days()); $form->addCssClass('begin_day', 'form-control'); $form->addDropBox('begin_month', HMS_Util::get_months()); $form->addCssClass('begin_month', 'form-control'); $form->addDropBox('begin_year', HMS_Util::get_years_2yr()); $form->addCssClass('begin_year', 'form-control'); $form->addDropBox('begin_hour', HMS_Util::get_hours()); $form->addCssClass('begin_hour', 'form-control'); $form->addDropBox('end_day', HMS_Util::get_days()); $form->addCssClass('end_day', 'form-control'); $form->addDropBox('end_month', HMS_Util::get_months()); $form->addCssClass('end_month', 'form-control'); $form->addDropBox('end_year', HMS_Util::get_years_2yr()); $form->addCssClass('end_year', 'form-control'); $form->addDropBox('end_hour', HMS_Util::get_hours()); $form->addCssClass('end_hour', 'form-control'); $form->addSubmit('submit', 'Create'); $cmd = CommandFactory::getCommand('CreateMoveinTime'); $cmd->initForm($form); $tpl['MOVEIN_TIME_PAGER'] = HMS_Movein_Time::get_movein_times_pager(); $form->mergeTemplate($tpl); $tpl = $form->getTemplate(); Layout::addPageTitle("Move-in Times"); return PHPWS_Template::process($tpl, 'hms', 'admin/edit_movein_time.tpl'); }
public function show() { $tpl = array(); PHPWS_Core::initModClass('hms', 'HMS_Util.php'); $tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate); if (is_null($this->application)) { // No application $tpl['ICON'] = FEATURE_NOTYET_ICON; $tpl['NOT_APP'] = ""; // this needs to be here to trigger the line in the template } else { if (time() < $this->startDate) { // too early $tpl['BEGIN_DEADLINE'] = HMS_Util::getFriendlyDate($this->startDate); $tpl['ICON'] = FEATURE_NOTYET_ICON; } else { if (time() > $this->endDate) { // too late $tpl['ICON'] = FEATURE_LOCKED_ICON; $tpl['END_DEADLINE'] = HMS_Util::getFriendlyDate($this->endDate); } else { $tpl['ICON'] = FEATURE_OPEN_ICON; $cmd = CommandFactory::getCommand('ShowEmergencyContactForm'); $cmd->setTerm($this->application->getTerm()); $tpl['UPDATE_CONTACT'] = $cmd->getLink('update your emergency contact info'); } } } return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/updateEmergencyContactMenuBlock.tpl'); }
public function show() { $tpl = array(); $tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate); $tpl['STATUS'] = ""; if (isset($this->profile) && !is_null($this->profile)) { $tpl['ICON'] = FEATURE_COMPLETED_ICON; $editCmd = CommandFactory::getCommand('ShowRoommateProfileForm'); $editCmd->setTerm($this->term); $tpl['EDIT_PROFILE'] = $editCmd->getLink('view and edit your profile'); } else { if (time() < $this->startDate) { $tpl['ICON'] = FEATURE_LOCKED_ICON; $tpl['BEGIN_DEADLINE'] = HMS_Util::getFriendlyDate($this->startDate); } else { if (time() > $this->endDate) { $tpl['END_DEADLINE'] = HMS_Util::getFriendlyDate($this->endDate); // fade out header $tpl['STATUS'] = "locked"; $tpl['ICON'] = FEATURE_LOCKED_ICON; } else { $tpl['ICON'] = FEATURE_OPEN_ICON; $createCmd = CommandFactory::getCommand('ShowRoommateProfileForm'); $createCmd->setTerm($this->term); $tpl['CREATE_PROFILE'] = $createCmd->getLink('Create your profile'); } } } return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/StudentProfileMenuBlock.tpl'); }
public function execute(CommandContext $context) { $newrows = array(); $pdo = PdoFactory::getPdoInstance(); $floor_id = (int) $context->get('floorId'); $query = <<<EOF select\troom.id as room_id, \troom.room_number, \troom.gender_type, \tbed.id as bed_id, \tbed.bedroom_label, \tbed.bed_letter, \tassign.banner_id, \tassign.meal_option, assign.asu_username from \thms_room as room \tfull join \t\thms_bed as bed on room.id=bed.room_id \tfull join \t\thms_assignment as assign on bed.id=assign.bed_id where\troom.floor_id = :floor_id order by room_number asc, bedroom_label, bed_letter; EOF; $prep = $pdo->prepare($query); $prep->execute(array(':floor_id' => $floor_id)); $rows = $prep->fetchAll(PDO::FETCH_ASSOC); if (empty($rows)) { $context->setContent(json_encode(array())); return; } $count = -1; $room_number_track = 0; foreach ($rows as $k => $v) { $gender = HMS_Util::formatGender($v['gender_type']); if ($v['banner_id']) { $student = StudentFactory::getStudentByBannerID($v['banner_id'], Term::getSelectedTerm()); if ($student) { $v['student'] = $student->first_name . ' ' . $student->last_name; } else { $v['student'] = null; } } else { $v['student'] = null; } if ($v['room_number'] != $room_number_track) { $count++; $newrows[$count]['room_number'] = $v['room_number']; $newrows[$count]['gender'] = $gender; $newrows[$count]['beds'][] = $v; $room_number_track = $v['room_number']; } else { $newrows[$count]['beds'][] = $v; } } $context->setContent(json_encode($newrows)); }
public function getRowTags() { $delete_cmd = CommandFactory::getCommand('DeleteMoveinTime'); $delete_cmd->setId($this->id); $tags = array(); $tags['BEGIN_TIMESTAMP'] = HMS_Util::get_long_date_time($this->begin_timestamp); $tags['END_TIMESTAMP'] = HMS_Util::get_long_date_time($this->end_timestamp); $tags['ACTION'] = $delete_cmd->getLink('Delete'); return $tags; }
public function show() { $tpl = array(); if (empty($this->housingApps)) { $tpl['APPLICATIONS_EMPTY'] = 'No applications found.'; return PHPWS_Template::process($tpl, 'hms', 'admin/profileHousingAppList.tpl'); } // Include javascript for cancel application jquery dialog $jsParams = array('LINK_SELECT' => '.cancelAppLink'); javascript('profileCancelApplication', $jsParams, 'mod/hms/'); $app_rows = ""; // Get the list of cancellation reasons $reasons = HousingApplication::getCancellationReasons(); // Show a row for each application foreach ($this->housingApps as $app) { $term = Term::toString($app->getTerm()); $mealPlan = HMS_Util::formatMealOption($app->getMealPlan()); $phone = HMS_Util::formatCellPhone($app->getCellPhone()); $type = $app->getPrintableAppType(); // Clean/dirty and early/late preferences are only fields on the FallApplication if ($app instanceof FallApplication && isset($app->room_condition)) { $clean = $app->room_condition == 1 ? 'Neat' : 'Cluttered'; } else { $clean = ''; } if ($app instanceof FallApplication && isset($app->preferred_bedtime)) { $bedtime = $app->preferred_bedtime == 1 ? 'Early' : 'Late'; } else { $bedtime = ''; } $viewCmd = CommandFactory::getCommand('ShowApplicationView'); $viewCmd->setAppId($app->getId()); $view = $viewCmd->getURI(); $row = array('term' => $term, 'type' => $type, 'meal_plan' => $mealPlan, 'cell_phone' => $phone, 'clean' => $clean, 'bedtime' => $bedtime, 'view' => $view); if ($app->isCancelled()) { $reInstateCmd = CommandFactory::getCommand('ReinstateApplication'); $reInstateCmd->setAppID($app->getId()); $row['reinstate'] = $reInstateCmd->getURI(); $cancelledReason = "({$reasons[$app->getCancelledReason()]})"; $row['cancelledReason'] = $cancelledReason; $row['row_style'] = 'warning'; } else { // Show Cancel Command, if user has permission to cancel apps if (Current_User::allow('hms', 'cancel_housing_application')) { $cancelCmd = CommandFactory::getCommand('ShowCancelHousingApplication'); $cancelCmd->setHousingApp($app); $cancel = $cancelCmd->getURI(); $row['cancel'] = $cancel; } } $app_rows[] = $row; } $tpl['APPLICATIONS'] = $app_rows; return PHPWS_Template::process($tpl, 'hms', 'admin/profileHousingAppList.tpl'); }
public function show() { PHPWS_Core::initModClass('hms', 'HMS_Lottery.php'); PHPWS_Core::initModClass('hms', 'HMS_Bed.php'); PHPWS_Core::initModClass('hms', 'StudentFactory.php'); PHPWS_Core::initModClass('hms', 'HMS_Util.php'); # Get the roommate request record from the database $bed = new HMS_Bed($this->request['bed_id']); $room = $bed->get_parent(); $tpl = array(); $requestor = StudentFactory::getStudentByUsername($this->request['requestor'], $this->term); $tpl['REQUESTOR'] = $requestor->getName(); $tpl['HALL_ROOM'] = $bed->where_am_i(); # List all the students which will be assigned and their beds $beds = $room->get_beds(); foreach ($beds as $bed) { $bed_row = array(); # Check for an assignment $bed->loadAssignment(); # Check for a reservation $reservation = $bed->get_lottery_reservation_info(); $bed_row['BEDROOM_LETTER'] = $bed->bedroom_label; if ($bed->_curr_assignment != NULL) { # Bed is assigned $roommate = StudentFactory::getStudentByUsername($bed->_curr_assignment->asu_username, $this->term); $bed_row['TEXT'] = $roommate->getName(); } else { if ($reservation != NULL) { # Bed is reserved $roommate = StudentFactory::getStudentByUsername($reservation['asu_username'], $this->term); $bed_row['TEXT'] = $roommate->getName() . ' (reserved)'; } else { $bed_row['TEXT'] = 'Empty'; } } $tpl['beds'][] = $bed_row; } $tpl['MEAL_PLAN'] = HMS_Util::formatMealOption($this->mealPlan); PHPWS_Core::initCoreClass('Captcha.php'); $tpl['CAPTCHA'] = Captcha::get(); $submitCmd = CommandFactory::getCommand('LotteryConfirmRoommateRequest'); $submitCmd->setRequestId($this->request['id']); $submitCmd->setMealPlan($this->mealPlan); $form = new PHPWS_Form(); $submitCmd->initForm($form); $form->addSubmit('confirm', 'Confirm Roommate'); $form->mergeTemplate($tpl); $tpl = $form->getTemplate(); Layout::addPageTitle("Lottery Confirm Roommate"); return PHPWS_Template::process($tpl, 'hms', 'student/lottery_confirm_roommate_request.tpl'); }
public function getRowTags() { // Get the damage types, if we don't already have them if (!isset(self::$damageTypes)) { self::$damageTypes = DamageTypeFactory::getDamageTypeAssoc(); } $row = array(); $row['CATEGORY'] = $row['DAMAGE_TYPE'] = self::$damageTypes[$this->getDamageType()]['category']; $row['DESCRIPTION'] = self::$damageTypes[$this->getDamageType()]['description']; $row['SIDE'] = $this->getSide(); $row['TERM'] = Term::toString($this->getTerm()); $row['REPORTED_ON'] = HMS_Util::get_long_date($this->getReportedOn()); return $row; }
public function execute(CommandContext $context) { $pdo = PdoFactory::getPdoInstance(); $hall_id = (int) $context->get('hallId'); $prep = $pdo->prepare('select id, floor_number, gender_type from hms_floor where residence_hall_id=? and is_online=1 order by floor_number'); $prep->execute(array($hall_id)); $rows = $prep->fetchAll(PDO::FETCH_ASSOC); if (empty($rows)) { return null; } foreach ($rows as $k => $r) { $gender = HMS_Util::formatGender($r['gender_type']); $rows[$k]['title'] = $r['floor_number'] . ' - ' . $gender; } $context->setContent(json_encode($rows)); }
/** * Returns the full CSV output as one long string. * * @return String CSV output */ public function getOutput() { // Get the columns from the report $columns = $this->report->getCsvColumnsArray(); // Add a copule of meta-data fields $columns[] = HMS_Util::get_long_date_time($this->report->getCompletedTimestamp()); $columns[] = $this->report->getCreatedBy(); $columns[] = Term::toString($this->report->getTerm()); $output = self::sputcsv($columns); $rows = $this->report->getCsvRowsArray(); if (isset($rows) && !empty($rows)) { foreach ($rows as $cols) { $output .= self::sputcsv($cols); } } return $output; }
public function show() { $tpl = array(); $tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate); // Don't show the app-feature if it's not time if ($this->startDate <= time()) { $cmd = CommandFactory::getCommand('ShowVerifyAssignment'); $cmd->setUsername($this->student->getUsername()); $tpl['VIEW_APP'] = $cmd->getLink('here'); $tpl['ICON'] = FEATURE_OPEN_ICON; return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/verifyAssignmentMenuBlock.tpl'); } else { $tpl['BEGIN_DEADLINE'] = HMS_Util::getFriendlyDate($this->startDate); $tpl['ICON'] = FEATURE_NOTYET_ICON; return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/verifyAssignmentMenuBlock.tpl'); } }
public function show() { PHPWS_Core::initModClass('hms', 'RoomChangeParticipantFactory.php'); $tpl = array(); PHPWS_Core::initModClass('hms', 'HMS_Util.php'); $tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate); if (time() < $this->startDate) { // too early $tpl['BEGIN_DEADLINE'] = HMS_Util::getFriendlyDate($this->startDate); $tpl['ICON'] = FEATURE_NOTYET_ICON; } else { if (time() > $this->endDate) { // too late $tpl['ICON'] = FEATURE_LOCKED_ICON; $tpl['END_DEADLINE'] = HMS_Util::getFriendlyDate($this->endDate); } else { if (is_null($this->assignment)) { // Not assigned anywhere $tpl['ICON'] = FEATURE_NOTYET_ICON; $tpl['NOT_ASSIGNED'] = ""; } else { if (!is_null($this->changeRequest) && !$this->changeRequest->getState() instanceof CompletedChangeRequest && !$this->changeRequest->getState() instanceof DeniedChangeRequest) { // has pending request // Currently has a request open, so check to see if this student has approved it $participant = RoomChangeParticipantFactory::getParticipantByRequestStudent($this->changeRequest, $this->student); $state = $participant->getState(); // If this student needs to approve their part of this request if ($state instanceof ParticipantStateNew) { $approvalCmd = CommandFactory::getCommand('ShowRoomChangeRequestApproval'); $tpl['APPROVAL_CMD'] = $approvalCmd->getLink('View the request'); } else { // Request if pending, but this student doesn't need to do anything $tpl['PENDING'] = ""; } $tpl['ICON'] = FEATURE_OPEN_ICON; } else { $tpl['ICON'] = FEATURE_OPEN_ICON; $changeReqCmd = CommandFactory::getCommand('ShowRoomChangeRequestForm'); $tpl['NEW_REQUEST'] = $changeReqCmd->getLink('request a room change'); } } } } return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/roomChangeMenuBlock.tpl'); }
public function show() { PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php'); PHPWS_Core::initModClass('hms', 'HMS_Util.php'); PHPWS_Core::initModClass('filecabinet', 'Cabinet.php'); $hall = new HMS_Residence_Hall($this->hallId); $tpl = array(); $tpl['HALL'] = $hall->hall_name; if (isset($hall->exterior_image_id)) { $tpl['EXTERIOR_IMAGE'] = Cabinet::getTag($hall->exterior_image_id); } if (isset($hall->room_plan_image_id) && $hall->room_plan_image_id != 0) { $file = Cabinet::getFile($hall->room_plan_image_id); $tpl['ROOM_PLAN_IMAGE'] = $file->parentLinked(); } if (isset($hall->map_image_id)) { $tpl['MAP_IMAGE'] = Cabinet::getTag($hall->map_image_id); } if (isset($hall->other_image_id) && $hall->other_image_id != 0 && $hall->other_image_id != '0') { $file = Cabinet::getFile($hall->other_image_id); $tpl['OTHER_IMAGE'] = $file->parentLinked(); } if ($this->rlcAssignment != null && ($this->rlcAssignment->getStateName() == 'confirmed' || $this->rlcAssignment->getStateName() == 'selfselect-invite')) { $rlcId = $this->rlcAssignment->getRlc()->getId(); } else { $rlcId = null; } $floors = $hall->get_floors(); foreach ($floors as $floor) { $row = array(); if ($floor->count_avail_lottery_rooms($this->student->getGender(), $rlcId) <= 0) { $row['FLOOR'] = HMS_Util::ordinal($floor->floor_number); $row['ROW_TEXT_COLOR'] = 'class="text-muted"'; $tpl['floor_list'][] = $row; continue; } $floorCmd = CommandFactory::getCommand('LotteryChooseFloor'); $floorCmd->setFloorId($floor->id); $row['FLOOR'] = $floorCmd->getLink(HMS_Util::ordinal($floor->floor_number) . ' floor'); $row['ROW_TEXT_COLOR'] = 'grey'; $tpl['floor_list'][] = $row; } Layout::addPageTitle("Choose Floor"); return PHPWS_Template::process($tpl, 'hms', 'student/lottery_choose_floor.tpl'); }
protected function render() { parent::render(); PHPWS_Core::initModClass('hms', 'HMS_Util.php'); $this->tpl['TERM'] = Term::toString($this->report->getTerm()); $rows = array(); $totalCancellations = 0; foreach ($this->report->getTypeCounts() as $type => $count) { $row = array(); $row['TYPE'] = HMS_Util::formatType($type); $row['COUNT'] = $count; $rows[] = $row; $totalCancellations += $count; } $this->tpl['TABLE_ROWS'] = $rows; $this->tpl['TOTAL_CANCELLATIONS'] = $totalCancellations; return PHPWS_Template::process($this->tpl, 'hms', 'admin/reports/CancelledAppsByType.tpl'); }
public function execute() { $db = new PHPWS_DB(); $query = <<<EOF SELECT assign.banner_id, assign.asu_username, bed.bed_letter, bed.bedroom_label, room.room_number, floor.floor_number, hall.hall_name FROM hms_assignment as assign LEFT JOIN hms_bed as bed on assign.bed_id=bed.id LEFT JOIN hms_room as room on bed.room_id=room.id LEFT JOIN hms_floor as floor on room.floor_id=floor.id LEFT JOIN hms_residence_hall as hall on floor.residence_hall_id=hall.id WHERE assign.term = '{$this->term}' ORDER BY hall.hall_name, floor.floor_number, room.room_number, bed.bedroom_label, bed.bed_letter EOF; $result = $db->select(null, $query); if (PEAR::isError($result)) { throw new DatabaseException($result->toString()); } $final_rows = array(); foreach ($result as $row) { $hall_name = $row['hall_name']; $student = StudentFactory::getStudentByBannerId($row['banner_id'], $this->term); $row['name'] = $student->getFullName(); $row['dob'] = $student->getDOB(); $row['year'] = $student->getClass(); $row['gender'] = HMS_Util::formatGender($student->getGender()); $final_rows[$hall_name][] = $row; } $this->rows =& $final_rows; }
public function show() { $tpl = array(); $submitCmd = CommandFactory::getCommand('SendRlcInvites'); $form = new PHPWS_Form(); $submitCmd->initForm($form); $tpl['RESPOND_BY_DATE'] = javascript('datepicker', array('name' => 'respond_by_date', 'id' => 'respond_by_date')); $tpl['TERM'] = Term::toString(Term::getSelectedTerm()); PHPWS_Core::initModClass('hms', 'HMS_Util.php'); $form->addDropBox('time', HMS_Util::get_hours()); $form->setMatch('time', '17'); $form->setClass('time', 'form-control'); $form->addRadioAssoc('type', array('freshmen' => 'Freshmen', 'returning' => 'Continuing')); $form->addSubmit('submit', 'Send Invites'); $form->setClass('submit', 'btn btn-primary'); $form->mergeTemplate($tpl); $tpl = $form->getTemplate(); return PHPWS_Template::process($tpl, 'hms', 'admin/sendRlcInvites.tpl'); }
public function execute(CommandContext $context) { PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php'); PHPWS_Core::initModClass('hms', 'HMS_Util.php'); //TODO check for a hallId $hall = new HMS_Residence_Hall($context->get('hallId')); $floors = $hall->getFloorsWithVacancies(); $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; } $context->setContent(json_encode($json_floors)); }
protected function render() { parent::render(); $this->tpl['TERM'] = Term::toString($this->report->getTerm()); $halls = $this->report->getHalls(); // Need to create our own Template object $myTpl = new PHPWS_Template('hms'); $myTpl->setFile('admin/reports/AssignmentTypeByFloor.tpl'); // Set the existing tags $myTpl->setData($this->tpl); $hallTags = array(); foreach ($halls as $hall) { $hallCounts = $this->report->getCountsForHall($hall); // Hall totals summary foreach ($hallCounts as $hallCount) { $myTpl->setCurrentBlock('hall_totals'); $myTpl->setData(array('HALL_TOTAL_TYPE' => constant($hallCount['reason']), 'HALL_TOTAL_COUNT' => $hallCount['count'])); $myTpl->parseCurrentBlock(); } $floors = $hall->get_floors(); foreach ($floors as $floor) { $counts = $this->report->getCountsForFloor($floor); foreach ($counts as $countRow) { $myTpl->setCurrentBlock('floor_counts'); $myTpl->setData(array('TYPE' => constant($countRow['reason']), 'COUNT' => $countRow['count'])); $myTpl->parseCurrentBlock(); } // Floor tags $myTpl->setCurrentBlock('floors'); $myTpl->setData(array('FLOOR_NUMBER' => HMS_Util::ordinal($floor->getFloorNumber()))); $myTpl->parseCurrentBlock(); } // Set hall tags $hallTags['HALL_NAME'] = $hall->getHallName(); $hallTags['HALL_OCCUPANCY'] = $hall->get_number_of_assignees(); $hallTags['HALL_CAPACITY'] = $hall->countNominalBeds(); $myTpl->setCurrentBlock('hall_repeat'); $myTpl->setData($hallTags); $myTpl->parseCurrentBlock(); } //return PHPWS_Template::process($this->tpl, 'hms', 'admin/reports/AssignmentTypeByFloor.tpl'); return $myTpl->get(); }
public function show() { PHPWS_Core::initModClass('hms', 'HMS_Util.php'); $tpl = array(); $now = time(); $tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate); $tpl['STATUS'] = ""; if ($this->startDate > $now) { // Too early! $tpl['ICON'] = FEATURE_NOTYET_ICON; $tpl['BEGIN_DEADLINE'] = HMS_Util::get_long_date_time($this->startDate); } else { if ($this->endDate < $now) { // Too late $tpl['ICON'] = FEATURE_LOCKED_ICON; // fade out header $tpl['STATUS'] = "locked"; $tpl['END_DEADLINE'] = HMS_Util::get_long_date_time($this->endDate); } else { if (!isset($this->application)) { $tpl['ICON'] = FEATURE_LOCKED_ICON; $tpl['STATUS'] = "locked"; $tpl['DID_NOT_APPLY'] = ""; } else { if (isset($this->application) && isset($this->application->waiting_list_date)) { $tpl['ICON'] = FEATURE_COMPLETED_ICON; $tpl['SIGNED_UP'] = ""; } else { if (isset($this->application)) { $tpl['ICON'] = FEATURE_OPEN_ICON; $cmd = CommandFactory::getCommand('ShowWaitingListSignup'); $cmd->setTerm($this->term); $tpl['APPLY_LINK'] = $cmd->getLink("apply to the On-campus Housing Waiting List"); } else { } } } } } Layout::addPageTitle("Re-Application Waiting List"); return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/reApplicationWaitingListMenuBlock.tpl'); }
public function show() { $tpl = array(); // Show availability dates! $tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate); $tpl['STATUS'] = ""; if (time() < $this->startDate) { $tpl['ICON'] = FEATURE_NOTYET_ICON; $tpl['BEGIN_DEADLINE'] = HMS_Util::getFriendlyDate($this->startDate); } else { if (time() > $this->endDate) { $tpl['ICON'] = FEATURE_LOCKED_ICON; // fade out header $tpl['STATUS'] = "locked"; $tpl['END_DEADLINE'] = HMS_Util::getFriendlyDate($this->endDate); } else { if (is_null($this->application)) { $tpl['ICON'] = FEATURE_OPEN_ICON; $cmd = CommandFactory::getCommand('ShowHousingApplicationForm'); $cmd->setTerm($this->term); $tpl['APP_NOW'] = $cmd->getURI(); } else { $appCommand = CommandFactory::getCommand('ShowApplicationView'); if (!is_null($this->application)) { $tpl['ICON'] = FEATURE_COMPLETED_ICON; $appCommand->setAppId($this->application->id); } $tpl['VIEW_APP'] = $appCommand->getLink('view your application'); if (time() < $this->editDate) { $tpl['ICON'] = FEATURE_COMPLETED_ICON; $newApp = CommandFactory::getCommand('ShowHousingApplicationForm'); $newApp->setTerm($this->term); $tpl['NEW_APP'] = $newApp->getLink('submit a new application'); } } } } return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/applicationMenuBlock.tpl'); }
public function execute(CommandContext $context) { PHPWS_Core::initModClass('hms', 'HMS_Floor.php'); PHPWS_Core::initModClass('hms', 'HMS_Util.php'); //TODO check for a floorId $floor = new HMS_Floor($context->get('floorId')); $rooms = $floor->getRoomsWithVacancies(); $json_rooms = array(); $json_rooms[0] = 'Select ...'; foreach ($rooms as $room) { unset($text); $text = $room->room_number; if ($floor->gender_type == COED) { $text .= ' (' . HMS_Util::formatGender($room->gender_type) . ')'; } if ($room->ra == 1) { $text .= ' (RA)'; } $json_rooms[$room->id] = $text; } $context->setContent(json_encode($json_rooms)); }
public function show() { PHPWS_Core::initModClass('hms', 'HMS_Util.php'); $tpl = array(); if (is_null($this->feature) || !$this->feature->isEnabled()) { $tpl['ENTRY_TERM'] = Term::toString($this->term); $tpl['NO_FEATURE'] = ""; // dummy var } else { if ($this->feature->getStartDate() > time()) { $tpl['TERM'] = Term::toString($this->term); $tpl['DEADLINE'] = 'It is too soon to complete your application. The On-campus Housing Application will be availble here on ' . HMS_Util::getFriendlyDate($this->feature->getStartDate()); } else { if ($this->feature->getEndDate() < time()) { $tpl['TERM'] = Term::toString($this->term); $tpl['DEADLINE'] = 'The deadline to complete the On-campus Housing Application was ' . HMS_Util::getFriendlyDate($this->feature->getEndDate()); } } } $contactCmd = CommandFactory::getCommand('ShowContactForm'); $tpl['CONTACT_LINK'] = $contactCmd->getLink('click here to contact us'); return PHPWS_Template::process($tpl, 'hms', 'student/welcomeScreenNotAvailable.tpl'); }
public function show() { $tpl = new PHPWS_Template('hms'); $tpl->setFile('admin/floor_assignment.tpl'); $this->floor->loadRooms(); javascript('jquery_ui'); javascript('modules/hms/floor_assignment'); $this->floor->loadHall(); $hall = $this->floor->_hall; $tpl->setCurrentBlocK('title'); $tpl->setData(array('TITLE' => HMS_Util::ordinal($this->floor->getFloorNumber()) . ' Floor - ' . $hall->getHallName() . ' - ' . Term::getPrintableSelectedTerm())); foreach ($this->floor->_rooms as $room) { $room->loadBeds(); foreach ($room->_beds as $bed) { $tpl->setCurrentBlock('bed-list'); $tpl->setData(array('BED_ID' => $bed->id)); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock('room-list'); $tpl->setData(array('ROOM' => $room->room_number)); $tpl->parseCurrentBlock(); } return $tpl->get(); }
public function execute() { PHPWS_Core::initModClass('hms', 'StudentFactory.php'); $db = new PHPWS_DB('hms_assignment'); $db->addColumn('hms_assignment.banner_id'); $db->addColumn('hms_assignment.reason'); $db->addColumn('hms_residence_hall.hall_name'); $db->addColumn('hms_room.room_number'); $db->addColumn('hms_new_application.cell_phone'); $db->addWhere('hms_assignment.term', $this->term); $db->addJoin('LEFT OUTER', 'hms_assignment', 'hms_bed', 'bed_id', 'id'); $db->addJoin('LEFT OUTER', 'hms_bed', 'hms_room', 'room_id', 'id'); $db->addJoin('LEFT OUTER', 'hms_room', 'hms_floor', 'floor_id', 'id'); $db->addJoin('LEFT OUTER', 'hms_floor', 'hms_residence_hall', 'residence_hall_id', 'id'); $db->addJoin('LEFT OUTER', 'hms_assignment', 'hms_new_application', 'banner_id', 'banner_id AND hms_assignment.term = hms_new_application.term'); $results = $db->select(); if (PHPWS_Error::logIfError($results)) { return $results; } foreach ($results as $row) { try { $student = StudentFactory::getStudentByBannerId($row['banner_id'], $this->term); $bannerId = $student->getBannerId(); $username = $student->getUsername(); $first = $student->getFirstName(); $middle = $student->getMiddleName(); $last = $student->getLastName(); $type = $student->getType(); $appTerm = $student->getApplicationTerm(); $cellPhone = $row['cell_phone']; $assignmentType = $row['reason']; $gender = HMS_Util::formatGender($student->getGender()); $dob = $student->getDob(); $room = $row['hall_name'] . ' ' . $row['room_number']; $address = $student->getAddress(NULL); if (!$address || !isset($address) || is_null($address)) { $line1 = ""; $line2 = ""; $line3 = ""; $city = ""; $state = ""; $zip = ""; } else { $line1 = $address->line1; $line2 = $address->line2; $line3 = $address->line3; $city = $address->city; $state = $address->state; $zip = $address->zip; } } catch (StudentNotFoundException $e) { $bannerId = $row['banner_id']; $username = ''; $first = ''; $middle = ''; $last = ''; $gender = ''; $dob = ''; $type = ''; $cellPhone = ''; $line1 = ''; $line2 = ''; $line3 = ''; $city = ''; $state = ''; $zip = ''; $appTerm = ''; $assignmentType = ''; $room = ''; } $this->rows[] = array($username, $bannerId, $first, $middle, $last, $gender, $dob, $type, $appTerm, $cellPhone, $assignmentType, $room, $line1, $line2, $line3, $city, $state, $zip); } }