本文整理汇总了PHP中Rights::t方法的典型用法代码示例。如果您正苦于以下问题:PHP Rights::t方法的具体用法?PHP Rights::t怎么用?PHP Rights::t使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rights
的用法示例。
在下文中一共展示了Rights::t方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: accessDenied
/**
* Denies the access of the user.
* @param string $message the message to display to the user.
* This method may be invoked when access check fails.
* @throws CHttpException when called unless login is required.
*/
public function accessDenied($message = null)
{
if ($message === null) {
$message = Rights::t('core', 'Bạn không được phép thực hiện hành động này.');
}
$user = Yii::app()->getUser();
if ($user->isGuest === true) {
$user->loginRequired();
} else {
throw new CHttpException(403, $message);
}
}
示例2: init
/**
* Initializes the installer.
* @throws CException if the authorization manager or the web user
* is not configured to use the correct class.
*/
public function init()
{
parent::init();
// Make sure the application is configured
// to use a valid authorization manager.
$authManager = Yii::app()->getAuthManager();
if ($authManager instanceof RDbAuthManager === false) {
throw new CException(Rights::t('install', 'Application authorization manager must extend the RDbAuthManager class.'));
}
// Make sure the application is configured
// to use a valid web user.
$user = Yii::app()->getUser();
//if( ($user instanceof RWebUser)===false )
// throw new CException(Rights::t('install', 'Application web user must extend the RWebUser class.'));
$this->_authManager = $authManager;
$this->db = $this->_authManager->db;
}
示例3: actionRun
/**
* Installs the module.
* @throws CHttpException if the user is not logged in.
*/
public function actionRun()
{
// Make sure the user is not a guest.
if (Yii::app()->user->isGuest === false) {
// Make sure that the module is not already installed.
if (isset($_GET['confirm']) === true || $this->_installer->installed === false) {
// Run the installer and check for an error.
if ($this->_installer->run() === RInstaller::ERROR_NONE) {
// Mark the user to have superuser privileges.
Yii::app()->user->isSuperuser = true;
$this->redirect(array('install/ready'));
}
// Redirect to the error page.
$this->redirect(array('install/error'));
} else {
$this->redirect(array('install/confirm'));
}
} else {
$this->accessDenied(Rights::t('install', 'You must be logged in to install Rights.'));
}
}
示例4: actionRun
/**
* Installs the module.
* @throws CHttpException if the user is not logged in.
*/
public function actionRun()
{
// Make sure the user is not a guest.
if (Yii::app()->user->isGuest === false) {
// Get the application web user.
$user = Yii::app()->getUser();
// Make sure that the module is not already installed.
if (isset($_GET['confirm']) === true || $this->_installer->installed === false) {
// Run the installer and check for an error.
if ($this->_installer->run(true) === true) {
// Mark the user to have superuser priviledges.
$user->isSuperuser = true;
$this->redirect(array('install/ready'));
}
// Set an error message.
$user->setFlash($this->module->flashErrorKey, Rights::t('install', 'Installation failed.'));
$this->redirect(Yii::app()->homeUrl);
} else {
$this->redirect(array('install/confirm'));
}
} else {
$this->accessDenied(Rights::t('install', 'You must be logged in to install Rights.'));
}
}
示例5: array
<?php
$this->breadcrumbs = array('Phân quyền' => Rights::getBaseUrl(), Rights::t('core', 'Assignments'));
?>
<div id="assignments">
<h2><?php
echo Rights::t('core', 'Assignments');
?>
</h2>
<p>
<?php
echo Rights::t('core', 'Here you can view which permissions has been assigned to each user.');
?>
</p>
<?php
$this->widget('zii.widgets.grid.CGridView', array('dataProvider' => $dataProvider, 'template' => "{items}\n{pager}", 'emptyText' => Rights::t('core', 'No users found.'), 'htmlOptions' => array('class' => 'grid-view assignment-table'), 'columns' => array(array('name' => 'name', 'header' => Rights::t('core', 'Name'), 'type' => 'raw', 'htmlOptions' => array('class' => 'name-column'), 'value' => '$data->getAssignmentNameLink()'), array('name' => 'assignments', 'header' => Rights::t('core', 'Roles'), 'type' => 'raw', 'htmlOptions' => array('class' => 'role-column'), 'value' => '$data->getAssignmentsText(CAuthItem::TYPE_ROLE)'), array('name' => 'assignments', 'header' => Rights::t('core', 'Tasks'), 'type' => 'raw', 'htmlOptions' => array('class' => 'task-column'), 'value' => '$data->getAssignmentsText(CAuthItem::TYPE_TASK)'), array('name' => 'assignments', 'header' => Rights::t('core', 'Operations'), 'type' => 'raw', 'htmlOptions' => array('class' => 'operation-column'), 'value' => '$data->getAssignmentsText(CAuthItem::TYPE_OPERATION)'))));
?>
</div>
示例6: getInheritedPermissionText
/**
* Returns the markup for a inherited permission.
* @param array the parents for this item.
* @param boolean whether to display the parent item type.
* @return string the markup.
*/
public function getInheritedPermissionText($parents, $displayType = false)
{
$items = array();
foreach ($parents as $itemName => $item) {
$itemMarkup = $item->getNameText();
if ($displayType === true) {
$itemMarkup .= ' (' . Rights::getAuthItemTypeName($item->type) . ')';
}
$items[] = $itemMarkup;
}
return '<span class="inherited-item" title="' . implode('<br />', $items) . '">' . Rights::t('core', 'Inherited') . ' *</span>';
}
示例7: array
<?php $this->breadcrumbs = array(
'Rights'=>Rights::getBaseUrl(),
Rights::t('core', 'Create :type', array(':type'=>Rights::getAuthItemTypeName($_GET['type']))),
); ?>
<div class="createAuthItem">
<h2 style="color:#427FED;border-bottom:2px solid #ff503f;padding: 10px 1%;width: 98%;"><?php echo Rights::t('core', 'Create :type', array(
':type'=>Rights::getAuthItemTypeName($_GET['type']),
)); ?></h2>
<?php $this->renderPartial('_form', array('model'=>$formModel)); ?>
</div>
示例8: getValidChildTypes
/**
* Returns the valid child item types for a specific type.
* @param string the authorization item type.
* @return array the valid types.
*/
public static function getValidChildTypes($type)
{
switch ((int) $type) {
// Roles can consist of any type of authorization items
case CAuthItem::TYPE_ROLE:
return null;
// Tasks can consist of other tasks and operations
// Tasks can consist of other tasks and operations
case CAuthItem::TYPE_TASK:
return array(CAuthItem::TYPE_TASK, CAuthItem::TYPE_OPERATION);
// Operations can consist of other operations
// Operations can consist of other operations
case CAuthItem::TYPE_OPERATION:
return array(CAuthItem::TYPE_OPERATION);
// Invalid type
// Invalid type
default:
throw new CException(Rights::t('core', 'Invalid authorization item type.'));
}
}
示例9: array
<?php
$this->breadcrumbs = array('Rights' => Rights::getBaseUrl(), Rights::t('core', 'Create :type', array(':type' => Rights::getAuthItemTypeName($_GET['type']))));
$this->title = '<h2>' . Rights::t('core', 'Create :type', array(':type' => Rights::getAuthItemTypeName($_GET['type']))) . '</h2>';
?>
<?php
echo $this->renderPartial('/_menu', array('list' => array()));
?>
<?php
$this->renderPartial('/_flash');
?>
<?php
$this->renderPartial('_form', array('model' => $formModel));
示例10: attributeLabels
/**
* Declares attribute labels.
*/
public function attributeLabels()
{
return array('itemname' => Rights::t('core', 'Authorization item'));
}
示例11: array
<h3><?php
echo Rights::t('core', 'Меню');
?>
</h3>
<hr/>
<?php
$this->widget('zii.widgets.CMenu', array('activeCssClass' => 'active', 'items' => array(array('label' => Rights::t('core', 'Assignments'), 'url' => array('assignment/view'), 'itemOptions' => array('class' => 'item-assignments')), array('label' => Rights::t('core', 'Permissions'), 'url' => array('authItem/permissions'), 'itemOptions' => array('class' => 'item-permissions')), array('label' => Rights::t('core', 'Roles'), 'url' => array('authItem/roles'), 'itemOptions' => array('class' => 'item-roles')), array('label' => Rights::t('core', 'Tasks'), 'url' => array('authItem/tasks'), 'itemOptions' => array('class' => 'item-tasks')), array('label' => Rights::t('core', 'Operations'), 'url' => array('authItem/operations'), 'itemOptions' => array('class' => 'item-operations')))));
if (isset($this->clips['sidebarHelpText'])) {
echo '<div class="hint" style="margin-top:25px;padding-right:5px;">' . $this->clips['sidebarHelpText'] . '</div>';
}
示例12: array
<?php
if ($formModel !== null) {
?>
<div class="form">
<?php
$this->renderPartial('_form', array('model' => $formModel, 'itemnameSelectOptions' => $assignSelectOptions));
?>
</div>
<?php
} else {
?>
<p class="info"><?php
echo Rights::t('core', 'No assignments available to be assigned to this user.');
?>
<?php
}
?>
</div>
<?php
$this->endWidget();
?>
</div>
示例13: bizRuleNotEmpty
/**
* Makes sure that the business rule is not empty when data is specified.
* This is the 'bizRuleNotEmpty' validator as declared in rules().
*/
public function bizRuleNotEmpty($attribute, $params)
{
if (empty($this->data) === false && empty($this->bizRule) === true) {
$this->addError('data', Rights::t('core', 'Business rule cannot be empty.'));
}
}
示例14:
<p class="info"><?php
echo Rights::t('core', 'No children available to be added to this item.');
?>
<?php
}
?>
</div>
<?php
} else {
?>
<p class="info">
<?php
echo Rights::t('core', 'No relations need to be set for the superuser role.');
?>
<br/>
<?php
echo Rights::t('core', 'Super users are always granted access implicitly.');
?>
</p>
<?php
}
?>
</div>
</div>
示例15: if
<?php if( Rights::module()->enableBizRule===true ): ?>
<div class="row">
<?php echo $form->labelEx($model, 'bizRule'); ?>
<?php echo $form->textField($model, 'bizRule', array('maxlength'=>255, 'class'=>'text-field')); ?>
<?php echo $form->error($model, 'bizRule'); ?>
<p class="hint"><?php echo Rights::t('core', 'Code that will be executed when performing access checking.'); ?></p>
</div>
<?php endif; ?>
<?php if( Rights::module()->enableBizRule===true && Rights::module()->enableBizRuleData ): ?>
<div class="row">
<?php echo $form->labelEx($model, 'data'); ?>
<?php echo $form->textField($model, 'data', array('maxlength'=>255, 'class'=>'text-field')); ?>
<?php echo $form->error($model, 'data'); ?>
<p class="hint"><?php echo Rights::t('core', 'Additional data available when executing the business rule.'); ?></p>
</div>
<?php endif; ?>
<div class="row buttons">
<?php echo CHtml::submitButton(Rights::t('core', 'Save'),array('class'=>'submit')); ?> <?php echo CHtml::link(Rights::t('core', 'Cancel'), Yii::app()->user->rightsReturnUrl, array('class'=>'btnCan')); ?>
</div>
<?php $this->endWidget(); ?>
</div>