本文整理汇总了PHP中Term::toString方法的典型用法代码示例。如果您正苦于以下问题:PHP Term::toString方法的具体用法?PHP Term::toString怎么用?PHP Term::toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Term
的用法示例。
在下文中一共展示了Term::toString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
protected function render()
{
require_once PHPWS_SOURCE_DIR . 'mod/hms/class/Term.php';
parent::render();
$this->tpl['TERM'] = Term::toString($this->report->getTerm());
$this->tpl['TOTAL_BEDS'] = $this->report->getTotalBeds();
$this->tpl['TOTAL_ROOMS'] = $this->report->getTotalRooms();
$this->tpl['MALE'] = $this->report->getMale();
$this->tpl['FEMALE'] = $this->report->getFemale();
$this->tpl['COED'] = $this->report->getCoed();
// Copy results into the template
foreach ($this->report->getData() as $row) {
if (empty($row['maleRooms'])) {
$row['maleRooms'] = "None";
}
if (empty($row['femaleRooms'])) {
$row['femaleRooms'] = "None";
}
if (empty($row['coedRooms'])) {
$row['coedRooms'] = "None";
}
$this->tpl['rows'][] = $row;
}
return PHPWS_Template::process($this->tpl, 'hms', 'admin/reports/UnassignedBeds.tpl');
}
示例2: render
protected function render()
{
$this->tpl = $this->report->getSortedRows();
parent::render();
$this->tpl['TERM'] = Term::toString($this->report->getTerm());
return PHPWS_Template::process($this->tpl, 'hms', 'admin/reports/SpecialNeedsRequest.tpl');
}
示例3: 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');
}
示例4: show
public function show()
{
$tpl = array();
$tpl['REVIEW_MSG'] = '';
// set this to show the review message
$tpl['STUDENT_NAME'] = $this->student->getFullName();
$tpl['TERM'] = Term::toString($this->term);
/* Emergency Contact */
$tpl['EMERGENCY_CONTACT_NAME'] = $this->app->getEmergencyContactName();
$tpl['EMERGENCY_CONTACT_RELATIONSHIP'] = $this->app->getEmergencyContactRelationship();
$tpl['EMERGENCY_CONTACT_PHONE'] = $this->app->getEmergencyContactPhone();
$tpl['EMERGENCY_CONTACT_EMAIL'] = $this->app->getEmergencyContactEmail();
$tpl['EMERGENCY_MEDICAL_CONDITION'] = $this->app->getEmergencyMedicalCondition();
/* Missing Person */
$tpl['MISSING_PERSON_NAME'] = $this->app->getMissingPersonName();
$tpl['MISSING_PERSON_RELATIONSHIP'] = $this->app->getMissingPersonRelationship();
$tpl['MISSING_PERSON_PHONE'] = $this->app->getMissingPersonPhone();
$tpl['MISSING_PERSON_EMAIL'] = $this->app->getMissingPersonEmail();
$form = new PHPWS_Form('hidden_form');
$submitCmd = CommandFactory::getCommand('EmergencyContactConfirm');
$submitCmd->setVars($_REQUEST);
$submitCmd->initForm($form);
$form->addSubmit('submit', 'Confirm & Continue');
$redoCmd = CommandFactory::getCommand('ShowEmergencyContactForm');
$redoCmd->setTerm($this->term);
$redoCmd->setVars($_REQUEST);
$tpl['REDO_BUTTON'] = $redoCmd->getLink('modify your information');
$form->mergeTemplate($tpl);
$tpl = $form->getTemplate();
return PHPWS_Template::process($tpl, 'hms', 'student/emergency_contact_form.tpl');
}
示例5: 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');
}
示例6: show
public function show()
{
$tpl = array();
$tpl['TERM'] = Term::toString($this->term);
$form = new PHPWS_Form('rlc_reapp');
$submitCmd = CommandFactory::getCommand('SubmitRLCReapplicationPage2');
$submitCmd->setTerm($this->term);
$submitCmd->initForm($form);
foreach ($this->rlcs as $i => $rlc) {
$question = $this->rlcs[$i]->getReturningQuestion();
if (!isset($question)) {
throw new Exception("Missing returning question for {$this->rlcs[$i]->get_community_name()}");
}
if (isset($this->reApp) && isset($this->reApp->{"rlc_question_{$i}"})) {
$form->addTextArea("rlc_question_{$i}", $this->reApp->{"rlc_question_{$i}"});
} else {
$form->addTextArea("rlc_question_{$i}");
}
$form->setLabel("rlc_question_{$i}", $this->rlcs[$i]->getReturningQuestion());
$form->addCssClass("rlc_question_{$i}", 'form-control');
}
$form->addSubmit('submit', 'Submit Application');
$form->mergeTemplate($tpl);
$tpl = $form->getTemplate();
return PHPWS_Template::process($tpl, 'hms', 'student/RlcReapplicationPage2.tpl');
}
示例7: execute
/**
* Executes this pulse. Does the withdrawn search and emails the results.
*/
public function execute()
{
// Reschedule the next run of this process
$sp = $this->makeClone();
$sp->execute_at = strtotime("tomorrow");
$sp->save();
// Load some classes
PHPWS_Core::initModClass('hms', 'HMS.php');
PHPWS_Core::initModClass('hms', 'WithdrawnSearch.php');
PHPWS_Core::initModClass('hms', 'HMS_Email.php');
PHPWS_Core::initModClass('hms', 'UserStatus.php');
UserStatus::wearMask('HMS System');
// The search is run over all future terms
$terms = Term::getFutureTerms();
$text = "";
foreach ($terms as $term) {
$search = new WithdrawnSearch($term);
$search->doSearch();
$text .= "\n\n=========== " . Term::toString($term) . " ===========\n\n";
$text .= $search->getTextView();
}
$text = $search->getTextView();
HMS_Email::sendWithdrawnSearchOutput($text);
UserStatus::removeMask();
HMS::quit();
}
示例8: 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');
}
示例9: __construct
public function __construct($sendMagicWinners, $sendReminders, array $inviteCounts)
{
// Gender and classes
$this->genders = array(MALE, FEMALE);
$this->classes = array(CLASS_SENIOR, CLASS_JUNIOR, CLASS_SOPHOMORE);
// Send magic winners?
$this->sendMagicWinners = $sendMagicWinners;
// Send reminders?
$this->sendReminders = $sendReminders;
// Invite counts to be sent
$this->inviteCounts = $inviteCounts;
// One-time date/time calculations, setup for later on
$this->term = PHPWS_Settings::get('hms', 'lottery_term');
$this->year = Term::getTermYear($this->term);
$this->academicYear = Term::toString($this->term) . ' - ' . Term::toString(Term::getNextTerm($this->term));
$this->now = time();
$this->expireTime = $this->now + INVITE_TTL_HRS * 3600;
// Hard Cap
$this->hardCap = LotteryProcess::getHardCap();
// Soft caps
$this->jrSoftCap = LotteryProcess::getJrSoftCap();
$this->srSoftCap = LotteryProcess::getSrSoftCap();
// Invites Sent by this process so far this run
$this->numInvitesSent['TOTAL'] = 0;
foreach ($this->classes as $c) {
foreach ($this->genders as $g) {
$this->numInvitesSent[$c][$g] = 0;
}
}
$this->output = array();
}
示例10: execute
public function execute(CommandContext $context)
{
// Check permissions
if (!Current_User::allow('hms', 'checkin')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to checkin students.');
}
$term = Term::getSelectedTerm();
$bannerId = $context->get('bannerId');
$hallId = $context->get('hallId');
$errorCmd = CommandFactory::getCommand('ShowCheckinStart');
if (!isset($bannerId) || is_null($bannerId) || $bannerId == '') {
NQ::simple('hms', hms\NotificationView::ERROR, 'Missing Banner ID.');
$errorCmd->redirect();
}
if (!isset($hallId)) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Missing residence hall ID.');
$errorCmd->redirect();
}
// Check the Banner ID
if (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 {
$student = StudentFactory::getStudentByBannerId($bannerId, $term);
} catch (StudentNotFoundException $e) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Could not locate a student with that Banner ID.');
$errorCmd->redirect();
}
// Make sure the student is assigned in the current term
$assignment = HMS_Assignment::getAssignmentByBannerId($bannerId, $term);
if (!isset($assignment) || is_null($assignment)) {
NQ::simple('hms', hms\NotificationView::ERROR, $student->getName() . ' is not assigned for ' . Term::toString($term) . '. Please contact the University Housing Assignments Office at 828-262-6111.');
$errorCmd->redirect();
}
// Make sure the student's assignment matches the hall the user selected
$bed = $assignment->get_parent();
$room = $bed->get_parent();
$floor = $room->get_parent();
$hall = $floor->get_parent();
if ($hallId != $hall->getId()) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Wrong hall! ' . $student->getName() . ' is assigned to ' . $assignment->where_am_i());
$errorCmd->redirect();
}
// Load any existing check-in
$checkin = CheckinFactory::getLastCheckinByBannerId($bannerId, $term);
// If there is a checkin for the same bed, and the difference between the current time and the checkin time is
// greater than 48 hours, then show an error.
if (!is_null($checkin)) {
$checkoutDate = $checkin->getCheckoutDate();
if ($checkin->getBedId() == $bed->getId() && !isset($checkoutDate) && time() - $checkin->getCheckinDate() > Checkin::CHECKIN_TIMEOUT) {
NQ::simple('hms', hms\NotificationView::ERROR, $student->getName() . ' has already checked in to ' . $assignment->where_am_i());
$errorCmd->redirect();
}
}
$view = new CheckinFormView($student, $assignment, $hall, $floor, $room, $checkin);
$context->setContent($view->show());
}
示例11: show
public function show()
{
PHPWS_Core::initModClass('hms', 'HMS_Learning_Community.php');
PHPWS_Core::initModClass('hms', 'HMS_RLC_Application.php');
PHPWS_Core::initModClass('hms', 'HMS_RLC_Assignment.php');
Layout::addPageTitle("RLC Application Review");
$tags = array();
if (UserStatus::isAdmin()) {
$menuCmd = CommandFactory::getCommand('ShowAssignRlcApplicants');
$tags['MENU_LINK'] = $menuCmd->getURI();
} else {
$menuCmd = CommandFactory::getCommand('ShowStudentMenu');
$tags['MENU_LINK'] = $menuCmd->getURI();
}
$tags['FULL_NAME'] = $this->student->getFullName();
$tags['STUDENT_TYPE'] = $this->student->getPrintableType();
$tags['TERM'] = Term::toString($this->application->getTerm());
$appType = $this->application->getApplicationType();
if ($appType == RLC_APP_FRESHMEN) {
$tags['APPLICATION_TYPE'] = 'Freshmen';
} else {
if ($appType == RLC_APP_RETURNING) {
$tags['APPLICATION_TYPE'] = 'Re-application';
}
}
$rlcs = HMS_Learning_Community::getRlcList();
$tags['FIRST_CHOICE'] = $rlcs[$this->application->rlc_first_choice_id];
if (isset($this->application->rlc_second_choice_id)) {
$tags['SECOND_CHOICE'] = $rlcs[$this->application->rlc_second_choice_id];
}
if (isset($this->application->rlc_third_choice_id)) {
$tags['THIRD_CHOICE'] = $rlcs[$this->application->rlc_third_choice_id];
}
$tags['WHY_SPECIFIC'] = $this->application->why_specific_communities;
$tags['STRENGTHS_AND_WEAKNESSES'] = $this->application->strengths_weaknesses;
$tags['WHY_FIRST_CHOICE'] = $this->application->rlc_question_0;
if (isset($this->application->rlc_second_choice_id)) {
$tags['WHY_SECOND_CHOICE'] = $this->application->rlc_question_1;
}
if (isset($this->application->rlc_second_choice_id)) {
$tags['WHY_THIRD_CHOICE'] = $this->application->rlc_question_2;
}
// If this application is denied and the person logged in is an admin, show a warning
if ($this->application->isDenied() && UserStatus::isAdmin()) {
NQ::simple('hms', hms\NotificationView::WARNING, 'This application has been denied.');
}
// Show options depending of status of application.
if (UserStatus::isAdmin() && Current_User::allow('hms', 'approve_rlc_applications')) {
if (!$this->application->denied && !HMS_RLC_Assignment::checkForAssignment($this->student->getUsername(), Term::getSelectedTerm())) {
// Approve application for the community selected from dropdown
$approvalForm = $this->getApprovalForm();
$approvalForm->mergeTemplate($tags);
$tags = $approvalForm->getTemplate();
// Deny application
$tags['DENY_APP'] = $this->getDenialLink();
}
}
return PHPWS_Template::process($tags, 'hms', 'student/rlc_application.tpl');
}
示例12: render
protected function render()
{
parent::render();
$this->tpl['rows'] = $this->report->getRows();
$this->tpl['TERM'] = Term::toString($this->report->getTerm());
$this->tpl['totalCoed'] = $this->report->getTotalCoed();
return PHPWS_Template::process($this->tpl, 'hms', 'admin/reports/CoedRooms.tpl');
}
示例13: render
protected function render()
{
parent::render();
$rows = $this->report->getRows();
$this->tpl['rows'] = $rows;
$this->tpl['TERM'] = Term::toString($this->report->getTerm());
return PHPWS_Template::process($this->tpl, 'hms', 'admin/reports/TwentyFive.tpl');
}
示例14: show
public function show()
{
$excess_limit = 3;
// Number of rows to show by default
$count = 0;
$tpl = array();
$historyRows = array();
$excessRows = array();
$historyArray = $this->assignmentHistory->getHistory();
foreach ($historyArray as $ah) {
$row = array();
if (defined($ah->assigned_reason)) {
$assignedReason = constant($ah->assigned_reason);
// for pretty text purposes
} else {
$assignedReason = $ah->assigned_reason;
}
if (defined($ah->removed_reason)) {
$removedReason = constant($ah->removed_reason);
// for pretty text purposes
} else {
$removedReason = $ah->removed_reason;
}
if (!is_null($ah->assigned_on)) {
$assignedOn = date('M jS, Y \\a\\t g:ia', $ah->assigned_on);
}
if (!is_null($ah->removed_on)) {
$removedOn = date('M jS, Y \\a\\t g:ia', $ah->removed_on);
}
$bed = new HMS_Bed($ah->getBedId());
$row['room'] = $bed->where_am_i();
$row['term'] = Term::toString($ah->term);
// Combine for ease of view
if (isset($ah->assigned_reason)) {
$row['assignments'] = '<em>' . $assignedReason . '</em>' . ' by ' . $ah->assigned_by . '<br /><span style="font-size:11px;color:#7C7C7C;">on ' . $assignedOn . '</span>';
} else {
$row['assignments'] = '<em class="text-muted">None</em>';
}
if (isset($ah->removed_reason)) {
$row['unassignments'] = '<em>' . $removedReason . '</em>' . ' by ' . $ah->removed_by . '<br /><span style="font-size:11px;color:#7C7C7C;">on ' . $removedOn . '</span>';
} else {
$row['unassignments'] = '<em class="text-muted">None</em>';
}
if ($count++ < $excess_limit) {
$historyRows[] = $row;
} else {
$excessRows[] = $row;
}
}
$tpl['HISTORY'] = $historyRows;
$tpl['EXTRA_HISTORY'] = $excessRows;
if (sizeof($historyArray) > $excess_limit) {
$tpl['SHOW_MORE'] = "[ <a id='showMoreLink'>show more</a> ]";
}
return PHPWS_Template::process($tpl, 'hms', 'admin/StudentAssignmentHistoryView.tpl');
}
示例15: 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;
}