/**
  * 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'));
 }
Ejemplo n.º 2
0
 /**
  * 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'));
 }