root/trunk/patForms/Observer/ReadonlyFinished.php

Revision 84, 1.1 kB (checked in by schst, 5 years ago)

added observer concept to patForms class

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?php
2 /**
3  * patForms observer that will set the mode of the subject
4  * to 'readonly' once the supplied data is OK.
5  *
6  * $Id$
7  *
8  * @package        patForms
9  * @subpackage    Observers
10  */
11
12 /**
13  * patForms observer that will set the mode of the subject
14  * to 'readonly' once the supplied data is OK.
15  *
16  * @package        patForms
17  * @subpackage    Observers
18  * @author        Stephan Schmidt <schst@php-tools.net>
19  * @license        LGPL, see license.txt for details
20  * @link        http://www.php-tools.net
21  */
22 class patForms_Observer_ReadonlyFinished extends patForms_Observer
23 {
24    /**
25     * method called by patForms or any patForms_Element to signalise
26     * an event
27     *
28     * @access    public
29     * @param    object        Either a patForms or patForms_Element object
30     * @param    string        Property, that has changed (currently only 'status' is possible)
31     * @param    mixed        new value of the property
32     * @return    boolean     should always return true
33     */
34     function notify( &$container, $property, $value )
35     {
36         /**
37          * act only on a status change
38          */
39         if( $property != 'status' )
40             return true;
41
42         if( $value != 'validated' )
43             return true;
44             
45         $container->setMode( 'readonly' );
46         return true;
47     }
48 }
49 ?>
Note: See TracBrowser for help on using the browser.