%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/lightco1/www/components/com_baforms/helpers/
Upload File :
Create Path :
Current File : /home/lightco1/www/components/com_baforms/helpers/baforms.php

<?php
/**
* @package   BaForms
* @author    Balbooa http://www.balbooa.com/
* @copyright Copyright @ Balbooa
* @license   http://www.gnu.org/licenses/gpl.html GNU/GPL
*/

defined('_JEXEC') or die;

abstract class baformsHelper 
{
    public static function addStyle()
    {
        $document = JFactory::getDocument();
        $regex = '/\[forms ID=+(.*?)\]/i';
        $buffer = $document->getBuffer();
        foreach ($buffer as $buff) {
            foreach ($buff as $pos) {
                foreach ($pos as $items) {
                    preg_match_all($regex, $items, $matches, PREG_SET_ORDER);
                    if ($matches) {
                        foreach ($matches as $index => $match) {
                            $id = $match[1];
                            if (self::checkForm($id)) {
                                self::addScripts($id);
                            }
                        }
                    }
                }
            }
        }
        $app = JFactory::getApplication();
        if ($app->getTemplate() == 'g5_hydrogen') {
            $db = JFactory::getDbo();
            $query = $db->getQuery(true);
            $query->select("alow_captcha");
            $query->from("#__baforms_forms");
            $query->where("published = 1");
            $query->order("id ASC");
            $db->setQuery($query);
            $items = $db->loadObjectList();
            foreach ($items as $item) {
                if ($item->alow_captcha != '0') {
                    $captch = JCaptcha::getInstance($item->alow_captcha);
                    $captch->initialise($item->alow_captcha);
                }
            }
        }
    }
    
    public static function addScripts($id)
    {
        $document = JFactory::getDocument();
        $scripts = $document->_scripts;
        $doc = array();
        $map = true;
        foreach ($scripts as $key=>$script) {
            if (strpos($key, 'maps.googleapis.com/maps/api/js')) {
                $map = false;
            }
            $key = explode('/', $key);
            $doc[] = end($key);
        }
        if (!in_array('jquery.min.js', $doc) && !in_array('jquery.js', $doc)) {
            $document->addScript(JUri::root(true) . '/media/jui/js/jquery.min.js');
        }
        if (!in_array('bootstrap.min.js', $doc) && !in_array('bootstrap.js', $doc)) {
            $document->addScript(JUri::root(true) . '/media/jui/js/bootstrap.min.js');
        }
        $document->addStyleSheet(JURI::root() . 'components/com_baforms/assets/css/ba-style.css');
        $captcha = self::getCaptcha($id);
        if ($captcha != '0') {
            $captch = JCaptcha::getInstance($captcha);
            $captch->initialise($captcha);
        }
        $elements = self::getElement($id);
        foreach ($elements as $element) {
            $element = explode('_-_', $element->settings);
            if ($element[2] == 'map') {
                if ($map) {
                    $document->addScript('https://maps.googleapis.com/maps/api/js');
                }
            }
            if ($element[2] == 'date') {
                $document->addScript(JUri::root(true) . '/media/system/js/calendar.js');
                $document->addScript(JUri::root(true) . '/media/system/js/calendar-setup.js');
                $document->addStyleSheet(JUri::root(true) . '/media/system/css/calendar-jos.css');
            }
            if ($element[2] == 'slider') {
                $document->addScript(JUri::root() . 'components/com_baforms/libraries/bootstrap-slider/bootstrap-slider.js');
            }
        }
        $document->addScript(JUri::root() . 'components/com_baforms/libraries/modal/ba_modal.js');
        $document->addScript(JURI::root() . 'components/com_baforms/assets/js/ba-form.js');
    }
    
