Deletes an incident template.

@param \CachetHQ\Cachet\Models\IncidentTemplate $template

@return \Illuminate\Http\RedirectResponse
519904
public function deleteTemplateAction(IncidentTemplate $template)
    {
        $template->delete();

        return cachet_redirect('dashboard.templates')
            ->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.incidents.templates.delete.success')));
    }
26949
public function edit(TemplateRequest $request, $template)
    {
        try {
            $template = $request->template;
            $path = theme_path('views').$template;

            return response()->json([
                'status' => true, 'message' => null,
                'file' => [
                    'content' => \File::get($path),
                    'size' => formatBytes(\File::size($path)),
                    'modified' => strftime('%Y-%m-%d %H:%M', \File::lastModified($path))
                ]
            ], 200);

        } catch (ValidationException $e) {
            $message = $e->validator->errors()->first();
            return response()->json(['status' => false, 'message' => $message], 200);
        } catch (\Exception $e) {
            $message = $e->getMessage();
            return response()->json(['status' => false, 'message' => $message], 404 );
        }
    }
979583
public static void removeTemplate(RestClient client, String template) throws Exception {
		logger.trace("removeTemplate({})", template);
		client.performRequest(new Request("DELETE", "/_template/" + template));
		logger.trace("/removeTemplate({})", template);
	}
105116
public function destroy(Request $request, Evento $evento)
	{
		$this->authorize('admin',  Auth::user());
				
		$evento->delete();
	
		return redirect(route('evento'))->with('success', 'Evento Deleted!');
	}
542782
public function postTemplate(Page $page, Template $template)
    {
        $this->authorize('editTemplate', $page);

        $page->setTemplate($template);

        Event::fire(new Events\PageTemplateWasChanged($page, $template));

        return $page->getCurrentVersion()->getStatus();
    }
561381
public function resolveErrorTemplate()
    {
        $this->buildTemplateIndex();

        $template = (array_key_exists(self::ERROR_TEMPLATE, $this->templateIndex)) ?
            $this->templateIndex[self::ERROR_TEMPLATE] :
            false;

        return($template);
    }
88616
public function destroy(Incident $incident, IncidentUpdate $update)
    {
        try {
            execute(new RemoveIncidentUpdateCommand($update));
        } catch (QueryException $e) {
            throw new BadRequestHttpException();
        }

        return $this->noContent();
    }
306396
public function deleteAction(Request $request, SakonninTemplate $sakonninTemplate)
    {
        $form = $this->createDeleteForm($sakonninTemplate);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrineManager();
            $em->remove($sakonninTemplate);
            $em->flush();
        }

        return $this->redirectToRoute('sakonnintemplate_index');
    }
157774
public function redirect($template, $name, $to)
	{
		return $this->connect($template, $name, new RedirectController($to));
	}
609632
public function onDeleteTemplates()
    {
        $this->validateRequestTheme();

        $type = Request::input('type');
        $templates = Request::input('template');
        $error = null;
        $deleted = [];

        try {
            foreach ($templates as $path => $selected) {
                if ($selected) {
                    $this->loadTemplate($type, $path)->delete();
                    $deleted[] = $path;
                }
            }
        }
        catch (Exception $ex) {
            $error = $ex->getMessage();
        }

        /**
         * @event cms.template.delete
         * Fires after a CMS template (page|partial|layout|content|asset) has been deleted.
         *
         * Example usage:
         *
         *     Event::listen('cms.template.delete', function ((\Cms\Controllers\Index) $controller, (string) $type) {
         *         \Log::info("A $type has been deleted");
         *     });
         *
         * Or
         *
         *     $CmsIndexController->bindEvent('template.delete', function ((string) $type) {
         *         \Log::info("A $type has been deleted");
         *     });
         *
         */
        $this->fireSystemEvent('cms.template.delete', [$type]);

        return [
            'deleted' => $deleted,
            'error'   => $error,
            'theme'   => Request::input('theme')
        ];
    }
899512
public function editorViewAction(Request $request, Template $template)
    {
        $request->request->set('blockMode', 'manage');
        return $this->render($template->getView(), ['block' => $template]);
    }
893845
public function deleteTemplateDataAction()
    {
        $translator = $this->getServiceLocator()->get('translator');

    	$eventDatas = array();
    	$this->getEventManager()->trigger('meliscms_template_delete_start', $this, $eventDatas);

        $request = $this->getRequest();
        $templateId = null;
        $status  = false;
        $message = 'no data';
        $textMessage = '';
        $textTitle = 'tr_tool_template_fm_update_title';
        // make sure it's a POST call
        if($request->isPost()) {

            // get the service for Templates Model & Table
            $templatesModel = $this->getServiceLocator()->get('MelisEngineTableTemplate');
            $templateId = (int) $request->getPost('templateId');

            // make sure our ID is not empty
            if(!empty($templateId))
            {
                $templatesModel->deleteById($templateId);
                $status = true;
                $message = $templateId . ' successfully deleted';
                $textMessage = 'tr_tool_template_fm_delete_content';
            }
        }

        $response = array(
           'success' => $status ,
            'textTitle' => $textTitle,
            'textMessage' => $textMessage
        );

        $this->getEventManager()->trigger('meliscms_template_delete_end', $this, array_merge($response, array('typeCode' => 'CMS_TEMPLATE_DELETE', 'itemId' => $templateId)));

        return new JsonModel($response);
    }
592227
public function processTemplateAction($template)
    {
        try {
            if (! empty($template)) {
                // If we have a view in the URL, render this view
                return $this->render($template);
            } elseif (null != $view = $this->getRequest()->get('view')) {
                return $this->render($view);
            }
        } catch (\Exception $ex) {
            return $this->errorPage($ex->getMessage());
        }

        return $this->pageNotFound();
    }
872627
public function deleteTemplate(Request $request, $id)
    {
        // Find Template
        $mailTemplate = $this
            ->getDoctrine()
            ->getRepository($this->getParameter('pd_mailer.mail_template_class'))
            ->findOneBy(['id' => $id]);

        // Not Found
        if (null === $mailTemplate) {
            $this->addFlash('error', 'sorry_not_existing');

            return $this->redirectToRoute('admin_mail_list');
        }

        // Remove Template
        $em = $this->getDoctrine()->getManager();
        $em->remove($mailTemplate);
        $em->flush();

        // Redirect Back
        return $this->redirect($request->headers->get('referer') ?? $this->generateUrl('admin_mail_list'));
    }
561319
private function validateTwigTemplate($template)
    {
        $loader = $this->twig->getLoader();
        if (!$loader->exists($template)) {
            throw new \Exception(sprintf(
                'Unable to find template "%s".',
                $template
            ));
        }
    }
1340678
public function editAsCopy(Request $request, $template)
    {
        $name = $request->get('name');
        $data = $this->getData();

        try
        {
            /**
             * Set workspace identifier
             */
            \PDFGeneratorAPI::setWorkspace($this->userRepository->getWorkspaceIdentifier(Auth::user()));

            $newTemplate = \PDFGeneratorAPI::copy($template, $name);
        }
        catch(Exception $e)
        {
            return response()->json([
                'error' => $e->getMessage()
            ], $e->getCode());
        }

        return redirect()->away(\PDFGeneratorAPI::editor($newTemplate->id, $data));
    }
381418
protected static function removeFragment($template, $tag)
    {
        $fragment = self::fetchFragment($template, $tag);

        return !empty($fragment) ? str_replace($fragment, '', $template) : $template;
    }