52 lines
1.6 KiB
PHP
52 lines
1.6 KiB
PHP
|
|
<?php
|
||
|
|
require_once __DIR__.'/auth_guard.php';
|
||
|
|
error_reporting(0);
|
||
|
|
require_once "../config.php";
|
||
|
|
|
||
|
|
$catsuperior = $_POST['catsuperior'];
|
||
|
|
$titulo= $_POST['titulo'];
|
||
|
|
$desc= $_POST['desc'];
|
||
|
|
$instrucciones= $_POST['inst'];
|
||
|
|
$orden= $_POST['orden'];
|
||
|
|
$tipointentos = $_POST['tipointentos'];
|
||
|
|
if ($tipointentos == 'Limitado') {
|
||
|
|
$intentos = $_POST['intentos'];
|
||
|
|
}else{
|
||
|
|
$intentos = 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
$tipotiempo = $_POST['tipotiempo'];
|
||
|
|
if ($tipotiempo == 'Limitado') {
|
||
|
|
$tiempo = $_POST['tiempo'];
|
||
|
|
}else{
|
||
|
|
$tiempo = 0;
|
||
|
|
}
|
||
|
|
$tipopreguntas = $_POST['tipopreguntas'];
|
||
|
|
$calificacion = $_POST['calificacion'];
|
||
|
|
$retro = $_POST['retro'];
|
||
|
|
$habilitado= $_POST['habilitado'];
|
||
|
|
if( $_POST['urlimgevaluacion'] == "" ){
|
||
|
|
$urlimgevaluacion = $CFG->wwwroot.'img/icons/211-gift.png';
|
||
|
|
}else{
|
||
|
|
$urlimgevaluacion =$_POST['urlimgevaluacion'];
|
||
|
|
}
|
||
|
|
|
||
|
|
global $link;
|
||
|
|
dbConnect();
|
||
|
|
$return = new stdClass();
|
||
|
|
|
||
|
|
$sql = "INSERT INTO evaluaciones (categoria, titulo, descripcion, instrucciones, orden, tipointentos, intentos,tipotiempo, tiempo, calificacion, tipopreguntas, retroalimentacion, habilitado, imagen) VALUES ($catsuperior, '$titulo', '$desc', '$instrucciones',$orden, '$tipointentos', $intentos, '$tipotiempo', $tiempo, $calificacion, '$tipopreguntas', '$retro', $habilitado, '$urlimgevaluacion')";
|
||
|
|
|
||
|
|
if($result = mysqli_multi_query($link, $sql)){
|
||
|
|
$idevaluacion = mysqli_insert_id($link);
|
||
|
|
$return->idevaluacion = $idevaluacion;
|
||
|
|
$return->code = "200";
|
||
|
|
$return->msg = 'Evaluación creada exitosamente';
|
||
|
|
}else{
|
||
|
|
$return->code = "400";
|
||
|
|
$return->msg = "Consulta fallo! SQL: ".$sql."<br><br> Error: ".mysqli_error($link);
|
||
|
|
}
|
||
|
|
|
||
|
|
echo json_encode($return, JSON_UNESCAPED_UNICODE);
|
||
|
|
exit;
|
||
|
|
?>
|