Ejemplo n.º 1
0
* custom-looking forms, the ability to separate the creation of form
* elements from their display, and being able to use QuickForm in
* widget-based template systems.  See the online documentation for more
* info.
*
* @author      Jason Rust <*****@*****.**> 
*/
require_once "HTML/QuickForm.php";
require_once "HTML/QuickForm/Renderer/QuickHtml.php";
$form =& new HTML_QuickForm('tmp_form', 'POST');
// get our render
$renderer =& new HTML_QuickForm_Renderer_QuickHtml();
// create the elements
createElements($form);
// set their values
setValues($form);
// Do the magic of creating the form.  NOTE: order is important here: this must
// be called after creating the form elements, but before rendering them.
$form->accept($renderer);
// Because radio buttons have the same name we have to pass the value
// as well as the name in order to get the correct one.
$tmp_radio = ' Yes: ' . $renderer->elementToHtml('tmp_radio', 'Y');
$tmp_radio .= ' No: ' . $renderer->elementToHtml('tmp_radio', 'N');
$tmp_submit = $renderer->elementToHtml('tmp_reset');
$tmp_submit .= $renderer->elementToHtml('tmp_submit');
// Make our form table using some of the widget functions.
$data = '
<table border="0" cellpadding="0" cellspacing="2" bgcolor="#eeeeee" width="500">
  <tr style="font-weight: bold;">' . createHeaderCell('QuickForm using QuickHtml Renderer', 'center', 2) . '</tr>
  <tr>' . createFormCell($renderer->elementToHtml('tmp_textarea'), 'center', 2) . '</tr>
  <tr>' . createHeaderCell('Text box (element is part of an array)', 'left') . createHeaderCell('Yes or no?', 'right') . '</tr>
Ejemplo n.º 2
0
    $GLOBALS['pkstu_id'] = $studsList[0]->pkstu_id;
    $GLOBALS['fkstu_lug_id'] = $studsList[0]->fkstu_lug_id;
    $GLOBALS['stu_nombre'] = $studsList[0]->stu_nombre;
    $GLOBALS['stu_fecha_creacion'] = $studsList[0]->stu_fecha_creacion;
}
function setValuesWhenSubmitIsClicked()
{
    $GLOBALS['pkstu_id'] = test_input($_POST['pkstu_id']);
    $GLOBALS['fkstu_lug_id'] = test_input($_POST['fkstu_lug_id']);
    $GLOBALS['stu_nombre'] = test_input($_POST['stu_nombre']);
    $GLOBALS['stu_fecha_creacion'] = test_input($_POST['stu_fecha_creacion']);
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (!empty($_POST['update_id'])) {
        $studsList = json_decode($db->getStudById($_POST['update_id']));
        setValues($studsList);
    } elseif (!empty($_POST['pkstu_id'])) {
        setValuesWhenSubmitIsClicked();
        $answer = @json_decode($db->updateStud($pkstu_id, $fkstu_lug_id, $stu_nombre, $stu_fecha_creacion));
        if ($answer->action != "error") {
            echo '<meta http-equiv="refresh" content="0;url=../studs.php">';
            die;
        }
    }
} else {
    echo '<meta http-equiv="refresh" content="0;url=../studs.php">';
    die;
}
?>

  <!-- Main content -->
 public function __invoke()
 {
     $this->createLabel();
     $alert_text = [];
     $history = [];
     $currentTime = new \DateTime();
     $today = $currentTime->format('m') + 1 + "/" + $currentTime . getDate() + "/" + $currentTime->format('Y');
     $keywordIterator;
     $line_counter = 0;
     while ($keywordIterator->hasNext()) {
         $keyword = keywordIterator . next();
         $line_counter++;
         $current_quality_score = $keyword->qualityScore;
         $keywordLabelsIterator = keyword . labels() . withCondition("Name STARTS_WITH 'QS: '") . get();
         if ($keywordLabelsIterator->hasNext()) {
             $keyword_label = $keywordLabelsIterator . next();
             $matches = new RegExp('QS: ([0-9]+)$') . exec($keyword_label . getName());
             $old_quality_score = $matches[1];
         } else {
             $old_quality_score = 0;
         }
         // For the history also note the change or whether this keyword is new
         if ($old_quality_score > 0) {
             $change = $current_quality_score - $old_quality_score;
         } else {
             $change = "NEW";
         }
         $row = [$today, $keyword . getCampaign() . getName(), $keyword . getAdGroup() . getName(), $keyword . getText(), $current_quality_score, $change];
         $history . push(row);
         // If there is a previously tracked quality score and it's different from the current one...
         if ($old_quality_score > 0 && $current_quality_score != $old_quality_score) {
             // Make a note of this to log it and possibly send it via email later
             $alert_text . push($current_quality_score + "\t" + $old_quality_score + "\t" + $change + "\t" + $keyword . getText());
             // Remove the old label
             $keyword . removeLabel($keyword_label . getName());
         }
         // Store the current QS for the next time by using a label
         $keyword . applyLabel("QS: " + $current_quality_score);
     }
     if ($line_counter == 0) {
         $this->logger->log("Couldn't find any keywords marked for quality score tracking. To mark keywords for tracking, apply the label '" + $label_name + "' to those keywords.");
         return;
     }
     $this->logger->log("Tracked " + $line_counter + " keyword quality scores. To select different keywords for tracking, apply the label '" + $label_name + "' to those keywords.");
     // Store history
     $history_sheet = spreadsheet . getSheetByName('QS history');
     $history_sheet . getRange($history_sheet . getLastRow() + 1, 1, $history . length, 6) . setValues($history);
     // If there are notes for alerts then prepare a message to log and possibly send via email
     if ($alert_text . length) {
         $message = "The following quality score changes were discovered:\nNew\tOld\tChange\tKeyword\n";
         for ($i = 0; $i < count($alert_text); $i++) {
             $message += $alert_text[i] + "\n";
         }
         // Also include a link to the spreadsheet
         $message += "\n" + "The complete history is available at " + $spreadsheet . getUrl();
         $this->logger->log($message);
         // If there is an email address send out a notification
         if ($email_address && $email_address != "YOUR_EMAIL_HERE") {
             $this->mailer->sendEmail($email_address, "Quality Score Tracker: Changes detected", $message);
         }
     }
 }
