本文整理汇总了PHP中AResource::getTypeDir方法的典型用法代码示例。如果您正苦于以下问题:PHP AResource::getTypeDir方法的具体用法?PHP AResource::getTypeDir怎么用?PHP AResource::getTypeDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AResource
的用法示例。
在下文中一共展示了AResource::getTypeDir方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _buildGeneralSubform
/**
* @param AForm $form
* @param int $download_id
* @param int $product_id
*/
private function _buildGeneralSubform($form, $download_id, $product_id)
{
if ($download_id) {
$file_data = $this->model_catalog_download->getDownload($download_id);
$this->_validateDownloadForm($file_data);
$this->data['error'] = $this->error;
} else {
$file_data = array();
$file_data['status'] = 1;
//set status ON for new download by default
}
$this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'downloadFrm', 'attr' => 'data-confirm-exit="true" class="aform form-horizontal"', 'action' => $this->data['action']));
$this->data['form']['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => (int) $download_id ? $this->language->get('button_save') : $this->language->get('text_add'), 'style' => 'button1'));
$this->data['form']['cancel'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'cancel', 'href' => $this->html->getSecureURL('catalog/product_files', '&product_id=' . $product_id), 'text' => $this->language->get('button_cancel'), 'style' => 'button2'));
$order_statuses = $this->model_localisation_order_status->getOrderStatuses();
$this->data['date_added'] = dateISO2Display($file_data['date_added'], $this->language->get('date_format_short') . ' ' . $this->language->get('time_format'));
$this->data['date_modified'] = dateISO2Display($file_data['date_modified'], $this->language->get('date_format_short') . ' ' . $this->language->get('time_format'));
$this->data['action'] = $this->html->getSecureURL('r/product/product/processDownloadForm', '&product_id=' . $product_id);
$resources_scripts = $this->dispatch('responses/common/resource_library/get_resources_scripts', array('object_name' => 'downloads', 'object_id' => '', 'types' => array('download')));
$this->data['resources_scripts'] = $resources_scripts->dispatchGetOutput();
$this->data['form']['fields']['general']['resource'] = $form->getFieldHtml($props[] = array('type' => 'resource', 'name' => 'filename', 'resource_path' => htmlspecialchars($file_data['filename'], ENT_COMPAT, 'UTF-8'), 'rl_type' => 'download'));
$rl = new AResource('download');
$rl_dir = $rl->getTypeDir();
$resource_id = $rl->getIdFromHexPath(str_replace($rl_dir, '', $file_data['filename']));
if ($resource_id) {
$this->data['preview']['href'] = $this->html->getSecureURL('common/resource_library/get_resource_preview', '&resource_id=' . $resource_id, true);
$this->data['preview']['path'] = 'resources/' . $file_data['filename'];
}
$this->data['form']['fields']['general']['status'] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'status', 'value' => 1, 'checked' => $file_data['status'] ? true : false, 'style' => 'btn_switch'));
//check is download already shared
if ($download_id) {
$this->data['map_list'] = array();
$file_data['map_list'] = (array) $this->model_catalog_download->getDownloadMapList($download_id);
foreach ($file_data['map_list'] as $map_id => $map_name) {
if ($map_id == $product_id) {
continue;
}
$this->data['map_list'][] = array('href' => $this->html->getSecureURL('catalog/product_files', '&product_id=' . $map_id . '&download_id=' . $this->data['download_id'], true), 'text' => $map_name);
}
if (!sizeof($this->data['map_list'])) {
$this->data['already_shared'] = false;
} else {
$this->data['already_shared'] = true;
}
}
$this->data['delete_unmap_href'] = $this->html->getSecureURL('catalog/product_files', '&act=' . ($file_data['shared'] ? 'unmap' : 'delete') . '&product_id=' . $product_id . '&download_id=' . $this->data['download_id'], true);
if ($product_id) {
$this->data['form']['fields']['general']['shared'] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'shared', 'value' => 1, 'checked' => $file_data['shared'] ? true : false, 'style' => 'btn_switch ' . ($this->data['already_shared'] ? 'disabled' : '')));
}
if ($file_data['shared']) {
$this->data['text_attention_shared'] = $this->language->get('attention_shared');
}
$this->data['form']['fields']['general']['download_id'] = $form->getFieldHtml(array('type' => 'hidden', 'name' => 'download_id', 'value' => $this->data['download_id']));
$this->data['form']['fields']['general']['name'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'name', 'value' => $file_data['name'], 'attr' => ' maxlength="64" '));
$this->data['form']['fields']['general']['mask'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'mask', 'value' => $file_data['mask']));
$this->data['form']['fields']['general']['activate'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'activate', 'value' => $file_data['activate'], 'options' => array('' => $this->language->get('text_select'), 'before_order' => $this->language->get('text_before_order'), 'immediately' => $this->language->get('text_immediately'), 'order_status' => $this->language->get('text_on_order_status'), 'manually' => $this->language->get('text_manually')), 'required' => true, 'style' => 'download_activate no-save'));
$options = array('' => $this->language->get('text_select'));
foreach ($order_statuses as $order_status) {
$options[$order_status['order_status_id']] = $order_status['name'];
}
$this->data['form']['fields']['general']['activate'] .= $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'activate_order_status_id', 'value' => $file_data['activate_order_status_id'], 'options' => $options, 'required' => true, 'style' => ' no-save '));
$this->data['form']['fields']['general']['sort_order'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'sort_order', 'style' => 'small-field', 'value' => $file_data['sort_order']));
$this->data['form']['fields']['general']['max_downloads'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'max_downloads', 'value' => $file_data['max_downloads'], 'style' => 'small-field'));
$this->data['form']['fields']['general']['expire_days'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'expire_days', 'style' => 'small-field', 'value' => $file_data['expire_days']));
}
示例2: main
public function main()
{
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$this->loadLanguage('catalog/files');
$this->document->setTitle($this->language->get('heading_title'));
$this->loadModel('catalog/product');
$this->loadModel('catalog/download');
$product_id = $this->request->get['product_id'];
if (!$product_id) {
$this->redirect($this->html->getSecureURL('catalog/product'));
}
if (has_value($product_id) && $this->request->is_GET()) {
$product_info = $this->model_catalog_product->getProduct($product_id);
if (!$product_info) {
$this->session->data['warning'] = $this->language->get('error_product_not_found');
$this->redirect($this->html->getSecureURL('catalog/product'));
}
// remove
if (has_value($this->request->get['act']) && $this->request->get['act'] == 'delete') {
$download_info = $this->model_catalog_download->getDownload($this->request->get['download_id']);
$map_list = $this->model_catalog_download->getDownloadMapList($this->request->get['download_id']);
if (sizeof($map_list) == 1 && key($map_list) == $product_id || $download_info['shared'] != 1) {
$this->model_catalog_download->deleteDownload($this->request->get['download_id']);
} else {
$this->model_catalog_download->unmapDownload($this->request->get['download_id'], $product_id);
}
$this->session->data['success'] = $this->language->get('text_success_remove');
$this->redirect($this->html->getSecureURL('catalog/product_files', '&product_id=' . $product_id));
}
}
//Downloads disabled. Warn user
if (!$this->config->get('config_download')) {
$this->error['warning'] = $this->html->convertLinks($this->language->get('error_downloads_disabled'));
}
if ($this->request->is_POST() && $this->_validateForm()) {
foreach ($this->request->post['selected'] as $id) {
$this->model_catalog_download->mapDownload($id, $product_id);
}
$this->session->data['success'] = $this->language->get('text_map_success');
$this->redirect($this->html->getSecureURL('catalog/product_files', '&product_id=' . $product_id));
}
$this->view->assign('error_warning', $this->error['warning']);
$this->view->assign('success', $this->session->data['success']);
if (isset($this->session->data['success'])) {
unset($this->session->data['success']);
}
$this->data['product_description'] = $this->model_catalog_product->getProductDescriptions($product_id);
$this->document->initBreadcrumb(array('href' => $this->html->getSecureURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE));
$this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('catalog/product'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: '));
$this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('catalog/product/update', '&product_id=' . $product_id), 'text' => $this->language->get('text_edit') . ' ' . $this->language->get('text_product') . ' - ' . $this->data['product_description'][$this->session->data['content_language_id']]['name'], 'separator' => ' :: '));
$this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('catalog/product_files', '&product_id=' . $product_id), 'text' => $this->language->get('tab_files'), 'separator' => ' :: ', 'current' => true));
$this->data['active'] = 'files';
//load tabs controller
$tabs_obj = $this->dispatch('pages/catalog/product_tabs', array($this->data));
$this->data['product_tabs'] = $tabs_obj->dispatchGetOutput();
unset($tabs_obj);
$this->loadModel('catalog/download');
$this->data['downloads'] = array();
$this->data['product_files'] = $this->model_catalog_download->getProductDownloadsDetails($product_id);
$rl = new AResource('download');
$rl_dir = $rl->getTypeDir();
foreach ($this->data['product_files'] as &$file) {
$resource_id = $rl->getIdFromHexPath(str_replace($rl_dir, '', $file['filename']));
$resource_info = $rl->getResource($resource_id);
$thumbnail = $rl->getResourceThumb($resource_id, $this->config->get('config_image_grid_width'), $this->config->get('config_image_grid_height'));
if ($resource_info['resource_path']) {
$file['icon'] = $this->html->buildResourceImage(array('url' => $thumbnail, 'width' => $this->config->get('config_image_grid_width'), 'height' => $this->config->get('config_image_grid_height'), 'attr' => 'alt="' . $resource_info['title'] . '"'));
} else {
$file['icon'] = $resource_info['resource_code'];
}
$file['status'] = $file['status'] ? $this->language->get('text_enabled') : $this->language->get('text_disabled');
$file['button_edit'] = $this->html->buildElement(array('type' => 'button', 'text' => $this->language->get('button_edit'), 'href' => $this->html->getSecureURL('r/product/product/buildDownloadForm', '&product_id=' . $product_id . '&download_id=' . $file['download_id'])));
$map_list = $this->model_catalog_download->getDownloadMapList($file['download_id']);
if (sizeof($map_list) == 1 && key($map_list) == $product_id || $file['shared'] != 1) {
$text = $this->language->get('button_delete');
$icon = 'fa-trash-o';
} else {
$text = $this->language->get('button_unmap');
$icon = 'fa-chain-broken';
}
$file['button_delete'] = $this->html->buildElement(array('type' => 'button', 'text' => $text, 'href' => $this->html->getSecureURL('catalog/product_files', '&act=delete&product_id=' . $product_id . '&download_id=' . $file['download_id']), 'icon' => $icon));
$orders_count = $this->model_catalog_download->getTotalOrdersWithProduct($product_id);
if ($orders_count) {
$file['push_to_customers'] = $this->html->buildElement(array('type' => 'button', 'name' => 'push_to_customers', 'text' => sprintf($this->language->get('text_push_to_orders'), $orders_count), 'title' => $this->language->get('text_push'), 'icon' => 'fa-share-alt-square', 'href' => $this->html->getSecureURL('catalog/product_files/pushToCustomers', '&product_id=' . $product_id . '&download_id=' . $file['download_id']), 'attr' => 'data-orders-count="' . $orders_count . '"'));
}
}
unset($file);
$this->data['button_add_file'] = $this->html->buildElement(array('type' => 'button', 'text' => $this->language->get('text_add_file'), 'href' => $this->html->getSecureURL('r/product/product/buildDownloadForm', '&product_id=' . $product_id)));
if ($this->config->get('config_embed_status')) {
$this->data['embed_url'] = $this->html->getSecureURL('common/do_embed/product', '&product_id=' . $product_id);
}
$this->addChild('pages/catalog/product_summary', 'summary_form', 'pages/catalog/product_summary.tpl');
$this->view->assign('help_url', $this->gen_help_url('product_files'));
$this->view->assign('form_language_switch', $this->html->getContentLanguageSwitcher());
$this->view->batchAssign($this->data);
$this->processTemplate('pages/catalog/product_files.tpl');
//update controller data
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}
示例3: _json_response
private function _json_response()
{
// json-response for jqgrid
$this->loadLanguage('catalog/download');
$this->loadModel('catalog/download');
$excludes = $this->session->data['multivalue_excludes'];
$grid_filter_params = array('name');
// if need to show all downloads of product
if ($this->request->get['product_id']) {
$additional_filter_string = sizeof($excludes) ? "AND p2d.download_id NOT IN (" . implode(', ', $excludes) . ")" : '';
if (isset($this->request->get['shared_only'])) {
$additional_filter_string .= 'AND shared=1';
}
$filter_grid = new AFilter(array('method' => 'post', 'grid_filter_params' => $grid_filter_params, 'additional_filter_string' => $additional_filter_string));
$results = $this->model_catalog_download->getProductDownloadsDetails($this->request->get['product_id'], $filter_grid->getFilterData());
$total = sizeof($results);
} else {
//Prepare filter config
$additional_filter_string = sizeof($excludes) ? " d.download_id NOT IN (" . implode(', ', $excludes) . ")" : '';
if (isset($this->request->get['shared_only'])) {
$additional_filter_string .= 'AND shared=1';
}
$filter_grid = new AFilter(array('method' => 'post', 'grid_filter_params' => $grid_filter_params, 'additional_filter_string' => $additional_filter_string));
$total = $this->model_catalog_download->getTotalDownloads($filter_grid->getFilterData());
$results = $this->model_catalog_download->getDownloads($filter_grid->getFilterData());
}
$response = new stdClass();
$response->page = $filter_grid->getParam('page');
$response->total = $filter_grid->calcTotalPages($total);
$response->records = $total;
$i = 0;
$response->userdata = (object) array('page' => $page);
$data_type = 'download_id';
$rl = new AResource('download');
$rl_dir = $rl->getTypeDir();
if ($results) {
foreach ($results as $result) {
$resource_id = $rl->getIdFromHexPath(str_replace($rl_dir, '', $result['filename']));
$resource_info = $rl->getResource($resource_id);
$thumbnail = $rl->getResourceThumb($resource_id, 27, 27);
if ($resource_info['resource_path']) {
$thumbnail = $this->html->buildResourceImage(array('url' => $thumbnail, 'width' => 27, 'height' => 27, 'attr' => 'alt="' . $resource_info['title'] . '"'));
} else {
$thumbnail = $resource_info['resource_code'];
}
$response->rows[$i]['id'] = $result['download_id'];
$response->rows[$i]['cell'] = array($thumbnail, $result['name'], '<a class="btn_action" href="JavaScript:void(0);"
onclick="showPopup(\'' . $this->html->getSecureURL('catalog/download/update', '&' . $data_type . '=' . $result[$data_type]) . '\')" title="' . $this->language->get('text_view') . '">' . '<img height="27" src="' . RDIR_TEMPLATE . 'image/icons/icon_grid_view.png" alt="' . $this->language->get('text_edit') . '" /></a>');
$i++;
}
}
$this->data['response'] = AJson::encode($response);
}
示例4: _getForm
private function _getForm()
{
if (isset($this->error['warning'])) {
$this->data['error_warning'] = $this->error['warning'];
} else {
$this->data['error_warning'] = '';
}
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['error'] = $this->error;
$this->data['language_id'] = $this->config->get('storefront_language_id');
$this->document->initBreadcrumb(array('href' => $this->html->getSecureURL('index/home'), 'text' => $this->language->get('text_home'), 'separator' => FALSE));
$this->document->addBreadcrumb(array('href' => $this->html->getSecureURL('catalog/download'), 'text' => $this->language->get('heading_title'), 'separator' => ' :: '));
$this->data['cancel'] = $this->html->getSecureURL('catalog/download');
if (isset($download_info['filename'])) {
if (is_file(DIR_RESOURCE . $download_info['filename'])) {
$rm = new AResource('archive');
$id = $rm->getIdFromHexPath(str_replace($rm->getTypeDir(), '', $download_info['filename']));
$this->data['download_link'] = $this->html->getSecureURL('common/resource_library/get_resource_preview', '&resource_id=' . $id);
}
$this->data['filename'] = $download_info['filename'];
$this->data['mask'] = $download_info['mask'];
} else {
$this->data['filename'] = '';
$this->data['mask'] = '';
}
if (isset($this->request->get['download_id'])) {
$this->data['show_update'] = TRUE;
} else {
$this->data['show_update'] = FALSE;
}
if (isset($this->request->post['remaining_count'])) {
$this->data['remaining_count'] = $this->request->post['remaining_count'];
} elseif (isset($download_info['remaining_count'])) {
$this->data['remaining_count'] = $download_info['remaining_count'];
} else {
$this->data['remaining_count'] = 1;
}
if (isset($this->request->post['update'])) {
$this->data['update'] = $this->request->post['update'];
} else {
$this->data['update'] = FALSE;
}
if (!isset($this->request->get['download_id'])) {
$this->data['action'] = $this->html->getSecureURL('catalog/download/insert');
$this->data['heading_title'] = $this->language->get('text_insert') . $this->language->get('text_download');
$this->data['update'] = '';
$download_info = array('download_id' => 0);
} else {
$this->data['action'] = $this->html->getSecureURL('catalog/download/update', '&download_id=' . $this->request->get['download_id']);
$this->data['heading_title'] = $this->language->get('text_edit') . $this->language->get('text_download') . ' - ' . $download_info['name'];
$this->data['update'] = $this->html->getSecureURL('listing_grid/download/update_field', '&id=' . $this->request->get['download_id']);
$download_info = $this->model_catalog_download->getDownload($this->request->get['download_id']);
}
$this->document->addBreadcrumb(array('href' => $this->data['action'], 'text' => $this->data['heading_title'], 'separator' => ' :: '));
$this->view->assign('help_url', $this->gen_help_url('download_edit'));
$this->view->batchAssign($this->data);
$this->view->assign('form_language_switch', $this->html->getContentLanguageSwitcher());
$this->view->assign('language_id', $this->session->data['content_language_id']);
$form_html = $this->dispatch('responses/product/product/buildDownloadForm', array($download_info, 'responses/catalog/download_form.tpl'));
$this->view->assign('form', $form_html->dispatchGetOutput());
$this->processTemplate('pages/catalog/download_form.tpl');
}
示例5: buildDownloadForm
/**
* @param array $file_data
* @param string $tpl
*/
public function buildDownloadForm($file_data, $tpl)
{
$this->data = array();
//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);
$this->loadLanguage('catalog/files');
$this->loadModel('localisation/order_status');
$this->loadModel('catalog/download');
$product_id = $file_data['product_id'];
$order_statuses = $this->model_localisation_order_status->getOrderStatuses();
$this->data['date_added'] = dateISO2Display($file_data['date_added'], $this->language->get('date_format_short') . ' ' . $this->language->get('time_format'));
$this->data['date_modified'] = dateISO2Display($file_data['date_modified'], $this->language->get('date_format_short') . ' ' . $this->language->get('time_format'));
$this->data['action'] = $this->html->getSecureURL('r/product/product/processDownloadForm', '&product_id=' . $product_id);
$this->data['form_title'] = $this->language->get('text_edit') . ' ' . $this->language->get('text_product');
$this->data['download_id'] = (int) $file_data['download_id'];
if ($this->data['download_id']) {
$form = new AForm('HS');
$this->data['update'] = $this->html->getSecureURL('listing_grid/download/update_field', '&id=' . $this->data['download_id']);
} else {
$form = new AForm('HT');
}
$form->setForm(array('form_name' => 'downloadFrm' . $file_data['download_id'], 'update' => $this->data['update']));
$this->data['form']['form_open'] = $form->getFieldHtml(array('type' => 'form', 'name' => 'downloadFrm' . $file_data['download_id'], 'attr' => 'confirm-exit="true"', 'action' => $this->data['action']));
$this->data['form']['submit'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'submit', 'text' => (int) $this->data['download_id'] ? $this->language->get('button_save') : $this->language->get('text_add'), 'style' => 'button1'));
$this->data['form']['cancel'] = $form->getFieldHtml(array('type' => 'button', 'name' => 'cancel', 'href' => $this->html->getSecureURL('catalog/product_files', '&product_id=' . $product_id), 'text' => $this->language->get('button_cancel'), 'style' => 'button2'));
$rl = new AResource('download');
$rl_dir = $rl->getTypeDir();
$resource_id = $rl->getIdFromHexPath(str_replace($rl_dir, '', $file_data['filename']));
$resource_info = $rl->getResource($resource_id);
$thumbnail = $rl->getResourceThumb($resource_id, 30, 30);
if ($resource_info['resource_path']) {
$this->data['icon'] = $this->html->buildResourceImage(array('url' => $thumbnail, 'width' => 30, 'height' => 30, 'attr' => 'alt="' . $resource_info['title'] . '"'));
} else {
$this->data['icon'] = $resource_info['resource_code'];
}
if ($resource_id) {
$this->data['preview']['href'] = $this->html->getSecureURL('common/resource_library/get_resource_preview', '&resource_id=' . $resource_id, true);
$this->data['preview']['path'] = 'resources/' . $file_data['filename'];
}
$r = $this->dispatch('responses/common/resource_library/get_resource_html_single', array('type' => 'download', 'wrapper_id' => 'download_' . (int) $this->data['download_id'], 'resource_id' => $resource_id, 'field' => 'download_rl_path_' . $this->data['download_id']));
$this->data['resource'] = $r->dispatchGetOutput();
$resources_scripts = $this->dispatch('responses/common/resource_library/get_resources_scripts', array('object_name' => 'downloads', 'object_id' => (int) $this->data['download_id'], 'types' => 'download', 'mode' => 'url'));
$this->data['resources_scripts'] = $resources_scripts->dispatchGetOutput();
$this->data['form']['fields']['download_rl_path'] = $form->getFieldHtml(array('type' => 'hidden', 'name' => 'download_rl_path_' . $this->data['download_id'], 'value' => htmlspecialchars($file_data['filename'], ENT_COMPAT, 'UTF-8')));
$this->data['form']['fields']['status'] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'status', 'value' => 1, 'checked' => $file_data['status'] ? true : false, 'style' => 'btn_switch'));
$orders_count = $this->model_catalog_download->getTotalOrdersWithProduct($product_id);
if ($orders_count) {
$this->data['push_to_customers'] = $this->html->buildElement(array('type' => 'button', 'name' => 'push_to_customers', 'title' => sprintf($this->language->get('text_push_to_orders'), $orders_count), 'text' => $this->language->get('text_push'), 'href' => $this->html->getSecureURL('r/product/product/pushToCustomers', '&product_id=' . $product_id . '&download_id=' . $this->data['download_id']), 'style' => 'button2', 'attr' => 'data-orders-count="' . $orders_count . '"'));
}
$this->data['maplist'] = array();
$file_data['map_list'] = (array) $file_data['map_list'];
foreach ($file_data['map_list'] as $map_id => $map_name) {
if ($map_id == $product_id) {
continue;
}
$this->data['maplist'][] = array('href' => $this->html->getSecureURL('catalog/product_files', '&product_id=' . $map_id . '&download_id=' . $this->data['download_id'], true), 'text' => $map_name);
}
if (!sizeof($this->data['maplist'])) {
$this->data['already_shared'] = false;
} else {
$this->data['already_shared'] = true;
}
$this->data['delete_unmap_href'] = $this->html->getSecureURL('catalog/product_files', '&act=' . ($file_data['shared'] ? 'unmap' : 'delete') . '&product_id=' . $product_id . '&download_id=' . $this->data['download_id'], true);
$this->data['form']['fields']['shared'] = $form->getFieldHtml(array('type' => 'checkbox', 'name' => 'shared', 'value' => $file_data['shared'], 'attr' => $this->data['already_shared'] ? ' disabled=disabled' : ''));
if ($file_data['shared']) {
$this->data['text_attention_shared'] = $this->language->get('attention_shared');
}
$this->data['form']['fields']['download_id'] = $form->getFieldHtml(array('type' => 'hidden', 'name' => 'download_id', 'value' => $this->data['download_id']));
$this->data['form']['fields']['name'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'name', 'value' => $file_data['name'], 'attr' => ' maxlength="64" '));
$this->data['form']['fields']['mask'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'mask', 'value' => $file_data['mask']));
$this->data['form']['fields']['max_downloads'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'max_downloads', 'value' => $file_data['max_downloads'], 'style' => 'small-field'));
$this->data['form']['fields']['activate'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'activate', 'value' => $file_data['activate'], 'options' => array('' => $this->language->get('text_select'), 'before_order' => $this->language->get('text_before_order'), 'immediately' => $this->language->get('text_immediately'), 'order_status' => $this->language->get('text_on_order_status'), 'manually' => $this->language->get('text_manually')), 'required' => true, 'style' => 'download_activate no-save'));
$options = array('' => $this->language->get('text_select'));
foreach ($order_statuses as $order_status) {
$options[$order_status['order_status_id']] = $order_status['name'];
}
$this->data['form']['fields']['order_statuses'] = $form->getFieldHtml(array('type' => 'selectbox', 'name' => 'activate_order_status_id', 'value' => $file_data['activate_order_status_id'], 'options' => $options, 'required' => true, 'style' => 'no-save'));
$this->data['form']['fields']['sort_order'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'sort_order', 'style' => 'small-field', 'value' => $file_data['sort_order']));
$this->data['form']['fields']['expire_days'] = $form->getFieldHtml(array('type' => 'input', 'name' => 'expire_days', 'style' => 'small-field', 'value' => $file_data['expire_days']));
/*
* DOWNLOAD ATTRIBUTES PIECE OF FORM
* */
$attributes = $this->model_catalog_download->getDownloadAttributes($this->data['download_id']);
$elements = HtmlElementFactory::getAvailableElements();
$html_multivalue_elements = HtmlElementFactory::getMultivalueElements();
$html_elements_with_options = HtmlElementFactory::getElementsWithOptions();
if (!$attributes) {
$attr_mng = new AAttribute_Manager('download_attribute');
$attr_type_id = $attr_mng->getAttributeTypeID('download_attribute');
$this->data['text_no_download_attributes_yet'] = sprintf($this->language->get('text_no_download_attributes_yet'), $this->html->getSecureURL('catalog/attribute/insert', '&attribute_type_id=' . $attr_type_id));
} else {
foreach ($attributes as $attribute) {
$html_type = $elements[$attribute['element_type']]['type'];
if (!$html_type || !$attribute['status']) {
continue;
}
//.........这里部分代码省略.........