Exemplo n.º 1
0
	function order($option, $pkg, $form, $page, $ids, $inc)
	{
		global $database;
		$database = JFactory::getDBO();
		$row = new facileFormsElements($database);
		$row->load($ids[0]);
		$row->move($inc, "form=$form and page=$page" );
		JFactory::getApplication()->redirect("index.php?option=$option&act=editpage&form=$form&page=$page&pkg=$pkg");
	} // order
Exemplo n.º 2
0
 static function order($option, $pkg, $form, $page, $ids, $inc)
 {
     global $database;
     $database = JFactory::getDBO();
     $row = new facileFormsElements($database);
     $row->load($ids[0]);
     $row->move($inc, "form={$form} and page={$page}");
     JFactory::getApplication()->redirect("index.php?option={$option}&act=editpage&form={$form}&page={$page}&pkg={$pkg}");
 }
Exemplo n.º 3
0
	function copy($option, $pkg, $ids)
	{
		global $database;
		$database = JFactory::getDBO();
		$total = count($ids);
		$row = new facileFormsForms($database);
		$elem = new facileFormsElements($database);
		if (count($ids)) foreach ($ids as $id) {
			$row->load(intval($id));
			$row->id       = NULL;
			$row->ordering = 999999;
			$row->store();
			$row->reorder('');
			$database->setQuery("select id from #__facileforms_elements where form=$id");
			$eids = $database->loadObjectList();
			for($i = 0; $i < count($eids); $i++) {
				$eid = $eids[$i];
				$elem->load(intval($eid->id));
				$elem->id      = NULL;
				$elem->form    = $row->id;
				$elem->store();
			} // for
		} // foreach
		$msg = $total.' '.BFText::_('COM_BREEZINGFORMS_FORMS_SUCOPIED');
		JFactory::getApplication()->redirect("index.php?option=$option&act=manageforms&pkg=$pkg&mosmsg=$msg");
	} // copy
Exemplo n.º 4
0
 static function copy($option, $pkg, $ids)
 {
     global $database;
     JArrayHelper::toInteger($ids);
     require_once JPATH_SITE . '/administrator/components/com_breezingforms/admin/quickmode.class.php';
     require_once JPATH_SITE . '/administrator/components/com_breezingforms/libraries/Zend/Json/Decoder.php';
     require_once JPATH_SITE . '/administrator/components/com_breezingforms/libraries/Zend/Json/Encoder.php';
     $database = JFactory::getDBO();
     $total = count($ids);
     $row = new facileFormsForms($database);
     $elem = new facileFormsElements($database);
     if (count($ids)) {
         foreach ($ids as $id) {
             $row->load(intval($id));
             $row->id = NULL;
             $row->ordering = 999999;
             $row->title = 'Copy of ' . $row->title;
             $row->name = 'copy_' . $row->name;
             $row->store();
             $row->reorder('');
             $database->setQuery("select id from #__facileforms_elements where form={$id}");
             $eids = $database->loadObjectList();
             for ($i = 0; $i < count($eids); $i++) {
                 $eid = $eids[$i];
                 $elem->load(intval($eid->id));
                 $elem->id = NULL;
                 $elem->form = $row->id;
                 $elem->store();
             }
             // for
             // resetting easy and quickmode database ids
             JFactory::getDBO()->setQuery("Select template_areas, template_code_processed, template_code From #__facileforms_forms Where id = " . intval($row->{$id}));
             $row_ = JFactory::getDBO()->loadObject();
             if (trim($row_->template_code) != '') {
                 $areas = Zend_Json::decode($row_->template_areas);
                 $i = 0;
                 foreach ($areas as $area) {
                     $j = 0;
                     foreach ($area['elements'] as $element) {
                         $areas[$i]['elements'][$j]['dbId'] = 0;
                         $j++;
                     }
                     $i++;
                 }
                 $template_areas = Zend_Json::encode($areas);
                 $template_code = $row_->template_code;
                 if ($row_->template_code_processed == 'QuickMode') {
                     $dataObject = Zend_Json::decode(base64_decode($row_->template_code));
                     resetQuickModeDbId($dataObject);
                     $template_code = base64_encode(Zend_Json::encode($dataObject));
                 }
                 JFactory::getDBO()->setQuery("Update #__facileforms_forms Set template_code = " . JFactory::getDBO()->Quote($template_code) . ", template_areas = " . JFactory::getDBO()->Quote($template_areas) . " Where id = " . intval($id));
                 JFactory::getDBO()->query();
                 if ($row_ && $row_->template_code_processed == 'QuickMode') {
                     $quickMode = new QuickMode();
                     $quickMode->save($id, Zend_Json::decode(base64_decode($template_code)));
                 }
             }
             // reset end
         }
     }
     // foreach
     $msg = $total . ' ' . BFText::_('COM_BREEZINGFORMS_FORMS_SUCOPIED');
     JFactory::getApplication()->redirect("index.php?option={$option}&act=manageforms&pkg={$pkg}&mosmsg={$msg}");
 }