public function actionDelete($id, $type = null)
 {
     // Find Model
     $model = TemplateService::findById($id);
     // Delete/Render if exist
     if (isset($model)) {
         if ($model->load(Yii::$app->request->post(), 'Template') && $model->validate()) {
             if (TemplateService::delete($model)) {
                 return $this->redirect($this->returnUrl);
             }
         }
         return $this->render('@cmsgears/module-core/admin/views/template/delete', ['model' => $model]);
     }
     // Model not found
     throw new NotFoundHttpException(Yii::$app->cmgCoreMessage->getMessage(CoreGlobal::ERROR_NOT_FOUND));
 }
 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));
 }
Example #3
0
 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));
 }
Example #4
0
 public function actionDelete($id)
 {
     // Find Model
     $model = BlockService::findById($id);
     // Delete/Render if exist
     if (isset($model)) {
         if ($model->load(Yii::$app->request->post(), 'Block')) {
             if (BlockService::delete($model)) {
                 $this->redirect(['all']);
             }
         }
         $banner = $model->banner;
         $video = $model->video;
         $texture = $model->texture;
         $templatesMap = TemplateService::getIdNameMap(['conditions' => ['type' => CmsGlobal::TYPE_BLOCK], 'prepend' => [['name' => '0', 'value' => 'Choose Template']]]);
         return $this->render('delete', ['model' => $model, 'banner' => $banner, 'video' => $video, 'texture' => $texture, 'templatesMap' => $templatesMap]);
     }
     // Model not found
     throw new NotFoundHttpException(Yii::$app->cmgCoreMessage->getMessage(CoreGlobal::ERROR_NOT_FOUND));
 }
Example #5
0
 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));
 }
Example #6
0
 public function actionSettings($id)
 {
     // Find Model
     $model = WidgetService::findById($id);
     // Update/Render if exist
     if (isset($model)) {
         $meta = new WidgetForm($model->data);
         if ($meta->load(Yii::$app->request->post(), 'WidgetForm')) {
             if (WidgetService::update($model, $meta)) {
                 return $this->redirect(['all']);
             }
         }
         $templatesMap = TemplateService::getIdNameMap(CmsGlobal::TYPE_WIDGET);
         return $this->render('settings', ['model' => $model, 'meta' => $meta, 'templatesMap' => $templatesMap]);
     }
     // Model not found
     throw new NotFoundHttpException(Yii::$app->cmgCoreMessage->getMessage(CoreGlobal::ERROR_NOT_FOUND));
 }