Ejemplo n.º 4
0
    $GLOBALS['pkeje_id'] = test_input($_POST['pkeje_id']);
    $GLOBALS['fkeje_har_id'] = test_input($_POST['fkeje_har_id']);
    $GLOBALS['fkeje_pel_id'] = test_input($_POST['fkeje_pel_id']);
    $GLOBALS['fkeje_raz_id'] = test_input($_POST['fkeje_raz_id']);
    $GLOBALS['fkeje_mad_id'] = test_input($_POST['fkeje_mad_id']);
    $GLOBALS['fkeje_pad_id'] = test_input($_POST['fkeje_pad_id']);
    $GLOBALS['eje_fecha_nacimiento'] = test_input($_POST['eje_fecha_nacimiento']);
    $GLOBALS['eje_nombre'] = test_input($_POST['eje_nombre']);
    $GLOBALS['eje_precio'] = test_input($_POST['eje_precio']);
    $GLOBALS['eje_sexo'] = test_input($_POST['eje_sexo']);
    $GLOBALS['eje_tatuaje'] = test_input($_POST['eje_tatuaje']);
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (!empty($_POST['update_id'])) {
        $ejemplaresList = json_decode($db->getEjemplarById($_POST['update_id']));
        setValues($ejemplaresList);
    } elseif (!empty($_POST['pkeje_id'])) {
        setValuesWhenSubmitIsClicked();
        $answer = @json_decode($db->updateEjemplar($pkeje_id, $fkeje_har_id, $fkeje_pel_id, $fkeje_raz_id, $fkeje_mad_id, $fkeje_pad_id, $eje_fecha_nacimiento, $eje_nombre, $eje_precio, $eje_sexo, $eje_tatuaje));
        if ($answer->action != "error") {
            echo '<meta http-equiv="refresh" content="0;url=../ejemplares.php">';
            die;
        }
    }
} else {
    echo '<meta http-equiv="refresh" content="0;url=../ejemplares.php">';
    die;
}
?>

  <!-- Main content -->
