예제 #1
0
 /**
  * Constructs the field
  *
  * @param string $column Field column name
  * @param string $label Field label
  * @param mixed $dbSourceOrLabelField it can be an string with field name if you want to pass field label name and field value (key) name and query
  * but you can make it passing a DBSource instance to $dbSourceOrLabelField param and ignoring another paramether in sequence
  * @throws \InvalidArgumentException
  */
 public function __construct($column, $label, $dbSourceOrLabelField, $valueField = "", $query = "", $db = null)
 {
     if (empty(self::$defaultTemplate)) {
         self::$defaultTemplate = Select::getDefaultTemplate();
     }
     parent::__construct($column, $label);
     $dbSource = $dbSourceOrLabelField;
     if (!is_a($dbSource, 'DBSource')) {
         $dbSource = new \TotalFlex\DBSource($dbSourceOrLabelField, $valueField, $query, $db);
     }
     $this->_options = $dbSource->getLabelAsKeyFieldAsValue();
 }
예제 #2
0
 /**
  * [__construct description]
  * @param [type] $column        db field name
  * @param [type] $label         label to be shown on html output
  * @param [type] $folderToSave  where we want to save our uploaded files
  * @param [type] $webFolder     how we'll reference this file when accessing it from public web path, relative to public root "/"
  * @param [type] $fileNameLimit max characters allowed on database to file name
  * @param array  $allowedTypes  this can be an array of extensions eg.: array('.gif','.png'...) or a group of constants as: File::TYPE_IMAGE|File::TYPE_WEB_IMAGE|File::TYPE_WEB_VIDEO
  */
 public function __construct($column, $label, $folderToSave, $webFolder, $fileNameLimit, $allowedTypes = array())
 {
     parent::__construct($column, $label);
     if (!($folderToSave = realpath($folderToSave))) {
         throw new \TotalFlex\Exception\InvalidPath("Diretório para salvar inválido ( {$folderToSave} ) ");
     }
     $this->_targetFolder = $folderToSave;
     $this->_webFolder = $webFolder;
     if (!empty($allowedTypes)) {
         $this->setAllowedTypes($allowedTypes);
     }
     $this->_maxFileSize = ini_get("upload_max_filesize");
     $this->_maxFileUploads = ini_get("max_file_uploads");
     $this->_fileNameLimit = $fileNameLimit;
 }
예제 #3
0
 /**
  * Constructs the field
  *
  * @param string $column Field column name
  * @param string $label Field label
  * @throws \InvalidArgumentException
  */
 public function __construct($column, $label, $options)
 {
     parent::__construct($column, $label);
     $this->_options = $options;
 }