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


PHP Permission::labelInitials方法代碼示例

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


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

示例1: Input

            }
            if ($targetUser->id === $currentUser->id) {
                Response::fail("You cannot {$action} yourself");
            }
            if (Permission::sufficient('staff', $targetUser->role)) {
                Response::fail("You cannot {$action} people within the assistant or any higher group");
            }
            if ($action == 'banish' && $targetUser->role === 'ban' || $action == 'un-banish' && $targetUser->role !== 'ban') {
                Response::fail("This user has already been {$action}ed");
            }
            $reason = (new Input('reason', 'string', array(Input::IN_RANGE => [5, 255], Input::CUSTOM_ERROR_MESSAGES => array(Input::ERROR_MISSING => 'Please specify a reason', Input::ERROR_RANGE => 'Reason length must be between @min and @max characters'))))->out();
            $changes = array('role' => $action == 'banish' ? 'ban' : 'user');
            $Database->where('id', $targetUser->id)->update('users', $changes);
            Logs::action($action, array('target' => $targetUser->id, 'reason' => $reason));
            $changes['role'] = Permission::ROLES_ASSOC[$changes['role']];
            $changes['badge'] = Permission::labelInitials($changes['role']);
            if ($action == 'banish') {
                Response::done($changes);
            }
            Response::success("We welcome {$targetUser->name} back with open hooves!", $changes);
        } else {
            CoreUtils::notFound();
        }
    }
}
if (strtolower($data) === 'immortalsexgod') {
    $data = 'DJDavid98';
}
if (empty($data)) {
    if ($signedIn) {
        $un = $currentUser->name;
開發者ID:ponydevs,項目名稱:MLPVC-RR,代碼行數:31,代碼來源:user.php

示例2:

use App\Time;
use App\UserPrefs;
use App\Users;

/** @var $User User */

if (isset($MSG)){
	echo "<h1>$MSG</h1>";
	if (isset($SubMSG)) echo "<p>$SubMSG</p>";
}
else {
	$vectorapp = UserPrefs::get('p_vectorapp', $User->id); ?>
	<div class="briefing">
		<?=$User->getAvatarWrap()?>
		<div class="title">
			<h1><span class="role-badge"><?=Permission::labelInitials($User->role)?></span><span class="username"><?=$User->name?></span><a class="da" title="Visit DeviantArt profile" href="<?=$User->getDALink(User::LINKFORMAT_URL)?>"><?=str_replace(' fill="#FFF"','',file_get_contents(APPATH.'img/da-logo.svg'))?></a><?=!empty($vectorapp)?"<img class='vectorapp-logo' src='/img/vapps/$vectorapp.svg' alt='$vectorapp logo' title='".CoreUtils::$VECTOR_APPS[$vectorapp]." user'>":''?></h1>
			<p><?php
echo "<span class='rolelabel'>{$User->rolelabel}</span>";
if ($canEdit){
	echo ' <button id="change-role" class="blue typcn typcn-spanner'.($User->role==='ban'?' hidden':'').'" title="Change '.CoreUtils::posess($User->name).' group"></button>';
	$BanLabel = ($User->role==='ban'?'Un-ban':'Ban').'ish';
	$Icon = $User->role==='ban'?'world':'weather-night';
	if (Permission::sufficient('staff', $User->role))
		$Icon .= ' hidden';
	echo ' <button id="ban-toggle" class="darkblue typcn typcn-'.$Icon.' '.strtolower($BanLabel).'" title="'."$BanLabel user".'"></button>';
}
if (Permission::sufficient('developer'))
	echo " &bullet; <span class='userid'>{$User->id}</span>";
			?></p>
		</div>
	</div>
開發者ID:ponydevs,項目名稱:MLPVC-RR,代碼行數:31,代碼來源:user.php

示例3: array

if (!empty($Users)) {
    $Arranged = array();
    foreach ($Users as $u) {
        if (!isset($Arranged[$u->role])) {
            $Arranged[$u->role] = array();
        }
        $Arranged[$u->role][] = $u;
    }
    foreach (array_reverse(Permission::ROLES) as $r => $v) {
        if (empty($Arranged[$r])) {
            continue;
        }
        /** @var $users \App\Models\User[] */
        $users = $Arranged[$r];
        $group = CoreUtils::makePlural(Permission::ROLES_ASSOC[$r], count($users), true);
        $groupInitials = '[' . Permission::labelInitials($r) . ']';
        $usersStr = array();
        foreach ($users as $u) {
            $usersStr[] = $u->getProfileLink();
        }
        $usersStr = implode(', ', $usersStr);
        echo <<<HTML
<section>
\t<h2>{$group} {$groupInitials}</h2>
\t{$usersStr}
</section>
HTML;
    }
}
?>
	</div>
開發者ID:ponydevs,項目名稱:MLPVC-RR,代碼行數:31,代碼來源:users.php


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