Orion PHP  0.11.12
The PHP5.3 framework
password.php
Go to the documentation of this file.
00001 <?php
00002 namespace Orion\Core\Model;
00003 
00004 
00005 class Password extends Field
00006 {
00007     
00008     protected $needsConfirm = true;
00009 
00010     public function __construct($bind='password', $label='Password', $required=true, $needsConfirm=true)
00011     {
00012         $this->type = 'password';
00013         $this->bind = $bind;
00014         $this->label = $label;
00015         $this->required = $required;
00016         $this->needsConfirm = $needsConfirm;
00017     }
00018 
00019     public function prepare($value)
00020     {
00021                 return "'".$value."'";
00022     }
00023 
00024     public function toHtml($XHTML=true)
00025     {
00026         if($XHTML)
00027             $tag = ' /';
00028         else
00029             $tag = '';
00030 
00031         $out = '<div class="form-row"><label for="'.$this->bind.'">'.$this->label.'</label><div class="form-container"><input name="'.$this->bind.'" type="password" class="form-text" value="'.$this->value.'"'.$tag.'></div></div>';
00032         
00033         if($this->needsConfirm)
00034             $out .='<div class="form-row"><label for="'.$this->bind.'">'.$this->label.' (confirm)</label><div class="form-container"><input name="'.$this->bind.'-confirm" type="password" class="form-text" value="'.$this->value.'"'.$tag.'></div></div>';
00035     
00036         return $out;
00037     }
00038 }
00039 
00040 ?>