本文整理汇总了PHP中Term类的典型用法代码示例。如果您正苦于以下问题:PHP Term类的具体用法?PHP Term怎么用?PHP Term使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Term类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute(CommandContext $context)
{
$term = new Term(Term::getSelectedTerm());
$term->setDocusignTemplate($context->get('template'));
$term->setDocusignUnder18Template($context->get('under18_template'));
$term->save();
$cmd = CommandFactory::getCommand('ShowEditTerm');
$cmd->redirect();
}
示例2: show
public function show()
{
if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'edit_terms')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to edit terms.');
}
$printable = Term::getPrintableSelectedTerm();
$tpl = array();
$tpl['TITLE'] = dgettext('hms', 'Term settings for ') . $printable;
$newTermCmd = CommandFactory::getCommand('ShowCreateTerm');
$tpl['NEW_TERM_URI'] = $newTermCmd->getURI();
// Is this the Current Term?
if (Term::isCurrentTermSelected()) {
$tpl['CURRENT_TERM_TEXT'] = dgettext('hms', 'This term is the <strong>active term</strong>. To make another term active, please select it from the list at the top-left.');
} else {
$tpl['CURRENT_TERM_TEXT'] = dgettext('hms', 'This term is <strong>not</strong> the active term.');
if (Current_User::allow('hms', 'activate_term')) {
$cmd = CommandFactory::getCommand('SetCurrentTerm');
$cmd->setTerm(Term::getSelectedTerm());
$tpl['SET_TERM_URI'] = $cmd->getURI();
$tpl['SET_TERM_TEXT'] = "Make <strong>{$printable}</strong> the Current Term";
}
}
// What's with the Banner Queue?
$term = new Term(Term::getSelectedTerm());
if ($term->getBannerQueue()) {
$tpl['QUEUE_ENABLED'] = '';
$count = $term->getQueueCount();
$tpl['BANNER_QUEUE_COUNT'] = $count;
if ($count > 0) {
$cmd = CommandFactory::getCommand('ProcessBannerQueue');
$cmd->setTerm(Term::getSelectedTerm());
$tpl['BANNER_QUEUE_PROCESS_URI'] = $cmd->getURI();
} else {
$cmd = CommandFactory::getCommand('DisableBannerQueue');
$cmd->setTerm(Term::getSelectedTerm());
$tpl['BANNER_QUEUE_LINK'] = $cmd->getLink('Disable');
}
} else {
$tpl['QUEUE_DISABLED'] = '';
$cmd = CommandFactory::getCommand('EnableBannerQueue');
$cmd->setTerm(Term::getSelectedTerm());
$tpl['BANNER_QUEUE_LINK'] = $cmd->getLink('Enable');
}
// Terms and Conditions
PHPWS_Core::initModClass('hms', 'TermsConditionsAdminView.php');
$tcav = new TermsConditionsAdminView($this->term);
$tpl['TERMS_CONDITIONS_CONTENT'] = $tcav->show();
// Features and Deadlines
PHPWS_Core::initModClass('hms', 'ApplicationFeatureListView.php');
$aflv = new ApplicationFeatureListView(Term::getSelectedTerm());
$tpl['FEATURES_DEADLINES_CONTENT'] = $aflv->show();
Layout::addPageTitle("Term Settings");
return PHPWS_Template::process($tpl, 'hms', 'admin/TermEditView.tpl');
}
示例3: import_terms
protected function import_terms($array)
{
foreach ($array as $term_data) {
$term = new Term($term_data->name, $term_data->taxonomy);
if ($term->id) {
foreach ($term_data as $key => $value) {
$term->set($key, $value);
}
}
}
}
示例4: show
public function show()
{
PHPWS_Core::initCoreClass('Form.php');
javascript('jquery');
javascript('modules/hms/assign_student');
$unassignCmd = CommandFactory::getCommand('UnassignStudent');
$form = new PHPWS_Form();
$unassignCmd->initForm($form);
$form->addText('username');
if (!is_null($this->student)) {
$form->setValue('username', $this->student->getUsername());
}
$form->addCssClass('username', 'form-control');
$form->setExtra('username', 'autofocus');
// Addition of "Unassignment Type"
$form->addDropBox('unassignment_type', array('-1' => 'Choose a reason...', UNASSIGN_ADMIN => 'Administrative', UNASSIGN_REASSIGN => 'Re-assign', UNASSIGN_CANCEL => 'Contract Cancellation', UNASSIGN_PRE_SPRING => 'Pre-spring room change', UNASSIGN_RELEASE => 'Contract Release'));
//$form->setMatch('unassignment_type', UNASSIGN_ADMIN);
$form->setLabel('unassignment_type', 'Unassignment Type: ');
$form->addCssClass('unassignment_type', 'form-control');
$form->addText('refund');
$form->setLabel('refund', 'Refund Percentage');
$form->setSize('refund', 4);
$form->setMaxSize('refund', 3);
$form->addCssClass('refund', 'form-control');
$form->addTextarea('note');
$form->setLabel('note', 'Note: ');
$form->addCssClass('note', 'form-control');
$tpl = $form->getTemplate();
$tpl['TERM'] = Term::getPrintableSelectedTerm();
Layout::addPageTitle("Unassign Student");
return PHPWS_Template::process($tpl, 'hms', 'admin/unassignStudent.tpl');
}
示例5: execute
public function execute(CommandContext $context)
{
$resultCmd = CommandFactory::getCommand('ShowSendRlcInvites');
$respondByDate = $context->get('respond_by_date');
$respondByTime = $context->get('time');
if (!isset($respondByDate) || $respondByDate == '') {
NQ::simple('hms', hms\NotificationView::ERROR, 'Please choose a \'respond by\' date.');
$resultCmd->redirect();
}
$dateParts = explode('/', $respondByDate);
$respondByTimestamp = mktime($respondByTime, null, null, $dateParts[0], $dateParts[1], $dateParts[2]);
$term = Term::getSelectedTerm();
$studentType = $context->get('type');
if (!isset($studentType)) {
NQ::simple('hms', hms\NotificationView::ERROR, 'Please choose a student type.');
$resultCmd->redirect();
}
PHPWS_Core::initModClass('hms', 'RlcAssignmentFactory.php');
PHPWS_Core::initModClass('hms', 'RlcAssignmentInvitedState.php');
$assignments = RlcAssignmentFactory::getAssignmentsByTermStateType($term, 'new', $studentType);
if (sizeof($assignments) == 0) {
NQ::simple('hms', hms\NotificationView::WARNING, 'No invites needed to be sent.');
$resultCmd->redirect();
}
foreach ($assignments as $assign) {
$assign->changeState(new RlcAssignmentInvitedState($assign, $respondByTimestamp));
}
NQ::simple('hms', hms\NotificationView::SUCCESS, 'Learning community invites sent.');
$resultCmd->redirect();
}
示例6: 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');
}
示例7: actionList
public function actionList()
{
$title = 'Sản phẩm';
$criteria = new CDbCriteria(array('condition' => 'status<>0', 'order' => 'count_buy DESC'));
if ($_GET['catid']) {
$criteria->addCondition('`cat_id` =' . $_GET['catid']);
$term = Term::model()->findByPk($_GET['catid']);
$title = $term->name;
}
$dataProvider = new CActiveDataProvider('Product', array('pagination' => array('pageSize' => Yii::app()->params['itemsPerPage']), 'criteria' => $criteria));
$thuongHieu = Term::model()->findAll('vid=7');
$thItems = array();
if ($thuongHieu) {
foreach ($thuongHieu as $thItem) {
$thItems[] = array('title' => $thItem['name'], 'value' => $thItem['id'], 'checked' => false);
}
}
$cat = Term::model()->findAll('vid=6');
$catItems = array();
if ($cat) {
foreach ($cat as $thItem) {
$catItems[] = array('title' => $thItem['name'], 'value' => $thItem['id'], 'checked' => false);
}
}
$this->render('list', array('items' => $dataProvider, 'title' => $title, 'thItems' => $thItems, 'catItems' => $catItems));
}
示例8: show
public function show()
{
$username = UserStatus::getUsername();
$currentTerm = Term::getCurrentTerm();
$student = StudentFactory::getStudentByUsername($username, $currentTerm);
$applicationTerm = $student->getApplicationTerm();
$tpl = array();
$tpl['TITLE'] = 'Contact Form';
$form = new PHPWS_Form();
$form->addText('name');
$form->setLabel('name', 'Name');
$form->addText('email');
$form->setLabel('email', 'Email Address');
$form->addText('phone');
$form->setLabel('phone', 'Phone number');
$form->addDropBox('stype', array('F' => 'New Freshmen', 'T' => 'Transfer', 'C' => 'Returning'));
$form->setLabel('stype', 'Classification');
$form->addTextArea('comments');
$form->setLabel('comments', 'Question, Comments, or Description of the Problem');
$form->addSubmit('Submit');
$form->mergeTemplate($tpl);
$cmd = CommandFactory::getCommand('SubmitContactForm');
$cmd->setUsername($username);
$cmd->setApplicationTerm($applicationTerm);
$cmd->setStudentType($student->getType());
$cmd->initForm($form);
$tpl = $form->getTemplate();
//var_dump($tpl);exit;
return PHPWS_Template::process($tpl, 'hms', 'student/contact_page.tpl');
}
示例9: 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');
}
示例10: execute
public function execute(CommandContext $context)
{
if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'floor_view')) {
PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
throw new PermissionException('You do not have permission to edit floors.');
}
// Check for a hall ID
$floorId = $context->get('floor');
if (!isset($floorId)) {
throw new InvalidArgumentException('Missing floor ID.');
}
PHPWS_Core::initModClass('hms', 'HMS_Residence_Hall.php');
PHPWS_Core::initModClass('hms', 'HMS_Floor.php');
PHPWS_Core::initModClass('hms', 'FloorView.php');
$floor = new HMS_Floor($floorId);
if ($floor->term != Term::getSelectedTerm()) {
$floorCmd = CommandFactory::getCommand('SelectFloor');
$floorCmd->setTitle('Edit a Floor');
$floorCmd->setOnSelectCmd(CommandFactory::getCommand('EditFloorView'));
$floorCmd->redirect();
}
$hall = $floor->get_parent();
$floorView = new FloorView($hall, $floor);
$context->setContent($floorView->show());
}
示例11: show
public function show()
{
$tpl = array();
if ($this->halls == NULL) {
NQ::simple('hms', hms\NotificationView::ERROR, 'There are no halls available for the selected term.');
$cmd = CommandFactory::getCommand('ShowAdminMaintenanceMenu');
$cmd->redirect();
}
$tpl['TITLE'] = $this->title;
$tpl['TERM'] = Term::getPrintableSelectedTerm();
javascript('jquery');
javascript('modules/hms/select_floor');
# Setup the form
$form = new PHPWS_Form();
$this->onSelectCmd->initForm($form);
$form->setMethod('get');
$form->addDropBox('residence_hall', $this->halls);
$form->setLabel('residence_hall', 'Residence hall');
$form->setMatch('residence_hall', 0);
$form->setClass('residence_hall', 'form-control');
$form->addDropBox('floor', array(0 => ''));
$form->setLabel('floor', 'Floor');
$form->setClass('floor', 'form-control');
$form->addSubmit('submit_button', 'Select');
$form->mergeTemplate($tpl);
$tpl = $form->getTemplate();
Layout::addPageTitle("Select Floor");
return PHPWS_Template::process($tpl, 'hms', 'admin/select_floor.tpl');
}
示例12: 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');
}
示例13: 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();
}
示例14: 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');
}
示例15: __get
/**
* function __get
* Overrides QueryRecord __get to implement custom object properties
* @param string Name of property to return
* @return mixed The requested field value
**/
public function __get($name)
{
$term = Term::get(Tags::vocabulary()->id, $this->id);
switch ($name) {
case 'tag':
case 'tag_text':
$out = $term->term_display;
break;
case 'tag_text_searchable':
// if it's got spaces, then quote it.
if (strpos($term->term_display, ' ') !== FALSE) {
$out = '\'' . str_replace("'", "\\'", $term->term_display) . '\'';
} else {
$out = $term->term_display;
}
break;
case 'slug':
case 'tag_slug':
$out = $term->term;
break;
case 'count':
$out = $this->get_count();
break;
default:
break;
}
return $out;
}