$this->data['heading_title'] = $this->language->get('heading_title');
$this->data['text_image_manager'] = $this->language->get('text_image_manager');
$this->data['text_browse'] = $this->language->get('text_browse');
$this->data['text_clear'] = $this->language->get('text_clear');
$this->data['entry_name'] = $this->language->get('entry_name');
$this->data['entry_image'] = $this->language->get('entry_image');
$this->data['button_save'] = $this->language->get('button_save');
$this->data['button_cancel'] = $this->language->get('button_cancel');
if (isset($this->error['warning'])) {
$this->data['error_warning'] = $this->error['warning'];
} else {
$this->data['error_warning'] = '';
}
if (isset($this->error['name'])) {
$this->data['error_name'] = $this->error['name'];
} else {
$this->data['error_name'] = array();
}
if (isset($this->error['image'])) {
$this->data['error_image'] = $this->error['image'];
} else {
$this->data['error_image'] = '';
}
$url = '';
if (isset($this->request->get['sort'])) {
$url .= '&sort=' . $this->request->get['sort'];
}
if (isset($this->request->get['order'])) {
$url .= '&order=' . $this->request->get['order'];
}
if (isset($this->request->get['page'])) {
$url .= '&page=' . $this->request->get['page'];
}
$this->data['breadcrumbs'] = array();
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('text_home'),
'href' => $this->url->link('common/home', 'token=' . $this->session->data['token'], 'SSL'),
'separator' => false
);
$this->data['breadcrumbs'][] = array(
'text' => $this->language->get('heading_title'),
'href' => $this->url->link('sale/voucher_theme', 'token=' . $this->session->data['token'] . $url, 'SSL'),
'separator' => ' :: '
);
if (!isset($this->request->get['voucher_theme_id'])) {
$this->data['action'] = $this->url->link('sale/voucher_theme/insert', 'token=' . $this->session->data['token'] . $url, 'SSL');
} else {
$this->data['action'] = $this->url->link('sale/voucher_theme/update', 'token=' . $this->session->data['token'] . '&voucher_theme_id=' . $this->request->get['voucher_theme_id'] . $url, 'SSL');
}
$this->data['cancel'] = $this->url->link('sale/voucher_theme', 'token=' . $this->session->data['token'] . $url, 'SSL');
if (isset($this->request->get['voucher_theme_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
$voucher_theme_info = $this->model_sale_voucher_theme->getVoucherTheme($this->request->get['voucher_theme_id']);
}
$this->data['token'] = $this->session->data['token'];
$this->load->model('localisation/language');
$this->data['languages'] = $this->model_localisation_language->getLanguages();
if (isset($this->request->post['voucher_theme_description'])) {
$this->data['voucher_theme_description'] = $this->request->post['voucher_theme_description'];
} elseif (isset($this->request->get['voucher_theme_id'])) {
$this->data['voucher_theme_description'] = $this->model_sale_voucher_theme->getVoucherThemeDescriptions($this->request->get['voucher_theme_id']);
} else {
$this->data['voucher_theme_description'] = array();
}
if (isset($this->request->post['image'])) {
$this->data['image'] = $this->request->post['image'];
} elseif (!empty($voucher_theme_info)) {
$this->data['image'] = $voucher_theme_info['image'];
} else {
$this->data['image'] = '';
}
$this->load->model('tool/image');
if (isset($voucher_theme_info) && $voucher_theme_info['image'] && file_exists(DIR_IMAGE . $voucher_theme_info['image'])) {
$this->data['thumb'] = $this->model_tool_image->resize($voucher_theme_info['image'], 100, 100);
} else {
$this->data['thumb'] = $this->model_tool_image->resize('no_image.jpg', 100, 100);
}
$this->data['no_image'] = $this->model_tool_image->resize('no_image.jpg', 100, 100);
$this->template = 'sale/voucher_theme_form.tpl';
$this->children = array(
'common/header',
'common/footer'
);
$this->response->setOutput($this->render());