public static function execute(ApplicationAbstract $application) { $data = array('name' => $_POST['categories_name'], 'image' => isset($_POST['cImageSelected']) ? $_POST['cImageSelected'] : null, 'parent_id' => $_POST['parent_id']); if (Categories::save(isset($_GET['id']) && is_numeric($_GET['id']) ? $_GET['id'] : null, $data)) { Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_success_action_performed'), 'success'); } else { Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_error_action_not_performed'), 'error'); } OSCOM::redirect(OSCOM::getLink(null, null, 'cid=' . $application->getCurrentCategoryID())); }
public static function execute(ApplicationAbstract $application) { $error = false; foreach ($_POST['batch'] as $id) { if (!Categories::move($id, $_POST['parent_id'])) { $error = true; break; } } if ($error === false) { Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_success_action_performed'), 'success'); } else { Registry::get('MessageStack')->add(null, OSCOM::getDef('ms_error_action_not_performed'), 'error'); } OSCOM::redirect(OSCOM::getLink(null, null, 'cid=' . $application->getCurrentCategoryID())); }