Commands
[ class tree: Commands ] [ index: Commands ] [ all elements ]

Source for file HelloWorldCommand.php

Documentation is available at HelloWorldCommand.php

  1. <?php
  2. /**
  3.  * MVClasses
  4.  *
  5.  * LICENSE
  6.  *
  7.  * "THE BEER-WARE LICENSE" (Revision 42):
  8.  * "Sven Strittmatter" <ausserirdisch@sven-space.de> wrote this file.
  9.  * As long as you retain this notice you can do whatever you want with
  10.  * this stuff. If we meet some day, and you think this stuff is worth it,
  11.  * you can buy me a beer in return.
  12.  *
  13.  * @category    MVClasses
  14.  * @package     Commands
  15.  * @copyright   Copyright (c) 2007 Sven Strittmatter
  16.  */
  17.  
  18.  /**
  19.   * @see Command
  20.   */
  21. require_once dirname(__FILE__)."/Command.php";
  22.  
  23. /**
  24.  * HelloWorldCommand gibt eine Begruessung aus.
  25.  * 
  26.  * Das HelloWorldCommand erwartet vom uebergebenen Request-Objekt
  27.  * einen Parameter name udn gibt eine Willkiommensbotschaft an das
  28.  * Response-Objekt. Fals der name-Parameter nicht gesetzt ist wird
  29.  * als Name "Unbekannter" ausgegeben.
  30.  * 
  31.  * @category    MVClasses
  32.  * @package     Commands
  33.  * @copyright     Copyright (c) 2007 Sven Strittmatter
  34.  * @author    "Sven Strittmatter" <ausserirdisch@sven-space.de>
  35.  * @version     1.0
  36.  * @link    http://www.sven-space.de/code/php/MVClasses
  37.  */
  38. class HelloWorldCommand implements Command {
  39.     /**
  40.      * Fuehrt das Command aus.
  41.      *
  42.      * @access     public
  43.      * @param    Request $req 
  44.      * @param    Response $res 
  45.      */
  46.     public function execute(Request $reqResponse $res{
  47.         $view new TemplateView(dirname(__FILE__)."/../Views/HelloWorld.php");
  48.  
  49.         if ($req->issetParameter("name"HttpRequest::GLOBALS_GET)) {
  50.             $view->assign("name"$req->getParameter("name"));
  51.         else {
  52.             $view->assign("name""Unbekannter");
  53.         }
  54.  
  55.         $view->render($req$res);
  56.     }
  57. }

Documentation generated on Sun, 02 Aug 2009 17:14:58 +0200 by phpDocumentor 1.4.2