Activates a list of models
@return mixed
190283
public function actionDeactivateAll()
    {
        if (isset($_POST['items'])) {
            foreach ($_POST['items'] as $id) {
                if ($model = $this->findModel($id)) {
                    $model->status = ActiveRecord::STATUS_INACTIVE;
                    $model->save(false);
                }
            }
        }
    }
284206
public function getList()
    {
        if ($this->kind === 'collection') {
            $model_class = $this->model_class;
            return $model_class::dump($this->where, $model_class::PRIMARY_KEY);
        }
        return [$this->where];
    }
602732
public function active()
    {
        $classes = $this->getAdaptee()->classes;

        foreach ($classes as $class) {
            if (strpos($class, 'current') !== false) {
                return true;
            }
        }

        return false;
    }
900955
public function &GetActiveVATList()
    {
        if (is_null($this->oActiveVatList)) {
            $this->oActiveVatList = TdbShopVatList::GetList();
            $this->oActiveVatList->bAllowItemCache = true;
            $this->oActiveVatList->GoToStart();
        }

        return $this->oActiveVatList;
    }
1158152
public function actionAssign()
    {
        $routes = Yii::$app->getRequest()->post('routes', []);
        $model = new AdminRoute();
        $model->addNew($routes);
        Yii::$app->getResponse()->format = Response::FORMAT_JSON;
        return $model->getRoutes();
    }
856110
public function run() {

		$post = yii::$app->request->post();

		if( isset( $this->model ) && isset( $post[ 'itemId' ] ) ) {

			$mappingType = isset( $post[ 'ctype' ] ) ? $post[ 'ctype' ] : null;

			$modelMapper = $this->modelMapperService->activateByModelId( $this->model->id, $this->parentType, $post[ 'itemId' ], $mappingType );

			$data = [ 'cid' => $modelMapper->id, 'name' => $modelMapper->model->name ];

			// Trigger Ajax Success
			return AjaxUtil::generateSuccess( Yii::$app->coreMessage->getMessage( CoreGlobal::MESSAGE_REQUEST ), $data );
		}

		// Trigger Ajax Failure
		return AjaxUtil::generateFailure( Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_NOT_FOUND ) );
	}
333206
public function getMethods()
    {
        return array_reduce(
            $this->_models,
            function ($result, $item) {
                $result[$item['method']] = $item['method'];
                return $result;
            },
            []
        );
    }
551331
public function activate(ActivateRequest $request, $id)
    {
        $record    = $this->modelRepository->findOrFail($id);
        $success   = false;
        $result    = null;
        $activated = $request->get('activate');

        if ($this->getModelInformation()->list->activatable) {
            $success = true;
            $result  = $this->changeModelActiveState($record, $activated);
        }

        if ($activated) {
            event( new Events\ModelActivatedInCms($record) );
        } else {
            event( new Events\ModelDeactivatedInCms($record) );
        }

        if (request()->ajax()) {
            return response()->json([ 'success' => $success, 'active' => $result ]);
        }

        if ($success && config('cms-models.notifications.flash.activate')) {
            cms_flash(
                cms_trans(
                    'models.store.success-message-' . ($result ? 'activate' : 'deactivate'),
                    [ 'record' => $this->getSimpleRecordReference($id, $record) ]
                ),
                FlashLevel::SUCCESS
            );
        }

        return redirect()->back();
    }
595951
public static function onActivate()
    {
        self::setupModule();

        self::updateModule();

        self::activateModule();

        self::regenerateViews();

        self::clearCache();
    }
264578
protected function createActivations()
    {
        $model = $this->config['activations']['model'];

        $expires = $this->config['activations']['expires'];

        return new IlluminateActivationRepository($model, $expires);
    }
228714
public static function getModels() {
        return self::cache(__METHOD__, function() {
            $plugins = array_merge(array(Configure::read('Admin.coreName')), App::objects('plugins'));
            $map = array();

            foreach ($plugins as $plugin) {
                $data = Admin::getPlugin($plugin);

                if ($data['models']) {
                    $map[$plugin] = $data;
                }
            }

            ksort($map);

            return $map;
        });
    }
114731
public function reloadModelsWithRelationCount(): self
    {
        /** @var \Illuminate\Database\Eloquent\Builder $query */
        $query = $this->models()
            ->first()
            ->newQuery()
            ->withCount($this->relations);

        $ids = $this->getModelIds();

        $reloadedModels = $query
            ->whereKey($ids)
            ->get()
            ->filter(function (Model $model) use ($ids) {
                return in_array(
                    $model->getKey(),
                    $ids,
                    true
                );
            });

        return $this->setModels($reloadedModels);
    }
504061
public function activate()
    {
        $this->isActive            = true;
        $this->attributes['class'] = Utils::addHtmlClass(
            array_get($this->attributes, 'class', ''),
            $this->activeClass
        );

        return $this;
    }
391896
public function updateModels(Models $models)
    {
        foreach ($models as $model) {
            if ($model->isSoftDeleted()) {
                $this->dispatchBeforeEvent($model, Event::DELETE);
            } else {
                $this->dispatchBeforeEvent($model, Event::UPDATE);
                $this->dispatchBeforeEvent($model, Event::SAVE);
            }
        }

        $this->updateAll()->executeModels($models);

        foreach ($models as $model) {

            $model->resetOriginals();

            if ($model->isSoftDeleted()) {
                $this->dispatchAfterEvent($model, Event::DELETE);
            } else {
                $this->dispatchAfterEvent($model, Event::UPDATE);
                $this->dispatchAfterEvent($model, Event::SAVE);
            }
        }

        return $this;
    }
875420
public function activate() {
		$duration = (int)$this->params['duration'];
		$this->Maintenance->setMaintenanceMode($duration);
		$this->out('Maintenance mode activated ...');
	}
482733
function action_list()
    {
        $_model = $this->model;
        $gets = $this->gets;
        $gets['page'] = empty($_REQUEST[self::$page_key]) ? 1 : $_REQUEST[self::$page_key];
        $gets['pagesize'] = empty($_REQUEST[self::$pagesize_key]) ? self::$pagesize_default : $_REQUEST[self::$pagesize_key];

        /**
         * @var Pager
         */
        $pager = null;
        $this->vars['list'] = $this->model->gets($gets, $pager);
        $this->vars['pager'] = array(
            'total' => $pager->total,
            'render' => $pager->render(),
            'pagesize' => $pager->pagesize,
            'totalpage' => $pager->totalpage,
            'nowpage' => $pager->page
        );
        $this->swoole->tpl->ref('pager', $this->vars['pager']);
        $this->swoole->tpl->ref('list', $this->vars['list']);
    }
693724
public function activate()
    {
        $app = Facade::getFacadeApplication();
        $db = $app->make('database')->connection();
        $db->executeQuery('update SystemCaptchaLibraries set sclIsActive = 0');
        $db->executeQuery('update SystemCaptchaLibraries set sclIsActive = 1 where sclHandle = ?', [$this->sclHandle]);
        $this->sclIsActive = 1;
    }