Ejemplo n.º 1
0
 function __construct($ipagename, $idbname, $iload_from_DB, $iwrite_to_DB, $irequired, $imaxlength, $idisabled = false, $ivalue = "")
 {
     parent::__construct($ipagename, $idbname, $iload_from_DB, $iwrite_to_DB, $irequired, $imaxlength, $idisabled);
     $this->set_value($ivalue);
 }
Ejemplo n.º 2
0
 /**
  * @var FORM $form
  */
 public function validate($form)
 {
     parent::validate($form);
     if ($this->continue_validating($form)) {
         $idx = 0;
         /** @var UPLOADED_FILE_SET $file_value */
         $file_value = $this->_value;
         foreach ($file_value->files as $file) {
             if (!$file->is_valid()) {
                 if ($this->required || $file->error != Uploaded_file_error_missing) {
                     $form->record_error($this->id, $file->error_message(), $idx);
                 }
             } else {
                 if ($this->max_bytes && $file->size > $this->max_bytes) {
                     $form->record_error($this->id, "{$this->caption} can be at most " . file_size_as_text($this->max_bytes) . '.', $idx);
                 }
             }
             $idx += 1;
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * Add a field to the form.
  * Almost always called from the {@link FORM} constructor. Call this function only after
  * setting all properties of the field.
  * @param FIELD $field
  * @access private
  */
 public function add_field($field)
 {
     $this->_field_list[] = $field;
     $this->_fields[$field->id] = $field;
     $field->added_to_form($this);
 }
Ejemplo n.º 4
0
 /**
  * Return the contents of the field 'id' as HTML.
  * Text values have to have characters properly escaped before inserting them into text inputs or areas.
  * @param FIELD $field
  * @param string $quote_style Can be "ENT_NOQUOTES" or "ENT_QUOTES", which
  * translates quotes or not, respectively.
  * @return string
  * @access private
  */
 protected function _to_html($field, $quote_style)
 {
     if (isset($this->_num_controls[$field->id])) {
         return $field->as_html($this->_form, $quote_style, $this->_num_controls[$field->id]);
     }
     return $field->as_html($this->_form, $quote_style);
 }