Пример #1
0
function fn_delete_events_field($field_id)
{
    fn_giftreg_delete_field_variants($field_id);
    db_query("DELETE FROM ?:giftreg_fields WHERE field_id = ?i", $field_id);
    db_query("DELETE FROM ?:giftreg_descriptions WHERE object_id = ?i AND object_type = 'F'", $field_id);
}
Пример #2
0
             $_data = fn_check_table_fields($data, 'giftreg_fields');
             db_query("UPDATE ?:giftreg_fields SET ?u WHERE field_id = ?i", $_data, $field_id);
             $_data = array('object_id' => $field_id, 'object_type' => 'F', 'description' => $data['description'], 'lang_code' => DESCR_SL);
             db_query("REPLACE INTO ?:giftreg_descriptions ?e", $_data);
             if (@is_array($data['variants'])) {
                 foreach ($data['variants'] as $variant_id => $vdata) {
                     $_data = fn_check_table_fields($vdata, 'giftreg_field_variants');
                     db_query("UPDATE ?:giftreg_field_variants SET ?u WHERE variant_id = ?i", $_data, $variant_id);
                     $_data = array('object_id' => $variant_id, 'object_type' => 'V', 'description' => $vdata['description'], 'lang_code' => DESCR_SL);
                     db_query("REPLACE INTO ?:giftreg_descriptions ?e", $_data);
                 }
             }
             if (substr_count('SR', $data['field_type']) && is_array($data['add_variants'])) {
                 fn_giftreg_add_field_variants($data['add_variants'], $field_id);
             } else {
                 fn_giftreg_delete_field_variants($field_id);
             }
         }
     }
     $suffix = ".field_editor";
 }
 // Delete fields and/or variants
 if ($mode == 'delete') {
     if (!empty($_REQUEST['field_ids'])) {
         foreach ($_REQUEST['field_ids'] as $field_id) {
             fn_delete_events_field($field_id);
         }
     }
     if (!empty($_REQUEST['var_ids'])) {
         foreach ($_REQUEST['var_ids'] as $variant_id) {
             fn_delete_events_variant($variant_id);