[-] BO : #PSTEST-1061 : add button save and stay in AdminScenesController

This commit is contained in:
lLefevre
2012-03-23 09:47:55 +00:00
parent a1a39944f3
commit 13bc57517a
+15 -7
View File
@@ -106,20 +106,27 @@ class AdminScenesControllerCore extends AdminController
public function renderForm() public function renderForm()
{ {
$this->initFieldsForm(); $this->initFieldsForm();
$content = '';
if (!($obj = $this->loadObject(true))) if (!($obj = $this->loadObject(true)))
return; return;
$langtags = 'name';
$active = $this->getFieldValue($obj, 'active');
$products = $obj->getProducts(true, $this->context->language->id, false, $this->context);
$this->tpl_form_vars['products'] = $obj->getProducts(true, $this->context->language->id, false, $this->context); $this->tpl_form_vars['products'] = $obj->getProducts(true, $this->context->language->id, false, $this->context);
return parent::renderForm(); return parent::renderForm();
} }
public function initToolbar()
{
parent::initToolbar();
if (in_array($this->display, array('add', 'edit')))
$this->toolbar_btn = array_merge(array('save-and-stay' => array(
'short' => 'SaveAndStay',
'href' => '#',
'desc' => $this->l('Save and stay'),
)), $this->toolbar_btn);
}
public function initFieldsForm() public function initFieldsForm()
{ {
$obj = $this->loadObject(true); $obj = $this->loadObject(true);
@@ -234,10 +241,10 @@ class AdminScenesControllerCore extends AdminController
$selected_cat = array(); $selected_cat = array();
if (Tools::isSubmit('categories')) if (Tools::isSubmit('categories'))
foreach (Tools::getValue('categories') as $k => $row) foreach (Tools::getValue('categories') as $row)
$selected_cat[] = $row; $selected_cat[] = $row;
else if ($obj->id) else if ($obj->id)
foreach (Scene::getIndexedCategories($obj->id) as $k => $row) foreach (Scene::getIndexedCategories($obj->id) as $row)
$selected_cat[] = $row['id_category']; $selected_cat[] = $row['id_category'];
$root_category = Category::getRootCategory(); $root_category = Category::getRootCategory();
@@ -307,6 +314,7 @@ class AdminScenesControllerCore extends AdminController
if (!Tools::isSubmit('zones') || !count(Tools::getValue('zones'))) if (!Tools::isSubmit('zones') || !count(Tools::getValue('zones')))
$this->errors[] = Tools::displayError('You should make at least one zone'); $this->errors[] = Tools::displayError('You should make at least one zone');
} }
parent::postProcess(); parent::postProcess();
} }
} }