-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9963707
commit 76eb4e7
Showing
2 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
/** | ||
* @author Semenov Alexander <semenov@skeeks.com> | ||
* @link http://skeeks.com/ | ||
* @copyright 2010 SkeekS (СкикС) | ||
* @date 31.05.2015 | ||
*/ | ||
|
||
namespace skeeks\cms\controllers; | ||
|
||
use skeeks\cms\backend\controllers\BackendModelStandartController; | ||
use skeeks\cms\components\Cms; | ||
use skeeks\cms\models\CmsSite; | ||
use skeeks\cms\modules\admin\actions\modelEditor\AdminMultiModelEditAction; | ||
use skeeks\cms\modules\admin\traits\AdminModelEditorStandartControllerTrait; | ||
use yii\helpers\ArrayHelper; | ||
|
||
/** | ||
* Class AdminCmsSiteController | ||
* @package skeeks\cms\controllers | ||
*/ | ||
class AdminCmsSiteTwoController extends BackendModelStandartController | ||
{ | ||
use AdminModelEditorStandartControllerTrait; | ||
|
||
public function init() | ||
{ | ||
$this->name = \Yii::t('skeeks/cms', "Site management"); | ||
$this->modelShowAttribute = "name"; | ||
$this->modelClassName = CmsSite::class; | ||
|
||
parent::init(); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function actions() | ||
{ | ||
return ArrayHelper::merge(parent::actions(), | ||
[ | ||
"def-multi" => | ||
[ | ||
'class' => AdminMultiModelEditAction::className(), | ||
"name" => "По умолчанию", | ||
//"icon" => "glyphicon glyphicon-trash", | ||
"eachCallback" => [$this, 'eachMultiDef'], | ||
"priority" => 0, | ||
], | ||
|
||
"activate-multi" => | ||
[ | ||
'class' => AdminMultiModelEditAction::className(), | ||
"name" => "Активировать", | ||
//"icon" => "glyphicon glyphicon-trash", | ||
"eachCallback" => [$this, 'eachMultiActivate'], | ||
], | ||
|
||
"inActivate-multi" => | ||
[ | ||
'class' => AdminMultiModelEditAction::className(), | ||
"name" => "Деактивировать", | ||
//"icon" => "glyphicon glyphicon-trash", | ||
"eachCallback" => [$this, 'eachMultiInActivate'], | ||
], | ||
] | ||
); | ||
} | ||
|
||
/** | ||
* @param $model | ||
* @param $action | ||
* @return bool | ||
*/ | ||
public function eachMultiDef($model, $action) | ||
{ | ||
try { | ||
$model->def = Cms::BOOL_Y; | ||
return $model->save(false); | ||
} catch (\Exception $e) { | ||
return false; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters