@param null $id

@return \Symfony\Component\HttpFoundation\RedirectResponse|Response
@throws \Twig_Error_Runtime
331236
public function editAction( $id = null ) {
		$request = $this->getRequest();

		$pageId      = $request->get( 'pageId' );
		$formFieldId = $request->get( 'formFieldId' );
		$uniqId      = $request->get( 'uniqId' );
		$code        = $request->get( 'code', 'networking_init_cms.admin.page' );


		$layoutBlock = $this->admin->getObject( $id );

		/** @var $form \Symfony\Component\Form\Form */
		$form = $this->admin->getForm();
		$form->setData( $layoutBlock );

		$form->handleRequest( $request );
		$response = null;

		if ( $form->isSubmitted() ) {
			if ( $form->isValid() ) {
				$this->admin->update( $layoutBlock );
				$html   = $this->getLayoutBlockFormWidget( $pageId, $formFieldId, $uniqId, $code );
				$status = 200;

				return new Response( $html, $status );
			} else {
				$this->error = true;

				$response = new Response();
				$response->setStatusCode( 500 );
			}

		}

		$view = $form->createView();

		// set the theme for the current Admin Form
		$this->get( 'twig' )->getRuntime( FormRenderer::class )->setTheme( $view, $this->admin->getFormTheme() );

		return $this->renderWithExtraParams(
			'@NetworkingInitCms/PageAdmin/layout_block_edit.html.twig',
			[
				'action' => 'create',
				'form'   => $view,
				'object' => $layoutBlock,
			],
			$response
		);
	}
632452
public function delete($id = null)
    {
        $this->request->allowMethod(['post', 'delete']);

        $group = $this->UsersGroups->get($id);

        //Before deleting, checks if the group is a necessary group or if the group has some users
        if ($id > 3 && !$group->user_count) {
            $this->UsersGroups->deleteOrFail($group);

            $this->Flash->success(I18N_OPERATION_OK);
        } else {
            $this->Flash->alert($id <= 3 ? __d('me_cms', 'You cannot delete this users group') : I18N_BEFORE_DELETE);
        }

        return $this->redirect(['action' => 'index']);
    }
584458
public function delete($id = null) {
        $task = $this->Tasks->get($id);
        if ($this->request->is(['patch', 'post', 'put'])) {
            if ($this->Tasks->delete($task)) {
                $this->Flash->success(__('The task has been deleted.'));
            } else {
                $this->Flash->error(__('The task could not be deleted. Please, try again.'));
            }
            return $this->redirect(['action' => 'index']);
        }
        $this->set(compact('task'));
    }
202806
public function delete($id = null) {
		$this->request->allowMethod('post');
		$log = $this->DatabaseLogs->get($id);

		if ($this->DatabaseLogs->delete($log)) {
			$this->Flash->success(__('Log deleted'));
			return $this->redirect(['action' => 'index']);
		}
		$this->Flash->error(__('Log was not deleted'));
		return $this->redirect(['action' => 'index']);
	}
1373876
public function delete($id = null) {
		$cell = $this->Cells->get($id);
		$this->request->allowMethod('post', 'delete');
		if ($this->Cells->delete($cell)) {
			$this->Flash->success('The cell has been deleted.');
		} else {
			$this->Flash->error('The cell could not be deleted. Please, try again.');
		}
		return $this->redirect(['action' => 'index']);
	}
762227
public function edit($id = null)
    {
        $page = $this->Pages->findById($id)
            ->formatResults(function (ResultSet $results) {
                return $results->map(function (Page $page) {
                    return $page->set('created', $page->created->i18nFormat(FORMAT_FOR_MYSQL));
                });
            })
            ->firstOrFail();

        if ($this->request->is(['patch', 'post', 'put'])) {
            $page = $this->Pages->patchEntity($page, $this->request->getData());

            if ($this->Pages->save($page)) {
                $this->Flash->success(I18N_OPERATION_OK);

                return $this->redirect(['action' => 'index']);
            }

            $this->Flash->error(I18N_OPERATION_NOT_OK);
        }

        $this->set(compact('page'));
    }
