PHP code example of drsdre / yii2-radtools

1. Go to this page and download the library: Download drsdre/yii2-radtools library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

drsdre / yii2-radtools example snippets


class UserController extends drsdre\radtools\BaseAjaxCrudController
{
    protected $useDynagrid = true;
    protected $modelClass = 'app\models\UserForm';
    protected $searchModelClass ='app\models\search\UserSearch';
    protected $model_name = 'User';
    protected $model_field_name = 'username';

class TableController extends drsdre\radtools\AjaxCrudHierarchyLinkController
{   
    protected $useDetailView = true;
    protected $useDynagrid = true;
    protected $modelClass = 'app\models\UserForm';
    protected $searchModelClass ='app\models\search\UserSearch';
    protected $model_name = 'User';
    protected $model_field_name = 'username';       
    protected $hierarchy_links = [
    		'user_id' => [
    			'model' => 'app\models\User',
    			'linked_model' => 'user',
    			'breadcrumbs' => [
    				[
    					'label' => 'Users',
    					'url' => '/user/overview',
    				],
    				[
    					'label' => '{model_name}',
    					'name_field' => 'username',
    					'url' => '/user/view?id={id}',
    				]
    			]
    		]
    	];

   <?= DynaGrid::widget([
                'options' => [
                    'id' => 'example-gridview',
                ],
                'gridOptions'=>[
                    'dataProvider' => $dataProvider,
                    'filterModel' => $searchModel,
                    'panel' => [
                        'type' => 'primary',
                        'heading' => '<i class="glyphicon glyphicon-list"></i>',
                        'before' => '<em></em>',
                        'after' => BulkButtonWidget::widget( [
		                        'buttons' =>
			                        Html::a( '<i class="glyphicon glyphicon-pencil"></i>&nbsp;Change Status',
				                        [ '/cmm-wptheme-map/bulk-update' ],
				                        [
					                        'class'                => "btn btn-primary btn-xs",
					                        'role'                 => 'modal-remote-bulk',
					                        'data-method'          => false,// for overide yii data api
					                        'data-request-method'  => 'post',
					                        'data-confirm-title'   => 'Bulk Change Status',
					                        'data-confirm-message' =>
						                        Html::dropDownList(
							                        'status',
							                        '',
							                        common\models\Model::$statuses
						                        ),
					                        'data-confirm-ok '     => Html::button( 'Save',
						                        [ 'class' => 'btn btn-primary', 'type' => "submit" ] ),
				                        ]
			                        ) .
			                        ' ' .
			                        Html::a( '<i class="glyphicon glyphicon-trash"></i>&nbsp; Delete All',
				                        [ "bulk-delete" ],
				                        [
					                        'class'                => "btn btn-danger btn-xs",
					                        'role'                 => 'modal-remote-bulk',
					                        'data-confirm'         => false,
					                        'data-method'          => false,
					                        'data-request-method'  => 'post',
					                        'data-confirm-title'   => 'Are you sure?',
					                        'data-confirm-message' => 'Are you sure want to delete this item',
				                        ] ),
	                        ] ) .
                                   '<div class="clearfix"></div>',
                    ],
                ],
                'columns' => 

php composer.phar