} else {
    if ($debug) {
        echo "VOY A RECUPERAR EL ID DE UNA NUEVA INICIATIVA REGISTRADA: " . $ini_name_registered . "<br>";
    }
    $ini_id = getIdFromIniciative($ini_name_registered);
    if ($debug) {
        echo "ID de iniciativa ya registrada (" . $ini_name_registered . "): " . $ini_id . "<br>";
    }
}
//Meta Datos
$delivery_date_time = time();
$ev_c_date = date("j/n/Y", $delivery_date_time);
/**
 * Configurar alerta correo electrónico
 */
$texToMailAlert = "MIME_VERSION: 1.0\r\n";
$texToMailAlert .= "Content-type: text/html; charset=UTF-8\r\n";
$texToMailAlert .= "From: Formulario Actividades Civic";
$mail_to = "yourcheckmail@yourserver.com";
$mail_subject = "Nueva actividad en " . $ini_city;
$mail_body = "<b> Iniciativa: " . $ini_name_registered . $ini_name . "<br> Nueva actividad: " . $act_name . "<br> descripción: <br> " . $act_descri . "<br> desde: " . $act_start . "<br> en: " . $map_addres . "<br> lat: " . $map_lat . ", lon: " . $map_lon . "<br> creada por: " . $ini_name . $ini_name_registered . "<br> con web: " . $act_web . "<br>" . $act_topic . "<br>" . $act_form . "<br>" . $act_atten . "<br>" . "<br> Si es una iniciativa nueva: " . "<br> nombre iniciativa: " . $ini_name . "<br> descripción iniciativa: " . $ini_descri . "<br> web iniciativa: " . $ini_web . "<br> mail iniciativa: " . $ini_mail . "<br> telef iniciativa: " . $ini_tef . "<br> dirección iniciativa: " . $ini_addres . "<br> lat: " . $ini_lat . ", lon: " . $ini_lon . "</b>";
//enviar mail (función de php)
mail($mail_to, $mail_subject, $mail_body, $texToMailAlert);
/*************************************************************************************************
 * METER ACTIVIDADES EN CARTO DB
 *************************************************************************************************/
$sqlRegisterActivity = "INSERT INTO " . $act_table_name . "(" . $cartodb_act_field_the_geom . "," . $cartodb_act_field_act_name . "," . $cartodb_act_field_act_descri . "," . $cartodb_act_field_act_web . "," . $cartodb_act_field_act_topic . "," . $cartodb_act_field_act_otopic . "," . $cartodb_act_field_act_form . "," . $cartodb_act_field_act_oform . "," . $cartodb_act_field_act_atten . "," . $cartodb_act_field_act_oatten . "," . $cartodb_act_field_act_start . "," . $cartodb_act_field_act_city . "," . $cartodb_act_field_map_addres . "," . $cartodb_act_field_map_lat . "," . $cartodb_act_field_map_lon . "," . $cartodb_act_field_ini_id . ") VALUES (" . "ST_SetSRID(ST_Point(" . $map_lon . "," . $map_lat . "), 4326)" . "," . "'" . $act_name . "'" . "," . "'" . $act_descri . "'" . "," . "'" . $act_web . "'" . "," . "'" . $act_topic . "'" . "," . "'" . $act_otopic . "'" . "," . "'" . $act_form . "'" . "," . "'" . $act_oform . "'" . "," . "'" . $act_atten . "'" . "," . "'" . $act_oatten . "'" . "," . "'" . $act_start . "'" . "," . "'" . $act_city . "'" . "," . "'" . $map_addres . "'" . "," . "'" . $map_lat . "'" . "," . "'" . $map_lon . "'" . "," . "'" . $ini_id . "'" . ")";
$result = executeQueryToCartoDB($sqlRegisterActivity);
if ($debug) {
    echo "Form input result: " . $result . "<br>";
}
Exemplo n.º 2
0
function getIniciatives()
{
    global $debug;
    global $cartodb_ini_field_ini_name;
    global $ini_table_name;
    global $ciudad_activa;
    $sql = "SELECT * FROM " . $ini_table_name . " WHERE city like '" . $ciudad_activa . "' ORDER BY " . $cartodb_ini_field_ini_name . " ASC";
    $result = executeQueryToCartoDB($sql);
    if ($debug) {
        echo "<br>getNameIniciatives() query RESULT: " . $result . "<br>";
    }
    return $result;
}