本文整理汇总了PHP中Term::getCurrentTerm方法的典型用法代码示例。如果您正苦于以下问题:PHP Term::getCurrentTerm方法的具体用法?PHP Term::getCurrentTerm怎么用?PHP Term::getCurrentTerm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Term
的用法示例。
在下文中一共展示了Term::getCurrentTerm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
示例2: show
public function show()
{
$username = UserStatus::getUsername();
$currentTerm = Term::getCurrentTerm();
$student = StudentFactory::getStudentByUsername($username, $currentTerm);
$applicationTerm = $student->getApplicationTerm();
$tpl = array();
$tpl['TITLE'] = 'Contact Form';
$form = new PHPWS_Form();
$form->addText('name');
$form->setLabel('name', 'Name');
$form->addText('email');
$form->setLabel('email', 'Email Address');
$form->addText('phone');
$form->setLabel('phone', 'Phone number');
$form->addDropBox('stype', array('F' => 'New Freshmen', 'T' => 'Transfer', 'C' => 'Returning'));
$form->setLabel('stype', 'Classification');
$form->addTextArea('comments');
$form->setLabel('comments', 'Question, Comments, or Description of the Problem');
$form->addSubmit('Submit');
$form->mergeTemplate($tpl);
$cmd = CommandFactory::getCommand('SubmitContactForm');
$cmd->setUsername($username);
$cmd->setApplicationTerm($applicationTerm);
$cmd->setStudentType($student->getType());
$cmd->initForm($form);
$tpl = $form->getTemplate();
//var_dump($tpl);exit;
return PHPWS_Template::process($tpl, 'hms', 'student/contact_page.tpl');
}
示例3: getAdminPagerTags
public function getAdminPagerTags()
{
PHPWS_Core::initModClass('hms', 'StudentFactory.php');
PHPWS_Core::initModClass('hms', 'Term.php');
$student = StudentFactory::getStudentByUsername($this->username, Term::getCurrentTerm());
$rlc_list = HMS_Learning_Community::getRlcList();
$tags = array();
$tags['NAME'] = $student->getProfileLink();
$rlcCmd = CommandFactory::getCommand('ShowRlcApplicationReView');
$rlcCmd->setAppId($this->getId());
$tags['1ST_CHOICE'] = $rlcCmd->getLink($rlc_list[$this->getFirstChoice()], '_blank');
if (isset($rlc_list[$this->getSecondChoice()])) {
$tags['2ND_CHOICE'] = $rlc_list[$this->getSecondChoice()];
}
if (isset($rlc_list[$this->getThirdChoice()])) {
$tags['3RD_CHOICE'] = $rlc_list[$this->getThirdChoice()];
}
$tags['FINAL_RLC'] = HMS_RLC_Application::generateRLCDropDown($rlc_list, $this->getID());
$tags['CLASS'] = $student->getClass();
// $tags['SPECIAL_POP'] = ;
// $tags['MAJOR'] = ;
// $tags['HS_GPA'] = ;
$tags['GENDER'] = $student->getPrintableGender();
$tags['DATE_SUBMITTED'] = date('d-M-y', $this->getDateSubmitted());
$denyCmd = CommandFactory::getCommand('DenyRlcApplication');
$denyCmd->setApplicationId($this->getID());
$tags['DENY'] = $denyCmd->getLink('Deny');
return $tags;
}
示例4: __construct
public function __construct($username)
{
PHPWS_Core::initModClass('hms', 'StudentFactory.php');
$student = StudentFactory::getStudentByUsername($username, Term::getCurrentTerm());
$this->student = $student;
$this->term = $student->getApplicationTerm();
}
示例5: execute
public function execute(CommandContext $context)
{
$term = $context->get('term');
if (!isset($term) || is_null($term) || empty($term)) {
throw new InvalidArgumentException('Missing term.');
}
$cmd = CommandFactory::getCommand('ShowStudentMenu');
$feature = ApplicationFeature::getInstanceByNameAndTerm('RlcApplication', $term);
// Make sure the RLC application feature is enabled
if (is_null($feature) || !$feature->isEnabled()) {
NQ::simple('hms', hms\NotificationView::ERROR, "Sorry, RLC applications are not avaialable for this term.");
$cmd->redirect();
}
// Check feature's deadlines
if ($feature->getStartDate() > time()) {
NQ::simple('hms', hms\NotificationView::ERROR, "Sorry, it is too soon to fill out an RLC application.");
$cmd->redirect();
} else {
if ($feature->getEndDate() < time()) {
NQ::simple('hms', hms\NotificationView::ERROR, "Sorry, the RLC application deadline has already passed. Please contact University Housing if you are interested in applying for a RLC.");
$cmd->redirect();
}
}
// Get the Student object
$student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), Term::getCurrentTerm());
$view = new RlcApplicationPage1View($context, $student);
$context->setContent($view->show());
}
示例6: execute
public function execute(CommandContext $context)
{
PHPWS_Core::initModClass('hms', 'StudentFactory.php');
PHPWS_Core::initModClass('hms', 'FreshmenMainMenuView.php');
$student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), Term::getCurrentTerm());
$view = new FreshmenMainMenuView($student);
$context->setContent($view->show());
}
示例7: showForStudent
public function showForStudent(Student $student, $term)
{
if ($student->getApplicationTerm() <= Term::getCurrentTerm()) {
return true;
} else {
return false;
}
}
示例8: showForStudent
public function showForStudent(Student $student, $term)
{
// New Incoming Freshmen
if ($student->getApplicationTerm() > Term::getCurrentTerm()) {
return true;
}
return false;
}
示例9: execute
public function execute(CommandContext $context)
{
if (!Current_User::allow('hms', 'cancel_housing_application')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to cancel housing applications.');
}
// Check for a housing application id
$applicationId = $context->get('applicationId');
if (!isset($applicationId) || is_null($applicationId)) {
throw new InvalidArgumentException('Missing housing application id.');
}
// Check for a cancellation reason
$cancelReason = $context->get('cancel_reason');
if (!isset($cancelReason) || is_null($cancelReason)) {
throw new InvalidArgumentException('Missing cancellation reason.');
}
// Load the housing application
PHPWS_Core::initModClass('hms', 'HousingApplicationFactory.php');
$application = HousingApplicationFactory::getApplicationById($applicationId);
// Load the student
$student = $application->getStudent();
$username = $student->getUsername();
$term = $application->getTerm();
// Load the cancellation reasons
$reasons = HousingApplication::getCancellationReasons();
// Check for an assignment and remove it
// Decide which term to use - If this application is in a past fall term, then use the current term
if ($term < Term::getCurrentTerm() && Term::getTermSem($term) == TERM_FALL) {
$assignmentTerm = Term::getCurrentTerm();
} else {
$assignmentTerm = $term;
}
PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
$assignment = HMS_Assignment::getAssignmentByBannerId($student->getBannerId(), $assignmentTerm);
if (isset($assignment)) {
// TODO: Don't hard code cancellation refund percentage
HMS_Assignment::unassignStudent($student, $assignmentTerm, 'Application cancellation: ' . $reasons[$cancelReason], UNASSIGN_CANCEL, 100);
}
PHPWS_Core::initModClass('hms', 'HMS_RLC_Assignment.php');
$rlcAssignment = HMS_RLC_Assignment::getAssignmentByUsername($username, $term);
if (!is_null($rlcAssignment)) {
$rlcAssignment->delete();
}
PHPWS_Core::initModClass('hms', 'HMS_RLC_Application.php');
$rlcApplication = HMS_RLC_Application::getApplicationByUsername($username, $term);
if (!is_null($rlcApplication)) {
$rlcApplication->denied = 1;
$rlcApplication->save();
HMS_Activity_Log::log_activity($username, ACTIVITY_DENIED_RLC_APPLICATION, \Current_User::getUsername(), Term::toString($term) . ' Denied RLC Application due to Contract Cancellation');
}
// Cancel the application
$application->cancel($cancelReason);
$application->save();
echo 'success';
exit;
}
示例10: execute
public function execute(CommandContext $context)
{
$term = Term::getCurrentTerm();
// Get the list of role memberships this user has
// NB: This gets memberships for all terms.. must filter later
$hms_perm = new HMS_Permission();
$memberships = $hms_perm->getMembership('room_change_approve', NULL, UserStatus::getUsername());
// Use the roles to instantiate a list of floors this user has access to
$floors = array();
foreach ($memberships as $member) {
if ($member['class'] == 'hms_residence_hall') {
$hall = new HMS_Residence_Hall($member['instance']);
// Filter out halls that aren't in the current term
if ($hall->getTerm() != $term) {
continue;
}
$floors = array_merge($floors, $hall->getFloors());
} else {
if ($member['class'] == 'hms_floor') {
$f = new HMS_Floor($member['instance']);
// Filter out floors that aren't in the current term
if ($f->getTerm() != $term) {
continue;
}
$floors[] = $f;
} else {
throw new Exception('Unknown object type.');
}
}
}
if (empty($floors)) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
NQ::simple('hms', hms\NotificationView::ERROR, "You do not have the 'RD' role on any residence halls or floors.");
$cmd = CommandFactory::getCommand('ShowAdminMaintenanceMenu');
$cmd->redirect();
}
// Remove duplicate floors
$uniqueFloors = array();
foreach ($floors as $floor) {
$uniqueFloors[$floor->getId()] = $floor;
}
// Use the list of floors to get a unique list of hall names
$hallNames = array();
foreach ($uniqueFloors as $floor) {
$hall = $floor->get_parent();
$hallNames[$hall->getId()] = $hall->getHallName();
}
// Get the set of room changes which are not complete based on the floor list
$needsApprovalChanges = RoomChangeRequestFactory::getRoomChangesNeedsApproval($term, $uniqueFloors);
$approvedChanges = RoomChangeRequestFactory::getRoomChangesByFloor($term, $uniqueFloors, array('Approved'));
$allPendingChanges = RoomChangeRequestFactory::getRoomChangesByFloor($term, $uniqueFloors, array('Pending', 'Hold'));
$completedChanges = RoomChangeRequestFactory::getRoomChangesByFloor($term, $uniqueFloors, array('Complete'));
$inactiveChanges = RoomChangeRequestFactory::getRoomChangesByFloor($term, $uniqueFloors, array('Cancelled', 'Denied'));
$view = new RoomChangeApprovalView($needsApprovalChanges, $approvedChanges, $allPendingChanges, $completedChanges, $inactiveChanges, $hallNames, $term);
$context->setContent($view->show());
}
示例11: execute
public function execute(CommandContext $context)
{
$term = Term::getCurrentTerm();
// Create the student
$student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), $term);
// If the student has a pending request load it from the db
$request = RoomChangeRequestFactory::getPendingByStudent($student, $term);
$view = new RoomChangeRequestForm($student, $term);
$context->setContent($view->show());
}
示例12: checkForWaiver
public static function checkForWaiver($username, $term = NULL)
{
$db = new PHPWS_DB('hms_eligibility_waiver');
$db->addWhere('asu_username', $username);
if (!isset($term)) {
$db->addWhere('term', Term::getCurrentTerm());
} else {
$db->addWhere('term', $term);
}
return !is_null($db->select('row'));
}
示例13: showForStudent
public function showForStudent(Student $student, $term)
{
// for freshmen
if ($student->getApplicationTerm() > Term::getCurrentTerm()) {
return true;
}
// for returning students (summer terms)
if ($term > $student->getApplicationTerm() && $term != PHPWS_Settings::get('hms', 'lottery_term') && (Term::getTermSem($term) == TERM_SUMMER1 || Term::getTermSem($term) == TERM_SUMMER2)) {
return true;
}
return false;
}
示例14: execute
public function execute(CommandContext $context)
{
PHPWS_Core::initModClass('hms', 'StudentFactory.php');
PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
PHPWS_Core::initModClass('hms', 'CheckinFactory.php');
PHPWS_Core::initModClass('hms', 'RoomDamageFactory.php');
PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php');
PHPWS_Core::initModClass('hms', 'HMS_Bed.php');
PHPWS_Core::initModClass('hms', 'BedFactory.php');
$term = Term::getCurrentTerm();
$bannerId = $context->get('bannerId');
$hallId = $context->get('hallId');
$errorCmd = CommandFactory::getCommand('ShowCheckoutStart');
if (!isset($bannerId) || is_null($bannerId) || $bannerId == '') {
NQ::simple('hms', hms\NotificationView::ERROR, 'Missing student ID.');
$errorCmd->redirect();
}
if (!isset($hallId)) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Missing residence hall ID.');
$errorCmd->redirect();
}
// If search string is all numeric, make sure it looks like a valid Banner ID
if (is_numeric($bannerId) && 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 {
// If it's all numeric assume it's a student ID, otherwise assume it's a username
if (is_numeric($bannerId) && strlen((string) $bannerId) == 9) {
$student = StudentFactory::getStudentByBannerId($bannerId, $term);
} else {
$student = StudentFactory::getStudentByUsername($bannerId, $term);
}
} catch (StudentNotFoundException $e) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Could not locate a student with that Banner ID.');
$errorCmd->redirect();
}
// Find the earliest checkin that matches hall the user selected
$hall = new HMS_Residence_Hall($hallId);
$checkin = CheckinFactory::getPendingCheckoutForStudentByHall($student, $hall);
if (!isset($checkin)) {
NQ::simple('hms', hms\NotificationView::ERROR, "Sorry, we couldn't find a matching check-in at {$hall->getHallName()} for this student to check-out of.");
$errorCmd->redirect();
}
$bed = BedFactory::getBedByPersistentId($checkin->getBedPersistentId(), $term);
$room = $bed->get_parent();
// Get the damages for this student's room
$damages = RoomDamageFactory::getDamagesByRoom($room);
PHPWS_Core::initModClass('hms', 'CheckoutFormView.php');
$view = new CheckoutFormView($student, $hall, $room, $bed, $damages, $checkin);
$context->setContent($view->show());
}
示例15: execute
public function execute(CommandContext $context)
{
$this->searchString = $context->get('studentSearchQuery');
// NB: this is the *search term*, not the semester
$this->hmsTerm = Term::getCurrentTerm();
// If the search string is empty, just return an empty json array
if (!isset($this->searchString) || $this->searchString == '') {
echo json_encode(array());
exit;
}
// Strip any non-alphanumeric characters, escape slashes
$this->searchString = pg_escape_string($this->searchString);
// Check for a direct banner ID match
if (preg_match("/^[0-9]{9}/", $this->searchString)) {
// String is all-numeric, probably a Banner ID
// If the seach string is exactly 9 digits, then try to find a match
$sql = $this->getBannerIdSearchSql();
} else {
// Do fancy string matching instead
$sql = $this->getFuzzyTextSql();
}
// TODO join for only assigned students / applied students in current/future terms
// Add a limit on the number of results
$sql .= " LIMIT " . self::resultLimit;
//test($sql,1);
$this->db = new PHPWS_DB('hms_student_autocomplete');
$results = PHPWS_DB::getAll($sql);
//test($results,1);
if (is_null($results)) {
echo json_encode();
exit;
}
// Log any DB errors and echo an empty result
if (PHPWS_Error::logIfError($results)) {
echo json_encode(array());
exit;
}
$resultObjects = array();
foreach ($results as $row) {
$obj = new stdClass();
$obj->banner_id = $row['banner_id'];
$obj->name = $row['first_name'] . ' ' . $row['last_name'];
$obj->username = $row['username'];
$resultObjects[] = $obj;
}
$jsonResult = json_encode($resultObjects);
//test($jsonResult,1);
echo $jsonResult;
exit;
// NB: using setContent adds escape characters to quotes in the JSON string... WRONG.
//$context->setContent(json_encode($jsonResult));
}