Example #1
0
             require_once JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_contentbuilder' . DS . 'classes' . DS . 'contentbuilder.php';
             $cbForm = contentbuilder::getForm('com_breezingforms', $formId);
             $db = JFactory::getDBO();
             $db->setQuery("Select id From #__contentbuilder_forms Where `type` = 'com_breezingforms' And `reference_id` = " . intval($formId));
             jimport('joomla.version');
             $version = new JVersion();
             if (version_compare($version->getShortVersion(), '3.0', '>=')) {
                 $cbForms = $db->loadColumn();
             } else {
                 $cbForms = $db->loadResultArray();
             }
             if (is_object($cbForm) && count($cbForms)) {
                 require_once JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_contentbuilder' . DS . 'tables' . DS . 'elements.php';
                 foreach ($cbForms as $dataId) {
                     contentbuilder::synchElements($dataId, $cbForm);
                     $elements_table = new TableElements($db);
                     $elements_table->reorder('form_id=' . $dataId);
                 }
             }
         }
         ob_end_clean();
         echo $formId;
         exit;
         // CONTENTBUILDER END
     }
     exit;
     break;
 case 'save':
     $formId = JRequest::getInt('form', 0);
     $fOptions = $quickMode->getFormOptions($formId);
     if ($fOptions == null) {
 static function save($option, $pkg, $form, $page)
 {
     global $database;
     $database = JFactory::getDBO();
     $row = new facileFormsElements($database);
     // bind it to the table
     if (!$row->bind($_POST)) {
         echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
         exit;
     }
     // if
     if ($row->script1flag1 == null) {
         $row->script1flag1 = 0;
     }
     if ($row->script1flag2 == null) {
         $row->script1flag2 = 0;
     }
     if ($row->script2flag1 == null) {
         $row->script2flag1 = 0;
     }
     if ($row->script2flag2 == null) {
         $row->script2flag2 = 0;
     }
     if ($row->script2flag3 == null) {
         $row->script2flag3 = 0;
     }
     if ($row->script2flag4 == null) {
         $row->script2flag4 = 0;
     }
     if ($row->script2flag5 == null) {
         $row->script2flag5 = 0;
     }
     // store it in the db
     if (!$row->store()) {
         echo "<script> alert('" . $row->getError() . "'); window.history.go(-1); </script>\n";
         exit;
     }
     // if
     $row->reorder("form={$form} and page={$page}");
     // CONTENTBUILDER
     jimport('joomla.filesystem.file');
     jimport('joomla.filesystem.folder');
     if (JFile::exists(JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_contentbuilder' . DS . 'classes' . DS . 'contentbuilder.php')) {
         $formId = $form;
         require_once JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_contentbuilder' . DS . 'classes' . DS . 'contentbuilder.php';
         $cbForm = contentbuilder::getForm('com_breezingforms', $formId);
         $db = JFactory::getDBO();
         $db->setQuery("Select id From #__contentbuilder_forms Where `type` = 'com_breezingforms' And `reference_id` = " . intval($formId));
         jimport('joomla.version');
         $version = new JVersion();
         if (version_compare($version->getShortVersion(), '3.0', '>=')) {
             $cbForms = $db->loadColumn();
         } else {
             $cbForms = $db->loadResultArray();
         }
         if (is_object($cbForm) && count($cbForms)) {
             require_once JPATH_SITE . DS . 'administrator' . DS . 'components' . DS . 'com_contentbuilder' . DS . 'tables' . DS . 'elements.php';
             foreach ($cbForms as $dataId) {
                 contentbuilder::synchElements($dataId, $cbForm);
                 $elements_table = new TableElements($db);
                 $elements_table->reorder('form_id=' . $dataId);
             }
         }
     }
     // CONTENTBUILDER END
     JFactory::getApplication()->redirect("index.php?option={$option}&act=editpage&form={$form}&page={$page}&pkg={$pkg}", BFText::_('COM_BREEZINGFORMS_ELEMENTS_SAVED'));
 }