PHP Classes

File: examples.php

Recommend this page to a friend!
  Classes of John Smith   nDialog   examples.php   Download  
File: examples.php
Role: Example script
Content type: text/plain
Description: Shows how to use the nDialog object
Class: nDialog
Display dialog windows in text consoles
Author: By
Last change: Major changes to class methods.
Date: 17 years ago
Size: 3,279 bytes
 

Contents

Class file image Download
#!/usr/local/bin/php
<?
require_once("nDialog.class.php");



$Dialog = new nDialog();

// Set a top title bar
$Dialog->set("title_page_header", " Example v.1.1.0 ");





// ********** Example: Checklist
$Dialog->mode("checklist","18x52");
$Dialog->set("text","This is a checkbox selection.\nWe are testing the checkboxes.");
$Dialog->addChecklist("field-a","Apples","A", "Red & Green Apples",1,true);
$Dialog->addChecklist("field-b","Meats","M", "Beef, Pork",2,false);
$Dialog->addChecklist("field-c","Seafood","f", "Fish, Shrimp",3,true);
$Dialog->addChecklist("field-d","Vegi","V", "Garden Greens",4,true);
$Dialog->addChecklist("field-e","Grains","G", "Flour, Nuts",5,false);
$Dialog->set("title_dialog_header", " Food List ");
// Show dialog box & get user input
$result = $Dialog->stroke();
// Properly cleanup the screen
$Dialog->distroy();
// Show what results we got back
print"Return value:\n";var_dump($result);






/*
// ********** Example: Menu
$Dialog->mode("menu","18x62");
$Dialog->set("text","This is a menu test.\nWe are testing the menu.\nHit go");
$Dialog->set("title_dialog_header", " Main Menu ");
$Dialog->addMenu("Standard","S", "Begin standard installation",1);
$Dialog->addMenu("Express","E", "Express installation",2);
$Dialog->addMenu("Keymap","K", "Define Keymaps",3);
$Dialog->addMenu("Options","O", "View/Set Options",4);
$Dialog->addMenu("Run","R", "Start the process",5);
// Show dialog box & get user input
$result = $Dialog->stroke();
// Properly cleanup the screen
$Dialog->distroy();
// Show what results we got back
print"Return value:\n";var_dump($result);
*/





/*
// ********** Example: Notice
$Dialog->mode("notice","");
$Dialog->set("text","\nA notice box is great\nfor informing people while\na proccess continues...\n");
$Dialog->set("title_dialog_header", " Please Wait ");
// Show dialog box & get user input
$result = $Dialog->stroke();
// keep going - do work...
sleep(3);
// Properly cleanup the screen
$Dialog->distroy();
*/




/*
// ********** Example: Message Dialog
$Dialog->mode("msgbox","8x40");
$Dialog->set("text","This is a simple message box. Please press <enter> to continue.");
// Show dialog box & get user input
$result = $Dialog->stroke();
// Properly cleanup the screen
$Dialog->distroy();
// Show what results we got back
print"Return value:\n";var_dump($result);
*/




/*
// ********** Example: Yes/No box
$Dialog->mode("yesno","7x35");
$Dialog->set("text","\nContinue?");
$Dialog->set("title_dialog_header", "");
// Show dialog box & get user input
$result = $Dialog->stroke();
// Properly cleanup the screen
$Dialog->distroy();
// Show what results we got back
print"Return value:\n";var_dump($result);
*/







/*
// ********** Example: Inputbox
$Dialog->mode("inputbox","10x40");
$Dialog->set("title_dialog_header", " Age Check ");
$Dialog->set("text","\nPlease enter your current age:");
$Dialog->set("length",10);
$Dialog->set("default_val","34");
// Show dialog box & get user input
$result = $Dialog->stroke();
// Properly cleanup the screen
$Dialog->distroy();
// Show what results we got back
print"Return value:\n";var_dump($result);
*/











exit;
?>