예제 #1
0
 public static function get_controller_type($id)
 {
     $title = AclController::model()->findByAttributes(array('id' => $id));
     //if (!empty($title->controller_type)) {
     return $title->controller_type;
     //} else {
     return null;
     //}
 }
 /**
  * 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 = AclController::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
예제 #3
0
<?php

$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('action' => Yii::app()->createUrl($this->route), 'method' => 'get'));
echo $form->dropDownListControlGroup($model, 'controller_id', CHtml::listData(AclController::model()->findAll(array('condition' => '', "order" => "controller")), 'id', 'controller'), array('empty' => '--please select--', 'class' => 'span5'));
echo $form->textFieldControlGroup($model, 'action', array('class' => 'span5', 'maxlength' => 150));
?>
<div class="form-actions">
    <?php 
echo TbHtml::submitButton('Search', array('color' => TbHtml::BUTTON_COLOR_PRIMARY));
?>
    <?php 
echo TbHtml::resetButton('Reset', array('color' => TbHtml::BUTTON_COLOR_INFO));
?>
</div>

<?php 
$this->endWidget();
예제 #4
0
<?php

$this->pageTitle = 'ACL Actions - ' . Yii::app()->name;
$this->breadcrumbs = array('Acl Actions' => array('admin'), 'Manage');
$this->menu = array(array('label' => 'Manage', 'url' => array('admin'), 'active' => true, 'icon' => 'icon-home'), array('label' => 'New', 'url' => array('create'), 'active' => true, 'icon' => 'icon-file'), array('label' => '', 'class' => 'search-button', 'url' => '#', 'active' => true, 'icon' => 'icon-search search-button'));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('acl-action-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>
<div class="search-form" style="display:none">
    <?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<?php 
$this->widget('bootstrap.widgets.TbGridView', array('type' => TbHtml::GRID_TYPE_HOVER, 'id' => 'acl-action-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'controller_id', 'type' => 'raw', 'value' => 'getControllerName($data->controller_id)', 'filter' => CHtml::activeDropDownList($model, 'controller_id', CHtml::listData(AclController::model()->findAll(array('condition' => '', "order" => "controller")), 'id', 'controller'), array('empty' => 'All')), 'htmlOptions' => array('style' => "text-align:left;", 'title' => 'Controller')), array('name' => 'title', 'type' => 'raw', 'value' => '$data->title', 'htmlOptions' => array('style' => "text-align:left;", 'title' => 'Title')), 'action', array('class' => 'bootstrap.widgets.TbButtonColumn'))));
/**
 * Retrieves Controller name by ID.
 * @return string.
 */
function getControllerName($id)
{
    $returnValue = Yii::app()->db->createCommand()->select('controller')->from('{{acl_controller}}')->where('id=:id', array(':id' => $id))->queryScalar();
    return $returnValue;
}