klenwell information services : WikkaBaseActionClass

Base Action Class

ProjectWikka
source: https://gist.github.com/klenwell/5564387

The Klenwell Wikka Action Class (WAC) provides some common useful methods for actions using the action class pattern. It serves as a base class for specific action classes.

It offers mail, database, and data persistence methods. See the source code for the full API.

Implementation

require_once 'libs/action.class.php';

class SampleAction extends WikkaAction {

    var $version = '1.0';

    # parameter defaults
    var $some_parameter = 'hello world';

    # internal
    # add internal variables

    function action_set_up() {
        if ( $this->has_param('some_parameter') ) {
            $this->some_parameter = $this->get_param('some_parameter');
        }
    }
   
    function main() {
        $this->action_set_up();
        return $this->some_parameter;
    }
   
    function output($content) {
        print $content;
    }
}

# Main Routine
try {
    $Action = new SampleAction($this, $vars);
    $content = $Action->main();
    $Action->output($content);
}
catch(Exception $e) {
    printf('<em class="error">%s</em>', $e->getMessage());
}


Examples

Classes using the Klenwell wikka action class:

Additional Info

Data Persistence