PHP code example of myzero1 / yii2-theme-adminlteiframe
1. Go to this page and download the library: Download myzero1/yii2-theme-adminlteiframe 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/ */
myzero1 / yii2-theme-adminlteiframe example snippets
return [
......
// 'defaultRoute' => '/adminlteiframe/layout', // for adminlteiframe theme
'controllerMap' => [
// 'adminlteiframe' => [ // for adminlteiframe theme
// 'class' => 'myzero1\adminlteiframe\controllers\SiteController'
// ],
'demo' => [ // for the menu of demo
'class' => 'myzero1\adminlteiframe\controllers\DemoController'
]
],
'components' => [
......
'view' => [
'theme' => [
'pathMap' => [
'@app/views' => '@vendor/myzero1/yii2-theme-adminlteiframe/src/views/adminlte', // using the adminlte theme
// '@app/views' => '@vendor/myzero1/yii2-theme-adminlteiframe/src/views/adminlteiframe', // using the adminlteiframe theme
],
],
],
'assetManager' => [
'class' => 'yii\web\AssetManager',
'forceCopy' => true,// true/false
/*'bundles'=> [
'myzero1\adminlteiframe\assets\php\components\LayoutAsset' => [
'skin' => 'skin-red',// skin-{blue|black|purple|green|red|yellow}[-light],example skin-blue,skin-blue-light,
'menuRefreshTab' => false, // true,false
'jsVersion' => '1.7',
'cssVersion' => '1.7',
], // for adminlteiframe theme
'myzero1\adminlteiframe\assets\php\components\AdminLteAsset' => [
'skin' => 'skin-red',// skin-{blue|black|purple|green|red|yellow}[-light],example skin-blue,skin-blue-light,
'jsVersion' => '1.7',
'cssVersion' => '1.7',
], // for adminlte theme
'myzero1\adminlteiframe\assets\php\components\MainAsset' => [
'showJParticle' => 'true', // 'false'/'true', default 'true', 'icon' => "fa fa-angle-double-right",
'targetType' => 'iframe-tab',
'urlType' => 'abosulte',
'url' => ['/demo/level21'],
],
[
'id' => "level22",
'text' => "level22",
'title'=>"level22",
'icon' => "fa fa-angle-double-right",
'targetType' => 'iframe-tab',
'urlType' => 'abosulte',
'url' => ['/demo/level22'],
],
],
],
],
],
......
],
......
];
......
if (YII_ENV_DEV) {
$config['modules']['gii'] = [
'class' => 'yii\gii\Module',
'allowedIPs' => ['127.0.0.1', '::1'],
'generators' => [
'adminlteiframe_crud' => [ // generator name
'class' => 'myzero1\adminlteiframe\gii\templates\crud\Generator', // generator class
'templates' => [
'default' => '@vendor/myzero1/yii2-theme-adminlteiframe/src/gii/templates/crud/adminlteiframe',
'z1adminlte' => '@vendor/myzero1/yii2-theme-adminlteiframe/src/gii/templates/crud/adminlte',
]
],
],
];
}
......
return [
......
'layout' => 'main',// to set theme by setting layout and layoutPath
'layoutPath' => \Yii::getAlias('@vendor/myzero1/yii2-theme-adminlteiframe/src/views/adminlte/layouts'),
......
];
\myzero1\adminlteiframe\assets\php\components\plugins\Select2Asset::register($this);
\myzero1\adminlteiframe\assets\php\components\plugins\DataRangePickerAsset::register($this);
\myzero1\adminlteiframe\assets\php\components\plugins\TableAsset::register($this);
\myzero1\adminlteiframe\assets\php\components\plugins\EchartsAsset::register($this);
\myzero1\adminlteiframe\assets\php\components\plugins\LayerAsset::register($this);
\myzero1\adminlteiframe\assets\php\components\plugins\Select2Asset::register($this);
\myzero1\adminlteiframe\assets\php\components\plugins\SwitchAsset::register($this);
\myzero1\adminlteiframe\assets\php\components\plugins\Wysihtml5Asset::register($this);
\myzero1\adminlteiframe\assets\php\components\plugins\ZtreeAsset::register($this);
php composer.phar
http://localhost/path/to/index.php?r=gii
OR
http://localhost/path/to/index.php/gii
public function actionIndex()
{
$this->layout = 'layout';
return $this->render('index');
}
public function actionLogin()
{
if (!Yii::$app->user->isGuest) {
return $this->goHome();
}
$model = new LoginForm();
if ($model->load(Yii::$app->request->post()) && $model->login()) {
return $this->goBack();
} else {
$model->password = '';
return $this->renderAjax('login', [
'model' => $model,
]);
}
}
myzero1\adminlteiframe\assets\php\components\plugins\EchartsAsset::register($this);
myzero1\adminlteiframe\assets\php\components\plugins\DataRangePickerAsset::register($this);
myzero1\adminlteiframe\assets\php\components\plugins\LayerAsset::register($this);
myzero1\adminlteiframe\assets\php\components\plugins\Wysihtml5Asset::register($this);
echo $form->field($model, 'id')->textInput(['data-provide' =>"z1ztree"])
echo $form->field($model, 'id')->textInput(['data-provide' =>"z1ztree",'data-z1ztree-config' => '{"radioWithParents": false}'])
echo $form->field($model, 'id')->textInput(['data-provide' =>"z1ztree",'data-z1ztree-config' => '{"checkType": "checkbox"}'])
echo $form->field($model, 'id')->dropDownList(['n1'=>'v1','n2'=>'v2',] ,['data-provide' =>"z1select2"])
echo $form->field($model, 'id')->dropDownList(['n1'=>'v1','n2'=>'v2',] ,['data-provide' =>"z1select2", "multiple"=>"multiple"])
...
myzero1\adminlteiframe\assets\php\components\plugins\Z1passwordAsset::register($this);
...
<?= $form->field($model, 'password')->passwordInput([
'placeholder' => '请输入',
'readonly' => true,
'onfocus' => "this.removeAttribute('readonly');",
'data-provide' => 'z1password',
'rsa-key-public' => 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC3oSDe9Gu6AcoNU0NYQRBi3Pidwqlet/PpMddqlqnUO4sP4R0/ABOHbf/1byVbfKsbpEQqan2+v8x7MvrjZtzl6cAqrGkp3zmfvMHSkYBaQFZym0Hc49sMCbygCy77Hw9PnXsFIFayTsT97Whd6U8HzKg51wHoSW+eq2QmjZUCsQIDAQAB',
])
...
$ok=\myzero1\adminlteiframe\helpers\Tool::CheckPassword(
$model,
$privateKey,
[
'usernameKey'=>'username',
'passwordKey'=>'password',
'frequentlyMsg'=>'请求太频繁请稍后再试',
'replayMsg'=>'请不要重复提交',
]
);
if ($ok && $model->load(Yii::$app->request->post()) && $model->login()) {
return $this->goBack();
} else {
$model->password = '';
// return $this->renderAjax('login-custom1', [
// return $this->renderAjax('login-custom', [
return $this->renderAjax('login', [
// return $this->render('login', [
'model' => $model,
]);
}
...