Example #1
0
 /**
  * 
  * Constructor
  * 
  * @param string $type layout type
  * @param VisformsHtml $field instance of field html class
  * @param array $option additionals layout options
  */
 public function __construct($type, VisformsHtml $fieldHtml)
 {
     $this->type = $type;
     $this->fieldHtml = $fieldHtml;
     $this->field = $fieldHtml->getField();
     $this->fieldtype = $fieldHtml->getFieldType();
 }
Example #2
0
 /**
  * 
  * Constructor
  * 
  * @param object $field field object as extracted from database
  */
 public function __construct($field, $decorable, $attribute_type)
 {
     if (is_null($attribute_type)) {
         $attribute_type = "radio";
     }
     parent::__construct($field, $decorable, $attribute_type);
 }
Example #3
0
 /**
  * 
  * Constructor
  * 
  * @param object $field field object as extracted from database
  */
 public function __construct($field, $decorable, $attribute_type)
 {
     if (is_null($decorable)) {
         $decorable = false;
     }
     $attribute_type = 'checkbox';
     parent::__construct($field, $decorable, $attribute_type);
 }
Example #4
0
 /**
  * 
  * Constructor
  * 
  * @param object $field field object as extracted from database
  */
 public function __construct($field, $decorable, $attribute_type)
 {
     if (is_null($decorable)) {
         $decorable = false;
     }
     if (is_null($attribute_type)) {
         $attribute_type = "submit";
     }
     parent::__construct($field, $decorable, $attribute_type);
 }
Example #5
0
 /**
  * 
  * Constructor
  * 
  * @param object $field field object as extracted from database
  */
 public function __construct($field, $decorable, $attribute_type)
 {
     if (is_null($decorable)) {
         $decorable = false;
     }
     $attribute_type = "hidden";
     //prevent email cloaking in hidden fields that may contain a email address as default value
     if (isset($field->attribute_value) && $field->attribute_value != "") {
         $field->attribute_value = str_replace('@', '&#64', $field->attribute_value);
     }
     parent::__construct($field, $decorable, $attribute_type);
 }
Example #6
0
 /**
  * 
  * Constructor
  * 
  * @param object $field field object as extracted from database
  */
 public function __construct($field, $decorable, $attribute_type)
 {
     $attribute_type = "date";
     parent::__construct($field, $decorable, $attribute_type);
 }
Example #7
0
 /**
  * Method to build the field item list
  *
  * @return  array of form fields
  *
  * @since   11.1
  */
 public function getFields()
 {
     $app = JFactory::getApplication();
     $this->fields = $app->getUserState('com_visforms.form' . $this->_id . '.fields');
     if (!is_array($this->fields)) {
         $fields = $this->getItems();
         $visform = $this->getForm();
         $n = count($fields);
         //get basic field definition
         for ($i = 0; $i < $n; $i++) {
             $ofield = VisformsField::getInstance($fields[$i], $visform);
             if (is_object($ofield)) {
                 $fields[$i] = $ofield->getField();
             }
         }
         // perform business logic
         for ($i = 0; $i < $n; $i++) {
             $ofield = VisformsBusiness::getInstance($fields[$i], $visform, $fields);
             if (is_object($ofield)) {
                 //as there may be interactions between the field processed and the rest of the form fields we always return the fields array
                 $fields = $ofield->getFields();
             }
         }
         //only after we have performed the business logic on all fields we know which fields are disabled
         //we can validate the "required" only then, because we have to omit the required validation for disabled fields!
         //we use the business class for this as well
         for ($i = 0; $i < $n; $i++) {
             $ofield = VisformsBusiness::getInstance($fields[$i], $visform, $fields);
             if (is_object($ofield)) {
                 $fields[$i] = $ofield->validateRequired();
             }
         }
         //prepare HTML
         for ($i = 0; $i < $n; $i++) {
             $html = VisformsHtml::getInstance($fields[$i]);
             if (is_object($html)) {
                 $ofield = VisformsHtmllayout::getInstance($visform->formlayout, $html);
                 if (is_object($ofield)) {
                     $fields[$i] = $ofield->prepareHtml();
                 }
             }
         }
         $this->fields = $fields;
     }
     $app->setUserState('com_visforms.form' . $this->_id . '.fields', $this->fields);
     return $this->fields;
 }