public function actionCreate() { self::checkAdmin(); if (isset($_POST['submit'])) { $options['name'] = $_POST['name']; $options['sort_order'] = $_POST['sort_order']; $options['status'] = $_POST['status']; $errors = false; if (!isset($options['name']) || empty($options['name'])) { $errors[] = 'Заполните поля формы!'; } if ($errors == false) { $newCategory = Category::createNewCategory($options); header('Location: /admin/category'); } } require_once ROOT . '/views/admin_category/create.php'; return true; }
<?php use_class('CategoryTop'); $default_lid = LANGUAGEID; //SUBMIT FORM $reload_list = false; if (isset($_POST['me_action'])) { $reload_list = true; if ($_POST['me_action'] == 'CATEGORYDETAILSAVE') { $cid = tep_db_prepare_input($_POST['categories_id']); $prefix = tep_db_prepare_input($_POST['prefix']); if ($cid == '0') { $cat_id_new = true; $ctid = tep_db_prepare_input($_POST['categories_top_id']); $cid = Category::createNewCategory($ctid, $prefix); $cat = new Category($cid); } else { $cat_id_new = false; $cat = new Category($cid); $cat->updateDetail($prefix); } foreach ($languages as $lid => $l) { $name = tep_db_prepare_input($_POST['categories_name'][$lid]); $seo_text = tep_db_input($_POST['seo_text'][$lid]); $cat->updateDetailLanguage($lid, $name, $seo_text); } if ($cat_id_new) { $hm = $hidemenuscript == '' ? '' : '&hidemenu=true'; header('Location: ?open=setting-category&id=' . $cat->id . $hm); exit; }