Source for file LoginForm.class.php

Documentation is available at LoginForm.class.php

  1. /**
  2.  * Содержит класс LoginForm
  3.  *
  4.  * @package energine
  5.  * @author dr.Pavka
  6.  * @copyright ColoCall 2006
  7.  * @version $Id: fsource_energine__modulesusercomponentsLoginForm.class.php.html,v 1.1 2007/09/17 14:32:32 pavka Exp $
  8.  */
  9.  
  10. require_once('core/modules/share/components/DataSet.class.php');
  11.  
  12.  
  13. /**
  14.  * Вывод формы авторизации
  15.  *
  16.  * @package energine
  17.  * @subpackage user
  18.  */
  19. class LoginForm extends DataSet {
  20.  
  21.  
  22.     /**
  23.      * Конструктор
  24.      *
  25.      * @param string $name 
  26.      * @param string $module 
  27.      */
  28.     public function __construct($name$moduleDocument $document,  array $params null{
  29.         $params['action'AuthUser::getInstance()->isAuthenticated()?'showLogoutForm':'showLoginForm';
  30.         parent::__construct($name$module$document,  $params);
  31.     }
  32.  
  33.     /**
  34.      * Вывод формы авторизации
  35.      *
  36.      * @return type 
  37.      * @access public
  38.      */
  39.  
  40.     public function showLoginForm({
  41.         $this->prepare();
  42.         if (isset($_POST['user']['login'])) {
  43.             $messageField new FieldDescription('message');
  44.             $messageField->setType(FieldDescription::FIELD_TYPE_STRING);
  45.             $this->getDataDescription()->addFieldDescription($messageField);
  46.             $messageField->setRights(FieldDescription::FIELD_MODE_READ);
  47.  
  48.             $messageField new Field('message');
  49.             $messageField->addRowData($this->translate('ERR_BAD_LOGIN'));
  50.             $this->setData(new Data());
  51.             $this->getData()->addField($messageField);
  52.         }
  53.     }
  54.  
  55.  
  56.     /**
  57.       * Вывод формы logout
  58.       *
  59.       * @return type 
  60.       * @access public
  61.       */
  62.  
  63.     public function showLogoutForm({
  64.         $request Request::getInstance();
  65.         //$this->setTitle($this->translate('TXT_LOGOUT'));
  66.         $this->addTranslation('TXT_USER_GREETING');
  67.         $this->addTranslation('TXT_USER_NAME');
  68.         $this->setDataSetAction($request->getBasePath()true);
  69.         $this->prepare();
  70.     }
  71.  
  72.     protected function loadData({
  73.         $result false;
  74.         switch ($this->getAction()) {
  75.             case 'showLogoutForm':
  76.                 foreach ($this->getDataDescription()->getFieldDescriptionList(as $fieldName{
  77.                     $result[array($fieldName=>$this->document->user->getValue($fieldName));
  78.                 }
  79.                 break;
  80.             default:
  81.                 $result parent::loadData();
  82.         }
  83.         return $result;
  84.     }
  85. }

Documentation generated on Mon, 17 Sep 2007 13:30:33 +0300 by phpDocumentor 1.4.0a2