| // +---------------------------------------------------------------------------+ /** * User / Login Block. * * Shows login form if not logged in, user data (username and "session started at") * if logged in * * @package block * @author Werner M. Krauss */ class User_Block_Login { function init($output) { SGL::logMessage(null, PEAR_LOG_DEBUG); $this->uid = isset($output->loggedOnUserID) ? $output->loggedOnUserID : ''; $this->username = isset($output->loggedOnUser) ? $output->loggedOnUser : ''; $this->startTime = isset($output->loggedOnSince) ? $output->loggedOnSince : ''; return $this->getBlockContent($output); } function getBlockContent($output) { if ($this->uid == SGL_GUEST) { return $this->getLoginScreen($output); } else { return $this->getLogoutScreen(); } } function getLoginScreen($output) { if (isset($output->conf['tuples']['demoMode']) && $output->conf['tuples']['demoMode'] == true) { $username = 'admin'; $password = 'admin'; } else { $username = ''; $password = ''; } $login = '
'.SGL_String::translate('Username').' '.SGL_String::translate('Password').'

'.SGL_String::translate('Not Registered').'
'.SGL_String::translate('Forgot Password').'

*'.SGL_String::translate('denotes required field').'
'; return $login; } function getLogoutScreen() { $logout = SGL_String::translate('user').': '.$this->username.'
'; $logout .= SGL_String::translate('session started at').': '.$this->startTime.'
 
'; $logout .= ''.SGL_String::translate('logout').''; return $logout; } } ?>