Source for file ALoginWidget.php

Documentation is available at ALoginWidget.php

  1. <?php
  2. /**
  3.  * 
  4.  *
  5.  * @package Alia
  6.  * @subpackage Widgets
  7.  * @author Jordan CM Wambaugh <jordan@wamabugh.org>
  8.  *
  9.  */
  10.  
  11. /**
  12.  * ALoginWidget
  13.  * 
  14.  * A widget for username/password prompt
  15.  * 
  16.  * @package Alia
  17.  * @subpackage Widgets
  18.  * @author Jordan CM Wambaugh <jordan@wamabugh.org>
  19.  * @signal loginPushed - Emitted when the user completes the form
  20.  */
  21.  
  22. class ALoginWidget extends AWidget {
  23.     private $validator;    
  24.  
  25.  
  26.     function __construct(){
  27.         parent::__construct();
  28.         $this->defineSignal('loginPushed');
  29.         
  30.         $layout new AGridLayout($this);
  31.         $this->setLayout($layout);
  32.         
  33.         
  34.         
  35.         $layout->addWidget(new AHTMLText("User Name:"),0,0);
  36.         $userName new ALineEdit();
  37.         $layout->addWidget($userName,0,1);
  38.         
  39.         $layout->addWidget(new AHTMLText("Password:"),1,0);
  40.         $password new ALineEdit();
  41.         $password->setAttribute('type','password');
  42.         $layout->addWidget($password,1,1);
  43.         
  44.         $button new APushButton('Login');
  45.         $layout->addWidget($button,2,0,2);
  46.         
  47.         
  48.         
  49.         //make our connection to the button.
  50.         //when to button is clicked, emit a new signal with our login information.
  51.         Alia::connect($button,'clicked',null,null,AJScript::emit('loginPushed',$this,array(AJScript::formElementValue($userName),AJScript::formElementValue($password))));
  52.  
  53.         //add some validation!
  54.         $this->validator = new AValidator();
  55.         $this->validator->add($userName->getAttribute('id')'string'array('minLength'=>4"required"=>true));
  56.         $this->validator->add($password->getAttribute('id')'string'array('minLength'=>4"required"=>true));
  57.         $this->validator->sendJScript();
  58.         //Alia($button,'clicked','trigger');
  59.     }
  60.     
  61. }

Documentation generated on Fri, 11 Jul 2008 13:28:41 -0400 by phpDocumentor 1.4.2