/**
  * @inheritdoc
  */
 protected function renderDataCellContent($model, $key, $index)
 {
     if ($this->checkboxOptions instanceof Closure) {
         $options = call_user_func($this->checkboxOptions, $model, $key, $index, $this);
     } else {
         $options = $this->checkboxOptions;
         if (!isset($options['value'])) {
             $options['value'] = is_array($key) ? json_encode($key, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) : $key;
         }
     }
     return Html::checkbox($this->name, !empty($options['checked']), $options);
 }
Exemple #2
0
                <div class="panel-body">
                    <?php 
echo Html::beginForm(['set-child-roles', 'id' => $role->name]);
?>

                    <?php 
echo Html::checkboxList('child_roles', ArrayHelper::map($childRoles, 'name', 'name'), ArrayHelper::map($allRoles, 'name', 'description'), ['item' => function ($index, $label, $name, $checked, $value) {
    $list = '<ul style="padding-left: 10px">';
    foreach (Role::getPermissionsByRole($value) as $permissionName => $permissionDescription) {
        $list .= $permissionDescription ? "<li>{$permissionDescription}</li>" : "<li>{$permissionName}</li>";
    }
    $list .= '</ul>';
    $helpIcon = Html::beginTag('span', ['title' => Yii::t('yee/user', 'Permissions for "{role}" role', ['role' => $label]), 'data-content' => $list, 'data-html' => 'true', 'role' => 'button', 'style' => 'margin-bottom: 5px; padding: 0 5px', 'class' => 'btn btn-sm btn-default role-help-btn']);
    $helpIcon .= '?';
    $helpIcon .= Html::endTag('span');
    $checkbox = Html::checkbox($name, $checked, ['label' => $label, 'value' => $value]);
    return "<div><div class='pull-left' style='margin-right: 15px;'>{$checkbox}</div><div>{$helpIcon}</div></div>";
}]);
?>

                    <hr/>
                    <?php 
if (User::hasPermission('manageRolesAndPermissions')) {
    ?>
                        <?php 
    echo Html::submitButton(Yii::t('yee', 'Save'), ['class' => 'btn btn-primary btn-sm']);
    ?>
                    <?php 
}
?>
Exemple #3
0
echo Yii::t('yee/user', 'Show only selected');
?>
                            </span>
                            <span id="show-all-routes" class="btn btn-default btn-sm hide">
				<i class="fa fa-plus"></i> <?php 
echo Yii::t('yee/user', 'Show all');
?>
                            </span>
                        </div-->
                    </div>

                    <hr/>

                    <?php 
echo Html::checkboxList('child_routes', ArrayHelper::map($childRoutes, 'name', 'name'), ArrayHelper::map($routes, 'name', 'name'), ['id' => 'routes-list', 'separator' => '<div class="separator"></div>', 'item' => function ($index, $label, $name, $checked, $value) {
    return Html::checkbox($name, $checked, ['value' => $value, 'label' => '<span class="route-text">' . $label . '</span>', 'labelOptions' => ['class' => 'route-label'], 'class' => 'route-checkbox']);
}]);
?>

                    <hr/>
                    <?php 
if (User::hasPermission('manageRolesAndPermissions')) {
    ?>
                        <?php 
    echo Html::submitButton(Yii::t('yee', 'Save'), ['class' => 'btn btn-primary btn-sm']);
    ?>
                    <?php 
}
?>

                    <?php