Viewing file: include_acciones.php (6.54 KB) -rw-rw-rw- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
///////////////////////////////////////
// Herramienta de manejo de acciones //
///////////////////////////////////////
// Inclusiones
include ('class_consulta_sql.php');
include ('class_listar.php');
include ('class_paginar.php');
include ('class_paginar_1.php');
include ('class_seleccion.php');
include ('class_seleccion_pg.php');
include ('class_cadena_constante.php');
include ('class_seleccion_constante.php');
include ('class_files.php');
include ('class_filtrar_select_edicion.php');
include ('include_imprimir.php');
include ('class_categorias.php');
include ('class_fechas.php');
include ('class_mover.php');
include ('class_copiar.php');
include ('class_password.php');
include ('class_tree.php');
include ('class_tree_1.php');
include ('class_tree_2.php');
include ('class_tree_simple.php');
include ('class_indice.php');
include ('class_indice_interno.php');
include ('class_resize.php');
include ('class_system.php');
include ('class_reemplazo.php');
include ('class_validar_datos.php');
include ('class_aviso.php');
include ('class_integridad.php');
include ('class_search.php');
include ('class_data_register.php');
include ('class_avoid_duplicidad.php');
include ('include_querys_admon.php');
if ($stop == 0) {
// 0. Despliegue inicial
if ($accion == "") {
// Por llenar.
}
// 1. Insercion Masiva
$reg_unit = 0;
$control_insercion = 0;
if (isset($links_numero) and $id_app=21) {
$reg_unit = 1;
if ($accion == "ins_") {
$s = 0;
foreach ($valores_insertar as $v_i) {
$query = "insert into " . $tabla . " values(" . $v_i . ")";
$insert = new Select($query, "ins_", 0 ,0);
//1.3 Registro Masivo
// 1.3.1 Cáculo del día
$f2 = new fecha;
$f2->sys_fecha();
$fecha_registro = $f2->FECHA_SYS;
// 1.3.2 Inserción de los valores en el registro
$valores_insertar_register = "'','$user','$id_app','$insert->LAST_ID','$tabla','$accion','$fecha_registro',''";
$query_register = "insert into administracion_registro values(" . $valores_insertar_register . ")";
$insert_register = new Select($query_register, "ins_", 0 ,0);
//1.2 Insercion Relacion Masiva
if (isset($tabla_rel)) {
for ($i = 0; $i < $repeticiones; $i++) {
$val = $insert->LAST_ID . "," . $valores_insertar_rel[$i];
$query = "insert into " . $tabla_rel . " values(" . $val . ")";
$insert_rel = new Select($query, "ins_", 0 ,0);
}
}
}
}
$control_insercion = 1;
}
if ($accion == "ins_" and $control_insercion == 0) {
if (isset($links_id)){
$last_insert_id = $links_id;
}else{
$query = "insert into " . $tabla . " values(" . $valores_insertar . ")";
$insert = new Select($query, "ins_", 0 ,0);
$last_insert_id = $insert->LAST_ID;
}
// 1.3 Insercion Relacion
if (isset($tabla_rel)) {
for ($i = 0; $i < $repeticiones; $i++) {
$valores_insertar_rel[$i] = $last_insert_id . "," . $valores_insertar_rel[$i];
$query = "insert into " . $tabla_rel . " values(" . $valores_insertar_rel[$i] . ")";
$insert_rel = new Select($query, "ins_", 0 ,0);
}
}
if (isset($tabla_rel_2)) {
$valores_insertar_rel_2 = $last_insert_id . "," . $valores_insertar_rel_2;
$query = "insert into " . $tabla_rel_2 . " values(" . $valores_insertar_rel_2 . ")";
$insert_rel = new Select($query, "ins_", 0 ,0);
}
}
// 1.5 Invocación de la clase que detalla el registro afectado en sus campos principales.
if ($accion == "edi_" or $accion == "del_") {
if (isset($select_reg)) {
$n_c = substr_count($select_reg, ',') + 1;
$detalles = new data_register($campo_id, $id, $select_reg ,$tabla, $n_c);
$detalle_reg = $detalles->STRING_REG;
}else{
$detalle_reg = "";
}
}else{
if ($accion == "ins_") {
$detalle_reg = $valores_insertar;
$detalle_reg = str_replace("\"", "", $detalle_reg);
$detalle_reg = str_replace("'", "", $detalle_reg);
$detalle_reg = str_replace("\\", "", $detalle_reg);
//$detalle_reg = str_replace("\'", "", $detalle_reg);
//echo $detalle_reg;
}
}
// 2. Eliminación
if ($accion == "del_") {
$query = "delete from " . $tabla . " where " . $campo_id . "=" . $id;
$delete = new Select($query, "del_", 0 ,0);
}
// 3. Edición
if ($accion == "-1") {
$cuando = $campo_id . "=" . $id;
$arreglo = new select_v1(0, "*", $tabla, $cuando, $numero_campos, 0, "", "", "");
}
if ($accion == "-1_opc") {
$cuando = $campo_id . "=" . $id;
$arreglo = new select_v1(0, "*", $tabla, $cuando, $numero_campos, 0, "", "", "");
}
// 4. Actualización
if ($accion == "edi_") {
$query = "update " . $tabla . " set " . $set . " where " . $campo_id . "=" . $id;
$update = new Select($query, "edi_", 0 ,0);
if (isset($dir_accion)) {
$accion = 9;
}
}
// 5. Especiales de Links
if ($accion == "3a") {
//echo $categoria_id;
}
// 6. Registro de Acciones
if ($accion != "x" and $accion != "-1" and $accion != "" and $reg_unit == 0) {
// 6.1 Cáculo del día
$f2 = new fecha;
$f2->sys_fecha();
$fecha_registro = $f2->FECHA_SYS;
// 6.2 Inserción de los valores en el registro
if ($accion == "ins_") {
$r_id = $last_insert_id;
}else{
$r_id = $id;
}
// 6.3 Muestra con ayuda de la clase aviso un mensaje diciendo que todo esta Ok
if ($accion == "ins_" or $accion == "edi_" or $accion == "del_") {
if ($accion == "ins_") {
$accion_label = "agregado";
}
if ($accion == "del_") {
$accion_label = "eliminado";
}
if ($accion == "edi_") {
$accion_label = "editado";
}
$mensaje_ok = "perfecto " . $user . ", el registro No. " . $r_id . " fue correctamente " . $accion_label . ". <br>Realizado en: " . $fecha_registro;
$aviso = new aviso($mensaje_ok, 1);
}
$valores_insertar_register = "'','$user','$id_app','$r_id','$tabla','$accion','$fecha_registro','$detalle_reg'";
$query_register = "insert into administracion_registro values(" . $valores_insertar_register . ")";
$insert_register = new Select($query_register, "ins_", 0 ,0);
// 6.6 Recuerde que le registro tiene un alias en el control de inserción masiva de este mismo script
// en la línea 52
}
}
?>
|