コード例 #1
0
ファイル: baforms.php プロジェクト: pupsikus/bs.test
 public static function drawHTMLPage($id)
 {
     $item = 1;
     $form = baformsHelper::getForm($id);
     $columns = baformsHelper::getColumn($id);
     $elements = baformsHelper::getElement($id);
     $popup = baformsHelper::getPopup($id);
     $submissionsOptions = baformsHelper::getSubmisionOptions($id);
     $embed = self::getEmbed($id);
     $html = "<div class='com-baforms'>";
     $title = $form[0]->title;
     $titleSettings = $form[0]->title_settings;
     $formSettings = $form[0]->form_settings;
     $formSettings = explode('/', $formSettings);
     $uri = JURI::getInstance();
     $url = $uri->toString(array('scheme', 'host', 'port')) . JURI::root(true);
     $url .= '/index.php?option=com_baforms&amp;view=form&amp;task=form.save&amp;form_id=';
     $url .= $id;
     $language = JFactory::getLanguage();
     $language->load('com_baforms', JPATH_ADMINISTRATOR);
     $formStyle = explode(';', $formSettings[9]);
     if (empty($submissionsOptions['message_bg_rgba'])) {
         $submissionsOptions['message_bg_rgba'] = '#ffffff';
     }
     if (empty($submissionsOptions['message_color_rgba'])) {
         $submissionsOptions['message_color_rgba'] = '#333333';
     }
     if (empty($submissionsOptions['dialog_color_rgba'])) {
         $submissionsOptions['dialog_color_rgba'] = 'rgba(0, 0, 0, 0.15)';
     }
     $html .= '<div class="modal-scrollable"><div class="ba-modal fade hide message-modal"';
     $html .= ' style="color:' . $submissionsOptions['message_color_rgba'];
     $html .= '; background-color: ' . $submissionsOptions['message_bg_rgba'];
     $html .= ';"><div class="ba-modal-body"><span class="message"></span><input type="hidden" value="';
     $html .= $submissionsOptions['dialog_color_rgba'] . '" class="dialog-color"></div></div></div>';
     if ($popup['display_popup'] == 1) {
         $html .= '<div class="btn-' . $popup['button_position'] . '">';
         $html .= "<input type='button' value='" . $popup['button_lable'];
         $html .= "' style='background-color: " . $popup['button_bg'];
         $html .= "; font-weight:" . $popup['button_weight'];
         $html .= "; border-radius:" . $popup['button_border'] . "px";
         $html .= "; font-size:" . $popup['button_font_size'] . "px";
         $html .= "; color: " . $popup['button_color'] . "'";
         $html .= " data-popup='popup-form-" . $id . "' class='popup-btn'>";
         $html .= '</div><div class="modal-scrollable"><div class="ba-modal';
         $html .= ' fade hide popup-form" id="popup-form-' . $id . '" style="display: none; ';
         $html .= $formStyle[0] . '">';
         $html .= '<div class="ba-modal-body">';
     }
     $html .= '<form action="' . $url . '"';
     $html .= ' method="post" class="form-validate" enctype="multipart/form-data">';
     $html .= '<div style="';
     if ($popup['display_popup'] == 0) {
         $html .= $formStyle[0] . '; ';
     }
     $html .= $formStyle[1] . ';' . $formStyle[2] . ';' . $formStyle[3];
     $html .= '" class="ba-form ' . $formSettings[0] . '">';
     if ($submissionsOptions['display_title'] == 1) {
         $html .= '<div class="row-fluid ba-row" style="' . $titleSettings . '"><div class="span12">';
         $html .= $title . '</div></div>';
     }
     $row = '';
     $k = 0;
     if (empty($columns)) {
         foreach ($elements as $element) {
             $element = explode('_-_', $element->settings);
             if ($element[0] == 'button') {
                 $button = $element[1];
                 $buttonStyle = $element[2];
                 $buttonAligh = $element[3];
             }
         }
     }
     $n = 1;
     $html .= '<div class="page-0">';
     foreach ($columns as $column) {
         $column = explode(',', $column->settings);
         if (trim($column[1]) == 'spank') {
             $prev = $column[3];
             $prev = explode(';', $prev);
             $next = $column[5];
             $next = explode(';', $next);
             if ($n != 1) {
                 $html .= '<div class="ba-prev"><input type="button" value="';
                 $html .= $prev[0] . '" style="border-radius:' . $prev[7];
                 $html .= 'px; background-color: #' . $prev[3] . '; font-size:';
                 $html .= $prev[5] . 'px; font-weight:' . $prev[6] . '; width:';
                 $html .= $prev[1] . 'px; height:' . $prev[2] . 'px; color: #' . $prev[4];
                 $html .= '" class="btn-prev"></div>';
             }
             if ($n == 1) {
                 $last = $prev;
             }
             $html .= '<div class="ba-next"><input type="button" value="';
             $html .= $next[0] . '" style="border-radius:' . $next[7];
             $html .= 'px; background-color: #' . $next[3] . '; font-size:';
             $html .= $next[5] . 'px; font-weight:' . $next[6] . '; width:';
             $html .= $next[1] . 'px; height:' . $next[2] . 'px; color: #' . $next[4];
             $html .= '" class="btn-next"></div></div>';
             $html .= '<div class="page-' . $n . '" style="display:none">';
             $n++;
         }
         if (trim($column[1]) == 'span12') {
             $html .= '<div class="row-fluid ba-row">';
         }
         if (trim($column[1]) == 'span6') {
             if ($row == 1) {
                 $row = 2;
             }
             if ($row == '') {
                 $html .= '<div class="row-fluid ba-row">';
                 $row = 1;
             }
         }
         if (trim($column[1]) == 'span4') {
             if ($row == 2) {
                 $row = 3;
             }
             if ($row == 1) {
                 $row = 2;
             }
             if ($row == '') {
                 $html .= '<div class="row-fluid ba-row">';
                 $row = 1;
             }
         }
         if (trim($column[1]) == 'span3') {
             if ($row == 3) {
                 $row = 4;
             }
             if ($row == 2) {
                 $row = 3;
             }
             if ($row == 1) {
                 $row = 2;
             }
             if ($row == '') {
                 $html .= '<div class="row-fluid ba-row">';
                 $row = 1;
             }
         }
         if (trim($column[1]) != 'spank') {
             $html .= '<div class="' . $column[1] . '">';
             foreach ($elements as $element) {
                 $element = explode('_-_', $element->settings);
                 if ($element[0] == 'button') {
                     $button = $element[1];
                     $buttonStyle = $element[2];
                     $buttonAligh = $element[3];
                 }
                 if ($element[0] == $column[0]) {
                     if ($element[2] == 'textInput') {
                         $options = explode(';', $element[3]);
                         $html .= '<div class="ba-textInput tool">';
                         if ($options[0] != '') {
                             $html .= '<label style="font-size:' . $formSettings[1] . '; color:';
                             $html .= $formSettings[2] . '; font-weight: ';
                             $html .= $formSettings[10] . '"><span title="';
                             $html .= htmlspecialchars($options[1]) . '">' . htmlspecialchars($options[0]);
                             if (isset($options[3])) {
                                 if ($options[3] == 1) {
                                     $html .= ' *';
                                 }
                             }
                             $html .= '</span></label>';
                         }
                         if (!isset($options[4]) || empty($options[4])) {
                             $options[4] = 'regular';
                         }
                         $html .= '<input type="text" data-type="' . $options[4];
                         $html .= '" style="height:' . $formSettings[3] . '; ';
                         $html .= 'font-size:' . $formSettings[4] . ';color:' . $formSettings[5];
                         $html .= '; background-color:' . $formSettings[6] . '; ';
                         $html .= $formSettings[7] . '; border-radius:' . $formSettings[8] . '"';
                         $html .= " placeholder='" . htmlspecialchars($options[2], ENT_QUOTES) . "'";
                         $html .= " name='";
                         $html .= $item;
                         $item++;
                         $html .= "'";
                         if (isset($options[3])) {
                             if ($options[3] == 1) {
                                 $html .= ' required';
                             }
                         }
                         $html .= '><br></div>';
                     }
                     if ($element[2] == 'email') {
                         $options = explode(';', $element[3]);
                         $html .= '<div class="ba-email tool">';
                         if ($options[0] != '') {
                             $html .= '<label style="font-size:' . $formSettings[1] . '; color:';
                             $html .= $formSettings[2] . '; font-weight: ';
                             $html .= $formSettings[10] . '"><span title="';
                             $html .= htmlspecialchars($options[1]) . '">' . htmlspecialchars($options[0]) . '</span></label>';
                         }
                         $html .= '<input type="email" style="height:' . $formSettings[3] . '; ';
                         $html .= 'font-size:' . $formSettings[4] . ';color:' . $formSettings[5];
                         $html .= '; background-color:' . $formSettings[6] . '; ';
                         $html .= $formSettings[7] . '; border-radius:' . $formSettings[8] . '"';
                         $html .= " placeholder='" . htmlspecialchars($options[2], ENT_QUOTES);
                         $html .= "' required";
                         $html .= " name='";
                         $html .= $item;
                         $item++;
                         $html .= "'";
                         $html .= '></div>';
                     }
                     if ($element[2] == 'textarea') {
                         $options = explode(';', $element[3]);
                         $html .= '<div class="ba-textarea tool">';
                         if ($options[0] != '') {
                             $html .= '<label style="font-size:' . $formSettings[1] . '; color:';
                             $html .= $formSettings[2] . '; font-weight: ';
                             $html .= $formSettings[10] . '"><span  title="';
                             $html .= htmlspecialchars($options[1]) . '">' . htmlspecialchars($options[0]);
                             if (isset($options[3])) {
                                 if ($options[3] == 1) {
                                     $html .= ' *';
                                 }
                             }
                             $html .= '</span></label>';
                         }
                         $html .= '<textarea style="height:' . $formSettings[3] . '; ';
                         $html .= 'font-size:' . $formSettings[4] . ';color:' . $formSettings[5];
                         $html .= '; background-color:' . $formSettings[6] . '; ';
                         $html .= $formSettings[7] . '; border-radius:' . $formSettings[8];
                         $html .= '; min-height:' . $options[4] . 'px;"';
                         $html .= " placeholder='" . htmlspecialchars($options[2], ENT_QUOTES);
                         $html .= "'";
                         $html .= " name='";
                         $html .= $item;
                         $item++;
                         $html .= "'";
                         if (isset($options[3])) {
                             if ($options[3] == 1) {
                                 $html .= ' required';
                             }
                         }
                         $html .= '></textarea><br></div>';
                     }
                     if ($element[2] == 'date') {
                         $html .= '<div class="ba-date tool">';
                         $html .= '<label style="font-size:' . $formSettings[1] . '; color:';
                         $html .= $formSettings[2] . '; font-weight: ';
                         $html .= $formSettings[10] . '">' . htmlspecialchars($element[3]) . '</label>';
                         if ($element[3] == '') {
                             $element[3] = 'Date[]';
                         }
                         $html .= JHTML::calendar(date("Y-m-d"), $item, 'date_' . $id . $k, '%d %B %Y');
                         $item++;
                         $html .= '</div>';
                         $k++;
                     }
                     if ($element[2] == 'htmltext') {
                         $item++;
                         $html .= '<div class="ba-htmltext tool">' . $element[3];
                         $html .= '</div>';
                     }
                     if ($element[2] == 'chekInline') {
                         $options = explode(';', $element[3]);
                         $html .= '<div class="ba-chekInline tool">';
                         if ($options[0] != '') {
                             $html .= '<label style="font-size:' . $formSettings[1] . '; color:';
                             $html .= $formSettings[2] . '; font-weight: ';
                             $html .= $formSettings[10] . '"><span title="';
                             $html .= htmlspecialchars($options[1]) . '">' . htmlspecialchars($options[0]);
                             if (isset($options[3])) {
                                 if ($options[3] == 1) {
                                     $html .= ' *';
                                 }
                             }
                             $html .= '</span></label>';
                         }
                         $option = substr($options[2], 1, strlen($options[2]) - 2);
                         $option = explode('\\n', $option);
                         $html .= '<div class="';
                         if (isset($options[3])) {
                             if ($options[3] == 1) {
                                 $html .= 'required';
                             }
                         }
                         $html .= '">';
                         for ($i = 0; $i < count($option); $i++) {
                             $html .= "<span style='font-size:" . $formSettings[4] . "; color:";
                             $html .= $formSettings[5] . "'><input type='checkbox' name='";
                             $html .= $item;
                             $html .= "[]' value='";
                             $html .= htmlspecialchars($option[$i], ENT_QUOTES) . "'";
                             $html .= '/>' . htmlspecialchars($option[$i]) . '</span>';
                         }
                         $item++;
                         $html .= '</div></div>';
                     }
                     if ($element[2] == 'radioInline') {
                         $options = explode(';', $element[3]);
                         $html .= '<div class="ba-radioInline tool">';
                         if ($options[0] != '') {
                             $html .= '<label style="font-size:' . $formSettings[1] . '; color:';
                             $html .= $formSettings[2] . '; font-weight: ';
                             $html .= $formSettings[10] . '"><span title="';
                             $html .= htmlspecialchars($options[1]) . '">' . htmlspecialchars($options[0]);
                             if (isset($options[3])) {
                                 if ($options[3] == 1) {
                                     $html .= ' *';
                                 }
                             }
                             $html .= '</span></label>';
                         }
                         $option = substr($options[2], 1, strlen($options[2]) - 2);
                         $option = explode('\\n', $option);
                         for ($i = 0; $i < count($option); $i++) {
                             $html .= "<span style='font-size:" . $formSettings[4] . "; color:";
                             $html .= $formSettings[5] . "'><input type='radio' name='";
                             $html .= $item;
                             $html .= "' value='";
                             $html .= htmlspecialchars($option[$i], ENT_QUOTES) . "'";
                             if (isset($options[3])) {
                                 if ($options[3] == 1 && $i == 0) {
                                     $html .= ' required';
                                 }
                             }
                             $html .= '/>' . htmlspecialchars($option[$i]) . '</span>';
                         }
                         $item++;
                         $html .= '</div>';
                     }
                     if ($element[2] == 'checkMultiple') {
                         $options = explode(';', $element[3]);
                         $html .= '<div class="ba-checkMultiple tool">';
                         if ($options[0] != '') {
                             $html .= '<label style="font-size:' . $formSettings[1] . '; color:';
                             $html .= $formSettings[2] . '; font-weight: ';
                             $html .= $formSettings[10] . '"><span title="';
                             $html .= htmlspecialchars($options[1]) . '">' . htmlspecialchars($options[0]);
                             if ($options[3] == 1) {
                                 $html .= ' *';
                             }
                             $html .= '</span></label>';
                         }
                         $option = substr($options[2], 1, strlen($options[2]) - 2);
                         $option = explode('\\n', $option);
                         $html .= '<div class="';
                         if (isset($options[3])) {
                             if ($options[3] == 1) {
                                 $html .= 'required';
                             }
                         }
                         $html .= '">';
                         for ($i = 0; $i < count($option); $i++) {
                             $html .= "<span style='font-size:" . $formSettings[4] . "; color:";
                             $html .= $formSettings[5] . "'><input type='checkbox' name='";
                             $html .= $item;
                             $html .= "[]' value='";
                             $html .= htmlspecialchars($option[$i], ENT_QUOTES) . "'";
                             $html .= '/>' . htmlspecialchars($option[$i]) . '<br></span>';
                         }
                         $item++;
                         $html .= '</div></div>';
                     }
                     if ($element[2] == 'upload') {
                         $options = explode(';', $element[3]);
                         $html .= '<div class="ba-upload tool">';
                         if ($options[0] != '') {
                             $html .= '<label style="font-size:' . $formSettings[1] . '; color:';
                             $html .= $formSettings[2] . '; font-weight: ';
                             $html .= $formSettings[10] . '"><span title="';
                             $html .= htmlspecialchars($options[1]) . '">' . htmlspecialchars($options[0]);
                             $html .= '</span></label>';
                         }
                         $html .= "<input class='ba-upload' type='file'";
                         $html .= " name='";
                         $html .= $item;
                         $item++;
                         $html .= "'><br>";
                         $html .= '<span style="font-size: 12px; font-style:';
                         $html .= ' italic; color: #999;">' . $language->_('MAXIMUM_FILE_SIZE') . ' ' . $options[2];
                         $html .= 'mb (' . $options[3] . ')</span>';
                         $html .= '<input type="hidden" class="upl-size"';
                         $html .= ' value="' . $options[2] . '">';
                         $html .= '<input type="hidden" class="upl-type"';
                         $html .= ' value="' . $options[3] . '">';
                         $html .= '<input type="hidden" class="upl-error">';
                         $html .= "</div>";
                     }
                     if ($element[2] == 'radioMultiple') {
                         $options = explode(';', $element[3]);
                         $html .= '<div class="ba-radioMultiple tool">';
                         if ($options[0] != '') {
                             $html .= '<label style="font-size:' . $formSettings[1] . '; color:';
                             $html .= $formSettings[2] . '; font-weight: ';
                             $html .= $formSettings[10] . '"><span title="';
                             $html .= htmlspecialchars($options[1]) . '">' . htmlspecialchars($options[0]);
                             if (isset($options[3])) {
                                 if ($options[3] == 1) {
                                     $html .= ' *';
                                 }
                             }
                             $html .= '</span></label>';
                         }
                         $option = substr($options[2], 1, strlen($options[2]) - 2);
                         $option = explode('\\n', $option);
                         for ($i = 0; $i < count($option); $i++) {
                             $html .= "<span style='font-size:" . $formSettings[4] . "; color:";
                             $html .= $formSettings[5] . "'><input type='radio' name='";
                             $html .= $item;
                             $html .= "' value='";
                             $html .= htmlspecialchars($option[$i], ENT_QUOTES) . "'";
                             if (isset($options[3])) {
                                 if ($options[3] == 1 && $i == 0) {
                                     $html .= ' required';
                                 }
                             }
                             $html .= '/>' . htmlspecialchars($option[$i]) . '<br></span>';
                         }
                         $item++;
                         $html .= '</div>';
                     }
                     if ($element[2] == 'dropdown') {
                         $options = explode(';', $element[3]);
                         $html .= '<div class="ba-dropdown tool">';
                         if ($options[0] != '') {
                             $html .= '<label style="font-size:' . $formSettings[1] . '; color:';
                             $html .= $formSettings[2] . '; font-weight: ';
                             $html .= $formSettings[10] . '"><span title="';
                             $html .= htmlspecialchars($options[1]) . '">' . htmlspecialchars($options[0]);
                             if (isset($options[3])) {
                                 if ($options[3] == 1) {
                                     $html .= ' *';
                                 }
                             }
                             $html .= '</span></label>';
                         }
                         $option = substr($options[2], 1, strlen($options[2]) - 2);
                         $option = explode('\\n', $option);
                         $html .= '<select style="height:' . $formSettings[3] . '; ';
                         $html .= 'font-size:' . $formSettings[4] . ';color:' . $formSettings[5];
                         $html .= '; background-color:' . $formSettings[6] . '; ';
                         $html .= $formSettings[7] . '"';
                         $html .= " name='";
                         $html .= $item;
                         $item++;
                         $html .= "'";
                         if (isset($options[3])) {
                             if ($options[3] == 1) {
                                 $html .= ' required';
                             }
                         }
                         $html .= '>';
                         $html .= '<option value="">Select</option>';
                         for ($i = 0; $i < count($option); $i++) {
                             $html .= '<option value="';
                             $html .= htmlspecialchars($option[$i], ENT_QUOTES) . '">' . htmlspecialchars($option[$i]) . '</option>';
                         }
                         $html .= '</select></div>';
                     }
                     if ($element[2] == 'selectMultiple') {
                         $options = explode(';', $element[3]);
                         $html .= '<div class="ba-selectMultiple tool">';
                         if ($options[0] != '') {
                             $html .= '<label style="font-size:' . $formSettings[1] . '; color:';
                             $html .= $formSettings[2] . '; font-weight: ';
                             $html .= $formSettings[10] . '"><span title="';
                             $html .= htmlspecialchars($options[1]) . '">' . htmlspecialchars($options[0]);
                             if (isset($options[3])) {
                                 if ($options[3] == 1) {
                                     $html .= ' *';
                                 }
                             }
                             $html .= '</span></label>';
                         }
                         $option = substr($options[2], 1, strlen($options[2]) - 2);
                         $option = explode('\\n', $option);
                         $html .= '<select multiple size="' . $options[4] . '" style="';
                         $html .= 'font-size:' . $formSettings[4] . ';color:' . $formSettings[5];
                         $html .= '; background-color:' . $formSettings[6] . '; ';
                         $html .= $formSettings[7] . '"';
                         $html .= " name='";
                         $html .= $item;
                         $item++;
                         $html .= "[]'";
                         if (isset($options[3])) {
                             if ($options[3] == 1) {
                                 $html .= ' required';
                             }
                         }
                         $html .= '>';
                         for ($i = 0; $i < count($option); $i++) {
                             $html .= '<option value="';
                             $html .= htmlspecialchars($option[$i], ENT_QUOTES) . '">' . htmlspecialchars($option[$i]) . '</option>';
                         }
                         $html .= '</select></div>';
                     }
                     if ($element[2] == 'map') {
                         $options = explode(';', $element[3]);
                         $html .= '<div><div class="ba-map tool" style="width:' . $options[3];
                         $html .= '%; height:' . $options[4] . 'px;"></div>';
                         $html .= "<input type='hidden' value='{$element['3']}' class='ba-options'></div>";
                         $item++;
                     }
                     if ($element[2] == 'slider') {
                         $options = explode(';', $element[3]);
                         $html .= '<div class="slider tool">';
                         if ($options[0] != '') {
                             $html .= '<label style="font-size:' . $formSettings[1] . '; color:';
                             $html .= $formSettings[2] . '; font-weight: ';
                             $html .= $formSettings[10] . '"><span title="';
                             $html .= htmlspecialchars($options[1]) . '">' . htmlspecialchars($options[0]);
                             $html .= '</span></label>';
                         }
                         $html .= '<input type="hidden" class="ba-slider-values" ';
                         $html .= " name='";
                         $html .= $item;
                         $item++;
                         $html .= "'";
                         $html .= '>';
                         $html .= '<div class="ba-slider"></div>';
                         $html .= '<input type="hidden" value="' . htmlspecialchars($element[3]) . '" class="ba-options"></div>';
                     }
                 }
             }
             $html .= '</div>';
         }
         if (trim($column[1]) == 'span12') {
             $html .= '</div>';
         }
         if (trim($column[1]) == 'span6') {
             if ($row == 2) {
                 $html .= '</div>';
                 $row = '';
             }
         }
         if (trim($column[1]) == 'span4') {
             if ($row == 3) {
                 $html .= '</div>';
                 $row = '';
             }
         }
         if (trim($column[1]) == 'span3') {
             if ($row == 4) {
                 $html .= '</div>';
                 $row = '';
             }
         }
     }
     $capt = $submissionsOptions['alow_captcha'];
     if ($capt != '0') {
         $captcha = JCaptcha::getInstance($capt);
         $captcha->initialise($capt);
         $html .= "<div class='tool ba-captcha'>";
         $html .= $captcha->display($capt, $capt);
         $html .= "</div>";
     }
     if ($n != 1) {
         $html .= '<div class="ba-prev"><input type="button" value="';
         $html .= $last[0] . '" style="border-radius:' . $last[7];
         $html .= 'px; background-color: #' . $last[3] . '; font-size:';
         $html .= $last[5] . 'px; font-weight:' . $last[6] . '; width:';
         $html .= $last[1] . 'px; height:' . $last[2] . 'px; color: #' . $last[4];
         $html .= '" class="btn-prev"></div>';
     }
     if ($submissionsOptions['display_submit'] == 1) {
         $html .= '<div class="row-fluid ba-row"><div class="span12" style="' . $buttonAligh . '">';
         $html .= '<input class="ba-btn-submit" type="submit" style="' . $buttonStyle;
         $html .= '" value="' . $button . '" ' . $embed . '>';
         $html .= '</div></div>';
     }
     $html .= '</div><input type="hidden" class="redirect" value="';
     $html .= $submissionsOptions['redirect_url'] . '">';
     $html .= '<input type="hidden" class="sent-massage" value="';
     $html .= htmlspecialchars($submissionsOptions['sent_massage']) . '">';
     $html .= '<input type="hidden" value="' . JURI::base();
     $html .= '" class="admin-dirrectory">';
     $html .= '<input type="hidden" name="form_id" value="' . $id . '">';
     $html .= '<input type="hidden" name="task" value="form.save">';
     $html .= '';
     $html .= '';
     $html .= '';
     $html .= '</div>';
     $html .= '</form>';
     if ($popup['display_popup'] == 1) {
         $html .= '</div></div></div>';
     }
     $html .= "</div>";
     return $html;
 }
