Version Notes
Auguria_Contact
Download this release
Release Info
Developer | Magento Core Team |
Extension | Auguria_Contact |
Version | 0.1.1 |
Comparing to | |
See all releases |
Version 0.1.1
- app/code/community/Auguria/Contact/Block/Adminhtml/Contact.php +24 -0
- app/code/community/Auguria/Contact/Block/Adminhtml/Contact/Edit.php +50 -0
- app/code/community/Auguria/Contact/Block/Adminhtml/Contact/Edit/Form.php +116 -0
- app/code/community/Auguria/Contact/Block/Adminhtml/Contact/Grid.php +147 -0
- app/code/community/Auguria/Contact/Block/Contact.php +54 -0
- app/code/community/Auguria/Contact/Helper/Data.php +10 -0
- app/code/community/Auguria/Contact/Model/Contacts.php +15 -0
- app/code/community/Auguria/Contact/Model/Mysql4/Contacts.php +139 -0
- app/code/community/Auguria/Contact/Model/Mysql4/Contacts/Collection.php +64 -0
- app/code/community/Auguria/Contact/controllers/Adminhtml/ContactController.php +207 -0
- app/code/community/Auguria/Contact/controllers/Contacts/IndexController.php +127 -0
- app/code/community/Auguria/Contact/etc/adminhtml.xml +38 -0
- app/code/community/Auguria/Contact/etc/config.xml +143 -0
- app/code/community/Auguria/Contact/etc/system.xml +38 -0
- app/code/community/Auguria/Contact/sql/auguria_contact_setup/mysql4-install-0.1.0.php +30 -0
- app/code/community/Auguria/Contact/sql/auguria_contact_setup/mysql4-upgrade-0.1.0-0.1.1.php +18 -0
- app/design/frontend/base/default/layout/auguria/contact.xml +15 -0
- app/design/frontend/base/default/template/auguria/contact/form.phtml +80 -0
- app/etc/modules/Auguria_Contact.xml +21 -0
- app/locale/fr_FR/Auguria_Contact.csv +35 -0
- app/locale/fr_FR/template/email/auguria/contact/contact_form.html +20 -0
- package.xml +18 -0
app/code/community/Auguria/Contact/Block/Adminhtml/Contact.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_Contact
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
7 |
+
*/
|
8 |
+
class Auguria_Contact_Block_Adminhtml_Contact extends Mage_Adminhtml_Block_Widget_Grid_Container
|
9 |
+
{
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Initialize banners manage page
|
13 |
+
*
|
14 |
+
* @return void
|
15 |
+
*/
|
16 |
+
public function __construct()
|
17 |
+
{
|
18 |
+
$this->_controller = 'adminhtml_contact';
|
19 |
+
$this->_blockGroup = 'auguria_contact';
|
20 |
+
$this->_headerText = Mage::helper('auguria_contact')->__('Manage Contacts');
|
21 |
+
$this->_addButtonLabel = Mage::helper('auguria_contact')->__('Add Contact');
|
22 |
+
parent::__construct();
|
23 |
+
}
|
24 |
+
}
|
app/code/community/Auguria/Contact/Block/Adminhtml/Contact/Edit.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_Contact
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
7 |
+
*/
|
8 |
+
class Auguria_Contact_Block_Adminhtml_Contact_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
9 |
+
{
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
$this->_objectId = 'contact_id';
|
13 |
+
$this->_controller = 'adminhtml_contact';
|
14 |
+
$this->_blockGroup = 'auguria_contact';
|
15 |
+
parent::__construct();
|
16 |
+
|
17 |
+
$this->_updateButton('save', 'label', Mage::helper('auguria_contact')->__('Save Contact'));
|
18 |
+
$this->_updateButton('delete', 'label', Mage::helper('auguria_contact')->__('Delete Contact'));
|
19 |
+
|
20 |
+
$this->_addButton(
|
21 |
+
'saveandcontinue', array(
|
22 |
+
'label' => Mage::helper('adminhtml')->__('Save and Continue Edit'),
|
23 |
+
'onclick' => 'saveAndContinueEdit()',
|
24 |
+
'class' => 'save',
|
25 |
+
),
|
26 |
+
-100
|
27 |
+
);
|
28 |
+
|
29 |
+
$this->_formScripts[] = "
|
30 |
+
function saveAndContinueEdit(){
|
31 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
32 |
+
}
|
33 |
+
";
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Get edit form container header text
|
38 |
+
*
|
39 |
+
* @return string
|
40 |
+
*/
|
41 |
+
public function getHeaderText()
|
42 |
+
{
|
43 |
+
if (Mage::registry('auguria_contact')->getId()) {
|
44 |
+
return Mage::helper('auguria_contact')->__("Edit Contact '%s'", $this->htmlEscape(Mage::registry('auguria_contact')->getIdentifier()));
|
45 |
+
} else {
|
46 |
+
return Mage::helper('auguria_contact')->__('New Contact');
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
}
|
app/code/community/Auguria/Contact/Block/Adminhtml/Contact/Edit/Form.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_Contact
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
7 |
+
*/
|
8 |
+
class Auguria_Contact_Block_Adminhtml_Contact_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
9 |
+
{
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Init form
|
13 |
+
*/
|
14 |
+
public function __construct()
|
15 |
+
{
|
16 |
+
parent::__construct();
|
17 |
+
$this->setId('contact_form');
|
18 |
+
$this->setTitle(Mage::helper('auguria_contact')->__('Contact Information'));
|
19 |
+
}
|
20 |
+
|
21 |
+
protected function _prepareForm()
|
22 |
+
{
|
23 |
+
return $this->generate(Mage::app()->isSingleStoreMode());
|
24 |
+
}
|
25 |
+
|
26 |
+
public function generate($isinglestore)
|
27 |
+
{
|
28 |
+
$model = Mage::registry('auguria_contact');
|
29 |
+
|
30 |
+
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getUrl('*/contact/save'), 'method' => 'post'));
|
31 |
+
|
32 |
+
$form->setHtmlIdPrefix('contact_');
|
33 |
+
|
34 |
+
$fieldset = $form->addFieldset('base_fieldset', array('legend'=>Mage::helper('auguria_contact')->__('General Information'), 'class' => 'fieldset-wide'));
|
35 |
+
|
36 |
+
if ($model->getContactId()) {
|
37 |
+
$fieldset->addField('contact_id', 'hidden', array('name' => 'contact_id',));
|
38 |
+
}
|
39 |
+
|
40 |
+
$fieldset->addField(
|
41 |
+
'identifier', 'text', array(
|
42 |
+
'name' => 'identifier',
|
43 |
+
'label' => Mage::helper('auguria_contact')->__('Identifier'),
|
44 |
+
'title' => Mage::helper('auguria_contact')->__('Identifier'),
|
45 |
+
'required' => true,
|
46 |
+
'class' => 'validate-identifier',
|
47 |
+
)
|
48 |
+
);
|
49 |
+
|
50 |
+
$fieldset->addField(
|
51 |
+
'email', 'text', array(
|
52 |
+
'name' => 'email',
|
53 |
+
'label' => Mage::helper('auguria_contact')->__('Email'),
|
54 |
+
'title' => Mage::helper('auguria_contact')->__('Email'),
|
55 |
+
'required' => true,
|
56 |
+
'class' => 'validate-email',
|
57 |
+
)
|
58 |
+
);
|
59 |
+
|
60 |
+
$fieldset->addField(
|
61 |
+
'frontend_subject', 'text', array(
|
62 |
+
'name' => 'frontend_subject',
|
63 |
+
'label' => Mage::helper('auguria_contact')->__('Frontend Subject'),
|
64 |
+
'title' => Mage::helper('auguria_contact')->__('Frontend Subject'),
|
65 |
+
'required' => true,
|
66 |
+
)
|
67 |
+
);
|
68 |
+
|
69 |
+
$fieldset->addField(
|
70 |
+
'email_subject', 'text', array(
|
71 |
+
'name' => 'email_subject',
|
72 |
+
'label' => Mage::helper('auguria_contact')->__('Email Subject'),
|
73 |
+
'title' => Mage::helper('auguria_contact')->__('Email Subject'),
|
74 |
+
'required' => true,
|
75 |
+
)
|
76 |
+
);
|
77 |
+
|
78 |
+
$fieldset->addField(
|
79 |
+
'position', 'text', array(
|
80 |
+
'name' => 'position',
|
81 |
+
'label' => Mage::helper('auguria_contact')->__('Position'),
|
82 |
+
'title' => Mage::helper('auguria_contact')->__('Position'),
|
83 |
+
'class' => 'validate-digits',
|
84 |
+
)
|
85 |
+
);
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Check is single store mode
|
89 |
+
*/
|
90 |
+
if (!$isinglestore) {
|
91 |
+
$fieldset->addField(
|
92 |
+
'store_id', 'multiselect', array(
|
93 |
+
'name' => 'stores[]',
|
94 |
+
'label' => Mage::helper('auguria_contact')->__('Store View'),
|
95 |
+
'title' => Mage::helper('auguria_contact')->__('Store View'),
|
96 |
+
'required' => true,
|
97 |
+
'values' => Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
|
98 |
+
)
|
99 |
+
);
|
100 |
+
} else {
|
101 |
+
$fieldset->addField(
|
102 |
+
'store_id', 'hidden', array(
|
103 |
+
'name' => 'stores[]',
|
104 |
+
'value' => Mage::app()->getStore(true)->getId()
|
105 |
+
)
|
106 |
+
);
|
107 |
+
$model->setStoreId(Mage::app()->getStore(true)->getId());
|
108 |
+
}
|
109 |
+
|
110 |
+
$form->setValues($model->getData());
|
111 |
+
$form->setUseContainer(true);
|
112 |
+
$this->setForm($form);
|
113 |
+
|
114 |
+
return parent::_prepareForm();
|
115 |
+
}
|
116 |
+
}
|
app/code/community/Auguria/Contact/Block/Adminhtml/Contact/Grid.php
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_Contact
|
5 |
+
* @author Auguria
|
6 |
+
*/
|
7 |
+
class Auguria_Contact_Block_Adminhtml_Contact_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
8 |
+
{
|
9 |
+
/**
|
10 |
+
* Set defaults
|
11 |
+
*/
|
12 |
+
protected function _construct()
|
13 |
+
{
|
14 |
+
parent::_construct();
|
15 |
+
$this->setId('contactGrid');
|
16 |
+
$this->setDefaultSort('contact_id');
|
17 |
+
$this->setDefaultDir('desc');
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Instantiate and prepare collection
|
22 |
+
*
|
23 |
+
* @return Enterprise_Banner_Block_Adminhtml_Contact_Grid
|
24 |
+
*/
|
25 |
+
protected function _prepareCollection()
|
26 |
+
{
|
27 |
+
$collection = Mage::getResourceModel('auguria_contact/contacts_collection');
|
28 |
+
$this->setCollection($collection);
|
29 |
+
return parent::_prepareCollection();
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Define grid columns
|
34 |
+
*/
|
35 |
+
protected function _prepareColumns()
|
36 |
+
{
|
37 |
+
$this->addColumn(
|
38 |
+
'contact_id',
|
39 |
+
array(
|
40 |
+
'header'=> Mage::helper('auguria_contact')->__('ID'),
|
41 |
+
'width' => 1,
|
42 |
+
'type' => 'number',
|
43 |
+
'index' => 'contact_id',
|
44 |
+
)
|
45 |
+
);
|
46 |
+
|
47 |
+
$this->addColumn(
|
48 |
+
'identifier', array(
|
49 |
+
'header' => Mage::helper('auguria_contact')->__('Identifier'),
|
50 |
+
'align' => 'left',
|
51 |
+
'index' => 'identifier'
|
52 |
+
)
|
53 |
+
);
|
54 |
+
|
55 |
+
$this->addColumn(
|
56 |
+
'frontend_subject', array(
|
57 |
+
'header' => Mage::helper('auguria_contact')->__('Frontend Subject'),
|
58 |
+
'align' => 'left',
|
59 |
+
'index' => 'frontend_subject',
|
60 |
+
)
|
61 |
+
);
|
62 |
+
|
63 |
+
$this->addColumn(
|
64 |
+
'email_subject', array(
|
65 |
+
'header' => Mage::helper('auguria_contact')->__('Email Subject'),
|
66 |
+
'align' => 'left',
|
67 |
+
'index' => 'email_subject',
|
68 |
+
)
|
69 |
+
);
|
70 |
+
|
71 |
+
$this->addColumn(
|
72 |
+
'email', array(
|
73 |
+
'header' => Mage::helper('auguria_contact')->__('Email'),
|
74 |
+
'align' => 'left',
|
75 |
+
'index' => 'email',
|
76 |
+
)
|
77 |
+
);
|
78 |
+
|
79 |
+
$this->addColumn(
|
80 |
+
'position', array(
|
81 |
+
'header' => Mage::helper('auguria_contact')->__('Position'),
|
82 |
+
'align' => 'right',
|
83 |
+
'index' => 'position',
|
84 |
+
'type' => 'number',
|
85 |
+
)
|
86 |
+
);
|
87 |
+
|
88 |
+
if (!Mage::app()->isSingleStoreMode()) {
|
89 |
+
$this->addColumn(
|
90 |
+
'store_id', array(
|
91 |
+
'header' => Mage::helper('auguria_contact')->__('Store View'),
|
92 |
+
'index' => 'store_id',
|
93 |
+
'type' => 'store',
|
94 |
+
'store_all' => true,
|
95 |
+
'store_view' => true,
|
96 |
+
'sortable' => false,
|
97 |
+
'filter_condition_callback' => array($this, '_filterStoreCondition'),
|
98 |
+
)
|
99 |
+
);
|
100 |
+
}
|
101 |
+
|
102 |
+
return parent::_prepareColumns();
|
103 |
+
}
|
104 |
+
/**
|
105 |
+
* Prepare mass action options for this grid
|
106 |
+
*/
|
107 |
+
protected function _prepareMassaction()
|
108 |
+
{
|
109 |
+
$this->setMassactionIdField('contact_id');
|
110 |
+
$this->getMassactionBlock()->setFormFieldName('contact');
|
111 |
+
|
112 |
+
$this->getMassactionBlock()->addItem(
|
113 |
+
'delete', array(
|
114 |
+
'label' => Mage::helper('auguria_contact')->__('Delete'),
|
115 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
116 |
+
'confirm' => Mage::helper('auguria_contact')->__('Are you sure you want to delete these contacts?')
|
117 |
+
)
|
118 |
+
);
|
119 |
+
|
120 |
+
return $this;
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Row click url
|
125 |
+
*
|
126 |
+
* @return string
|
127 |
+
*/
|
128 |
+
public function getRowUrl($row)
|
129 |
+
{
|
130 |
+
return $this->getUrl('*/*/edit', array('contact_id' => $row->getId()));
|
131 |
+
}
|
132 |
+
|
133 |
+
protected function _afterLoadCollection()
|
134 |
+
{
|
135 |
+
$this->getCollection()->walk('afterLoad');
|
136 |
+
parent::_afterLoadCollection();
|
137 |
+
}
|
138 |
+
|
139 |
+
protected function _filterStoreCondition($collection, $column)
|
140 |
+
{
|
141 |
+
if (!$value = $column->getFilter()->getValue()) {
|
142 |
+
return;
|
143 |
+
}
|
144 |
+
|
145 |
+
$this->getCollection()->addStoreFilter($value);
|
146 |
+
}
|
147 |
+
}
|
app/code/community/Auguria/Contact/Block/Contact.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_Contact
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
7 |
+
*/
|
8 |
+
class Auguria_Contact_Block_Contact extends Mage_Core_Block_Template
|
9 |
+
{
|
10 |
+
protected $_customerIsLoggedIn;
|
11 |
+
|
12 |
+
protected function getCustomerIsLoggedIn()
|
13 |
+
{
|
14 |
+
if (!isset($this->_customerIsLoggedIn)) {
|
15 |
+
$this->_customerIsLoggedIn = Mage::getSingleton('customer/session')->isLoggedIn();
|
16 |
+
}
|
17 |
+
return $this->_customerIsLoggedIn;
|
18 |
+
}
|
19 |
+
public function getFirstName()
|
20 |
+
{
|
21 |
+
if (!$this->getCustomerIsLoggedIn()) {
|
22 |
+
return '';
|
23 |
+
}
|
24 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
25 |
+
return trim($customer->getFirstname());
|
26 |
+
}
|
27 |
+
|
28 |
+
public function getLastName()
|
29 |
+
{
|
30 |
+
if (!$this->getCustomerIsLoggedIn()) {
|
31 |
+
return '';
|
32 |
+
}
|
33 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
34 |
+
return trim($customer->getLastname());
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getEmail()
|
38 |
+
{
|
39 |
+
if (!$this->getCustomerIsLoggedIn()) {
|
40 |
+
return '';
|
41 |
+
}
|
42 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
43 |
+
return trim($customer->getEmail());
|
44 |
+
}
|
45 |
+
|
46 |
+
public function getSubjects()
|
47 |
+
{
|
48 |
+
$subjects = Mage::getResourceModel('auguria_contact/contacts_collection')
|
49 |
+
->addStoreFilter(Mage::app()->getStore()->getId())
|
50 |
+
->setOrder('position', 'ASC')
|
51 |
+
->toOptionArray();
|
52 |
+
return $subjects;
|
53 |
+
}
|
54 |
+
}
|
app/code/community/Auguria/Contact/Helper/Data.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_Contact
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
7 |
+
*/
|
8 |
+
class Auguria_Contact_Helper_Data extends Mage_Catalog_Helper_Data
|
9 |
+
{
|
10 |
+
}
|
app/code/community/Auguria/Contact/Model/Contacts.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_Contact
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
7 |
+
*/
|
8 |
+
class Auguria_Contact_Model_Contacts extends Mage_Core_Model_Abstract
|
9 |
+
{
|
10 |
+
public function _construct()
|
11 |
+
{
|
12 |
+
parent::_construct();
|
13 |
+
$this->_init('auguria_contact/contacts');
|
14 |
+
}
|
15 |
+
}
|
app/code/community/Auguria/Contact/Model/Mysql4/Contacts.php
ADDED
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_Contact
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Auguria_Contact_Model_Mysql4_Contacts extends Mage_Core_Model_Mysql4_Abstract
|
10 |
+
{
|
11 |
+
public function _construct()
|
12 |
+
{
|
13 |
+
$this->_init('auguria_contact/contacts', 'contact_id');
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
*
|
18 |
+
*
|
19 |
+
* @param Mage_Core_Model_Abstract $object
|
20 |
+
*/
|
21 |
+
protected function _beforeSave(Mage_Core_Model_Abstract $object)
|
22 |
+
{
|
23 |
+
if (!$this->getIsUniqueContactToStores($object)) {
|
24 |
+
Mage::throwException(Mage::helper('auguria_contact')->__('A contact identifier with the same properties already exists in the selected store.'));
|
25 |
+
}
|
26 |
+
return $this;
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
*
|
31 |
+
* @param Mage_Core_Model_Abstract $object
|
32 |
+
*/
|
33 |
+
protected function _afterSave(Mage_Core_Model_Abstract $object)
|
34 |
+
{
|
35 |
+
$condition = $this->_getWriteAdapter()->quoteInto('contact_id = ?', $object->getId());
|
36 |
+
$this->_getWriteAdapter()->delete($this->getTable('auguria_contact/stores'), $condition);
|
37 |
+
|
38 |
+
foreach ((array)$object->getData('stores') as $store) {
|
39 |
+
$storeArray = array();
|
40 |
+
$storeArray['contact_id'] = $object->getId();
|
41 |
+
$storeArray['store_id'] = $store;
|
42 |
+
$this->_getWriteAdapter()->insert($this->getTable('auguria_contact/stores'), $storeArray);
|
43 |
+
}
|
44 |
+
|
45 |
+
return parent::_afterSave($object);
|
46 |
+
}
|
47 |
+
|
48 |
+
public function load(Mage_Core_Model_Abstract $object, $value, $field=null)
|
49 |
+
{
|
50 |
+
|
51 |
+
if (!intval($value) && is_string($value)) {
|
52 |
+
$field = 'identifier';
|
53 |
+
}
|
54 |
+
return parent::load($object, $value, $field);
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
*
|
59 |
+
* @param Mage_Core_Model_Abstract $object
|
60 |
+
*/
|
61 |
+
protected function _afterLoad(Mage_Core_Model_Abstract $object)
|
62 |
+
{
|
63 |
+
if ($object->getId()) {
|
64 |
+
$select = $this->_getReadAdapter()->select()
|
65 |
+
->from($this->getTable('auguria_contact/stores'))
|
66 |
+
->where('contact_id = ?', $object->getId());
|
67 |
+
|
68 |
+
if ($data = $this->_getReadAdapter()->fetchAll($select)) {
|
69 |
+
$storesArray = array();
|
70 |
+
foreach ($data as $row) {
|
71 |
+
$storesArray[] = $row['store_id'];
|
72 |
+
}
|
73 |
+
$object->setData('store_id', $storesArray);
|
74 |
+
}
|
75 |
+
}
|
76 |
+
|
77 |
+
return parent::_afterLoad($object);
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Retrieve select object for load object data
|
82 |
+
*
|
83 |
+
* @param string $field
|
84 |
+
* @param mixed $value
|
85 |
+
* @return Zend_Db_Select
|
86 |
+
*/
|
87 |
+
protected function _getLoadSelect($field, $value, $object)
|
88 |
+
{
|
89 |
+
|
90 |
+
$select = parent::_getLoadSelect($field, $value, $object);
|
91 |
+
|
92 |
+
if ($object->getStoreId()) {
|
93 |
+
$select->join(array('wcs' => $this->getTable('auguria_contact/stores')), $this->getMainTable().'.contact_id = wcs.contact_id')
|
94 |
+
->where('wcs.store_id in (0, ?) ', $object->getStoreId())
|
95 |
+
->order('store_id DESC')
|
96 |
+
->limit(1);
|
97 |
+
}
|
98 |
+
return $select;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Check for unique of identifier of block to selected store(s).
|
103 |
+
*
|
104 |
+
* @param Mage_Core_Model_Abstract $object
|
105 |
+
* @return bool
|
106 |
+
*/
|
107 |
+
public function getIsUniqueContactToStores(Mage_Core_Model_Abstract $object)
|
108 |
+
{
|
109 |
+
$select = $this->_getWriteAdapter()->select()
|
110 |
+
->from($this->getMainTable())
|
111 |
+
->join(array('wcs' => $this->getTable('auguria_contact/stores')), $this->getMainTable().'.contact_id = `wcs`.contact_id')
|
112 |
+
->where($this->getMainTable().'.identifier = ?', $object->getData('identifier'));
|
113 |
+
if ($object->getId()) {
|
114 |
+
$select->where($this->getMainTable().'.contact_id <> ?', $object->getId());
|
115 |
+
}
|
116 |
+
$select->where('`wcs`.store_id IN (?)', (array)$object->getData('stores'));
|
117 |
+
|
118 |
+
if ($this->_getWriteAdapter()->fetchRow($select)) {
|
119 |
+
return false;
|
120 |
+
}
|
121 |
+
|
122 |
+
return true;
|
123 |
+
}
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Get store ids to which specified item is assigned
|
127 |
+
*
|
128 |
+
* @param int $id
|
129 |
+
* @return array
|
130 |
+
*/
|
131 |
+
public function lookupStoreIds($id)
|
132 |
+
{
|
133 |
+
return $this->_getReadAdapter()->fetchCol(
|
134 |
+
$this->_getReadAdapter()->select()
|
135 |
+
->from($this->getTable('auguria_contact/stores'), 'store_id')
|
136 |
+
->where("{$this->getIdFieldName()} = ?", $id)
|
137 |
+
);
|
138 |
+
}
|
139 |
+
}
|
app/code/community/Auguria/Contact/Model/Mysql4/Contacts/Collection.php
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_Contact
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
7 |
+
*/
|
8 |
+
|
9 |
+
class Auguria_Contact_Model_Mysql4_Contacts_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
10 |
+
{
|
11 |
+
public function _construct()
|
12 |
+
{
|
13 |
+
parent::_construct();
|
14 |
+
$this->_init('auguria_contact/contacts');
|
15 |
+
$this->_map['fields']['store'] = 'store_table.store_id';
|
16 |
+
}
|
17 |
+
|
18 |
+
public function toOptionArray()
|
19 |
+
{
|
20 |
+
return $this->_toOptionArray('contact_id', 'frontend_subject');
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Add filter by store
|
25 |
+
*
|
26 |
+
* @param int|Mage_Core_Model_Store $store
|
27 |
+
* @return Auguria_Contact_Model_Mysql4_Contacts_Collection
|
28 |
+
*/
|
29 |
+
public function addStoreFilter($store, $withAdmin = true)
|
30 |
+
{
|
31 |
+
if ($store instanceof Mage_Core_Model_Store) {
|
32 |
+
$store = array($store->getId());
|
33 |
+
}
|
34 |
+
$this->addFilter('store', array('in' => ($withAdmin ? array(0, $store) : $store)), 'public');
|
35 |
+
return $this;
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Get SQL for get record count
|
40 |
+
*
|
41 |
+
* @return Varien_Db_Select
|
42 |
+
*/
|
43 |
+
public function getSelectCountSql()
|
44 |
+
{
|
45 |
+
$countSelect = parent::getSelectCountSql();
|
46 |
+
$countSelect->reset(Zend_Db_Select::GROUP);
|
47 |
+
return $countSelect;
|
48 |
+
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Join store relation table if there is store filter
|
52 |
+
*/
|
53 |
+
protected function _renderFiltersBefore()
|
54 |
+
{
|
55 |
+
if ($this->getFilter('store')) {
|
56 |
+
$this->getSelect()->join(
|
57 |
+
array('store_table' => $this->getTable('auguria_contact/stores')),
|
58 |
+
'main_table.contact_id = store_table.contact_id',
|
59 |
+
array()
|
60 |
+
)->group('main_table.contact_id');
|
61 |
+
}
|
62 |
+
return parent::_renderFiltersBefore();
|
63 |
+
}
|
64 |
+
}
|
app/code/community/Auguria/Contact/controllers/Adminhtml/ContactController.php
ADDED
@@ -0,0 +1,207 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_Contact
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
7 |
+
*/
|
8 |
+
class Auguria_Contact_Adminhtml_ContactController extends Mage_Adminhtml_Controller_Action
|
9 |
+
{
|
10 |
+
/**
|
11 |
+
* Init actions
|
12 |
+
*
|
13 |
+
* @return Mage_Adminhtml_Cms_BlockController
|
14 |
+
*/
|
15 |
+
protected function _initAction()
|
16 |
+
{
|
17 |
+
// load layout, set active menu and breadcrumbs
|
18 |
+
$this->loadLayout()
|
19 |
+
->_setActiveMenu('cms/contacts');
|
20 |
+
return $this;
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Banners list
|
25 |
+
*
|
26 |
+
* @return void
|
27 |
+
*/
|
28 |
+
public function indexAction()
|
29 |
+
{
|
30 |
+
$this->_title($this->__('CMS'))->_title($this->__('Contacts'));
|
31 |
+
$this->_initAction();
|
32 |
+
$this->renderLayout();
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Create new contact
|
37 |
+
*/
|
38 |
+
public function newAction()
|
39 |
+
{
|
40 |
+
// the same form is used to create and edit
|
41 |
+
$this->_forward('edit');
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Edit action
|
46 |
+
*
|
47 |
+
*/
|
48 |
+
public function editAction()
|
49 |
+
{
|
50 |
+
$this->_title($this->__('CMS'))->_title($this->__('Contacts'));
|
51 |
+
|
52 |
+
// 1. Get ID and create model
|
53 |
+
$id = $this->getRequest()->getParam('contact_id');
|
54 |
+
$model = Mage::getModel('auguria_contact/contacts');
|
55 |
+
|
56 |
+
// 2. Initial checking
|
57 |
+
if ($id) {
|
58 |
+
$model->load($id);
|
59 |
+
if (! $model->getId()) {
|
60 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('auguria_contact')->__('This contact no longer exists.'));
|
61 |
+
$this->_redirect('*/*/');
|
62 |
+
return;
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
$this->_title($model->getId() ? $model->getTitle() : $this->__('New Contact'));
|
67 |
+
|
68 |
+
// 3. Set entered data if was error when we do save
|
69 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
70 |
+
if (! empty($data)) {
|
71 |
+
$model->setData($data);
|
72 |
+
}
|
73 |
+
// 4. Register model to use later in blocks
|
74 |
+
Mage::register('auguria_contact', $model);
|
75 |
+
|
76 |
+
// 5. Build edit form
|
77 |
+
$this->_initAction()
|
78 |
+
->_addBreadcrumb($id ? Mage::helper('auguria_contact')->__('Edit Contact') : Mage::helper('auguria_contact')->__('New Block'), $id ? Mage::helper('cms')->__('Edit Contact') : Mage::helper('auguria_contact')->__('New Contact'))
|
79 |
+
->renderLayout();
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Save action
|
84 |
+
*/
|
85 |
+
public function saveAction()
|
86 |
+
{
|
87 |
+
// check if data sent
|
88 |
+
if ($data = $this->getRequest()->getPost()) {
|
89 |
+
|
90 |
+
$id = $this->getRequest()->getParam('contact_id');
|
91 |
+
$model = Mage::getModel('auguria_contact/contacts')->load($id);
|
92 |
+
if (!$model->getId() && $id) {
|
93 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('auguria_contact')->__('This block no longer exists.'));
|
94 |
+
$this->_redirect('*/*/');
|
95 |
+
return;
|
96 |
+
}
|
97 |
+
|
98 |
+
// init model and set data
|
99 |
+
|
100 |
+
$model->setData($data);
|
101 |
+
|
102 |
+
// try to save it
|
103 |
+
try {
|
104 |
+
// save the data
|
105 |
+
$model->save();
|
106 |
+
// display success message
|
107 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('auguria_contact')->__('The contact has been saved.'));
|
108 |
+
// clear previously saved data from session
|
109 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
110 |
+
|
111 |
+
// check if 'Save and Continue'
|
112 |
+
if ($this->getRequest()->getParam('back')) {
|
113 |
+
$this->_redirect('*/*/edit', array('contact_id' => $model->getId()));
|
114 |
+
return;
|
115 |
+
}
|
116 |
+
// go to grid
|
117 |
+
$this->_redirect('*/*/');
|
118 |
+
return;
|
119 |
+
|
120 |
+
} catch (Exception $e) {
|
121 |
+
// display error message
|
122 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
123 |
+
// save data in session
|
124 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
125 |
+
// redirect to edit form
|
126 |
+
$this->_redirect('*/*/edit', array('contact_id' => $this->getRequest()->getParam('contact_id')));
|
127 |
+
return;
|
128 |
+
}
|
129 |
+
}
|
130 |
+
$this->_redirect('*/*/');
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Delete action
|
135 |
+
*
|
136 |
+
*/
|
137 |
+
public function deleteAction()
|
138 |
+
{
|
139 |
+
// check if we know what should be deleted
|
140 |
+
if ($id = $this->getRequest()->getParam('contact_id')) {
|
141 |
+
try {
|
142 |
+
// init model and delete
|
143 |
+
$model = Mage::getModel('auguria_contact/contacts');
|
144 |
+
$model->load($id);
|
145 |
+
$model->delete();
|
146 |
+
// display success message
|
147 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('auguria_contact')->__('The contact has been deleted.'));
|
148 |
+
// go to grid
|
149 |
+
$this->_redirect('*/*/');
|
150 |
+
return;
|
151 |
+
|
152 |
+
} catch (Exception $e) {
|
153 |
+
// display error message
|
154 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
155 |
+
// go back to edit form
|
156 |
+
$this->_redirect('*/*/edit', array('contact_id' => $id));
|
157 |
+
return;
|
158 |
+
}
|
159 |
+
}
|
160 |
+
// display error message
|
161 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('auguria_contact')->__('Unable to find a contact to delete.'));
|
162 |
+
// go to grid
|
163 |
+
$this->_redirect('*/*/');
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Delete specified banners using grid massaction
|
168 |
+
*
|
169 |
+
*/
|
170 |
+
public function massDeleteAction()
|
171 |
+
{
|
172 |
+
$ids = $this->getRequest()->getParam('contact');
|
173 |
+
if (!is_array($ids)) {
|
174 |
+
$this->_getSession()->addError($this->__('Please select contact(s).'));
|
175 |
+
} else {
|
176 |
+
try {
|
177 |
+
foreach ($ids as $id) {
|
178 |
+
$model = Mage::getSingleton('auguria_contact/contacts')->load($id);
|
179 |
+
$model->delete();
|
180 |
+
}
|
181 |
+
|
182 |
+
$this->_getSession()->addSuccess(
|
183 |
+
$this->__('Total of %d record(s) have been deleted.', count($ids))
|
184 |
+
);
|
185 |
+
} catch (Mage_Core_Exception $e) {
|
186 |
+
$this->_getSession()->addError($e->getMessage());
|
187 |
+
} catch (Exception $e) {
|
188 |
+
$this->_getSession()->addError(Mage::helper('auguria_contact')->__('An error occurred while mass deleting contacts. Please review log and try again.'));
|
189 |
+
Mage::logException($e);
|
190 |
+
return;
|
191 |
+
}
|
192 |
+
}
|
193 |
+
$this->_redirect('*/*/index');
|
194 |
+
}
|
195 |
+
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Check the permission to run it
|
199 |
+
*
|
200 |
+
* @return boolean
|
201 |
+
*/
|
202 |
+
protected function _isAllowed()
|
203 |
+
{
|
204 |
+
return Mage::getSingleton('admin/session')->isAllowed('cms/contacts');
|
205 |
+
}
|
206 |
+
|
207 |
+
}
|
app/code/community/Auguria/Contact/controllers/Contacts/IndexController.php
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_Contact
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
7 |
+
*/
|
8 |
+
require_once 'Mage/Contacts/controllers/IndexController.php';
|
9 |
+
class Auguria_Contact_Contacts_IndexController extends Mage_Contacts_IndexController
|
10 |
+
{
|
11 |
+
/*
|
12 |
+
const XML_PATH_EMAIL_RECIPIENT = 'contacts/email/recipient_email';
|
13 |
+
const XML_PATH_EMAIL_SENDER = 'contacts/email/sender_email_identity';
|
14 |
+
const XML_PATH_EMAIL_TEMPLATE = 'contacts/email/email_template';
|
15 |
+
const XML_PATH_ENABLED = 'contacts/contacts/enabled';
|
16 |
+
*/
|
17 |
+
public function preDispatch()
|
18 |
+
{
|
19 |
+
parent::preDispatch();
|
20 |
+
}
|
21 |
+
|
22 |
+
public function postAction()
|
23 |
+
{
|
24 |
+
$post = $this->getRequest()->getPost();
|
25 |
+
if ($post) {
|
26 |
+
$translate = Mage::getSingleton('core/translate');
|
27 |
+
/* @var $translate Mage_Core_Model_Translate */
|
28 |
+
$translate->setTranslateInline(false);
|
29 |
+
try {
|
30 |
+
$error = false;
|
31 |
+
|
32 |
+
if (!Zend_Validate::is(trim($post['firstname']), 'NotEmpty')) {
|
33 |
+
$error = true;
|
34 |
+
}
|
35 |
+
|
36 |
+
if (!Zend_Validate::is(trim($post['lastname']), 'NotEmpty')) {
|
37 |
+
$error = true;
|
38 |
+
}
|
39 |
+
|
40 |
+
if (!Zend_Validate::is(trim($post['telephone']), 'NotEmpty')) {
|
41 |
+
$error = true;
|
42 |
+
}
|
43 |
+
|
44 |
+
if (!Zend_Validate::is(trim($post['email']), 'EmailAddress')) {
|
45 |
+
$error = true;
|
46 |
+
}
|
47 |
+
|
48 |
+
if (!Zend_Validate::is(trim($post['comment']), 'NotEmpty')) {
|
49 |
+
$error = true;;
|
50 |
+
}
|
51 |
+
|
52 |
+
if (Zend_Validate::is(trim($post['hideit']), 'NotEmpty')) {
|
53 |
+
$error = true;
|
54 |
+
}
|
55 |
+
|
56 |
+
if (isset($post['subject'])) {
|
57 |
+
if (!Zend_Validate::is(trim($post['subject']), 'NotEmpty')) {
|
58 |
+
$error = true;
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
if ($error) {
|
63 |
+
throw new Exception();
|
64 |
+
}
|
65 |
+
|
66 |
+
|
67 |
+
$postObject = new Varien_Object();
|
68 |
+
$postObject->setData($post);
|
69 |
+
|
70 |
+
//set data depending on subject
|
71 |
+
$recipient = Mage::getStoreConfig(self::XML_PATH_EMAIL_RECIPIENT);
|
72 |
+
$subject = Mage::app()->getStore()->getName().' : ';
|
73 |
+
$emailSubject = Mage::helper('auguria_contact')->__('Form contact');
|
74 |
+
if (isset($post['subject'])) {
|
75 |
+
$contact = Mage::getModel('auguria_contact/contacts')->load($post['subject']);
|
76 |
+
$recipient = $contact->getEmail();
|
77 |
+
$subject .= $contact->getEmailSubject();
|
78 |
+
$emailSubject = $contact->getEmailSubject();
|
79 |
+
} else {
|
80 |
+
$subject .= '['.Mage::helper('auguria_contact')->__('Form contact').']';
|
81 |
+
}
|
82 |
+
$subject .= ' - '.$post['lastname'].' - '.$post['order_id'];
|
83 |
+
$postObject->setData('subject', $subject);
|
84 |
+
$postObject->setData('email_subject', $emailSubject);
|
85 |
+
|
86 |
+
//add br to message
|
87 |
+
$postObject->setData('comment', nl2br($post['comment']));
|
88 |
+
|
89 |
+
//keep compatibility with default email template
|
90 |
+
$postObject->setData('name', $post['firstname'].' '.$post['lastname']);
|
91 |
+
|
92 |
+
$mailTemplate = Mage::getModel('core/email_template');
|
93 |
+
/* @var $mailTemplate Mage_Core_Model_Email_Template */
|
94 |
+
$mailTemplate->setDesignConfig(array('area' => 'frontend'))
|
95 |
+
->setReplyTo($post['email'])
|
96 |
+
->sendTransactional(
|
97 |
+
Mage::getStoreConfig('contacts/email/auguria_template'),
|
98 |
+
Mage::getStoreConfig(self::XML_PATH_EMAIL_SENDER),
|
99 |
+
$recipient,
|
100 |
+
null,
|
101 |
+
array('data' => $postObject)
|
102 |
+
);
|
103 |
+
|
104 |
+
if (!$mailTemplate->getSentSuccess()) {
|
105 |
+
throw new Exception();
|
106 |
+
}
|
107 |
+
|
108 |
+
$translate->setTranslateInline(true);
|
109 |
+
|
110 |
+
Mage::getSingleton('customer/session')->addSuccess(Mage::helper('contacts')->__('Your inquiry was submitted and will be responded to as soon as possible. Thank you for contacting us.'));
|
111 |
+
$this->_redirect('*/*/');
|
112 |
+
|
113 |
+
return;
|
114 |
+
} catch (Exception $e) {
|
115 |
+
$translate->setTranslateInline(true);
|
116 |
+
Mage::logException($e);
|
117 |
+
Mage::getSingleton('customer/session')->addError(Mage::helper('contacts')->__('Unable to submit your request. Please, try again later'));
|
118 |
+
$this->_redirect('*/*/');
|
119 |
+
return;
|
120 |
+
}
|
121 |
+
|
122 |
+
} else {
|
123 |
+
$this->_redirect('*/*/');
|
124 |
+
}
|
125 |
+
}
|
126 |
+
|
127 |
+
}
|
app/code/community/Auguria/Contact/etc/adminhtml.xml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Auguria
|
5 |
+
* @package Auguria_Contact
|
6 |
+
* @author Auguria
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<menu>
|
12 |
+
<cms>
|
13 |
+
<children>
|
14 |
+
<contacts translate="title" module="auguria_contact">
|
15 |
+
<title>Contacts</title>
|
16 |
+
<action>adminhtml/contact</action>
|
17 |
+
<sort_order>100</sort_order>
|
18 |
+
</contacts>
|
19 |
+
</children>
|
20 |
+
</cms>
|
21 |
+
</menu>
|
22 |
+
<acl>
|
23 |
+
<resources>
|
24 |
+
<admin>
|
25 |
+
<children>
|
26 |
+
<cms>
|
27 |
+
<children>
|
28 |
+
<contacts translate="title" module="auguria_contact">
|
29 |
+
<title>Contacts</title>
|
30 |
+
<sort_order>100</sort_order>
|
31 |
+
</contacts>
|
32 |
+
</children>
|
33 |
+
</cms>
|
34 |
+
</children>
|
35 |
+
</admin>
|
36 |
+
</resources>
|
37 |
+
</acl>
|
38 |
+
</config>
|
app/code/community/Auguria/Contact/etc/config.xml
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Auguria
|
5 |
+
* @package Auguria_Contact
|
6 |
+
* @author Auguria
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<Auguria_Contact>
|
13 |
+
<version>0.1.1</version>
|
14 |
+
</Auguria_Contact>
|
15 |
+
</modules>
|
16 |
+
<global>
|
17 |
+
<models>
|
18 |
+
<auguria_contact>
|
19 |
+
<class>Auguria_Contact_Model</class>
|
20 |
+
<resourceModel>auguria_contact_mysql4</resourceModel>
|
21 |
+
</auguria_contact>
|
22 |
+
<auguria_contact_mysql4>
|
23 |
+
<class>Auguria_Contact_Model_Mysql4</class>
|
24 |
+
<entities>
|
25 |
+
<contacts>
|
26 |
+
<table>auguria_contacts</table>
|
27 |
+
</contacts>
|
28 |
+
<stores>
|
29 |
+
<table>auguria_contacts_stores</table>
|
30 |
+
</stores>
|
31 |
+
</entities>
|
32 |
+
</auguria_contact_mysql4>
|
33 |
+
</models>
|
34 |
+
<blocks>
|
35 |
+
<auguria_contact>
|
36 |
+
<class>Auguria_Contact_Block</class>
|
37 |
+
</auguria_contact>
|
38 |
+
</blocks>
|
39 |
+
<helpers>
|
40 |
+
<auguria_contact>
|
41 |
+
<class>Auguria_Contact_Helper</class>
|
42 |
+
</auguria_contact>
|
43 |
+
</helpers>
|
44 |
+
<resources>
|
45 |
+
<auguria_contact_setup>
|
46 |
+
<setup>
|
47 |
+
<module>Auguria_Contact</module>
|
48 |
+
</setup>
|
49 |
+
<connection>
|
50 |
+
<use>core_setup</use>
|
51 |
+
</connection>
|
52 |
+
</auguria_contact_setup>
|
53 |
+
<auguria_contact_write>
|
54 |
+
<connection>
|
55 |
+
<use>core_write</use>
|
56 |
+
</connection>
|
57 |
+
</auguria_contact_write>
|
58 |
+
<auguria_contact_read>
|
59 |
+
<connection>
|
60 |
+
<use>core_read</use>
|
61 |
+
</connection>
|
62 |
+
</auguria_contact_read>
|
63 |
+
</resources>
|
64 |
+
<rewrite>
|
65 |
+
<auguria_contact_contacts_index>
|
66 |
+
<from><![CDATA[#^/contacts/index/#]]></from>
|
67 |
+
<to>/contact/contacts_index/</to>
|
68 |
+
</auguria_contact_contacts_index>
|
69 |
+
</rewrite>
|
70 |
+
<template>
|
71 |
+
<email>
|
72 |
+
<contacts_email_auguria_template translate="label" module="auguria_contact">
|
73 |
+
<label>Auguria Contact Form</label>
|
74 |
+
<file>auguria/contact/contact_form.html</file>
|
75 |
+
<type>html</type>
|
76 |
+
</contacts_email_auguria_template>
|
77 |
+
</email>
|
78 |
+
</template>
|
79 |
+
</global>
|
80 |
+
<frontend>
|
81 |
+
<routers>
|
82 |
+
<Auguria_Contact>
|
83 |
+
<use>standard</use>
|
84 |
+
<args>
|
85 |
+
<module>Auguria_Contact</module>
|
86 |
+
<frontName>contact</frontName>
|
87 |
+
</args>
|
88 |
+
</Auguria_Contact>
|
89 |
+
</routers>
|
90 |
+
<layout>
|
91 |
+
<updates>
|
92 |
+
<auguria_contact>
|
93 |
+
<file>auguria/contact.xml</file>
|
94 |
+
</auguria_contact>
|
95 |
+
</updates>
|
96 |
+
</layout>
|
97 |
+
<translate>
|
98 |
+
<modules>
|
99 |
+
<Auguria_Contact>
|
100 |
+
<files>
|
101 |
+
<default>Auguria_Contact.csv</default>
|
102 |
+
</files>
|
103 |
+
</Auguria_Contact>
|
104 |
+
</modules>
|
105 |
+
</translate>
|
106 |
+
</frontend>
|
107 |
+
<admin>
|
108 |
+
<routers>
|
109 |
+
<adminhtml>
|
110 |
+
<args>
|
111 |
+
<modules>
|
112 |
+
<auguria_contact before="Mage_Adminhtml">Auguria_Contact_Adminhtml</auguria_contact>
|
113 |
+
</modules>
|
114 |
+
</args>
|
115 |
+
</adminhtml>
|
116 |
+
</routers>
|
117 |
+
</admin>
|
118 |
+
<adminhtml>
|
119 |
+
<layout>
|
120 |
+
<updates>
|
121 |
+
<auguria_contact>
|
122 |
+
<file>auguria/contact.xml</file>
|
123 |
+
</auguria_contact>
|
124 |
+
</updates>
|
125 |
+
</layout>
|
126 |
+
<translate>
|
127 |
+
<modules>
|
128 |
+
<Auguria_Contact>
|
129 |
+
<files>
|
130 |
+
<default>Auguria_Contact.csv</default>
|
131 |
+
</files>
|
132 |
+
</Auguria_Contact>
|
133 |
+
</modules>
|
134 |
+
</translate>
|
135 |
+
</adminhtml>
|
136 |
+
<default>
|
137 |
+
<contacts>
|
138 |
+
<email>
|
139 |
+
<auguria_template>contacts_email_auguria_template</auguria_template>
|
140 |
+
</email>
|
141 |
+
</contacts>
|
142 |
+
</default>
|
143 |
+
</config>
|
app/code/community/Auguria/Contact/etc/system.xml
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Auguria
|
5 |
+
* @package Auguria_Contact
|
6 |
+
* @author Auguria
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<sections>
|
12 |
+
<contacts>
|
13 |
+
<groups>
|
14 |
+
<email>
|
15 |
+
<fields>
|
16 |
+
<recipient_email translate="label" module="auguria_contact">
|
17 |
+
<label>Default recipient</label>
|
18 |
+
</recipient_email>
|
19 |
+
<email_template>
|
20 |
+
<show_in_default>0</show_in_default>
|
21 |
+
<show_in_website>0</show_in_website>
|
22 |
+
<show_in_store>0</show_in_store>
|
23 |
+
</email_template>
|
24 |
+
<auguria_template translate="label" module="auguria_contact">
|
25 |
+
<label>Email Template</label>
|
26 |
+
<frontend_type>select</frontend_type>
|
27 |
+
<source_model>adminhtml/system_config_source_email_template</source_model>
|
28 |
+
<sort_order>30</sort_order>
|
29 |
+
<show_in_default>1</show_in_default>
|
30 |
+
<show_in_website>1</show_in_website>
|
31 |
+
<show_in_store>1</show_in_store>
|
32 |
+
</auguria_template>
|
33 |
+
</fields>
|
34 |
+
</email>
|
35 |
+
</groups>
|
36 |
+
</contacts>
|
37 |
+
</sections>
|
38 |
+
</config>
|
app/code/community/Auguria/Contact/sql/auguria_contact_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Create contact table and contact stoe table
|
4 |
+
* @category Auguria
|
5 |
+
* @package Auguria_Contact
|
6 |
+
* @author Auguria
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
$installer = $this;
|
10 |
+
$installer->startSetup();
|
11 |
+
$installer->run(
|
12 |
+
"
|
13 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('auguria_contact/contacts')}` (
|
14 |
+
`contact_id` int(11) unsigned NOT NULL auto_increment,
|
15 |
+
`identifier` varchar(255) NOT NULL default '',
|
16 |
+
`email` varchar(255) NOT NULL default '',
|
17 |
+
`frontend_subject` varchar(255) NOT NULL default '',
|
18 |
+
`email_subject` varchar(255) NOT NULL default '',
|
19 |
+
`position` int(11) NOT NULL,
|
20 |
+
PRIMARY KEY (`contact_id`)
|
21 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
22 |
+
|
23 |
+
CREATE TABLE IF NOT EXISTS `{$this->getTable('auguria_contact/stores')}` (
|
24 |
+
`contact_id` int(11) unsigned NOT NULL auto_increment,
|
25 |
+
`store_id` smallint(5) unsigned NOT NULL,
|
26 |
+
PRIMARY KEY (`contact_id`,`store_id`)
|
27 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
28 |
+
"
|
29 |
+
);
|
30 |
+
$installer->endSetup();
|
app/code/community/Auguria/Contact/sql/auguria_contact_setup/mysql4-upgrade-0.1.0-0.1.1.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Add constraint to delete store values on contact delete
|
5 |
+
* @category Auguria
|
6 |
+
* @package Auguria_Contact
|
7 |
+
* @author Auguria
|
8 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
+
*/
|
10 |
+
$installer = $this;
|
11 |
+
$installer->startSetup();
|
12 |
+
$installer->run(
|
13 |
+
"
|
14 |
+
ALTER TABLE `{$this->getTable('auguria_contact/stores')}`
|
15 |
+
ADD CONSTRAINT `FK_AUGURIA_CONTACT_STORES_CONTACTS` FOREIGN KEY (`contact_id`) REFERENCES `{$this->getTable('auguria_contact/contacts')}` (`contact_id`) ON UPDATE CASCADE ON DELETE CASCADE,
|
16 |
+
ADD CONSTRAINT `FK_AUGURIA_CONTACT_STORES_STORES` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core/store')} (`store_id`) ON UPDATE CASCADE ON DELETE CASCADE;"
|
17 |
+
);
|
18 |
+
$installer->endSetup();
|
app/design/frontend/base/default/layout/auguria/contact.xml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Auguria
|
5 |
+
* @package Auguria_Contact
|
6 |
+
* @author Auguria
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<layout version="0.1.0">
|
11 |
+
<contacts_index_index>
|
12 |
+
<update handle="content"/>
|
13 |
+
<block type="auguria_contact/contact" name="contactForm" template="auguria/contact/form.phtml"/>
|
14 |
+
</contacts_index_index>
|
15 |
+
</layout>
|
app/design/frontend/base/default/template/auguria/contact/form.phtml
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category Auguria
|
4 |
+
* @package Auguria_Contact
|
5 |
+
* @author Auguria
|
6 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
|
10 |
+
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('contact_page_header')->toHtml(); ?>
|
11 |
+
<form action="<?php echo $this->getFormAction(); ?>" id="contactForm" method="post">
|
12 |
+
<div class="fieldset">
|
13 |
+
<ul class="form-list">
|
14 |
+
<li>
|
15 |
+
<label for="lastname" class="required"><em>*</em><?php echo Mage::helper('auguria_contact')->__('Lastname') ?></label>
|
16 |
+
<div class="input-box">
|
17 |
+
<input name="lastname" id="lastname" title="<?php echo Mage::helper('auguria_contact')->__('Lastname') ?>" value="<?php echo $this->htmlEscape($this->getLastname()); ?>" class="input-text required-entry" type="text" />
|
18 |
+
</div>
|
19 |
+
</li>
|
20 |
+
<li>
|
21 |
+
<label for="firstname" class="required"><em>*</em><?php echo Mage::helper('auguria_contact')->__('Firstname') ?></label>
|
22 |
+
<div class="input-box">
|
23 |
+
<input name="firstname" id="firstname" title="<?php echo Mage::helper('auguria_contact')->__('Firstname') ?>" value="<?php echo $this->htmlEscape($this->getFirstname()); ?>" class="input-text required-entry" type="text" />
|
24 |
+
</div>
|
25 |
+
</li>
|
26 |
+
<li>
|
27 |
+
<label for="order_id"><?php echo Mage::helper('auguria_contact')->__('Order Id') ?></label>
|
28 |
+
<div class="input-box">
|
29 |
+
<input name="order_id" id="order_id" title="<?php echo Mage::helper('auguria_contact')->__('Order Id') ?>" value="" class="input-text" type="text" />
|
30 |
+
</div>
|
31 |
+
</li>
|
32 |
+
<li>
|
33 |
+
<label for="email" class="required"><em>*</em><?php echo Mage::helper('auguria_contact')->__('Email') ?></label>
|
34 |
+
<div class="input-box">
|
35 |
+
<input name="email" id="email" title="<?php echo Mage::helper('auguria_contact')->__('Email') ?>" value="<?php echo $this->htmlEscape($this->getEmail()); ?>" class="input-text required-entry validate-email" type="text" />
|
36 |
+
</div>
|
37 |
+
</li>
|
38 |
+
<li>
|
39 |
+
<label for="telephone" class="required"><em>*</em><?php echo Mage::helper('auguria_contact')->__('Telephone') ?></label>
|
40 |
+
<div class="input-box">
|
41 |
+
<input name="telephone" id="telephone" title="<?php echo Mage::helper('auguria_contact')->__('Telephone') ?>" value="" class="input-text required-entry" type="text" />
|
42 |
+
</div>
|
43 |
+
</li>
|
44 |
+
<li>
|
45 |
+
<?php
|
46 |
+
$subjects = $this->getSubjects();
|
47 |
+
if (count($subjects)>0):
|
48 |
+
?>
|
49 |
+
<label for="subject" class="required"><em>*</em><?php echo Mage::helper('auguria_contact')->__('Contact a service') ?></label>
|
50 |
+
<div class="input-box">
|
51 |
+
<select id="subject" name="subject" title="<?php echo Mage::helper('auguria_contact')->__('Contact a service') ?>" class="validate-select required-entry">
|
52 |
+
<option value=""><?php echo Mage::helper('auguria_contact')->__('Please select a subject'); ?></option>
|
53 |
+
<?php foreach ($subjects as $subject): ?>
|
54 |
+
<option value="<?php echo $subject['value']; ?>"><?php echo $this->htmlEscape($subject['label']); ?></option>
|
55 |
+
<?php endforeach; ?>
|
56 |
+
</select>
|
57 |
+
</div>
|
58 |
+
<?php
|
59 |
+
endif;
|
60 |
+
?>
|
61 |
+
</li>
|
62 |
+
<li class="wide">
|
63 |
+
<label for="comment" class="required"><em>*</em><?php echo Mage::helper('auguria_contact')->__('Comment') ?></label>
|
64 |
+
<div class="input-box">
|
65 |
+
<textarea name="comment" id="comment" title="<?php echo Mage::helper('auguria_contact')->__('Comment') ?>" class="required-entry input-text" cols="5" rows="3"></textarea>
|
66 |
+
</div>
|
67 |
+
</li>
|
68 |
+
</ul>
|
69 |
+
</div>
|
70 |
+
<div class="buttons-set">
|
71 |
+
<p class="required"><?php echo Mage::helper('auguria_contact')->__('* Required Fields') ?></p>
|
72 |
+
<input type="text" name="hideit" id="hideit" value="" style="display:none !important;" />
|
73 |
+
<button type="submit" title="<?php echo Mage::helper('auguria_contact')->__('Submit') ?>" class="button"><span><span><?php echo Mage::helper('auguria_contact')->__('Submit') ?></span></span></button>
|
74 |
+
</div>
|
75 |
+
</form>
|
76 |
+
<script type="text/javascript">
|
77 |
+
//<![CDATA[
|
78 |
+
var contactForm = new VarienForm('contactForm', true);
|
79 |
+
//]]>
|
80 |
+
</script>
|
app/etc/modules/Auguria_Contact.xml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Auguria
|
5 |
+
* @package Auguria_Contact
|
6 |
+
* @author Auguria
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
|
13 |
+
<Auguria_Contact>
|
14 |
+
<active>true</active>
|
15 |
+
<codePool>community</codePool>
|
16 |
+
<depends>
|
17 |
+
<Mage_Contacts/>
|
18 |
+
</depends>
|
19 |
+
</Auguria_Contact>
|
20 |
+
</modules>
|
21 |
+
</config>
|
app/locale/fr_FR/Auguria_Contact.csv
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"Contacts","Contacts"
|
2 |
+
"Add Contact","Ajouter un contact"
|
3 |
+
"An error occurred while mass deleting contacts. Please review log and try again.","Une erreur est survenue lors de la suppression en masse des contacts. Merci de regarder les logs et d'essayer ultérieurement."
|
4 |
+
"Are you sure you want to delete these contacts?","Êtes vous sure de vouloir supprimer ces contacts ?"
|
5 |
+
"Comment","Message"
|
6 |
+
"Contact a service","Contactez un service"
|
7 |
+
"Contact Information","Informations du contact"
|
8 |
+
"Default recipient","Destinataire par défaut"
|
9 |
+
"Delete","Supprimer"
|
10 |
+
"Delete Contact","Supprimer le contact"
|
11 |
+
"Edit Contact","Édition de contact"
|
12 |
+
"Edit Contact '%s'","Édition du contact '%s'"
|
13 |
+
"Email","Email"
|
14 |
+
"Email Subject","Sujet de l'email"
|
15 |
+
"Email Template","Gabarit du mail"
|
16 |
+
"Firstname","Prénom"
|
17 |
+
"Form contact","Formulaire de contact"
|
18 |
+
"Frontend Subject","Sujet proposé au client"
|
19 |
+
"General Information","Informations générales"
|
20 |
+
"ID","ID"
|
21 |
+
"Identifier","Identifiant"
|
22 |
+
"Lastname","Nom"
|
23 |
+
"Manage Contacts","Gérer les contacts"
|
24 |
+
"New Contact","Nouveau contact"
|
25 |
+
"Order Id","N° de commande"
|
26 |
+
"Please select a subject","Contactez un service"
|
27 |
+
"Please select contact(s).","Merci de sélectionner au moins un contact."
|
28 |
+
"Position","Position"
|
29 |
+
"Save Contact","Sauvegarder le contact"
|
30 |
+
"Store View","Vue magasin"
|
31 |
+
"Telephone","Téléphone"
|
32 |
+
"The contact has been deleted.","Le contact a bien été supprimé."
|
33 |
+
"The contact has been saved.","Le contact a bien été sauvegardé."
|
34 |
+
"This contact no longer exists.","Ce contact n'existe plus."
|
35 |
+
"Unable to find a contact to delete.","Impossible de trouver le contact à supprimer."
|
app/locale/fr_FR/template/email/auguria/contact/contact_form.html
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!--@subject {{var data.subject}} @-->
|
2 |
+
<!--@vars
|
3 |
+
{"var data.subject":"Sujet de l'email complet",
|
4 |
+
"var data.email_subject":"Sujet de l'email",
|
5 |
+
"var data.name":"Nom de l'expéditeur",
|
6 |
+
"var data.fistname":"Prénom de l'expéditeur",
|
7 |
+
"var data.lastname":"Nom de l'expéditeur",
|
8 |
+
"var data.order_id":"N° de commande",
|
9 |
+
"var data.email":"Email du destinataire",
|
10 |
+
"var data.telephone":"Téléphone de l'expéditeur",
|
11 |
+
"var data.comment":"Commentaire"}
|
12 |
+
@-->
|
13 |
+
Nom : {{var data.lastname}}<br/>
|
14 |
+
Prénom : {{var data.firstname}}<br/>
|
15 |
+
E-mail : {{var data.email}}<br/>
|
16 |
+
N° de tél. : {{var data.telephone}}<br/>
|
17 |
+
N° de commande : {{var data.order_id}}<br/>
|
18 |
+
Service demandé : {{var data.email_subject}}<br/>
|
19 |
+
Message :<br/><br/>
|
20 |
+
{{var data.comment}}<br/>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Auguria_Contact</name>
|
4 |
+
<version>0.1.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL 3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Auguria_Contact</summary>
|
10 |
+
<description>Auguria_Contact</description>
|
11 |
+
<notes>Auguria_Contact</notes>
|
12 |
+
<authors><author><name>Auguria</name><user>auto-converted</user><email>magento@auguria.net</email></author></authors>
|
13 |
+
<date>2012-06-21</date>
|
14 |
+
<time>12:54:57</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Auguria"><dir name="Contact"><dir name="Block"><dir name="Adminhtml"><dir name="Contact"><dir name="Edit"><file name="Form.php" hash="1a3d5b1be73131372a231a33c09ed290"/></dir><file name="Edit.php" hash="060625c35f166b4e8628d76fd5ccb9a7"/><file name="Grid.php" hash="ee47fd56146c4399c550c2fb906a3630"/></dir><file name="Contact.php" hash="c029ed9167b247d803f29b1c3b5c39b7"/></dir><file name="Contact.php" hash="0144e93aa3cffb26ba35513474e1e3fb"/></dir><dir name="Helper"><file name="Data.php" hash="a5cd8f07c377f4112ddec57fa8499766"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Contacts"><file name="Collection.php" hash="c1e5c55e203972d26396939eb71495f7"/></dir><file name="Contacts.php" hash="fd5a8a56a8ea943146a70036cee3add7"/></dir><file name="Contacts.php" hash="2f333901bf009e01e417b9878630096f"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="ContactController.php" hash="f63070544021fcbf3e6ff760a57f60b6"/></dir><dir name="Contacts"><file name="IndexController.php" hash="bc1fb3ab3ef0ee465d6537c5361004a0"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="2a63b9067f52e19a0fc4d9d0d6d37c89"/><file name="config.xml" hash="1b4b351c7216063e68e99a2e9a5d5329"/><file name="system.xml" hash="0d5223dbaf2998518a1cc9abe96e50bf"/></dir><dir name="sql"><dir name="auguria_contact_setup"><file name="mysql4-install-0.1.0.php" hash="f29bea819ee650ab21f8ccb137551016"/><file name="mysql4-upgrade-0.1.0-0.1.1.php" hash="d0db5259db4c025a043c00d8e7a3e5b8"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="auguria"><file name="contact.xml" hash="301ce88b9df87caa57bae4901c9e68ba"/></dir></dir><dir name="template"><dir name="auguria"><dir name="contact"><file name="form.phtml" hash="3a8434a623a41ccbc7cc5d0129e896ea"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="layout"><dir name="auguria"><file name="contact.xml" hash=""/></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="fr_FR"><dir name="template"><dir name="email"><dir name="auguria"><dir name="contact"><file name="contact_form.html" hash="ac51f977d86deaae18cbf1a7c4fa7526"/></dir></dir></dir></dir><file name="Auguria_Contact.csv" hash="da1180263c41e32d20826cf37bbd9034"/></dir></target><target name="mageetc"><dir name="modules"><file name="Auguria_Contact.xml" hash="000758c700f7bfc4ecddc7de2cf4da0b"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies/>
|
18 |
+
</package>
|