Version Notes
Only tested with Magento 1.7
Download this release
Release Info
Developer | The Wishpond Team |
Extension | Wishpond_Social_Campaigns |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/local/Wishpond/SocialCampaigns/Block/Adminhtml/SocialCampaigns.php +49 -0
- app/code/local/Wishpond/SocialCampaigns/Block/Adminhtml/SocialCampaigns/Edit.php +45 -0
- app/code/local/Wishpond/SocialCampaigns/Block/Adminhtml/SocialCampaigns/Edit/Form.php +19 -0
- app/code/local/Wishpond/SocialCampaigns/Block/Adminhtml/SocialCampaigns/Edit/Tab/Form.php +58 -0
- app/code/local/Wishpond/SocialCampaigns/Block/Adminhtml/SocialCampaigns/Edit/Tabs.php +24 -0
- app/code/local/Wishpond/SocialCampaigns/Block/Adminhtml/SocialCampaigns/Grid.php +116 -0
- app/code/local/Wishpond/SocialCampaigns/Block/SocialCampaigns.php +16 -0
- app/code/local/Wishpond/SocialCampaigns/Helper/Data.php +6 -0
- app/code/local/Wishpond/SocialCampaigns/Model/Mysql4/SocialCampaigns.php +10 -0
- app/code/local/Wishpond/SocialCampaigns/Model/Mysql4/SocialCampaigns/Collection.php +10 -0
- app/code/local/Wishpond/SocialCampaigns/Model/SocialCampaigns.php +10 -0
- app/code/local/Wishpond/SocialCampaigns/Model/Status.php +15 -0
- app/code/local/Wishpond/SocialCampaigns/controllers/Adminhtml/SocialCampaignsController.php +214 -0
- app/code/local/Wishpond/SocialCampaigns/controllers/IndexController.php +47 -0
- app/code/local/Wishpond/SocialCampaigns/etc/config.xml +122 -0
- app/code/local/Wishpond/SocialCampaigns/sql/socialcampaigns_setup/mysql4-install-0.1.0.php +23 -0
- app/code/local/Wishpond/SocialCampaignsBad/Helper/Data.php +5 -0
- app/code/local/Wishpond/SocialCampaignsBad/controllers/SimpleController.php +20 -0
- app/code/local/Wishpond/SocialCampaignsBad/etc/adminhtml.xml +35 -0
- app/code/local/Wishpond/SocialCampaignsBad/etc/config.xml +33 -0
- app/design/adminhtml/default/default/layout/socialcampaigns.xml +8 -0
- app/etc/modules/Wishpond_SocialCampaigns.xml +17 -0
- package.xml +42 -0
app/code/local/Wishpond/SocialCampaigns/Block/Adminhtml/SocialCampaigns.php
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Wishpond_SocialCampaigns_Block_Adminhtml_SocialCampaigns extends Mage_Adminhtml_Block_Template
|
3 |
+
{
|
4 |
+
|
5 |
+
protected $_iframeURLBase = '';
|
6 |
+
protected $_iframeURLDomain = '';
|
7 |
+
|
8 |
+
public function __construct()
|
9 |
+
{
|
10 |
+
$this->_controller = 'adminhtml_socialcampaigns';
|
11 |
+
$this->_blockGroup = 'socialcampaigns';
|
12 |
+
$this->_iframeURLDomain = 'https://www.wishpond.com/';
|
13 |
+
$this->_iframeURLBase = $this->_iframeURLDomain . 'central/merchant_signups/new?type=campaigns&plain=true&referral=magento&autologin=true&utm_campaign=campaigns&utm_source=integration&utm_medium=magento';
|
14 |
+
$this->setTemplate('socialcampaigns/socialcampaigns.phtml');
|
15 |
+
// $this->_setActiveMenu('promo/socialcampaigns');
|
16 |
+
parent::__construct();
|
17 |
+
}
|
18 |
+
|
19 |
+
public function getIFrameURL()
|
20 |
+
{
|
21 |
+
// return $this->_iframeDomain;
|
22 |
+
$site_url = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
23 |
+
$params = array(
|
24 |
+
'email' => $this->getAdminEmail(),
|
25 |
+
'key' => urlencode(sha1(php_uname("n") . $site_url)), // Same as used in WordPress plugin
|
26 |
+
'redirect_to' => $this->getWPHomeURL()
|
27 |
+
);
|
28 |
+
|
29 |
+
return $this->_iframeURLBase . '&' . http_build_query($params);
|
30 |
+
}
|
31 |
+
|
32 |
+
public function getWPHomeURL()
|
33 |
+
{
|
34 |
+
return $this->_iframeURLDomain . 'central/social_campaigns';
|
35 |
+
}
|
36 |
+
|
37 |
+
protected function getUserObject()
|
38 |
+
{
|
39 |
+
$userId = Mage::getSingleton('admin/session')->getUser()->getId();
|
40 |
+
$user = Mage::getModel("admin/user")->load($userId);
|
41 |
+
return $user;
|
42 |
+
}
|
43 |
+
|
44 |
+
protected function getAdminEmail()
|
45 |
+
{
|
46 |
+
return $this->getUserObject()->getEmail();
|
47 |
+
}
|
48 |
+
|
49 |
+
}
|
app/code/local/Wishpond/SocialCampaigns/Block/Adminhtml/SocialCampaigns/Edit.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Wishpond_SocialCampaigns_Block_Adminhtml_SocialCampaigns_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
|
9 |
+
$this->_objectId = 'id';
|
10 |
+
$this->_blockGroup = 'socialcampaigns';
|
11 |
+
$this->_controller = 'adminhtml_socialcampaigns';
|
12 |
+
|
13 |
+
$this->_updateButton('save', 'label', Mage::helper('socialcampaigns')->__('Save Item'));
|
14 |
+
$this->_updateButton('delete', 'label', Mage::helper('socialcampaigns')->__('Delete Item'));
|
15 |
+
|
16 |
+
$this->_addButton('saveandcontinue', array(
|
17 |
+
'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
|
18 |
+
'onclick' => 'saveAndContinueEdit()',
|
19 |
+
'class' => 'save',
|
20 |
+
), -100);
|
21 |
+
|
22 |
+
$this->_formScripts[] = "
|
23 |
+
function toggleEditor() {
|
24 |
+
if (tinyMCE.getInstanceById('socialcampaigns_content') == null) {
|
25 |
+
tinyMCE.execCommand('mceAddControl', false, 'socialcampaigns_content');
|
26 |
+
} else {
|
27 |
+
tinyMCE.execCommand('mceRemoveControl', false, 'socialcampaigns_content');
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
function saveAndContinueEdit(){
|
32 |
+
editForm.submit($('edit_form').action+'back/edit/');
|
33 |
+
}
|
34 |
+
";
|
35 |
+
}
|
36 |
+
|
37 |
+
public function getHeaderText()
|
38 |
+
{
|
39 |
+
if( Mage::registry('socialcampaigns_data') && Mage::registry('socialcampaigns_data')->getId() ) {
|
40 |
+
return Mage::helper('socialcampaigns')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('socialcampaigns_data')->getTitle()));
|
41 |
+
} else {
|
42 |
+
return Mage::helper('socialcampaigns')->__('Add Item');
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
app/code/local/Wishpond/SocialCampaigns/Block/Adminhtml/SocialCampaigns/Edit/Form.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Wishpond_SocialCampaigns_Block_Adminhtml_SocialCampaigns_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
protected function _prepareForm()
|
6 |
+
{
|
7 |
+
$form = new Varien_Data_Form(array(
|
8 |
+
'id' => 'edit_form',
|
9 |
+
'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
|
10 |
+
'method' => 'post',
|
11 |
+
'enctype' => 'multipart/form-data'
|
12 |
+
)
|
13 |
+
);
|
14 |
+
|
15 |
+
$form->setUseContainer(true);
|
16 |
+
$this->setForm($form);
|
17 |
+
return parent::_prepareForm();
|
18 |
+
}
|
19 |
+
}
|
app/code/local/Wishpond/SocialCampaigns/Block/Adminhtml/SocialCampaigns/Edit/Tab/Form.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Wishpond_SocialCampaigns_Block_Adminhtml_SocialCampaigns_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
|
4 |
+
{
|
5 |
+
protected function _prepareForm()
|
6 |
+
{
|
7 |
+
$form = new Varien_Data_Form();
|
8 |
+
$this->setForm($form);
|
9 |
+
$fieldset = $form->addFieldset('socialcampaigns_form', array('legend'=>Mage::helper('socialcampaigns')->__('Item information')));
|
10 |
+
|
11 |
+
$fieldset->addField('title', 'text', array(
|
12 |
+
'label' => Mage::helper('socialcampaigns')->__('Title'),
|
13 |
+
'class' => 'required-entry',
|
14 |
+
'required' => true,
|
15 |
+
'name' => 'title',
|
16 |
+
));
|
17 |
+
|
18 |
+
$fieldset->addField('filename', 'file', array(
|
19 |
+
'label' => Mage::helper('socialcampaigns')->__('File'),
|
20 |
+
'required' => false,
|
21 |
+
'name' => 'filename',
|
22 |
+
));
|
23 |
+
|
24 |
+
$fieldset->addField('status', 'select', array(
|
25 |
+
'label' => Mage::helper('socialcampaigns')->__('Status'),
|
26 |
+
'name' => 'status',
|
27 |
+
'values' => array(
|
28 |
+
array(
|
29 |
+
'value' => 1,
|
30 |
+
'label' => Mage::helper('socialcampaigns')->__('Enabled'),
|
31 |
+
),
|
32 |
+
|
33 |
+
array(
|
34 |
+
'value' => 2,
|
35 |
+
'label' => Mage::helper('socialcampaigns')->__('Disabled'),
|
36 |
+
),
|
37 |
+
),
|
38 |
+
));
|
39 |
+
|
40 |
+
$fieldset->addField('content', 'editor', array(
|
41 |
+
'name' => 'content',
|
42 |
+
'label' => Mage::helper('socialcampaigns')->__('Content'),
|
43 |
+
'title' => Mage::helper('socialcampaigns')->__('Content'),
|
44 |
+
'style' => 'width:700px; height:500px;',
|
45 |
+
'wysiwyg' => false,
|
46 |
+
'required' => true,
|
47 |
+
));
|
48 |
+
|
49 |
+
if ( Mage::getSingleton('adminhtml/session')->getSocialCampaignsData() )
|
50 |
+
{
|
51 |
+
$form->setValues(Mage::getSingleton('adminhtml/session')->getSocialCampaignsData());
|
52 |
+
Mage::getSingleton('adminhtml/session')->setSocialCampaignsData(null);
|
53 |
+
} elseif ( Mage::registry('socialcampaigns_data') ) {
|
54 |
+
$form->setValues(Mage::registry('socialcampaigns_data')->getData());
|
55 |
+
}
|
56 |
+
return parent::_prepareForm();
|
57 |
+
}
|
58 |
+
}
|
app/code/local/Wishpond/SocialCampaigns/Block/Adminhtml/SocialCampaigns/Edit/Tabs.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Wishpond_SocialCampaigns_Block_Adminhtml_SocialCampaigns_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
|
4 |
+
{
|
5 |
+
|
6 |
+
public function __construct()
|
7 |
+
{
|
8 |
+
parent::__construct();
|
9 |
+
$this->setId('socialcampaigns_tabs');
|
10 |
+
$this->setDestElementId('edit_form');
|
11 |
+
$this->setTitle(Mage::helper('socialcampaigns')->__('Item Information'));
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _beforeToHtml()
|
15 |
+
{
|
16 |
+
$this->addTab('form_section', array(
|
17 |
+
'label' => Mage::helper('socialcampaigns')->__('Item Information'),
|
18 |
+
'title' => Mage::helper('socialcampaigns')->__('Item Information'),
|
19 |
+
'content' => $this->getLayout()->createBlock('socialcampaigns/adminhtml_socialcampaigns_edit_tab_form')->toHtml(),
|
20 |
+
));
|
21 |
+
|
22 |
+
return parent::_beforeToHtml();
|
23 |
+
}
|
24 |
+
}
|
app/code/local/Wishpond/SocialCampaigns/Block/Adminhtml/SocialCampaigns/Grid.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Wishpond_SocialCampaigns_Block_Adminhtml_SocialCampaigns_Grid extends Mage_Adminhtml_Block_Widget_Grid
|
4 |
+
{
|
5 |
+
public function __construct()
|
6 |
+
{
|
7 |
+
parent::__construct();
|
8 |
+
$this->setId('socialcampaignsGrid');
|
9 |
+
$this->setDefaultSort('socialcampaigns_id');
|
10 |
+
$this->setDefaultDir('ASC');
|
11 |
+
$this->setSaveParametersInSession(true);
|
12 |
+
}
|
13 |
+
|
14 |
+
protected function _prepareCollection()
|
15 |
+
{
|
16 |
+
$collection = Mage::getModel('socialcampaigns/socialcampaigns')->getCollection();
|
17 |
+
$this->setCollection($collection);
|
18 |
+
return parent::_prepareCollection();
|
19 |
+
}
|
20 |
+
|
21 |
+
protected function _prepareColumns()
|
22 |
+
{
|
23 |
+
$this->addColumn('socialcampaigns_id', array(
|
24 |
+
'header' => Mage::helper('socialcampaigns')->__('ID'),
|
25 |
+
'align' =>'right',
|
26 |
+
'width' => '50px',
|
27 |
+
'index' => 'socialcampaigns_id',
|
28 |
+
));
|
29 |
+
|
30 |
+
$this->addColumn('title', array(
|
31 |
+
'header' => Mage::helper('socialcampaigns')->__('Title'),
|
32 |
+
'align' =>'left',
|
33 |
+
'index' => 'title',
|
34 |
+
));
|
35 |
+
|
36 |
+
/*
|
37 |
+
$this->addColumn('content', array(
|
38 |
+
'header' => Mage::helper('socialcampaigns')->__('Item Content'),
|
39 |
+
'width' => '150px',
|
40 |
+
'index' => 'content',
|
41 |
+
));
|
42 |
+
*/
|
43 |
+
|
44 |
+
$this->addColumn('status', array(
|
45 |
+
'header' => Mage::helper('socialcampaigns')->__('Status'),
|
46 |
+
'align' => 'left',
|
47 |
+
'width' => '80px',
|
48 |
+
'index' => 'status',
|
49 |
+
'type' => 'options',
|
50 |
+
'options' => array(
|
51 |
+
1 => 'Enabled',
|
52 |
+
2 => 'Disabled',
|
53 |
+
),
|
54 |
+
));
|
55 |
+
|
56 |
+
$this->addColumn('action',
|
57 |
+
array(
|
58 |
+
'header' => Mage::helper('socialcampaigns')->__('Action'),
|
59 |
+
'width' => '100',
|
60 |
+
'type' => 'action',
|
61 |
+
'getter' => 'getId',
|
62 |
+
'actions' => array(
|
63 |
+
array(
|
64 |
+
'caption' => Mage::helper('socialcampaigns')->__('Edit'),
|
65 |
+
'url' => array('base'=> '*/*/edit'),
|
66 |
+
'field' => 'id'
|
67 |
+
)
|
68 |
+
),
|
69 |
+
'filter' => false,
|
70 |
+
'sortable' => false,
|
71 |
+
'index' => 'stores',
|
72 |
+
'is_system' => true,
|
73 |
+
));
|
74 |
+
|
75 |
+
$this->addExportType('*/*/exportCsv', Mage::helper('socialcampaigns')->__('CSV'));
|
76 |
+
$this->addExportType('*/*/exportXml', Mage::helper('socialcampaigns')->__('XML'));
|
77 |
+
|
78 |
+
return parent::_prepareColumns();
|
79 |
+
}
|
80 |
+
|
81 |
+
protected function _prepareMassaction()
|
82 |
+
{
|
83 |
+
$this->setMassactionIdField('socialcampaigns_id');
|
84 |
+
$this->getMassactionBlock()->setFormFieldName('socialcampaigns');
|
85 |
+
|
86 |
+
$this->getMassactionBlock()->addItem('delete', array(
|
87 |
+
'label' => Mage::helper('socialcampaigns')->__('Delete'),
|
88 |
+
'url' => $this->getUrl('*/*/massDelete'),
|
89 |
+
'confirm' => Mage::helper('socialcampaigns')->__('Are you sure?')
|
90 |
+
));
|
91 |
+
|
92 |
+
$statuses = Mage::getSingleton('socialcampaigns/status')->getOptionArray();
|
93 |
+
|
94 |
+
array_unshift($statuses, array('label'=>'', 'value'=>''));
|
95 |
+
$this->getMassactionBlock()->addItem('status', array(
|
96 |
+
'label'=> Mage::helper('socialcampaigns')->__('Change status'),
|
97 |
+
'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
|
98 |
+
'additional' => array(
|
99 |
+
'visibility' => array(
|
100 |
+
'name' => 'status',
|
101 |
+
'type' => 'select',
|
102 |
+
'class' => 'required-entry',
|
103 |
+
'label' => Mage::helper('socialcampaigns')->__('Status'),
|
104 |
+
'values' => $statuses
|
105 |
+
)
|
106 |
+
)
|
107 |
+
));
|
108 |
+
return $this;
|
109 |
+
}
|
110 |
+
|
111 |
+
public function getRowUrl($row)
|
112 |
+
{
|
113 |
+
return $this->getUrl('*/*/edit', array('id' => $row->getId()));
|
114 |
+
}
|
115 |
+
|
116 |
+
}
|
app/code/local/Wishpond/SocialCampaigns/Block/SocialCampaigns.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Wishpond_SocialCampaigns_Block_SocialCampaigns extends Mage_Core_Block_Template {
|
3 |
+
public function _prepareLayout()
|
4 |
+
{
|
5 |
+
return parent::_prepareLayout();
|
6 |
+
}
|
7 |
+
|
8 |
+
public function getSocialCampaigns()
|
9 |
+
{
|
10 |
+
if (!$this -> hasData('socialcampaigns')) {
|
11 |
+
$this -> setData('socialcampaigns', Mage::registry('socialcampaigns'));
|
12 |
+
}
|
13 |
+
return $this -> getData('socialcampaigns');
|
14 |
+
}
|
15 |
+
|
16 |
+
}
|
app/code/local/Wishpond/SocialCampaigns/Helper/Data.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Wishpond_SocialCampaigns_Helper_Data extends Mage_Core_Helper_Abstract
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/local/Wishpond/SocialCampaigns/Model/Mysql4/SocialCampaigns.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Wishpond_SocialCampaigns_Model_Mysql4_SocialCampaigns extends Mage_Core_Model_Mysql4_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
// Note that the socialcampaigns_id refers to the key field in your database table.
|
8 |
+
$this->_init('socialcampaigns/socialcampaigns', 'socialcampaigns_id');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Wishpond/SocialCampaigns/Model/Mysql4/SocialCampaigns/Collection.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Wishpond_SocialCampaigns_Model_Mysql4_SocialCampaigns_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('socialcampaigns/socialcampaigns');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Wishpond/SocialCampaigns/Model/SocialCampaigns.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Wishpond_SocialCampaigns_Model_SocialCampaigns extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('socialcampaigns/socialcampaigns');
|
9 |
+
}
|
10 |
+
}
|
app/code/local/Wishpond/SocialCampaigns/Model/Status.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Wishpond_SocialCampaigns_Model_Status extends Varien_Object
|
4 |
+
{
|
5 |
+
const STATUS_ENABLED = 1;
|
6 |
+
const STATUS_DISABLED = 2;
|
7 |
+
|
8 |
+
static public function getOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
self::STATUS_ENABLED => Mage::helper('socialcampaigns')->__('Enabled'),
|
12 |
+
self::STATUS_DISABLED => Mage::helper('socialcampaigns')->__('Disabled')
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
app/code/local/Wishpond/SocialCampaigns/controllers/Adminhtml/SocialCampaignsController.php
ADDED
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Wishpond_SocialCampaigns_Adminhtml_SocialCampaignsController extends Mage_Adminhtml_Controller_action
|
4 |
+
{
|
5 |
+
|
6 |
+
protected function _initAction() {
|
7 |
+
$this->loadLayout()
|
8 |
+
->_setActiveMenu('socialcampaigns/items')
|
9 |
+
->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
10 |
+
|
11 |
+
return $this;
|
12 |
+
}
|
13 |
+
|
14 |
+
public function indexAction() {
|
15 |
+
$this->_initAction()
|
16 |
+
->renderLayout();
|
17 |
+
}
|
18 |
+
|
19 |
+
public function editAction() {
|
20 |
+
$id = $this->getRequest()->getParam('id');
|
21 |
+
$model = Mage::getModel('socialcampaigns/socialcampaigns')->load($id);
|
22 |
+
|
23 |
+
if ($model->getId() || $id == 0) {
|
24 |
+
$data = Mage::getSingleton('adminhtml/session')->getFormData(true);
|
25 |
+
if (!empty($data)) {
|
26 |
+
$model->setData($data);
|
27 |
+
}
|
28 |
+
|
29 |
+
Mage::register('socialcampaigns_data', $model);
|
30 |
+
|
31 |
+
$this->loadLayout();
|
32 |
+
$this->_setActiveMenu('socialcampaigns/items');
|
33 |
+
|
34 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
|
35 |
+
$this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
|
36 |
+
|
37 |
+
$this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
|
38 |
+
|
39 |
+
$this->_addContent($this->getLayout()->createBlock('socialcampaigns/adminhtml_socialcampaigns_edit'))
|
40 |
+
->_addLeft($this->getLayout()->createBlock('socialcampaigns/adminhtml_socialcampaigns_edit_tabs'));
|
41 |
+
|
42 |
+
$this->renderLayout();
|
43 |
+
} else {
|
44 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('socialcampaigns')->__('Item does not exist'));
|
45 |
+
$this->_redirect('*/*/');
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
public function newAction() {
|
50 |
+
$this->_forward('edit');
|
51 |
+
}
|
52 |
+
|
53 |
+
public function saveAction() {
|
54 |
+
if ($data = $this->getRequest()->getPost()) {
|
55 |
+
|
56 |
+
if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
|
57 |
+
try {
|
58 |
+
/* Starting upload */
|
59 |
+
$uploader = new Varien_File_Uploader('filename');
|
60 |
+
|
61 |
+
// Any extention would work
|
62 |
+
$uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
|
63 |
+
$uploader->setAllowRenameFiles(false);
|
64 |
+
|
65 |
+
// Set the file upload mode
|
66 |
+
// false -> get the file directly in the specified folder
|
67 |
+
// true -> get the file in the product like folders
|
68 |
+
// (file.jpg will go in something like /media/f/i/file.jpg)
|
69 |
+
$uploader->setFilesDispersion(false);
|
70 |
+
|
71 |
+
// We set media as the upload dir
|
72 |
+
$path = Mage::getBaseDir('media') . DS ;
|
73 |
+
$uploader->save($path, $_FILES['filename']['name'] );
|
74 |
+
|
75 |
+
} catch (Exception $e) {
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
//this way the name is saved in DB
|
80 |
+
$data['filename'] = $_FILES['filename']['name'];
|
81 |
+
}
|
82 |
+
|
83 |
+
|
84 |
+
$model = Mage::getModel('socialcampaigns/socialcampaigns');
|
85 |
+
$model->setData($data)
|
86 |
+
->setId($this->getRequest()->getParam('id'));
|
87 |
+
|
88 |
+
try {
|
89 |
+
if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
|
90 |
+
$model->setCreatedTime(now())
|
91 |
+
->setUpdateTime(now());
|
92 |
+
} else {
|
93 |
+
$model->setUpdateTime(now());
|
94 |
+
}
|
95 |
+
|
96 |
+
$model->save();
|
97 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('socialcampaigns')->__('Item was successfully saved'));
|
98 |
+
Mage::getSingleton('adminhtml/session')->setFormData(false);
|
99 |
+
|
100 |
+
if ($this->getRequest()->getParam('back')) {
|
101 |
+
$this->_redirect('*/*/edit', array('id' => $model->getId()));
|
102 |
+
return;
|
103 |
+
}
|
104 |
+
$this->_redirect('*/*/');
|
105 |
+
return;
|
106 |
+
} catch (Exception $e) {
|
107 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
108 |
+
Mage::getSingleton('adminhtml/session')->setFormData($data);
|
109 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
110 |
+
return;
|
111 |
+
}
|
112 |
+
}
|
113 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('socialcampaigns')->__('Unable to find item to save'));
|
114 |
+
$this->_redirect('*/*/');
|
115 |
+
}
|
116 |
+
|
117 |
+
public function deleteAction() {
|
118 |
+
if( $this->getRequest()->getParam('id') > 0 ) {
|
119 |
+
try {
|
120 |
+
$model = Mage::getModel('socialcampaigns/socialcampaigns');
|
121 |
+
|
122 |
+
$model->setId($this->getRequest()->getParam('id'))
|
123 |
+
->delete();
|
124 |
+
|
125 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
|
126 |
+
$this->_redirect('*/*/');
|
127 |
+
} catch (Exception $e) {
|
128 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
129 |
+
$this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
|
130 |
+
}
|
131 |
+
}
|
132 |
+
$this->_redirect('*/*/');
|
133 |
+
}
|
134 |
+
|
135 |
+
public function massDeleteAction() {
|
136 |
+
$socialcampaignsIds = $this->getRequest()->getParam('socialcampaigns');
|
137 |
+
if(!is_array($socialcampaignsIds)) {
|
138 |
+
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
|
139 |
+
} else {
|
140 |
+
try {
|
141 |
+
foreach ($socialcampaignsIds as $socialcampaignsId) {
|
142 |
+
$socialcampaigns = Mage::getModel('socialcampaigns/socialcampaigns')->load($socialcampaignsId);
|
143 |
+
$socialcampaigns->delete();
|
144 |
+
}
|
145 |
+
Mage::getSingleton('adminhtml/session')->addSuccess(
|
146 |
+
Mage::helper('adminhtml')->__(
|
147 |
+
'Total of %d record(s) were successfully deleted', count($socialcampaignsIds)
|
148 |
+
)
|
149 |
+
);
|
150 |
+
} catch (Exception $e) {
|
151 |
+
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
152 |
+
}
|
153 |
+
}
|
154 |
+
$this->_redirect('*/*/index');
|
155 |
+
}
|
156 |
+
|
157 |
+
public function massStatusAction()
|
158 |
+
{
|
159 |
+
$socialcampaignsIds = $this->getRequest()->getParam('socialcampaigns');
|
160 |
+
if(!is_array($socialcampaignsIds)) {
|
161 |
+
Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
|
162 |
+
} else {
|
163 |
+
try {
|
164 |
+
foreach ($socialcampaignsIds as $socialcampaignsId) {
|
165 |
+
$socialcampaigns = Mage::getSingleton('socialcampaigns/socialcampaigns')
|
166 |
+
->load($socialcampaignsId)
|
167 |
+
->setStatus($this->getRequest()->getParam('status'))
|
168 |
+
->setIsMassupdate(true)
|
169 |
+
->save();
|
170 |
+
}
|
171 |
+
$this->_getSession()->addSuccess(
|
172 |
+
$this->__('Total of %d record(s) were successfully updated', count($socialcampaignsIds))
|
173 |
+
);
|
174 |
+
} catch (Exception $e) {
|
175 |
+
$this->_getSession()->addError($e->getMessage());
|
176 |
+
}
|
177 |
+
}
|
178 |
+
$this->_redirect('*/*/index');
|
179 |
+
}
|
180 |
+
|
181 |
+
public function exportCsvAction()
|
182 |
+
{
|
183 |
+
$fileName = 'socialcampaigns.csv';
|
184 |
+
$content = $this->getLayout()->createBlock('socialcampaigns/adminhtml_socialcampaigns_grid')
|
185 |
+
->getCsv();
|
186 |
+
|
187 |
+
$this->_sendUploadResponse($fileName, $content);
|
188 |
+
}
|
189 |
+
|
190 |
+
public function exportXmlAction()
|
191 |
+
{
|
192 |
+
$fileName = 'socialcampaigns.xml';
|
193 |
+
$content = $this->getLayout()->createBlock('socialcampaigns/adminhtml_socialcampaigns_grid')
|
194 |
+
->getXml();
|
195 |
+
|
196 |
+
$this->_sendUploadResponse($fileName, $content);
|
197 |
+
}
|
198 |
+
|
199 |
+
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
|
200 |
+
{
|
201 |
+
$response = $this->getResponse();
|
202 |
+
$response->setHeader('HTTP/1.1 200 OK','');
|
203 |
+
$response->setHeader('Pragma', 'public', true);
|
204 |
+
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
|
205 |
+
$response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
|
206 |
+
$response->setHeader('Last-Modified', date('r'));
|
207 |
+
$response->setHeader('Accept-Ranges', 'bytes');
|
208 |
+
$response->setHeader('Content-Length', strlen($content));
|
209 |
+
$response->setHeader('Content-type', $contentType);
|
210 |
+
$response->setBody($content);
|
211 |
+
$response->sendResponse();
|
212 |
+
die;
|
213 |
+
}
|
214 |
+
}
|
app/code/local/Wishpond/SocialCampaigns/controllers/IndexController.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Wishpond_SocialCampaigns_IndexController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
|
7 |
+
/*
|
8 |
+
* Load an object by id
|
9 |
+
* Request looking like:
|
10 |
+
* http://site.com/socialcampaigns?id=15
|
11 |
+
* or
|
12 |
+
* http://site.com/socialcampaigns/id/15
|
13 |
+
*/
|
14 |
+
/*
|
15 |
+
$socialcampaigns_id = $this->getRequest()->getParam('id');
|
16 |
+
|
17 |
+
if($socialcampaigns_id != null && $socialcampaigns_id != '') {
|
18 |
+
$socialcampaigns = Mage::getModel('socialcampaigns/socialcampaigns')->load($socialcampaigns_id)->getData();
|
19 |
+
} else {
|
20 |
+
$socialcampaigns = null;
|
21 |
+
}
|
22 |
+
*/
|
23 |
+
|
24 |
+
/*
|
25 |
+
* If no param we load a the last created item
|
26 |
+
*/
|
27 |
+
/*
|
28 |
+
if($socialcampaigns == null) {
|
29 |
+
$resource = Mage::getSingleton('core/resource');
|
30 |
+
$read= $resource->getConnection('core_read');
|
31 |
+
$socialcampaignsTable = $resource->getTableName('socialcampaigns');
|
32 |
+
|
33 |
+
$select = $read->select()
|
34 |
+
->from($socialcampaignsTable,array('socialcampaigns_id','title','content','status'))
|
35 |
+
->where('status',1)
|
36 |
+
->order('created_time DESC') ;
|
37 |
+
|
38 |
+
$socialcampaigns = $read->fetchRow($select);
|
39 |
+
}
|
40 |
+
Mage::register('socialcampaigns', $socialcampaigns);
|
41 |
+
*/
|
42 |
+
|
43 |
+
|
44 |
+
$this->loadLayout();
|
45 |
+
$this->renderLayout();
|
46 |
+
}
|
47 |
+
}
|
app/code/local/Wishpond/SocialCampaigns/etc/config.xml
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Wishpond
|
5 |
+
* @package Wishpond_SocialCampaigns
|
6 |
+
* @author ModuleCreator
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<Wishpond_SocialCampaigns>
|
13 |
+
<version>0.1.0</version>
|
14 |
+
</Wishpond_SocialCampaigns>
|
15 |
+
</modules>
|
16 |
+
<frontend>
|
17 |
+
<routers>
|
18 |
+
<socialcampaigns>
|
19 |
+
<use>standard</use>
|
20 |
+
<args>
|
21 |
+
<module>Wishpond_SocialCampaigns</module>
|
22 |
+
<frontName>socialcampaigns</frontName>
|
23 |
+
</args>
|
24 |
+
</socialcampaigns>
|
25 |
+
</routers>
|
26 |
+
<layout>
|
27 |
+
<updates>
|
28 |
+
<socialcampaigns>
|
29 |
+
<file>socialcampaigns.xml</file>
|
30 |
+
</socialcampaigns>
|
31 |
+
</updates>
|
32 |
+
</layout>
|
33 |
+
</frontend>
|
34 |
+
<admin>
|
35 |
+
<routers>
|
36 |
+
<socialcampaigns>
|
37 |
+
<use>admin</use>
|
38 |
+
<args>
|
39 |
+
<module>Wishpond_SocialCampaigns</module>
|
40 |
+
<frontName>socialcampaigns</frontName>
|
41 |
+
</args>
|
42 |
+
</socialcampaigns>
|
43 |
+
</routers>
|
44 |
+
</admin>
|
45 |
+
<adminhtml>
|
46 |
+
<menu>
|
47 |
+
<socialcampaigns module="socialcampaigns">
|
48 |
+
<title>Wishpond Social Campaigns</title>
|
49 |
+
<sort_order>100</sort_order>
|
50 |
+
<action>socialcampaigns/adminhtml_socialcampaigns</action>
|
51 |
+
</socialcampaigns>
|
52 |
+
</menu>
|
53 |
+
<acl>
|
54 |
+
<resources>
|
55 |
+
<all>
|
56 |
+
<title>Allow Everything</title>
|
57 |
+
</all>
|
58 |
+
<admin>
|
59 |
+
<children>
|
60 |
+
<Wishpond_SocialCampaigns>
|
61 |
+
<title>SocialCampaigns Module</title>
|
62 |
+
<sort_order>10</sort_order>
|
63 |
+
</Wishpond_SocialCampaigns>
|
64 |
+
</children>
|
65 |
+
</admin>
|
66 |
+
</resources>
|
67 |
+
</acl>
|
68 |
+
<layout>
|
69 |
+
<updates>
|
70 |
+
<socialcampaigns>
|
71 |
+
<file>socialcampaigns.xml</file>
|
72 |
+
</socialcampaigns>
|
73 |
+
</updates>
|
74 |
+
</layout>
|
75 |
+
</adminhtml>
|
76 |
+
<global>
|
77 |
+
<models>
|
78 |
+
<socialcampaigns>
|
79 |
+
<class>Wishpond_SocialCampaigns_Model</class>
|
80 |
+
<resourceModel>socialcampaigns_mysql4</resourceModel>
|
81 |
+
</socialcampaigns>
|
82 |
+
<socialcampaigns_mysql4>
|
83 |
+
<class>Wishpond_SocialCampaigns_Model_Mysql4</class>
|
84 |
+
<entities>
|
85 |
+
<socialcampaigns>
|
86 |
+
<table>socialcampaigns</table>
|
87 |
+
</socialcampaigns>
|
88 |
+
</entities>
|
89 |
+
</socialcampaigns_mysql4>
|
90 |
+
</models>
|
91 |
+
<resources>
|
92 |
+
<socialcampaigns_setup>
|
93 |
+
<setup>
|
94 |
+
<module>Wishpond_SocialCampaigns</module>
|
95 |
+
</setup>
|
96 |
+
<connection>
|
97 |
+
<use>core_setup</use>
|
98 |
+
</connection>
|
99 |
+
</socialcampaigns_setup>
|
100 |
+
<socialcampaigns_write>
|
101 |
+
<connection>
|
102 |
+
<use>core_write</use>
|
103 |
+
</connection>
|
104 |
+
</socialcampaigns_write>
|
105 |
+
<socialcampaigns_read>
|
106 |
+
<connection>
|
107 |
+
<use>core_read</use>
|
108 |
+
</connection>
|
109 |
+
</socialcampaigns_read>
|
110 |
+
</resources>
|
111 |
+
<blocks>
|
112 |
+
<socialcampaigns>
|
113 |
+
<class>Wishpond_SocialCampaigns_Block</class>
|
114 |
+
</socialcampaigns>
|
115 |
+
</blocks>
|
116 |
+
<helpers>
|
117 |
+
<socialcampaigns>
|
118 |
+
<class>Wishpond_SocialCampaigns_Helper</class>
|
119 |
+
</socialcampaigns>
|
120 |
+
</helpers>
|
121 |
+
</global>
|
122 |
+
</config>
|
app/code/local/Wishpond/SocialCampaigns/sql/socialcampaigns_setup/mysql4-install-0.1.0.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$installer->run("
|
8 |
+
|
9 |
+
-- DROP TABLE IF EXISTS {$this->getTable('socialcampaigns')};
|
10 |
+
CREATE TABLE {$this->getTable('socialcampaigns')} (
|
11 |
+
`socialcampaigns_id` int(11) unsigned NOT NULL auto_increment,
|
12 |
+
`title` varchar(255) NOT NULL default '',
|
13 |
+
`filename` varchar(255) NOT NULL default '',
|
14 |
+
`content` text NOT NULL default '',
|
15 |
+
`status` smallint(6) NOT NULL default '0',
|
16 |
+
`created_time` datetime NULL,
|
17 |
+
`update_time` datetime NULL,
|
18 |
+
PRIMARY KEY (`socialcampaigns_id`)
|
19 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
20 |
+
|
21 |
+
");
|
22 |
+
|
23 |
+
$installer->endSetup();
|
app/code/local/Wishpond/SocialCampaignsBad/Helper/Data.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Wishpond_SocialCampaignsBad_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
|
5 |
+
}
|
app/code/local/Wishpond/SocialCampaignsBad/controllers/SimpleController.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Wishpond_SocialCampainsBad_SimpleController extends Mage_Adminhtml_Controller_Action
|
4 |
+
{
|
5 |
+
|
6 |
+
public function indexAction()
|
7 |
+
{
|
8 |
+
// "Fetch" display
|
9 |
+
$this->loadLayout();
|
10 |
+
|
11 |
+
// "Inject" into display
|
12 |
+
// The below example will not actualy show anything since the core/template is empty
|
13 |
+
$this->_addContent($this->getLayout()->createBlock('core/template'));
|
14 |
+
|
15 |
+
// echo "Hello developer...";
|
16 |
+
|
17 |
+
// "Output" display
|
18 |
+
$this->renderLayout();
|
19 |
+
}
|
20 |
+
}
|
app/code/local/Wishpond/SocialCampaignsBad/etc/adminhtml.xml
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<admin>
|
6 |
+
<children>
|
7 |
+
<promo>
|
8 |
+
<children>
|
9 |
+
<socialcampaignsbad translate="title" module="SocialCampaignsBad">
|
10 |
+
<title>Social Campaigns Bad</title>
|
11 |
+
<sort_order>100</sort_order>
|
12 |
+
</socialcampaignsbad>
|
13 |
+
</children>
|
14 |
+
</promo>
|
15 |
+
</children>
|
16 |
+
</admin>
|
17 |
+
</resources>
|
18 |
+
</acl>
|
19 |
+
<menu>
|
20 |
+
<promo>
|
21 |
+
<children>
|
22 |
+
<socialcampaignsbad translate="title" module="SocialCampaignsBad">
|
23 |
+
<title>
|
24 |
+
Social Campaigns Bad
|
25 |
+
</title>
|
26 |
+
<sort_order>-1000</sort_order>
|
27 |
+
<!-- Without an action tag, this menu item will do nothing -->
|
28 |
+
<!--action>adminhtml/promo_socialcampaignsbad</action-->
|
29 |
+
<!--depends><module>Wishpond_SocialCampaignsBad</module></depends-->
|
30 |
+
<disabled>true</disabled>
|
31 |
+
</socialcampaignsbad>
|
32 |
+
</children>
|
33 |
+
</promo>
|
34 |
+
</menu>
|
35 |
+
</config>
|
app/code/local/Wishpond/SocialCampaignsBad/etc/config.xml
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
|
5 |
+
<modules>
|
6 |
+
<Wishpond_SocialCampaignsBad>
|
7 |
+
<version>0.1.0</version>
|
8 |
+
</Wishpond_SocialCampaignsBad>
|
9 |
+
</modules>
|
10 |
+
|
11 |
+
|
12 |
+
<global>
|
13 |
+
<helpers>
|
14 |
+
<SocialCampaignsBad>
|
15 |
+
<class>Wishpond_SocialCampaignsBad_Helper</class>
|
16 |
+
</SocialCampaignsBad>
|
17 |
+
</helpers>
|
18 |
+
</global>
|
19 |
+
|
20 |
+
|
21 |
+
<admin>
|
22 |
+
<routers>
|
23 |
+
<socialcampaignsbad>
|
24 |
+
<use>admin</use>
|
25 |
+
<args>
|
26 |
+
<module>Wishpond_SocialCampaignsBad</module>
|
27 |
+
<frontName>socialcampaignsbad</frontName>
|
28 |
+
</args>
|
29 |
+
</socialcampaignsbad>
|
30 |
+
</routers>
|
31 |
+
</admin>
|
32 |
+
|
33 |
+
</config>
|
app/design/adminhtml/default/default/layout/socialcampaigns.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
<socialcampaigns_adminhtml_socialcampaigns_index>
|
4 |
+
<reference name="content">
|
5 |
+
<block type="socialcampaigns/adminhtml_socialcampaigns" name="socialcampaigns" />
|
6 |
+
</reference>
|
7 |
+
</socialcampaigns_adminhtml_socialcampaigns_index>
|
8 |
+
</layout>
|
app/etc/modules/Wishpond_SocialCampaigns.xml
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category Wishpond
|
5 |
+
* @package Wishpond_SocialCampaigns
|
6 |
+
* @author ModuleCreator
|
7 |
+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<Wishpond_SocialCampaigns>
|
13 |
+
<active>true</active>
|
14 |
+
<codePool>local</codePool>
|
15 |
+
</Wishpond_SocialCampaigns>
|
16 |
+
</modules>
|
17 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Wishpond_Social_Campaigns</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>Need a License</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Easily gather new Customer Intelligence - and new customers - by running Sweepstakes and Offers on your Magento Store and Facebook Page. Free 30-day trial.</summary>
|
10 |
+
<description>Social Offers
|
11 |
+
1. Create a store-wide or item discount Offer using Magento discount codes
|
12 |
+
2. Run the Offer on your Magento Store and/or Facebook Page
|
13 |
+
3. Customers enter, and a post is made to their Facebook Profile - which is distributed to the News Feed of their entire social network
|
14 |
+
4. Entrants purchase immediately via PayPal or on your Magento Store
|
15 |
+

|
16 |
+
Social Sweepstakes
|
17 |
+
1. Run a Sweepstakes on your Magento Store and/or Facebook Page that gives away a free item or gift card
|
18 |
+
2. Customers enter and share to their Facebook Profile and friend's News Feeds
|
19 |
+

|
20 |
+
Customer Intelligence
|
21 |
+
* Collect email addresses for each entrant in your campaigns
|
22 |
+
* View a breakdown of the Age, Gender, Location and Facebook Likes for the entrants of each campaign
|
23 |
+

|
24 |
+
MailChimp Integration
|
25 |
+
* Schedule an email for each campaign to a MailChimp list in your Wishpond admin
|
26 |
+
* Auto-Export entrant emails directly to MailChimp
|
27 |
+

|
28 |
+
Try Social Campaigns free for 30 days.
|
29 |
+

|
30 |
+

|
31 |
+
For more details:
|
32 |
+

|
33 |
+
http://corp.wishpond.com/social-offers/features/
|
34 |
+
http://corp.wishpond.com/social-sweepstakes/features/</description>
|
35 |
+
<notes>Only tested with Magento 1.7</notes>
|
36 |
+
<authors><author><name>The Wishpond Team</name><user>Wishpond</user><email>nick@wishpond.com</email></author></authors>
|
37 |
+
<date>2012-08-13</date>
|
38 |
+
<time>20:58:48</time>
|
39 |
+
<contents><target name="magelocal"><dir name="Wishpond"><dir name="SocialCampaigns"><dir name="Block"><dir name="Adminhtml"><dir name="SocialCampaigns"><dir name="Edit"><file name="Form.php" hash="62a368b0f5f8f8cd12c3e42edceed6f8"/><dir name="Tab"><file name="Form.php" hash="36a18dfa8436834486570e4f598cc55c"/></dir><file name="Tabs.php" hash="ef22233895abd3b551fc953c299a080e"/></dir><file name="Edit.php" hash="c3285963af346216508f9ae64b3fdf7d"/><file name="Grid.php" hash="da38397c78adab6832fafb8d41c50cd5"/></dir><file name="SocialCampaigns.php" hash="9df31edf92367365428569106ab455bc"/></dir><file name="SocialCampaigns.php" hash="573b7714f0439a04bd6eb609c3c4c09e"/></dir><dir name="Helper"><file name="Data.php" hash="560ddb219079431890450335f90155d5"/></dir><dir name="Model"><dir name="Mysql4"><dir name="SocialCampaigns"><file name="Collection.php" hash="d1cd63894ad249baf80ddaf7d36d054e"/></dir><file name="SocialCampaigns.php" hash="37c3b7c32a9f8cd3556ac726e29da239"/></dir><file name="SocialCampaigns.php" hash="0f67a946caa0061068eeeba34210620d"/><file name="Status.php" hash="28691545b6afb9ad65f0e4e77fefd3ab"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="SocialCampaignsController.php" hash="1d04aa47b68006d2d2c5fe1352866b91"/></dir><file name="IndexController.php" hash="feaf2ab4521396763f228cadcefbd057"/></dir><dir name="etc"><file name="config.xml" hash="dd7cabf4b76ba5612431a0efffbda308"/></dir><dir name="sql"><dir name="socialcampaigns_setup"><file name="mysql4-install-0.1.0.php" hash="2f0f3ab1b4df6b1b93ed02a2ada828a0"/></dir></dir></dir><dir name="SocialCampaignsBad"><dir name="Helper"><file name="Data.php" hash="661a6feee02ac07fd481deba04f19db5"/></dir><dir name="controllers"><file name="SimpleController.php" hash="1bc906267a9a076d8268715f85d37c22"/></dir><dir name="etc"><file name="adminhtml.xml" hash="f29b348e5729d44f8131c4aca926e0bc"/><file name="config.xml" hash="d132fb20d5b0551cacabdcbf70d23be2"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="socialcampaigns.xml" hash="0e571de8198e04f1b08aefd2674ad682"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Wishpond_SocialCampaigns.xml" hash="922ddd16deb7be4525ca0d987f6b237d"/></dir></target></contents>
|
40 |
+
<compatible/>
|
41 |
+
<dependencies><required><php><min>5.3.0</min><max>5.3.14</max></php></required></dependencies>
|
42 |
+
</package>
|