328584
public function delete($id = null)
    {
        $this->request->allowMethod(['post', 'delete']);

        $category = $this->PagesCategories->get($id);

        //Before deleting, it checks if the category has some pages
        if (!$category->page_count) {
            $this->PagesCategories->deleteOrFail($category);
            $this->Flash->success(I18N_OPERATION_OK);
        } else {
            $this->Flash->alert(I18N_BEFORE_DELETE);
        }

        return $this->redirect(['action' => 'index']);
    }
410051
public function view($id = null)
    {
        $role = $this->Roles->get($id, [
            'contain' => []
        ]);
        $this->set('role', $role);

        $this->render(Configure::read('CM.AdminRoleViews.view'));
    }
589580
public function run($id = null, $slug = null)
    {
        if (!is_numeric($id) || $id < 1 || empty($slug)) {
            $this->controller->error(Yii::t('podium/flash', 'Sorry! We can not find the user you are looking for.'));
            return $this->controller->redirect(['members/index']);
        }

        $user = User::find()->where(['and',
            ['id' => $id],
            ['or',
                ['slug' => $slug],
                ['slug' => ''],
                ['slug' => null],
            ]
        ])->limit(1)->one();
        if (empty($user)) {
            $this->controller->error(Yii::t('podium/flash', 'Sorry! We can not find the user you are looking for.'));
            return $this->controller->redirect(['members/index']);
        }
        return $this->controller->render($this->view, ['user' => $user]);
    }
1257948
public function show($id = null)
    {
        if ($id === 'new') {
            return response()->json([
                'entry' => WinkTag::make([
                    'id' => Str::uuid(),
                ]),
            ]);
        }

        $entry = WinkTag::findOrFail($id);

        return response()->json([
            'entry' => $entry,
        ]);
    }
1059444
public function run($id)
    {
        $model = $this->getModel($id);
        
        if ($model->restore()) {
            $this->addSuccessFlash();
        }

        return $this->redirect($model);
    }
518350
public function view($id = null)
    {
        $user = $this->Users->get($id);
        $this->set('user', $user);

        $this->render(Configure::read('CM.AdminUserViews.view'));
    }
812830
public function edit($id = null)
    {
        $banner = $this->Banners->get($id);

        if ($this->request->is(['patch', 'post', 'put'])) {
            $banner = $this->Banners->patchEntity($banner, $this->request->getData());

            if ($this->Banners->save($banner)) {
                $this->Flash->success(I18N_OPERATION_OK);

                return $this->redirect(['action' => 'index']);
            }

            $this->Flash->error(I18N_OPERATION_NOT_OK);
        }

        $this->set(compact('banner'));
    }
388590
public function delete($id = null) {
		$block = $this->Blocks->get($id);
		$this->request->allowMethod('post', 'delete');
		if ($this->Blocks->delete($block)) {
			$this->Flash->success('The block has been deleted.');
		} else {
			$this->Flash->error('The block could not be deleted. Please, try again.');
		}
		return $this->redirect(['action' => 'index']);
	}
704344
protected function deleteRelatedContent($id = NULL) {
        $this->CmsContent = TableRegistry::get('CmsContent');
        $content = $this->CmsContent->get($id);
        if (trim($content->content_path) != '')
            $this->_removeFile($content->content_path);
        return $this->CmsContent->delete($content);
    }
1285191
public function getDelete($id = null)
    {
        // Get comment information
        $comment = Comments::getCommentsRepository()->find($id);

        if ($comment == null)
        {
            // Prepare the error message
            $error = Lang::get('comments.comment.not_found');

            // Redirect to the post management page
            return Redirect::route('posts')->with('error', $error);
        }

        Base::Log('Comment (' . $comment->id . ') was deleted.');

        // Delete the post
        $comment->delete();

        // Prepare the success message
        $success = Lang::get('comments.comment.deleted');

        // Redirect to the post management page
        return Redirect::back()->with('success', $success);
    }
92135
public function edit($id = null)
    {
        $position = $this->BannersPositions->get($id);

        if ($this->request->is(['patch', 'post', 'put'])) {
            $position = $this->BannersPositions->patchEntity($position, $this->request->getData());

            if ($this->BannersPositions->save($position)) {
                $this->Flash->success(I18N_OPERATION_OK);

                return $this->redirect(['action' => 'index']);
            }

            $this->Flash->error(I18N_OPERATION_NOT_OK);
        }

        $this->set(compact('position'));
    }