// Move controller templates to subfolder controllers/

This commit is contained in:
tDidierjean
2012-01-09 17:23:42 +00:00
parent 14c9eec92a
commit e2dbac517f
168 changed files with 190 additions and 132 deletions
@@ -59,7 +59,6 @@ class AdminAccountingExportControllerCore extends AdminController
{
$this->className = 'Accounting';
$this->pathAccountExportTpl = _PS_ADMIN_DIR_.'/themes/default/template/accounting_export/';
$this->content = '';
$this->downloadDir = _PS_ADMIN_DIR_.'/export/';
$this->exportSelected = 'global_export';
@@ -118,8 +117,8 @@ class AdminAccountingExportControllerCore extends AdminController
'preventList' => $this->prevent
)
);
$this->content .= $this->context->smarty->fetch($this->pathAccountExportTpl.'menu.tpl');
$this->content .= $this->createTemplate('menu.tpl')->fetch();
}
/**
@@ -155,23 +154,18 @@ class AdminAccountingExportControllerCore extends AdminController
'journal' => Configuration::get('ACCOUNTING_JOURNAL_EXPORT'),
'begin_date' => Tools::getValue('beginDate'),
'end_date' => Tools::getValue('endDate'),
'pathAccountExportTpl' => $this->pathAccountExportTpl,
'urlDownload' => Tools::getShopDomain().'/download/'
));
foreach($this->exportTypeList as $exportType)
{
$pathTpl = $this->pathAccountExportTpl.$exportType['type'].'.tpl';
$pathExportedFile = $this->downloadDir.$exportType['file'];
$this->context->smarty->assign(array(
'title' => $exportType['name'],
'type' => $exportType['type'],
'existingExport' => file_exists($this->downloadDir.$exportType['file']) ? true : false
));
if (file_exists($pathTpl))
$this->content .= $this->context->smarty->fetch($pathTpl);
$this->content .= $this->createTemplate($exportType['type'].'.tpl')->fetch();
}
parent::initContent();
}
@@ -176,7 +176,7 @@ class AdminCartRulesControllerCore extends AdminController
foreach ($results as $row)
$attributes[in_array($row['id'], $selected) ? 'selected' : 'unselected'][] = $row;
Context::getContext()->smarty->assign('product_rule_itemlist', $attributes);
$choose_content = Context::getContext()->smarty->fetch('cart_rules/product_rule_itemlist.tpl');
$choose_content = $this->createTemplate('product_rule_itemlist.tpl')->fetch();
Context::getContext()->smarty->assign('product_rule_choose_content', $choose_content);
break;
case 'products':
@@ -190,7 +190,7 @@ class AdminCartRulesControllerCore extends AdminController
foreach ($results as $row)
$products[in_array($row['id'], $selected) ? 'selected' : 'unselected'][] = $row;
Context::getContext()->smarty->assign('product_rule_itemlist', $products);
$choose_content = Context::getContext()->smarty->fetch('cart_rules/product_rule_itemlist.tpl');
$choose_content = $this->createTemplate('product_rule_itemlist.tpl')->fetch();
Context::getContext()->smarty->assign('product_rule_choose_content', $choose_content);
break;
case 'categories':
@@ -204,14 +204,14 @@ class AdminCartRulesControllerCore extends AdminController
foreach ($results as $row)
$categories[in_array($row['id'], $selected) ? 'selected' : 'unselected'][] = $row;
Context::getContext()->smarty->assign('product_rule_itemlist', $categories);
$choose_content = Context::getContext()->smarty->fetch('cart_rules/product_rule_itemlist.tpl');
$choose_content = $this->createTemplate('product_rule_itemlist.tpl')->fetch();
Context::getContext()->smarty->assign('product_rule_choose_content', $choose_content);
break;
default:
die;
}
return Context::getContext()->smarty->fetch('cart_rules/product_rule.tpl');
return $this->createTemplate('product_rule.tpl')->fetch();
}
public function ajaxProcess()
@@ -337,7 +337,7 @@ class AdminCartRulesControllerCore extends AdminController
)
);
$this->content .= Context::getContext()->smarty->fetch('cart_rules/form.tpl');
$this->content .= $this->createTemplate('form.tpl')->fetch();
$this->addJqueryUI('ui.datepicker');
return parent::renderForm();
@@ -524,7 +524,7 @@ class AdminCustomerThreadsControllerCore extends AdminController
private function displayMessage($message, $email = false, $id_employee = null)
{
$tpl = $this->context->smarty->createTemplate($this->tpl_folder.'message.tpl');
$tpl = $this->createTemplate('message.tpl');
$contacts = Contact::getContacts($this->context->language->id);
+2 -1
View File
@@ -148,7 +148,8 @@ class AdminHomeControllerCore extends AdminController
}
$this->context->smarty->assign('opti_list',$opti_list);
$this->context->smarty->assign('content',$content);
return $this->context->smarty->fetch('home/optimizationTips.tpl');
$template = $this->createTemplate('optimizationTips.tpl');
return $template->fetch();
}
public function setMedia()
@@ -285,7 +285,7 @@ class AdminModulesPositionsControllerCore extends AdminController
'can_move' => (Shop::isFeatureActive() && $this->context->shop->getContextType() != Shop::CONTEXT_SHOP) ? false : true,
));
return $this->context->smarty->fetch('modules_positions/list_modules.tpl');
return $this->createTemplate('list_modules.tpl')->fetch();
}
public function renderForm()
@@ -344,7 +344,7 @@ class AdminModulesPositionsControllerCore extends AdminController
foreach ($exceptsList as $shopID => $fileList)
$exception_list_diff[] = $this->displayModuleExceptionList($fileList, $shopID);
$tpl = $this->context->smarty->createTemplate('modules_positions/form.tpl');
$tpl = $this->createTemplate('form.tpl');
$tpl->assign(array(
'url_submit' => self::$currentIndex.'&token='.$this->token,
'edit_graft' => Tools::isSubmit('editGraft'),
+11 -11
View File
@@ -102,7 +102,7 @@ class AdminOrdersControllerCore extends AdminController
'toolbar_fix' => $this->toolbar_fix,
'title' => $this->l('Orders : create order'),
));
$this->content .= $this->context->smarty->fetch('orders/form.tpl');
$this->content .= $this->createTemplate('form.tpl')->fetch();
}
public function initToolbar()
@@ -162,7 +162,7 @@ class AdminOrdersControllerCore extends AdminController
'tr' => $tr
));
return $this->context->smarty->fetch('orders/_print_pdf_icon.tpl');
return $this->createTemplate('_print_pdf_icon.tpl')->fetch();
}
public function postProcess()
@@ -1393,13 +1393,13 @@ class AdminOrdersControllerCore extends AdminController
die(Tools::jsonEncode(array(
'result' => true,
'view' => $this->context->smarty->fetch('orders/_product_line.tpl'),
'view' => $this->createTemplate('_product_line.tpl')->fetch(),
'can_edit' => $this->tabAccess['add'],
'order' => $order,
'invoices' => $invoice_array,
'documents_html' => $this->context->smarty->fetch('orders/_documents.tpl'),
'shipping_html' => $this->context->smarty->fetch('orders/_shipping.tpl'),
'discount_form_html' => $this->context->smarty->fetch('orders/_discount_form.tpl')
'documents_html' => $this->createTemplate('_documents.tpl')->fetch(),
'shipping_html' => $this->createTemplate('_shipping.tpl')->fetch(),
'discount_form_html' => $this->createTemplate('_discount_form.tpl')->fetch()
)));
}
@@ -1552,13 +1552,13 @@ class AdminOrdersControllerCore extends AdminController
die(Tools::jsonEncode(array(
'result' => $res,
'view' => $this->context->smarty->fetch('orders/_product_line.tpl'),
'view' => $this->createTemplate('_product_line.tpl')->fetch(),
'can_edit' => $this->tabAccess['add'],
'invoices_collection' => $invoice_collection,
'order' => $order,
'invoices' => $invoice_array,
'documents_html' => $this->context->smarty->fetch('orders/_documents.tpl'),
'shipping_html' => $this->context->smarty->fetch('orders/_shipping.tpl')
'documents_html' => $this->createTemplate('_documents.tpl')->fetch(),
'shipping_html' => $this->createTemplate('_shipping.tpl')->fetch()
)));
}
@@ -1624,8 +1624,8 @@ class AdminOrdersControllerCore extends AdminController
'result' => $res,
'order' => $order,
'invoices' => $invoice_array,
'documents_html' => $this->context->smarty->fetch('orders/_documents.tpl'),
'shipping_html' => $this->context->smarty->fetch('orders/_shipping.tpl')
'documents_html' => $this->createTemplate('_documents.tpl')->fetch(),
'shipping_html' => $this->createTemplate('_shipping.tpl')->fetch()
)));
}
@@ -135,7 +135,7 @@ class AdminOutstandingControllerCore extends AdminController
'id_invoice' => $id_invoice
));
return $this->context->smarty->fetch('outstanding/_print_pdf_icon.tpl');
return $this->createTemplate('_print_pdf_icon.tpl')->fetch();
}
public function printOutstandingCalculation($id_invoice, $tr)
+34 -47
View File
@@ -1850,7 +1850,7 @@ class AdminProductsControllerCore extends AdminController
$this->tab_display = 'Informations';
if(method_exists($this, 'initForm'.$this->tab_display))
$this->tpl_form = 'products/'.strtolower($this->tab_display).'.tpl';
$this->tpl_form = strtolower($this->tab_display).'.tpl';
if ($this->ajax)
$this->content_only = true;
@@ -2144,13 +2144,9 @@ class AdminProductsControllerCore extends AdminController
$this->_errors[] = 'Unable to load object';
else
{
if ($this->object->id && !Shop::isProductAvailable($this->object->id))
$this->_displayUnavailableProductWarning();
$this->_displayDraftWarning($this->object->active);
$this->initPack($this->object);
$this->{'initForm'.$this->tab_display}($this->object, $languages, $default_language);
$this->tpl_form_vars['product'] = $this->object;
if ($this->ajax)
@@ -2159,7 +2155,6 @@ class AdminProductsControllerCore extends AdminController
else
return $this->tpl_form_vars['custom_form'];
}
$parent = parent::renderForm();
$this->addJqueryPlugin(array('autocomplete', 'fancybox', 'typewatch'));
return $parent;
@@ -2460,12 +2455,11 @@ class AdminProductsControllerCore extends AdminController
*/
public function initFormAccounting($obj)
{
$data = $this->context->smarty->createData();
$data = $this->createTemplate($this->tpl_form);
if ($obj->id)
{
$error = '';
$token = Tools::getValue('token') ? Tools::getValue('token') : $this->token;
$detail = array();
if (count($this->context->shop->getListOfID()) > 1)
@@ -2498,13 +2492,13 @@ class AdminProductsControllerCore extends AdminController
else
$this->displayWarning($this->l('You must save this product before manage accounting.'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
public function initFormAssociations($obj)
{
$product = $obj;
$data = $this->context->smarty->createData();
$data = $this->createTemplate($this->tpl_form);
// Prepare Categories tree for display in Associations tab
$default_category = Tools::getValue('id_category', 1);
@@ -2518,15 +2512,8 @@ class AdminProductsControllerCore extends AdminController
$selected_cat = Product::getProductCategoriesFull($product->id, $this->default_form_language);
}
if ($this->context->shop() == Shop::CONTEXT_SHOP)
{
$root_category = Category::getRootCategory();
$root_category = array('id_category' => $root_category->id_category, 'name' => $root_category->name);
}
else
$root_category = array('id_category' => '0', 'name' => $this->l('Root'));
$translations = array(
'Root' => $root_category,
'Home' => $this->l('Home'),
'selected' => $this->l('selected'),
'Collapse All' => $this->l('Collapse All'),
'Expand All' => $this->l('Expand All'),
@@ -2569,12 +2556,12 @@ class AdminProductsControllerCore extends AdminController
'link' => $this->context->link
));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
public function initFormPrices($obj)
{
$data = $this->context->smarty->createData();
$data = $this->createTemplate($this->tpl_form);
$product = $obj;
if ($obj->id)
{
@@ -2651,12 +2638,12 @@ class AdminProductsControllerCore extends AdminController
'token' => $this->token
));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
public function initFormSeo($product, $languages, $default_language)
{
$data = $this->context->smarty->createData();
$data = $this->createTemplate($this->tpl_form);
$data->assign(array(
'product' => $product,
@@ -2665,12 +2652,12 @@ class AdminProductsControllerCore extends AdminController
'ps_ssl_enabled' => Configuration::get('PS_SSL_ENABLED')
));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
public function initFormPack($product, $languages, $default_language)
{
$data = $this->context->smarty->createData();
$data = $this->createTemplate($this->tpl_form);
$product->packItems = Pack::getItems($product->id, $this->context->language->id);
@@ -2698,12 +2685,12 @@ class AdminProductsControllerCore extends AdminController
'input_namepack_items' => $input_namepack_items
));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
public function initFormVirtualProduct($product, $languages, $default_language)
{
$data = $this->context->smarty->createData();
$data = $this->createTemplate($this->tpl_form);
$currency = $this->context->currency;
@@ -2775,7 +2762,7 @@ class AdminProductsControllerCore extends AdminController
$data->assign($this->tpl_form_vars);
$data->assign('link', $this->context->link);
$this->tpl_form_vars['product'] = $product;
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
private function _getFinalPrice($specific_price, $productPrice, $taxRate)
@@ -3009,7 +2996,7 @@ class AdminProductsControllerCore extends AdminController
public function initFormCustomization($obj, $languages, $default_language)
{
$data = $this->context->smarty->createData();
$data = $this->createTemplate($this->tpl_form);
if ((bool)$obj->id)
{
@@ -3033,12 +3020,12 @@ class AdminProductsControllerCore extends AdminController
else
$this->displayWarning($this->l('You must save this product before adding customization.'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
public function initFormAttachments($obj, $languages, $default_language)
{
$data = $this->context->smarty->createData();
$data = $this->createTemplate($this->tpl_form);
if ((bool)$obj->id)
{
@@ -3065,12 +3052,12 @@ class AdminProductsControllerCore extends AdminController
else
$this->displayWarning($this->l('You must save this product before adding attachements.'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
public function initFormInformations($product)
{
$data = $this->context->smarty->createData();
$data = $this->createTemplate($this->tpl_form);
// autoload rich text editor (tiny mce)
$iso = $this->context->language->iso_code;
@@ -3152,12 +3139,12 @@ class AdminProductsControllerCore extends AdminController
$data->assign('link', $this->context->link);
$data->assign('PS_PRODUCT_SHORT_DESC_LIMIT', Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT') ? Configuration::get('PS_PRODUCT_SHORT_DESC_LIMIT') : 400);
$this->tpl_form_vars['product'] = $product;
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
public function initFormShipping($obj)
{
$data = $this->context->smarty->createData();
$data = $this->createTemplate($this->tpl_form);
$data->assign(array(
'product' => $obj,
'ps_dimension_unit' => Configuration::get('PS_DIMENSION_UNIT'),
@@ -3166,7 +3153,7 @@ class AdminProductsControllerCore extends AdminController
'currency' => $this->context->currency,
'country_display_tax_label' => $this->context->country->display_tax_label
));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
protected function getCarrierList()
@@ -3200,7 +3187,7 @@ class AdminProductsControllerCore extends AdminController
public function initFormImages($obj)
{
$data = $this->context->smarty->createData();
$data = $this->createTemplate($this->tpl_form);
if ((bool)$obj->id)
{
@@ -3237,7 +3224,7 @@ class AdminProductsControllerCore extends AdminController
else
$this->displayWarning($this->l('You must save this product before adding images.'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
public function initFormCombinations($obj, $languages, $default_language)
@@ -3254,7 +3241,7 @@ class AdminProductsControllerCore extends AdminController
return;
}
$data = $this->context->smarty->createData();
$data = $this->createTemplate($this->tpl_form);
if ((bool)$product->id)
{
$attribute_js = array();
@@ -3314,7 +3301,7 @@ class AdminProductsControllerCore extends AdminController
else
$this->displayWarning($this->l('You must save this product before adding combinations.'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
public function renderListAttributes($id_product_download, $product, $currency)
@@ -3463,7 +3450,7 @@ class AdminProductsControllerCore extends AdminController
public function initFormQuantities($obj, $languages)
{
$data = $this->context->smarty->createData();
$data = $this->createTemplate($this->tpl_form);
if ($obj->id)
{
@@ -3559,12 +3546,12 @@ class AdminProductsControllerCore extends AdminController
else
$this->displayWarning($this->l('You must save this product before managing quantities.'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
public function initFormSuppliers($obj)
{
$data = $this->context->smarty->createData();
$data = $this->createTemplate($this->tpl_form);
if ($obj->id)
{
@@ -3631,12 +3618,12 @@ class AdminProductsControllerCore extends AdminController
else
$this->displayWarning($this->l('You must save this product before managing suppliers'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
public function initFormWarehouses($obj)
{
$data = $this->context->smarty->createData();
$data = $this->createTemplate($this->tpl_form);
if ($obj->id)
{
@@ -3676,7 +3663,7 @@ class AdminProductsControllerCore extends AdminController
else
$this->displayWarning($this->l('You must save this product before managing warehouses'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
public function initFormFeatures($obj)
@@ -3687,7 +3674,7 @@ class AdminProductsControllerCore extends AdminController
return;
}
$data = $this->context->smarty->createData();
$data = $this->createTemplate($this->tpl_form);
if ($obj->id)
{
$features = Feature::getFeatures($this->context->language->id);
@@ -3722,7 +3709,7 @@ class AdminProductsControllerCore extends AdminController
else
$this->displayWarning($this->l('You must save this product before adding features.'));
$this->tpl_form_vars['custom_form'] = $this->context->smarty->createTemplate($this->tpl_form, $data)->fetch();
$this->tpl_form_vars['custom_form'] = $data->fetch();
}
public function ajaxProcessProductQuantity()
@@ -364,7 +364,7 @@ class AdminReferrersControllerCore extends AdminController
public static function displayCalendarForm($translations, $token, $action = null, $table = null, $identifier = null, $id = null)
{
$context = Context::getContext();
$tpl = $context->smarty->createTemplate('referrers/calendar.tpl');
$tpl = $context->controller->createTemplate('calendar.tpl');
$context->controller->addJqueryUI('ui.datepicker');
@@ -387,7 +387,7 @@ class AdminReferrersControllerCore extends AdminController
{
if (!Tools::isSubmit('viewreferrer'))
{
$tpl = $this->context->smarty->createTemplate($this->tpl_folder.'form_settings.tpl');
$tpl = $this->createTemplate('form_settings.tpl');
$tpl->assign(array(
'current' => self::$currentIndex,
@@ -171,7 +171,7 @@ class AdminRequestSqlControllerCore extends AdminController
*/
public function displayExportLink($token, $id)
{
$tpl = $this->context->smarty->createTemplate('request_sql/list_action_export.tpl');
$tpl = $this->createTemplate('list_action_export.tpl');
$tpl->assign(array(
'href' => self::$currentIndex.'&token='.$this->token.'&'.$this->identifier.'='.$id.'&export'.$this->table.'=1',
@@ -74,7 +74,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
public static function displayCalendarForm($translations, $token, $action = null, $table = null, $identifier = null, $id = null)
{
$context = Context::getContext();
$tpl = $context->smarty->createTemplate('stats/calendar.tpl');
$tpl = $context->controller->createTemplate('calendar.tpl');
$context->controller->addJqueryUI('ui.datepicker');
@@ -95,7 +95,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
protected function displayEngines()
{
$tpl = $this->context->smarty->createTemplate('stats/engines.tpl');
$tpl = $this->createTemplate('engines.tpl');
$autoclean_period = array(
'never' => $this->l('Never'),
@@ -120,7 +120,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
public function displayMenu()
{
$tpl = $this->context->smarty->createTemplate('stats/menu.tpl');
$tpl = $this->createTemplate('menu.tpl');
$modules = $this->getModules();
$module_instance = array();
@@ -152,7 +152,7 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
public function displayStats()
{
$tpl = $this->context->smarty->createTemplate('stats/stats.tpl');
$tpl = $this->createTemplate('stats.tpl');
if (!($module_name = Tools::getValue('module')) && $module_instance = Module::getInstanceByName('statsforecast') AND $module_instance->active)
$module_name = 'statsforecast';
@@ -173,7 +173,7 @@ class AdminStatusesControllerCore extends AdminController
'action' => self::$cache_lang['editaddresses'],
));
return $this->context->smarty->fetch('manufacturers/list_action_edit_adresses.tpl');
return $this->createTemplate('list_action_edit_adresses.tpl')->fetch();
}
public function renderForm()