home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / HTML / Progress2 / Monitor.php < prev    next >
Encoding:
PHP Script  |  2008-07-02  |  21.9 KB  |  655 lines

  1. <?php
  2. /**
  3.  * Copyright (c) 2005-2008, Laurent Laville <pear@laurent-laville.org>
  4.  *
  5.  * All rights reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  *
  11.  *     * Redistributions of source code must retain the above copyright
  12.  *       notice, this list of conditions and the following disclaimer.
  13.  *     * Redistributions in binary form must reproduce the above copyright
  14.  *       notice, this list of conditions and the following disclaimer in the
  15.  *       documentation and/or other materials provided with the distribution.
  16.  *     * Neither the name of the authors nor the names of its contributors
  17.  *       may be used to endorse or promote products derived from this software
  18.  *       without specific prior written permission.
  19.  *
  20.  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  21.  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  23.  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
  24.  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  25.  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  26.  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  27.  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  28.  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  29.  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  30.  * POSSIBILITY OF SUCH DAMAGE.
  31.  *
  32.  * PHP versions 4 and 5
  33.  *
  34.  * @category  HTML
  35.  * @package   HTML_Progress2
  36.  * @author    Laurent Laville <pear@laurent-laville.org>
  37.  * @copyright 2005-2008 Laurent Laville
  38.  * @license   http://www.opensource.org/licenses/bsd-license.php  New BSD License
  39.  * @version   CVS: $Id: Monitor.php,v 1.13 2008/03/20 21:27:55 farell Exp $
  40.  * @link      http://pear.php.net/package/HTML_Progress2
  41.  * @since     File available since Release 2.0.0RC1
  42.  */
  43.  
  44. require_once 'HTML/Progress2.php';
  45. require_once 'HTML/QuickForm.php';
  46.  
  47. /**
  48.  * Monitoring of HTML loading bar into a dialog box.
  49.  *
  50.  * The HTML_Progress2_Monitor class allow an easy way to display progress bar
  51.  * into a dialog box, and observe all changes easily. User-end can stop task
  52.  * at anytime.
  53.  *
  54.  * Here is a basic example:
  55.  * <code>
  56.  * <?php
  57.  * require_once 'HTML/Progress2/Monitor.php';
  58.  *
  59.  * $pm = new HTML_Progress2_Monitor();
  60.  *
  61.  * $pb =& $pm->getProgressElement();
  62.  * $pb->setAnimSpeed(200);
  63.  * $pb->setIncrement(10);
  64.  * ?>
  65.  * <html>
  66.  * <head>
  67.  * <?php
  68.  * echo $pm->getStyle(false);
  69.  * echo $pm->getScript(false);
  70.  * ?>
  71.  * </head>
  72.  * <body>
  73.  * <?php
  74.  * $pm->display();
  75.  * $pm->run();
  76.  * ?>
  77.  * </body>
  78.  * </html>
  79.  * </code>
  80.  *
  81.  * @category  HTML
  82.  * @package   HTML_Progress2
  83.  * @author    Laurent Laville <pear@laurent-laville.org>
  84.  * @copyright 2005-2008 Laurent Laville
  85.  * @license   http://www.opensource.org/licenses/bsd-license.php  New BSD License
  86.  * @version   Release: 2.4.0
  87.  * @link      http://pear.php.net/package/HTML_Progress2
  88.  * @since     Class available since Release 2.0.0RC1
  89.  */
  90.  
  91. class HTML_Progress2_Monitor
  92. {
  93.     /**
  94.      * Instance-specific unique identification number.
  95.      *
  96.      * @var        integer
  97.      * @since      2.0.0
  98.      * @access     private
  99.      */
  100.     var $_id;
  101.  
  102.     /**#@+
  103.      * Attributes of monitor form.
  104.      *
  105.      * @var        string
  106.      * @since      2.0.0
  107.      * @access     public
  108.      */
  109.     var $windowname;
  110.     var $buttonStart;
  111.     var $buttonCancel;
  112.     var $autorun;
  113.     /**#@-*/
  114.  
  115.     /**
  116.      * Monitor status (text label of progress bar).
  117.      *
  118.      * @var        array
  119.      * @since      2.0.0
  120.      * @access     public
  121.      */
  122.     var $caption = array();
  123.  
  124.     /**
  125.      * The progress object renders into this monitor.
  126.      *
  127.      * @var        object
  128.      * @since      2.0.0
  129.      * @access     private
  130.      */
  131.     var $_progress;
  132.  
  133.     /**
  134.      * The quickform object that allows the presentation.
  135.      *
  136.      * @var        object
  137.      * @since      2.0.0
  138.      * @access     private
  139.      */
  140.     var $_form;
  141.  
  142.     /**
  143.      * Stores the event dispatcher which handles notifications
  144.      *
  145.      * @var        array
  146.      * @since      2.0.0RC2
  147.      * @access     protected
  148.      */
  149.     var $dispatcher;
  150.  
  151.     /**
  152.      * Count the number of observer registered.
  153.      * The Event_Dispatcher will be add on first observer registration, and
  154.      * will be removed with the last observer.
  155.      *
  156.      * @var        integer
  157.      * @since      2.0.0RC2
  158.      * @access     private
  159.      */
  160.     var $_observerCount;
  161.  
  162.  
  163.     /**
  164.      * Constructor (ZE1)
  165.      *
  166.      * @param string $formName   (optional) Name of monitor dialog box (QuickForm)
  167.      * @param array  $attributes (optional) List of renderer options
  168.      * @param array  $errorPrefs (optional) Hash of parameters
  169.      *                                      to configure error handler
  170.      *
  171.      * @since      version 2.0.0 (2005-10-01)
  172.      * @access     public
  173.      */
  174.     function HTML_Progress2_Monitor($formName = 'ProgressMonitor',
  175.                                     $attributes = array(),
  176.                                     $errorPrefs = array())
  177.     {
  178.         $this->__construct($formName, $attributes, $errorPrefs);
  179.     }
  180.  
  181.     /**
  182.      * Constructor (ZE2) Summary
  183.      *
  184.      * o Creates a standard progress bar into a dialog box (QuickForm).
  185.      *   Form name, buttons 'start', 'cancel' labels and style, and
  186.      *   title of dialog box may also be changed.
  187.      *   <code>
  188.      *   $monitor = new HTML_Progress2_Monitor();
  189.      *   </code>
  190.      *
  191.      * o Creates a progress bar into a dialog box, with only a new
  192.      *   form name.
  193.      *   <code>
  194.      *   $monitor = new HTML_Progress2_Monitor($formName);
  195.      *   </code>
  196.      *
  197.      * o Creates a progress bar into a dialog box, with a new form name,
  198.      *   new buttons name and style, and also a different title box.
  199.      *   <code>
  200.      *   $monitor = new HTML_Progress2_Monitor($formName, $attributes);
  201.      *   </code>
  202.      *
  203.      * @param string $formName   (optional) Name of monitor dialog box (QuickForm)
  204.      * @param array  $attributes (optional) List of renderer options
  205.      * @param array  $errorPrefs (optional) Hash of parameters
  206.      *                                      to configure error handler
  207.      *
  208.      * @since      version 2.0.0 (2005-10-01)
  209.      * @access     protected
  210.      * @throws     HTML_PROGRESS2_ERROR_INVALID_INPUT
  211.      */
  212.     function __construct($formName = 'ProgressMonitor',
  213.                          $attributes = array(),
  214.                          $errorPrefs = array())
  215.     {
  216.         $this->_progress = new HTML_Progress2($errorPrefs);
  217.  
  218.         if (!is_string($formName)) {
  219.             return $this->_progress->raiseError(HTML_PROGRESS2_ERROR_INVALID_INPUT,
  220.                 'exception',
  221.                 array('var' => '$formName',
  222.                       'was' => gettype($formName),
  223.                       'expected' => 'string',
  224.                       'paramnum' => 1));
  225.  
  226.         } elseif (!is_array($attributes)) {
  227.             return $this->_progress->raiseError(HTML_PROGRESS2_ERROR_INVALID_INPUT,
  228.                 'exception',
  229.                 array('var' => '$attributes',
  230.                       'was' => gettype($attributes),
  231.                       'expected' => 'array',
  232.                       'paramnum' => 2));
  233.  
  234.         }
  235.  
  236.         $this->_id            = md5(microtime());
  237.         $this->_observerCount = 0;
  238.  
  239.         $this->_form = new HTML_QuickForm($formName);
  240.         $this->_form->removeAttribute('name');        // XHTML compliance
  241.  
  242.         $captionAttr = array('id' => 'monitorStatus',
  243.                              'valign' => 'bottom', 'left' => 0);
  244.  
  245.         $this->windowname   = isset($attributes['title']) ?
  246.                                   $attributes['title']  : 'In progress ...';
  247.         $this->buttonStart  = isset($attributes['start']) ?
  248.                                   $attributes['start']  : 'Start';
  249.         $this->buttonCancel = isset($attributes['cancel']) ?
  250.                                   $attributes['cancel'] : 'Cancel';
  251.         $buttonAttr         = isset($attributes['button']) ?
  252.                                   $attributes['button'] : '';
  253.         $this->autorun      = isset($attributes['autorun']) ?
  254.                                   $attributes['autorun']: false;
  255.         $this->caption      = isset($attributes['caption']) ?
  256.                                   $attributes['caption']: $captionAttr;
  257.  
  258.         $this->_progress->addLabel(HTML_PROGRESS2_LABEL_TEXT, $this->caption['id']);
  259.         $captionAttr = $this->caption;
  260.         unset($captionAttr['id']);
  261.         $this->_progress->setLabelAttributes($this->caption['id'], $captionAttr);
  262.         $this->_progress->setProgressAttributes('top=0 left=0');
  263.  
  264.         $this->_form->addElement('header', 'windowname', $this->windowname);
  265.         $this->_form->addElement('static', 'progressBar');
  266.  
  267.         if ($this->isStarted()) {
  268.             $style = array('disabled'=>'true');
  269.         } else {
  270.             $style = null;
  271.         }
  272.  
  273.         $buttons[] =& $this->_form->createElement('submit', 'start',
  274.                                                   $this->buttonStart, $style);
  275.         $buttons[] =& $this->_form->createElement('submit', 'cancel',
  276.                                                   $this->buttonCancel);
  277.  
  278.         $buttons[0]->updateAttributes($buttonAttr);
  279.         $buttons[1]->updateAttributes($buttonAttr);
  280.  
  281.         $this->_form->addGroup($buttons, 'buttons', '', ' ', false);
  282.  
  283.         // default embedded progress element with look-and-feel
  284.         $this->setProgressElement($this->_progress);
  285.     }
  286.  
  287.     /**
  288.      * Adds a new observer.
  289.      *
  290.      * Adds a new observer to the Event Dispatcher that will listen
  291.      * for all messages emitted by this HTML_Progress2 instance.
  292.      *
  293.      * @param mixed $callback PHP callback that will act as listener
  294.      *
  295.      * @return     void
  296.      * @since      version 2.0.0 (2005-10-01)
  297.      * @access     public
  298.      * @throws     HTML_PROGRESS2_ERROR_INVALID_CALLBACK
  299.      * @see        removeListener()
  300.      */
  301.     function addListener($callback)
  302.     {
  303.         if (!is_callable($callback)) {
  304.             return $this->raiseError(HTML_PROGRESS2_ERROR_INVALID_CALLBACK,
  305.                 'exception',
  306.                 array('var' => '$callback',
  307.                       'element' => 'valid Class-Method/Function',
  308.                       'was' => 'callback',
  309.                       'paramnum' => 1));
  310.         }
  311.  
  312.         $this->dispatcher =& Event_Dispatcher::getInstance();
  313.         $this->dispatcher->addObserver($callback);
  314.         $this->_observerCount++;
  315.     }
  316.  
  317.     /**
  318.      * Removes a registered observer.
  319.      *
  320.      * This function removes a registered observer, and if there are no more
  321.      * observer, remove the event dispatcher interface too.
  322.      *
  323.      * @param mixed $callback PHP callback that act as listener
  324.      *
  325.      * @return     bool       True if observer was removed, false otherwise
  326.      * @since      version 2.0.0 (2005-10-01)
  327.      * @access     public
  328.      * @throws     HTML_PROGRESS2_ERROR_INVALID_CALLBACK
  329.      * @see        addListener()
  330.      */
  331.     function removeListener($callback)
  332.     {
  333.         if (!is_callable($callback)) {
  334.             return $this->raiseError(HTML_PROGRESS2_ERROR_INVALID_CALLBACK,
  335.                 'exception',
  336.                 array('var' => '$callback',
  337.                       'element' => 'valid Class-Method/Function',
  338.                       'was' => 'callback',
  339.                       'paramnum' => 1));
  340.         }
  341.  
  342.         $result = $this->dispatcher->removeObserver($callback);
  343.  
  344.         if ($result) {
  345.             $this->_observerCount--;
  346.             if ($this->_observerCount == 0) {
  347.                 unset($this->dispatcher);
  348.             }
  349.         }
  350.         return $result;
  351.     }
  352.  
  353.     /**
  354.      * Detect if progress monitor is started.
  355.      *
  356.      * This function returns TRUE if progress monitor was started by user,
  357.      * FALSE otherwise.
  358.      *
  359.      * @return     bool
  360.      * @since      version 2.0.0 (2005-10-01)
  361.      * @access     public
  362.      */
  363.     function isStarted()
  364.     {
  365.         $action = $this->_form->getSubmitValues();
  366.         return (isset($action['start']) || $this->autorun);
  367.     }
  368.  
  369.     /**
  370.      * Detect if progress monitor is stopped.
  371.      *
  372.      * This function returns TRUE if progress monitor was canceled by user,
  373.      * FALSE otherwise.
  374.      *
  375.      * @return     bool
  376.      * @since      version 2.0.0 (2005-10-01)
  377.      * @access     public
  378.      */
  379.     function isCanceled()
  380.     {
  381.         $action = $this->_form->getSubmitValues();
  382.         return (isset($action['cancel']));
  383.     }
  384.  
  385.     /**
  386.      * Runs the progress monitor.
  387.      *
  388.      * This function accept both modes: indeterminate and determinate,
  389.      * and execute all actions defined in the user callback identified by
  390.      * HTML_Progress2::setProgressHandler() method.
  391.      *
  392.      * All observers are also notified of main changes (start, stop meter).
  393.      *
  394.      * @return     void
  395.      * @since      version 2.0.0 (2005-10-01)
  396.      * @access     public
  397.      */
  398.     function run()
  399.     {
  400.         if ($this->isCanceled()) {
  401.             $this->_postNotification('onCancel',
  402.                                      array('handler' => __FUNCTION__,
  403.                                            'value' => $this->_progress->getValue()));
  404.         }
  405.         if ($this->isStarted()) {
  406.             $this->_progress->_status = 'show';
  407.  
  408.             $this->_postNotification('onSubmit',
  409.                                      array('handler' => __FUNCTION__,
  410.                                            'value' => $this->_progress->getValue()));
  411.             $this->_progress->run();
  412.             $this->_postNotification('onLoad',
  413.                                      array('handler' => __FUNCTION__,
  414.                                            'value' => $this->_progress->getValue()));
  415.         }
  416.     }
  417.  
  418.     /**
  419.      * Links a progress bar to this monitor.
  420.      *
  421.      * This function allow to define a complete progress bar from scratch.
  422.      *
  423.      * @param object &$bar a html_progress2 instance
  424.      *
  425.      * @return     void
  426.      * @since      version 2.0.0 (2005-10-01)
  427.      * @access     public
  428.      * @throws     HTML_PROGRESS2_ERROR_INVALID_INPUT
  429.      * @see        getProgressElement()
  430.      */
  431.     function setProgressElement(&$bar)
  432.     {
  433.         if (!is_a($bar, 'HTML_Progress2')) {
  434.             return $this->_progress->raiseError(HTML_PROGRESS2_ERROR_INVALID_INPUT,
  435.                 'exception',
  436.                 array('var' => '$bar',
  437.                       'was' => gettype($bar),
  438.                       'expected' => 'HTML_Progress2 object',
  439.                       'paramnum' => 1));
  440.         }
  441.         $this->_progress = $bar;
  442.  
  443.         $bar =& $this->_form->getElement('progressBar');
  444.         $bar->setText($this->_progress->toHtml());
  445.     }
  446.  
  447.     /**
  448.      * Returns a reference to the progress bar.
  449.      *
  450.      * This function returns a reference to the progress meter
  451.      * used with the monitor. Its allow to change easily part or all basic options.
  452.      *
  453.      * @return     object
  454.      * @since      version 2.0.0 (2005-10-01)
  455.      * @access     public
  456.      * @see        setProgressElement()
  457.      */
  458.     function &getProgressElement()
  459.     {
  460.         return $this->_progress;
  461.     }
  462.  
  463.     /**
  464.      * Returns the cascading style sheet (CSS).
  465.      *
  466.      * Get the CSS required to display the progress meter in a HTML document.
  467.      *
  468.      * @param boolean $raw (optional) html output with script tags or just raw data
  469.      *
  470.      * @return     string
  471.      * @since      version 2.0.0 (2005-10-01)
  472.      * @access     public
  473.      * @throws     HTML_PROGRESS2_ERROR_INVALID_INPUT
  474.      */
  475.     function getStyle($raw = true)
  476.     {
  477.         if (!is_bool($raw)) {
  478.             return $this->raiseError(HTML_PROGRESS2_ERROR_INVALID_INPUT,
  479.                 'exception',
  480.                 array('var' => '$raw',
  481.                       'was' => gettype($raw),
  482.                       'expected' => 'boolean',
  483.                       'paramnum' => 1));
  484.         }
  485.  
  486.         return $this->_progress->getStyle($raw);
  487.     }
  488.  
  489.     /**
  490.      * Returns javascript progress meter handler.
  491.      *
  492.      * Get the javascript URL or inline code that will handle the progress meter
  493.      * refresh.
  494.      *
  495.      * @param boolean $raw (optional) html output with script tags or just raw data
  496.      *
  497.      * @return     string
  498.      * @since      version 2.0.0 (2005-10-01)
  499.      * @throws     HTML_PROGRESS2_ERROR_INVALID_INPUT
  500.      * @access     public
  501.      */
  502.     function getScript($raw = true)
  503.     {
  504.         if (!is_bool($raw)) {
  505.             return $this->raiseError(HTML_PROGRESS2_ERROR_INVALID_INPUT,
  506.                 'exception',
  507.                 array('var' => '$raw',
  508.                       'was' => gettype($raw),
  509.                       'expected' => 'boolean',
  510.                       'paramnum' => 1));
  511.         }
  512.  
  513.         return $this->_progress->getScript($raw);
  514.     }
  515.  
  516.     /**
  517.      * Returns the progress monitor structure as HTML.
  518.      *
  519.      * Get html code required to display the progress monitor in any html document.
  520.      *
  521.      * @return     string
  522.      * @since      version 2.0.0 (2005-10-01)
  523.      * @access     public
  524.      */
  525.     function toHtml()
  526.     {
  527.         $barAttr = $this->_progress->getProgressAttributes();
  528.         $width   = $barAttr['width'] + 70;
  529.  
  530.         $formTpl = "\n<form{attributes}>"
  531.                  . "\n<div>"
  532.                  . "\n{hidden}"
  533.                  . "<table width=\"{$width}\" border=\"0\">"
  534.                  . "\n{content}"
  535.                  . "\n</table>"
  536.                  . "\n</div>"
  537.                  . "\n</form>";
  538.  
  539.         $renderer =& $this->_form->defaultRenderer();
  540.         $renderer->setFormTemplate($formTpl);
  541.  
  542.         return $this->_form->toHtml();
  543.     }
  544.  
  545.     /**
  546.      * Renders the initial state of progress monitor.
  547.      *
  548.      * This function should be used only to display initial state of the
  549.      * progress monitor with default QF renderer. If you use another QF renderer
  550.      * (Smarty, ITDynamic, ...) read template engine renderer related documentation.
  551.      *
  552.      * @return     void
  553.      * @since      version 2.0.0RC2 (2005-08-01)
  554.      * @access     public
  555.      */
  556.     function display()
  557.     {
  558.         echo $this->toHtml();
  559.     }
  560.  
  561.     /**
  562.      * Accepts a renderer.
  563.      *
  564.      * Accepts a QF renderer for design pattern.
  565.      *
  566.      * @param object &$renderer An HTML_QuickForm_Renderer object
  567.      *
  568.      * @return     void
  569.      * @since      version 2.0.0 (2005-10-01)
  570.      * @access     public
  571.      */
  572.     function accept(&$renderer)
  573.     {
  574.         if (!is_a($renderer, 'HTML_QuickForm_Renderer')) {
  575.             return $this->_progress->raiseError(HTML_PROGRESS2_ERROR_INVALID_INPUT,
  576.                 'exception',
  577.                 array('var' => '$renderer',
  578.                       'was' => gettype($renderer),
  579.                       'expected' => 'HTML_QuickForm_Renderer object',
  580.                       'paramnum' => 1));
  581.         }
  582.         $this->_form->accept($renderer);
  583.     }
  584.  
  585.     /**
  586.      * Display a caption on action in progress.
  587.      *
  588.      * The idea of a simple utility function for replacing variables
  589.      * with values in an message template, come from sprintfErrorMessage
  590.      * function of Error_Raise package by Greg Beaver.
  591.      *
  592.      * This simple str_replace-based function can be used to have an
  593.      * order-independent sprintf, so messages can be passed in
  594.      * with different grammar ordering, or other possibilities without
  595.      * changing the source code.
  596.      *
  597.      * Variables should simply be surrounded by % as in %varname%
  598.      *
  599.      * @param string $caption (optional) message template
  600.      * @param array  $args    (optional) associative array of
  601.      *                                   template var -> message text
  602.      *
  603.      * @return     void
  604.      * @since      version 2.0.0 (2005-10-01)
  605.      * @access     public
  606.      */
  607.     function setCaption($caption = ' ', $args = array())
  608.     {
  609.         if (!is_string($caption)) {
  610.             return $this->_progress->raiseError(HTML_PROGRESS2_ERROR_INVALID_INPUT,
  611.                 'exception',
  612.                 array('var' => '$caption',
  613.                       'was' => gettype($caption),
  614.                       'expected' => 'string',
  615.                       'paramnum' => 1));
  616.  
  617.         } elseif (!is_array($args)) {
  618.             return $this->_progress->raiseError(HTML_PROGRESS2_ERROR_INVALID_INPUT,
  619.                 'exception',
  620.                 array('var' => '$args',
  621.                       'was' => gettype($args),
  622.                       'expected' => 'array',
  623.                       'paramnum' => 2));
  624.         }
  625.  
  626.         foreach ($args as $name => $value) {
  627.             $caption = str_replace("%$name%", $value, $caption);
  628.         }
  629.         $this->_progress->setLabelAttributes($this->caption['id'],
  630.                                              array('value' => $caption));
  631.     }
  632.  
  633.     /**
  634.      * Post a new notification to all observers registered.
  635.      *
  636.      * This notification occured only if a dispatcher exists. That means if
  637.      * at least one observer was registered.
  638.      *
  639.      * @param string $event Name of the notification handler
  640.      * @param array  $info  (optional) Additional information about the notification
  641.      *
  642.      * @return     void
  643.      * @since      version 2.0.0RC2 (2005-08-01)
  644.      * @access     private
  645.      */
  646.     function _postNotification($event, $info = array())
  647.     {
  648.         if (isset($this->dispatcher)) {
  649.             $info['sender'] = get_class($this);
  650.             $info['time']   = microtime();
  651.             $this->dispatcher->post($this, $event, $info);
  652.         }
  653.     }
  654. }
  655. ?>