|
@@ -14,15 +14,11 @@ class TemplateController extends BaseController {
|
|
* Show all the available templates.
|
|
* Show all the available templates.
|
|
*/
|
|
*/
|
|
public function show() {
|
|
public function show() {
|
|
- $appTemplates = $this->getCoreTemplates();
|
|
|
|
- $pluginTemplates = $this->getPluginTemplates();
|
|
|
|
-
|
|
|
|
- $templates = $this->getEditableTemplates();
|
|
|
|
-
|
|
|
|
- $missingTemplates = array_diff($appTemplates, $pluginTemplates);
|
|
|
|
- $extraTemplates = array_diff($pluginTemplates, $appTemplates);
|
|
|
|
- $modifiedStatus = $this->getModifiedStatus();
|
|
|
|
-
|
|
|
|
|
|
+ $templates = $this->getEditableTemplates();
|
|
|
|
+ $missingTemplates = array_diff($this->getCoreTemplates(), $this->getPluginTemplates());
|
|
|
|
+ $extraTemplates = array_diff($this->getPluginTemplates(), $this->getCoreTemplates());
|
|
|
|
+ $modifiedStatus = $this->getModifiedStatus();
|
|
|
|
+
|
|
$this->response->html($this->helper->layout->config("OMITemplateModder:config/index", [
|
|
$this->response->html($this->helper->layout->config("OMITemplateModder:config/index", [
|
|
"title" => t("OMI - Notification Template Modder"),
|
|
"title" => t("OMI - Notification Template Modder"),
|
|
"templates" => $templates,
|
|
"templates" => $templates,
|
|
@@ -82,34 +78,35 @@ class TemplateController extends BaseController {
|
|
return $templates;
|
|
return $templates;
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Compares core and plugin templates to check for modifications.
|
|
|
|
- *
|
|
|
|
- * @return array
|
|
|
|
- */
|
|
|
|
- private function getModifiedStatus() {
|
|
|
|
- $modified = [];
|
|
|
|
- $pluginTemplateDir = ETM_PLUGIN_ROOT_DIR . '/Template/notification';
|
|
|
|
- $coreTemplateDir = KB_APP_DIR . '/Template/notification';
|
|
|
|
-
|
|
|
|
- foreach (glob($pluginTemplateDir . '/*.php') as $filename) {
|
|
|
|
- $templateName = basename($filename);
|
|
|
|
- $pluginFile = $pluginTemplateDir . '/' . $templateName;
|
|
|
|
- $coreFile = $coreTemplateDir . '/' . $templateName;
|
|
|
|
-
|
|
|
|
- // Only compare if the core file exists
|
|
|
|
- if (file_exists($coreFile)) {
|
|
|
|
- $pluginContent = file_get_contents($pluginFile);
|
|
|
|
- $coreContent = file_get_contents($coreFile);
|
|
|
|
-
|
|
|
|
- // Compare the file contents
|
|
|
|
- if ($pluginContent !== $coreContent) {
|
|
|
|
- $modified[$templateName] = true;
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Compares core and plugin templates by file content to check for modifications.
|
|
|
|
+ *
|
|
|
|
+ * @return array
|
|
|
|
+ */
|
|
|
|
+ private function getModifiedStatus()
|
|
|
|
+ {
|
|
|
|
+ $modified = [];
|
|
|
|
+ $pluginTemplateDir = ETM_PLUGIN_ROOT_DIR . '/Template/notification';
|
|
|
|
+ $coreTemplateDir = KB_APP_DIR . '/Template/notification';
|
|
|
|
+
|
|
|
|
+ foreach (glob($pluginTemplateDir . '/*.php') as $filename) {
|
|
|
|
+ $templateName = basename($filename);
|
|
|
|
+ $pluginFile = $pluginTemplateDir . '/' . $templateName;
|
|
|
|
+ $coreFile = $coreTemplateDir . '/' . $templateName;
|
|
|
|
+
|
|
|
|
+ // Only compare if the core file exists
|
|
|
|
+ if (file_exists($coreFile)) {
|
|
|
|
+ $pluginContent = file_get_contents($pluginFile);
|
|
|
|
+ $coreContent = file_get_contents($coreFile);
|
|
|
|
+
|
|
|
|
+ // Compare the file contents
|
|
|
|
+ if ($pluginContent !== $coreContent) {
|
|
|
|
+ $modified[$templateName] = true;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ return $modified;
|
|
}
|
|
}
|
|
- return $modified;
|
|
|
|
- }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* Show the form to edit a template
|
|
* Show the form to edit a template
|