Пример #1
0
 /**
  * Deletes product tab with reliated descriptions
  * @static
  * @param  integer $menu_id ID of tab for delete
  * @return bool
  */
 public static function delete($menu_id)
 {
     if (!empty($menu_id) && fn_check_company_id('menus', 'menu_id', $menu_id)) {
         /**
          * Before delete product tab
          * @param int $menu_id Id of product tab for delete
          */
         fn_set_hook('delete_menu_pre', $menu_id);
         db_query("DELETE FROM ?:menus WHERE menu_id = ?i", $menu_id);
         db_query("DELETE FROM ?:menus_descriptions WHERE menu_id = ?i", $menu_id);
         // Remove data from static data
         $static_datas = db_get_array("SELECT param_id FROM ?:static_data WHERE param_5 = ?i AND section = 'A'", $menu_id);
         foreach ($static_datas as $static_data) {
             fn_delete_static_data($static_data['param_id']);
         }
         /**
          * After delete product tab
          * @param int $menu_id Id of product tab for delete
          */
         fn_set_hook('delete_menu_post', $menu_id);
         return true;
     }
     return false;
 }
Пример #2
0
        }
    }
    if ($mode == 'm_delete') {
        if (!empty($_REQUEST['static_data_ids'])) {
            foreach ($_REQUEST['static_data_ids'] as $k => $v) {
                fn_delete_static_data($v);
            }
        }
    }
    return array(CONTROLLER_STATUS_OK, "static_data.manage?section={$section}");
}
//
// Delete
//
if ($mode == 'delete') {
    fn_delete_static_data($_REQUEST['param_id']);
    $static_data = db_get_field("SELECT COUNT(*) FROM ?:static_data WHERE ?:static_data.section = ?s", $_REQUEST['section']);
    if (empty($static_data)) {
        $view->display('views/static_data/manage.tpl');
    }
    exit;
} elseif ($mode == 'update') {
    $schema = fn_get_schema('static_data', 'schema');
    $section_data = $schema[$section];
    $view->assign('section_data', $section_data);
    $static_data = db_get_row("SELECT ?:static_data.*, ?:static_data_descriptions.descr FROM ?:static_data LEFT JOIN ?:static_data_descriptions ON ?:static_data.param_id = ?:static_data_descriptions.param_id AND ?:static_data_descriptions.lang_code = ?s WHERE ?:static_data.section = ?s AND ?:static_data.param_id = ?i", DESCR_SL, $_REQUEST['section'], $_REQUEST['param_id']);
    if (!empty($section_data['icon'])) {
        $static_data['icon'] = fn_get_image_pairs($static_data['param_id'], $section_data['icon']['type'], 'M', true, true, DESCR_SL);
    }
    if (!empty($section_data['multi_level'])) {
        $params = array('section' => $_REQUEST['section'], 'generate_levels' => true, 'get_params' => true, 'multi_level' => true, 'plain' => true);