AppStateESS/homestead

View on GitHub
class/CheckoutDocumentView.php

Summary

Maintainability
B
5 hrs
Test Coverage
<?php

namespace Homestead;

class CheckoutDocumentView extends View {

    private $checkin;

    public function __construct(Checkin $checkin)
    {
        $this->checkin = $checkin;
    }

    public function show()
    {
        $term = Term::getCurrentTerm();
        $student = StudentFactory::getStudentByBannerId($this->checkin->getBannerId(), $term);

        $bed = new Bed($this->checkin->getBedId());

        $tpl = array();

        $tpl['NAME'] = $student->getName();
        $tpl['ASSIGNMENT'] = $bed->where_am_i();

        $pdfCmd = CommandFactory::getCommand('GenerateInfoCard');
        $pdfCmd->setCheckinId($this->checkin->getId());

        $tpl['INFO_CARD_LINK'] = $pdfCmd->getLink('Resident Information Card', '_blank');

        return \PHPWS_Template::process($tpl, 'hms', 'admin/checkoutComplete.tpl');
    }
}