AppStateESS/homestead

View on GitHub
class/ApplicationFeature/RoommateSelectionRegistration.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

namespace Homestead\ApplicationFeature;

use \Homestead\ApplicationFeatureRegistration;
use \Homestead\Student;
use \Homestead\Term;

class RoommateSelectionRegistration extends ApplicationFeatureRegistration {
    public function __construct()
    {
        $this->name = 'RoommateSelection';
        $this->description = 'Roommate Selection';
        $this->startDateRequired = true;
        $this->editDateRequired = true;
        $this->endDateRequired = true;
        $this->priority = 5;
    }

    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;
    }
}