<?php

/* $Id: class.php,v 1.1 2005/09/27 20:04:31 tuupola Exp $ */

/*
+-----------------------------------------------------------------------+
| Copyright (c) 2005 Mika Tuupola                                       |
| All rights reserved.                                                  |
|                                                                       |
| Redistribution and use in source and binary forms, with or without    |
| modification, are permitted provided that the following conditions    |
| are met:                                                              |
|                                                                       |
| o Redistributions of source code must retain the above copyright      |
|   notice, this list of conditions and the following disclaimer.       |
| o Redistributions in binary form must reproduce the above copyright   |
|   notice, this list of conditions and the following disclaimer in the |
|   documentation and/or other materials provided with the distribution.|
| o The names of the authors may not be used to endorse or promote      |
|   products derived from this software without specific prior written  |
|   permission.                                                         |
|                                                                       |
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |
| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |
| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |
| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |
| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |
| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |
|                                                                       |
+-----------------------------------------------------------------------+
| Author: Mika Tuupola <tuupola@appelsiini.net>                         |
| Install: <path_to_mint>/pepper/tuupola/helloworld/                    |
+-----------------------------------------------------------------------+

*/


$install_plugin "Tuupola_HelloWorld";

class 
Tuupola_HelloWorld {

    var 
$Mint;
    var 
$info;
    var 
$panes;    
    var 
$plugin_id;

    function 
Tuupola_HelloWorld($plugin_id) {
        global 
$Mint;

        
$this->Mint      =& $Mint;
        
$this->plugin_id =  $plugin_id;
        
        
/* Pepper info */
        
$this->info['developer']     = "Mika Tuupola";
        
$this->info['plugin']        = "Hello World!";
        
$this->info['description']   = "A simple example Pepper which prints 
                                        out the text <i>Hello World!</i> in 
                                        two different languages."
;
        
$this->info['developer_url'] = "http://www.appelsiini.net/~tuupola/";    
        
$this->info['documentation'] = "http://www.appelsiini.net/~tuupola/";

        
$this->info['src']           = 'tuupola/helloworld/';
        
$this->info['class']         = 'Tuupola_HelloWorld';

        
/* Which panes this plugin creates */
        
$this->panes['Hello World!']   = array('English''Finnish');
    }

    function 
install() {
        
$this->Mint->registerPlugIn($this->info['src'], 
                                     
$this->info['class'],
                                     
$this->panes);
    }

    function 
uninstall() { 
    }

    function 
onRecord() {
        return array();
    }

    function 
onJavaScript() { 
    }

    function 
onDisplay($pane$tab$column=''$sort='') {

        
$html '';

        
$table['table'] = array('id'=>'','class'=>'');
        
$table['thead'] = array(
            
// display name, CSS class(es) for each column
            
array('value'=>'Line','class'=>''),
            array(
'value'=>'String','class'=>''),
        );

        switch(
$pane) {
            case 
'Hello World!':
                switch(
$tab) {
                    case 
'English':    
                        
$table['tbody'][] = array("Line one""Hello World!");
                        
$table['tbody'][] = array("Line two""Hello World!");
                        
$table['tbody'][] = array("Line three""Hello World!");
            break;
                    case 
'Finnish':    
                        
$table['tbody'][] = array("Line one""Hei maailma!");
                        
$table['tbody'][] = array("Line two""Hei maailma!");
                        
$table['tbody'][] = array("Line three""Hei maailma!");
                        break;
                }
            break;
        }

        
$html $this->Mint->generateTable($table);

        return 
$html;
    }

    function 
onWidget() { 
    }

    function 
onDisplayPreferences() {
    }

    function 
onSavePreferences() {
    }

    function 
onCustom() { 
    }

}

?>