desarrollosconsejeria/adtos-server/1.7-0/adtos/evaluar.pas @ 23a384b9
54e95a47 | Elisa | {
|
|
23a384b9 | Elisa | Adtos 1.0 Software de gestión de Aulas Tecnológicas
|
|
54e95a47 | Elisa | Programación: Manuel Narváez Martínez <mnarvaez007@gmail.com>
|
|
Diseño gráfico: Ana María Zamora Moreno
|
|||
Desarrollado con Lazarus 0.9.26
|
|||
This program is free software; you can redistribute it and/or modify
|
|||
it under the terms of the GNU General Public License as published by
|
|||
the Free Software Foundation; either version 2 of the License, or
|
|||
(at your option) any later version.
|
|||
This program is distributed in the hope that it will be useful,
|
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||
GNU General Public License for more details.
|
|||
You should have received a copy of the GNU General Public License
|
|||
along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
}
|
|||
unit evaluar;
|
|||
{$mode objfpc}{$H+}
|
|||
interface
|
|||
uses
|
|||
23a384b9 | Elisa | Math,globales1,inicio,globales,textomensajes, IniFiles,Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
|
IdCmdTCPServer, ExtCtrls,IdCommandHandlers, TAGraph, ComCtrls, IdSync, Chart, HTTPDefs, IdCustomTCPServer;
|
|||
54e95a47 | Elisa | ||
type
|
|||
TCuestionSync = class(TIdSync)
|
|||
protected
|
|||
fip:string;
|
|||
frespuesta,ftiempo: integer;
|
|||
procedure DoSynchronize; override;
|
|||
public
|
|||
23a384b9 | Elisa | constructor Create(ip,respuesta,tiempo: string);
|
|
54e95a47 | Elisa | class procedure add(ip,respuesta,tiempo: string);
|
|
end;
|
|||
Tposiciones=record
|
|||
texto:string;
|
|||
valor:double;
|
|||
color:Tcolor;
|
|||
end;
|
|||
{ TfrmEvaluar }
|
|||
TfrmEvaluar = class(TForm)
|
|||
bchOpciones: TBarChart;
|
|||
btnCargar: TButton;
|
|||
btnCrear: TButton;
|
|||
btnEnviar: TButton;
|
|||
btnIndividual: TButton;
|
|||
btnNuevo: TButton;
|
|||
btnResultados: TButton;
|
|||
btnOpciones: TButton;
|
|||
btnSalir: TButton;
|
|||
cboNumOpc: TComboBox;
|
|||
cboSolucion: TComboBox;
|
|||
cboTiempo: TComboBox;
|
|||
23a384b9 | Elisa | IdCmdTCPServer2: TIdCmdTCPServer;
|
|
54e95a47 | Elisa | imgGrafico: TImage;
|
|
lbl: TLabel;
|
|||
lblBlanco: TLabel;
|
|||
lblMenTiempo: TLabel;
|
|||
lblNumCorrectas: TLabel;
|
|||
lblNumEncuestados: TLabel;
|
|||
lblNumEquipos: TLabel;
|
|||
lblNumFallos: TLabel;
|
|||
lblSolucion: TLabel;
|
|||
lblTiempo: TLabel;
|
|||
lblTiempo2: TLabel;
|
|||
lblTitNotaM: TLabel;
|
|||
lblTitNotaM1: TLabel;
|
|||
lblTitNotaM2: TLabel;
|
|||
lblTitNotaM4: TLabel;
|
|||
lblTitNotaM5: TLabel;
|
|||
mePregunta: TEdit;
|
|||
edNombreTest: TEdit;
|
|||
imgFondo: TImage;
|
|||
lblNompre: TLabel;
|
|||
OpenDialog1: TOpenDialog;
|
|||
OpenDialog2: TOpenDialog;
|
|||
pbTiempo: TProgressBar;
|
|||
pnEstadisticas1: TPanel;
|
|||
pnGrafico: TPanel;
|
|||
tmrMensaje: TTimer;
|
|||
tmrRecogida: TTimer;
|
|||
23a384b9 | Elisa | IdCmdTCPServer1: TIdCmdTCPServer;
|
|
54e95a47 | Elisa | procedure btnCargarClick(Sender: TObject);
|
|
procedure btnCrearClick(Sender: TObject);
|
|||
procedure btnEnviarClick(Sender: TObject);
|
|||
procedure btnNuevoClick(Sender: TObject);
|
|||
procedure btnResultadosClick(Sender: TObject);
|
|||
procedure btnOpcionesClick(Sender: TObject);
|
|||
procedure btnIndividualClick(Sender: TObject);
|
|||
procedure btnSalirClick(Sender: TObject);
|
|||
procedure cboNumOpcChange(Sender: TObject);
|
|||
procedure cboNumOpcKeyPress(Sender: TObject; var Key: char);
|
|||
procedure cboSolucionKeyPress(Sender: TObject; var Key: char);
|
|||
procedure cboTiempoKeyPress(Sender: TObject; var Key: char);
|
|||
procedure edNombreTestKeyPress(Sender: TObject; var Key: char);
|
|||
procedure FormActivate(Sender: TObject);
|
|||
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
|||
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
|||
procedure FormCreate(Sender: TObject);
|
|||
procedure FormDestroy(Sender: TObject);
|
|||
23a384b9 | Elisa | procedure IdCmdTCPServer1ListenException(AThread: TIdListenerThread;
|
|
AException: Exception);
|
|||
54e95a47 | Elisa | procedure respuestaCuestionCommand(ASender: TIdCommand);
|
|
procedure tmrMensajeTimer(Sender: TObject);
|
|||
procedure tmrRecogidaTimer(Sender: TObject);
|
|||
private
|
|||
procedure ActDesBotonesEst(valor: boolean);
|
|||
procedure ActivarControles;
|
|||
procedure comprobarClasificacion(nequ: integer);
|
|||
procedure CrearArchivoPreguntaTest();
|
|||
procedure CrearCuadrosTexto;
|
|||
procedure DesactivarControles;
|
|||
procedure DrawPieSlice(myB: TBitmap; const bcolor, pcolor:Tcolor; CONST Center: TPoint; CONST Radius: INTEGER; CONST StartDegrees, StopDegrees: Double);
|
|||
procedure EncuestaMarcarCorrecta(sol: integer);
|
|||
procedure EnviarConsulta(nombre:string);
|
|||
procedure EstadisticaPintarFondo(img: TBitmap; Titulo: String);
|
|||
function InicializarConsulta(archivoexamen: string): boolean;
|
|||
23a384b9 | Elisa | ||
54e95a47 | Elisa | procedure MostrarEstadisticasCuestion();
|
|
procedure IndividualMostrarEstadisticas();
|
|||
procedure IndividualPintarCabecera(ima: TBitmap);
|
|||
procedure IndividualPintarFondo(ima: TBitmap);
|
|||
procedure IndividualPintarResultados(ima: TBitmap);
|
|||
procedure IniciarTCPCMD();
|
|||
procedure LeerArchivoPreguntaTest(miarchivo: string);
|
|||
procedure LimpiarExamen();
|
|||
procedure MostrarMemos(num: integer);
|
|||
procedure OpcionesPintarLeyendas(ima: TBitmap);
|
|||
procedure OpcionesMostrarEstadisticas1(opciones: array of integer);
|
|||
procedure ResultadosEstadisticas(aci, fal, bla: integer);
|
|||
23a384b9 | Elisa | procedure ResultadosPintarLeyendas(ima: TBitmap; leyenda: array of string; colores: array of Tcolor);
|
|
54e95a47 | Elisa | procedure ResultadosPregunta();
|
|
function ValidarCuestionTest(): Boolean;
|
|||
{ private declarations }
|
|||
public
|
|||
procedure anadirRespuesta(ip: string; respuesta, tiempor: integer);
|
|||
{ public declarations }
|
|||
end;
|
|||
var
|
|||
frmEvaluar: TfrmEvaluar;
|
|||
meOpciones:Array [0..5] of TEdit;
|
|||
lblOpciones:Array [0..5] of TLabel;
|
|||
shaExtOpc:Array [0..6] of TShape;
|
|||
lblEstOpc:Array [0..6] of TLabel;
|
|||
g_cuestion:Tcuestion;
|
|||
implementation
|
|||
{ TfrmEvaluar }
|
|||
var
|
|||
f_cuestion_contador:integer=30;
|
|||
f_respuestas_recibidas:array of integer;
|
|||
f_contador_mensaje:integer;
|
|||
23a384b9 | Elisa | f_cuestion_Aulas_examinados:integer=0;
|
|
54e95a47 | Elisa | { TCuestionSync }
|
|
constructor TCuestionSync.Create(ip,respuesta,tiempo: string);
|
|||
begin
|
|||
inherited Create;
|
|||
fip:= ip;
|
|||
try
|
|||
frespuesta:=strtoint(respuesta);
|
|||
except
|
|||
frespuesta:=0;
|
|||
end;
|
|||
try
|
|||
ftiempo:=strtoint(tiempo);
|
|||
except
|
|||
ftiempo:=60
|
|||
end
|
|||
end;
|
|||
procedure TCuestionSync.DoSynchronize;
|
|||
begin
|
|||
frmEvaluar.anadirRespuesta(fip,frespuesta,ftiempo);
|
|||
end;
|
|||
class procedure TCuestionSync.add(ip,respuesta,tiempo: string);
|
|||
begin
|
|||
with Create(ip,respuesta,tiempo) do
|
|||
try
|
|||
Synchronize;
|
|||
finally
|
|||
Free;
|
|||
end;
|
|||
end;
|
|||
procedure TfrmEvaluar.anadirRespuesta(ip:string;respuesta,tiempor:integer);
|
|||
var
|
|||
i:integer;
|
|||
begin
|
|||
23a384b9 | Elisa | // ////writeln('mi ip: '+ ip + ' mi respuesta ' +inttostr(respuesta) + ' mitiempo: ' + inttostr(tiempor));
|
|
54e95a47 | Elisa | f_respuestas_recibidas[respuesta]:=f_respuestas_recibidas[respuesta]+1;
|
|
23a384b9 | Elisa | for i:=0 to high(equipoServidorAula) do
|
|
54e95a47 | Elisa | begin
|
|
23a384b9 | Elisa | if (equipoServidorAula[i].IP=ip) then
|
|
54e95a47 | Elisa | begin
|
|
23a384b9 | Elisa | if equipoServidorAula[i].CuestionHace then
|
|
if not equipoServidorAula[i].CuestionTerminada then
|
|||
equipoServidorAula[i].cargarEvaluacionCuestion(g_cuestion.solucion,respuesta,tiempor);
|
|||
54e95a47 | Elisa | break;
|
|
end;
|
|||
end;
|
|||
end;
|
|||
procedure TfrmEvaluar.respuestaCuestionCommand(ASender: TIdCommand);
|
|||
var
|
|||
ip,tiempo,respuestas:string;
|
|||
begin
|
|||
try
|
|||
if ASender.Params.Count=5 then
|
|||
begin
|
|||
ip:=HTTPDecode(Asender.Params[0]);
|
|||
respuestas:=HTTPDecode(Asender.Params[2]);
|
|||
tiempo:=HTTPDecode(Asender.Params[3]);
|
|||
TCuestionSync.add(ip,respuestas,tiempo)
|
|||
end
|
|||
except
|
|||
23a384b9 | Elisa | ////writeln(MEN_ORDEN_NUM_INCORRECTOS);
|
|
54e95a47 | Elisa | end;
|
|
end;
|
|||
Function TfrmEvaluar.InicializarConsulta(archivoexamen:string):boolean;
|
|||
var
|
|||
i: integer;
|
|||
begin
|
|||
result:=true;
|
|||
if not FileExists(archivoexamen) then
|
|||
begin
|
|||
mensaje(MEN_NO_ENVIAR_CUESTION,aceptar);
|
|||
result:=false;
|
|||
exit;
|
|||
end;
|
|||
23a384b9 | Elisa | for i:=0 to high( g_cuestion.mejoresAulas) do
|
|
54e95a47 | Elisa | begin
|
|
23a384b9 | Elisa | g_cuestion.mejoresAulas[i]:='';
|
|
54e95a47 | Elisa | g_cuestion.mejoresequipos[i]:='';
|
|
g_cuestion.mejorestiempos[i]:=999;
|
|||
g_cuestion.mejoresrespuestas[i]:=-1
|
|||
end;
|
|||
23a384b9 | Elisa | f_cuestion_Aulas_examinados:=0;
|
|
54e95a47 | Elisa | f_cuestion_contador:=g_cuestion.tiempo+5;
|
|
f_contador_mensaje:=g_cuestion.tiempo;
|
|||
setlength(f_respuestas_recibidas, g_cuestion.numOpciones+1);
|
|||
for i:=0 to high(f_respuestas_recibidas) do
|
|||
f_respuestas_recibidas[i]:=0;
|
|||
DesactivarControles();
|
|||
btnSalir.enabled:=true;
|
|||
try
|
|||
if IdCmdTCPServer1.Active=false then
|
|||
23a384b9 | Elisa | IniciarTCPCMD();
|
|
54e95a47 | Elisa | except
|
|
result:=false;
|
|||
ActivarControles();
|
|||
Mensaje(MEN_ERROR_INICIAR_SERVIDOR,Aceptar);
|
|||
end;
|
|||
end;
|
|||
procedure TfrmEvaluar.EnviarConsulta(nombre:string);
|
|||
var
|
|||
i:integer;
|
|||
begin
|
|||
23a384b9 | Elisa | equipoAdministrador.ArcCuestion:= equipoAdministrador.DirCuestiones+PathDelim+nombre+'.txt';
|
|
if not InicializarConsulta(equipoAdministrador.ArcCuestion) then exit;
|
|||
for i:=0 to high(equipoServidorAula) do
|
|||
54e95a47 | Elisa | begin
|
|
23a384b9 | Elisa | equipoServidorAula[i].CuestionHace:=false;
|
|
equipoServidorAula[i].CuestionTerminada:=false;
|
|||
equipoServidorAula[i].CuestionRespuesta:=0;
|
|||
equipoServidorAula[i].CuestionTiempo:=g_cuestion.tiempo;
|
|||
if equipoServidorAula[i].usuarioActivo<>'' then
|
|||
54e95a47 | Elisa | begin
|
|
23a384b9 | Elisa | equipoServidorAula[i].CuestionHace:=true;
|
|
inc(f_cuestion_Aulas_examinados);
|
|||
equipoServidorAula[i].iniciarCuestion();
|
|||
//////writeln('Comienzo a enviar encuesta ', equipoServidorAula[i].usuarioActivo);
|
|||
54e95a47 | Elisa | Sleep(SLEEP_ALTO * g_factor_velocidad+100);
|
|
Application.ProcessMessages;
|
|||
end;
|
|||
end;
|
|||
tmrRecogida.enabled:=true;
|
|||
tmrMensaje.Enabled:=true;
|
|||
lblMenTiempo.visible:=true;
|
|||
end;
|
|||
23a384b9 | Elisa | ||
54e95a47 | Elisa | procedure TfrmEvaluar.IniciarTCPCMD();
|
|
23a384b9 | Elisa | var
|
|
aCommand:TIdCommandHandler;
|
|||
begin
|
|||
54e95a47 | Elisa | with IdCmdTCPServer1 do
|
|
begin
|
|||
Bindings.Clear;
|
|||
Bindings.Add;
|
|||
Bindings.items[0].IP:='0.0.0.0';
|
|||
23a384b9 | Elisa | Bindings.Items[0].Port:=PUERTO_CONSULTA;
|
|
DefaultPort:=PUERTO_CONSULTA;
|
|||
MaxConnections:=0;
|
|||
ListenQueue:=15;
|
|||
TerminateWaitTime:=5000;
|
|||
54e95a47 | Elisa | ||
aCommand:=CommandHandlers.Add;
|
|||
aCommand.Command := 'respuestaCuestion';
|
|||
23a384b9 | Elisa | aCommand.OnCommand :=@respuestaCuestionCommand;
|
|
54e95a47 | Elisa | aCommand.Disconnect:=true;
|
|
aCommand.CmdDelimiter:=#32;
|
|||
aCommand.ParamDelimiter:=#32;
|
|||
aCommand.NormalReply.Code:='260';
|
|||
aCommand.Enabled:=true;
|
|||
23a384b9 | Elisa | OnListenException:=@IdCmdTCPServer1ListenException;
|
|
54e95a47 | Elisa | active:=true;
|
|
end;
|
|||
23a384b9 | Elisa | ||
54e95a47 | Elisa | end;
|
|
procedure TfrmEvaluar.LimpiarExamen();
|
|||
var
|
|||
i:integer;
|
|||
begin
|
|||
edNombreTest.Text:='';
|
|||
edNombreTest.Enabled:=true;
|
|||
mePregunta.text:='';
|
|||
mePregunta.Enabled:=true;
|
|||
for i:=0 to 5 do
|
|||
begin
|
|||
meOpciones[i].text:='';
|
|||
meOpciones[i].Enabled:=true;
|
|||
23a384b9 | Elisa | lblOpciones[i].Font.Color:=clblack;
|
|
54e95a47 | Elisa | g_cuestion.opciones[i]:=''
|
|
end;
|
|||
cboSolucion.ItemIndex:=-1;
|
|||
cboSolucion.Enabled:=true;
|
|||
cboNumOpc.Enabled:=true;
|
|||
cboTiempo.Enabled:=true;
|
|||
g_cuestion.numOpciones:=strtoint(cboNumOpc.text);
|
|||
g_cuestion.tiempo:=strtoint(cboTiempo.text);
|
|||
g_cuestion.pregunta:='';
|
|||
g_cuestion.solucion:=1;
|
|||
pngrafico.Visible:=false;
|
|||
pbTiempo.visible:=false;
|
|||
lblTiempo2.Visible:=false;
|
|||
btnOpciones.enabled:=false;
|
|||
btnIndividual.enabled:=false;
|
|||
btnNuevo.Enabled:=false;
|
|||
btnResultados.Enabled:=false;
|
|||
btnEnviar.Enabled:=true;
|
|||
btnCargar.Enabled:=true;
|
|||
btnCrear.Enabled:=true;
|
|||
end;
|
|||
procedure TfrmEvaluar.EncuestaMarcarCorrecta(sol:integer);
|
|||
23a384b9 | Elisa | var
|
|
i:integer;
|
|||
54e95a47 | Elisa | begin
|
|
23a384b9 | Elisa | for i:=0 to high(lblOpciones) do
|
|
lblOpciones[i].font.color:=clblack;
|
|||
lblOpciones[sol-1].font.color:=clgreen;
|
|||
54e95a47 | Elisa | end;
|
|
procedure TfrmEvaluar.ResultadosPregunta();
|
|||
var
|
|||
i:integer;
|
|||
begin
|
|||
g_cuestion.numaciertos:=0;
|
|||
g_cuestion.numfallos:=0;
|
|||
g_cuestion.numblancos:=0;
|
|||
23a384b9 | Elisa | for i:=0 to High(g_cuestion.mejoresAulas) do
|
|
54e95a47 | Elisa | g_cuestion.mejorestiempos[i]:=g_cuestion.tiempo+1;
|
|
23a384b9 | Elisa | for i:=0 to high(equipoServidorAula) do
|
|
54e95a47 | Elisa | begin
|
|
23a384b9 | Elisa | if equipoServidorAula[i].CuestionHace then
|
|
54e95a47 | Elisa | begin;
|
|
23a384b9 | Elisa | if equipoServidorAula[i].CuestionResultado= 0 then
|
|
54e95a47 | Elisa | begin
|
|
inc(g_cuestion.numblancos)
|
|||
end
|
|||
23a384b9 | Elisa | else if equipoServidorAula[i].CuestionResultado =1 then
|
|
54e95a47 | Elisa | begin
|
|
inc(g_cuestion.numaciertos);
|
|||
end
|
|||
else
|
|||
begin
|
|||
inc(g_cuestion.numfallos);
|
|||
end;
|
|||
//comprobarClasificacion(i);
|
|||
end;
|
|||
end;
|
|||
end;
|
|||
procedure TfrmEvaluar.MostrarEstadisticasCuestion();
|
|||
begin
|
|||
lblMenTiempo.Visible:=False;
|
|||
lblTiempo2.visible:=false;
|
|||
ResultadosPregunta();
|
|||
23a384b9 | Elisa | lblNumEquipos.Caption:=inttostr(g_num_servidores_aula);
|
|
lblNumEncuestados.caption:=IntToStr(f_cuestion_Aulas_examinados);
|
|||
54e95a47 | Elisa | lblTiempo.Caption:=cboTiempo.text + ' s';
|
|
lblNumCorrectas.Caption:=IntToStr(g_cuestion.numAciertos);
|
|||
lblNumFallos.Caption:=IntToStr(g_cuestion.numfallos);
|
|||
lblBlanco.Caption:=IntToStr(g_cuestion.numBlancos);
|
|||
btnIndividual.Enabled:=true;
|
|||
btnOpciones.Enabled:=true;
|
|||
btnResultados.Enabled:=true;
|
|||
EncuestaMarcarCorrecta(g_cuestion.solucion);
|
|||
ActDesBotonesEst(true);
|
|||
btnOpcionesClick(btnOpciones);
|
|||
btnNuevo.Enabled:=true;
|
|||
pnGrafico.visible:=true;
|
|||
pnEstadisticas1.BringToFront;
|
|||
pnEstadisticas1.visible:=true;
|
|||
end;
|
|||
Procedure TfrmEvaluar.IndividualPintarResultados(ima:TBitmap);
|
|||
const
|
|||
alto:integer=12;
|
|||
posiciones:integer=45;
|
|||
separacion:integer=145;
|
|||
var
|
|||
sep,j,i,k:integer;
|
|||
notas:array of array of string;
|
|||
begin
|
|||
23a384b9 | Elisa | SetLength(notas,g_num_servidores_aula);
|
|
for i:=0 to g_num_servidores_aula-1 do
|
|||
54e95a47 | Elisa | begin
|
|
SetLength(notas[i],4);
|
|||
23a384b9 | Elisa | if equipoServidorAula[i].CuestionHace then
|
|
54e95a47 | Elisa | begin
|
|
23a384b9 | Elisa | notas[i][0]:=equipoServidorAula[i].UsuarioActivo;
|
|
notas[i][1]:=equipoServidorAula[i].mihost;
|
|||
notas[i][2]:=inttostr(equipoServidorAula[i].CuestionRespuesta);
|
|||
if equipoServidorAula[i].CuestionRespuesta = 0 then notas[i][2]:='NC';
|
|||
notas[i][3]:=inttostr(equipoServidorAula[i].CuestionTiempo) +' s';
|
|||
54e95a47 | Elisa | end
|
|
else
|
|||
notas[i][0]:='';
|
|||
end;
|
|||
with ima.Canvas do
|
|||
begin
|
|||
Font.Name:='Sans';
|
|||
Font.Size:=8;
|
|||
Font.color:=AZUL_COLOR;
|
|||
sep:=separacion;
|
|||
k:=0;
|
|||
for i:=0 to high(notas) do
|
|||
begin
|
|||
if (notas[i][0]='') then continue;
|
|||
for j:=0 to 3 do
|
|||
begin
|
|||
if notas[i][2]='NC' then
|
|||
Font.color:=clGray
|
|||
else if strtoint(notas[i][2])=g_cuestion.solucion then
|
|||
Font.color:=clgreen
|
|||
else
|
|||
Font.color:=clred;
|
|||
if j=2 then
|
|||
sep:= separacion+15
|
|||
else if j=3 then
|
|||
sep:=separacion+10
|
|||
else
|
|||
sep:=separacion;
|
|||
if notas[i][2]= '0' then notas[i][2]:='NC';
|
|||
TextOut(posiciones+sep*j,24+(alto*k),notas[i][j]);
|
|||
end;
|
|||
inc(k);
|
|||
end;
|
|||
end;
|
|||
end;
|
|||
Procedure TfrmEvaluar.IndividualPintarCabecera(ima:TBitmap);
|
|||
const
|
|||
alto:integer=8;
|
|||
posiciones:integer=45;
|
|||
separacion:integer=145;
|
|||
23a384b9 | Elisa | titulos: array [0..3] of String=('Aula','Equipo','Opción','Tiempo');
|
|
54e95a47 | Elisa | var
|
|
i:integer;
|
|||
begin
|
|||
with ima.Canvas do
|
|||
begin
|
|||
Font.Name:='Sanz';
|
|||
Font.Size:=9;
|
|||
Font.Color:=MORADO_COLOR;
|
|||
for i:=0 to high(titulos) do
|
|||
begin
|
|||
brush.color:=clBlack;
|
|||
TextOut(posiciones+separacion*i,alto,titulos[i]);
|
|||
end;
|
|||
end;
|
|||
end;
|
|||
procedure TfrmEvaluar.IndividualPintarFondo(ima: TBitmap);
|
|||
const
|
|||
colorf:array[0..1] of TColor=(clWhite,$E5E5E5);
|
|||
alto:integer=12;
|
|||
var
|
|||
c,i:integer;
|
|||
begin
|
|||
with ima.Canvas do
|
|||
begin
|
|||
for i:=0 to 36 do
|
|||
begin
|
|||
c:=i mod 2;
|
|||
brush.color:=colorf[c];
|
|||
pen.color:=colorf[c];
|
|||
Rectangle(10,12+(alto*i),ima.width-14,12+alto*(i+1))
|
|||
end;
|
|||
end;
|
|||
end;
|
|||
procedure TfrmEvaluar.IndividualMostrarEstadisticas();
|
|||
var
|
|||
mbitmap:TBitmap;
|
|||
begin
|
|||
bchOpciones.visible:=false;
|
|||
mbitmap:=TBitmap.create;
|
|||
try
|
|||
mbitmap.Width:=imgGrafico.Width;
|
|||
mbitmap.Height:=imgGrafico.Height;
|
|||
23a384b9 | Elisa | EstadisticaPintarFondo(mbitmap,'');
|
|
54e95a47 | Elisa | IndividualPintarFondo(mbitmap);
|
|
IndividualPintarCabecera(mbitmap);
|
|||
IndividualPintarResultados(mbitmap);
|
|||
imgGrafico.Picture.Bitmap.Assign(mbitmap);
|
|||
finally
|
|||
mbitmap.free;
|
|||
end;
|
|||
end;
|
|||
procedure TfrmEvaluar.OpcionesPintarLeyendas(ima: TBitmap);
|
|||
const
|
|||
textos:array [0..1] of string=('Correcta','Incorrectas');
|
|||
var
|
|||
i:integer;
|
|||
colores:array [0..1] of TColor;
|
|||
begin
|
|||
colores[0]:=VERDE_COLOR;
|
|||
colores[1]:=ROJO_COLOR;
|
|||
with ima.Canvas do
|
|||
begin
|
|||
font.Name:='Sans';
|
|||
font.size:=9;
|
|||
for i:=0 to 1 do
|
|||
begin
|
|||
brush.color:=colores[i];
|
|||
pen.color:=colores[i];
|
|||
Rectangle(480,35+i*17,495,50+i*17);
|
|||
brush.color:=clBlack;
|
|||
Font.Color:=clBlack;
|
|||
TextOut(497,35+i*17,textos[i]);
|
|||
end;
|
|||
end;
|
|||
end;
|
|||
procedure TfrmEvaluar.OpcionesMostrarEstadisticas1( opciones:array of integer);
|
|||
var
|
|||
mcolor:TColor;
|
|||
nombre:string;
|
|||
i:integer;
|
|||
mbitmap:TBitmap;
|
|||
begin
|
|||
mbitmap:=TBitmap.create;
|
|||
try
|
|||
mbitmap.Width:=imgGrafico.Width;
|
|||
mbitmap.Height:=imgGrafico.Height;
|
|||
EstadisticaPintarFondo(mbitmap,'');
|
|||
OpcionesPintarLeyendas(mbitmap);
|
|||
imgGrafico.Picture.Bitmap.Assign(mbitmap);
|
|||
finally
|
|||
mbitmap.free;
|
|||
end;
|
|||
imgGrafico.visible:=true;
|
|||
bchOpciones.clear;
|
|||
for i:=0 to high(opciones) do
|
|||
begin
|
|||
if i<>g_cuestion.solucion then
|
|||
begin
|
|||
mcolor:=ROJO_COLOR;
|
|||
end
|
|||
else
|
|||
begin
|
|||
mcolor:=VERDE_COLOR;
|
|||
end;
|
|||
if i=0 then nombre:=' NS/NC' else nombre:='Opción ' + inttostr(i);
|
|||
bchOpciones.AddBar(nombre,opciones[i],mcolor);
|
|||
end;
|
|||
bchOpciones.visible:=true;
|
|||
end;
|
|||
Procedure TfrmEvaluar.EstadisticaPintarFondo(img:TBitmap;Titulo:String);
|
|||
begin
|
|||
with img.Canvas do
|
|||
begin
|
|||
pen.color:=clwhite;
|
|||
brush.color:=clwhite;
|
|||
Rectangle(0,0,img.width,img.Height);
|
|||
pen.color:=$E5E5E5;
|
|||
brush.color:=$E5E5E5;
|
|||
Rectangle(5,0,img.width,img.Height-5);
|
|||
pen.color:=clsilver;
|
|||
brush.color:=clwhite;
|
|||
Rectangle(0,3,img.width-3,img.Height);
|
|||
Font.Color:=clBlack;
|
|||
Font.Name:='Sans';
|
|||
Font.Size:=8;
|
|||
TextOut(150,5,Titulo);
|
|||
end;
|
|||
end;
|
|||
23a384b9 | Elisa | procedure TfrmEvaluar.ResultadosPintarLeyendas(ima: TBitmap;leyenda:array of string; colores:array of Tcolor);
|
|
54e95a47 | Elisa | var
|
|
i:integer;
|
|||
begin
|
|||
with ima.Canvas do
|
|||
begin
|
|||
font.Name:='Sans';
|
|||
font.size:=9;
|
|||
for i:=0 to high(leyenda) do
|
|||
begin
|
|||
brush.color:=colores[i];
|
|||
pen.color:=colores[i];
|
|||
Rectangle(370,35+i*17,385,50+i*17);
|
|||
brush.color:=clBlack;
|
|||
Font.Color:=clBlack;
|
|||
TextOut(387,35+i*17,leyenda[i]);
|
|||
end;
|
|||
end;
|
|||
end;
|
|||
procedure TfrmEvaluar.ResultadosEstadisticas(aci,fal,bla:integer);
|
|||
const
|
|||
miscolores:array[0..2] of Tcolor=($66FFCC,$7B61FF,$E5E5E5);
|
|||
textos:array [0..2] of string =('Aciertos: ', 'Fallos: ', 'NC: ');
|
|||
var
|
|||
mbitmap:TBitmap;
|
|||
i,total,unototal:integer;
|
|||
cent:TPoint;
|
|||
x0,x1:double;
|
|||
xs:array[0..3] of double;
|
|||
numopc:array[0..2] of integer;
|
|||
numopcp:array[0..2] of double;
|
|||
numopcd:array [0..2]of double;
|
|||
textoetiquetas:array [0..2] of string;
|
|||
colores:array [0..2] of Tcolor;
|
|||
pora:string;
|
|||
begin
|
|||
numopc[0]:=aci;
|
|||
numopc[1]:=fal;
|
|||
numopc[2]:=bla;
|
|||
unototal:=-1;
|
|||
bchOpciones.visible:=false;
|
|||
mbitmap:=TBitmap.Create;
|
|||
try
|
|||
mbitmap.Width:=imgGrafico.Width;
|
|||
mbitmap.Height:=imgGrafico.Height;
|
|||
cent.x:=200; cent.y:=170;
|
|||
total:=0;
|
|||
for i:=0 to high(numopc)do
|
|||
total:=total+numopc[i];
|
|||
if total=0 then exit;
|
|||
x0:=0;x1:=0; xs[0]:=0;
|
|||
EstadisticaPintarFondo(mbitmap,'');
|
|||
for i:=0 to high(numopc) do
|
|||
begin
|
|||
numopcd[i]:=numopc[i]*360/total;
|
|||
numopcp[i]:=numopc[i]*100/total;
|
|||
x0:=x1;
|
|||
x1:=x0+numopcd[i];
|
|||
xs[i+1]:=x1;
|
|||
pora:=FloatToStrF(numopcp[i],ffFixed,8,2);
|
|||
textoetiquetas[i]:= textos[i]+ inttostr(numopc[i])+' -> '+pora +' %';
|
|||
colores[i]:=miscolores[i];
|
|||
if numopc[i]=total then unototal:=i;
|
|||
end;
|
|||
ResultadosPintarLeyendas(mbitmap,textoetiquetas,colores);
|
|||
imgGrafico.Picture.Assign(mbitmap);
|
|||
if unototal<>-1 then
|
|||
begin
|
|||
imgGrafico.Picture.Bitmap.Canvas.Brush.color:=colores[unototal];
|
|||
imgGrafico.Picture.Bitmap.Canvas.EllipseC(cent.x,cent.y,130,130)
|
|||
end
|
|||
else
|
|||
begin
|
|||
for i:=0 to high(numopc) do
|
|||
DrawPieSlice(imgGrafico.Picture.Bitmap,colores[i],clsilver,cent,130,xs[i],xs[i+1]);
|
|||
end;
|
|||
finally
|
|||
mbitmap.free;
|
|||
end;
|
|||
end;
|
|||
procedure TfrmEvaluar.DesactivarControles;
|
|||
var i:integer;
|
|||
begin
|
|||
for i:=0 to controlcount-1 do
|
|||
if ((Controls[i] is Tbutton) or (controls[i] is TEdit) or (Controls[i] is TComboBox)) then
|
|||
Controls[i].enabled:=false;
|
|||
end;
|
|||
procedure TfrmEvaluar.ActivarControles;
|
|||
var i:integer;
|
|||
begin
|
|||
for i:=0 to controlcount-1 do
|
|||
Controls[i].enabled:=true;
|
|||
end;
|
|||
procedure TfrmEvaluar.ActDesBotonesEst(valor:boolean);
|
|||
begin
|
|||
btnIndividual.enabled:=valor;
|
|||
btnResultados.enabled:=valor;
|
|||
btnOpciones.enabled:=valor;
|
|||
end;
|
|||
function TfrmEvaluar.ValidarCuestionTest():Boolean;
|
|||
var
|
|||
i:integer;
|
|||
mens:string;
|
|||
begin
|
|||
mens:='';
|
|||
if Trim(edNombreTest.text)='' then
|
|||
begin
|
|||
mens:=MEN_NOMBRE_CUESTION;
|
|||
end
|
|||
else if length(Trim(mepregunta.text))<1 then
|
|||
begin
|
|||
mens:=MEN_PREGUNTA_CUESTION;
|
|||
end
|
|||
else if cboSolucion.ItemIndex=-1 then
|
|||
begin
|
|||
mens:=MEN_SOLUCION_CUESTION;
|
|||
end
|
|||
else
|
|||
begin
|
|||
for i:=0 to g_cuestion.numOpciones -1 do
|
|||
begin
|
|||
if length(Trim(meOpciones[i].text))<1 then
|
|||
begin
|
|||
mens:=MEN_OPCIONES_CUESTION;
|
|||
end
|
|||
end;
|
|||
end;
|
|||
result:=mens='';
|
|||
if not result then
|
|||
begin
|
|||
Mensaje(mens,aceptar);
|
|||
end;
|
|||
end;
|
|||
procedure TfrmEvaluar.MostrarMemos(num:integer);
|
|||
var
|
|||
numero,i,j:integer;
|
|||
begin
|
|||
cbosolucion.clear;
|
|||
numero:=num;
|
|||
for i:=0 to high(meOpciones) do
|
|||
begin
|
|||
meOpciones[i].visible:=false;
|
|||
lblOpciones[i].visible:=false;
|
|||
end;
|
|||
application.processmessages;
|
|||
for j:=0 to numero -1 do
|
|||
begin
|
|||
cbosolucion.items.add(inttostr(j+1));
|
|||
meOpciones[j].visible:=true;
|
|||
lblOpciones[j].visible:=true;
|
|||
end;
|
|||
application.processmessages;
|
|||
lblsolucion.top:=meopciones[numero-1].top +meOpciones[numero-1].height+10;
|
|||
cbosolucion.top:=lblsolucion.top;
|
|||
end;
|
|||
procedure TfrmEvaluar.DrawPieSlice(myB: TBitmap; const bcolor, pcolor:Tcolor; CONST Center: TPoint; CONST Radius: INTEGER; CONST StartDegrees, StopDegrees: Double);
|
|||
const
|
|||
Offset = 0;
|
|||
var
|
|||
X1,X2,X3,X4: INTEGER;
|
|||
Y1,Y2,Y3,Y4: INTEGER;
|
|||
begin
|
|||
X1 := Center.X - Radius;
|
|||
Y1 := Center.Y - Radius;
|
|||
X2 := Center.X + Radius;
|
|||
Y2 := Center.Y + Radius;
|
|||
X3 := Center.X + Round( Radius*COS( DegToRad(Offset+StartDegrees) ) );
|
|||
Y3 := Center.y - Round( Radius*SIN( DegToRad(Offset+StartDegrees) ) );
|
|||
X4 := Center.X + Round( Radius*COS( DegToRad(Offset+StopDegrees) ) );
|
|||
Y4 := Center.y - Round( Radius*SIN( DegToRad(Offset+StopDegrees) ) );
|
|||
with myb.Canvas do
|
|||
begin
|
|||
pen.width:=1;
|
|||
Brush.color:=bcolor;
|
|||
pen.Color:=pcolor;
|
|||
Pie(X1,Y1, X2,Y2, X3,Y3, X4,Y4);
|
|||
end;
|
|||
end;
|
|||
procedure TfrmEvaluar.LeerArchivoPreguntaTest(miarchivo:string);
|
|||
var
|
|||
Mifichero:TMemIniFile;
|
|||
i:integer;
|
|||
begin
|
|||
try
|
|||
Mifichero := TMemIniFile.Create(miarchivo);
|
|||
try
|
|||
with Mifichero do
|
|||
begin
|
|||
g_cuestion.codigo:=ReadString ('TIPO','Codigo','');
|
|||
g_cuestion.tipo:=ReadInteger('TIPO','Tipo',0);
|
|||
g_cuestion.numOpciones:= ReadInteger('TIPO','Numero_Opciones',4);
|
|||
cboNumOpc.text:=inttostr(g_cuestion.numOpciones);
|
|||
g_cuestion.tiempo:=ReadInteger('TIPO','Tiempo',30);
|
|||
g_cuestion.solucion:=ReadInteger('TIPO','Solucion',1);
|
|||
cboTiempo.text:=inttostr(g_cuestion.tiempo);
|
|||
g_cuestion.pregunta:=HTTPDecode(ReadString('CUESTION','Pregunta',''));
|
|||
mePregunta.text:=g_cuestion.pregunta;
|
|||
cboSolucion.clear;
|
|||
for i:=0 to high(meopciones) do
|
|||
begin
|
|||
meOpciones[i].visible:=false;
|
|||
lblOpciones[i].visible:=false;
|
|||
end;
|
|||
for i:=0 to g_cuestion.numOpciones-1 do
|
|||
begin
|
|||
g_cuestion.opciones[i]:=HTTPDecode(ReadString('CUESTION','Opcion_'+inttostr(i+1),''));
|
|||
meOpciones[i].text:=g_cuestion.opciones[i];
|
|||
lblOpciones[i].visible:=true;
|
|||
meOpciones[i].visible:=true;
|
|||
cboSolucion.Items.Add(inttostr(i+1));
|
|||
end;
|
|||
cboSolucion.ItemIndex:=g_cuestion.solucion-1;
|
|||
end;
|
|||
lblsolucion.top:=meopciones[g_cuestion.numOpciones-1].top +meOpciones[g_cuestion.numOpciones-1].height+10;
|
|||
cbosolucion.top:=lblsolucion.top;
|
|||
application.ProcessMessages;
|
|||
finally
|
|||
Mifichero.free;
|
|||
end;
|
|||
except
|
|||
Mensaje(MEN_ERROR_LEER_CUESTION,aceptar);
|
|||
end;
|
|||
end;
|
|||
procedure TfrmEvaluar.CrearCuadrosTexto;
|
|||
var
|
|||
i,s:integer;
|
|||
begin
|
|||
s:=-1;
|
|||
lblnompre.Font.Name:='Sans';
|
|||
lblnompre.Font.Size:=10;
|
|||
lblnompre.Font.Color:=AZUL_COLOR;
|
|||
lblSolucion.Font.Name:='Sans';
|
|||
lblSolucion.Font.Size:=10;
|
|||
lblSolucion.Font.Color:=AZUL_COLOR;
|
|||
for i:=0 to 5 do
|
|||
begin
|
|||
meOpciones[i]:=TEdit.Create(self);
|
|||
lblOpciones[i]:=Tlabel.Create(self);
|
|||
with lblOpciones[i] do
|
|||
begin
|
|||
font.name:='Sans';
|
|||
font.size:=10;
|
|||
font.color:=AZUL_COLOR;
|
|||
Caption:= ' Opción ' + intToStr(i+1)+': ';
|
|||
autosize:=false;
|
|||
width:=70;
|
|||
transparent:=true;
|
|||
Parent:=self;
|
|||
tag:=i;
|
|||
if (i mod 2)=0 then
|
|||
begin
|
|||
left:= 8;
|
|||
inc(s)
|
|||
end
|
|||
else
|
|||
begin
|
|||
left:=446;
|
|||
end;
|
|||
top:= mePregunta.top + mePregunta.height + 3 + (s*(3+mePregunta.height));
|
|||
end;
|
|||
with meOpciones[i] do
|
|||
begin
|
|||
font.name:='Sans';
|
|||
font.size:=10;
|
|||
width:=(873- (2*lblOpciones[i].width)) div 2;
|
|||
height:=mePregunta.height;
|
|||
Parent:=self;
|
|||
tag:=i;
|
|||
text:='';
|
|||
if (i mod 2)=0 then
|
|||
begin
|
|||
left:= mePregunta.left;
|
|||
end
|
|||
else
|
|||
begin
|
|||
left:=lblOpciones[i].left+lblOpciones[i].width+2;
|
|||
end;
|
|||
top:= lblOpciones[i].top;
|
|||
end;
|
|||
lblOpciones[i].top:= meOpciones[i].top+5;
|
|||
end;
|
|||
cbosolucion.left:=mePregunta.left;
|
|||
cboSolucion.top:=meOpciones[5].top+ meOpciones[5].height+5;
|
|||
end;
|
|||
procedure TfrmEvaluar.CrearArchivoPreguntaTest();
|
|||
var
|
|||
Mifichero:TMemIniFile;
|
|||
i:integer;
|
|||
begin
|
|||
g_cuestion.solucion:=strtoint(cboSolucion.text);
|
|||
g_cuestion.nombre:=edNombreTest.text;
|
|||
g_cuestion.tiempo:=strtoint(cboTiempo.text);
|
|||
g_cuestion.tipo:=0;
|
|||
g_cuestion.archivo:= getenvironmentvariable('HOME');
|
|||
23a384b9 | Elisa | g_cuestion.archivo:=equipoAdministrador.DirCuestiones;
|
|
54e95a47 | Elisa | IF NOT DirectoryExists(g_cuestion.archivo) THEN
|
|
CreateDir(g_cuestion.archivo);
|
|||
g_cuestion.archivo:=g_cuestion.archivo+'/'+edNombreTest.text+'.txt';
|
|||
23a384b9 | Elisa | equipoAdministrador.ArcCuestion:=g_cuestion.archivo;
|
|
54e95a47 | Elisa | g_cuestion.pregunta:=mePregunta.text;
|
|
for i:=0 to high(meOpciones) do
|
|||
begin
|
|||
g_cuestion.Opciones[i]:=meOpciones[i].text;
|
|||
end;
|
|||
try
|
|||
g_cuestion.codigo:=FormatDatetime('mmddhhmmss',Now);
|
|||
Mifichero := TMemIniFile.Create(g_cuestion.archivo);
|
|||
try
|
|||
with Mifichero do
|
|||
begin
|
|||
23a384b9 | Elisa | writeString ('TIPO','Administrador',equipoAdministrador.IP);
|
|
54e95a47 | Elisa | writeString ('TIPO','Codigo',g_cuestion.codigo);
|
|
writeInteger('TIPO','Tipo',g_cuestion.tipo);
|
|||
WriteInteger('TIPO','Numero_Opciones',g_cuestion.numOpciones);
|
|||
WriteInteger('TIPO','Tiempo',g_cuestion.tiempo);
|
|||
writeInteger('TIPO','Solucion',g_cuestion.solucion);
|
|||
WriteString('CUESTION','Pregunta', HTTPEncode(g_cuestion.pregunta));
|
|||
for i:=0 to g_cuestion.numOpciones-1 do
|
|||
23a384b9 | Elisa | WriteString('CUESTION','Opcion_'+inttostr(i+1), HTTPEncode (g_cuestion.Opciones[i]));
|
|
54e95a47 | Elisa | UpdateFile;
|
|
end;
|
|||
sleep(100);
|
|||
application.ProcessMessages;
|
|||
finally
|
|||
Mifichero.free;
|
|||
end;
|
|||
except
|
|||
Mensaje(MEN_ERROR_GUARDAR_CUESTION,aceptar);
|
|||
end;
|
|||
end;
|
|||
procedure TfrmEvaluar.comprobarClasificacion(nequ:integer);
|
|||
var
|
|||
j,k:integer;
|
|||
begin
|
|||
23a384b9 | Elisa | for j:=0 to high(equipoServidorAula) do
|
|
54e95a47 | Elisa | begin
|
|
23a384b9 | Elisa | if equipoServidorAula[nequ].UsuarioActivo<>'' then
|
|
54e95a47 | Elisa | begin
|
|
23a384b9 | Elisa | if equipoServidorAula[nequ].CuestionTiempo<= g_cuestion.mejorestiempos[j] then
|
|
54e95a47 | Elisa | begin
|
|
23a384b9 | Elisa | for k:=j to high(equipoServidorAula) do
|
|
54e95a47 | Elisa | begin
|
|
23a384b9 | Elisa | if k<high(equipoServidorAula) then
|
|
54e95a47 | Elisa | begin
|
|
23a384b9 | Elisa | g_cuestion.mejoresAulas[k+1]:=g_cuestion.mejoresAulas[k];
|
|
54e95a47 | Elisa | g_cuestion.mejorestiempos[k+1]:=g_cuestion.mejorestiempos[k];
|
|
g_cuestion.mejoresequipos[k+1]:=g_cuestion.mejoresequipos[k];
|
|||
g_cuestion.mejoresrespuestas[k+1]:=g_cuestion.mejoresrespuestas[k]
|
|||
end;
|
|||
end;
|
|||
23a384b9 | Elisa | g_cuestion.mejoresAulas[j]:=equipoServidorAula[nequ].NombreMonitor;
|
|
g_cuestion.mejoresequipos[j]:=equipoServidorAula[nequ].mihost;
|
|||
g_cuestion.mejorestiempos[j]:=equipoServidorAula[nequ].CuestionTiempo;
|
|||
g_cuestion.mejoresrespuestas[j]:=equipoServidorAula[nequ].CuestionRespuesta;
|
|||
54e95a47 | Elisa | break;
|
|
end;
|
|||
end;
|
|||
end;
|
|||
end;
|
|||
procedure TfrmEvaluar.tmrMensajeTimer(Sender: TObject);
|
|||
begin
|
|||
f_contador_mensaje:=f_contador_mensaje-1;
|
|||
lblTiempo2.caption:=Tiempo(f_contador_mensaje);
|
|||
pbTiempo.Position:=pbTiempo.Position+1;
|
|||
if f_contador_mensaje<=0 then
|
|||
begin
|
|||
tmrMensaje.enabled:=false;
|
|||
lblMenTiempo.Caption:=MEN_ORG_RESULTADOS;
|
|||
end;
|
|||
end;
|
|||
procedure TfrmEvaluar.tmrRecogidaTimer(Sender: TObject);
|
|||
var
|
|||
i:integer;
|
|||
todasrrecogidas:Boolean;
|
|||
begin
|
|||
todasrrecogidas:=true;
|
|||
f_cuestion_contador:=f_cuestion_contador-1;
|
|||
23a384b9 | Elisa | for i:=0 to high(equipoServidorAula) do
|
|
54e95a47 | Elisa | begin
|
|
23a384b9 | Elisa | if equipoServidorAula[i].CuestionHace then
|
|
if equipoServidorAula[i].CuestionTerminada=false then
|
|||
54e95a47 | Elisa | todasrrecogidas:=false;
|
|
end;
|
|||
if (f_cuestion_contador<=0) or todasrrecogidas then
|
|||
begin
|
|||
tmrMensaje.enabled:=false;
|
|||
tmrRecogida.enabled:=false;
|
|||
lblMenTiempo.Caption:=MEN_ORG_RESULTADOS;
|
|||
23a384b9 | Elisa | for i:=0 to high(equipoServidorAula) do
|
|
54e95a47 | Elisa | begin
|
|
23a384b9 | Elisa | if equipoServidorAula[i].CuestionHace then
|
|
if equipoServidorAula[i].CuestionTerminada=false then
|
|||
anadirRespuesta(equipoServidorAula[i].ip,0,g_cuestion.tiempo);
|
|||
54e95a47 | Elisa | end;
|
|
//ShowMessage('Tiempo finalizaod');
|
|||
Application.ProcessMessages;
|
|||
MostrarEstadisticasCuestion();
|
|||
application.ProcessMessages;
|
|||
todasrrecogidas:=false;
|
|||
f_cuestion_contador:=g_cuestion.tiempo+5;
|
|||
end;
|
|||
end;
|
|||
procedure TfrmEvaluar.btnOpcionesClick(Sender: TObject);
|
|||
begin
|
|||
OpcionesMostrarEstadisticas1(f_respuestas_recibidas);
|
|||
pnEstadisticas1.BringToFront;
|
|||
pnEstadisticas1.visible:=true
|
|||
end;
|
|||
procedure TfrmEvaluar.btnIndividualClick(Sender: TObject);
|
|||
begin
|
|||
IndividualMostrarEstadisticas();
|
|||
pnEstadisticas1.BringToFront;
|
|||
pnEstadisticas1.visible:=true ;
|
|||
end;
|
|||
procedure TfrmEvaluar.btnSalirClick(Sender: TObject);
|
|||
begin
|
|||
close;
|
|||
end;
|
|||
procedure TfrmEvaluar.cboNumOpcChange(Sender: TObject);
|
|||
begin
|
|||
g_cuestion.numOpciones:=strtoint(cboNumOpc.text);
|
|||
mostrarMemos(g_cuestion.numOpciones);
|
|||
end;
|
|||
procedure TfrmEvaluar.cboNumOpcKeyPress(Sender: TObject; var Key: char);
|
|||
begin
|
|||
key:=#0;
|
|||
end;
|
|||
procedure TfrmEvaluar.cboSolucionKeyPress(Sender: TObject; var Key: char);
|
|||
begin
|
|||
key:=#0;
|
|||
end;
|
|||
procedure TfrmEvaluar.cboTiempoKeyPress(Sender: TObject; var Key: char);
|
|||
begin
|
|||
key:=#0;
|
|||
end;
|
|||
procedure TfrmEvaluar.edNombreTestKeyPress(Sender: TObject; var Key: char);
|
|||
begin
|
|||
if not(key in['a'..'z','A'..'Z','0'..'9','.','-','_',':',#8]) then
|
|||
key:=#0;
|
|||
end;
|
|||
procedure TfrmEvaluar.FormActivate(Sender: TObject);
|
|||
begin
|
|||
23a384b9 | Elisa | if frmMain.Visible then frmMain.hide;
|
|
54e95a47 | Elisa | end;
|
|
procedure TfrmEvaluar.FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
|||
begin
|
|||
try
|
|||
if idCMDTCPServer1.Active=true then
|
|||
idCMDTCPServer1.Active:=false;
|
|||
finally
|
|||
CloseAction:=cafree;
|
|||
end;
|
|||
end;
|
|||
procedure TfrmEvaluar.FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
|||
begin
|
|||
23a384b9 | Elisa | if mensaje(MEN_SALIR_ZONA,sino)=2 then
|
|
canclose:=false
|
|||
else
|
|||
begin
|
|||
frmMain.show;
|
|||
hide;
|
|||
end;
|
|||
54e95a47 | Elisa | end;
|
|
procedure TfrmEvaluar.FormCreate(Sender: TObject);
|
|||
var
|
|||
i:integer;
|
|||
begin
|
|||
top:=13;
|
|||
g_cuestion.numOpciones:=4;
|
|||
g_cuestion.tiempo:=30;
|
|||
g_cuestion.solucion:=1;
|
|||
top:=13;left:=(screen.Width-width) div 2;
|
|||
pnGrafico.SetBounds(7,295,882,324);
|
|||
pnGrafico.Color:=clWhite;
|
|||
SetLength(f_respuestas_recibidas,7);
|
|||
for i:=0 to high(f_respuestas_recibidas) do
|
|||
f_respuestas_recibidas[i]:=0;
|
|||
23a384b9 | Elisa | setlength(g_cuestion.mejoresAulas,g_num_servidores_aula+1);
|
|
setlength(g_cuestion.mejorestiempos,g_num_servidores_aula+1);
|
|||
setlength(g_cuestion.mejoresequipos,g_num_servidores_aula+1);
|
|||
setlength(g_cuestion.mejoresrespuestas,g_num_servidores_aula+1);
|
|||
54e95a47 | Elisa | left:=(screen.Width-width) div 2;
|
|
CrearCuadrosTexto();
|
|||
mostrarMemos(g_cuestion.numOpciones);
|
|||
23a384b9 | Elisa | IdCmdTCPServer1:=TIdCmdTCPServer.Create(nil);
|
|
54e95a47 | Elisa | end;
|
|
procedure TfrmEvaluar.FormDestroy(Sender: TObject);
|
|||
23a384b9 | Elisa | begin
|
|
FreeAndNil( IdCmdTCPServer1);
|
|||
end;
|
|||
procedure TfrmEvaluar.IdCmdTCPServer1ListenException(
|
|||
AThread: TIdListenerThread; AException: Exception);
|
|||
54e95a47 | Elisa | begin
|
|
23a384b9 | Elisa | //
|
|
54e95a47 | Elisa | end;
|
|
procedure TfrmEvaluar.btnCargarClick(Sender: TObject);
|
|||
var
|
|||
archivo1,archivo,dirconsultas:string;
|
|||
exte:string;
|
|||
begin
|
|||
dirconsultas:= getenvironmentvariable('HOME');
|
|||
23a384b9 | Elisa | dirconsultas:= dirconsultas+'/adtos_consultas';
|
|
54e95a47 | Elisa | IF NOT DirectoryExists(dirconsultas) THEN
|
|
CreateDir(dirconsultas);
|
|||
OpenDialog1.InitialDir := dirconsultas;
|
|||
if opendialog1.Execute then
|
|||
begin
|
|||
archivo1:=opendialog1.FileName;
|
|||
archivo:=ExtractFilename(archivo1);
|
|||
exte:=ExtractFileExt(archivo);
|
|||
archivo:=StringReplace(archivo,exte,'',[rfReplaceAll]);
|
|||
ednombretest.text:=archivo;
|
|||
LeerArchivoPreguntaTest(archivo1)
|
|||
end;
|
|||
end;
|
|||
procedure TfrmEvaluar.btnCrearClick(Sender: TObject);
|
|||
begin
|
|||
if validarCuestionTest then
|
|||
begin
|
|||
CrearArchivoPreguntaTest();
|
|||
23a384b9 | Elisa | Mensaje('La cuestión '+ g_cuestion.nombre+' ha sido guardada en la carpeta adtos_consultas de su directorio pesonal.',aceptar);
|
|
54e95a47 | Elisa | end
|
|
end;
|
|||
procedure TfrmEvaluar.btnEnviarClick(Sender: TObject);
|
|||
begin
|
|||
if validarCuestionTest then
|
|||
begin
|
|||
//IniciarServidorVnc();
|
|||
CrearArchivoPreguntaTest();
|
|||
EnviarConsulta(edNombreTest.text);
|
|||
pbTiempo.Position:=0;
|
|||
pbTiempo.Visible:=true;
|
|||
pbTiempo.Max:=g_cuestion.tiempo;
|
|||
lblMenTiempo.caption:=MEN_RECOGIENDO_RESPUESTAS;
|
|||
lblMenTiempo.visible:=true;
|
|||
lblTiempo2.visible:=true;
|
|||
pnEstadisticas1.visible:=false
|
|||
end
|
|||
end;
|
|||
procedure TfrmEvaluar.btnNuevoClick(Sender: TObject);
|
|||
begin
|
|||
if mensaje(MEN_NUEVO_CUESTION,sino)=1 then
|
|||
LimpiarExamen();
|
|||
end;
|
|||
procedure TfrmEvaluar.btnResultadosClick(Sender: TObject);
|
|||
begin
|
|||
ResultadosEstadisticas(g_cuestion.numaciertos,g_cuestion.numfallos,g_cuestion.numBlancos);
|
|||
pnGrafico.visible:=true;
|
|||
end;
|
|||
initialization
|
|||
{$I evaluar.lrs}
|
|||
end.
|