本文整理匯總了PHP中Rights::getDataCsrf方法的典型用法代碼示例。如果您正苦於以下問題:PHP Rights::getDataCsrf方法的具體用法?PHP Rights::getDataCsrf怎麽用?PHP Rights::getDataCsrf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Rights
的用法示例。
在下文中一共展示了Rights::getDataCsrf方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getAssignPermissionLink
/**
* Returns the markup for the assign permission link.
* @param CAuthItem $role the role the permission is for.
* @return string the markup.
*/
public function getAssignPermissionLink(CAuthItem $role)
{
$csrf = Rights::getDataCsrf();
return CHtml::link(Rights::t('core', ''), '#', array('onclick' => "\n\t\t\t\tjQuery.ajax({\n\t\t\t\t\ttype:'POST',\n\t\t\t\t\turl:'" . Yii::app()->controller->createUrl('authItem/assign', array('name' => urlencode($role->name), 'child' => urlencode($this->owner->name))) . "',\n\t\t\t\t\tdata:{ ajax:1 {$csrf} },\n\t\t\t\t\tsuccess:function() {\n\t\t\t\t\t\t\$('#permissions').load('" . Yii::app()->controller->createUrl('authItem/permissions') . "', { ajax:1 {$csrf} });\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\treturn false;\t\t\t\t\n\t\t\t", 'class' => 'fa fa-plus', 'title' => 'Asignar'));
}
示例2: getAssignPermissionLink
/**
* Returns the markup for the assign permission link.
* @param CAuthItem $role the role the permission is for.
* @return string the markup.
*/
public function getAssignPermissionLink(CAuthItem $role)
{
$csrf = Rights::getDataCsrf();
$img = CHtml::image(Yii::app()->baseUrl . '/images/unchecked.png', '', array('style' => 'height:16px'));
return CHtml::link($img, '#', array('title' => Rights::t('core', 'Assign'), 'onclick' => "\n\t\t\t\tjQuery.ajax({\n\t\t\t\t\ttype:'POST',\n\t\t\t\t\turl:'" . Yii::app()->controller->createUrl('authItem/assign', array('name' => urlencode($role->name), 'child' => urlencode($this->owner->name))) . "',\n\t\t\t\t\tdata:{ ajax:1 {$csrf} }, \n\t\t\t\t\tsuccess:function() {\n\t\t\t\t\t\t\$('#permissions').load('" . Yii::app()->controller->createUrl('authItem/permissions') . "', { ajax:1 {$csrf} });\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\treturn false;\t\t\t\t\n\t\t\t", 'class' => 'assign-link'));
}