    public static function drawHTMLPage($id) 
    {
        $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 ba-forms-modal"><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  ba-forms-modal"><div class="ba-modal';
            $html .= ' fade hide popup-form" id="popup-form-'.$id.'" style="display: none; ';
            $html .= 'width: ' .$popup['modal_width']. 'px">';
            $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) {
                    $settings = explode('_-_', $element->settings);
                    if ($settings[0] == 'button') {
                        $button = $settings[1];
                        $buttonStyle = $settings[2];
                        $buttonAligh = $settings[3];
                    }
                    if ($settings[0] == $column[0]) {
                        if ($settings[2] == 'textInput') {
                            $options = explode(';', $settings[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 .= $element->id;
                            $html .= "'";
                            if (isset($options[3])) {
                                if ($options[3] == 1) {
                                    $html .= ' required';
                                }
                            }
                            $html .= '><br></div>';
                        }
                        if ($settings[2] == 'email') {
                            $options = explode(';', $settings[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 .= $element->id;
                            $html .= "'";
                            $html .= '></div>';
                        }
                        if ($settings[2] == 'textarea') {
                            $options = explode(';', $settings[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 .= $element->id;
                            $html .= "'";
                            if (isset($options[3])) {
                                if ($options[3] == 1) {
                                    $html .= ' required';
                                }
                            }
                            $html .= '></textarea><br></div>';
                        }
                        if ($settings[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($settings[3]). '</label>';
                            if ($settings[3] == '') {
                                $settings[3] = 'Date[]';
                            }
                            $html .= JHTML::calendar(date("Y-m-d"), $element->id,'date_'.$id.$k,'%d %B %Y');
                            $html .= '</div>';
                            $k++;
                        }
                        if ($settings[2] == 'htmltext') {
                            $html .= '<div class="ba-htmltext tool">' .$settings[3];
                            $html .= '</div>';
                        }
                        if ($settings[2] == 'chekInline') {
                            $options = explode(';', $settings[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 .= $element->id;
                                $html .= "[]' value='";
                                $html .= htmlspecialchars($option[$i], ENT_QUOTES). "'";
                                $html .= '/>' .htmlspecialchars($option[$i]). '</span>';
                            }
                            $html .= '</div></div>';
                        }
                        if ($settings[2] == 'radioInline') {
                            $options = explode(';', $settings[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 .= $element->id;
                                $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>';
                            }
                            $html .= '</div>';
                        }
                        if ($settings[2] == 'checkMultiple') {
                            $options = explode(';', $settings[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 .= $element->id;
                                $html .= "[]' value='";
                                $html .= htmlspecialchars($option[$i], ENT_QUOTES). "'";
                                $html .= '/>' .htmlspecialchars($option[$i]). '<br></span>';
                            }
                            $html .= '</div></div>';
                        }
                        if ($settings[2] == 'upload') {
                            $options = explode(';', $settings[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 .= $element->id;
                            $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 ($settings[2] == 'radioMultiple') {
                            $options = explode(';', $settings[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 .= $element->id;
                                $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>';
                            }
                            $html .= '</div>';
                        }
                        if ($settings[2] == 'dropdown') {
                            $options = explode(';', $settings[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 .= $element->id;
                            $html .= "'";
                            if (isset($options[3])) {
                                if ($options[3] == 1) {
                                    $html .= ' required';
                                }
                            }
                            $html .= '>';
                            $html .= '<option value="">' .$language->_('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 ($settings[2] == 'selectMultiple') {
                            $options = explode(';', $settings[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 .= $element->id;
                            $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 ($settings[2] == 'map') {
                            $options = explode(';', $settings[3]);
                            $html .= '<div><div class="ba-map tool" style="width:' .$options[3];
                            $html .= '%; height:' .$options[4]. 'px;"></div>';
                            $html .= "<input type='hidden' value='$settings[3]' class='ba-options'></div>";
                        }
                        if ($settings[2] == 'slider') {
                            $options = explode(';', $settings[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 .= $element->id;
                            $html .= "'";
                            $html .= '>';
                            $html .= '<div class="ba-slider"></div>';
                            $html .= '<input type="hidden" value="' .htmlspecialchars($settings[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::root();
        $html .= '" class="admin-dirrectory">';
        $html .= '<input type="hidden" name="form_id" value="' .$id. '">';
        $html .= '<input type="hidden" name="task" value="form.save">';
        $html .= '<p style="text-align: center; font-size: 12px; font-style:';
        $html .= ' italic;"><a href="http://www.balbooa.com/joomla-forms">';
        $html .= 'Joomla Forms</a> makes it right. Balbooa.com</p>';
        $html .= '</div>';
        $html .='</form>';
        if ($popup['display_popup'] == 1) {
            $html .= '</div></div></div>';
        }
        $html .= "</div>";
        return $html;
    }
    
    /*
        get the submission options of the form
    */
    protected static function getSubmisionOptions($id)
    {
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);
        $query->select("alow_captcha, display_title, sent_massage, error_massage,
                        redirect_url, display_submit, 	dialog_color_rgba,
                        message_color_rgba, message_bg_rgba");
        $query->from("#__baforms_forms");
        $query->where("id=" . $id);
        $db->setQuery($query);
		$items = $db->loadAssoc();
        return $items;
    }
    
    public static function getCaptcha($id)
    {
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);
        $query->select("alow_captcha");
        $query->from("#__baforms_forms");
        $query->where("id=" . $id);
        $db->setQuery($query);
		$items = $db->loadResult();
        return $items;
    }
    
    /*
        get the form
    */
    protected static function getForm($id)
    {
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);
        $query->select("title, title_settings, form_settings");
        $query->from("#__baforms_forms");
        $query->where("id=" . $id);
        $db->setQuery($query);
		$items = $db->loadObjectList();
        return $items;
    }
    
    /*
        get the fomr columns
    */
    protected static function getColumn($id)
    {
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);
        $query->select("settings");
        $query->from("#__baforms_columns");
        $query->where("form_id=" . $id);
        $query->order("id ASC");
        $db->setQuery($query);
		$items = $db->loadObjectList();
        return $items;
    }
    
    /*
        get the form items
    */
    public static function getElement($id)
    {
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);
        $query->select("settings, id");
        $query->from("#__baforms_items");
        $query->where("form_id=" . $id);
        $query->order("id ASC");
        $db->setQuery($query);
		$items = $db->loadObjectList();
        return $items;
    }
    
    /*
        check the publishing of the form
    */
    public static function checkForm($id)
    {
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);
        $query->select("published");
        $query->from("#__baforms_forms");
        $query->where("id=" . $id);
        $db->setQuery($query);
        $publish = $db->loadResult();
        if (isset($publish)) {
            if ($publish == 1) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }
    
    public static function getEmbed($id)
    {
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);
        $query->select("submit_embed");
        $query->from("#__baforms_forms");
        $query->where("id=" . $id);
        $db->setQuery($query);
		$items = $db->loadResult();
        return $items;
    }
    
    /*
        get the popup options
    */
    public static function getPopup($id)
    {
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);
        $query->select("display_popup, button_lable, button_position, button_bg,
                        button_color, button_font_size, button_weight,
                        button_border, modal_width");
        $query->from("#__baforms_forms");
        $query->where("id=" . $id);
        $db->setQuery($query);
		$items = $db->loadAssoc();
        return $items;
    }
}

Zerion Mini Shell 1.0