$value) { if (!empty($value)) { if (preg_match("/_ID$/", $key)) { if (preg_match("/NOT_/", $key)) { $key = explode("NOT_", $key); $key = $key[0].$key[1]; $sql.= "AND ".$key." != '".addslashes($value)."' "; } else { $sql.= "AND ".$key." = '".addslashes($value)."' "; } } else { if (preg_match("/EXACT_/", $key)) { $key = explode("EXACT_", $key); $key = $key[0].$key[1]; $sql.= "AND ".$key." = '".addslashes($value)."' "; } else { $sql.= "AND ".$key." LIKE '%".addslashes($value)."%' "; } } } } } $sql.= "GROUP BY t_school_centers.CENTER_ID "; if ($order_element) { $sql.= "ORDER BY ".$order_element." ".$order_order." "; } else { $sql.= "ORDER BY t_school_centers.CENTER_ID DESC "; } $sql.= "LIMIT ".$index_element.", ".$show_elements." "; // echo "
".$sql."
"; $datos_results = LIB_db_generic_query($sql, $connection); //print_r($datos_results); // generamos los datos validos $results = MOD_SCHOOLCENTERS_get_centers_results($datos_results, $destiny); return $results; } // contabiliza el total de resultados de una busqueda function MOD_SCHOOLCENTERS_search_total_centers ($search_criteria=false, $destiny=false, $forceDB=false) { global $GLOBAL_config, $MOD_SCHOOLCENTERS_config, $LIB_db_config; $connection = $LIB_db_config["LIGAEDUCACIONEXTRAESCOLARESALCALA_connection"]; $sql = "SELECT COUNT(DISTINCT(t_school_centers.CENTER_ID)) ". "FROM t_school_centers ". "WHERE t_school_centers.CENTER_options_erased=0 "; if (is_array($search_criteria)) { foreach ($search_criteria as $key=>$value) { if (!empty($value)) { if (preg_match("/_ID$/", $key)) { if (preg_match("/NOT_/", $key)) { $key = explode("NOT_", $key); $key = $key[0].$key[1]; $sql.= "AND ".$key." != '".addslashes($value)."' "; } else { $sql.= "AND ".$key." = '".addslashes($value)."' "; } } else { if (preg_match("/EXACT_/", $key)) { $key = explode("EXACT_", $key); $key = $key[0].$key[1]; $sql.= "AND ".$key." = '".addslashes($value)."' "; } else { $sql.= "AND ".$key." LIKE '%".addslashes($value)."%' "; } } } } } // echo $sql; $datos_results = LIB_db_generic_query($sql, $connection); return $datos_results[0][0]; } // muestrea los resultados de una busqueda function MOD_SCHOOLCENTERS_get_centers_results ($complete_results, $destino='') { global $GLOBAL_config, $MOD_SCHOOLCENTERS_config, $search_criteria; if (is_array($complete_results)) { foreach($complete_results as $key=>$result) { switch ($destino) { case "load": default: $final_results[$key]["CENTER_ID"] = $result["CENTER_ID"]; $final_results[$key]["CENTER_name"] = htmlentities($result["CENTER_name"]); $final_results[$key]["CENTER_info"] = nl2br($result["CENTER_info"]); $final_results[$key]["CENTER_confirmed"] = $result["CENTER_confirmed"]; $final_results[$key]["CENTER_confirmed_text"] = $result["CENTER_confirmed_text"]; $search_criteria_workshops["t_workshops.CENTER_ID"] = $result["CENTER_ID"]; $total_workshops = MOD_WORKSHOPS_search_total_workshops($search_criteria_workshops); $results_workshops = MOD_WORKSHOPS_search_workshops(0, $total_workshops, "WORKSHOP_order", "ASC", $search_criteria_workshops, "load"); $final_results[$key]["WORKSHOPS"] = $results_workshops; break; } } } else { $final_results[0]["CENTER_ID"] = ""; $final_results[0]["CENTER_name"] = ""; $final_results[0]["OP"] = ""; } return $final_results; } // Función para generar un SELECT con las categorieas function MOD_SCHOOLCENTERS_generate_centers_select ($selected=false, $selected_action="add_selecteds", $search_criteria=false) { global $GLOBAL_config, $MOD_SCHOOLCENTERS_config, $LIB_db_config; $connection = $LIB_db_config["LIGAEDUCACIONEXTRAESCOLARESALCALA_connection"]; $sql = "SELECT CENTER_ID, CENTER_name FROM t_school_centers ". "WHERE CENTER_options_erased=0 AND ( ". "(". "SELECT COUNT(WORKSHOP_ID) ". "FROM t_workshops ". "WHERE t_workshops.CENTER_ID = t_school_centers.CENTER_ID ". "AND WORKSHOP_options_erased =0 ". ") >0 ". ") "; if ($search_criteria != false && is_array($search_criteria)) { foreach ($search_criteria as $key_criteria=>$value_criteria) { $sql.= "AND ".$key_criteria." = ".$value_criteria." "; } } $sql.=" ORDER BY CENTER_ID ASC "; echo("[".$sql."]"); $elements = LIB_db_generic_query($sql, $connection); $html = ""; if (!is_array($selected)) { $selected = explode(";", $selected); } if (is_array($elements)) { foreach ($elements as $value) { // Si ESTE elemento NO ESTÁ en los elementos pasados como parámetro, lo incluimos en el listado switch ($selected_action) { case "delete_selecteds": if (!in_array($value[0], $selected)) { $html.= ""; } return $html; } ?>$value) { if (!empty($value)) { if (preg_match("/_ID$/", $key)) { if (preg_match("/NOT_/", $key)) { $key = explode("NOT_", $key); $key = $key[0].$key[1]; $sql.= "AND ".$key." != '".addslashes($value)."' "; } else { $sql.= "AND ".$key." = '".addslashes($value)."' "; } } else { if (preg_match("/EXACT_/", $key)) { $key = explode("EXACT_", $key); $key = $key[0].$key[1]; $sql.= "AND ".$key." = '".addslashes($value)."' "; } else { $sql.= "AND ".$key." LIKE '%".addslashes($value)."%' "; } } } } } $sql.= "GROUP BY t_workshops.WORKSHOP_ID "; if ($order_element) { $sql.= "ORDER BY ".$order_element." ".$order_order." "; } else { $sql.= "ORDER BY t_workshops.WORKSHOP_ID DESC "; } $sql.= "LIMIT ".$index_element.", ".$show_elements." "; // echo "
".$sql."
"; $datos_results = LIB_db_generic_query($sql, $connection); //print_r($datos_results); // generamos los datos validos $results = MOD_WORKSHOPS_get_workshops_results($datos_results, $destiny); return $results; } // contabiliza el total de resultados de una busqueda function MOD_WORKSHOPS_search_total_workshops ($search_criteria=false, $destiny=false, $forceDB=false) { global $GLOBAL_config, $MOD_WORKSHOPS_config, $LIB_db_config; $connection = $LIB_db_config["LIGAEDUCACIONEXTRAESCOLARESALCALA_connection"]; $sql = "SELECT COUNT(DISTINCT(t_workshops.WORKSHOP_ID)) ". "FROM t_workshops ". "LEFT JOIN t_school_centers ON t_workshops.CENTER_ID = t_school_centers.CENTER_ID ". "WHERE t_workshops.WORKSHOP_options_erased=0 "; if (is_array($search_criteria)) { foreach ($search_criteria as $key=>$value) { if (!empty($value)) { if (preg_match("/_ID$/", $key)) { if (preg_match("/NOT_/", $key)) { $key = explode("NOT_", $key); $key = $key[0].$key[1]; $sql.= "AND ".$key." != '".addslashes($value)."' "; } else { $sql.= "AND ".$key." = '".addslashes($value)."' "; } } else { if (preg_match("/EXACT_/", $key)) { $key = explode("EXACT_", $key); $key = $key[0].$key[1]; $sql.= "AND ".$key." = '".addslashes($value)."' "; } else { $sql.= "AND ".$key." LIKE '%".addslashes($value)."%' "; } } } } } // echo $sql; $datos_results = LIB_db_generic_query($sql, $connection); return $datos_results[0][0]; } // muestrea los resultados de una busqueda function MOD_WORKSHOPS_get_workshops_results ($complete_results, $destino='') { global $GLOBAL_config, $MOD_WORKSHOPS_config, $search_criteria; if (is_array($complete_results)) { foreach($complete_results as $key=>$result) { switch ($destino) { case "load": default: $final_results[$key]["WORKSHOP_ID"] = $result["WORKSHOP_ID"]; $final_results[$key]["WORKSHOP_name"] = $result["WORKSHOP_name"]; $final_results[$key]["WORKSHOP_intervention_days"] = $result["WORKSHOP_intervention_days"]; $final_results[$key]["WORKSHOP_hours"] = $result["WORKSHOP_hours"]; $final_results[$key]["WORKSHOP_remark"] = $result["WORKSHOP_remark"]; $final_results[$key]["WORKSHOP_order"] = $result["WORKSHOP_order"]; $final_results[$key]["CENTER_ID"] = $result["CENTER_ID"]; break; } } } else { $final_results[0]["WORKSHOP_name"] = ""; $final_results[0]["WORKSHOP_intervention_days"] = ""; $final_results[0]["WORKSHOP_hours"] = ""; $final_results[0]["CENTER_name"] = ""; $final_results[0]["OP"] = ""; } return $final_results; } // Función para generar un SELECT con las categorieas function MOD_WORKSHOPS_generate_workshops_select ($selected=false, $selected_action="add_selecteds") { global $GLOBAL_config, $MOD_WORKSHOPS_config, $LIB_db_config; $connection = $LIB_db_config["LIGAEDUCACIONEXTRAESCOLARESALCALA_connection"]; $elements = LIB_db_select_query("WORKSHOP_ID, WORKSHOP_name", "t_workshops", $connection, "WORKSHOP_options_erased=0 ORDER BY WORKSHOP_name "); $html = ""; if (!is_array($selected)) { $selected = explode(";", $selected); } if (is_array($elements)) { foreach ($elements as $value) { // Si ESTE elemento NO ESTÁ en los elementos pasados como parámetro, lo incluimos en el listado switch ($selected_action) { case "add_selecteds": $html.= ""; } return $html; } ?>
Fatal error: Call to undefined function MOD_SCHOOLCENTERS_search_total_centers() in /var/www/vhosts/ligaeducacion.org/httpdocs/extraescolaresalcala/oferta_de_talleres.php on line 10