当前位置: 首页>>代码示例>>PHP>>正文


PHP UserStatus::isGuest方法代码示例

本文整理汇总了PHP中UserStatus::isGuest方法的典型用法代码示例。如果您正苦于以下问题:PHP UserStatus::isGuest方法的具体用法?PHP UserStatus::isGuest怎么用?PHP UserStatus::isGuest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserStatus的用法示例。


在下文中一共展示了UserStatus::isGuest方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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');
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:29,代码来源:TermSelector.php

示例2: execute

 public function execute(CommandContext $context)
 {
     if (!UserStatus::isAdmin() || !Current_User::allow('hms', 'select_term')) {
         PHPWS_Core::initModClass('hms', 'exception/PermissionException.php');
         throw new PermissionException('You do no have permission to select other terms.');
     }
     if (UserStatus::isGuest()) {
         $context->goBack();
     }
     if (!isset($this->term)) {
         $this->term = $context->get('term');
     }
     Term::setSelectedTerm($this->term);
     $context->goBack();
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:15,代码来源:SelectTermCommand.php

示例3: addUserStatus

 private function addUserStatus()
 {
     // If the user is not logged in, then we have nothing to do here
     if (\UserStatus::isGuest()) {
         return;
     }
     $userTpl = array();
     $userTpl['FULL_NAME'] = \UserStatus::getDisplayName();
     $useDropdown = false;
     if (\UserStatus::isMasquerading() && \UserStatus::isMasqueradingAsSelf()) {
         // User is masquerading as student version of self
         $useDropdown = true;
         $userTpl['FULL_NAME'] = \UserStatus::getDisplayName() . ' (student)';
         $cmd = \CommandFactory::getCommand('RemoveMaskAsSelf');
         $userTpl['STUDENT_SELF_RETURN'] = $cmd->getURI();
         // Link to return to admin version of self
     } else {
         if (\UserStatus::isMasquerading()) {
             // User is masquerading as a student
             $useDropdown = true;
             $cmd = \CommandFactory::getCommand('RemoveMask');
             $userTpl['REMOVE_MASK'] = $cmd->getURI();
             $userTpl['FULL_NAME'] = '<strong class="text-danger">' . \UserStatus::getDisplayName() . '</strong>';
         } else {
             if (\Current_User::allow('hms', 'ra_login_as_self')) {
                 // User is not masquerading, but do have permission to change to student self-view
                 $useDropdown = true;
                 $studentViewCmd = \CommandFactory::getCommand('RaMasqueradeAsSelf');
                 $userTpl['STUDENT_VIEW_URI'] = $studentViewCmd->getURI();
             }
         }
     }
     if ($useDropdown) {
         // Other options available, so we'll render a drop down
         $this->tpl['USER_STATUS_DROPDOWN'] = \PHPWS_Template::process($userTpl, 'hms', 'UserStatus.tpl');
     } else {
         // No other options, so the user status is just the display name
         $this->tpl['DISPLAY_NAME'] = \UserStatus::getDisplayName();
     }
 }
开发者ID:jlbooker,项目名称:homestead,代码行数:40,代码来源:NavBar.php


注:本文中的UserStatus::isGuest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。