Archivate item with $id.
@param integer $id
@param integer $page
481762
public function actionExport($id, $page = 1)
    {
        $this->gc();

        $params = Yii::$app->request->getQueryParams();
        $paramSort = isset($params['sort']) ? $params['sort'] : null;

        //$model = $this->findModel($id); // exception if not found
        $model = $this->module->model('News')->findOne($id);
        if (empty($model)) {
            Yii::$app->session->setFlash('error', Yii::t($this->tcModule, "News id#{id} not found", ['id' => $id]));
        } else {
            $dir = $this->tmpDir . '/'. date('Y/md');
            FileHelper::createDirectory($dir);

            $slug = NewsArchieve::getSlug($model);

            $basename = $dir . '/' . sprintf("%s-news-%s-%s", date('ymd-His'), $id, $slug);
            if (is_file("{$basename}.zip")) $basename .= '.' . uniqid();
            $name = "{$basename}.zip";

            $result = NewsArchieve::createArchieve($name, $model, $this);
            if ($result === true) {
                //Yii::$app->session->setFlash('success', Yii::t($this->tcModule, 'Archieve create success'));
                return Yii::$app->response->sendFile($name);
            } else if (is_string($result)) {
                Yii::$app->session->setFlash('error', $result);
            } else {
                Yii::$app->session->setFlash('error', Yii::t($this->tcModule, 'Archieve creation fail by unknown error'));
            }
        }
        return $this->redirect(['index',
            'page' => $page,
            'id'   => $id,
            'sort' => $paramSort,
        ]);
    }
1266417
public function actionActivate ()
		{
			if (Yii::$app->request->isAjax)
			{
				$post = Yii::$app->request->post();
				$page = Page::findOne($post[ 'id' ]);
				$page->updateAttributes([ 'active' => $page->active ? 0 : 1 ]);

				echo $page->active;
			}
			Yii::$app->end();
		}
155451
public function activate($id)
    {
        $user = $this->findById($id);

        try
        {
            if ( $user->attemptActivation($user->getActivationCode()) )
            {
                $this->event->fire('users.activate',array($user));
                return true;
            }
        }
        catch (UserAlreadyActivatedException $e){}


        return false;
    }
946748
public function updateCurrentPageID(&$id){
		if (!$id) {
			if($site = Multisites::inst()->getCurrentSite()){
				$id = $site->Children()->first();
			}
		}
	}
631266
public function edit($id)
    {
        $this->request->allowMethod(['get', 'put']);

        /** @var Page $page */
        $page = $this->Pages->get($id, ['contain' => ['Current', 'Attributes', 'Collections']]);

        ThemeManager::theme(Wasabi::setting('Cms.Theme.id'));

        if ($this->request->is('put')) {
            $page = $this->Pages->patchEntity($page, $this->request->data);
            if ($this->Pages->save($page)) {
                $this->Flash->success(__d('wasabi_cms', 'The page <strong>{0}</strong> has been saved.', $page->name));
                $this->redirect(['action' => 'index']);
                return;
            } else {
                $this->Flash->error($this->formErrorMessage);
            }
        } else {
            /** @var Content $current */
            $current = $page->current;
            if (!is_array($current) &&
                get_class($current) === 'Wasabi\Cms\Model\Entity\Content' &&
                $current->isNew()
            ) {
                $defaultLayout = ThemeManager::theme()->getLayout('Default');
                $page->current = [
                    (new Content())->set('content', json_encode($defaultLayout->content()))
                ];
            }
        }

        if ($page->meta_robots_index === null) {
            $page->meta_robots_index = (bool)Configure::read('Settings.Cms.SEO.meta-robots-index');
        }

        if ($page->meta_robots_follow === null) {
            $page->meta_robots_follow = (bool)Configure::read('Settings.Cms.SEO.meta-robots-follow');
        }

        $routes = $this->Routes
            ->findAllFor('Wasabi/Cms.Pages', $id, Wasabi::contentLanguage()->id)
            ->order([$this->Routes->aliasField('url') => 'asc']);

        $this->set([
            'page' => $page,
            'layouts' => ThemeManager::theme()->getLayoutsForSelect(),
            'availableModules' => ModuleManager::getAvailableModules(),
            'changeAttributesUrl' => Router::url([
                'plugin' => 'Wasabi/Cms',
                'controller' => 'Pages',
                'action' => 'attributes'
            ]),
            'attributes' => $page->getLayout()->attributes(),
            'routes' => $routes,
            'routeTypes' => RouteTypes::getForSelect(),
            'formRoute' => $this->Routes->newEntity([
                'type' => ($routes->count() >= 1) ? RouteTypes::TYPE_REDIRECT_ROUTE : RouteTypes::TYPE_DEFAULT_ROUTE
            ])
        ]);

        $this->render('add');
    }
