class ControllerExtensionModuleTextileStyleAdmin extends Controller {
private $error = array();
public function index() {
$this->load->language('extension/module/textile_style_admin');
$this->document->setTitle($this->language->get('heading_titles'));
$this->document->addStyle('view/javascript/textile/colorpicker/bootstrap-colorpicker.css');
$this->document->addStyle('view/stylesheet/textile/module_style_admin.css?v1.0.6');
$this->document->addScript('view/javascript/textile/colorpicker/bootstrap-colorpicker.js');
$this->document->addScript('view/javascript/textile/chroma_color.js');
$this->load->model('setting/setting');
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
$this->model_setting_setting->editSetting('module_textile_style_admin', $this->request->post);
$this->session->data['success'] = $this->language->get('text_success');
$this->response->redirect($this->url->link('extension/module/textile_style_admin', 'user_token=' . $this->session->data['user_token'], true));
}
if (isset($this->session->data['success'])) {
$data['success'] = $this->session->data['success'];
unset($this->session->data['success']);
} else {
$data['success'] = '';
}
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_titles'),
'href' => $this->url->link('extension/module/textile_style_admin', 'user_token=' . $this->session->data['user_token'], true)
);
$data['action'] = $this->url->link('extension/module/textile_style_admin', '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);
$data['entry_status'] = $this->language->get('entry_status');
if (isset($this->request->post['module_textile_style_admin_status'])) {
$data['status'] = $this->request->post['module_textile_style_admin_status'];
} else {
$data['status'] = $this->config->get('module_textile_style_admin_status');
}
if (isset($this->request->post['module_textile_style_admin_width'])) {
$data['width_container'] = $this->request->post['module_textile_style_admin_width'];
} else {
$data['width_container'] = $this->config->get('module_textile_style_admin_width');
}
if (isset($this->request->post['module_textile_style_admin_width_menu'])) {
$data['width_menu'] = $this->request->post['module_textile_style_admin_width_menu'];
} else {
$data['width_menu'] = $this->config->get('module_textile_style_admin_width_menu');
}
if (isset($this->request->post['module_textile_style_admin_csc_status'])) {
$data['admin_csc_status'] = $this->request->post['module_textile_style_admin_csc_status'];
} else {
$data['admin_csc_status'] = $this->config->get('module_textile_style_admin_csc_status');
}
if (isset($this->request->post['module_textile_style_admin_color_mode'])) {
$data['color_style_mode'] = $this->request->post['module_textile_style_admin_color_mode'];
} else {
$data['color_style_mode'] = $this->config->get('module_textile_style_admin_color_mode');
}
if (isset($this->request->post['module_textile_style_admin_color_style'])) {
$data['color_style'] = $this->request->post['module_textile_style_admin_color_style'];
} else {
$data['color_style'] = $this->config->get('module_textile_style_admin_color_style');
}
if (isset($this->request->post['module_textile_style_admin_mycolor_style'])) {
$data['my_color_style'] = $this->request->post['module_textile_style_admin_mycolor_style'];
} else {
$data['my_color_style'] = $this->config->get('module_textile_style_admin_mycolor_style');
}
$data['color_schemes'] = array(
'1' => array(
'0' => '647282',
'1' => '576473',
'2' => '4b5867',
'3' => '3c4a5a',
'4' => '2b3b4c',
'active' => '5795eb',
'text_active' => 'a0c8ff',
),
'2' => array(
'0' => '6684b3',
'1' => '5a78a9',
'2' => '4e6da1',
'3' => '3f5f95',
'4' => '314c87',
'active' => '5795eb',
'text_active' => 'a0c8ff',
),
'3' => array(
'0' => '8c44cd',
'1' => '7c30c1',
'2' => '6b21af',
'3' => '54188d',
'4' => '441471',
'active' => '9b50ed',
'text_active' => 'e291fb',
),
'4' => array(
'0' => '447d59',
'1' => '3a7550',
'2' => '28653f',
'3' => '1e5733',
'4' => '104724',
'active' => '4cb676',
'text_active' => '69f548',
),
'5' => array(
'0' => 'ad8835',
'1' => '9b7727',
'2' => '8d6919',
'3' => '7f5a08',
'4' => '755100',
'active' => 'c58800',
'text_active' => 'ffcf62',
),
'6' => array(
'0' => 'b14f4f',
'1' => 'a14242',
'2' => '913434',
'3' => '7f2727',
'4' => '691c1c',
'active' => 'bb3737',
'text_active' => 'ff7979',
),
);
$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/textile_style_admin', $data));
}
public function mode() {
$json = array();
if (!$this->validateWidget() || empty($this->request->post['value'])) {
$json['error'] = $this->language->get('error_permission');
} else {
$this->load->model('setting/setting');
if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
$this->model_setting_setting->editSettingValue('module_textile_style_admin', 'module_textile_style_admin_color_mode', $this->request->post['value']);
$json['success'] = $this->request->post['value'];
}
}
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
}
protected function validateWidget() {
if (!$this->user->hasPermission('access', 'extension/module/textile_style_admin') || !$this->config->get('module_textile_style_admin_status')) {
$this->error['warning'] = $this->language->get('error_permission');
}
return !$this->error;
}
protected function validate() {
if (!$this->user->hasPermission('modify', 'extension/module/textile_style_admin')) {
$this->error['warning'] = $this->language->get('error_permission');
}
return !$this->error;
}
}
© 2023 Quttera Ltd. All rights reserved.