Axiom (v1.2.0)

A lightweight PHP framework
H:/Workspace/php-axiom/www/php-axiom/libraries/axiom/axFormLineHelper.class.php
Go to the documentation of this file.
00001 <?php
00017 class axFormLineHelper extends axBaseHelper {
00018     
00044     public function __construct ($name, $display_name = null, $type = "text", $value = "", $class = "") {
00045         parent::__construct('div');
00046 
00047         if (!$display_name)
00048             $display_name = $name;
00049 
00050         $this->_children['label'] = axLabelHelper::export($display_name, $name);
00051 
00052         switch (strtolower($type)) {
00053             case 'text':
00054             case 'image':
00055             case 'hidden':
00056             case 'checkbox':
00057             case 'radio':
00058             case 'submit':
00059             case 'button':
00060             case 'file':
00061             case 'password':
00062                 $input = axInputHelper::export($name, $type, $value);
00063                 break;
00064                 
00065             case 'textarea':
00066                 $input  = axTextareaHelper::export($name, $value);
00067                 break;
00068 
00069             case 'select':
00070                 $input = axSelectHelper::export($name, $value);
00071                 break;
00072 
00073             case 'radio-group':
00074                 $input = axRadioGroupHelper::export($name, $value);
00075                 break;
00076 
00077             case 'checkbox-group':
00078                 $input = axCheckboxGroupHelper::export($name, $value);
00079                 break;
00080 
00081             default:
00082                 throw new LogicException("Given axFormLineHelper type mismatch with available types", 3006);
00083         }
00084 
00085         $this->_children['input'] = $input;
00086         
00087         if ($class)
00088             $this->getInput()->setClass($class);
00089     }
00090 
00094     public function setValue ($value) {
00095         $this->getInput()->setValue($value);
00096         return $this;
00097     }
00098 
00102     public function getValue () {
00103         return $this->getInput()->getValue();
00104     }
00105     
00111     public function getName () {
00112         return $this->getInput()->getName();
00113     }
00114     
00120     public function getType () {
00121         return $this->getInput()->getType();
00122     }
00123     
00130     public function setChecked ($c) {
00131         $this->getInput()->setChecked($c);
00132         return $this;
00133     }
00134 
00140     public function getInput () {
00141         return $this->_children['input'];
00142     }
00143 
00148     public function getLabel () {
00149         return $this->_children['label'];
00150     }
00151 
00158     public static function export ($name, $display_name = null, $type = "text", $value = "", $class = "") {
00159         return new self ($name, $display_name, $type, $value, $class);
00160     }
00161 }
 All Data Structures Files Functions Variables