Your browser must have JavaScript enabled in order to view this page.
 >  >
 
Welcome Guest#214 Login/register    Go to Bottom
Go to Top

Source for file note.php

Documentation is available at note.php

  1. <?php
  2. /**
  3.  * A small note that users can read
  4.  *
  5.  * DutchPIPE version 0.4; PHP version 5
  6.  *
  7.  * LICENSE: This source file is subject to version 1.0 of the DutchPIPE license.
  8.  * If you did not receive a copy of the DutchPIPE license, you can obtain one at
  9.  * http://dutchpipe.org/license/1_0.txt or by sending a note to
  10.  * license@dutchpipe.org, in which case you will be mailed a copy immediately.
  11.  *
  12.  * @package    DutchPIPE
  13.  * @subpackage dpuniverse_obj
  14.  * @author     Lennert Stock <ls@dutchpipe.org>
  15.  * @copyright  2006, 2007 Lennert Stock
  16.  * @license    http://dutchpipe.org/license/1_0.txt  DutchPIPE License
  17.  * @version    Subversion: $Id: note.php 308 2007-09-02 19:18:58Z ls $
  18.  * @link       http://dutchpipe.org/manual/package/DutchPIPE
  19.  * @see        DpObject
  20.  */
  21.  
  22. /**
  23.  * Builts upon the standard DpObject class
  24.  */
  25. inherit(DPUNIVERSE_STD_PATH 'DpObject.php');
  26.  
  27. /**
  28.  * A small note that users can read
  29.  *
  30.  * @package    DutchPIPE
  31.  * @subpackage dpuniverse_obj
  32.  * @author     Lennert Stock <ls@dutchpipe.org>
  33.  * @copyright  2006, 2007 Lennert Stock
  34.  * @license    http://dutchpipe.org/license/1_0.txt  DutchPIPE License
  35.  * @version    Release: 0.2.1
  36.  * @link       http://dutchpipe.org/manual/package/DutchPIPE
  37.  * @see        DpObject
  38.  */
  39. final class Note extends DpObject
  40. {
  41.     /**
  42.      * Sets up the object at object creation time
  43.      */
  44.     public function createDpObject()
  45.     {
  46.         $this->title dp_text('small note');
  47.         $this->titleDefinite dp_text('the small note');
  48.         $this->titleIndefinite dp_text('a small note');
  49.         $this->titleImg DPUNIVERSE_IMAGE_URL 'smallnote.gif';
  50.         $this->titleImgWidth 35;
  51.         $this->titleImgHeight 46;
  52.         $this->addId(explode('#',
  53.             dp_text('note#paper note#small note#small paper note#small, paper note#a small note')));
  54.         $this->body '<img src="' DPUNIVERSE_IMAGE_URL
  55.             . 'smallnote.gif" width="35" height="46" border="0" alt="" '
  56.             . 'align="left" style="margin-right: 15px" /><br />'
  57.             . dp_text('This is a small paper note. You can read it.<br />');
  58.  
  59.         $this->value 0.99;
  60.  
  61.         if (WEIGHT_TYPE_NONE !== WEIGHT_TYPE{
  62.             $this->coinherit(DPUNIVERSE_STD_PATH 'mass.php');
  63.             if (WEIGHT_TYPE_ABSTRACT === WEIGHT_TYPE{
  64.                 $this->weight 1;
  65.             elseif (WEIGHT_TYPE_METRIC === WEIGHT_TYPE{
  66.                 $this->weight 3/* Grams */
  67.             elseif (WEIGHT_TYPE_USA === WEIGHT_TYPE{
  68.                 $this->weight 0.1/* Ounces */
  69.             }
  70.         }
  71.         if (VOLUME_TYPE_NONE !== VOLUME_TYPE{
  72.             $this->coinherit(DPUNIVERSE_STD_PATH 'mass.php');
  73.             if (VOLUME_TYPE_ABSTRACT === VOLUME_TYPE{
  74.                 $this->volume 1;
  75.             elseif (VOLUME_TYPE_METRIC === VOLUME_TYPE{
  76.                 $this->volume 5;
  77.             elseif (VOLUME_TYPE_USA === VOLUME_TYPE{
  78.                 $this->volume 0.17;
  79.             }
  80.         }
  81.  
  82.         $this->addAction(dp_text('read me!')dp_text('read')'actionRead');
  83.     }
  84.  
  85.     /**
  86.      * Performs the 'read' action
  87.      *
  88.      * @param   string  $verb   The name or verb part of the action, "read"
  89.      * @param   string  $noun   The given id, noun or remainder, "note"
  90.      * @return  boolean         FALSE in case of failure, TRUE for success
  91.      */
  92.     public function actionRead($verb$noun)
  93.     {
  94.         /* Replies to object entering "read" */
  95.         if (!dp_strlen($noun)) {
  96.             get_current_dpobject()->setActionFailure(
  97.                 dp_text('What do you want to read?<br />'));
  98.             return FALSE;
  99.         }
  100.  
  101.         /* Replies to object entering "read noet" (typo) */
  102.         if (FALSE === $this->isId($noun)) {
  103.             get_current_dpobject()->setActionFailure(
  104.                 dp_text('Read WHAT?<br />'));
  105.             return FALSE;
  106.         }
  107.  
  108.         /* Shows a nice window with content */
  109.         get_current_dpobject()->tell('<window>' dp_text('Hello world.')
  110.             . '</window>');
  111.         return TRUE;
  112.     }
  113. }
  114. ?>

Documentation generated on Mon, 03 Sep 2007 22:22:13 +0200 by phpDocumentor 1.3.0RC6

Click me!
Guest#214
 
 
 
  Go to Top
 
 
Input Field OptionsClose Input Field Go to Top
 
Legal Notices | Copyright © 2006, 2007 Lennert Stock. All rights reserved. Last update: Mon Sep 03 2007, 21:50 CET.