Ejemplo n.º 5
0
{
    $GLOBALS['pkent_id'] = test_input($_POST['pkent_id']);
    $GLOBALS['fkent_lug_id'] = test_input($_POST['fkent_lug_id']);
    $GLOBALS['ent_ci'] = test_input($_POST['ent_ci']);
    $GLOBALS['ent_primer_nombre'] = test_input($_POST['ent_primer_nombre']);
    $GLOBALS['ent_segundo_nombre'] = test_input($_POST['ent_segundo_nombre']);
    $GLOBALS['ent_primer_apellido'] = test_input($_POST['ent_primer_apellido']);
    $GLOBALS['ent_segundo_apellido'] = test_input($_POST['ent_segundo_apellido']);
    $GLOBALS['ent_fecha_nacimiento'] = test_input($_POST['ent_fecha_nacimiento']);
    $GLOBALS['tel_codigo'] = test_input($_POST['tel_codigo']);
    $GLOBALS['tel_numero'] = test_input($_POST['tel_numero']);
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (!empty($_POST['update_id'])) {
        $entrenadoresList = json_decode($db->getEntrenadorById($_POST['update_id']));
        setValues($entrenadoresList);
    } elseif (!empty($_POST['pkent_id'])) {
        setValuesWhenSubmitIsClicked();
        $answer = @json_decode($db->updateEntrenador($pkent_id, $fkent_lug_id, $ent_ci, $ent_primer_nombre, $ent_segundo_nombre, $ent_primer_apellido, $ent_segundo_apellido, $ent_fecha_nacimiento));
        if ($answer->action != "error") {
            $answer = @json_decode($db->updateTelefono($pkent_id, $tel_codigo, $tel_numero));
            if ($answer->action != "error") {
                echo '<meta http-equiv="refresh" content="0;url=../entrenadores.php">';
                die;
            }
        }
    }
} else {
    echo '<meta http-equiv="refresh" content="0;url=../entrenadores.php">';
    die;
}
Ejemplo n.º 6
0
    $GLOBALS['fkjin_lug_id'] = test_input($_POST['fkjin_lug_id']);
    $GLOBALS['jin_ci'] = test_input($_POST['jin_ci']);
    $GLOBALS['jin_primer_nombre'] = test_input($_POST['jin_primer_nombre']);
    $GLOBALS['jin_segundo_nombre'] = test_input($_POST['jin_segundo_nombre']);
    $GLOBALS['jin_primer_apellido'] = test_input($_POST['jin_primer_apellido']);
    $GLOBALS['jin_segundo_apellido'] = test_input($_POST['jin_segundo_apellido']);
    $GLOBALS['jin_fecha_nacimiento'] = test_input($_POST['jin_fecha_nacimiento']);
    $GLOBALS['jin_altura'] = test_input($_POST['jin_altura']);
    $GLOBALS['jin_experiencia'] = test_input($_POST['jin_experiencia']);
    $GLOBALS['tel_codigo'] = test_input($_POST['tel_codigo']);
    $GLOBALS['tel_numero'] = test_input($_POST['tel_numero']);
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (!empty($_POST['update_id'])) {
        $jinetesList = json_decode($db->getJineteById($_POST['update_id']));
        setValues($jinetesList);
    } elseif (!empty($_POST['pkjin_id'])) {
        setValuesWhenSubmitIsClicked();
        $answer = @json_decode($db->updateJinete($pkjin_id, $fkjin_lug_id, $jin_ci, $jin_primer_nombre, $jin_segundo_nombre, $jin_primer_apellido, $jin_segundo_apellido, $jin_fecha_nacimiento, $jin_altura, $jin_experiencia));
        if ($answer->action != "error") {
            $answer = @json_decode($db->updateTelefono($pkjin_id, $tel_codigo, $tel_numero));
            if ($answer->action != "error") {
                echo '<meta http-equiv="refresh" content="0;url=../jinetes.php">';
                die;
            }
        }
    }
} else {
    echo '<meta http-equiv="refresh" content="0;url=../jinetes.php">';
    die;
}
Ejemplo n.º 7
0
    $GLOBALS['ins_favorito'] = $inscripcionesList[0]->ins_favorito;
}
function setValuesWhenSubmitIsClicked()
{
    $GLOBALS['pkins_id'] = test_input($_POST['pkins_id']);
    $GLOBALS['fkins_car_id'] = test_input($_POST['fkins_car_id']);
    $GLOBALS['fkins_cor_id'] = test_input($_POST['fkins_cor_id']);
    $GLOBALS['ins_valor'] = test_input($_POST['ins_valor']);
    $GLOBALS['ins_gualdrapa'] = test_input($_POST['ins_gualdrapa']);
    $GLOBALS['ins_puesto_partida'] = test_input($_POST['ins_puesto_partida']);
    $GLOBALS['ins_favorito'] = test_input($_POST['ins_favorito']);
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (!empty($_POST['update_id'])) {
        $inscripcionesList = json_decode($db->getInscripcionById($_POST['update_id']));
        setValues($inscripcionesList);
    } elseif (!empty($_POST['pkins_id'])) {
        setValuesWhenSubmitIsClicked();
        $answer = @json_decode($db->updateInscripcion($pkins_id, $fkins_car_id, $fkins_cor_id, $ins_valor, $ins_gualdrapa, $ins_puesto_partida, $ins_favorito));
        if ($answer->action != "error") {
            echo '<meta http-equiv="refresh" content="0;url=../inscripciones.php">';
            die;
        }
    }
} else {
    echo '<meta http-equiv="refresh" content="0;url=../inscripciones.php">';
    die;
}
?>

  <!-- Main content -->
