/**
  * @param string $theme
  * @param string $template
  * @return JSONResponse
  */
 public function reset($theme, $template)
 {
     try {
         $template = new MailTemplate($theme, $template);
         $template->reset();
         return new JSONResponse();
     } catch (\Exception $ex) {
         return new JSONResponse(array('message' => $ex->getMessage()), $ex->getCode());
     }
 }
 /**
  * @param string $theme
  * @param string $template
  * @return JSONResponse
  */
 public function resetTemplate($theme, $template)
 {
     try {
         $template = new MailTemplate($theme, $template);
         if ($template->reset()) {
             return new JSONResponse();
         } else {
             return new JSONResponse([], Http::STATUS_INTERNAL_SERVER_ERROR);
         }
     } catch (\Exception $ex) {
         return new JSONResponse(array('message' => $ex->getMessage()), $ex->getCode());
     }
 }
Exemplo n.º 3
0
<?php

\OC_Util::checkAdminUser();
\OCP\Util::addStyle('templateeditor', 'settings-admin');
\OCP\Util::addScript('templateeditor', 'settings-admin');
$themes = \OCA\TemplateEditor\MailTemplate::getEditableThemes();
$editableTemplates = \OCA\TemplateEditor\MailTemplate::getEditableTemplates();
$tmpl = new \OCP\Template('templateeditor', 'settings-admin');
$tmpl->assign('themes', $themes);
$tmpl->assign('editableTemplates', $editableTemplates);
return $tmpl->fetchPage();