Re: Issues with Event_Dispatcher possible fix ?

From: Date: Wed, 13 Apr 2005 06:13:24 +0000
Subject: Re: Issues with Event_Dispatcher possible fix ?
References: 1 2 3 4  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-18719@lists.php.net to get a copy of this message
Here is the complete code, to execute methods in the one class i've had to use a public method "get" to be setup to handle all the events. I highly doubt this is what its meant to do, but its the only way to get it to work ! require_once 'LiveUser.php'; require_once(SBS/Main.php); class SBS_Login extends SBS_Main { var $login_url; var $custom_auth; function SBS_Login() { parent::SBS_Main(); $this->login_url = $login_url; } function get($notification) { echo $notification->getNotificationName(); $this->{$notification->getNotificationName()}($notification); } function onIdled() { die(yes); } function onLogout() { die(logout); } function onLogin() { die(yes); } function onFailedLogin() { //die(yes); } function forceLogin(&$notification)
    {
$manage = parent::import('HTML_Form_Objects',true,true); require_once 'HTML/Template/Flexy/Element.php'; $elements['username'] = new HTML_Template_Flexy_Element; $elements['username']->prefix = '<b>Username:</b><br>'; $elements['username']->attributes = array('size'=>20,'tabindex'=>1,'style'=>'registertext'); $elements['username']->setValue($data['username']); $elements['password'] = new HTML_Template_Flexy_Element; $elements['password']->prefix = '<b>Password:</b><br>'; $elements['password']->attributes = array('size'=>20,'tabindex'=>2,'style'=>'registertext'); $elements['password']->setValue($data['password']); //set the global error handler $this->button = $manage->add_submit_button('Login'); $this->tpl->compile('login.html'); echo $this->tpl->outputObject($this,$elements); //exit;
    }
} $LU =& LiveUser::factory($LUOptions); $login_events = new SBS_Login; $LU->dispatcher-
addObserver(array($login_events,'get'),null,'LiveUser');
$username = (isset($_POST['username'])) ? $_POST['username'] : null; $password = (isset($_POST['password'])) ? $_POST['password'] : null; $remember = (isset($_POST['remember'])) ? $_POST['remember'] : null; $logout = (isset($_GET['logout'])) ? $_GET['logout'] : null; $LU->init($username, $password, $logout, $remember);

« previous php.pear.general (#18719) next »