Ejemplo n.º 8
0
    $GLOBALS['pkpro_id'] = test_input($_POST['pkpro_id']);
    $GLOBALS['fkpro_lug_id'] = test_input($_POST['fkpro_lug_id']);
    $GLOBALS['pro_ci'] = test_input($_POST['pro_ci']);
    $GLOBALS['pro_primer_nombre'] = test_input($_POST['pro_primer_nombre']);
    $GLOBALS['pro_segundo_nombre'] = test_input($_POST['pro_segundo_nombre']);
    $GLOBALS['pro_primer_apellido'] = test_input($_POST['pro_primer_apellido']);
    $GLOBALS['pro_segundo_apellido'] = test_input($_POST['pro_segundo_apellido']);
    $GLOBALS['pro_fecha_nacimiento'] = test_input($_POST['pro_fecha_nacimiento']);
    $GLOBALS['pro_correo'] = test_input($_POST['pro_correo']);
    $GLOBALS['tel_codigo'] = test_input($_POST['tel_codigo']);
    $GLOBALS['tel_numero'] = test_input($_POST['tel_numero']);
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (!empty($_POST['update_id'])) {
        $propietariosList = json_decode($db->getPropietarioById($_POST['update_id']));
        setValues($propietariosList);
    } elseif (!empty($_POST['pkpro_id'])) {
        setValuesWhenSubmitIsClicked();
        $answer = @json_decode($db->updatePropietario($pkpro_id, $fkpro_lug_id, $pro_ci, $pro_primer_nombre, $pro_segundo_nombre, $pro_primer_apellido, $pro_segundo_apellido, $pro_fecha_nacimiento, $pro_correo));
        if ($answer->action != "error") {
            $answer = @json_decode($db->updateTelefono($pkpro_id, $tel_codigo, $tel_numero));
            if ($answer->action != "error") {
                echo '<meta http-equiv="refresh" content="0;url=../propietarios.php">';
                die;
            }
        }
    }
} else {
    echo '<meta http-equiv="refresh" content="0;url=../propietarios.php">';
    die;
}
    return;
}
$db = acquireDatabase();
$loader = new User($db);
try {
    $res = $loader->loadId($_SESSION['uid']);
    if (sizeof($res) <= 0) {
        sendMessage(ERR, 'Couldn\'t find you user ID in the database. Please contact the administrator.');
        return;
    }
    $obj = $res[0];
    if ($obj->getState() == 'FILLDATA') {
        // We need to set at least the name
        if (!isset($_GET['name'])) {
            sendMessage(ERR, 'You need to set at least your name.');
            return;
        }
        $obj->setName($_GET['name']);
        $obj->setState('FINAL');
    }
    setValues($obj);
    if ($obj->save() !== FALSE) {
        $_SESSION['name'] = $obj->getName();
        sendMessage(OK, 'User ' . $obj->getName() . ' updated successfully.');
    } else {
        sendMessage(ERR, 'User ' . $obj->getName() . ' could not be updated due to an database error.');
    }
} catch (DbException $e) {
    sendMessage(ERR, $e->getMessage());
}
$db->close();
Ejemplo n.º 10
0
    $GLOBALS['usu_clave'] = $usuariosList[0]->usu_clave;
    $GLOBALS['usu_imagen'] = $usuariosList[0]->usu_imagen;
}
function setValuesWhenSubmitIsClicked()
{
    $GLOBALS['pkusu_id'] = test_input($_POST['pkusu_id']);
    $GLOBALS['fkusu_rol_id'] = test_input($_POST['fkusu_rol_id']);
    $GLOBALS['usu_nombre'] = test_input($_POST['usu_nombre']);
    $GLOBALS['usu_correo'] = test_input($_POST['usu_correo']);
    $GLOBALS['usu_clave'] = test_input($_POST['usu_clave']);
    $GLOBALS['usu_imagen'] = test_input($_POST['usu_imagen']);
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (!empty($_POST['update_id'])) {
        $usuariosList = json_decode($db->getUsuarioPorId($_POST['update_id']));
        setValues($usuariosList);
    } elseif (!empty($_POST['pkusu_id'])) {
        setValuesWhenSubmitIsClicked();
        var_dump($_POST['usu_clave']);
        $answer = @json_decode($db->updateUsuario($pkusu_id, $fkusu_rol_id, $usu_nombre, $usu_correo, $usu_clave, $usu_imagen));
        if ($answer->action != "error") {
            echo '<meta http-equiv="refresh" content="0;url=../usuarios.php">';
            die;
        }
    }
}
?>

  <!-- Main content -->
  <section class="content">
    <div class="row">