public function actionDelete($id) { // Find Model $model = NewsletterService::findById($id); // Delete/Render if exist if (isset($model)) { if ($model->load(Yii::$app->request->post(), 'Newsletter')) { if (NewsletterService::delete($model)) { $this->redirect(['all']); } } $templatesMap = TemplateService::getIdNameMapByType(NewsletterGlobal::TYPE_NEWSLETTER, ['default' => true]); return $this->render('delete', ['model' => $model, 'templatesMap' => $templatesMap]); } // Model not found throw new NotFoundHttpException(Yii::$app->cmgCoreMessage->getMessage(CoreGlobal::ERROR_NOT_FOUND)); }
public function actionDelete($id, $type = null) { // Find Model $model = FormService::findById($id); // Delete/Render if exist if (isset($model)) { $model->type = $type; if ($model->load(Yii::$app->request->post(), 'Form')) { if (FormService::delete($model)) { $this->redirect($this->returnUrl); } } $templatesMap = TemplateService::getIdNameMapByType(CoreGlobal::TYPE_FORM); $templatesMap = ArrayHelper::merge(['0' => 'Choose Template'], $templatesMap); return $this->render('@cmsgears/module-core/admin/views/form/delete', ['model' => $model, 'templatesMap' => $templatesMap, 'visibilityMap' => Form::$visibilityMap]); } // Model not found throw new NotFoundHttpException(Yii::$app->cmgCoreMessage->getMessage(CoreGlobal::ERROR_NOT_FOUND)); }
public function actionDelete($id) { // Find Model $model = PageService::findById($id); // Delete/Render if exist if (isset($model)) { $content = $model->content; if ($model->load(Yii::$app->request->post(), 'Page')) { if (PageService::delete($model)) { ModelContentService::delete($content); $this->redirect(['all']); } } $banner = $content->banner; $visibilityMap = Page::$visibilityMap; $statusMap = Page::$statusMap; $templatesMap = TemplateService::getIdNameMapByType(CmsGlobal::TYPE_PAGE); $templatesMap = ArrayHelper::merge(['0' => 'Choose Template'], $templatesMap); return $this->render('delete', ['model' => $model, 'content' => $content, 'banner' => $banner, 'visibilityMap' => $visibilityMap, 'statusMap' => $statusMap, 'templatesMap' => $templatesMap]); } // Model not found throw new NotFoundHttpException(Yii::$app->cmgCoreMessage->getMessage(CoreGlobal::ERROR_NOT_FOUND)); }