function getFields()
 {
     $formId = JRequest::getInt('formId');
     $return = array();
     $this->_db->setQuery("SELECT p.PropertyValue AS ComponentName, c.*, ct.ComponentTypeName FROM #__rsform_components c LEFT JOIN #__rsform_properties p ON (c.ComponentId=p.ComponentId AND p.PropertyName='NAME') LEFT JOIN #__rsform_component_types ct ON (ct.ComponentTypeId = c.ComponentTypeId) WHERE c.FormId='" . $formId . "' ORDER BY c.Order");
     $components = $this->_db->loadObjectList();
     $properties = RSFormProHelper::getComponentProperties($components);
     foreach ($components as $component) {
         $data = $properties[$component->ComponentId];
         $data['componentId'] = $component->ComponentId;
         $data['componentTypeId'] = $component->ComponentTypeId;
         $data['ComponentTypeName'] = $component->ComponentTypeName;
         $field = new stdClass();
         $field->id = $component->ComponentId;
         $field->type_id = $component->ComponentTypeId;
         $field->name = $component->ComponentName;
         $field->published = $component->Published;
         $field->ordering = $component->Order;
         $field->preview = RSFormProHelper::showPreview($formId, $field->id, $data);
         $field->required = '-';
         if (!empty($data['REQUIRED'])) {
             $field->required = $data['REQUIRED'] == 'YES';
         }
         $field->validation = '-';
         if (isset($data['VALIDATIONRULE']) && $data['VALIDATIONRULE'] != 'none') {
             $field->validation = '<b>' . $data['VALIDATIONRULE'] . '</b>';
         }
         if (isset($data['VALIDATIONRULE_DATE']) && $data['VALIDATIONRULE_DATE'] != 'none') {
             $field->validation = '<b>' . $data['VALIDATIONRULE_DATE'] . '</b>';
         }
         $return[] = $field;
     }
     return $return;
 }
Example #2
0
function RSpreviewComponent($formId, $componentId)
{
    $data = RSFormProHelper::getComponentProperties($componentId);
    return RSFormProHelper::showPreview($formId, $componentId, $data);
}