|
{
|
|
Adtos 1.0 Software de gestión de Aulas Tecnológicas
|
|
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 mapa;
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
interface
|
|
|
|
uses
|
|
math,globales,globales1,Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
|
ExtCtrls, Menus, StdCtrls,textomensajes;
|
|
|
|
type
|
|
|
|
{ TfrmMapa }
|
|
|
|
TfrmMapa = class(TForm)
|
|
btnvolver: TButton;
|
|
Image1: TImage;
|
|
Image2: TImage;
|
|
Image3: TImage;
|
|
Image4: TImage;
|
|
imlmenu: TImageList;
|
|
imlMesas: TImageList;
|
|
imgClase: TImage;
|
|
imgLetrero: TImage;
|
|
Label1: TLabel;
|
|
Label2: TLabel;
|
|
Label3: TLabel;
|
|
lblEstadisticas1: TLabel;
|
|
lblRefrescado: TLabel;
|
|
mnuApagarTodasAula1: TMenuItem;
|
|
mnuEncenderAlumno: TMenuItem;
|
|
mnuApagarEquipo: TMenuItem;
|
|
mnuEncerderAula: TMenuItem;
|
|
mnuApagarAula: TMenuItem;
|
|
mnuEncerderTodaAulas: TMenuItem;
|
|
poAula: TPopupMenu;
|
|
poAlumno: TPopupMenu;
|
|
poCentro: TPopupMenu;
|
|
tmrRevision: TTimer;
|
|
procedure btnvolverClick(Sender: TObject);
|
|
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
|
procedure FormCreate(Sender: TObject);
|
|
procedure imgClaseMouseDown(Sender: TObject; Button: TMouseButton;
|
|
Shift: TShiftState; X, Y: Integer);
|
|
procedure mnuApagarAulaClick(Sender: TObject);
|
|
procedure mnuApagarEquipoClick(Sender: TObject);
|
|
procedure mnuApagarTodasAula1Click(Sender: TObject);
|
|
procedure mnuEncenderAlumnoClick(Sender: TObject);
|
|
procedure mnuEncerderAulaClick(Sender: TObject);
|
|
procedure mnuEncerderTodaAulasClick(Sender: TObject);
|
|
procedure tmrRevisionTimer(Sender: TObject);
|
|
private
|
|
procedure ActualizarEstadoEquipos();
|
|
procedure ColocarAulas(numaulas, numequiposH, numequiposV: integer);
|
|
procedure CrearMesasAula(numeroaula, numordaula, lf, tp: integer);
|
|
procedure DistribucionAulas();
|
|
procedure IniciarClaseMapas();
|
|
procedure MostrarMesas(const mesasaula: array of Timage; lm, tm: integer);
|
|
procedure muestraEstadisticas(pe,pu,ae,au:integer);
|
|
function SeparacionHorizontal(anchofrm, anchobit, borde, numbotH: integer
|
|
): integer;
|
|
function SeparacionVertical(altofrm, altobit, bordes, bordei,
|
|
numbotV: integer): integer;
|
|
procedure sPMesaMouseDown(Sender: TObject; Button: TMouseButton;
|
|
Shift: TShiftState; X, Y: Integer);
|
|
{ private declarations }
|
|
public
|
|
{ public declarations }
|
|
end;
|
|
|
|
var
|
|
frmMapa: TfrmMapa;
|
|
imgAulas:array of Timage;
|
|
lblAulas:array of Tlabel;
|
|
spMesa:array of array of Timage;
|
|
f_anterior_actualzacion:String;
|
|
f_aula_elegida:integer=-1;
|
|
f_equipo_elegido:integer=-1;
|
|
|
|
implementation
|
|
const
|
|
//ANCHO_AULA:integer=82;
|
|
//ALTO_AULA:integer=111;
|
|
//ANCHO_MESA:integer=17;
|
|
//ALTO_MESA:integer=10;
|
|
// BORDEI_AULA:integer=20;
|
|
SEPARACION_HORIZONTAL_MESA:integer=17;
|
|
ALTURA_SUMA_MESA:integer=75;//505;
|
|
ANCHO_AULA:integer=74;
|
|
ALTO_AULA:integer=90;
|
|
ANCHO_MESA:integer=13;
|
|
ALTO_MESA:integer=8;
|
|
BORDES_AULA:integer=10;
|
|
BORDEI_AULA:integer=20;
|
|
BORDEL_AULA:integer=10;
|
|
TIEMPO_REFRESCO:INTEGER=50;
|
|
var
|
|
f_contador:integer=40;
|
|
f_tipo:integer=-1;
|
|
clasesmapa:array of Tmiclase;
|
|
f_ipequipoelegido:string='';
|
|
f_macpequipoelegido:string='';
|
|
|
|
{ TfrmMapa }
|
|
|
|
procedure TfrmMapa.btnvolverClick(Sender: TObject);
|
|
begin
|
|
Close;
|
|
end;
|
|
|
|
procedure TfrmMapa.FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
|
begin
|
|
CloseAction:=cafree;
|
|
end;
|
|
procedure TfrmMapa.muestraEstadisticas(pe,pu,ae,au:integer);
|
|
var
|
|
porprofe,porprofu,poralum:Double;
|
|
spe,spu,sae:string;
|
|
texto:String;
|
|
begin
|
|
porprofe:=(pe / g_num_servidores_aula)*100;
|
|
spe:=FloatToStrF(porprofe,ffFixed,8,2);
|
|
porprofu:=(pu / g_num_servidores_aula)*100;
|
|
spu:=FloatToStrF(porprofu,ffFixed,8,2);
|
|
poralum:=ae / g_num_servidores_aula;
|
|
sae:=FloatToStrF(poralum,ffFixed,8,2);
|
|
texto:='Número aulas: '+IntToStr(g_num_servidores_aula) +' Prof. encendidos: ' +IntToStr(pe)+'('+spe+'%) ';
|
|
texto:=texto+ 'Prof. usuario: '+IntToStr(pu)+'('+spu+'%) Alum. encendidos: '+ IntToStr(ae) + ' Alum. usuario: '+ IntToStr(au);
|
|
lblEstadisticas1.Caption:=texto;
|
|
//lblEstadisticas1.Visible:=true;
|
|
end;
|
|
procedure TfrmMapa.sPMesaMouseDown(Sender: TObject; Button: TMouseButton;
|
|
Shift: TShiftState; X, Y: Integer);
|
|
begin
|
|
f_equipo_elegido:=(Sender as Timage).tag mod 100;
|
|
f_aula_elegida:=(Sender as Timage).tag div 100;
|
|
f_ipequipoelegido:=g_equiposAulas[f_aula_elegida][f_equipo_elegido].ip;
|
|
f_macpequipoelegido:=g_equiposAulas[f_aula_elegida][f_equipo_elegido].mac;
|
|
|
|
end;
|
|
procedure TfrmMapa.FormCreate(Sender: TObject);
|
|
begin
|
|
IniciarClaseMapas();
|
|
DistribucionAulas();
|
|
f_contador:=0;
|
|
tmrRevision.Enabled:=true;
|
|
if g_primara_revision_hecha then
|
|
begin
|
|
lblRefrescado.Caption:='Pasa el ratón sobre las mesas activas para ver sus datos. Próxima actualización: ' + tiempo(g_contador_refresco_centro);
|
|
lblRefrescado.Font.color:=clgreen;
|
|
lblEstadisticas1.Visible:=true;
|
|
end;
|
|
|
|
end;
|
|
|
|
procedure TfrmMapa.imgClaseMouseDown(Sender: TObject; Button: TMouseButton;
|
|
Shift: TShiftState; X, Y: Integer);
|
|
begin
|
|
|
|
end;
|
|
|
|
procedure TfrmMapa.mnuApagarAulaClick(Sender: TObject);
|
|
var
|
|
j:integer;
|
|
begin
|
|
if Length(Trim(g_contraServidores)) <1 then
|
|
begin
|
|
mensaje(MEN_CONTRA_SERVIDORES_AULA, aceptar);
|
|
exit;
|
|
end;
|
|
if equipoServidorAula[f_aula_elegida].EstadoActivadEquipo in[eApagado,eAveriado] then exit;
|
|
if (Mensaje('¿Deseas apagar todos los equipos de los alumnos de este aula?',SiNo)=1) then
|
|
begin
|
|
|
|
equipoServidorAula[f_aula_elegida].apagarEncenderAlumosAula(0);
|
|
for j:= 1 to High(spMesa[f_aula_elegida]) do
|
|
|
|
imlmesas.GetBitmap(0,spMesa[f_aula_elegida,j].picture.bitmap) ;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
procedure TfrmMapa.mnuApagarEquipoClick(Sender: TObject);
|
|
begin
|
|
if Length(Trim(g_contraServidores)) <1 then
|
|
begin
|
|
mensaje(MEN_CONTRA_SERVIDORES_AULA, aceptar);
|
|
exit;
|
|
end;
|
|
equipoServidorAula[f_aula_elegida].apagarEncenderEquipoAlumno(f_ipequipoelegido,'0');
|
|
imlmesas.GetBitmap(3,spMesa[f_aula_elegida,f_equipo_elegido].picture.bitmap) ;
|
|
end;
|
|
|
|
procedure TfrmMapa.mnuApagarTodasAula1Click(Sender: TObject);
|
|
var
|
|
i,j:integer;
|
|
begin
|
|
try
|
|
if Length(Trim(g_contraServidores)) <1 then
|
|
begin
|
|
mensaje(MEN_CONTRA_SERVIDORES_AULA, aceptar);
|
|
exit;
|
|
end;
|
|
if (Mensaje('¿Deseas apagar los equipos de todos los alumnos de todas las aulas del centro?',SiNo)=1) then
|
|
begin
|
|
tmrRevision.Enabled:=false;
|
|
enabled:=false;
|
|
for i :=0 to High(equipoServidorAula) do
|
|
begin
|
|
if equipoServidorAula[i].EstadoActivadEquipo in[eApagado,eAveriado] then continue;
|
|
sleep(100);
|
|
Application.ProcessMessages;
|
|
equipoServidorAula[i].apagarEncenderAlumosAula(0);
|
|
for j:= 1 to High(spMesa[i]) do
|
|
begin
|
|
imlmesas.GetBitmap(0,spMesa[i,j].picture.bitmap) ;
|
|
Application.ProcessMessages;
|
|
end;
|
|
sleep(100);
|
|
Application.ProcessMessages;
|
|
end;
|
|
|
|
end;
|
|
finally
|
|
tmrRevision.Enabled:=true;
|
|
enabled:=true;
|
|
end
|
|
|
|
end;
|
|
|
|
procedure TfrmMapa.mnuEncenderAlumnoClick(Sender: TObject);
|
|
begin
|
|
if Length(Trim(g_contraServidores)) <1 then
|
|
begin
|
|
mensaje(MEN_CONTRA_SERVIDORES_AULA, aceptar);
|
|
exit;
|
|
end;
|
|
equipoServidorAula[f_aula_elegida].apagarEncenderEquipoAlumno(f_macpequipoelegido,'1');
|
|
imlmesas.GetBitmap(1,spMesa[f_aula_elegida,f_equipo_elegido].picture.bitmap) ;
|
|
end;
|
|
|
|
procedure TfrmMapa.mnuEncerderAulaClick(Sender: TObject);
|
|
var
|
|
j:integer;
|
|
begin
|
|
if Length(Trim(g_contraServidores)) <1 then
|
|
begin
|
|
mensaje(MEN_CONTRA_SERVIDORES_AULA, aceptar);
|
|
exit;
|
|
end;
|
|
if equipoServidorAula[f_aula_elegida].EstadoActivadEquipo in[eApagado,eAveriado] then exit;
|
|
if (Mensaje('¿Deseas encender todos los equipos de los alumnos de este aula?',SiNo)=1) then
|
|
begin
|
|
equipoServidorAula[f_aula_elegida].apagarEncenderAlumosAula(1);
|
|
for j:= 1 to High(spMesa[f_aula_elegida]) do
|
|
imlmesas.GetBitmap(1,spMesa[f_aula_elegida,j].picture.bitmap) ;
|
|
end;
|
|
|
|
end;
|
|
|
|
procedure TfrmMapa.mnuEncerderTodaAulasClick(Sender: TObject);
|
|
var
|
|
i,j:integer;
|
|
begin
|
|
try
|
|
if Length(Trim(g_contraServidores)) <1 then
|
|
begin
|
|
mensaje(MEN_CONTRA_SERVIDORES_AULA, aceptar);
|
|
exit;
|
|
end;
|
|
if (Mensaje('¿Deseas encender los equipos de todos los alumnos de todas las aulas del centro?',SiNo)=1) then
|
|
begin
|
|
tmrRevision.Enabled:=false;
|
|
enabled:=false;
|
|
for i :=0 to High(equipoServidorAula) do
|
|
begin
|
|
if equipoServidorAula[i].EstadoActivadEquipo in[eApagado,eAveriado] then continue;
|
|
sleep(100);
|
|
Application.ProcessMessages;
|
|
equipoServidorAula[i].apagarEncenderAlumosAula(1);
|
|
for j:= 1 to High(spMesa[i]) do
|
|
begin
|
|
imlmesas.GetBitmap(1,spMesa[i,j].picture.bitmap) ;
|
|
Application.ProcessMessages;
|
|
end;
|
|
sleep(10);
|
|
Application.ProcessMessages;
|
|
end;
|
|
|
|
end;
|
|
finally
|
|
tmrRevision.Enabled:=true;
|
|
enabled:=true;
|
|
end
|
|
|
|
end;
|
|
|
|
|
|
procedure TfrmMapa.tmrRevisionTimer(Sender: TObject);
|
|
begin
|
|
if g_revisionCentro_actualizada then
|
|
begin
|
|
|
|
lblRefrescado.Caption:='Pasa el ratón sobre las mesas activas para ver sus datos. Próxima actualización: ' + tiempo(g_contador_refresco_centro);
|
|
lblRefrescado.Font.color:=clGreen;
|
|
lblEstadisticas1.Visible:=true;
|
|
g_revisionCentro_actualizada:=false;
|
|
ActualizarEstadoEquipos();
|
|
exit;
|
|
end;
|
|
lblRefrescado.Caption:='Pasa el ratón sobre las mesas activas para ver sus datos. Próxima actualización: ' + tiempo(g_contador_refresco_centro);
|
|
|
|
end;
|
|
procedure TfrmMapa.ActualizarEstadoEquipos();
|
|
var
|
|
muestramen :boolean;
|
|
alumu, profe,profu,alume:integer;
|
|
i,j:integer;
|
|
begin
|
|
try
|
|
try
|
|
profe:=0;
|
|
profu:=0;
|
|
alume:=0;
|
|
alumu:=0;
|
|
g_revisionCentro_actualizada:=false;
|
|
lblRefrescado.Caption:='Pasa el ratón sobre las mesas activas para ver sus datos. Actualizando el estado del centro';
|
|
Application.ProcessMessages;
|
|
for i:=0 to g_num_servidores_aula -1 do
|
|
begin
|
|
for j:=0 to 32 do
|
|
begin
|
|
with spMesa[i][j]do
|
|
begin
|
|
imlmesas.GetBitmap(0,spMesa[i,j].picture.bitmap) ;
|
|
case g_equiposAulas[i][j].estadoActividad of
|
|
eAveriado:
|
|
begin
|
|
imlmesas.GetBitmap(0,spMesa[i,j].picture.bitmap) ;
|
|
hint:='';
|
|
if j=0 then hint:=equipoServidorAula[i].mihost + ' '+ equipoServidorAula[i].IP +' '+equipoServidorAula[i].mac;
|
|
end;
|
|
eApagado,eEncendiendo,eApagando:
|
|
begin
|
|
imlmesas.GetBitmap(3,spMesa[i,j].picture.bitmap) ;
|
|
hint:=g_equiposAulas[i][j].miHost + ' '+ g_equiposAulas[i][j].Ip+' '+ g_equiposAulas[i][j].mac;;
|
|
if j=0 then hint:=equipoServidorAula[i].mihost + ' '+ equipoServidorAula[i].IP +' '+equipoServidorAula[i].mac;
|
|
end;
|
|
eEncendido:
|
|
begin
|
|
if j=0 then inc(profe) else inc(alume);
|
|
imlmesas.GetBitmap(1,spMesa[i,j].picture.bitmap) ;
|
|
hint:=g_equiposAulas[i][j].miHost + ' '+ g_equiposAulas[i][j].Ip+' '+ g_equiposAulas[i][j].mac;
|
|
end;
|
|
eUsuario:
|
|
begin
|
|
if j=0 then inc(profu) else inc(alumu);
|
|
imlmesas.GetBitmap(2,spMesa[i,j].picture.bitmap) ;
|
|
hint:=g_equiposAulas[i][j].usuarioActivo+' '+g_equiposAulas[i][j].miHost + ' '+ g_equiposAulas[i][j].Ip +' '+ g_equiposAulas[i][j].mac;
|
|
end;
|
|
end;
|
|
|
|
end;
|
|
//(spMesa[i][j] as TImage).Refresh;
|
|
end;
|
|
end;
|
|
Application.ProcessMessages;
|
|
muestraEstadisticas(profe,profu,alume,alumu);
|
|
// lblRefrescado.caption:='Mapa actualizado a las '+ TimeToStr(Time()) + ' La anterior fue a las ' +g_anterior_actualizacion;
|
|
// g_anterior_actualizacion:=TimeToStr(Time());
|
|
|
|
except
|
|
//
|
|
end;
|
|
finally
|
|
enabled:=true;
|
|
end;
|
|
end;
|
|
procedure TfrmMapa.MostrarMesas(const mesasaula:array of Timage;lm,tm:integer);
|
|
|
|
var
|
|
lEquipoIzquierda,lEquipo,tEquipo,SeparacionVertical1,i,NumeroSeparacionesVerticales,numfilas:integer;
|
|
mix,miy:integer;
|
|
begin
|
|
//Muestra los ordenadores selecionados
|
|
try
|
|
|
|
lEquipoIzquierda:=4;
|
|
numfilas:=8;
|
|
NumeroSeparacionesVerticales:=7;
|
|
SeparacionVertical1:=(82-(numfilas*10)) div NumeroSeparacionesVerticales;
|
|
for i:=32 downto 1 do
|
|
begin
|
|
tEquipo:= (i-1) div 4;
|
|
tEquipo:= ALTURA_SUMA_MESA-tEquipo*(10+SeparacionVertical1);
|
|
lEquipo:= (i-1) mod 4;
|
|
lEquipo:= lEquipoIzquierda+ lEquipo*SEPARACION_HORIZONTAL_MESA;
|
|
mesasaula[i].SetBounds(lm+lEquipo,tm+tEquipo,ANCHO_MESA,ALTO_MESA);
|
|
mesasaula[i].visible:=true;
|
|
end;
|
|
mesasaula[0].SetBounds(lm+31,tm+86,ANCHO_MESA,ALTO_MESA);
|
|
mesasaula[0].visible:=true;
|
|
except
|
|
//
|
|
end;
|
|
end;
|
|
procedure TfrmMapa.CrearMesasAula(numeroaula,numordaula,lf,tp:integer);
|
|
var
|
|
i:integer;
|
|
begin
|
|
try
|
|
setlength(spMesa[numeroaula],numordaula);
|
|
for i:=0 to numordaula -1 do
|
|
begin
|
|
spMesa[numeroaula][i]:=Timage.create(self);
|
|
spMesa[numeroaula][i].Tag:= numeroaula;
|
|
with spMesa[numeroaula][i]do
|
|
begin
|
|
autosize:=false;
|
|
Stretch:=true;
|
|
parent:=self;
|
|
showhint:=true;
|
|
Width:=ANCHO_MESA;
|
|
Height:=ALTO_MESA;
|
|
tag:=100*numeroaula+i;
|
|
case clasesmapa[numeroaula].EstadoActividad[i] of
|
|
eAveriado:
|
|
begin
|
|
imlmesas.GetBitmap(0,spMesa[numeroaula,i].picture.bitmap) ;
|
|
if i=0 then hint:=equipoServidorAula[numeroaula].mihost + ' '+ equipoServidorAula[numeroaula].IP +' '+equipoServidorAula[numeroaula].mac;
|
|
end;
|
|
eApagado,eEncendiendo,eApagando:
|
|
begin
|
|
imlmesas.GetBitmap(3,spMesa[numeroaula,i].picture.bitmap) ;
|
|
hint:=clasesmapa[numeroaula].Host[i] + ' '+ clasesmapa[numeroaula].IP[i]+' '+clasesmapa[numeroaula].mac[i];
|
|
if i=0 then hint:=equipoServidorAula[numeroaula].mihost + ' '+ equipoServidorAula[numeroaula].IP +' '+equipoServidorAula[numeroaula].mac;
|
|
end;
|
|
eEncendido:
|
|
begin
|
|
imlmesas.GetBitmap(1,spMesa[numeroaula,i].picture.bitmap) ;
|
|
hint:=clasesmapa[numeroaula].Host[i] + ' '+ clasesmapa[numeroaula].IP[i]+' '+clasesmapa[numeroaula].mac[i];
|
|
|
|
end;
|
|
eUsuario:
|
|
begin
|
|
imlmesas.GetBitmap(2,spMesa[numeroaula,i].picture.bitmap) ;
|
|
hint:=clasesmapa[numeroaula].UsuariosActivo[i]+' '+clasesmapa[numeroaula].Host[i] + ' '+ clasesmapa[numeroaula].IP[i]+' '+clasesmapa[numeroaula].mac[i];
|
|
end;
|
|
end;
|
|
|
|
if i =0 then PopupMenu:=poAula else PopupMenu:=poAlumno;
|
|
Visible:=true;
|
|
OnMouseDown:=@sPMesaMouseDown;
|
|
end;
|
|
end;
|
|
MostrarMesas(spMesa[numeroaula],lf,tp);
|
|
except
|
|
//
|
|
end;
|
|
end;
|
|
procedure TfrmMapa.ColocarAulas(numaulas,numequiposH,numequiposV:integer);
|
|
var
|
|
numaula,i,j,laula,taula,sepH,sepV:integer;
|
|
begin
|
|
try
|
|
sepH:=SeparacionHorizontal(clientwidth,ANCHO_AULA,BORDEL_AULA,numequiposH);
|
|
sepV:=SeparacionVertical(clientheight,ALTO_AULA,BORDES_AULA,BORDEI_AULA,numequiposV);
|
|
numaula:=0;
|
|
setlength(imgAulas,numaulas);
|
|
setlength(lblaulas,numaulas);
|
|
setlength(spMesa,numaulas,19);
|
|
for j:=0 to numequiposV -1 do
|
|
begin
|
|
for i:=0 to numequiposH -1 do
|
|
begin
|
|
if numaula=numaulas then exit;
|
|
laula:=BORDEL_AULA+(i*ANCHO_AULA)+((i+1)*sepH);
|
|
taula:=BORDES_AULA+(j*ALTO_AULA)+((j+1)*sepV);
|
|
imgAulas[numaula]:=Timage.create(self);
|
|
lblAulas[numaula]:=Tlabel.create(self);
|
|
with imgAulas[numaula]do
|
|
begin
|
|
tag:=numaula;
|
|
parent:=self;
|
|
stretch:=true;
|
|
SetBounds(laula,taula,ANCHO_AULA,ALTO_AULA+8);
|
|
Visible:=true;
|
|
imgaulas[numaula].Picture.Assign(imgclase.Picture);
|
|
end;
|
|
with lblAulas[numaula]do
|
|
begin
|
|
tag:=numaula;
|
|
parent:=self;
|
|
autosize:=false;
|
|
transparent:=true;
|
|
Alignment:=taCenter;
|
|
SetBounds(laula-2,taula+ALTO_AULA+8,ANCHO_AULA+4,14);
|
|
cursor:=crdefault;
|
|
Visible:=true;
|
|
font.Color:=clblack;
|
|
font.Size:=8;
|
|
//font.Style:=[fsbold];
|
|
caption:=clasesmapa[numaula].NombreAula;
|
|
end;
|
|
CrearMesasAula(numaula,33,laula,taula);
|
|
inc(numaula);
|
|
end;
|
|
end;
|
|
except
|
|
//
|
|
end;
|
|
|
|
end;
|
|
Function TfrmMapa.SeparacionHorizontal(anchofrm,anchobit,borde,numbotH:integer):integer;
|
|
begin
|
|
result:=(anchofrm-(2*borde)-(numbotH*anchobit)) div (numboth+1);
|
|
end;
|
|
|
|
Function TfrmMapa.SeparacionVertical(altofrm,altobit,bordes,bordei,numbotV:integer):integer;
|
|
begin
|
|
result:=(altofrm-(bordes+bordei)-(numbotv*altobit)) div (numbotv+1);
|
|
//SeparacionVertical(clientheight,ALTO_AULA,BORDES_AULA,BORDEI_AULA,numequiposV);
|
|
end;
|
|
procedure TfrmMapa.DistribucionAulas();
|
|
var
|
|
eqH, eqV:integer;
|
|
begin
|
|
eqh:=4;eqV:=3;
|
|
case g_num_servidores_aula of
|
|
1..12:begin eqH:=4; eqV:=3;end;
|
|
13..20:begin eqH:=5; eqV:=4;end;
|
|
21..30:begin eqH:=6; eqV:=5;end;
|
|
31..35:begin eqH:=7; eqV:=5;end;
|
|
36..40:begin eqH:=8; eqV:=5;end;
|
|
41..45:begin eqH:=9; eqV:=5;end;
|
|
46..50:begin eqH:=10; eqV:=5;end;
|
|
51..60:begin eqH:=10; eqV:=6;end;
|
|
61..70:begin eqH:=11; eqV:=6;end;
|
|
end;
|
|
ColocarAulas(g_num_servidores_aula,eqH,eqV);
|
|
end;
|
|
procedure TfrmMapa.IniciarClaseMapas();
|
|
var
|
|
alumu, profe,profu,alume:integer;
|
|
i,j:integer;
|
|
begin
|
|
try
|
|
profe:=0;
|
|
profu:=0;
|
|
alume:=0;
|
|
alumu:=0;
|
|
setlength(clasesmapa,g_num_servidores_aula);
|
|
for i:=0 to g_num_servidores_aula-1 do
|
|
begin
|
|
with clasesmapa[i] do
|
|
begin
|
|
NombreAula:= g_equiposAulas[i][0].miHost;
|
|
if g_verNombreCursos then
|
|
if trim (g_equiposAulas[i][0].Curso)<>'' then
|
|
NombreAula:=g_equiposAulas[i][0].Curso;
|
|
setlength(EstadoActividad,33);
|
|
setlength(Host,33);
|
|
setlength(IP,33);
|
|
setlength(MAC,33);
|
|
setlength(UsuariosActivo,33);
|
|
for j:=0 to 32 do
|
|
begin
|
|
EstadoActividad[j]:=g_equiposAulas[i][j].estadoActividad;
|
|
if EstadoActividad[j] = eUsuario then
|
|
begin
|
|
if j=0 then inc(profu) else inc(alumu)
|
|
end
|
|
else if EstadoActividad[j] = eEncendido then
|
|
begin
|
|
if j=0 then inc(profe) else inc(alume);
|
|
end;
|
|
Ip[j]:=g_equiposAulas[i][j].Ip;
|
|
Host[j]:=g_equiposAulas[i][j].miHost;
|
|
UsuariosActivo[j]:=g_equiposAulas[i][j].usuarioActivo;
|
|
MAC[j]:=g_equiposAulas[i][j].mac;
|
|
end;
|
|
end;
|
|
end;
|
|
muestraEstadisticas(profe,profu,alume,alumu);
|
|
except
|
|
//
|
|
end;
|
|
end;
|
|
initialization
|
|
{$I mapa.lrs}
|
|
|
|
end.
|
|
|