Upload.class.php (793B)
1 <?php 2 3 namespace template_engine\components; 4 5 use template_engine\components\html\Component; 6 use template_engine\element\CMSElement; 7 8 class UploadComponent extends Component 9 { 10 public $size = 40; 11 public $name = ''; 12 public $multiple = false; 13 public $class = 'upload'; 14 public $maxlength = 0; 15 16 public function createElement() 17 { 18 $input = new CMSElement('input'); 19 $input->addAttribute('type','file'); 20 21 $input->addStyleClass( $this->class ); 22 23 if ( $this->multiple ) 24 $input->addAttribute( 'multiple','multiple' ); 25 26 //$input->addAttribute('id',REQUEST_ID.'_'.$this->name); 27 $input->addAttribute('name',$this->name); 28 $input->addAttribute('size',$this->size); 29 30 if ( $this->maxlength ) 31 $input->addAttribute( 'maxlength',$this->maxlength ); 32 33 return $input; 34 } 35 }