Version Notes
Fixed phone number and form image issues
Download this release
Release Info
Developer | Prakash Vaniya |
Extension | Phxsolution_Formbuilder |
Version | 0.3.2 |
Comparing to | |
See all releases |
Code changes from version 0.3.1 to 0.3.2
- app/code/community/Phxsolution/Formbuilder/Block/Adminhtml/Formbuilder/Edit/Tab/Form.php +188 -188
- app/code/community/Phxsolution/Formbuilder/Block/Adminhtml/Formbuilder/Renderer/Image.php +43 -40
- app/code/community/Phxsolution/Formbuilder/Block/Adminhtml/Formbuilder/Renderer/Recordvalue.php +11 -10
- app/code/community/Phxsolution/Formbuilder/Block/Adminhtml/Formbuilder/Renderer/Recordvalue.php-31-oct-15 +101 -0
- app/code/community/Phxsolution/Formbuilder/Helper/Data.php +377 -373
- app/code/community/Phxsolution/Formbuilder/controllers/Adminhtml/FormbuilderController.php +44 -44
- app/code/community/Phxsolution/Formbuilder/etc/config.xml +1 -1
- app/etc/modules/Phxsolution_Formbuilder.xml +1 -1
- package.xml +7 -7
- skin/frontend/base/default/css/formbuilder/custom.css +29 -27
app/code/community/Phxsolution/Formbuilder/Block/Adminhtml/Formbuilder/Edit/Tab/Form.php
CHANGED
@@ -1,189 +1,189 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
/**
|
4 |
-
* Phxsolution Formbuilder
|
5 |
-
*
|
6 |
-
* NOTICE OF LICENSE
|
7 |
-
*
|
8 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
-
* that is bundled with this package in the file LICENSE.txt.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://opensource.org/licenses/osl-3.0.php
|
12 |
-
* If you did not receive a copy of the license and are unable to
|
13 |
-
* obtain it through the world-wide-web, please send an email
|
14 |
-
* to license@magentocommerce.com so you can be sent a copy immediately.
|
15 |
-
*
|
16 |
-
* Original code copyright (c) 2008 Irubin Consulting Inc. DBA Varien
|
17 |
-
*
|
18 |
-
* @category adminhtml block
|
19 |
-
* @package Phxsolution_Formbuilder
|
20 |
-
* @author Murad Ali
|
21 |
-
* @contact contact@phxsolution.com
|
22 |
-
* @site www.phxsolution.com
|
23 |
-
* @copyright Copyright (c) 2014 Phxsolution Formbuilder
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
?>
|
27 |
-
<?php
|
28 |
-
class Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
|
29 |
-
{
|
30 |
-
protected function _prepareForm()
|
31 |
-
{
|
32 |
-
$model = Mage::registry('formbuilder_data');
|
33 |
-
|
34 |
-
if($model->getStores())
|
35 |
-
{
|
36 |
-
//$_model->setPageId(Mage::helper('core')->jsonDecode($_model->getPageId()));
|
37 |
-
$model->setStores(explode(',',$model->getStores()));
|
38 |
-
}
|
39 |
-
$form = new Varien_Data_Form();
|
40 |
-
$this->setForm($form);
|
41 |
-
$fieldset = $form->addFieldset('formbuilder_form', array('legend'=>Mage::helper('formbuilder')->__('Form Information')));
|
42 |
-
$fieldset->addType('bgcolor', 'Phxsolution_Formbuilder_Block_Adminhtml_Edit_Elements_Jscolorblock');
|
43 |
-
//$fieldset->addType('procolorblock', 'Phxsolution_Formbuilder_Block_Adminhtml_Edit_Elements_Procolorblock');
|
44 |
-
|
45 |
-
/*$fieldset->addField('some_field', 'text', array(
|
46 |
-
'label' => Mage::helper('core')->__('Some label'),
|
47 |
-
'name' => 'some_name',
|
48 |
-
'after_element_html' => '<button type="button" onclick="alert(\'Stop clicking me!!\')">Do not click</button>'
|
49 |
-
));*/
|
50 |
-
$fieldset->addField('title', 'text', array(
|
51 |
-
'label' => Mage::helper('formbuilder')->__('Title'),
|
52 |
-
'class' => 'required-entry',
|
53 |
-
'required' => true,
|
54 |
-
'name' => 'title',
|
55 |
-
));
|
56 |
-
$fieldset->addField('bgcolor','text',array(
|
57 |
-
'label' => Mage::helper('formbuilder')->__('Form Background Color'),
|
58 |
-
'name' => 'bgcolor',
|
59 |
-
'class' => 'color {required:false, adjust:true, hash:true}',
|
60 |
-
'style' => 'width:75px;',
|
61 |
-
));
|
62 |
-
/*$fieldset->addField('procolorblock','text',array(
|
63 |
-
'label' => Mage::helper('formbuilder')->__('Form Color 2'),
|
64 |
-
'required' => true,
|
65 |
-
'name' => 'procolorblock',
|
66 |
-
'class' => 'color {required:false, adjust:true, hash:true}',
|
67 |
-
'value' => '#150150'
|
68 |
-
));*/
|
69 |
-
/*$fieldset->addField('date', 'date', array(
|
70 |
-
'name' => 'date',
|
71 |
-
'label' => Mage::helper('formbuilder')->__('Date'),
|
72 |
-
'after_element_html' => '<small>Comments</small>',
|
73 |
-
'tabindex' => 1,
|
74 |
-
'image' => $this->getSkinUrl('images/grid-cal.gif'),
|
75 |
-
'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT) ,
|
76 |
-
'value' => date( Mage::app()->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
|
77 |
-
strtotime('next weekday') )
|
78 |
-
));*/
|
79 |
-
$fieldset->addField('title_image', 'image', array(
|
80 |
-
'label' => Mage::helper('formbuilder')->__('Title Image'),
|
81 |
-
'name' => 'title_image',
|
82 |
-
'note' => '(*.jpg, *.png, *.gif)',
|
83 |
-
));
|
84 |
-
$fieldset->addField('header_content', 'editor', array(
|
85 |
-
'name' => 'header_content',
|
86 |
-
'label' => Mage::helper('formbuilder')->__('Content Before Form'),
|
87 |
-
'title' => Mage::helper('formbuilder')->__('Content Before Form'),
|
88 |
-
'style' => 'height:15em',
|
89 |
-
'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(),
|
90 |
-
'wysiwyg' => true,
|
91 |
-
'required' => false,
|
92 |
-
));
|
93 |
-
$fieldset->addField('footer_content', 'editor', array(
|
94 |
-
'name' => 'footer_content',
|
95 |
-
'label' => Mage::helper('formbuilder')->__('Content After Form'),
|
96 |
-
'title' => Mage::helper('formbuilder')->__('Content After Form'),
|
97 |
-
'style' => 'height:15em',
|
98 |
-
'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(),
|
99 |
-
'wysiwyg' => true,
|
100 |
-
'required' => false,
|
101 |
-
));
|
102 |
-
if (!Mage::app()->isSingleStoreMode())
|
103 |
-
{
|
104 |
-
$field = $fieldset->addField('stores', 'multiselect', array(
|
105 |
-
'name' => 'stores[]',
|
106 |
-
'label' => Mage::helper('cms')->__('Store View'),
|
107 |
-
'title' => Mage::helper('cms')->__('Store View'),
|
108 |
-
'required' => true,
|
109 |
-
'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
|
110 |
-
'value' => $model->getStores()
|
111 |
-
//'value' => array('0'=>'1','1'=>'2'),
|
112 |
-
));
|
113 |
-
$renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
|
114 |
-
$field->setRenderer($renderer);
|
115 |
-
}
|
116 |
-
else
|
117 |
-
{
|
118 |
-
$fieldset->addField('stores', 'hidden', array(
|
119 |
-
'name' => 'stores[]',
|
120 |
-
'value' => Mage::app()->getStore(true)->getId()
|
121 |
-
));
|
122 |
-
$model->setStores(Mage::app()->getStore(true)->getId());
|
123 |
-
}
|
124 |
-
$fieldset->addField('success_msg', 'text', array(
|
125 |
-
'label' => Mage::helper('formbuilder')->__('Success Message'),
|
126 |
-
'name' => 'success_msg',
|
127 |
-
'style' => 'width:500px;',
|
128 |
-
));
|
129 |
-
$fieldset->addField('failure_msg', 'text', array(
|
130 |
-
'label' => Mage::helper('formbuilder')->__('Failure Message'),
|
131 |
-
'name' => 'failure_msg',
|
132 |
-
'style' => 'width:500px;',
|
133 |
-
));
|
134 |
-
$fieldset->addField('submit_text', 'text', array(
|
135 |
-
'label' => Mage::helper('formbuilder')->__('Submit Button Text'),
|
136 |
-
'name' => 'submit_text',
|
137 |
-
));
|
138 |
-
$fieldset->addField('in_menu', 'select', array(
|
139 |
-
'label' => Mage::helper('formbuilder')->__('Display in Menu'),
|
140 |
-
'name' => 'in_menu',
|
141 |
-
'values' => array(
|
142 |
-
array(
|
143 |
-
'value' => 1,
|
144 |
-
'label' => Mage::helper('formbuilder')->__('Yes'),
|
145 |
-
),
|
146 |
-
array(
|
147 |
-
'value' => 2,
|
148 |
-
'label' => Mage::helper('formbuilder')->__('No'),
|
149 |
-
),
|
150 |
-
),
|
151 |
-
));
|
152 |
-
/*$fieldset->addField('in_toplinks', 'select', array(
|
153 |
-
'label' => Mage::helper('formbuilder')->__('Display in Toplinks'),
|
154 |
-
'name' => 'in_toplinks',
|
155 |
-
'values' => array(
|
156 |
-
array(
|
157 |
-
'value' => 1,
|
158 |
-
'label' => Mage::helper('formbuilder')->__('Yes'),
|
159 |
-
),
|
160 |
-
array(
|
161 |
-
'value' => 2,
|
162 |
-
'label' => Mage::helper('formbuilder')->__('No'),
|
163 |
-
),
|
164 |
-
),
|
165 |
-
));*/
|
166 |
-
$fieldset->addField('status', 'select', array(
|
167 |
-
'label' => Mage::helper('formbuilder')->__('Is Active'),
|
168 |
-
'name' => 'status',
|
169 |
-
'values' => array(
|
170 |
-
array(
|
171 |
-
'value' => 1,
|
172 |
-
'label' => Mage::helper('formbuilder')->__('Yes'),
|
173 |
-
),
|
174 |
-
array(
|
175 |
-
'value' => 2,
|
176 |
-
'label' => Mage::helper('formbuilder')->__('No'),
|
177 |
-
),
|
178 |
-
),
|
179 |
-
));
|
180 |
-
if (Mage::getSingleton('adminhtml/session')->getFormData())
|
181 |
-
{
|
182 |
-
$form->setValues(Mage::getSingleton('adminhtml/session')->getFormData());
|
183 |
-
Mage::getSingleton('adminhtml/session')->setFormData(null);
|
184 |
-
} elseif ( Mage::registry('formbuilder_data') ) {
|
185 |
-
$form->setValues(Mage::registry('formbuilder_data')->getData());
|
186 |
-
}
|
187 |
-
return parent::_prepareForm();
|
188 |
-
}
|
189 |
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
/**
|
4 |
+
* Phxsolution Formbuilder
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so you can be sent a copy immediately.
|
15 |
+
*
|
16 |
+
* Original code copyright (c) 2008 Irubin Consulting Inc. DBA Varien
|
17 |
+
*
|
18 |
+
* @category adminhtml block
|
19 |
+
* @package Phxsolution_Formbuilder
|
20 |
+
* @author Murad Ali
|
21 |
+
* @contact contact@phxsolution.com
|
22 |
+
* @site www.phxsolution.com
|
23 |
+
* @copyright Copyright (c) 2014 Phxsolution Formbuilder
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
class Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
|
29 |
+
{
|
30 |
+
protected function _prepareForm()
|
31 |
+
{
|
32 |
+
$model = Mage::registry('formbuilder_data');
|
33 |
+
|
34 |
+
if($model->getStores())
|
35 |
+
{
|
36 |
+
//$_model->setPageId(Mage::helper('core')->jsonDecode($_model->getPageId()));
|
37 |
+
$model->setStores(explode(',',$model->getStores()));
|
38 |
+
}
|
39 |
+
$form = new Varien_Data_Form();
|
40 |
+
$this->setForm($form);
|
41 |
+
$fieldset = $form->addFieldset('formbuilder_form', array('legend'=>Mage::helper('formbuilder')->__('Form Information')));
|
42 |
+
$fieldset->addType('bgcolor', 'Phxsolution_Formbuilder_Block_Adminhtml_Edit_Elements_Jscolorblock');
|
43 |
+
//$fieldset->addType('procolorblock', 'Phxsolution_Formbuilder_Block_Adminhtml_Edit_Elements_Procolorblock');
|
44 |
+
|
45 |
+
/*$fieldset->addField('some_field', 'text', array(
|
46 |
+
'label' => Mage::helper('core')->__('Some label'),
|
47 |
+
'name' => 'some_name',
|
48 |
+
'after_element_html' => '<button type="button" onclick="alert(\'Stop clicking me!!\')">Do not click</button>'
|
49 |
+
));*/
|
50 |
+
$fieldset->addField('title', 'text', array(
|
51 |
+
'label' => Mage::helper('formbuilder')->__('Title'),
|
52 |
+
'class' => 'required-entry',
|
53 |
+
'required' => true,
|
54 |
+
'name' => 'title',
|
55 |
+
));
|
56 |
+
$fieldset->addField('bgcolor','text',array(
|
57 |
+
'label' => Mage::helper('formbuilder')->__('Form Background Color'),
|
58 |
+
'name' => 'bgcolor',
|
59 |
+
'class' => 'color {required:false, adjust:true, hash:true}',
|
60 |
+
'style' => 'width:75px;',
|
61 |
+
));
|
62 |
+
/*$fieldset->addField('procolorblock','text',array(
|
63 |
+
'label' => Mage::helper('formbuilder')->__('Form Color 2'),
|
64 |
+
'required' => true,
|
65 |
+
'name' => 'procolorblock',
|
66 |
+
'class' => 'color {required:false, adjust:true, hash:true}',
|
67 |
+
'value' => '#150150'
|
68 |
+
));*/
|
69 |
+
/*$fieldset->addField('date', 'date', array(
|
70 |
+
'name' => 'date',
|
71 |
+
'label' => Mage::helper('formbuilder')->__('Date'),
|
72 |
+
'after_element_html' => '<small>Comments</small>',
|
73 |
+
'tabindex' => 1,
|
74 |
+
'image' => $this->getSkinUrl('images/grid-cal.gif'),
|
75 |
+
'format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT) ,
|
76 |
+
'value' => date( Mage::app()->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT),
|
77 |
+
strtotime('next weekday') )
|
78 |
+
));*/
|
79 |
+
$fieldset->addField('title_image', 'image', array(
|
80 |
+
'label' => Mage::helper('formbuilder')->__('Title Image'),
|
81 |
+
'name' => 'title_image',
|
82 |
+
'note' => '(*.jpg, *.png, *.gif)',
|
83 |
+
));
|
84 |
+
$fieldset->addField('header_content', 'editor', array(
|
85 |
+
'name' => 'header_content',
|
86 |
+
'label' => Mage::helper('formbuilder')->__('Content Before Form'),
|
87 |
+
'title' => Mage::helper('formbuilder')->__('Content Before Form'),
|
88 |
+
'style' => 'height:15em',
|
89 |
+
'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(),
|
90 |
+
'wysiwyg' => true,
|
91 |
+
'required' => false,
|
92 |
+
));
|
93 |
+
$fieldset->addField('footer_content', 'editor', array(
|
94 |
+
'name' => 'footer_content',
|
95 |
+
'label' => Mage::helper('formbuilder')->__('Content After Form'),
|
96 |
+
'title' => Mage::helper('formbuilder')->__('Content After Form'),
|
97 |
+
'style' => 'height:15em',
|
98 |
+
'config' => Mage::getSingleton('cms/wysiwyg_config')->getConfig(),
|
99 |
+
'wysiwyg' => true,
|
100 |
+
'required' => false,
|
101 |
+
));
|
102 |
+
if (!Mage::app()->isSingleStoreMode())
|
103 |
+
{
|
104 |
+
$field = $fieldset->addField('stores', 'multiselect', array(
|
105 |
+
'name' => 'stores[]',
|
106 |
+
'label' => Mage::helper('cms')->__('Store View'),
|
107 |
+
'title' => Mage::helper('cms')->__('Store View'),
|
108 |
+
'required' => true,
|
109 |
+
'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
|
110 |
+
'value' => $model->getStores()
|
111 |
+
//'value' => array('0'=>'1','1'=>'2'),
|
112 |
+
));
|
113 |
+
$renderer = $this->getLayout()->createBlock('adminhtml/store_switcher_form_renderer_fieldset_element');
|
114 |
+
$field->setRenderer($renderer);
|
115 |
+
}
|
116 |
+
else
|
117 |
+
{
|
118 |
+
$fieldset->addField('stores', 'hidden', array(
|
119 |
+
'name' => 'stores[]',
|
120 |
+
'value' => Mage::app()->getStore(true)->getId()
|
121 |
+
));
|
122 |
+
$model->setStores(Mage::app()->getStore(true)->getId());
|
123 |
+
}
|
124 |
+
$fieldset->addField('success_msg', 'text', array(
|
125 |
+
'label' => Mage::helper('formbuilder')->__('Success Message'),
|
126 |
+
'name' => 'success_msg',
|
127 |
+
'style' => 'width:500px;',
|
128 |
+
));
|
129 |
+
$fieldset->addField('failure_msg', 'text', array(
|
130 |
+
'label' => Mage::helper('formbuilder')->__('Failure Message'),
|
131 |
+
'name' => 'failure_msg',
|
132 |
+
'style' => 'width:500px;',
|
133 |
+
));
|
134 |
+
$fieldset->addField('submit_text', 'text', array(
|
135 |
+
'label' => Mage::helper('formbuilder')->__('Submit Button Text'),
|
136 |
+
'name' => 'submit_text',
|
137 |
+
));
|
138 |
+
$fieldset->addField('in_menu', 'select', array(
|
139 |
+
'label' => Mage::helper('formbuilder')->__('Display in Menu'),
|
140 |
+
'name' => 'in_menu',
|
141 |
+
'values' => array(
|
142 |
+
array(
|
143 |
+
'value' => 1,
|
144 |
+
'label' => Mage::helper('formbuilder')->__('Yes'),
|
145 |
+
),
|
146 |
+
array(
|
147 |
+
'value' => 2,
|
148 |
+
'label' => Mage::helper('formbuilder')->__('No'),
|
149 |
+
),
|
150 |
+
),
|
151 |
+
));
|
152 |
+
/*$fieldset->addField('in_toplinks', 'select', array(
|
153 |
+
'label' => Mage::helper('formbuilder')->__('Display in Toplinks'),
|
154 |
+
'name' => 'in_toplinks',
|
155 |
+
'values' => array(
|
156 |
+
array(
|
157 |
+
'value' => 1,
|
158 |
+
'label' => Mage::helper('formbuilder')->__('Yes'),
|
159 |
+
),
|
160 |
+
array(
|
161 |
+
'value' => 2,
|
162 |
+
'label' => Mage::helper('formbuilder')->__('No'),
|
163 |
+
),
|
164 |
+
),
|
165 |
+
));*/
|
166 |
+
$fieldset->addField('status', 'select', array(
|
167 |
+
'label' => Mage::helper('formbuilder')->__('Is Active'),
|
168 |
+
'name' => 'status',
|
169 |
+
'values' => array(
|
170 |
+
array(
|
171 |
+
'value' => 1,
|
172 |
+
'label' => Mage::helper('formbuilder')->__('Yes'),
|
173 |
+
),
|
174 |
+
array(
|
175 |
+
'value' => 2,
|
176 |
+
'label' => Mage::helper('formbuilder')->__('No'),
|
177 |
+
),
|
178 |
+
),
|
179 |
+
));
|
180 |
+
if (Mage::getSingleton('adminhtml/session')->getFormData())
|
181 |
+
{
|
182 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getFormData());
|
183 |
+
Mage::getSingleton('adminhtml/session')->setFormData(null);
|
184 |
+
} elseif ( Mage::registry('formbuilder_data') ) {
|
185 |
+
$form->setValues(Mage::registry('formbuilder_data')->getData());
|
186 |
+
}
|
187 |
+
return parent::_prepareForm();
|
188 |
+
}
|
189 |
}
|
app/code/community/Phxsolution/Formbuilder/Block/Adminhtml/Formbuilder/Renderer/Image.php
CHANGED
@@ -1,41 +1,44 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
/**
|
4 |
-
* Phxsolution Formbuilder
|
5 |
-
*
|
6 |
-
* NOTICE OF LICENSE
|
7 |
-
*
|
8 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
-
* that is bundled with this package in the file LICENSE.txt.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://opensource.org/licenses/osl-3.0.php
|
12 |
-
* If you did not receive a copy of the license and are unable to
|
13 |
-
* obtain it through the world-wide-web, please send an email
|
14 |
-
* to license@magentocommerce.com so you can be sent a copy immediately.
|
15 |
-
*
|
16 |
-
* Original code copyright (c) 2008 Irubin Consulting Inc. DBA Varien
|
17 |
-
*
|
18 |
-
* @category adminhtml block renderer
|
19 |
-
* @package Phxsolution_Formbuilder
|
20 |
-
* @author Murad Ali
|
21 |
-
* @contact contact@phxsolution.com
|
22 |
-
* @site www.phxsolution.com
|
23 |
-
* @copyright Copyright (c) 2014 Phxsolution Formbuilder
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
?>
|
27 |
-
<?php
|
28 |
-
class Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Renderer_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
29 |
-
{
|
30 |
-
public function render(Varien_Object $row)
|
31 |
-
{
|
32 |
-
$
|
33 |
-
$
|
34 |
-
$
|
35 |
-
$html
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
41 |
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
/**
|
4 |
+
* Phxsolution Formbuilder
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so you can be sent a copy immediately.
|
15 |
+
*
|
16 |
+
* Original code copyright (c) 2008 Irubin Consulting Inc. DBA Varien
|
17 |
+
*
|
18 |
+
* @category adminhtml block renderer
|
19 |
+
* @package Phxsolution_Formbuilder
|
20 |
+
* @author Murad Ali
|
21 |
+
* @contact contact@phxsolution.com
|
22 |
+
* @site www.phxsolution.com
|
23 |
+
* @copyright Copyright (c) 2014 Phxsolution Formbuilder
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
class Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Renderer_Image extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
29 |
+
{
|
30 |
+
public function render(Varien_Object $row)
|
31 |
+
{
|
32 |
+
$_helper = Mage::helper("formbuilder");
|
33 |
+
$getImageUploadPath = $_helper->getImageUploadPath();
|
34 |
+
$getMediaUrl = Mage::getUrl('media');
|
35 |
+
$html = '<img ';
|
36 |
+
$html .= 'id="' . $this->getColumn()->getId() . '" ';
|
37 |
+
$html .= 'src="'. $getMediaUrl . $row->getData('title_image') . '"';
|
38 |
+
$html .= 'class="grid-image ' . $this->getColumn()->getInlineCss().'"';
|
39 |
+
$html .= 'style="weight:75px;height:75px"' . '"/>';
|
40 |
+
if($row->getData('title_image'))
|
41 |
+
return $html;
|
42 |
+
return "No Image";
|
43 |
+
}
|
44 |
}
|
app/code/community/Phxsolution/Formbuilder/Block/Adminhtml/Formbuilder/Renderer/Recordvalue.php
CHANGED
@@ -29,20 +29,15 @@ class Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Renderer_Recordvalue e
|
|
29 |
{
|
30 |
public function render(Varien_Object $row, $recordId=0, $fieldId=0, $serializedValue=0)
|
31 |
{
|
32 |
-
/*$recordId = intval($row->getData('records_index'));
|
33 |
-
$fieldId = intval($this->getColumn()->getIndex());
|
34 |
-
$i = intval($this->getColumn()->getName());*/
|
35 |
-
$recordId = ($recordId) ? $recordId : intval($row->getData('records_index'));
|
36 |
$fieldId = ($fieldId) ? $fieldId : intval($this->getColumn()->getIndex());
|
37 |
$found = false;
|
38 |
|
39 |
//$serialized = 'a:3:{i:8;s:16:"test first name3";i:9;s:15:"test last name3";i:10;s:1:"7";}';
|
40 |
$serializedValue = ($serializedValue) ? $serializedValue : $row->getData('value');
|
41 |
$unserialized = unserialize($serializedValue);
|
42 |
-
$
|
43 |
foreach ($unserialized as $key => $value)
|
44 |
{
|
45 |
-
$recordsModel->load($recordId);
|
46 |
if($key==$fieldId)
|
47 |
{
|
48 |
$found = true;
|
@@ -68,10 +63,16 @@ class Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Renderer_Recordvalue e
|
|
68 |
else
|
69 |
{
|
70 |
if(is_numeric($returnValue))
|
71 |
-
{
|
72 |
-
$
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
}
|
76 |
else
|
77 |
{
|
29 |
{
|
30 |
public function render(Varien_Object $row, $recordId=0, $fieldId=0, $serializedValue=0)
|
31 |
{
|
|
|
|
|
|
|
|
|
32 |
$fieldId = ($fieldId) ? $fieldId : intval($this->getColumn()->getIndex());
|
33 |
$found = false;
|
34 |
|
35 |
//$serialized = 'a:3:{i:8;s:16:"test first name3";i:9;s:15:"test last name3";i:10;s:1:"7";}';
|
36 |
$serializedValue = ($serializedValue) ? $serializedValue : $row->getData('value');
|
37 |
$unserialized = unserialize($serializedValue);
|
38 |
+
$fieldsModel = Mage::helper('formbuilder')->getFieldsModel();
|
39 |
foreach ($unserialized as $key => $value)
|
40 |
{
|
|
|
41 |
if($key==$fieldId)
|
42 |
{
|
43 |
$found = true;
|
63 |
else
|
64 |
{
|
65 |
if(is_numeric($returnValue))
|
66 |
+
{
|
67 |
+
$fieldsModel->load($fieldId);
|
68 |
+
if($fieldsModel["type"]=="field")
|
69 |
+
return $returnValue;
|
70 |
+
else
|
71 |
+
{
|
72 |
+
$optionsModel->load($returnValue);
|
73 |
+
if($title = $optionsModel['title'])
|
74 |
+
return $title;
|
75 |
+
}
|
76 |
}
|
77 |
else
|
78 |
{
|
app/code/community/Phxsolution/Formbuilder/Block/Adminhtml/Formbuilder/Renderer/Recordvalue.php-31-oct-15
ADDED
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
/**
|
4 |
+
* Phxsolution Formbuilder
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so you can be sent a copy immediately.
|
15 |
+
*
|
16 |
+
* Original code copyright (c) 2008 Irubin Consulting Inc. DBA Varien
|
17 |
+
*
|
18 |
+
* @category adminhtml block renderer
|
19 |
+
* @package Phxsolution_Formbuilder
|
20 |
+
* @author Murad Ali
|
21 |
+
* @contact contact@phxsolution.com
|
22 |
+
* @site www.phxsolution.com
|
23 |
+
* @copyright Copyright (c) 2014 Phxsolution Formbuilder
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
class Phxsolution_Formbuilder_Block_Adminhtml_Formbuilder_Renderer_Recordvalue extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
|
29 |
+
{
|
30 |
+
public function render(Varien_Object $row, $recordId=0, $fieldId=0, $serializedValue=0)
|
31 |
+
{
|
32 |
+
/*$recordId = intval($row->getData('records_index'));
|
33 |
+
$fieldId = intval($this->getColumn()->getIndex());
|
34 |
+
$i = intval($this->getColumn()->getName());*/
|
35 |
+
$recordId = ($recordId) ? $recordId : intval($row->getData('records_index'));
|
36 |
+
$fieldId = ($fieldId) ? $fieldId : intval($this->getColumn()->getIndex());
|
37 |
+
$found = false;
|
38 |
+
|
39 |
+
//$serialized = 'a:3:{i:8;s:16:"test first name3";i:9;s:15:"test last name3";i:10;s:1:"7";}';
|
40 |
+
$serializedValue = ($serializedValue) ? $serializedValue : $row->getData('value');
|
41 |
+
$unserialized = unserialize($serializedValue);
|
42 |
+
$recordsModel = Mage::helper('formbuilder')->getRecordsModel();
|
43 |
+
foreach ($unserialized as $key => $value)
|
44 |
+
{
|
45 |
+
$recordsModel->load($recordId);
|
46 |
+
if($key==$fieldId)
|
47 |
+
{
|
48 |
+
$found = true;
|
49 |
+
$returnValue = $value;
|
50 |
+
break;
|
51 |
+
}
|
52 |
+
}
|
53 |
+
if($found)
|
54 |
+
{
|
55 |
+
$optionsModel = Mage::helper('formbuilder')->getOptionsModel();
|
56 |
+
if(is_array($returnValue))
|
57 |
+
{
|
58 |
+
foreach ($returnValue as $key)
|
59 |
+
{
|
60 |
+
$optionsModel->load($key);
|
61 |
+
if($title = $optionsModel['title'])
|
62 |
+
$temp[] = $title;
|
63 |
+
else
|
64 |
+
$temp[] = $returnValue;
|
65 |
+
}
|
66 |
+
return implode(',',$temp);
|
67 |
+
}
|
68 |
+
else
|
69 |
+
{
|
70 |
+
if(is_numeric($returnValue))
|
71 |
+
{
|
72 |
+
$optionsModel->load($returnValue);
|
73 |
+
if($title = $optionsModel['title'])
|
74 |
+
return $title;
|
75 |
+
}
|
76 |
+
else
|
77 |
+
{
|
78 |
+
$supported_image = array('gif','jpg','jpeg','png');
|
79 |
+
$src_file_name = $returnValue;
|
80 |
+
$ext = strtolower(pathinfo($src_file_name, PATHINFO_EXTENSION)); // Using strtolower to overcome case sensitive
|
81 |
+
if (in_array($ext, $supported_image))
|
82 |
+
{
|
83 |
+
$file_path = Mage::getBaseUrl('media') . $returnValue;
|
84 |
+
$gd = @imagecreatefromstring(file_get_contents($file_path));
|
85 |
+
if ($gd === false)
|
86 |
+
return "Image seems corrupted or not found";
|
87 |
+
//else
|
88 |
+
$html = '<img height=75 width=150 ';
|
89 |
+
$html .= 'src="'. Mage::getBaseUrl('media') . $returnValue . '" ';
|
90 |
+
$html .= 'class="grid-image" ';
|
91 |
+
$html .= 'style="max-height:75px;max-width:150px" />';
|
92 |
+
return $html;
|
93 |
+
}
|
94 |
+
else
|
95 |
+
return $returnValue;
|
96 |
+
}
|
97 |
+
}
|
98 |
+
}
|
99 |
+
return "";
|
100 |
+
}
|
101 |
+
}
|
app/code/community/Phxsolution/Formbuilder/Helper/Data.php
CHANGED
@@ -1,374 +1,378 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
/**
|
4 |
-
* Phxsolution Formbuilder
|
5 |
-
*
|
6 |
-
* NOTICE OF LICENSE
|
7 |
-
*
|
8 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
-
* that is bundled with this package in the file LICENSE.txt.
|
10 |
-
* It is also available through the world-wide-web at this URL:
|
11 |
-
* http://opensource.org/licenses/osl-3.0.php
|
12 |
-
* If you did not receive a copy of the license and are unable to
|
13 |
-
* obtain it through the world-wide-web, please send an email
|
14 |
-
* to license@magentocommerce.com so you can be sent a copy immediately.
|
15 |
-
*
|
16 |
-
* Original code copyright (c) 2008 Irubin Consulting Inc. DBA Varien
|
17 |
-
*
|
18 |
-
* @category helper
|
19 |
-
* @package Phxsolution_Formbuilder
|
20 |
-
* @author Murad Ali
|
21 |
-
* @contact contact@phxsolution.com
|
22 |
-
* @site www.phxsolution.com
|
23 |
-
* @copyright Copyright (c) 2014 Phxsolution Formbuilder
|
24 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
-
*/
|
26 |
-
?>
|
27 |
-
<?php
|
28 |
-
class Phxsolution_Formbuilder_Helper_Data extends Mage_Core_Helper_Abstract
|
29 |
-
{
|
30 |
-
protected $_formData;
|
31 |
-
|
32 |
-
public function isProductEdit()
|
33 |
-
{
|
34 |
-
$currentProduct = Mage::registry('product');
|
35 |
-
if(isset($currentProduct))
|
36 |
-
return true;
|
37 |
-
else
|
38 |
-
return false;
|
39 |
-
}
|
40 |
-
public function setFormData($data)
|
41 |
-
{
|
42 |
-
$this->_formData = $data;
|
43 |
-
}
|
44 |
-
public function getFormData()
|
45 |
-
{
|
46 |
-
return $this->_formData;
|
47 |
-
}
|
48 |
-
public function getRedirectUrl()
|
49 |
-
{
|
50 |
-
return Mage::getStoreConfig('formbuilder_section/form_submission/redirect_url');
|
51 |
-
}
|
52 |
-
public function getLimitFormSubmissionForRegistered()
|
53 |
-
{
|
54 |
-
return Mage::getStoreConfig('formbuilder_section/form_submission/limit_form_submission_for_registered');
|
55 |
-
}
|
56 |
-
public function getLimitFormSubmissionForGuest()
|
57 |
-
{
|
58 |
-
return Mage::getStoreConfig('formbuilder_section/form_submission/limit_form_submission_for_guest');
|
59 |
-
}
|
60 |
-
public function getYearRange()
|
61 |
-
{
|
62 |
-
return Mage::getStoreConfig('formbuilder_section/custom_options/year_range');
|
63 |
-
}
|
64 |
-
public function getTimeFormat()
|
65 |
-
{
|
66 |
-
return Mage::getStoreConfig('formbuilder_section/custom_options/time_format');
|
67 |
-
}
|
68 |
-
public function getDateFieldsOrder()
|
69 |
-
{
|
70 |
-
return Mage::getStoreConfig('formbuilder_section/custom_options/date_fields_order');
|
71 |
-
}
|
72 |
-
public function useCalendar()
|
73 |
-
{
|
74 |
-
return Mage::getStoreConfig('formbuilder_section/custom_options/use_calendar');
|
75 |
-
}
|
76 |
-
public function getCustomerInfo()
|
77 |
-
{
|
78 |
-
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
79 |
-
return $customer;
|
80 |
-
}
|
81 |
-
public function getFormsModel()
|
82 |
-
{
|
83 |
-
return Mage::getModel('formbuilder/forms');
|
84 |
-
}
|
85 |
-
public function getFieldsModel()
|
86 |
-
{
|
87 |
-
return Mage::getModel('formbuilder/fields');
|
88 |
-
}
|
89 |
-
public function getOptionsModel()
|
90 |
-
{
|
91 |
-
return Mage::getModel('formbuilder/options');
|
92 |
-
}
|
93 |
-
public function getRecordsModel()
|
94 |
-
{
|
95 |
-
return Mage::getModel('formbuilder/records');
|
96 |
-
}
|
97 |
-
public function isEnabled()
|
98 |
-
{
|
99 |
-
return Mage::getStoreConfig('formbuilder_section/general/active');
|
100 |
-
}
|
101 |
-
public function registeredOnly()
|
102 |
-
{
|
103 |
-
return Mage::getStoreConfig('formbuilder_section/form_submission/registered_only');
|
104 |
-
}
|
105 |
-
public function showLinkinToplinks()
|
106 |
-
{
|
107 |
-
return Mage::getStoreConfig('formbuilder_section/general/in_toplinks');
|
108 |
-
}
|
109 |
-
public function showLinkinTopmenu()
|
110 |
-
{
|
111 |
-
return Mage::getStoreConfig('formbuilder_section/general/in_topmenu');
|
112 |
-
}
|
113 |
-
public function showLinkinFooterlinks()
|
114 |
-
{
|
115 |
-
return Mage::getStoreConfig('formbuilder_section/general/in_footerlinks');
|
116 |
-
}
|
117 |
-
public function getFormCollection()
|
118 |
-
{
|
119 |
-
$formCollection = array();
|
120 |
-
$formCollection = Mage::getModel('formbuilder/forms')->getCollection();
|
121 |
-
return $formCollection;
|
122 |
-
}
|
123 |
-
public function getCurrentFormDetails($currentFormId)
|
124 |
-
{
|
125 |
-
$currentForm = array();
|
126 |
-
$currentForm = Mage::getModel('formbuilder/forms')->load($currentFormId);
|
127 |
-
return $currentForm;
|
128 |
-
}
|
129 |
-
/*public function getcurrentFormFieldsCollection($currentFormId=0)
|
130 |
-
{
|
131 |
-
$fieldsCollection = array();
|
132 |
-
//$currentFormId = Mage::getSingleton('core/session')->getCurrentFormId();
|
133 |
-
if(!$currentFormId)
|
134 |
-
$currentFormId = $this->getCurrentFormId();
|
135 |
-
$fieldsCollection = Mage::getModel('formbuilder/fields')->getCollection();
|
136 |
-
$fieldsCollection->addFieldToFilter('forms_index',array('eq'=>$currentFormId));
|
137 |
-
return $fieldsCollection;
|
138 |
-
}*/
|
139 |
-
public function getCurrentFormId()
|
140 |
-
{
|
141 |
-
$sessionFormId = intval(Mage::getSingleton('core/session')->getCurrentFormId());
|
142 |
-
//$registryFormId = intval(Mage::registry('formbuilder_data')->getId());
|
143 |
-
//$currentFormId = $sessionFormId ? $sessionFormId : $registryFormId;
|
144 |
-
if(is_int($currentFormId = $sessionFormId))
|
145 |
-
return $currentFormId;
|
146 |
-
}
|
147 |
-
/*public function saveFields($fieldsArray)
|
148 |
-
{
|
149 |
-
$fieldsCollection = Mage::getModel('formbuilder/fields')->getCollection();
|
150 |
-
if(count($fieldsCollection))
|
151 |
-
{
|
152 |
-
foreach ($fieldsArray as $fieldsArrayItem)
|
153 |
-
{
|
154 |
-
foreach ($fieldsCollection as $fieldsItem)
|
155 |
-
{
|
156 |
-
if($fieldsArrayItem['id']==$fieldsItem['field_id'] && $this->getCurrentFormId()==$fieldsItem['forms_index'])
|
157 |
-
{
|
158 |
-
$this->_isNewField = false;
|
159 |
-
break;
|
160 |
-
}
|
161 |
-
}
|
162 |
-
if($this->_isNewField)
|
163 |
-
{
|
164 |
-
// adding new field to existing collection
|
165 |
-
if(!$fieldsArrayItem['is_delete'])
|
166 |
-
$this->addField($fieldsArrayItem);
|
167 |
-
}
|
168 |
-
else
|
169 |
-
{
|
170 |
-
// editing existing field
|
171 |
-
$this->removeField( $fieldsItem['fields_index'] );
|
172 |
-
if(!$fieldsArrayItem['is_delete'])
|
173 |
-
$this->addField($fieldsArrayItem);
|
174 |
-
}
|
175 |
-
}
|
176 |
-
}
|
177 |
-
elseif($this->_isNewField)
|
178 |
-
{
|
179 |
-
// adding first field
|
180 |
-
foreach ($fieldsArray as $fieldsArrayItem)
|
181 |
-
{
|
182 |
-
if(!$fieldsArrayItem['is_delete'])
|
183 |
-
$this->addField($fieldsArrayItem);
|
184 |
-
}
|
185 |
-
}
|
186 |
-
}
|
187 |
-
public function addField($fieldsArrayItem)
|
188 |
-
{
|
189 |
-
//add field then save options if any
|
190 |
-
$fieldsModel = Mage::getModel('formbuilder/fields');
|
191 |
-
$data = array();
|
192 |
-
|
193 |
-
$data['forms_index'] = $this->getCurrentFormId();
|
194 |
-
$data['field_id'] = $fieldsArrayItem['id'];
|
195 |
-
$data['previous_group'] = $fieldsArrayItem['previous_group'];
|
196 |
-
$data['type'] = $fieldsArrayItem['type'];
|
197 |
-
$data['title'] = $fieldsArrayItem['title'];
|
198 |
-
if(array_key_exists('values', $fieldsArrayItem))
|
199 |
-
$data['options'] = 1;
|
200 |
-
else
|
201 |
-
$data['options'] = 0;
|
202 |
-
$data['sort_order'] = $fieldsArrayItem['sort_order'];
|
203 |
-
$data['is_require'] = $fieldsArrayItem['is_require'];
|
204 |
-
$data['is_delete'] = $fieldsArrayItem['is_delete'];
|
205 |
-
$data['option_id'] = $fieldsArrayItem['option_id'];
|
206 |
-
$data['previous_type'] = $fieldsArrayItem['previous_type'];
|
207 |
-
|
208 |
-
if($fieldsArrayItem['previous_group']=='text')
|
209 |
-
$data['max_characters'] = $fieldsArrayItem['max_characters'];
|
210 |
-
elseif($fieldsArrayItem['previous_group']=='file')
|
211 |
-
{
|
212 |
-
$data['file_extension'] = $fieldsArrayItem['file_extension'];
|
213 |
-
$data['image_size_x'] = $fieldsArrayItem['image_size_x'];
|
214 |
-
$data['image_size_y'] = $fieldsArrayItem['image_size_y'];
|
215 |
-
}
|
216 |
-
|
217 |
-
$fieldsModel->setData($data);
|
218 |
-
$fieldsModel->save();
|
219 |
-
|
220 |
-
if(array_key_exists('values', $fieldsArrayItem))
|
221 |
-
{
|
222 |
-
$optionsArray = array();
|
223 |
-
$optionsArray = $fieldsArrayItem['values'];
|
224 |
-
$getFieldsIndex = $fieldsModel->getFieldsIndex();
|
225 |
-
$this->saveOptions($optionsArray,$getFieldsIndex);
|
226 |
-
}
|
227 |
-
}
|
228 |
-
public function removeField($getFieldsIndex)
|
229 |
-
{
|
230 |
-
//remove field then remove options
|
231 |
-
$fieldsModel = Mage::getModel('formbuilder/fields')->load($getFieldsIndex);
|
232 |
-
$fieldsModel->setFieldsIndex($getFieldsIndex);
|
233 |
-
$fieldsModel->delete();
|
234 |
-
$this->removeOptions($getFieldsIndex);
|
235 |
-
}*/
|
236 |
-
/*public function saveOptions($optionsArray,$getFieldsIndex)
|
237 |
-
{
|
238 |
-
if($this->_isNewField)
|
239 |
-
{
|
240 |
-
$this->addOptions($optionsArray,$getFieldsIndex);
|
241 |
-
}
|
242 |
-
else
|
243 |
-
{
|
244 |
-
$this->removeOptions($getFieldsIndex);
|
245 |
-
$this->addOptions($optionsArray,$getFieldsIndex);
|
246 |
-
}
|
247 |
-
}
|
248 |
-
public function addOptions($optionsArray,$getFieldsIndex)
|
249 |
-
{
|
250 |
-
$optionsModel = Mage::getModel('formbuilder/options');
|
251 |
-
$data = array();
|
252 |
-
foreach ($optionsArray as $key => $optionsArrayItem)
|
253 |
-
{
|
254 |
-
if(!$optionsArrayItem['is_delete'])
|
255 |
-
{
|
256 |
-
$data['fields_index'] = $getFieldsIndex;
|
257 |
-
$data['is_delete'] = $optionsArrayItem['is_delete'];
|
258 |
-
$data['title'] = $optionsArrayItem['title'];
|
259 |
-
$data['sort_order'] = $optionsArrayItem['sort_order'];
|
260 |
-
$optionsModel->setData($data);
|
261 |
-
$optionsModel->save();
|
262 |
-
}
|
263 |
-
}
|
264 |
-
}
|
265 |
-
public function removeOptions($getFieldsIndex)
|
266 |
-
{
|
267 |
-
$optionsCollection = Mage::getModel('formbuilder/options')->getCollection();
|
268 |
-
foreach ($optionsCollection as $key => $option)
|
269 |
-
{
|
270 |
-
if($option['fields_index']==$getFieldsIndex)
|
271 |
-
{
|
272 |
-
$currentOptionIndex = $option['options_index'];
|
273 |
-
$optionsModel = Mage::getModel('formbuilder/options')->load($currentOptionIndex);
|
274 |
-
$optionsModel->setOptionsIndex($currentOptionIndex);
|
275 |
-
$optionsModel->delete();
|
276 |
-
}
|
277 |
-
}
|
278 |
-
}*/
|
279 |
-
/**
|
280 |
-
* Path for config.
|
281 |
-
*/
|
282 |
-
const XML_CONFIG_PATH = 'formbuilder/general/';
|
283 |
-
|
284 |
-
/**
|
285 |
-
* Name library directory.
|
286 |
-
*/
|
287 |
-
const NAME_DIR_JS = 'formbuilder/jquery/';
|
288 |
-
|
289 |
-
/**
|
290 |
-
* List files for include.
|
291 |
-
*
|
292 |
-
* @var array
|
293 |
-
*/
|
294 |
-
protected $_files = array(
|
295 |
-
'jquery-1.8.1.min.js',
|
296 |
-
'jquery.noconflict.js',
|
297 |
-
);
|
298 |
-
|
299 |
-
/**
|
300 |
-
* Check enabled.
|
301 |
-
*
|
302 |
-
* @return bool
|
303 |
-
*/
|
304 |
-
public function isJqueryEnabled()
|
305 |
-
{
|
306 |
-
return (bool) $this->_getConfigValue('jquery', $store = '');
|
307 |
-
}
|
308 |
-
|
309 |
-
/**
|
310 |
-
* Return path file.
|
311 |
-
*
|
312 |
-
* @param $file
|
313 |
-
*
|
314 |
-
* @return string
|
315 |
-
*/
|
316 |
-
public function getJQueryPath($file)
|
317 |
-
{
|
318 |
-
return self::NAME_DIR_JS . $file;
|
319 |
-
}
|
320 |
-
|
321 |
-
/**
|
322 |
-
* Return list files.
|
323 |
-
*
|
324 |
-
* @return array
|
325 |
-
*/
|
326 |
-
public function getFiles()
|
327 |
-
{
|
328 |
-
return $this->_files;
|
329 |
-
}
|
330 |
-
|
331 |
-
public function isformbuilderModuleEnabled()
|
332 |
-
{
|
333 |
-
return (bool) $this->_getConfigValue('active', $store = '');
|
334 |
-
}
|
335 |
-
|
336 |
-
public function isResponsiveBannerEnabled()
|
337 |
-
{
|
338 |
-
return (bool) $this->_getConfigValue('responsive_banner', $store = '');
|
339 |
-
}
|
340 |
-
|
341 |
-
protected function _getConfigValue($key, $store)
|
342 |
-
{
|
343 |
-
return Mage::getStoreConfig(self::XML_CONFIG_PATH . $key, $store = '');
|
344 |
-
}
|
345 |
-
|
346 |
-
public function resizeImg($fileName,$width='',$height='')
|
347 |
-
{
|
348 |
-
$baseURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
|
349 |
-
$imageURL = $baseURL .'/'.'formbuilder'.'/'.$fileName;
|
350 |
-
|
351 |
-
$basePath = Mage::getBaseDir('media');
|
352 |
-
$imagePath = $basePath.DS.'formbuilder'.str_replace('/', DS,$fileName);
|
353 |
-
|
354 |
-
$extra =$width . 'x' . $height;
|
355 |
-
$newPath = Mage::getBaseDir('media') . DS .'formbuilder'.DS."resized".DS.$extra.str_replace('/', DS,$fileName);
|
356 |
-
//if width empty then return original size image's URL
|
357 |
-
if ($width != '' && $height != '') {
|
358 |
-
//if image has already resized then just return URL
|
359 |
-
if (file_exists($imagePath) && is_file($imagePath) && !file_exists($newPath)) {
|
360 |
-
$imageObj = new Varien_Image($imagePath);
|
361 |
-
$imageObj->constrainOnly(TRUE);
|
362 |
-
$imageObj->keepAspectRatio(FALSE);
|
363 |
-
$imageObj->keepFrame(FALSE);
|
364 |
-
//$width, $height - sizes you need (Note: when keepAspectRatio(TRUE), height would be ignored)
|
365 |
-
$imageObj->resize($width, $height);
|
366 |
-
$imageObj->save($newPath);
|
367 |
-
}
|
368 |
-
$resizedURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . "formbuilder".'/'."resized".'/'.$extra.'/'.$fileName;
|
369 |
-
} else {
|
370 |
-
$resizedURL = $imageURL;
|
371 |
-
}
|
372 |
-
return $resizedURL;
|
373 |
-
}
|
|
|
|
|
|
|
|
|
374 |
}
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
/**
|
4 |
+
* Phxsolution Formbuilder
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/osl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so you can be sent a copy immediately.
|
15 |
+
*
|
16 |
+
* Original code copyright (c) 2008 Irubin Consulting Inc. DBA Varien
|
17 |
+
*
|
18 |
+
* @category helper
|
19 |
+
* @package Phxsolution_Formbuilder
|
20 |
+
* @author Murad Ali
|
21 |
+
* @contact contact@phxsolution.com
|
22 |
+
* @site www.phxsolution.com
|
23 |
+
* @copyright Copyright (c) 2014 Phxsolution Formbuilder
|
24 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
class Phxsolution_Formbuilder_Helper_Data extends Mage_Core_Helper_Abstract
|
29 |
+
{
|
30 |
+
protected $_formData;
|
31 |
+
|
32 |
+
public function isProductEdit()
|
33 |
+
{
|
34 |
+
$currentProduct = Mage::registry('product');
|
35 |
+
if(isset($currentProduct))
|
36 |
+
return true;
|
37 |
+
else
|
38 |
+
return false;
|
39 |
+
}
|
40 |
+
public function setFormData($data)
|
41 |
+
{
|
42 |
+
$this->_formData = $data;
|
43 |
+
}
|
44 |
+
public function getFormData()
|
45 |
+
{
|
46 |
+
return $this->_formData;
|
47 |
+
}
|
48 |
+
public function getRedirectUrl()
|
49 |
+
{
|
50 |
+
return Mage::getStoreConfig('formbuilder_section/form_submission/redirect_url');
|
51 |
+
}
|
52 |
+
public function getLimitFormSubmissionForRegistered()
|
53 |
+
{
|
54 |
+
return Mage::getStoreConfig('formbuilder_section/form_submission/limit_form_submission_for_registered');
|
55 |
+
}
|
56 |
+
public function getLimitFormSubmissionForGuest()
|
57 |
+
{
|
58 |
+
return Mage::getStoreConfig('formbuilder_section/form_submission/limit_form_submission_for_guest');
|
59 |
+
}
|
60 |
+
public function getYearRange()
|
61 |
+
{
|
62 |
+
return Mage::getStoreConfig('formbuilder_section/custom_options/year_range');
|
63 |
+
}
|
64 |
+
public function getTimeFormat()
|
65 |
+
{
|
66 |
+
return Mage::getStoreConfig('formbuilder_section/custom_options/time_format');
|
67 |
+
}
|
68 |
+
public function getDateFieldsOrder()
|
69 |
+
{
|
70 |
+
return Mage::getStoreConfig('formbuilder_section/custom_options/date_fields_order');
|
71 |
+
}
|
72 |
+
public function useCalendar()
|
73 |
+
{
|
74 |
+
return Mage::getStoreConfig('formbuilder_section/custom_options/use_calendar');
|
75 |
+
}
|
76 |
+
public function getCustomerInfo()
|
77 |
+
{
|
78 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
79 |
+
return $customer;
|
80 |
+
}
|
81 |
+
public function getFormsModel()
|
82 |
+
{
|
83 |
+
return Mage::getModel('formbuilder/forms');
|
84 |
+
}
|
85 |
+
public function getFieldsModel()
|
86 |
+
{
|
87 |
+
return Mage::getModel('formbuilder/fields');
|
88 |
+
}
|
89 |
+
public function getOptionsModel()
|
90 |
+
{
|
91 |
+
return Mage::getModel('formbuilder/options');
|
92 |
+
}
|
93 |
+
public function getRecordsModel()
|
94 |
+
{
|
95 |
+
return Mage::getModel('formbuilder/records');
|
96 |
+
}
|
97 |
+
public function isEnabled()
|
98 |
+
{
|
99 |
+
return Mage::getStoreConfig('formbuilder_section/general/active');
|
100 |
+
}
|
101 |
+
public function registeredOnly()
|
102 |
+
{
|
103 |
+
return Mage::getStoreConfig('formbuilder_section/form_submission/registered_only');
|
104 |
+
}
|
105 |
+
public function showLinkinToplinks()
|
106 |
+
{
|
107 |
+
return Mage::getStoreConfig('formbuilder_section/general/in_toplinks');
|
108 |
+
}
|
109 |
+
public function showLinkinTopmenu()
|
110 |
+
{
|
111 |
+
return Mage::getStoreConfig('formbuilder_section/general/in_topmenu');
|
112 |
+
}
|
113 |
+
public function showLinkinFooterlinks()
|
114 |
+
{
|
115 |
+
return Mage::getStoreConfig('formbuilder_section/general/in_footerlinks');
|
116 |
+
}
|
117 |
+
public function getFormCollection()
|
118 |
+
{
|
119 |
+
$formCollection = array();
|
120 |
+
$formCollection = Mage::getModel('formbuilder/forms')->getCollection();
|
121 |
+
return $formCollection;
|
122 |
+
}
|
123 |
+
public function getCurrentFormDetails($currentFormId)
|
124 |
+
{
|
125 |
+
$currentForm = array();
|
126 |
+
$currentForm = Mage::getModel('formbuilder/forms')->load($currentFormId);
|
127 |
+
return $currentForm;
|
128 |
+
}
|
129 |
+
/*public function getcurrentFormFieldsCollection($currentFormId=0)
|
130 |
+
{
|
131 |
+
$fieldsCollection = array();
|
132 |
+
//$currentFormId = Mage::getSingleton('core/session')->getCurrentFormId();
|
133 |
+
if(!$currentFormId)
|
134 |
+
$currentFormId = $this->getCurrentFormId();
|
135 |
+
$fieldsCollection = Mage::getModel('formbuilder/fields')->getCollection();
|
136 |
+
$fieldsCollection->addFieldToFilter('forms_index',array('eq'=>$currentFormId));
|
137 |
+
return $fieldsCollection;
|
138 |
+
}*/
|
139 |
+
public function getCurrentFormId()
|
140 |
+
{
|
141 |
+
$sessionFormId = intval(Mage::getSingleton('core/session')->getCurrentFormId());
|
142 |
+
//$registryFormId = intval(Mage::registry('formbuilder_data')->getId());
|
143 |
+
//$currentFormId = $sessionFormId ? $sessionFormId : $registryFormId;
|
144 |
+
if(is_int($currentFormId = $sessionFormId))
|
145 |
+
return $currentFormId;
|
146 |
+
}
|
147 |
+
/*public function saveFields($fieldsArray)
|
148 |
+
{
|
149 |
+
$fieldsCollection = Mage::getModel('formbuilder/fields')->getCollection();
|
150 |
+
if(count($fieldsCollection))
|
151 |
+
{
|
152 |
+
foreach ($fieldsArray as $fieldsArrayItem)
|
153 |
+
{
|
154 |
+
foreach ($fieldsCollection as $fieldsItem)
|
155 |
+
{
|
156 |
+
if($fieldsArrayItem['id']==$fieldsItem['field_id'] && $this->getCurrentFormId()==$fieldsItem['forms_index'])
|
157 |
+
{
|
158 |
+
$this->_isNewField = false;
|
159 |
+
break;
|
160 |
+
}
|
161 |
+
}
|
162 |
+
if($this->_isNewField)
|
163 |
+
{
|
164 |
+
// adding new field to existing collection
|
165 |
+
if(!$fieldsArrayItem['is_delete'])
|
166 |
+
$this->addField($fieldsArrayItem);
|
167 |
+
}
|
168 |
+
else
|
169 |
+
{
|
170 |
+
// editing existing field
|
171 |
+
$this->removeField( $fieldsItem['fields_index'] );
|
172 |
+
if(!$fieldsArrayItem['is_delete'])
|
173 |
+
$this->addField($fieldsArrayItem);
|
174 |
+
}
|
175 |
+
}
|
176 |
+
}
|
177 |
+
elseif($this->_isNewField)
|
178 |
+
{
|
179 |
+
// adding first field
|
180 |
+
foreach ($fieldsArray as $fieldsArrayItem)
|
181 |
+
{
|
182 |
+
if(!$fieldsArrayItem['is_delete'])
|
183 |
+
$this->addField($fieldsArrayItem);
|
184 |
+
}
|
185 |
+
}
|
186 |
+
}
|
187 |
+
public function addField($fieldsArrayItem)
|
188 |
+
{
|
189 |
+
//add field then save options if any
|
190 |
+
$fieldsModel = Mage::getModel('formbuilder/fields');
|
191 |
+
$data = array();
|
192 |
+
|
193 |
+
$data['forms_index'] = $this->getCurrentFormId();
|
194 |
+
$data['field_id'] = $fieldsArrayItem['id'];
|
195 |
+
$data['previous_group'] = $fieldsArrayItem['previous_group'];
|
196 |
+
$data['type'] = $fieldsArrayItem['type'];
|
197 |
+
$data['title'] = $fieldsArrayItem['title'];
|
198 |
+
if(array_key_exists('values', $fieldsArrayItem))
|
199 |
+
$data['options'] = 1;
|
200 |
+
else
|
201 |
+
$data['options'] = 0;
|
202 |
+
$data['sort_order'] = $fieldsArrayItem['sort_order'];
|
203 |
+
$data['is_require'] = $fieldsArrayItem['is_require'];
|
204 |
+
$data['is_delete'] = $fieldsArrayItem['is_delete'];
|
205 |
+
$data['option_id'] = $fieldsArrayItem['option_id'];
|
206 |
+
$data['previous_type'] = $fieldsArrayItem['previous_type'];
|
207 |
+
|
208 |
+
if($fieldsArrayItem['previous_group']=='text')
|
209 |
+
$data['max_characters'] = $fieldsArrayItem['max_characters'];
|
210 |
+
elseif($fieldsArrayItem['previous_group']=='file')
|
211 |
+
{
|
212 |
+
$data['file_extension'] = $fieldsArrayItem['file_extension'];
|
213 |
+
$data['image_size_x'] = $fieldsArrayItem['image_size_x'];
|
214 |
+
$data['image_size_y'] = $fieldsArrayItem['image_size_y'];
|
215 |
+
}
|
216 |
+
|
217 |
+
$fieldsModel->setData($data);
|
218 |
+
$fieldsModel->save();
|
219 |
+
|
220 |
+
if(array_key_exists('values', $fieldsArrayItem))
|
221 |
+
{
|
222 |
+
$optionsArray = array();
|
223 |
+
$optionsArray = $fieldsArrayItem['values'];
|
224 |
+
$getFieldsIndex = $fieldsModel->getFieldsIndex();
|
225 |
+
$this->saveOptions($optionsArray,$getFieldsIndex);
|
226 |
+
}
|
227 |
+
}
|
228 |
+
public function removeField($getFieldsIndex)
|
229 |
+
{
|
230 |
+
//remove field then remove options
|
231 |
+
$fieldsModel = Mage::getModel('formbuilder/fields')->load($getFieldsIndex);
|
232 |
+
$fieldsModel->setFieldsIndex($getFieldsIndex);
|
233 |
+
$fieldsModel->delete();
|
234 |
+
$this->removeOptions($getFieldsIndex);
|
235 |
+
}*/
|
236 |
+
/*public function saveOptions($optionsArray,$getFieldsIndex)
|
237 |
+
{
|
238 |
+
if($this->_isNewField)
|
239 |
+
{
|
240 |
+
$this->addOptions($optionsArray,$getFieldsIndex);
|
241 |
+
}
|
242 |
+
else
|
243 |
+
{
|
244 |
+
$this->removeOptions($getFieldsIndex);
|
245 |
+
$this->addOptions($optionsArray,$getFieldsIndex);
|
246 |
+
}
|
247 |
+
}
|
248 |
+
public function addOptions($optionsArray,$getFieldsIndex)
|
249 |
+
{
|
250 |
+
$optionsModel = Mage::getModel('formbuilder/options');
|
251 |
+
$data = array();
|
252 |
+
foreach ($optionsArray as $key => $optionsArrayItem)
|
253 |
+
{
|
254 |
+
if(!$optionsArrayItem['is_delete'])
|
255 |
+
{
|
256 |
+
$data['fields_index'] = $getFieldsIndex;
|
257 |
+
$data['is_delete'] = $optionsArrayItem['is_delete'];
|
258 |
+
$data['title'] = $optionsArrayItem['title'];
|
259 |
+
$data['sort_order'] = $optionsArrayItem['sort_order'];
|
260 |
+
$optionsModel->setData($data);
|
261 |
+
$optionsModel->save();
|
262 |
+
}
|
263 |
+
}
|
264 |
+
}
|
265 |
+
public function removeOptions($getFieldsIndex)
|
266 |
+
{
|
267 |
+
$optionsCollection = Mage::getModel('formbuilder/options')->getCollection();
|
268 |
+
foreach ($optionsCollection as $key => $option)
|
269 |
+
{
|
270 |
+
if($option['fields_index']==$getFieldsIndex)
|
271 |
+
{
|
272 |
+
$currentOptionIndex = $option['options_index'];
|
273 |
+
$optionsModel = Mage::getModel('formbuilder/options')->load($currentOptionIndex);
|
274 |
+
$optionsModel->setOptionsIndex($currentOptionIndex);
|
275 |
+
$optionsModel->delete();
|
276 |
+
}
|
277 |
+
}
|
278 |
+
}*/
|
279 |
+
/**
|
280 |
+
* Path for config.
|
281 |
+
*/
|
282 |
+
const XML_CONFIG_PATH = 'formbuilder/general/';
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Name library directory.
|
286 |
+
*/
|
287 |
+
const NAME_DIR_JS = 'formbuilder/jquery/';
|
288 |
+
|
289 |
+
/**
|
290 |
+
* List files for include.
|
291 |
+
*
|
292 |
+
* @var array
|
293 |
+
*/
|
294 |
+
protected $_files = array(
|
295 |
+
'jquery-1.8.1.min.js',
|
296 |
+
'jquery.noconflict.js',
|
297 |
+
);
|
298 |
+
|
299 |
+
/**
|
300 |
+
* Check enabled.
|
301 |
+
*
|
302 |
+
* @return bool
|
303 |
+
*/
|
304 |
+
public function isJqueryEnabled()
|
305 |
+
{
|
306 |
+
return (bool) $this->_getConfigValue('jquery', $store = '');
|
307 |
+
}
|
308 |
+
|
309 |
+
/**
|
310 |
+
* Return path file.
|
311 |
+
*
|
312 |
+
* @param $file
|
313 |
+
*
|
314 |
+
* @return string
|
315 |
+
*/
|
316 |
+
public function getJQueryPath($file)
|
317 |
+
{
|
318 |
+
return self::NAME_DIR_JS . $file;
|
319 |
+
}
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Return list files.
|
323 |
+
*
|
324 |
+
* @return array
|
325 |
+
*/
|
326 |
+
public function getFiles()
|
327 |
+
{
|
328 |
+
return $this->_files;
|
329 |
+
}
|
330 |
+
|
331 |
+
public function isformbuilderModuleEnabled()
|
332 |
+
{
|
333 |
+
return (bool) $this->_getConfigValue('active', $store = '');
|
334 |
+
}
|
335 |
+
|
336 |
+
public function isResponsiveBannerEnabled()
|
337 |
+
{
|
338 |
+
return (bool) $this->_getConfigValue('responsive_banner', $store = '');
|
339 |
+
}
|
340 |
+
|
341 |
+
protected function _getConfigValue($key, $store)
|
342 |
+
{
|
343 |
+
return Mage::getStoreConfig(self::XML_CONFIG_PATH . $key, $store = '');
|
344 |
+
}
|
345 |
+
|
346 |
+
public function resizeImg($fileName,$width='',$height='')
|
347 |
+
{
|
348 |
+
$baseURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
|
349 |
+
$imageURL = $baseURL .'/'.'formbuilder'.'/'.$fileName;
|
350 |
+
|
351 |
+
$basePath = Mage::getBaseDir('media');
|
352 |
+
$imagePath = $basePath.DS.'formbuilder'.str_replace('/', DS,$fileName);
|
353 |
+
|
354 |
+
$extra =$width . 'x' . $height;
|
355 |
+
$newPath = Mage::getBaseDir('media') . DS .'formbuilder'.DS."resized".DS.$extra.str_replace('/', DS,$fileName);
|
356 |
+
//if width empty then return original size image's URL
|
357 |
+
if ($width != '' && $height != '') {
|
358 |
+
//if image has already resized then just return URL
|
359 |
+
if (file_exists($imagePath) && is_file($imagePath) && !file_exists($newPath)) {
|
360 |
+
$imageObj = new Varien_Image($imagePath);
|
361 |
+
$imageObj->constrainOnly(TRUE);
|
362 |
+
$imageObj->keepAspectRatio(FALSE);
|
363 |
+
$imageObj->keepFrame(FALSE);
|
364 |
+
//$width, $height - sizes you need (Note: when keepAspectRatio(TRUE), height would be ignored)
|
365 |
+
$imageObj->resize($width, $height);
|
366 |
+
$imageObj->save($newPath);
|
367 |
+
}
|
368 |
+
$resizedURL = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . "formbuilder".'/'."resized".'/'.$extra.'/'.$fileName;
|
369 |
+
} else {
|
370 |
+
$resizedURL = $imageURL;
|
371 |
+
}
|
372 |
+
return $resizedURL;
|
373 |
+
}
|
374 |
+
public function getImageUploadPath()
|
375 |
+
{
|
376 |
+
return "formbuilder/images/";
|
377 |
+
}
|
378 |
}
|
app/code/community/Phxsolution/Formbuilder/controllers/Adminhtml/FormbuilderController.php
CHANGED
@@ -184,58 +184,50 @@ class Phxsolution_Formbuilder_Adminhtml_FormbuilderController extends Mage_Admin
|
|
184 |
{
|
185 |
if ($data = $this->getRequest()->getPost())
|
186 |
{
|
187 |
-
/*echo "<pre>";
|
188 |
-
print_r($data);
|
189 |
-
echo "</pre>";
|
190 |
-
exit();*/
|
191 |
-
|
192 |
$model = Mage::getModel("formbuilder/forms")->load($this->getRequest()->getParam("id"));
|
193 |
$currentFormId = $this->getRequest()->getParam("id");
|
|
|
194 |
|
195 |
//save image
|
196 |
-
|
197 |
{
|
198 |
-
|
199 |
-
{
|
200 |
-
$data['title_image']='';
|
201 |
-
}
|
202 |
-
else
|
203 |
-
{
|
204 |
-
unset($data['title_image']);
|
205 |
-
if (isset($_FILES))
|
206 |
-
{
|
207 |
-
if ($_FILES['title_image']['name'])
|
208 |
-
{
|
209 |
-
if($this->getRequest()->getParam("id"))
|
210 |
-
{
|
211 |
-
//$model = Mage::getModel("formbuilder/forms")->load($this->getRequest()->getParam("id"));
|
212 |
-
if($model->getData('title_image'))
|
213 |
-
{
|
214 |
-
$io = new Varien_Io_File();
|
215 |
-
$io->rm(Mage::getBaseDir('media').DS.implode(DS,explode('/',$model->getData('title_image'))));
|
216 |
-
}
|
217 |
-
}
|
218 |
-
$path = Mage::getBaseDir('media') . DS . 'formbuilder/images' . DS;
|
219 |
-
$uploader = new Varien_File_Uploader('title_image');
|
220 |
-
$uploader->setAllowedExtensions(array('jpg','png','gif'));
|
221 |
-
$uploader->setAllowRenameFiles(false);
|
222 |
-
$uploader->setFilesDispersion(false);
|
223 |
-
$destFile = $path.$_FILES['title_image']['name'];
|
224 |
-
$filename = $uploader->getNewFileName($destFile);
|
225 |
-
$uploader->save($path, $filename);
|
226 |
-
|
227 |
-
$data['title_image']='formbuilder/images/'.$filename;
|
228 |
-
}
|
229 |
-
}
|
230 |
-
}
|
231 |
}
|
232 |
-
|
233 |
{
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
//save image ends
|
|
|
|
|
|
|
239 |
try
|
240 |
{
|
241 |
//$model = Mage::getModel("formbuilder/forms")->load($this->getRequest()->getParam("id"));
|
@@ -313,6 +305,14 @@ class Phxsolution_Formbuilder_Adminhtml_FormbuilderController extends Mage_Admin
|
|
313 |
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('formbuilder')->__('Unable to find Form to save'));
|
314 |
$this->_redirect('*/*/');
|
315 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
316 |
public function createCmsPage($currentModel)
|
317 |
{
|
318 |
$title = $currentModel['title'];
|
184 |
{
|
185 |
if ($data = $this->getRequest()->getPost())
|
186 |
{
|
|
|
|
|
|
|
|
|
|
|
187 |
$model = Mage::getModel("formbuilder/forms")->load($this->getRequest()->getParam("id"));
|
188 |
$currentFormId = $this->getRequest()->getParam("id");
|
189 |
+
$_helper = Mage::helper("formbuilder");
|
190 |
|
191 |
//save image
|
192 |
+
if (isset($data['title_image']['delete']) && $data['title_image']['delete'] == 1)
|
193 |
{
|
194 |
+
$data['title_image']='';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
}
|
196 |
+
else
|
197 |
{
|
198 |
+
if(isset($_FILES['title_image']['name']) && $_FILES['title_image']['name'] != '')
|
199 |
+
{
|
200 |
+
try
|
201 |
+
{
|
202 |
+
$_helper = Mage::helper("formbuilder");
|
203 |
+
$path = Mage::getBaseDir('media').DS.$_helper->getImageUploadPath().DS;
|
204 |
+
$fname = $_FILES['title_image']['name'];
|
205 |
+
$fname = str_replace(' ', '_', $fname);
|
206 |
+
$uploader = new Varien_File_Uploader('title_image');
|
207 |
+
$uploader->setAllowedExtensions(array('jpg','jpeg','png','gif'));
|
208 |
+
$uploader->setAllowCreateFolders(true);
|
209 |
+
$uploader->setAllowRenameFiles(true);
|
210 |
+
$uploader->setFilesDispersion(false);
|
211 |
+
$destFile = $path.$fname;
|
212 |
+
$fname = $uploader->getNewFileName($destFile);
|
213 |
+
$uploader->save($path,$fname);
|
214 |
+
}
|
215 |
+
catch (Exception $e)
|
216 |
+
{
|
217 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('formbuilder')->__('Error Message: '.$e->getMessage()));
|
218 |
+
}
|
219 |
+
//this way the name is saved in DB
|
220 |
+
$data['title_image'] = $_helper->getImageUploadPath().$fname;
|
221 |
+
}
|
222 |
+
else
|
223 |
+
{
|
224 |
+
unset($data['title_image']);
|
225 |
+
}
|
226 |
+
}
|
227 |
//save image ends
|
228 |
+
|
229 |
+
|
230 |
+
|
231 |
try
|
232 |
{
|
233 |
//$model = Mage::getModel("formbuilder/forms")->load($this->getRequest()->getParam("id"));
|
305 |
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('formbuilder')->__('Unable to find Form to save'));
|
306 |
$this->_redirect('*/*/');
|
307 |
}
|
308 |
+
public function removeFile($file)
|
309 |
+
{
|
310 |
+
$_helper = Mage::helper('ram');
|
311 |
+
$file = str_replace('\\', DS, $file);
|
312 |
+
$directory = Mage::getBaseDir('media') . DS .'formbuilder/images' ;
|
313 |
+
$io = new Varien_Io_File();
|
314 |
+
$result = $io->rmdir($directory, true);
|
315 |
+
}
|
316 |
public function createCmsPage($currentModel)
|
317 |
{
|
318 |
$title = $currentModel['title'];
|
app/code/community/Phxsolution/Formbuilder/etc/config.xml
CHANGED
@@ -27,7 +27,7 @@
|
|
27 |
<config>
|
28 |
<modules>
|
29 |
<Phxsolution_Formbuilder>
|
30 |
-
<version>0.3.
|
31 |
</Phxsolution_Formbuilder>
|
32 |
</modules>
|
33 |
<frontend>
|
27 |
<config>
|
28 |
<modules>
|
29 |
<Phxsolution_Formbuilder>
|
30 |
+
<version>0.3.2</version>
|
31 |
</Phxsolution_Formbuilder>
|
32 |
</modules>
|
33 |
<frontend>
|
app/etc/modules/Phxsolution_Formbuilder.xml
CHANGED
@@ -29,7 +29,7 @@
|
|
29 |
<Phxsolution_Formbuilder>
|
30 |
<active>true</active>
|
31 |
<codePool>community</codePool>
|
32 |
-
<version>0.3.
|
33 |
</Phxsolution_Formbuilder>
|
34 |
</modules>
|
35 |
</config>
|
29 |
<Phxsolution_Formbuilder>
|
30 |
<active>true</active>
|
31 |
<codePool>community</codePool>
|
32 |
+
<version>0.3.2</version>
|
33 |
</Phxsolution_Formbuilder>
|
34 |
</modules>
|
35 |
</config>
|
package.xml
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Phxsolution_Formbuilder</name>
|
4 |
-
<version>0.3.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSLv3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>Fixed
|
10 |
-
<description>Fixed some bugs of version 0.3.
|
11 |
-
<notes>Fixed
|
12 |
<authors><author><name>murad.magento</name><user>phxsolution</user><email>plvaniya@phxsolution.com</email></author></authors>
|
13 |
-
<date>2015-
|
14 |
-
<time>12:
|
15 |
-
<contents><target name="mageetc"><dir name="modules"><file name="Phxsolution_Formbuilder.xml" hash="
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Phxsolution_Formbuilder</name>
|
4 |
+
<version>0.3.2</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSLv3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Fixed phone number and form image issues</summary>
|
10 |
+
<description>Fixed some bugs of version 0.3.1</description>
|
11 |
+
<notes>Fixed phone number and form image issues</notes>
|
12 |
<authors><author><name>murad.magento</name><user>phxsolution</user><email>plvaniya@phxsolution.com</email></author></authors>
|
13 |
+
<date>2015-10-31</date>
|
14 |
+
<time>14:12:40</time>
|
15 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Phxsolution_Formbuilder.xml" hash="275849a09bae766b895790102d85bee2"/></dir></target><target name="magecommunity"><dir name="Phxsolution"><dir name="Formbuilder"><dir name="Block"><dir name="Adminhtml"><dir name="Formbuilder"><dir name="Edit"><dir name="Elements"><file name="Jscolorblock.php" hash="1a990d2bf3de66e0a57dfbee0392a24c"/></dir><file name="Form.php" hash="e20273437fb55a13d45d7f614b49e5ed"/><dir name="Tab"><file name="Fieldsgrid.php" hash="935506a56a3e021d90b39469381c1f95"/><file name="Form.php" hash="c884b3ab1d2047a5d9893573ca3798df"/><dir name="Options"><file name="Option.php" hash="b90344afd1f05bfc8fd93fd8d6ad6e98"/><dir name="Type"><file name="Date.php" hash="c0565edcd7fe65e834c781d42a6d19c2"/><file name="File.php" hash="0bc4ad5bedd67075aeb36255a90934f5"/><file name="Select.php" hash="6f8fc022bec1946ca819d01426132013"/><file name="Text.php" hash="f0aaf04e77ed8877a91e8335d164a7a3"/></dir></dir><file name="Options.php" hash="a5eb61c23da76f98a58adfbc72ca3746"/><file name="Recordsgrid.php" hash="a8c0f341b75c0b87d0b9d5714b158362"/></dir><file name="Tabs.php" hash="594b46d1fb37f35da23435e5a29ad81e"/></dir><file name="Edit.php" hash="14988d6334ce10c41c5e1c4dcd77bfc4"/><file name="Grid.php" hash="f340245d0ba0c753076da26443de5bf9"/><dir name="Renderer"><file name="Fieldtitle.php" hash="77de7c80130e9c65f9a480c76fef1595"/><file name="Formtitle.php" hash="4f9ace648d90453f65163d9cf71f25af"/><file name="Getoptions.php" hash="4f4bbab55ae3b846c3e82f08d724e93c"/><file name="Image.php" hash="909166a3560788ad9bd4b4c7c02c7138"/><file name="Numberoffields.php" hash="d6ce87f925d62b87b05e9267e79ae186"/><file name="Recordvalue.php" hash="a389e7f2e53f6f35e9bf49c4ce98d1d8"/><file name="Recordvalue.php-31-oct-15" hash="d70981ef9bc85469ea883a636c9046d5"/></dir></dir><file name="Formbuilder.php" hash="f9f257c3730efb61a02c648e24613d5e"/></dir><dir name="Frontend"><file name="Date.php" hash="0797ca67913af04e5a174db2b53419eb"/><file name="File.php" hash="73b64e65cb622ea93ed127ac690103ae"/><file name="Form.php" hash="d5f5bc44ec2d929e91d22772275121de"/><file name="Formbuilder.php" hash="99d21ff63f09c50bb1c02f231201a7a1"/><file name="Select.php" hash="d97b7f7fa96c4327fb722b14a2995140"/><file name="Text.php" hash="e0dea9657f1ce1b7630f630e3bf133d4"/></dir></dir><dir name="Helper"><file name="Data.php" hash="9c5b9e4c12153c06d42f1fdd3d70fb9b"/></dir><dir name="Model"><file name="Fields.php" hash="e03fcfc2bcfda3a0159d32fb134278d6"/><file name="Forms.php" hash="b911a987069ab83971cd8679696f1141"/><dir name="Mysql4"><dir name="Fields"><file name="Collection.php" hash="c7226e1388d223abd4869e2c960fd1c9"/></dir><file name="Fields.php" hash="53a3270bcc205ad77827e501b99d8258"/><dir name="Forms"><file name="Collection.php" hash="ed05e64031c62842df14721614687b33"/></dir><file name="Forms.php" hash="ec9f6f339eb39f32f3b5de7f8d2532ad"/><dir name="Options"><file name="Collection.php" hash="cc0d0272478f6d4f8b72d27bd96d55da"/></dir><file name="Options.php" hash="93bbe8f013286c7b2b4e2afb5d7da780"/><dir name="Records"><file name="Collection.php" hash="70e6959cf7b609f39aebed7058d5b34e"/></dir><file name="Records.php" hash="3209f8474955cff494c419b00fa729f5"/></dir><file name="Observer.php" hash="83deea98e8df7e61962cfb0af69a7682"/><file name="Options.php" hash="90fccc8c4be7b66d269fa9f88c069716"/><file name="Records.php" hash="76f39afcb412cfbae3211df2332ff407"/><file name="Status.php" hash="46137d1b2f0f3a2bc96729db3e0c6e99"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FormbuilderController.php" hash="0fdea09958c73460faee2b3ed9bcc0bf"/></dir><file name="IndexController.php" hash="225c6e59dbb9318e80330e21457f56ea"/></dir><dir name="etc"><file name="config.xml" hash="9fa1c2441a83e184fc1ef04cbcc7a504"/><file name="system.xml" hash="50e22f7a3bffae4c59f6b6abe65420bf"/></dir><dir name="sql"><dir name="formbuilder_setup"><file name="mysql4-install-0.1.0.php" hash="16a10b71a46e014f24c4c9f3e6c059e5"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="formbuilder"><file name="date.phtml" hash="f9cf6dbae29f6078b1891d304c2546de"/><file name="file.phtml" hash="f9eb1f8c2cd771721073680d88980d85"/><file name="form.phtml" hash="28d0723b899618875fbfbe1bad88c2d0"/><file name="formbuilder.phtml" hash="28ea24b9237feec17e8475d0540e06a2"/><file name="select.phtml" hash="3d95fa9af63afcf5eccff1250d48f7dc"/><file name="text.phtml" hash="38503786b985bf3fcd48af6009a4bb10"/></dir></dir><dir name="layout"><file name="formbuilder.xml" hash="cb2c356c3666211638016a8ae5ff9854"/></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="formbuilder.xml" hash="89e5db34b8171e238af46178d386a0f1"/></dir><dir name="template"><dir name="formbuilder"><dir name="catalog"><dir name="product"><dir name="edit"><dir name="options"><file name="option.phtml" hash="c24802beaec38ea569082a0dc0268ad1"/><dir name="type"><file name="date.phtml" hash="e939ad56a38df54ef2e02050b8c196d4"/><file name="file.phtml" hash="6195acc29483fc3743f4f3761c2050c4"/><file name="select.phtml" hash="bad580b6b244b717a1de0a266edd255a"/><file name="text.phtml" hash="72d6ef6a4a46b7b342fd90be449e3731"/></dir></dir><file name="options.phtml" hash="8b4febcfd81ce0ef726393fbabfdd024"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="formbuilder"><file name="custom.css" hash="ff07c6fc91c26e6e477140835b6bbad4"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="formbuilder"><dir name="jscolor"><file name="arrow.gif" hash="5034704a76cd55c1cbcbc58ea6bf523f"/><file name="cross.gif" hash="ba9a274b9323753cd95bc3b1eb2f4e5f"/><file name="hs.png" hash="fefa1a03d92ebad25c88dca94a0b63db"/><file name="hv.png" hash="990d71cada17da100653636cf8490884"/><file name="jscolor.js" hash="d85e03380b38c0937ee2c2594c599720"/></dir></dir></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
</package>
|
skin/frontend/base/default/css/formbuilder/custom.css
CHANGED
@@ -1,27 +1,29 @@
|
|
1 |
-
/*
|
2 |
-
/**
|
3 |
-
* Phxsolution Formbuilder
|
4 |
-
*
|
5 |
-
* NOTICE OF LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
-
* that is bundled with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://opensource.org/licenses/osl-3.0.php
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@magentocommerce.com so you can be sent a copy immediately.
|
14 |
-
*
|
15 |
-
* Original code copyright (c) 2008 Irubin Consulting Inc. DBA Varien
|
16 |
-
*
|
17 |
-
* @category module css
|
18 |
-
* @package Phxsolution_Formbuilder
|
19 |
-
* @author Murad Ali
|
20 |
-
* @contact contact@phxsolution.com
|
21 |
-
* @site www.phxsolution.com
|
22 |
-
* @copyright Copyright (c) 2014 Phxsolution Formbuilder
|
23 |
-
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
24 |
-
*/
|
25 |
-
.form-list .input-box {width:450px}
|
26 |
-
.product-options {border: 1px solid #333
|
27 |
-
.formbuilder ul {list-style: none !important; list-style-type: none !important;}
|
|
|
|
1 |
+
/*
|
2 |
+
/**
|
3 |
+
* Phxsolution Formbuilder
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Open Software License (OSL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/osl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magentocommerce.com so you can be sent a copy immediately.
|
14 |
+
*
|
15 |
+
* Original code copyright (c) 2008 Irubin Consulting Inc. DBA Varien
|
16 |
+
*
|
17 |
+
* @category module css
|
18 |
+
* @package Phxsolution_Formbuilder
|
19 |
+
* @author Murad Ali
|
20 |
+
* @contact contact@phxsolution.com
|
21 |
+
* @site www.phxsolution.com
|
22 |
+
* @copyright Copyright (c) 2014 Phxsolution Formbuilder
|
23 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
24 |
+
*/
|
25 |
+
.form-list .input-box {width:450px}
|
26 |
+
.product-options {/*border: 1px solid #333;*/}
|
27 |
+
.formbuilder ul {list-style: none !important; list-style-type: none !important;}
|
28 |
+
#custom_form .input-text {width:100%}
|
29 |
+
#custom_form .title_image {text-align: center;}
|