コード例 #2
0
ファイル: baforms.php プロジェクト: pupsikus/iman007.test
 public static function drawHTMLPage($id)
 {
     $item = 1;
     $form = baformsHelper::getForm($id);
     $columns = baformsHelper::getColumn($id);
     $elements = baformsHelper::getElement($id);
     $submissionsOptions = baformsHelper::getSubmisionOptions($id);
     $html = "";
     $title = $form[0]->title;
     $titleSettings = $form[0]->title_settings;
     $formSettings = $form[0]->form_settings;
     $formSettings = explode('/', $formSettings);
     $uri = JURI::getInstance();
     $url = $uri->toString(array('scheme', 'host', 'port')) . JURI::root(true);
     $url .= '/index.php?option=com_baforms&amp;view=form&amp;task=form.save&amp;form_id=';
     $url .= $id;
     $formStyle = explode(';', $formSettings[9]);
     $html .= '<form action="' . $url . '"';
     $html .= ' method="post" class="form-validate" enctype="multipart/form-data">';
     $html .= '<div style="';
     $html .= $formStyle[0] . '; ';
     $html .= $formStyle[1] . ';' . $formStyle[2] . ';' . $formStyle[3];
     $html .= '" class="ba-form ' . $formSettings[0] . '">';
     if ($submissionsOptions['display_title'] == 1) {
         $html .= '<div class="row-fluid ba-row" style="' . $titleSettings . '"><div class="span12">';
         $html .= $title . '</div></div>';
     }
     $row = '';
     $k = 0;
     if (empty($columns)) {
         foreach ($elements as $element) {
             $element = explode('_-_', $element->settings);
             if ($element[0] == 'button') {
                 $button = $element[1];
                 $buttonStyle = $element[2];
                 $buttonAligh = $element[3];
             }
         }
     }
     $n = 1;
     $html .= '<div class="page-0">';
     foreach ($columns as $column) {
         $column = explode(',', $column->settings);
         if (trim($column[1]) == 'span12') {
             $html .= '<div class="row-fluid ba-row">';
         }
         if (trim($column[1]) == 'span6') {
             if ($row == 1) {
                 $row = 2;
             }
             if ($row == '') {
                 $html .= '<div class="row-fluid ba-row">';
                 $row = 1;
             }
         }
         if (trim($column[1]) == 'span4') {
             if ($row == 2) {
                 $row = 3;
             }
             if ($row == 1) {
                 $row = 2;
             }
             if ($row == '') {
                 $html .= '<div class="row-fluid ba-row">';
                 $row = 1;
             }
         }
         if (trim($column[1]) == 'span3') {
             if ($row == 3) {
                 $row = 4;
             }
             if ($row == 2) {
                 $row = 3;
             }
             if ($row == 1) {
                 $row = 2;
             }
             if ($row == '') {
                 $html .= '<div class="row-fluid ba-row">';
                 $row = 1;
             }
         }
         if (trim($column[1]) != 'spank') {
             $html .= '<div class="' . $column[1] . '">';
             foreach ($elements as $element) {
                 $element = explode('_-_', $element->settings);
                 if ($element[0] == 'button') {
                     $button = $element[1];
                     $buttonStyle = $element[2];
                     $buttonAligh = $element[3];
                 }
                 if ($element[0] == $column[0]) {
                     if ($element[2] == 'textInput') {
                         $options = explode(';', $element[3]);
                         $html .= '<div class="ba-textInput tool">';
                         if ($options[0] != '') {
                             $html .= '<label style="font-size:' . $formSettings[1] . '; color:';
                             $html .= $formSettings[2] . '; font-weight: ';
                             $html .= $formSettings[10] . '"><span title="';
                             $html .= $options[1] . '">' . $options[0];
                             if (isset($options[3])) {
                                 if ($options[3] == 1) {
                                     $html .= ' *';
                                 }
                             }
                             $html .= '</span></label>';
                         }
                         $html .= '<input type="text" data-type="' . $options[4];
                         $html .= '" style="height:' . $formSettings[3] . '; ';
                         $html .= 'font-size:' . $formSettings[4] . ';color:' . $formSettings[5];
                         $html .= '; background-color:' . $formSettings[6] . '; ';
                         $html .= $formSettings[7] . '; border-radius:' . $formSettings[8] . '"';
                         $html .= " placeholder='" . $options[2] . "'";
                         $html .= " name='";
                         $html .= $item;
                         $item++;
                         $html .= "'";
                         if (isset($options[3])) {
                             if ($options[3] == 1) {
                                 $html .= ' required';
                             }
                         }
                         $html .= '><br></div>';
                     }
                     if ($element[2] == 'email') {
                         $options = explode(';', $element[3]);
                         $html .= '<div class="ba-email tool">';
                         if ($options[0] != '') {
                             $html .= '<label style="font-size:' . $formSettings[1] . '; color:';
                             $html .= $formSettings[2] . '; font-weight: ';
                             $html .= $formSettings[10] . '"><span title="';
                             $html .= $options[1] . '">' . $options[0] . '</span></label>';
                         }
                         $html .= '<input type="email" style="height:' . $formSettings[3] . '; ';
                         $html .= 'font-size:' . $formSettings[4] . ';color:' . $formSettings[5];
                         $html .= '; background-color:' . $formSettings[6] . '; ';
                         $html .= $formSettings[7] . '; border-radius:' . $formSettings[8] . '"';
                         $html .= " placeholder='" . $options[2];
                         $html .= "' required";
                         $html .= " name='";
                         $html .= $item;
                         $item++;
                         $html .= "'";
                         $html .= '></div>';
                     }
                     if ($element[2] == 'textarea') {
                         $options = explode(';', $element[3]);
                         $html .= '<div class="ba-textarea tool">';
                         if ($options[0] != '') {
                             $html .= '<label style="font-size:' . $formSettings[1] . '; color:';
                             $html .= $formSettings[2] . '; font-weight: ';
                             $html .= $formSettings[10] . '"><span  title="';
                             $html .= $options[1] . '">' . $options[0];
                             if (isset($options[3])) {
                                 if ($options[3] == 1) {
                                     $html .= ' *';
                                 }
                             }
                             $html .= '</span></label>';
                         }
                         $html .= '<textarea style="height:' . $formSettings[3] . '; ';
                         $html .= 'font-size:' . $formSettings[4] . ';color:' . $formSettings[5];
                         $html .= '; background-color:' . $formSettings[6] . '; ';
                         $html .= $formSettings[7] . '; border-radius:' . $formSettings[8];
                         $html .= '; min-height:' . $options[4] . 'px;"';
                         $html .= " placeholder='" . $options[2];
                         $html .= "'";
                         $html .= " name='";
                         $html .= $item;
                         $item++;
                         $html .= "'";
                         if (isset($options[3])) {
                             if ($options[3] == 1) {
                                 $html .= ' required';
                             }
                         }
                         $html .= '></textarea><br></div>';
                     }
                     if ($element[2] == 'htmltext') {
                         $item++;
                         $html .= '<div class="ba-htmltext tool">' . $element[3];
                         $html .= '</div>';
                     }
                     if ($element[2] == 'map') {
                         $item++;
                         $options = explode(';', $element[3]);
                         $html .= '<div><div class="ba-map tool" style="width:' . $options[3];
                         $html .= '%; height:' . $options[4] . 'px;"></div>';
                         $html .= "<input type='hidden' value='{$element['3']}' class='ba-options'></div>";
                     }
                 }
             }
             $html .= '</div>';
         }
         if (trim($column[1]) == 'span12') {
             $html .= '</div>';
         }
         if (trim($column[1]) == 'span6') {
             if ($row == 2) {
                 $html .= '</div>';
                 $row = '';
             }
         }
         if (trim($column[1]) == 'span4') {
             if ($row == 3) {
                 $html .= '</div>';
                 $row = '';
             }
         }
         if (trim($column[1]) == 'span3') {
             if ($row == 4) {
                 $html .= '</div>';
                 $row = '';
             }
         }
     }
     $capt = $submissionsOptions['alow_captcha'];
     if ($capt != '0') {
         $captcha = JCaptcha::getInstance($capt);
         $captcha->initialise($capt);
         $html .= "<div class='tool ba-captcha'>";
         $html .= $captcha->display($capt, $capt);
         $html .= "</div>";
     }
     if ($submissionsOptions['display_submit'] == 1) {
         $html .= '<div class="row-fluid ba-row"><div class="span12" style="' . $buttonAligh . '">';
         $html .= '<input class="ba-btn-submit" type="submit" style="' . $buttonStyle;
         $html .= '" value="' . $button . '"><br><br><span class="message"></span>';
         $html .= '</div></div>';
     }
     $html .= '</div><input type="hidden" class="redirect" value="';
     $html .= $submissionsOptions['redirect_url'] . '">';
     $html .= '<input type="hidden" class="sent-massage" value="';
     $html .= $submissionsOptions['sent_massage'] . '">';
     $html .= '<input type="hidden" value="' . JURI::base();
     $html .= '" class="admin-dirrectory">';
     $html .= '<input type="hidden" name="form_id" value="' . $id . '">';
     $html .= '<input type="hidden" name="task" value="form.save">';
     $html .= '</div>';
     $html .= '<p style="text-align: center; font-style: italic; color: #b1b1b1;font-size: 12px;">';
     $msg = "";
     $html .= $msg . ' <a href="http://www.balbooa.com/joomla-forms" target="_blank"></a></p>';
     $html .= '</form>';
     return $html;
 }