In the last version of the Rialto PHP lib, you can design your screen in a class. In this tutorial you will learn how to create a screen and how to print it.
Create a folder named : screens.
In this folder create a new file named : DefaultScreen.php.
<?php class DefaultScreen extends RialtoPHPScreen { public function doPrint($writer){ return ''; } } ?>
<?php class DefaultScreen extends RialtoPHPScreen { public $DIV = "document.body"; public $WINDOW = "myWindow"; public $WINDOW_TITLE = "My Title"; public $ICON = "images/imgFenSimple/picto-gr_recherchepatients.gif"; public function doPrint($writer){ $out.= $writer->windowTag($this->WINDOW,$this->WINDOW_TITLE, $this->DIV); return $out; } } ?>
<?php class DefaultScreen extends RialtoPHPScreen { public $DIV = "document.body"; public $WINDOW = "myWindow"; public $WINDOW_TITLE = "My Title"; public $CADRE = "boxDemo"; public $ICON = "images/imgFenSimple/picto-gr_recherchepatients.gif"; public function doPrint($writer){ $out.= $writer->windowTag($this->WINDOW,$this->WINDOW_TITLE, $this->DIV); $out.= $writer->frameTag($this->CADRE, "30", "30", "300", "120", "Box Title", "false", "false", "relative", "false", $this->WINDOW); return $out; } } ?>
<?php class DefaultScreen extends RialtoPHPScreen { public $DIV = "document.body"; public $WINDOW = "myWindow"; public $WINDOW_TITLE = "My Title"; public $CADRE = "boxDemo"; public $FORM = "myForm"; public $URL = "do.php"; public $ICON = "images/imgFenSimple/picto-gr_recherchepatients.gif"; public function doPrint($writer){ $out.= $writer->windowTag($this->WINDOW,$this->WINDOW_TITLE, $this->DIV); $out.= $writer->frameTag($this->CADRE, "30", "30", "300", "120", "Box Title", "false", "false", "relative", "false", $this->WINDOW); $out.= $writer->formTag($this->FORM,$this->URL,$this->CADRE); return $out; } } ?>
<?php class DefaultScreen extends RialtoPHPScreen { public $DIV = "document.body"; public $WINDOW = "myWindow"; public $WINDOW_TITLE = "My Title"; public $CADRE = "boxDemo"; public $FORM = "myForm"; public $URL = "do.php"; public $ICON = "images/imgFenSimple/picto-gr_recherchepatients.gif"; public function doPrint($writer){ $out.= $writer->windowTag($this->WINDOW,$this->WINDOW_TITLE, $this->DIV); $out.= $writer->frameTag($this->CADRE, "30", "30", "300", "120", "Box Title", "false", "false", "relative", "false", $this->WINDOW); $out.= $writer->formTag($this->FORM,$this->URL,$this->CADRE); $out.= $writer->labelTag("lib1", "25", "10", "Username :", $this->FORM); $out.= $writer->buttonTag("doLogon", "Logon", "90", "50", "", array('FORM',$this->FORM), $this->FORM); $out.= $writer->buttonTag("default", "Cancel", "90", "170", "", "", $this->FORM); return $out; } } ?>
<?php class DefaultScreen extends RialtoPHPScreen { public $DIV = "document.body"; public $WINDOW = "myWindow"; public $WINDOW_TITLE = "My Title"; public $CADRE = "boxDemo"; public $FORM = "myForm"; public $URL = "do.php"; public $ICON = "images/imgFenSimple/picto-gr_recherchepatients.gif"; public function doPrint($writer){ $out.= $writer->windowTag($this->WINDOW,$this->WINDOW_TITLE, $this->DIV); $out.= $writer->frameTag($this->CADRE, "30", "30", "300", "120", "Box Title", "false", "false", "relative", "false", $this->WINDOW); $out.= $writer->formTag($this->FORM,$this->URL,$this->CADRE); $out.= $writer->labelTag("lib1", "25", "10", "Username :", $this->FORM); $out.= $writer->textTag("login","25", "90", "200", "A", $this->FORM,"false", "true", ""); $out.= $writer->buttonTag("doLogon", "Logon", "90", "50", "", array('FORM',$this->FORM), $this->FORM); $out.= $writer->buttonTag("default", "Cancel", "90", "170", "", "", $this->FORM); return $out; } } ?>
<?php class DefaultScreen extends RialtoPHPScreen { public $DIV = "document.body"; public $WINDOW = "myWindow"; public $WINDOW_TITLE = "My Title"; public $CADRE = "boxDemo"; public $FORM = "myForm"; public $URL = "do.php"; public $ICON = "images/imgFenSimple/picto-gr_recherchepatients.gif"; public function doPrint($writer){ $out.= $writer->windowTag($this->WINDOW,$this->WINDOW_TITLE, $this->DIV); $out.= $writer->frameTag($this->CADRE, "30", "30", "300", "120", "Box Title", "false", "false", "relative", "false", $this->WINDOW); $out.= $writer->formTag($this->FORM,$this->URL,$this->CADRE); $out.= $writer->labelTag("lib1", "25", "10", "Username :", $this->FORM); $out.= $writer->textTag("login","25", "90", "200", "A", $this->FORM,"false", "true", ""); $out.= $writer->labelTag("lib2", "55", "10", "Password :", $this->FORM); $out.= $writer->textTag("pass","55", "90", "200", "P", $this->FORM, "false", "true", ""); $out.= $writer->buttonTag("doLogon", "Logon", "90", "50", "", array('FORM',$this->FORM), $this->FORM); $out.= $writer->buttonTag("default", "Cancel", "90", "170", "", "", $this->FORM); return $out; } } ?>
<?php // +----------------------------------------------------------------------+ // | RIALTO PHP 1.0 | // +----------------------------------------------------------------------+ // | Authors: Damien VIEL (damien.viel@improve.fr) | // +----------------------------------------------------------------------+ session_start(); include "../rialtoPHP/RialtoPHPConfig.php"; include "../rialtoPHP/RialtoPHPWriter.php"; include "../rialtoPHP/RialtoPHPTag.php"; include "../rialtoPHP/RialtoPHPScreen.php"; include "../rialtoPHP/tags/AlertTag.php"; include "../rialtoPHP/tags/ButtonTag.php"; include "../rialtoPHP/tags/FrameTag.php"; include "../rialtoPHP/tags/ComboTag.php"; include "../rialtoPHP/tags/FormTag.php"; include "../rialtoPHP/tags/GridTag.php"; include "../rialtoPHP/tags/ImportTag.php"; include "../rialtoPHP/tags/LayoutTag.php"; include "../rialtoPHP/tags/LabelTag.php"; include "../rialtoPHP/tags/PopUpTag.php"; include "../rialtoPHP/tags/TextTag.php"; include "../rialtoPHP/tags/CheckBoxTag.php"; include "../rialtoPHP/tags/WindowTag.php"; include "../rialtoPHP/tags/SplitterTag.php"; include "../rialtoPHP/tags/TreeviewTag.php"; include "../rialtoPHP/tags/TreeNodeTag.php"; include "../rialtoPHP/tags/CallBackTag.php"; include "../rialtoPHP/tags/RadioTag.php"; include "../rialtoPHP/tags/ImageTag.php"; include "../rialtoPHP/tags/CodeLabelTag.php"; include "../rialtoPHP/tags/TabFolderTag.php"; include "../rialtoPHP/tags/TabItemTag.php"; $writer = new RialtoPHPWriter(true,""); switch ($_GET[RIALTO_REQCODE]) { case doLogon : $error_msg = array (); if ($_GET["login"] == "") { array_push($error_msg, "Empty Username"); } if ($_GET["pass"] == "") { array_push($error_msg, "Empty password"); } if (sizeof($error_msg) == 0) { if ($_GET["login"] == "user" && $_GET["pass"] == "pass") { $_SESSION['isLog'] = true; $out.=$writer->getScreen("SuccessScreen"); } else { array_push($error_msg, "Unknown username/password"); } } if (sizeof($error_msg) > 0) { $out.=$writer->showAlert("",implode(",",$error_msg),""); } break; default: $out.= $writer->getScreen("DefaultScreen"); break; } echo $out; ?>
* Here is the index file
<?php // +----------------------------------------------------------------------+ // | RIALTO PHP 1.0 | // +----------------------------------------------------------------------+ // | Authors: Damien VIEL (damien.viel@improve.fr) | // +----------------------------------------------------------------------+ session_start(); include "../rialtoPHP/RialtoPHPConfig.php"; include "../rialtoPHP/RialtoPHPWriter.php"; include "../rialtoPHP/RialtoPHPTag.php"; include "../rialtoPHP/RialtoPHPScreen.php"; include "../rialtoPHP/tags/AlertTag.php"; include "../rialtoPHP/tags/ButtonTag.php"; include "../rialtoPHP/tags/FrameTag.php"; include "../rialtoPHP/tags/ComboTag.php"; include "../rialtoPHP/tags/FormTag.php"; include "../rialtoPHP/tags/GridTag.php"; include "../rialtoPHP/tags/ImportTag.php"; include "../rialtoPHP/tags/LayoutTag.php"; include "../rialtoPHP/tags/LabelTag.php"; include "../rialtoPHP/tags/PopUpTag.php"; include "../rialtoPHP/tags/TextTag.php"; include "../rialtoPHP/tags/CheckBoxTag.php"; include "../rialtoPHP/tags/WindowTag.php"; include "../rialtoPHP/tags/SplitterTag.php"; include "../rialtoPHP/tags/TreeviewTag.php"; include "../rialtoPHP/tags/TreeNodeTag.php"; include "../rialtoPHP/tags/CallBackTag.php"; include "../rialtoPHP/tags/RadioTag.php"; include "../rialtoPHP/tags/ImageTag.php"; include "../rialtoPHP/tags/CodeLabelTag.php"; include "../rialtoPHP/tags/TabFolderTag.php"; include "../rialtoPHP/tags/TabItemTag.php"; $writer = new RialtoPHPWriter(false,'myWindow'); echo $writer->addImport(); ?>
You can dowload the complete tutorial in the download page