本文整理汇总了PHP中Term::getTermSem方法的典型用法代码示例。如果您正苦于以下问题:PHP Term::getTermSem方法的具体用法?PHP Term::getTermSem怎么用?PHP Term::getTermSem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Term
的用法示例。
在下文中一共展示了Term::getTermSem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: execute
public function execute(CommandContext $context)
{
PHPWS_Core::initModClass('hms', 'StudentFactory.php');
PHPWS_Core::initModClass('hms', 'HousingApplication.php');
PHPWS_Core::initModClass('hms', 'HousingApplicationFactory.php');
PHPWS_Core::initModClass('hms', 'HousingApplicationFormView.php');
// Make sure we have a valid term
$term = $context->get('term');
if (is_null($term) || !isset($term)) {
throw new InvalidArgumentException('Missing term.');
}
// Determine the application type, based on the term
$sem = Term::getTermSem($term);
switch ($sem) {
case TERM_FALL:
$appType = 'fall';
break;
case TERM_SPRING:
$appType = 'spring';
break;
case TERM_SUMMER1:
case TERM_SUMMER2:
$appType = 'summer';
break;
}
$student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), $term);
// Make sure the student agreed to the terms, if not, send them back to the terms & agreement command
//$event = $context->get('event');
// If they haven't agreed, redirect to the agreement
// TODO: actually check via docusign API
/*
if(is_null($event) || !isset($event) || ($event != 'signing_complete' && $event != 'viewing_complete')){
$agreementCmd = CommandFactory::getCommand('ShowTermsAgreement');
$agreementCmd->setTerm($term);
$agreementCmd->setAgreedCommand(CommandFactory::getCommand('ShowHousingApplicationForm'));
$agreementCmd->redirect();
}
*/
// Check to see if the student's PIN is enabled. Don't let the student apply if the PIN is disabled.
if ($student->pinDisabled()) {
$pinCmd = CommandFactory::getCommand('ShowPinDisabled');
$pinCmd->redirect();
}
// Check to see if the user has an existing application for the term in question
$existingApplication = HousingApplication::getApplicationByUser($student->getUsername(), $term);
// Check for an in-progress application on the context, ignore any exceptions (in case there isn't an application on the context)
try {
//TODO check to see if it looks like there might be something on the context before trying this
$existingApplication = HousingApplicationFactory::getApplicationFromContext($context, $term, $student, $appType);
} catch (Exception $e) {
// ignored
$contextApplication = NULL;
}
$appView = new HousingApplicationFormView($student, $term, $existingApplication);
$context->setContent($appView->show());
}
示例3: 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;
}
示例4: execute
public function execute()
{
PHPWS_Core::initModClass('hms', 'HousingApplicationFactory.php');
PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
PHPWS_Core::initModClass('hms', 'StudentFactory.php');
$db = new PHPWS_DB('hms_new_application');
$db->addColumn('hms_new_application.*');
$db->addWhere('term', $this->term);
$db->addWhere('cancelled', 0);
$term = Term::getTermSem($this->term);
if ($term == TERM_FALL) {
$db->addJoin('LEFT', 'hms_new_application', 'hms_fall_application', 'id', 'id');
$db->addColumn('hms_fall_application.*');
} else {
if ($term == TERM_SUMMER1 || $term == TERM_SUMMER2) {
$db->addJoin('LEFT', 'hms_new_application', 'hms_summer_application', 'id', 'id');
$db->addColumn('hms_summer_application.*');
}
}
$result = $db->select();
$app = array();
foreach ($result as $app) {
$username = $app['username'];
$bannerId = $app['banner_id'];
$type = $app['student_type'];
$cellPhone = $app['cell_phone'];
$date = date('n/j/Y', $app['created_on']);
$assignment = HMS_Assignment::getAssignmentByBannerId($bannerId, $this->term);
if (!is_null($assignment)) {
$room = $assignment->where_am_i();
} else {
$room = '';
}
$student = StudentFactory::getStudentByBannerId($bannerId, $this->term);
$first = $student->getFirstName();
$middle = $student->getMiddleName();
$last = $student->getLastName();
$gender = $student->getPrintableGender();
$birthday = date("m/d/Y", $student->getDobDateTime()->getTimestamp());
$address = $student->getAddress(NULL);
if ($term == TERM_SPRING || $term == TERM_FALL) {
$lifestyle = $app['lifestyle_option'] == 1 ? 'Single Gender' : 'Co-Ed';
} else {
$lifestyle = $app['room_type'] == 1 ? 'Single Room' : 'Double Room';
}
if (!is_null($address) && $address !== false) {
$this->rows[] = array($username, $bannerId, $first, $middle, $last, $gender, $type, $cellPhone, $room, $date, $address->line1, $address->line2, $address->line3, $address->city, $address->state, $address->zip, $birthday, $lifestyle);
} else {
$this->rows[] = array($username, $bannerId, $first, $middle, $last, '', $type, $cellPhone, $room, $date, '', '', '', '', '', '', $lifestyle);
}
}
}
示例5: show
public function show()
{
$tpl = array();
if (Term::getTermSem($this->term) == TERM_FALL) {
// If it's fall, then it's really the fall & spring terms
$tpl['TERM'] = Term::toString($this->term) . ' - ' . Term::toString(Term::getNextTerm($this->term));
} else {
$tpl['TERM'] = Term::toString($this->term);
}
$contactFormLink = CommandFactory::getCommand('ShowContactForm')->getLink('contact University Housing');
// In case there are no features enabled for this term
$tpl['BLOCKS'][] = array('BLOCK' => 'Your application has been cancelled for this term. If this is an error please ' . $contactFormLink . '.');
return PHPWS_Template::process($tpl, 'hms', 'student/studentMenuTermBlock.tpl');
}
示例6: showForStudent
public function showForStudent(Student $student, $term)
{
// Freshmen only
if ($student->getApplicationTerm() > Term::getCurrentTerm()) {
return true;
}
// Possibly available for continuing students in the summer terms (this is sort of a hack)
//TODO: find a better way to implement this
$termSem = Term::getTermSem($term);
if ($student->getApplicationTerm() <= Term::getCurrentTerm() && ($termSem == TERM_SUMMER1 || $termSem == TERM_SUMMER2)) {
return true;
}
return false;
}
示例7: show
public function show()
{
$tpl = array();
$tpl['ENTRY_TERM'] = Term::toString($this->student->getApplicationTerm());
$tpl['REQUIRED_TERMS'] = array();
$appsOnFile = HousingApplication::getAllApplicationsForStudent($this->student);
# Make a list of the terms the student has completed
$termsOnFile = array();
if (isset($appsOnFile) && !is_null($appsOnFile)) {
foreach ($appsOnFile as $term => $app) {
$termsOnFile[] = $term;
}
}
foreach ($this->requiredTerms as $t) {
if ($t['required'] == 0) {
continue;
}
$completed = '';
if (in_array($t['term'], $termsOnFile)) {
$completed = ' <span style="color: #0000AA">(Completed)</span>';
}
// If the application is cancelled, overwrite the "complete" text with "cancelled"
if (isset($appsOnFile[$t['term']]) && $appsOnFile[$t['term']]->isCancelled()) {
$completed = ' <span style="color: #F00">(Cancelled)</span>';
}
if (Term::getTermSem($t['term']) == TERM_FALL) {
$tpl['REQUIRED_TERMS'][] = array('REQ_TERM' => Term::toString($t['term']) . ' - ' . Term::toString(Term::getNextTerm($t['term'])), 'COMPLETED' => $completed);
} else {
$tpl['REQUIRED_TERMS'][] = array('REQ_TERM' => Term::toString($t['term']), 'COMPLETED' => $completed);
}
}
$contactCmd = CommandFactory::getCommand('ShowContactForm');
$tpl['CONTACT_LINK'] = $contactCmd->getLink('contact us');
# Setup the form for the 'continue' button.
$form = new PHPWS_Form();
$this->submitCmd->initForm($form);
$form->mergeTemplate($tpl);
$tpl = $form->getTemplate();
$studentType = $this->student->getType();
Layout::addPageTitle("Welcome");
if (count($appsOnFile) > 0) {
// User is now past step one. No longer just welcoming, we are now welcoming back.
return PHPWS_Template::process($tpl, 'hms', 'student/welcome_back_screen.tpl');
}
if ($studentType == TYPE_FRESHMEN || $studentType == TYPE_NONDEGREE || $this->student->isInternational()) {
return PHPWS_Template::process($tpl, 'hms', 'student/welcome_screen_freshmen.tpl');
} else {
return PHPWS_Template::process($tpl, 'hms', 'student/welcome_screen_transfer.tpl');
}
}
示例8: execute
public function execute(CommandContext $context)
{
$term = $context->get('term');
// If we're coming from the special needs page, save any special needs flags the student selected
if (array_key_exists('special_needs', $context->getParams())) {
$this->saveSpecialNeeds($context);
}
// If they haven't agreed, redirect to the agreement
// TODO: actually check via docusign API
$event = $context->get('event');
if (is_null($event) || !isset($event) || $event != 'signing_complete' && $event != 'viewing_complete') {
$returnCmd = CommandFactory::getCommand('ShowFreshmenApplicationReview');
$returnCmd->setTerm($term);
$agreementCmd = CommandFactory::getCommand('ShowTermsAgreement');
$agreementCmd->setTerm($term);
$agreementCmd->setAgreedCommand($returnCmd);
$agreementCmd->redirect();
}
$student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), $term);
$errorCmd = CommandFactory::getCommand('ShowHousingApplicationForm');
$errorCmd->setTerm($term);
// Determine the application type, based on the term
$sem = Term::getTermSem($term);
switch ($sem) {
case TERM_FALL:
$appType = 'fall';
break;
case TERM_SPRING:
$appType = 'spring';
break;
case TERM_SUMMER1:
case TERM_SUMMER2:
$appType = 'summer';
break;
}
try {
$application = HousingApplicationFactory::getApplicationFromSession($_SESSION['application_data'], $term, $student, $appType);
} catch (Exception $e) {
NQ::simple('hms', hms\NotificationView::ERROR, $e->getMessage());
$errorCmd->redirect();
}
PHPWS_Core::initModClass('hms', 'FreshmenApplicationReview.php');
$view = new FreshmenApplicationReview($student, $term, $application);
$context->setContent($view->show());
}
示例9: execute
public function execute(CommandContext $context)
{
$term = $context->get('term');
$student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), $term);
$errorCmd = CommandFactory::getCommand('ShowEmergencyContactForm');
$errorCmd->setTerm($term);
// Determine the application type, based on the term
$sem = Term::getTermSem($term);
switch ($sem) {
case TERM_FALL:
$appType = 'fall';
break;
case TERM_SPRING:
$appType = 'spring';
break;
case TERM_SUMMER1:
case TERM_SUMMER2:
$appType = 'summer';
break;
}
try {
$application = HousingApplicationFactory::getAppByStudent($student, $term, $appType);
// Change the emergency contact and missing person info temporarily, WITHOUT saving
/* Emergency Contact */
$application->setEmergencyContactName($context->get('emergency_contact_name'));
$application->setEmergencyContactRelationship($context->get('emergency_contact_relationship'));
$application->setEmergencyContactPhone($context->get('emergency_contact_phone'));
$application->setEmergencyContactEmail($context->get('emergency_contact_email'));
/* Emergency Medical Condition */
$application->setEmergencyMedicalCondition($context->get('emergency_medical_condition'));
/* Missing Person */
$application->setMissingPersonName($context->get('missing_person_name'));
$application->setMissingPersonRelationship($context->get('missing_person_relationship'));
$application->setMissingPersonPhone($context->get('missing_person_phone'));
$application->setMissingPersonEmail($context->get('missing_person_email'));
} catch (Exception $e) {
NQ::simple('hms', hms\NotificationView::ERROR, $e->getMessage());
$errorCmd->redirect();
}
PHPWS_Core::initModClass('hms', 'EmergencyContactReview.php');
$view = new EmergencyContactReview($student, $term, $application);
$context->setContent($view->show());
}
示例10: getCumulativeCountsByTerm
private function getCumulativeCountsByTerm($term)
{
// If the report is for fall, we really want Summer 1 and Summer 2 applications terms too.
// So, build a list of extra application terms we should use.
$extraTerms = array();
if (Term::getTermSem($term) == TERM_FALL) {
// Compute the Summer 2 term
$t = Term::getPrevTerm($term);
$extraTerms[] = $t;
// Computer the SUmmer 1 term
$t = Term::getPrevTerm($t);
$extraTerms[] = $t;
}
// Create the where clause, start by adding the requested term
$termClause = "application_term = {$term}";
// Add any extra terms, if any.
if (count($extraTerms) > 0) {
foreach ($extraTerms as $t) {
$termClause .= " OR application_term = {$t}";
}
}
// Build the query
/* Query with human readable dates
$query = "select
to_char(date_trunc('day',timestamp 'epoch' + created_on * interval '1 second'), 'Mon DD, YYYY') as date,
count(created_on) as daily_count, sum(count(created_on)) OVER (ORDER BY to_char(date_trunc('day',timestamp 'epoch' + created_on * interval '1 second'), 'Mon DD, YYYY')) as running_total
FROM hms_new_application
WHERE term = 201340
AND ($termClause)
AND student_type = 'F'
AND application_type = 'fall'
GROUP BY date
ORDER BY date";
*/
PHPWS_Core::initModClass('hms', 'PdoFactory.php');
$db = PdoFactory::getInstance()->getPdo();
$query = "SELECT\n date_part('epoch', date_trunc('day',timestamp 'epoch' + created_on * interval '1 second')) as date,\n SUM(COUNT(created_on)) OVER (ORDER BY date_part('epoch', date_trunc('day',timestamp 'epoch' + created_on * interval '1 second'))) as running_total\n FROM hms_new_application\n WHERE term = :term\n AND ({$termClause})\n AND student_type = 'F'\n AND cancelled = 0\n GROUP BY date\n ORDER BY date";
$stmt = $db->prepare($query);
$stmt->bindParam(':term', $term);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $result;
}
示例11: getCumulativeCountsByTerm
private function getCumulativeCountsByTerm($term)
{
// If the report is for the fall, we want continuing students with
// application terms <= the spring term.
if (Term::getTermSem($term) == TERM_FALL) {
$year = Term::getTermYear($term);
$applicationTerm = $year . TERM_SPRING;
} else {
// For any other term, we want the application term <= the previous term
$applicationTerm = Term::getPrevTerm($term);
}
PHPWS_Core::initModClass('hms', 'PdoFactory.php');
$db = PdoFactory::getInstance()->getPdo();
$query = "SELECT\n date_part('epoch', date_trunc('day',timestamp 'epoch' + cancelled_on * interval '1 second')) as date,\n SUM(COUNT(cancelled_on)) OVER (ORDER BY date_part('epoch', date_trunc('day',timestamp 'epoch' + cancelled_on * interval '1 second'))) as running_total\n FROM hms_new_application\n WHERE term = :term\n and application_term <= {$applicationTerm}\n and cancelled = 1\n and cancelled_reason NOT IN ('offer_made', 'before_assignment')\n GROUP BY date\n ORDER BY date;";
$stmt = $db->prepare($query);
$stmt->bindParam(':term', $term);
$stmt->execute();
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
return $result;
}
示例12: show
public function show()
{
// Get the enabled features
$features = ApplicationFeature::getEnabledFeaturesForStudent($this->student, $this->term);
$tpl = array();
if (Term::getTermSem($this->term) == TERM_FALL) {
// If it's fall, then it's really the fall & spring terms
$tpl['TERM'] = Term::toString($this->term) . ' - ' . Term::toString(Term::getNextTerm($this->term));
} else {
$tpl['TERM'] = Term::toString($this->term);
}
// In case there are no features enabled for this term
if (empty($features)) {
$tpl['BLOCKS'][] = array('BLOCK' => 'There are no options currently available to you for this term.');
}
foreach ($features as $feat) {
$tpl['BLOCKS'][] = array('BLOCK' => $feat->getMenuBlockView($this->student)->show());
}
return PHPWS_Template::process($tpl, 'hms', 'student/studentMenuTermBlock.tpl');
}
示例13: show
public function show()
{
$tpl = array();
$termList = array();
// Current term
$currTerm = Term::getCurrentTerm();
$termList[] = $currTerm;
// Always add the current term
// Find the next two summer terms (could be next year if Fall
// is the current term, could be this year if Spring is current term)
$summerTerm1 = $currTerm;
while (Term::getTermSem($summerTerm1) != TERM_SUMMER1) {
$summerTerm1 = Term::getNextTerm($summerTerm1);
}
$summerTerm2 = Term::getNextTerm($summerTerm1);
$currSem = Term::getTermSem($currTerm);
if ($currSem == TERM_SUMMER1) {
// If the current term is Summer 1, then we've already added it above,
// so just add summer 2
$termList[] = Term::getNextTerm($currTerm);
} else {
if ($currSem != TERM_SUMMER2) {
// Add both of the next summer terms then
$termList[] = $summerTerm1;
$termList[] = $summerTerm2;
}
}
// Re-application term
if ($this->lotteryTerm > $currTerm) {
// If the lottery term is in the future
$termList[] = $this->lotteryTerm;
}
foreach ($termList as $t) {
$termBlock = new StudentMenuTermBlock($this->student, $t);
$tpl['TERMBLOCK'][] = array('TERMBLOCK_CONTENT' => $termBlock->show());
}
Layout::addPageTitle("Main Menu");
return PHPWS_Template::process($tpl, 'hms', 'student/returningMenu.tpl');
}
示例14: execute
public function execute(CommandContext $context)
{
$applicationId = $context->get('applicationId');
if (!isset($applicationId)) {
throw new InvalidArgumentException('Missing application id.');
}
PHPWS_Core::initModClass('hms', 'HousingApplicationFactory.php');
$application = HousingApplicationFactory::getApplicationById($applicationId);
$student = $application->getStudent();
PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
// Decide which term to use - If this application is in a past fall term, then use the current term
$term = $application->getTerm();
if ($term < Term::getCurrentTerm() && Term::getTermSem($term) == TERM_FALL) {
$assignmentTerm = Term::getCurrentTerm();
} else {
$assignmentTerm = $term;
}
$assignment = HMS_Assignment::getAssignmentByBannerId($student->getBannerId(), $assignmentTerm);
PHPWS_Core::initModClass('hms', 'HousingApplicationCancelView.php');
$view = new HousingApplicationCancelView($student, $application, $assignment);
echo $view->show();
exit;
}
示例15: execute
public function execute(CommandContext $context)
{
$term = $context->get('term');
$student = StudentFactory::getStudentByUsername(UserStatus::getUsername(), $term);
// Recreate the agreedToCommand
$agreedCmd = CommandFactory::getCommand($context->get('onAgreeAction'));
$agreedCmd->setTerm($term);
$roommateRequestId = $context->get('roommateRequestId');
if (isset($roommateRequestId) && $roommateRequestId != null) {
$agreedCmd->setRoommateRequestId($roommateRequestId);
}
//$submitCmd = CommandFactory::getCommand('AgreeToTerms');
//$submitCmd->setTerm($term);
//$submitCmd->setAgreedCmd($agreedCmd);
$sem = Term::getTermSem($term);
switch ($sem) {
case TERM_FALL:
$appType = 'fall';
break;
case TERM_SPRING:
$appType = 'spring';
break;
case TERM_SUMMER1:
case TERM_SUMMER2:
$appType = 'summer';
break;
}
$application = HousingApplicationFactory::getApplicationFromSession($_SESSION['application_data'], $term, $student, $appType);
$docusignCmd = CommandFactory::getCommand('BeginDocusign');
$docusignCmd->setTerm($term);
$docusignCmd->setReturnCmd($agreedCmd);
$docusignCmd->setParentName($application->getEmergencyContactName());
$docusignCmd->setParentEmail($application->getEmergencyContactEmail());
PHPWS_Core::initModClass('hms', 'TermsAgreementView.php');
$agreementView = new TermsAgreementView($term, $docusignCmd, $student);
$context->setContent($agreementView->show());
}