class ControllerExtensionModuleSeoUrl extends Controller {
private $error = array();
private $modulePath = "extension/module/seo_url";
private $moduleModel = "model_extension_module_seo_url";
public function index() {
$this->load->language("extension/module/seo_url");
$this->document->setTitle(strip_tags($this->language->get("heading_title")));
$this->load->model("setting/setting");
if ($this->request->server["REQUEST_METHOD"] == "POST" && $this->validate()) {
$status_status = $this->config->get("module_seo_url_status");
$this->request->post["module_seo_url_first"] = "1";
$this->model_setting_setting->editSetting("module_seo_url", $this->request->post);
if (isset($this->request->post["module_seo_url_status"])) {
$this->load->model("setting/modification");
$row = $this->model_setting_modification->getModificationByCode("no_common_home");
if ($this->request->post["module_seo_url_status"] == 0 && $status_status != 0) {
$this->model_setting_modification->disableModification($row["modification_id"]);
$this->response->redirect($this->url->link("marketplace/modification/refresh", "user_token=" . $this->session->data["user_token"], true));
}
elseif ($this->request->post["module_seo_url_status"] == 1 && $status_status != 1) {
$this->model_setting_modification->enableModification($row["modification_id"]);
$this->response->redirect($this->url->link("marketplace/modification/refresh", "user_token=" . $this->session->data["user_token"], true));
}
}
$this->session->data["success"] = $this->language->get("text_module_success");
$this->response->redirect($this->url->link("marketplace/extension", "user_token=" . $this->session->data["user_token"] . "&type=module", true));
}
if (isset($this->error["warning"])) {
$data["error_warning"] = $this->error["warning"];
}
else {
$data["error_warning"] = '';
}
$data["breadcrumbs"] = array();
$data["breadcrumbs"][] = array("text" => $this->language->get("text_home"), "href" => $this->url->link("common/dashboard", "user_token=" . $this->session->data["user_token"], true));
$data["breadcrumbs"][] = array("text" => $this->language->get("text_extension"), "href" => $this->url->link("marketplace/extension", "user_token=" . $this->session->data["user_token"] . "&type=module", true));
$data["breadcrumbs"][] = array("text" => $this->language->get("heading_title"), "href" => $this->url->link("extension/module/seo_url", "user_token=" . $this->session->data["user_token"], true));
$data["action"] = $this->url->link("extension/module/seo_url", "user_token=" . $this->session->data["user_token"], true);
$data["cancel"] = $this->url->link("marketplace/extension", "user_token=" . $this->session->data["user_token"] . "&type=module", true);
if (isset($this->request->post["module_seo_url_status"])) {
$data["module_seo_url_status"] = $this->request->post["module_seo_url_status"];
}
else {
$data["module_seo_url_status"] = $this->config->get("module_seo_url_status");
}
if (!(isset($this->request->post["module_seo_url_first"]) or null !== $this->config->get("module_seo_url_first"))) {
$data["refreshmod"] = $this->url->link("marketplace/modification/refresh", "user_token=" . $this->session->data["user_token"], true);
}
$this->document->addScript("view/javascript/md_bootstrap_switch/js/seo-url-switch.min.js");
$this->document->addStyle("view/javascript/md_bootstrap_switch/css/seo-url-switch.css");
$this->document->addStyle("view/stylesheet/seo-url.css");
$data["header"] = $this->load->controller("common/header");
$data["column_left"] = $this->load->controller("common/column_left");
$data["footer"] = $this->load->controller("common/footer");
$this->response->setOutput($this->load->view("extension/module/seo_url", $data));
}
public function install() {
$this->load->model($this->modulePath);
$result = $this->{
$this->moduleModel
}
->install();
}
public function uninstall() {
$this->load->model($this->modulePath);
$result = $this->{
$this->moduleModel
}
->uninstall();
}
protected function validate() {
if (!$this->user->hasPermission("modify", "extension/module/seo_url")) {
$this->error["warning"] = $this->language->get("error_permission");
}
return !$this->error;
}
}
© 2023 Quttera Ltd. All rights reserved.