本文整理汇总了PHP中Term::getSelectedTerm方法的典型用法代码示例。如果您正苦于以下问题:PHP Term::getSelectedTerm方法的具体用法?PHP Term::getSelectedTerm怎么用?PHP Term::getSelectedTerm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Term
的用法示例。
在下文中一共展示了Term::getSelectedTerm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reappAvailability
/**
* Report lists rooms in each residence hall that are still available, along with
* the available beds in the room. Also, show the number of beds allocated to the
* lotter for each residence hall.
*
*/
public static function reappAvailability()
{
$term = Term::getSelectedTerm();
// Available rooms in each residence hall.
$db = new PHPWS_DB('hms_bed');
$db->addJoin('LEFT', 'hms_bed', 'hms_room', 'room_id', 'id');
$db->addJoin('LEFT', 'hms_room', 'hms_floor', 'floor_id', 'id');
$db->addJoin('LEFT', 'hms_floor', 'hms_residence_hall', 'residence_hall_id', 'id');
//$db->addWhere('hms_bed.ra_bed', 0);
$db->addWhere('hms_room.private', 0);
$db->addWhere('hms_room.overflow', 0);
$db->addWhere('hms_room.reserved', 0);
$db->addWhere('hms_room.offline', 0);
$db->addWhere('hms_bed.term', $term);
$db->addColumn('hms_room.room_number');
$db->addColumn('hms_bed.bed_letter', null, null, True);
$db->addColumn('hms_residence_hall.hall_name');
$db->addGroupBy('hms_residence_hall.hall_name');
$db->addGroupBy('hms_room.room_number');
$db->addOrder('hms_residence_hall.hall_name');
$availRooms = $db->select();
// Allocated beds for lottery.
$db = new PHPWS_DB('hms_bed');
$db->addJoin('LEFT', 'hms_bed', 'hms_room', 'room_id', 'id');
$db->addJoin('LEFT', 'hms_room', 'hms_floor', 'floor_id', 'id');
$db->addJoin('LEFT', 'hms_floor', 'hms_residence_hall', 'residence_hall_id', 'id');
$db->addJoin('RIGHT', 'hms_bed', 'hms_lottery_reservation', 'id', 'bed_id');
$db->addWhere('hms_lottery_reservation.term', $term);
$db->addColumn('hms_residence_hall.hall_name');
$db->addColumn('hms_bed.id', null, null, True);
$db->addGroupBy('hms_residence_hall.hall_name');
$db->setIndexBy('hall_name');
$lotteryBeds = $db->select();
$tpl = new PHPWS_Template('hms');
$tpl->setFile('admin/reports/reapp_availability.tpl');
//
// "The parent row must be parsed after the child rows."
// Preload currHall with first residence hall name
$currHall = $availRooms[0]['hall_name'];
foreach ($availRooms as $row) {
// Change halls, create new block.
if ($currHall != $row['hall_name'] || $currHall == null) {
$tpl->setCurrentBlock('halls');
// Get allocated beds for the residence hall.
$lottCount = isset($lotteryBeds[$currHall]['count']) ? $lotteryBeds[$currHall]['count'] : 0;
$tpl->setData(array('HALL_NAME' => $currHall, 'LOTTERY_BEDS' => $lottCount));
$tpl->parseCurrentBlock();
$currHall = $row['hall_name'];
}
// Add room to residence hall template block.
$tpl->setCurrentBlock('rooms');
$tpl->setData(array('ROOM_NUM' => $row['room_number'], 'BED_COUNT' => $row['count']));
$tpl->parseCurrentBlock();
}
// Get last residence hall. Can't parse parent before child with template class.
$tpl->setCurrentBlock('halls');
$tpl->setData(array('HALL_NAME' => $currHall));
$tpl->parseCurrentBlock();
return $tpl->get();
}
示例2: execute
public function execute(CommandContext $context)
{
$resultCmd = CommandFactory::getCommand('ShowSendRlcInvites');
$respondByDate = $context->get('respond_by_date');
$respondByTime = $context->get('time');
if (!isset($respondByDate) || $respondByDate == '') {
NQ::simple('hms', hms\NotificationView::ERROR, 'Please choose a \'respond by\' date.');
$resultCmd->redirect();
}
$dateParts = explode('/', $respondByDate);
$respondByTimestamp = mktime($respondByTime, null, null, $dateParts[0], $dateParts[1], $dateParts[2]);
$term = Term::getSelectedTerm();
$studentType = $context->get('type');
if (!isset($studentType)) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Please choose a student type.');
$resultCmd->redirect();
}
PHPWS_Core::initModClass('hms', 'RlcAssignmentFactory.php');
PHPWS_Core::initModClass('hms', 'RlcAssignmentInvitedState.php');
$assignments = RlcAssignmentFactory::getAssignmentsByTermStateType($term, 'new', $studentType);
if (sizeof($assignments) == 0) {
NQ::simple('hms', hms\NotificationView::WARNING, 'No invites needed to be sent.');
$resultCmd->redirect();
}
foreach ($assignments as $assign) {
$assign->changeState(new RlcAssignmentInvitedState($assign, $respondByTimestamp));
}
NQ::simple('hms', hms\NotificationView::SUCCESS, 'Learning community invites sent.');
$resultCmd->redirect();
}
示例3: execute
public function execute(CommandContext $context)
{
if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'floor_view')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to edit floors.');
}
// Check for a hall ID
$floorId = $context->get('floor');
if (!isset($floorId)) {
throw new InvalidArgumentException('Missing floor ID.');
}
PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php');
PHPWS_Core::initModClass('hms', 'HMS_Floor.php');
PHPWS_Core::initModClass('hms', 'FloorView.php');
$floor = new HMS_Floor($floorId);
if ($floor->term != Term::getSelectedTerm()) {
$floorCmd = CommandFactory::getCommand('SelectFloor');
$floorCmd->setTitle('Edit a Floor');
$floorCmd->setOnSelectCmd(CommandFactory::getCommand('EditFloorView'));
$floorCmd->redirect();
}
$hall = $floor->get_parent();
$floorView = new FloorView($hall, $floor);
$context->setContent($floorView->show());
}
示例4: execute
public function execute(CommandContext $context)
{
$term = Term::getSelectedTerm();
$messageAll = Current_User::allow('hms', 'email_all');
$db = new PHPWS_DB('hms_residence_hall');
$db->addWhere('term', $term);
$results = $db->getObjects('HMS_Residence_Hall');
if (PHPWS_Error::logIfError($results) || is_null($results)) {
$errorMsg = array();
if (is_null($results)) {
$errorMsg['error'] = 'You do not have permission to message any halls, sorry.';
} else {
$errorMsg['error'] = 'There was a problem reading the database, please try reloading the page. If the problem persists contact ESS.';
}
echo json_encode($errorMsg);
exit;
}
$permission = new HMS_Permission();
$data = array();
foreach ($results as $hall) {
$somethingEnabled = false;
$floors = $hall->get_floors();
unset($obj);
$obj = new stdClass();
$obj->name = $hall->getHallName();
$obj->id = $hall->getId();
$obj->floors = array();
//$blah = 'Verify: ' . ($permission->verify(UserStatus::getUsername(), $hall, 'email') ? 'true' : 'false');
if ($permission->verify(UserStatus::getUsername(), $hall, 'email') || $messageAll) {
$obj->enabled = true;
$somethingEnabled = true;
foreach ($floors as $floor) {
unset($floor_obj);
$floor_obj = new stdClass();
$floor_obj->name = "Floor: " . $floor->getFloorNumber();
$floor_obj->id = $floor->getId();
$floor_obj->enabled = true;
$obj->floors[] = $floor_obj;
}
} else {
$obj->enabled = false;
foreach ($floors as $floor) {
unset($floor_obj);
$floor_obj = new stdClass();
$floor_obj->name = "Floor: " . $floor->getFloorNumber();
$floor_obj->id = $floor->getId();
$floor_obj->enabled = $permission->verify(Current_User::getUsername(), $floor, 'email');
$obj->floors[] = $floor_obj;
if ($floor_obj->enabled) {
$somethingEnabled = true;
}
}
}
if ($somethingEnabled) {
$data[] = $obj;
}
}
echo json_encode($data);
exit;
}
示例5: execute
public function execute(CommandContext $context)
{
// Check permissions
if (!Current_User::allow('hms', 'checkin')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to checkin students.');
}
$term = Term::getSelectedTerm();
$bannerId = $context->get('bannerId');
$hallId = $context->get('hallId');
$errorCmd = CommandFactory::getCommand('ShowCheckinStart');
if (!isset($bannerId) || is_null($bannerId) || $bannerId == '') {
NQ::simple('hms', hms\NotificationView::ERROR, 'Missing Banner ID.');
$errorCmd->redirect();
}
if (!isset($hallId)) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Missing residence hall ID.');
$errorCmd->redirect();
}
// Check the Banner ID
if (preg_match("/[\\d]{9}/", $bannerId) == false) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Imporperly formatted Banner ID.');
$errorCmd->redirect();
}
// Try to lookup the student in Banner
try {
$student = StudentFactory::getStudentByBannerId($bannerId, $term);
} catch (StudentNotFoundException $e) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Could not locate a student with that Banner ID.');
$errorCmd->redirect();
}
// Make sure the student is assigned in the current term
$assignment = HMS_Assignment::getAssignmentByBannerId($bannerId, $term);
if (!isset($assignment) || is_null($assignment)) {
NQ::simple('hms', hms\NotificationView::ERROR, $student->getName() . ' is not assigned for ' . Term::toString($term) . '. Please contact the University Housing Assignments Office at 828-262-6111.');
$errorCmd->redirect();
}
// Make sure the student's assignment matches the hall the user selected
$bed = $assignment->get_parent();
$room = $bed->get_parent();
$floor = $room->get_parent();
$hall = $floor->get_parent();
if ($hallId != $hall->getId()) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Wrong hall! ' . $student->getName() . ' is assigned to ' . $assignment->where_am_i());
$errorCmd->redirect();
}
// Load any existing check-in
$checkin = CheckinFactory::getLastCheckinByBannerId($bannerId, $term);
// If there is a checkin for the same bed, and the difference between the current time and the checkin time is
// greater than 48 hours, then show an error.
if (!is_null($checkin)) {
$checkoutDate = $checkin->getCheckoutDate();
if ($checkin->getBedId() == $bed->getId() && !isset($checkoutDate) && time() - $checkin->getCheckinDate() > Checkin::CHECKIN_TIMEOUT) {
NQ::simple('hms', hms\NotificationView::ERROR, $student->getName() . ' has already checked in to ' . $assignment->where_am_i());
$errorCmd->redirect();
}
}
$view = new CheckinFormView($student, $assignment, $hall, $floor, $room, $checkin);
$context->setContent($view->show());
}
示例6: show
public function show()
{
if (\UserStatus::isGuest()) {
return '';
}
$terms = \Term::getTermsAssoc();
$current = \Term::getCurrentTerm();
if (isset($terms[$current])) {
$terms[$current] .= ' (Current)';
}
$form = new \PHPWS_Form('term_selector');
$cmd = \CommandFactory::getCommand('SelectTerm');
$cmd->initForm($form);
$form->addDropBox('term', $terms);
$tags = $form->getTemplate();
$currentTerm = \Term::getSelectedTerm();
$tags['TERM_OPTIONS'] = array();
foreach ($tags['TERM_VALUE'] as $key => $value) {
$selected = '';
if ($key == $currentTerm) {
$selected = 'selected="selected"';
}
$tags['TERM_OPTIONS'][] = array('id' => $key, 'term' => $value, 'selected' => $selected);
}
javascript('jquery');
javascriptMod('hms', 'jqueryCookie');
javascript('modules/hms/SelectTerm');
return \PHPWS_Template::process($tags, 'hms', 'admin/SelectTerm.tpl');
}
示例7: execute
public function execute(CommandContext $context)
{
PHPWS_Core::initModClass('hms', 'RoomDamageFactory.php');
PHPWS_Core::initModClass('hms', 'StudentFactory.php');
PHPWS_Core::initModClass('hms', 'HMS_Email.php');
PHPWS_Core::initModClass('hms', 'CheckinFactory.php');
PHPWS_Core::initModClass('hms', 'HMS_Bed.php');
$term = Term::getSelectedTerm();
// Get the total damages assessed for each student
$damages = RoomDamageFactory::getAssessedDamagesStudentTotals($term);
foreach ($damages as $dmg) {
$student = StudentFactory::getStudentByBannerId($dmg['banner_id'], $term);
// Get the student's last checkout
// (NB: the damages may be for multiple check-outs,
// but we'll just take the last one)
$checkout = CheckinFactory::getLastCheckoutForStudent($student);
$bed = new HMS_Bed($checkout->getBedId());
$room = $bed->get_parent();
$floor = $room->get_parent();
$hall = $floor->get_parent();
$coordinators = $hall->getCoordinators();
if ($coordinators != null) {
$coordinatorName = $coordinators[0]->getDisplayName();
$coordinatorEmail = $coordinators[0]->getEmail();
} else {
$coordinatorName = '(No coordinator set for this hall.)';
$coordinatorEmail = '(No coordinator set for this hall.)';
}
HMS_Email::sendDamageNotification($student, $term, $dmg['sum'], $coordinatorName, $coordinatorEmail);
}
// Show a success message and redirect back to the main admin menu
NQ::simple('hms', hms\NotificationView::SUCCESS, 'Room damage noties sent.');
$cmd = CommandFactory::getCommand('ShowAdminMaintenanceMenu');
$cmd->redirect();
}
示例8: show
public function show()
{
$form = new PHPWS_Form('room_change_request');
/* Cell phone */
$form->addText('cell_num');
$form->setLabel('cell_num', 'Cell phone Number');
$form->addCssClass('cell_num', 'form-control');
$form->addCheck('cell_opt_out');
/* Preferences */
$halls = array(0 => 'Choose from below...');
$halls = $halls + HMS_Residence_Hall::get_halls_array(Term::getSelectedTerm());
$form->addRadioAssoc('type', array('switch' => 'I want to change to an open bed.', 'swap' => 'I want to swap beds with someone I know.'));
/* Swap */
$form->addText('swap_with');
$form->setLabel('swap_with', 'ASU Email Address');
$form->addCssClass('swap_with', 'form-control');
/* Switch */
$form->addDropBox('first_choice', $halls);
$form->setLabel('first_choice', 'First Choice');
$form->addCssClass('first_choice', 'form-control');
$form->addDropBox('second_choice', $halls);
$form->setLabel('second_choice', 'Second Choice');
$form->addCssClass('second_choice', 'form-control');
/* Reason */
$form->addTextArea('reason');
$form->setLabel('reason', 'Reason');
$form->addCssClass('reason', 'form-control');
$form->setRows('reason', 5);
/* POST location */
$cmd = CommandFactory::getCommand('SubmitRoomChangeRequest');
$cmd->initForm($form);
$tpl = $form->getTemplate();
return PHPWS_Template::process($tpl, 'hms', 'student/roomChangeRequestForm.tpl');
}
示例9: getPagerTags
/**
* Generates the activity log table
*/
public function getPagerTags()
{
PHPWS_Core::initModClass('hms', 'StudentFactory.php');
$tpl = array();
try {
$student = StudentFactory::getStudentByUsername($this->get_user_id(), Term::getSelectedTerm());
} catch (StudentNotFoundException $e) {
NQ::simple('hms', hms\NotificationView::WARNING, "Could not find data for student: {$this->get_user_id()}");
$student = null;
}
if (is_null($student)) {
$tpl['ACTEE'] = 'UNKNOWN';
} else {
$tpl['ACTEE'] = $student->getProfileLink();
}
if (strcmp($this->get_user_id(), $this->get_actor()) == 0) {
$tpl['ACTOR'] = NULL;
} else {
$tpl['ACTOR'] = $this->get_actor();
}
$time = $this->get_timestamp();
$tpl['DATE'] = date('j M Y', $time);
$tpl['TIME'] = date('g:i a', $time);
$tpl['ACTIVITY'] = $this->get_text_activity();
$notes = $this->get_notes();
if (!is_null($notes)) {
$tpl['NOTES'] = $notes;
}
return $tpl;
}
示例10: execute
public function execute(CommandContext $context)
{
if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'assign_by_floor')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to assign students by floor.');
}
$username = $context->get('username');
$banner_id = (int) $context->get('banner_id');
$reason = $context->get('reason');
$meal_plan = $context->get('meal_plan');
$bed_id = $context->get('bed_id');
$term = Term::getSelectedTerm();
try {
if ($banner_id) {
$student = StudentFactory::getStudentByBannerID($banner_id, Term::getSelectedTerm());
} elseif (!empty($username)) {
$student = StudentFactory::getStudentByUsername($username, Term::getSelectedTerm());
} else {
$context->setContent(json_encode(array('status' => 'failure', 'message' => 'Did not receive Banner ID or user name.')));
return;
}
try {
HMS_Assignment::assignStudent($student, $term, null, $bed_id, $meal_plan, null, null, $reason);
} catch (AssignmentException $e) {
$context->setContent(json_encode(array('status' => 'failure', 'message' => $e->getMessage())));
return;
}
$message = $student->first_name . ' ' . $student->last_name;
$context->setContent(json_encode(array('status' => 'success', 'message' => $message, 'student' => $student)));
} catch (\StudentNotFoundException $e) {
$context->setContent(json_encode(array('status' => 'failure', 'message' => $e->getMessage())));
}
}
示例11: execute
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));
}
}
示例12: execute
public function execute(CommandContext $context)
{
if (!Current_User::allow('hms', 'room_view')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to view rooms.');
}
// Check for a hall ID
$roomId = $context->get('room');
if (!isset($roomId)) {
throw new InvalidArgumentException('Missing room ID.');
}
// Load the room
$room = new HMS_Room($roomId);
if ($room->term != Term::getSelectedTerm()) {
$roomCmd = CommandFactory::getCommand('SelectRoom');
$roomCmd->setTitle('Edit a Room');
$roomCmd->setOnSelectCmd(CommandFactory::getCommand('EditRoomView'));
$roomCmd->redirect();
}
// Load the floor/hall
$floor = $room->get_parent();
$hall = $floor->get_parent();
// Load the room damages and damage types
$damageTypes = DamageTypeFactory::getDamageTypeAssoc();
$roomView = new RoomView($hall, $floor, $room, $damageTypes);
$context->setContent($roomView->show());
}
示例13: __construct
/**
*
* @param RoomChangeParticipant $participant The RoomChangeParticipant this view represents
* @param RoomChangeRequest $request
* @param array<RoomChangeParticipant> $participants All participants on this request
*/
public function __construct(RoomChangeParticipant $participant, RoomChangeRequest $request, array $participants)
{
$this->participant = $participant;
$this->request = $request;
$this->participants = $participants;
$this->student = StudentFactory::getStudentByBannerId($this->participant->getBannerId(), Term::getSelectedTerm());
}
示例14: show
public function show()
{
PHPWS_Core::initModClass('hms', 'HMS_Learning_Community.php');
PHPWS_Core::initModClass('hms', 'HMS_RLC_Application.php');
PHPWS_Core::initModClass('hms', 'HMS_RLC_Assignment.php');
Layout::addPageTitle("RLC Application Review");
$tags = array();
if (UserStatus::isAdmin()) {
$menuCmd = CommandFactory::getCommand('ShowAssignRlcApplicants');
$tags['MENU_LINK'] = $menuCmd->getURI();
} else {
$menuCmd = CommandFactory::getCommand('ShowStudentMenu');
$tags['MENU_LINK'] = $menuCmd->getURI();
}
$tags['FULL_NAME'] = $this->student->getFullName();
$tags['STUDENT_TYPE'] = $this->student->getPrintableType();
$tags['TERM'] = Term::toString($this->application->getTerm());
$appType = $this->application->getApplicationType();
if ($appType == RLC_APP_FRESHMEN) {
$tags['APPLICATION_TYPE'] = 'Freshmen';
} else {
if ($appType == RLC_APP_RETURNING) {
$tags['APPLICATION_TYPE'] = 'Re-application';
}
}
$rlcs = HMS_Learning_Community::getRlcList();
$tags['FIRST_CHOICE'] = $rlcs[$this->application->rlc_first_choice_id];
if (isset($this->application->rlc_second_choice_id)) {
$tags['SECOND_CHOICE'] = $rlcs[$this->application->rlc_second_choice_id];
}
if (isset($this->application->rlc_third_choice_id)) {
$tags['THIRD_CHOICE'] = $rlcs[$this->application->rlc_third_choice_id];
}
$tags['WHY_SPECIFIC'] = $this->application->why_specific_communities;
$tags['STRENGTHS_AND_WEAKNESSES'] = $this->application->strengths_weaknesses;
$tags['WHY_FIRST_CHOICE'] = $this->application->rlc_question_0;
if (isset($this->application->rlc_second_choice_id)) {
$tags['WHY_SECOND_CHOICE'] = $this->application->rlc_question_1;
}
if (isset($this->application->rlc_second_choice_id)) {
$tags['WHY_THIRD_CHOICE'] = $this->application->rlc_question_2;
}
// If this application is denied and the person logged in is an admin, show a warning
if ($this->application->isDenied() && UserStatus::isAdmin()) {
NQ::simple('hms', hms\NotificationView::WARNING, 'This application has been denied.');
}
// Show options depending of status of application.
if (UserStatus::isAdmin() && Current_User::allow('hms', 'approve_rlc_applications')) {
if (!$this->application->denied && !HMS_RLC_Assignment::checkForAssignment($this->student->getUsername(), Term::getSelectedTerm())) {
// Approve application for the community selected from dropdown
$approvalForm = $this->getApprovalForm();
$approvalForm->mergeTemplate($tags);
$tags = $approvalForm->getTemplate();
// Deny application
$tags['DENY_APP'] = $this->getDenialLink();
}
}
return PHPWS_Template::process($tags, 'hms', 'student/rlc_application.tpl');
}
示例15: execute
public function execute(CommandContext $context)
{
PHPWS_Core::initModClass('hms', 'WithdrawnSearch.php');
$term = Term::getSelectedTerm();
$search = new WithdrawnSearch($term);
$search->doSearch();
$context->setContent($search->getHTMLView());
}