PHP Classes
elePHPant
Icontem

File: console_example2.phpc

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Alex Mavrin  >  easy_console  >  console_example2.phpc  >  Download  
File: console_example2.phpc
Role: Example script
Content type: text/plain
Description: Second example
Class: easy_console
Process and execute comands from the command line
Author: By
Last change:
Date: 6 years ago
Size: 1,735 bytes
 

Contents

Class file image Download
<?php

/**PreInit**************************************************************/
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
/**PreInit**************************************************************/

require_once ('include/easy_console.php');


  
/**
    * Some class, wich we will use as command source
    * this is example wich was with Console class
    * it works wirh easy_console too.
    */


   
class Some_User_Class
   
{
        private
$email;
        private
$forename;
        private
$surname;

        public function
SetEmail()
        {
           
Console::ClearScreen();

            echo
"Please enter your email address: ";
           
$this->email = rtrim(Console::GetLine());
        }

        public function
SetForename()
        {
           
Console::ClearScreen();

            echo
"Please enter your forename: ";
           
$this->forename = rtrim(Console::GetLine());
        }

        public function
SetSurname()
        {
           
Console::ClearScreen();

            echo
"Please enter your surname: ";
           
$this->surname = rtrim(Console::GetLine());
        }

        public function
ShowConfig()
        {
           
Console::ClearScreen();

            echo
" Current Configuration\n =====================\n\n";

            echo
"Email........: ", $this->email, "\n";
            echo
"Forename.....: ", $this->forename, "\n";
            echo
"Surname......: ", $this->surname, "\n";
            echo
"\n\nPlease press enter to continue... [Enter]";

           
Console::Pause();
        }
    }

$x= new Some_User_Class();

easy_console::StartCommandLoop($x);

system('PAUSE');
?>