XOOPS RMCommon Utilities  2.1.8.91RC
 All Classes Namespaces Files Functions Variables
file.class.php
Go to the documentation of this file.
1 <?php
2 // $Id: file.class.php 825 2011-12-09 00:06:11Z i.bitcero $
3 // --------------------------------------------------------------
4 // Red México Common Utilities
5 // A framework for Red México Modules
6 // Author: Eduardo Cortés <i.bitcero@gmail.com>
7 // Email: i.bitcero@gmail.com
8 // License: GPL 2.0
9 // --------------------------------------------------------------
10 
16 {
17  private $_size = 30;
18  private $_limit = 0;
26  public function __construct($caption, $name, $size=30, $limit=0){
27  $this->_size = $size;
28  $this->setCaption($caption);
29  $this->setName($name);
30  $this->_limit = $limit;
31  }
36  public function setSize($size){
37  if ($size > 0){ $this->_size = $size; }
38  }
43  public function getSize(){
44  return $this->_size;
45  }
50  public function render(){
51  $ret = '<input type="file" name="'.$this->getName().'" id="'.$this->id().'" size="'.$this->_size.'" ';
52  if ($this->getClass()!=''){
53  $ret .= "class='".$this->getClass()."' ";
54  }
55  $ret .= $this->getExtra()." />";
56  if ($this->_limit>0){
57  $ret .= '<input type="hidden" name="MAX_FILE_SIZE" value="'.$this->_limit.'" />';
58  }
59  return $ret;
60  }
61 }
62 
63 ?>