Ejemplo n.º 1
0
 public function init()
 {
     if (Yii::app()->user->isGuest) {
         $this->redirect('/');
     }
     $modleRole = UserRole::model()->find('name LIKE "' . Yii::app()->user->role . '"')->id;
     $modelSiteModel = SiteModule::model()->find('templates LIKE "' . $this->module_template_name . '"');
     if ($modleRole && $modelSiteModel) {
         $modelRule = UserGroupRule::model()->find('user_role_id = ' . $modleRole . ' AND module_id=' . $modelSiteModel->id);
         if ($modelRule) {
             $this->rule = $modelRule->access_type;
         }
     }
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = UserGroupRule::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Ejemplo n.º 3
0
?>

    <!-- Fields with <span class="required">*</span> are required. -->
	<!--<p class="help-block"><?php 
echo Yii::t("Bootstrap", "PHRASE.FIELDS_REQUIRED");
?>
</p>-->

	<?php 
echo $form->errorSummary($model);
?>

<?php 
echo $form->dropDownListRow($model, 'user_role_id', UserGroupRule::model()->getRoleList(), array('class' => 'span5'));
echo $form->dropDownListRow($model, 'module_id', UserGroupRule::model()->getModulesList(), array('class' => 'span5'));
echo $form->dropDownListRow($model, 'access_type', UserGroupRule::model()->getAccessType(), array('class' => 'span5'));
?>



	<div class="form-actions">

		<?php 
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'htmlOptions' => array('style' => 'margin-right: 20px'), 'label' => $model->isNewRecord ? Yii::t('Bootstrap', 'PHRASE.BUTTON.CREATE') : Yii::t('Bootstrap', 'PHRASE.BUTTON.SAVE')));
?>

		<?php 
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'htmlOptions' => array('name' => 'go_to_list', 'style' => 'margin-right: 20px'), 'label' => $model->isNewRecord ? Yii::t('Bootstrap', 'PHRASE.BUTTON.CREATE_RETURN') : Yii::t('Bootstrap', 'PHRASE.BUTTON.SAVE_RETURN')));
?>

        <?php 
Ejemplo n.º 4
0
    'columns'=>array(


            
            array(
            'user_role_id',
            'htmlOptions'=>array('class'=>'span5')
        ),
        
            array(
            'module_id',
            'htmlOptions'=>array('class'=>'span5')
        ),
        
            array(
            'access_type',
            'htmlOptions'=>array('class'=>'span5')
        ),
        
            array(
            'created_at',
            'date',
            'range'=>true
        ),
        
    ),
));
*/
echo '<a href="usergrouprule/create" class="btn">Добавить</a>';
$this->widget('bootstrap.widgets.TbExtendedGridView', array('id' => 'user-group-rule-grid', 'template' => "{items}\n{pager}", 'enableHistory' => true, 'dataProvider' => $model->search(), 'filter' => null, 'bulkActions' => array('actionButtons' => $this->bulkRemoveButton(), 'checkBoxColumnConfig' => array('name' => 'id')), 'columns' => array(array('header' => $labels["id"], 'name' => "id"), array('header' => $labels["user_role_id"], 'name' => "user_role_id", 'value' => 'UserGroupRule::model()->getDownrolelist($data->user_role_id)', 'filter' => UserGroupRule::model()->getRoleList()), array('header' => $labels["module_id"], 'name' => "module_id", 'value' => 'UserGroupRule::model()->getDownmodulelist($data->module_id)', 'filter' => UserGroupRule::model()->getModulesList()), array('header' => $labels["access_type"], 'name' => "access_type", 'value' => 'UserGroupRule::model()->getDownaccesslist($data->access_type)', 'filter' => UserGroupRule::model()->getAccessType()), array('class' => 'bootstrap.widgets.TbButtonColumn', 'template' => '{update}  {delete}', 'buttons' => array('update' => array('label' => yii::t('Bootstrap', 'PHRASE.UPDATE'), 'url' => 'CHtml::normalizeUrl(array("update", "id" => $data->id))', 'options' => array()), 'delete' => array('label' => yii::t('Bootstrap', 'PHRASE.DELETE'), 'options' => array())), 'htmlOptions' => array('style' => 'white-space: nowrap')))));