CLICK HERE TO BUY IT TODAY! OR GET IT FREE VIA TRIALPAY  

PHP Demo Application - Source Code

/Application/Controller/Front.php

<?php
/**
* Script Contents: Apeel_Application_Controller_Front Class
* extends Apeel_Application_Controller_Abstract Class
* @package Apeel_Application_Controller
*/

/**
* Include Abstract Base Class to provide core functionality.  
*/
require('_Abstract.php');

/**
* Concrete Class containing methods that map keywords to physical routes.  
*
* @package      Apeel_Application_Controller
* @version      1.1.0
* @author       John W. King (email: contact@apeelframework.net)
* @copyright    City Business Logic Limited 2001-2011
* @license      Dual MIT / GNU Lesser General Public License Version 3
*/
class Apeel_Application_Controller_Front extends Apeel_Application_Controller_Abstract {
    
    
/**
    * Reads first Keyword (if any) and calls the appropriate method to handle 
    * it.  
    * 
    * Add new sections to your application by creating new methods to handle
    * them, based on the functionality of the default methods.  .  
    * 
    * @return void
    */    
    
public function processRequest() {
        switch(
Apeel_Framework_Controller_Libraries_Input::getArrayValueByIndex($this->_keywords'0')) {
            case 
'REQUEST':
                
$this->routeRequest();
                break;
            case 
'ADMIN':
                
$this->routeAdmin();
                break;
            default:
                
$this->routePublic();
                break;                
        }
    }
    
    
    
/**
    * Loads the default page when no keywords supplied, or possibly when 
    * Keyword invalid.  
    * 
    * Called by processRequest(...) method.  
    * 
    * @return void
    */    
    
public function routeDefault() {
        
$pageToLoad 'default.php';
        
$title APEEL_LANGUAGE_WELCOME_TO ' Apeel PHP Code Code Generator Pro Demo';
        if (
$pageToLoad) {
            
$this->loadPage($pageToLoad$title);
        }                
    }    
    
    
    
/**
    * Handles requests for Request Handler Objects (e.g. files, JSON data etc).  
    * 
    * If you add your own Request Handlers remember to add them to this method.  
    * 
    * @return void
    */
    
public function routeRequest() {
        
        
Apeel_Framework_Model_Handlers_Error::initErrorHandling(APEEL_DEBUG_MODEfalse);
        
Apeel_Framework_Controller_Libraries_Input::clearCache();
            
        switch(
Apeel_Framework_Controller_Libraries_Input::getArrayValueByIndex($this->_keywords'1')) {
            case 
'AUTOCOMPLETE':
                
ob_start();
                require(
APEEL_BASE_FILE_PATH 'Framework/Model/RequestHandlers/PopulateAutocomplete.php');
                break;
            case 
'DELETE':
                
ob_start();
                require(
APEEL_BASE_FILE_PATH 'Framework/Model/RequestHandlers/DeleteData.php');
                break;
            case 
'DROPDOWN':
                
ob_start();
                require(
APEEL_BASE_FILE_PATH 'Framework/Model/RequestHandlers/PopulateDropdown.php');
                break;
            case 
'EXPORT':
                require(
APEEL_BASE_FILE_PATH 'Framework/Model/RequestHandlers/ExportData.php');
                break;
            case 
'FILE':
                require(
APEEL_BASE_FILE_PATH 'Framework/Model/RequestHandlers/GetFile.php');
                break;
            case 
'FORM':
                
ob_start();
                require(
APEEL_BASE_FILE_PATH 'Framework/Model/RequestHandlers/GetForm.php');
                break;
            case 
'GRID_DATA':
                
ob_start();
                require(
APEEL_BASE_FILE_PATH 'Framework/Model/RequestHandlers/PopulateGrid.php');
                break;
            case 
'ICON':
                require(
APEEL_BASE_FILE_PATH 'Framework/Model/RequestHandlers/GetIcon.php');
                break;
            case 
'IMAGE':
                require(
APEEL_BASE_FILE_PATH 'Framework/Model/RequestHandlers/ShowImage.php');
                break;
            case 
'SEARCH_FORM':
                
ob_start();
                require(
APEEL_BASE_FILE_PATH 'Framework/Model/RequestHandlers/SearchForm.php');
                break;
            case 
'SAVE':
                
ob_start();
                require(
APEEL_BASE_FILE_PATH 'Framework/Model/RequestHandlers/SaveData.php');
                break;
            case 
'LOGIN':
                require(
APEEL_BASE_FILE_PATH 'Framework/Model/RequestHandlers/ValidateCredentials.php');
                break;
            case 
'LOGOUT':
                require(
APEEL_BASE_FILE_PATH 'Framework/Model/RequestHandlers/Logout.php');
                break;
            case 
'HELP':
                require(
APEEL_BASE_FILE_PATH 'Framework/Model/RequestHandlers/GetHelp.php');
                break;
        }
    }
    
    
    
/**
    * Processes requests for Public pages.  
    * 
    * When you add public pages to your application remember to add them to
    * this method.  
    * 
    * @return void
    */
    
private function routePublic() {

        
ob_start();
        
Apeel_Framework_Model_Handlers_Error::initErrorHandling(APEEL_DEBUG_MODEtrueAPEEL_ERROR_TEMPLATE);
        
        
$helpFile 'Default.html';
        
$pageToLoad '';
        
$title '';
        
        switch(
Apeel_Framework_Controller_Libraries_Input::getArrayValueByIndex($this->_keywords'1')) {            
            default:
                
$this->routeDefault();
                exit;
                break;
        }
        
        if (
$pageToLoad) {
            
$this->loadPage($pageToLoad$title$helpFile);
        }
    }
    

    
/**
    * Processes requests for Private Admin pages.  
    * 
    * If user not logged in, they will be routed to default page.
    * 
    * When you add public pages to your application remember to add them to
    * this method.  
    * 
    * @return void
    */
    
private function routeAdmin() {

        
ob_start();
        
Apeel_Framework_Model_Handlers_Error::initErrorHandling(APEEL_DEBUG_MODEtrueAPEEL_ERROR_TEMPLATE);
        
        
$helpFile 'Admin.html';
        
$pageToLoad '';
        
$title '';
        
        if (
Apeel_Framework_Controller_Libraries_Input::session('APEEL_LOGGED_IN'0) == 0) {
            
$this->routeDefault();
            exit;
        }
        
        switch(
Apeel_Framework_Controller_Libraries_Input::getArrayValueByIndex($this->_keywords'1')) {                        
            case 
'ACTOR':
                
$pageToLoad 'Actor.php';
                
$title 'Admin - Actor maintenance';
                break;
            case 
'ADDRESS':
                
$pageToLoad 'Address.php';
                
$title 'Admin - Address maintenance';
                break;
            case 
'CATEGORY':
                
$pageToLoad 'Category.php';
                
$title 'Admin - Category maintenance';
                break;
            case 
'CITY':
                
$pageToLoad 'City.php';
                
$title 'Admin - City maintenance';
                break;
            case 
'COUNTRY':
                
$pageToLoad 'Country.php';
                
$title 'Admin - Country maintenance';
                break;
            case 
'CUSTOMER':
                
$pageToLoad 'Customer.php';
                
$title 'Admin - Customer maintenance';
                break;
            case 
'FILM':
                
$pageToLoad 'Film.php';
                
$title 'Admin - Film maintenance';
                break;
            case 
'FILM_TEXT':
                
$pageToLoad 'Film_text.php';
                
$title 'Admin - Film Text maintenance';
                break;
            case 
'INVENTORY':
                
$pageToLoad 'Inventory.php';
                
$title 'Admin - Inventory maintenance';
                break;
            case 
'LANGUAGE':
                
$pageToLoad 'Language.php';
                
$title 'Admin - Language maintenance';
                break;
            case 
'PAYMENT':
                
$pageToLoad 'Payment.php';
                
$title 'Admin - Payment maintenance';
                break;
            case 
'RENTAL':
                
$pageToLoad 'Rental.php';
                
$title 'Admin - Rental maintenance';
                break;
            case 
'STAFF':
                
$pageToLoad 'Staff.php';
                
$title 'Admin - Staff maintenance';
                break;
            case 
'STORE':
                
$pageToLoad 'Store.php';
                
$title 'Admin - Store maintenance';
                break;

            default:
                
$this->routeDefault();
                exit;
                break;                
        }
        
        if (
$pageToLoad) {
            
$this->loadPage($pageToLoad$title$helpFile);
        }
    }    
}


?>

PHP Demo Source Code Index