當前位置: 首頁>>代碼示例>>PHP>>正文


PHP UserStatus::isMasqueradingAsSelf方法代碼示例

本文整理匯總了PHP中UserStatus::isMasqueradingAsSelf方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserStatus::isMasqueradingAsSelf方法的具體用法?PHP UserStatus::isMasqueradingAsSelf怎麽用?PHP UserStatus::isMasqueradingAsSelf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UserStatus的用法示例。


在下文中一共展示了UserStatus::isMasqueradingAsSelf方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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::isMasqueradingAsSelf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。