$this->data['heading_title'] = $this->language->get('heading_title');
$this->data['entry_name'] = $this->language->get('entry_name');
$this->data['entry_filename'] = $this->language->get('entry_filename');
$this->data['entry_mask'] = $this->language->get('entry_mask');
$this->data['entry_remaining'] = $this->language->get('entry_remaining');
$this->data['entry_update'] = $this->language->get('entry_update');
$this->data['button_save'] = $this->language->get('button_save');
$this->data['button_cancel'] = $this->language->get('button_cancel');
$this->data['button_upload'] = $this->language->get('button_upload');
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['filename'])) {
$this->data['error_filename'] = $this->error['filename'];
} else {
$this->data['error_filename'] = '';
}
if (isset($this->error['mask'])) {
$this->data['error_mask'] = $this->error['mask'];
} else {
$this->data['error_mask'] = '';
}
$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('catalog/download', 'token=' . $this->session->data['token'] . $url, 'SSL'),
'separator' => ' :: '
);
if (!isset($this->request->get['download_id'])) {
$this->data['action'] = $this->url->link('catalog/download/insert', 'token=' . $this->session->data['token'] . $url, 'SSL');
} else {
$this->data['action'] = $this->url->link('catalog/download/update', 'token=' . $this->session->data['token'] . '&download_id=' . $this->request->get['download_id'] . $url, 'SSL');
}
$this->data['cancel'] = $this->url->link('catalog/download', 'token=' . $this->session->data['token'] . $url, 'SSL');
$this->load->model('localisation/language');
$this->data['languages'] = $this->model_localisation_language->getLanguages();
if (isset($this->request->get['download_id']) && ($this->request->server['REQUEST_METHOD'] != 'POST')) {
$download_info = $this->model_catalog_download->getDownload($this->request->get['download_id']);
}
$this->data['token'] = $this->session->data['token'];
if (isset($this->request->get['download_id'])) {
$this->data['download_id'] = $this->request->get['download_id'];
} else {
$this->data['download_id'] = 0;
}
if (isset($this->request->post['download_description'])) {
$this->data['download_description'] = $this->request->post['download_description'];
} elseif (isset($this->request->get['download_id'])) {
$this->data['download_description'] = $this->model_catalog_download->getDownloadDescriptions($this->request->get['download_id']);
} else {
$this->data['download_description'] = array();
}
if (isset($this->request->post['filename'])) {
$this->data['filename'] = $this->request->post['filename'];
} elseif (!empty($download_info)) {
$this->data['filename'] = $download_info['filename'];
} else {
$this->data['filename'] = '';
}
if (isset($this->request->post['mask'])) {
$this->data['mask'] = $this->request->post['mask'];
} elseif (!empty($download_info)) {
$this->data['mask'] = $download_info['mask'];
} else {
$this->data['mask'] = '';
}
if (isset($this->request->post['remaining'])) {
$this->data['remaining'] = $this->request->post['remaining'];
} elseif (!empty($download_info)) {
$this->data['remaining'] = $download_info['remaining'];
} else {
$this->data['remaining'] = 1;
}
if (isset($this->request->post['update'])) {
$this->data['update'] = $this->request->post['update'];
} else {
$this->data['update'] = false;
}
$this->template = 'catalog/download_form.tpl';
$this->children = array(
'common/header',
'common/footer'
);
$this->response->setOutput($this->render());