<?php
/*
*
*/
class Otraventana extends GtkWindow
{
/*
*
*/
private $mimensaje ;
private $mimensaje2 ;
private $mimensaje3 ;
function __construct ()
{
parent :: __construct ();
//parent :: GtkEntry();
//parent :: get_text();
parent :: set_size_request ( 450 , 250 );
parent :: set_border_width ( 50 );
parent :: set_title ( 'otra ventana 4' );
parent :: connect_simple ( 'connect' , array( $this , 'on_click' ));
parent :: connect_simple ( 'delete_event' , array( $this , 'clicou' ));
$vbox = new GtkVBox ;
global $name12, $name22, $name33, $name44, $input, $input2, $input3, $input4;
$title = new GtkLabel("Usted va a crear un nuevo grupo \npara matricular un grupo de estudiante");
$title->modify_font(new PangoFontDescription("Times New Roman Italic 10"));
$title->modify_fg(Gtk::STATE_NORMAL, GdkColor::parse("#0000ff"));
$title->set_size_request(-1, 40);
$title->set_justify(Gtk::JUSTIFY_CENTER);
$alignment = new GtkAlignment(0.5, 0, 0, 0);
$alignment->add($title);
$vbox->pack_start($alignment, 0, 0);
$vbox->pack_start(new GtkLabel(), 0, 0);
// setup the entry field
$hbox = new GtkHBox();
$vbox->pack_start($hbox, 0, 0);
$hbox->pack_start(new GtkLabel(" Nivel:"), 0, 0);
$name12 = new GtkEntry();
$name12->set_size_request(40, 20);
$hbox->pack_start($name12, 0, 0);
$hbox->pack_start(new GtkLabel(" Dia(2 letras):"), 0, 0);
$name22 = new GtkEntry();
$name22->set_size_request(40, 20);
$hbox->pack_start($name22, 0, 0);
$hbox->pack_start(new GtkLabel(" Turno:"), 0, 0);
$name33 = new GtkEntry();
$name33->set_size_request(40, 20);
$hbox->pack_start($name33, 0, 0);
$hbox->pack_start(new GtkLabel(" Aņo:"), 0, 0);
$name44 = new GtkEntry();
$name44->set_size_request(40, 20);
$hbox->pack_start($name44, 0, 0);
$buttonx = new GtkButton('Crear Ya');
$buttonx->set_size_request(80, 28);
/******* para mandar mensajes *********************/
echo "on_click: $id!\n";
$input = $name12->get_text();
$input2 = $name22->get_text();
$input3 = $name33->get_text();
$input4 = $name44->get_text();
// the problem is here
if ($input ==''($input2=='') || ($input3=='') || ($input4==''){
$buttonx->connect_simple ( 'clicked' , array( $this , 'click2' ));
}
else{
$fecha=date("y-m-d");
include 'conex01.php';
$SQL="SELECT nombre FROM grupos WHERE nombre = '$input'.'$input2'.'$input3'.'$input4'";
//$SQL = "SELECT idma, nombre, nivel FROM materias";
$result = mysql_query($SQL) or die('Query failed. ' . mysql_error());
if (mysql_num_rows($result) >= 1) {
$buttonx->connect_simple ( 'clicked' , array( $this , 'click3' ));
}
else{
$conv=$input."".$input2."".$input3."".$input;
$SQL = "INSERT INTO grupos (nombre, system) VALUES ('$conv', '$fecha')";
mysql_query($SQL) or die('Error ,query failed');
$buttonx->connect_simple ( 'clicked' , array( $this , 'click4' ));
//mysql_close($conn);
}
mysql_close($conn);
}
/********* fin de para mandar mensajes ***********/
//$buttonx->connect_simple ( 'clicked' , array( $this , 'click2' )); //connect('clicked', 'on_click', 'AA');
$hbox = new GtkHBox();
$vbox->pack_start($hbox, 0, 0);
$hbox->pack_start(new GtkLabel());
$hbox->pack_start($buttonx, 0, 0);
global $message;
$hbox->pack_start(new GtkLabel($message));
$vbox->pack_start(new GtkLabel("Hola es el boton 4 que abre esta ventana"));
$vbox->pack_start(new GtkLabel());
$vbox->pack_start($hbox=new GtkHBox(), 0, 0);
$hbox->pack_start($botao = new GtkButton ( 'fecha otro 4' ));
$botao->set_size_request(40, 32);
$botao -> connect_simple ( 'clicked' , array( $this , 'clicou' ));
parent :: add ( $vbox );
parent :: add ( $hbox );
parent :: show_all ();
}
/*********************/
/********************/
/*
*
*/
function click2 ()
{
include_once 'mesage.php' ;
if (empty( $this -> mimensaje ))
{
$this -> mimensaje = new message ;
}
$this -> mimensaje -> show_all ();
}
function click3 ()
{
include_once 'mesage2.php' ;
if (empty( $this -> mimensaje2 ))
{
$this -> mimensaje2 = new message2 ;
}
$this -> mimensaje2 -> show_all ();
}
function click4 ()
{
include_once 'mesage3.php' ;
if (empty( $this -> mimensaje3 ))
{
$this -> mimensaje3 = new message3 ;
}
$this -> mimensaje3 -> show_all ();
}
function clicou ()
{
$this -> hide ();
return true ;
}
}
?> |