126556
public function actionDelete($id, $page = 1)
    {
        $model = $this->findModel($id);
/* moved to model:
        $subdir = $this->module->model('News')->getImageSubdir($model->id);
        $fullDir = $this->uploadsNewsDir . '/' . $subdir;//var_dump($fullDir);exit;
        if (is_dir($fullDir)) {
            @FileHelper::removeDirectory($fullDir);
        }
*/
        $model->delete(); // images and i18n-deletions also in main model

        Yii::$app->session->setFlash('success', Yii::t($this->tcModule, 'Record with ID={id} delete success', ['id' => $id]));

        $searchFormName = basename(NewsSearch::className());
        $paramSort = Yii::$app->request->get($searchFormName, []);
        foreach ($paramSort as $key => $val) {
            if (empty($val)) unset($paramSort[$key]);
        }
        return $this->redirect(['index',
            'page' => $page,
            $searchFormName => $paramSort,
            'sort' => $model->orderBy,
        ]);
    }
212931
public function actionClick($id) 
	{
		$model=$this->loadModel($id);
		if($id == null || $model == null)
			$this->redirect(Yii::app()->createUrl('site/index'));
		else {
			BannerClicks::insertClick($model->banner_id);
			$this->redirect($model->url);
		}
	}
433320
public function fetchById ($id)
    {
        $record = $this->query->fetchById($id);

        if ($record instanceof \stdClass) {
            $this->setRecord($record);
        } else {
            $this->record = null;
        }
    }
1098917
public function Magazine(int $id, int $page = 1): Model\Magazine\Magazine
    {
        return $this->myanimelist->getMagazine(
            new Request\Magazine\MagazineRequest($id, $page)
        );
    }
1088681
public function indexPage($page_id)
    {
        $this->setPage($page_id);
        $this->setTitleIndexPage();
        $this->setBreadcrumbIndexPage();
        $this->setHtmlFilterIndexPage();
        $this->setMetaIndexPage();

        $this->setData('page', $this->data_page);
        $this->setDataImagesIndexPage();

        $this->outputIndexPage();
    }
1299381
public function activate($id)
    {
        $user = $this->Users->get($id);
        $user->active = true;
        $this->Users->save($user);
        $this->Flash->success(I18N_OPERATION_OK);

        return $this->redirect(['action' => 'index']);
    }
1317581
public function getEpisodes(int $id, int $page = 1): PaginatedResults
    {
        $options = ['query' => ['page' => $page]];

        $json = $this->parent->performAPICallWithJsonResponse('get', '/series/'.$id.'/episodes', $options);

        return new PaginatedResults(
            DataParser::parseDataArray($json, BasicEpisode::class),
            $this->parent->getLastLinks()
        );
    }
10910
public function update(SeoPagesRequest $request, $id)
    {
        $input = $request->all();

        $record = $this->model->findOrFail($id);

        $record->update($input);

        $this->notify([
            'type' => 'success',
            'title' => 'Successful update!',
            'description' => 'SeoPage is updated successfully.',
        ]);

        return redirect()->back();
    }
611322
private function activateFolderById($id, FolderInterface $folder)
    {
        foreach ($folder->getChildren() as $child) {
            if ($child->getId() == $id) {
                $child->setActive(true);
                return true;
            }
            if ($this->activateFolderById($id, $child)) {
                return true;
            }
        }
        return false;
    }
1229497
public function actionEdit(int $id): void
	{
		$this->content = $this->orm->content->getById($id);
		if (!$this->content) {
			$this->error();
		}
	}
698917
public function setId( $id )
	{
		if( $id === $this->getId() ) { return; }

		$this->_values['id'] = (string) $id ;
		$this->setModified();
	}
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();
    }