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; //} }
public function frmAction($id = NULL) { $role = $this->getInstance($id); $controllers = array("Default" => array("name" => "Tous", "actions" => array("index" => "Lister", "frm" => "Modifiation des données Brutes", "update" => "Modifier/Ajouter", "delete" => "Supprimer", "show" => "Afficher les détails")), "Projects" => array("name" => "Projets", "actions" => array("manage" => "Ajouter/Modifier UseCases", "manageUc" => "Ajouter/Modifier Tâches")), "Roles" => array("name" => "Rôles", "actions" => array("updateACL" => "Mettre à jour es droits")), "Taches" => array("name" => "Tâches", "actions" => array()), "Messages" => array("name" => "Messages", "actions" => array()), "UseCases" => array("name" => "Use Cases", "actions" => array()), "Users" => array("name" => "Utilisateurs", "actions" => array())); $acls = Acl::find("idRole=" . $role->getId()); $this->view->setVars(array("role" => $role, "acls" => AclController::toArray($acls), "controllers" => $controllers, "siteUrl" => $this->url->getBaseUri(), "baseHref" => $this->dispatcher->getControllerName())); $_SESSION['bread']['object'] = $role; $this->jquery->postFormOnClick(".validateACL", $this->dispatcher->getControllerName() . "/updateACL", "frmObject", "#content"); parent::frmAction($id); }
public function fastConnectAction($role) { $user = User::findFirst("idRole = " . $role); if ($user != null) { $this->session->set("user", $user); $acl = Acl::find("idRole = " . $user->getIdRole()); $this->session->set("rights", AclController::toArray($acl)); $msg = new DisplayedMessage("Bienvenue " . $user); $this->dispatcher->forward(array("controller" => "Index", "action" => "indexAjax", "params" => array($msg))); } else { $this->dispatcher->forward(array("controller" => "Auth", "action" => "signin", "params" => array(true))); } }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new AclAction(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['AclAction'])) { $model->attributes = $_POST['AclAction']; $model->controller_type = AclController::get_controller_type($model->controller_id); if ($model->save()) { Yii::app()->user->setFlash('success', 'ACL action has been created successfully'); $this->redirect(array('view', 'id' => $model->id, 'cid' => $model->controller_id)); } } $this->render('create', array('model' => $model)); }
public function logoutAction() { parent::logoutAction(); echo "<meta http-equiv=refresh content='0; url=index.php?md=demo&cl=test&at=testLogout'>"; }
<?php $this->pageTitle = 'ACL action details - ' . Yii::app()->name; $this->breadcrumbs = array('Acl Actions' => array('actions', 'cid' => $_GET['cid']), AclController::get_controller($_GET['cid']) . ' - Details'); ?> <div class="widget-box"> <div class="widget-header"> <h5>Action Details (<?php echo $model->action; ?> )</h5> <div class="widget-toolbar"> <a data-action="settings" href="#"><i class="icon-cog"></i></a> <a data-action="reload" href="#"><i class="icon-refresh"></i></a> <a data-action="collapse" href="#"><i class="icon-chevron-up"></i></a> <a data-action="close" href="#"><i class="icon-remove"></i></a> </div> <div class="widget-toolbar"> <?php echo CHtml::link('<i class="icon-pencil"></i>', array('update', 'id' => $model->id, 'cid' => $_GET['cid']), array('data-rel' => 'tooltip', 'title' => 'Edit', 'data-placement' => 'bottom')); ?> </div> <div class="widget-toolbar"> <?php echo CHtml::link('<i class="icon-plus"></i>', array('create', 'cid' => $_GET['cid']), array('data-rel' => 'tooltip', 'title' => 'Add', 'data-placement' => 'bottom')); ?> </div> <div class="widget-toolbar"> <?php echo CHtml::link('<i class="icon-home"></i>', array('actions', 'cid' => $_GET['cid']), array('data-rel' => 'tooltip', 'title' => 'Actions', 'data-placement' => 'bottom')); ?>
<?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();
<?php $this->pageTitle = 'New ACL action - ' . Yii::app()->name; $this->breadcrumbs = array('ACL Actions' => array('actions', 'cid' => $_GET['cid']), AclController::get_controller($_GET['cid']) . ' - Create'); ?> <div class="widget-box"> <div class="widget-header"> <h5>New Action for <?php echo AclController::get_controller($_GET['cid']); ?> </h5> <div class="widget-toolbar"> <a data-action="settings" href="#"><i class="icon-cog"></i></a> <a data-action="reload" href="#"><i class="icon-refresh"></i></a> <a data-action="collapse" href="#"><i class="icon-chevron-up"></i></a> <a data-action="close" href="#"><i class="icon-remove"></i></a> </div> <div class="widget-toolbar"> <?php echo CHtml::link('<i class="icon-home"></i>', array('actions', 'cid' => $_GET['cid']), array('data-rel' => 'tooltip', 'title' => 'Actions', 'data-placement' => 'bottom')); ?> </div> <div class="widget-toolbar"> <?php echo CHtml::link('<i class="icon-arrow-up"></i>', array('aclController/admin'), array('data-rel' => 'tooltip', 'title' => 'Controller', 'data-placement' => 'bottom')); ?> </div> </div><!--/.widget-header --> <div class="widget-body"> <div class="widget-main"> <?php
/** * 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; }
<?php $this->pageTitle = 'Edit ACL action - ' . Yii::app()->name; $this->breadcrumbs = array('ACL Actions' => array('actions', 'cid' => $_GET['cid']), AclController::get_controller($_GET['cid']) . ' - Update'); ?> <div class="widget-box"> <div class="widget-header"> <h5>Edit Action (<?php echo $model->action; ?> )</h5> <div class="widget-toolbar"> <a data-action="settings" href="#"><i class="icon-cog"></i></a> <a data-action="reload" href="#"><i class="icon-refresh"></i></a> <a data-action="collapse" href="#"><i class="icon-chevron-up"></i></a> <a data-action="close" href="#"><i class="icon-remove"></i></a> </div> <div class="widget-toolbar"> <?php echo CHtml::link('<i class="icon-eye-open"></i>', array('view', 'id' => $model->id, 'cid' => $_GET['cid']), array('data-rel' => 'tooltip', 'title' => 'Details', 'data-placement' => 'bottom')); ?> </div> <div class="widget-toolbar"> <?php echo CHtml::link('<i class="icon-plus"></i>', array('create', 'cid' => $_GET['cid']), array('data-rel' => 'tooltip', 'title' => 'Add', 'data-placement' => 'bottom')); ?> </div> <div class="widget-toolbar"> <?php echo CHtml::link('<i class="icon-home"></i>', array('actions', 'cid' => $_GET['cid']), array('data-rel' => 'tooltip', 'title' => 'Actions', 'data-placement' => 'bottom')); ?>
<?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; }