本文整理汇总了PHP中PHPWS_Template类的典型用法代码示例。如果您正苦于以下问题:PHP PHPWS_Template类的具体用法?PHP PHPWS_Template怎么用?PHP PHPWS_Template使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PHPWS_Template类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute(CommandContext $context)
{
if (!Current_User::allow('hms', 'room_structure')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to add a room.');
}
PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php');
PHPWS_Core::initModClass('hms', 'HMS_Floor.php');
PHPWS_Core::initModClass('hms', 'HMS_Bed.php');
PHPWS_Core::initModClass('hms', 'HMS_Assignment.php');
PHPWS_Core::initModClass('hms', 'HMS_Util.php');
PHPWS_Core::initModClass('hms', 'AddRoomView.php');
$floor_id = $context->get('floor');
$tpl = array();
# Setup the title and color of the title bar
$tpl['TITLE'] = 'Add Room';
# Check to make sure we have a floor and hall.
$floor = new HMS_Floor($floor_id);
if (!$floor) {
$tpl['ERROR_MSG'] = 'There was an error getting the floor object. Please contact ESS.';
return PHPWS_Template::process($tpl, 'hms', 'admin/add_room.tpl');
}
$hall = $floor->get_parent();
if (!$hall) {
$tpl['ERROR_MSG'] = 'There was an error getting the hall object. Please contact ESS.';
return PHPWS_Template::process($tpl, 'hms', 'admin/add_room.tpl');
}
# Check Permissions
if (!Current_User::allow('hms', 'room_structure')) {
HMS_Floor::show_edit_floor($floor_id, NULL, 'You do not have permission to add rooms.');
}
$view = new AddRoomView($floor);
$context->setContent($view->show());
}
示例2: display
public function display()
{
$tpl = array();
$tpl['TITLE'] = 'Edit Internship';
// Setup the form
$internshipForm = new EditInternshipFormView($this->intern, $this->student, $this->agency, $this->docs);
// Get the Form object
$form = $internshipForm->getForm();
/*
* If 'missing' is set then we have been redirected
* back to the form because the user didn't type in something and
* somehow got past the javascript.
*/
if (isset($_REQUEST['missing'])) {
$missing = explode(' ', $_REQUEST['missing']);
/*
* Set classes on field we are missing.
*/
foreach ($missing as $m) {
//$form->addCssClass($m, 'has-error');
$form->addExtraTag($m, 'data-has-error="true"');
}
/* Plug old values back into form fields. */
$form->plugIn($_GET);
/* Re-add hidden fields with object ID's */
$form->addHidden('id', $this->intern->id);
}
$form->mergeTemplate($tpl);
$this->showWarnings();
$this->showStudentWarnings();
return \PHPWS_Template::process($form->getTemplate(), 'intern', 'internshipView.tpl');
}
示例3: execute
public function execute(CommandContext $context)
{
$id = $context->get('roommateId');
if (is_null($id)) {
throw new InvalidArgumentException('Must set roommateId');
}
PHPWS_Core::initModClass('hms', 'HMS_Roommate.php');
$roommate = new HMS_Roommate($id);
if ($roommate->id = 0) {
throw new InvalidArgumentException('Invalid roommateId ' . $id);
}
$username = UserStatus::getUsername();
if ($username != $roommate->requestor && $username != $roommate->requestee) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException("{$username} tried to break roommate pairing {$roommate->id}");
}
PHPWS_Core::initCoreClass('Captcha.php');
// get other roommate
$other = StudentFactory::getStudentByUsername($roommate->get_other_guy($username), $roommate->term);
$form = new PHPWS_Form();
$cmd = CommandFactory::getCommand('RoommateBreak');
$cmd->setRoommateId($id);
$cmd->initForm($form);
$form->addTplTag('CAPTCHA_IMAGE', Captcha::get());
$form->addTplTag('NAME', $other->getFullName());
$form->addSubmit('Confirm');
$form->addCssClass('submit', 'btn btn-danger');
$context->setContent(PHPWS_Template::process($form->getTemplate(), 'hms', 'student/roommate_break_confirm.tpl'));
}
示例4: render
protected function render()
{
parent::render();
$this->tpl['TERM'] = Term::toString($this->report->getTerm());
$rows = array();
$totalAssignments = 0;
foreach ($this->report->getTypeCounts() as $result) {
$row = array();
// Translate the reason string into a human readable label, if it exists
// Otherwsie, use the raw reason code
$name = constant($result['reason']);
if (isset($name)) {
$row['REASON'] = $name;
} else {
$row['REASON'] = $result['reason'];
}
$row['COUNT'] = $result['count'];
$rows[] = $row;
// Add the count for this reason to the running total
$totalAssignments += $result['count'];
}
$this->tpl['TABLE_ROWS'] = $rows;
$this->tpl['TOTAL_ASSIGNMENTS'] = $totalAssignments;
return PHPWS_Template::process($this->tpl, 'hms', 'admin/reports/AssignmentsByType.tpl');
}
示例5: show
public function show()
{
PHPWS_Core::initModClass('hms', 'HMS_Util.php');
$tpl = array();
$tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate);
$tpl['STATUS'] = "";
if (!is_null($this->application) && $this->application->getApplicationType() == 'offcampus_waiting_list') {
$tpl['ICON'] = FEATURE_COMPLETED_ICON;
$tpl['ALREADY_APPLIED'] = "";
} else {
if (time() < $this->startDate) {
$tpl['ICON'] = FEATURE_NOTYET_ICON;
$tpl['BEGIN_DEADLINE'] = HMS_Util::getFriendlyDate($this->startDate);
} else {
if (time() > $this->endDate) {
$tpl['ICON'] = FEATURE_LOCKED_ICON;
// fade out header
$tpl['STATUS'] = "locked";
$tpl['END_DEADLINE'] = HMS_Util::getFriendlyDate($this->endDate);
} else {
//TODO
$tpl['ICON'] = FEATURE_OPEN_ICON;
$waitListCommand = CommandFactory::getCommand('ShowOffCampusWaitListApplication');
$waitListCommand->setTerm($this->term);
$tpl['WAIT_LIST_LINK'] = $waitListCommand->getLink('Apply to the waiting list');
}
}
}
return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/OffCampusWaitingListMenuBlock.tpl');
}
示例6: show
public function show()
{
$tpl = array();
$tpl['TERM'] = Term::toString($this->room->getTerm());
$tpl['TITLE'] = 'Add New Bed';
$tpl['HALL_NAME'] = $this->hall->getLink();
$tpl['FLOOR_NUMBER'] = $this->floor->getLink();
$tpl['ROOM_NUMBER'] = $this->room->getLink();
$tpl['ASSIGNED_TO'] = '<unassigned>';
$submitCmd = CommandFactory::getCommand('AddBed');
$submitCmd->setRoomId($this->room->id);
$tpl['HALL_ABBR'] = $this->hall->getBannerBuildingCode();
$form = new PHPWS_Form();
$submitCmd->initForm($form);
if (isset($this->bedLetter)) {
$form->addText('bed_letter', $this->bedLetter);
} else {
$form->addText('bed_letter', chr($this->room->get_number_of_beds() + 97));
}
$form->addCssClass('bed_letter', 'form-control');
if (isset($this->bedroomLabel)) {
$form->addText('bedroom_label', $this->bedroomLabel);
} else {
$form->addText('bedroom_label', 'a');
}
$form->addCssClass('bedroom_label', 'form-control');
if (isset($this->phoneNumber)) {
$form->addText('phone_number', $this->phoneNumber);
} else {
// Try to guess at the phone number
$beds = $this->room->get_beds();
if (sizeof($beds) > 0) {
$form->addText('phone_number', $beds[0]->phone_number);
} else {
$form->addText('phone_number');
}
}
$form->setMaxSize('phone_number', 4);
$form->setSize('phone_number', 5);
$form->addCssClass('phone_number', 'form-control');
if (isset($this->bannerId)) {
$form->addText('banner_id', $this->bannerId);
} else {
// try to guess a the banner ID
// Strip any text out of the room number, just get the numbers
$match = null;
preg_match("/[0-9]*/", $this->room->room_number, $match);
$roomNumber = $match[0];
$form->addText('banner_id', '0' . $roomNumber . ($this->room->get_number_of_beds() + 1));
}
$form->addCssClass('banner_id', 'form-control');
$form->addCheckBox('ra', 1);
$form->addCheckBox('ra_roommate', 1);
$form->addCheckBox('international_reserved', 1);
$form->mergeTemplate($tpl);
$tpl = $form->getTemplate();
Layout::addPageTitle("Add Bed");
// Reusing the edit bed template here
return PHPWS_Template::process($tpl, 'hms', 'admin/addBed.tpl');
}
示例7: execute
public function execute(CommandContext $context)
{
$id = $context->get('roommateId');
if (is_null($id)) {
throw new InvalidArgumentException('Must set roommateId');
}
PHPWS_Core::initModClass('hms', 'HMS_Roommate.php');
$roommate = new HMS_Roommate($id);
if ($roommate->id == 0) {
throw new InvalidArgumentException('Invalid roommateId ' . $id);
}
$username = UserStatus::getUsername();
if ($username != $roommate->requestee) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException("{$username} tried to display confirmation screen for pairing {$roommate->id}");
}
$tpl = array();
$acceptCmd = CommandFactory::getCommand('ShowRoommateConfirmAccept');
$acceptCmd->setRoommateId($roommate->id);
$tpl['ACCEPT'] = $acceptCmd->getURI();
$rejectCmd = CommandFactory::getCommand('RoommateReject');
$rejectCmd->setRoommateId($roommate->id);
$tpl['DECLINE'] = $rejectCmd->getURI();
$cancelCmd = CommandFactory::getCommand('ShowStudentMenu');
$tpl['CANCEL'] = $cancelCmd->getURI();
$requestor = StudentFactory::getStudentByUsername($roommate->requestor, $roommate->term);
$tpl['REQUESTOR_NAME'] = $requestor->getFullName();
$context->setContent(PHPWS_Template::process($tpl, 'hms', 'student/roommate_accept_reject_screen.tpl'));
}
示例8: show
public function show()
{
$tpl = array();
$tpl['TERM'] = Term::getPrintableSelectedTerm();
$tpl['NAME'] = $this->student->getFullName();
$tpl['LOCATION'] = $this->assignment->where_am_i();
$submitCmd = CommandFactory::getCommand('AssignStudent');
$submitCmd->setUsername($this->student->getUsername());
$submitCmd->setRoom($this->room);
$submitCmd->setBed($this->bed);
$submitCmd->setMealPlan($this->mealPlan);
$submitCmd->setMoveConfirmed("true");
$submitCmd->setAssignmentType($this->assignmentType);
$submitCmd->setNotes($this->notes);
$form = new PHPWS_Form();
$submitCmd->initForm($form);
$form->addSubmit('submit', 'Confirm Move');
$form->setClass('submit', 'btn btn-danger');
$form->mergeTemplate($tpl);
$tpl = $form->getTemplate();
if (!empty($_SERVER['HTTP_REFERER'])) {
$tpl['BACK'] = $_SERVER['HTTP_REFERER'];
} else {
$tpl['BACK'] = 'index.php?module=hms&action=ShowAssignStudent';
}
Layout::addPageTitle("Assignment Move Confirmation");
return PHPWS_Template::process($tpl, 'hms', 'admin/assign_student_move_confirm.tpl');
}
示例9: show
public function show()
{
$tpl = array();
PHPWS_Core::initModClass('hms', 'HMS_Util.php');
$tpl['DATES'] = HMS_Util::getPrettyDateRange($this->startDate, $this->endDate);
if (is_null($this->application)) {
// No application
$tpl['ICON'] = FEATURE_NOTYET_ICON;
$tpl['NOT_APP'] = "";
// this needs to be here to trigger the line in the template
} else {
if (time() < $this->startDate) {
// too early
$tpl['BEGIN_DEADLINE'] = HMS_Util::getFriendlyDate($this->startDate);
$tpl['ICON'] = FEATURE_NOTYET_ICON;
} else {
if (time() > $this->endDate) {
// too late
$tpl['ICON'] = FEATURE_LOCKED_ICON;
$tpl['END_DEADLINE'] = HMS_Util::getFriendlyDate($this->endDate);
} else {
$tpl['ICON'] = FEATURE_OPEN_ICON;
$cmd = CommandFactory::getCommand('ShowEmergencyContactForm');
$cmd->setTerm($this->application->getTerm());
$tpl['UPDATE_CONTACT'] = $cmd->getLink('update your emergency contact info');
}
}
}
return PHPWS_Template::process($tpl, 'hms', 'student/menuBlocks/updateEmergencyContactMenuBlock.tpl');
}
示例10: 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');
}
示例11: show
public function show()
{
PHPWS_Core::initModClass('hms', 'HMS_Lottery.php');
$tpl = array();
$form = new PHPWS_Form();
$submitCmd = CommandFactory::getCommand('LotterySettingsSubmit');
$submitCmd->initForm($form);
$form->addDropBox('lottery_term', Term::getTermsAssoc());
$form->setMatch('lottery_term', PHPWS_Settings::get('hms', 'lottery_term'));
$form->setLabel('lottery_term', 'Lottery Term');
$form->setClass('lottery_term', 'form-control');
$form->addText('hard_cap');
$form->setLabel('hard_cap', 'Max # Returning Students (hard cap):');
$form->setValue('hard_cap', PHPWS_Settings::get('hms', 'lottery_hard_cap'));
$form->setClass('hard_cap', 'form-control');
/*
$form->addText('soph_goal');
$form->setLabel('soph_goal', 'Sophomores:');
$form->setValue('soph_goal', PHPWS_Settings::get('hms', 'lottery_soph_goal'));
*/
$form->addText('jr_goal');
$form->setLabel('jr_goal', 'Juniors:');
$form->setValue('jr_goal', PHPWS_Settings::get('hms', 'lottery_jr_goal'));
$form->setClass('jr_goal', 'form-control');
$form->addText('sr_goal');
$form->setLabel('sr_goal', 'Senior:');
$form->setValue('sr_goal', PHPWS_Settings::get('hms', 'lottery_sr_goal'));
$form->setClass('sr_goal', 'form-control');
$form->addSubmit('submit', 'Save');
$form->mergeTemplate($tpl);
Layout::addPageTitle("Lottery Settings");
return PHPWS_Template::process($form->getTemplate(), 'hms', 'admin/lottery_settings.tpl');
}
示例12: show
public function show()
{
$tpl = array();
$tpl['LOGIN_LINK'] = '';
// a dummy tag to make the actual login content show
return PHPWS_Template::process($tpl, 'hms', 'misc/login.tpl');
}
示例13: display
/**
* Returns the proccessed template that will be displayed
* @return template
*/
public function display()
{
$tpl = array();
javascript('jquery');
javascriptMod('appsync', 'organization');
return \PHPWS_Template::process($tpl, 'appsync', 'top.tpl');
}
示例14: render
protected function render()
{
parent::render();
$this->tpl['TERM'] = Term::toString($this->report->getTerm());
// Males
foreach ($this->report->getMaleTotals() as $total) {
$this->tpl['male_totals'][] = array('COUNT' => $total);
}
$this->tpl['MALE_SUB'] = $this->report->getMaleSubTotal();
// Females
foreach ($this->report->getFemaleTotals() as $total) {
$this->tpl['female_totals'][] = array('COUNT' => $total);
}
$this->tpl['FEMALE_SUB'] = $this->report->getFemaleSubTotal();
// Type totals
foreach ($this->report->getTypeTotals() as $total) {
$this->tpl['type_totals'][] = array('COUNT' => $total);
}
$this->tpl['SUB_TOTAL'] = $this->report->getSubTotal();
// Cancelled totals
$cancelledTotals = $this->report->getCancelledTotals();
$this->tpl['FEMALE_CANCELLED'] = $cancelledTotals[FEMALE];
$this->tpl['MALE_CANCELLED'] = $cancelledTotals[MALE];
$this->tpl['CANCELLED_SUB'] = $this->report->getCancelledSubTotal();
$this->tpl['FEMALE_TOTAL'] = $this->report->getFemaleGrandTotal();
$this->tpl['MALE_TOTAL'] = $this->report->getMaleGrandTotal();
$this->tpl['ALL_TOTAL'] = $this->report->getTotal();
return PHPWS_Template::process($this->tpl, 'hms', 'admin/reports/ApplicantDemographics.tpl');
}
示例15: show
public function show()
{
$tpl = array();
$tpl['TERM'] = Term::getPrintableSelectedTerm();
$form = new PHPWS_Form('roommate_group');
$submitCmd = CommandFactory::getCommand('CreateRoommateGroup');
$submitCmd->initForm($form);
if (isset($this->roommate1)) {
$form->addText('roommate1', $this->roommate1);
} else {
$form->addText('roommate1');
}
$form->addCssClass('roommate1', 'form-control');
$form->setExtra('roommate1', 'autofocus');
if (isset($this->roommate1)) {
$form->addText('roommate2', $this->roommate2);
} else {
$form->addText('roommate2');
}
$form->addCssClass('roommate2', 'form-control');
$form->mergeTemplate($tpl);
$tpl = $form->getTemplate();
Layout::addPageTitle("Create Roommate Group");
return PHPWS_Template::process($tpl, 'hms', 'admin/createRoommateGroup.tpl');
}