示例#1
0
 /**
  * 
  * Constructor
  * 
  * @param object $field field object as extracted from database
  * @param object $form  form object as extracted from database
  */
 public function __construct($field, $form)
 {
     parent::__construct($field, $form);
     $this->queryValue = $this->input->get->get($field->name, null, 'ARRAY');
     $this->postValue = $this->input->post->get($field->name, array(), 'ARRAY');
 }
示例#2
0
 /**
  * 
  * Constructor
  * 
  * @param object $field field object as extracted from database
  * @param object $form  form object as extracted from database
  */
 public function __construct($field, $form)
 {
     parent::__construct($field, $form);
     $this->queryValue = $this->input->get->get($field->name, null, 'STRING');
     $this->postValue = $this->input->post->get($field->name, '', 'STRING');
 }
示例#3
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;
 }