This repository has been archived by the owner on Oct 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4053e5f
Showing
251 changed files
with
24,096 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# VladimirPopov WebForms Pro | ||
|
||
**Extension for Magento 1** | ||
|
||
--- | ||
|
||
## Overview | ||
|
||
In this repository, we only added modman and composer support for the extension. | ||
|
||
For more information about the extension itself, please visit | ||
http://mageme.com/magento-extensions/magento-2-custom-form-builder-designer-webforms-professional-edition.html. | ||
|
||
## Requirements and setup | ||
|
||
This extension can be installed using [Composer](https://getcomposer.org/doc/01-basic-usage.md). | ||
|
||
## Support | ||
|
||
_Please note that we are not the developer of this extension. In this repository, we only added modman and composer | ||
support. We will not provide any support for this repository. If you have any problems on integration, please use the | ||
official link provided above._ |
16 changes: 16 additions & 0 deletions
16
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Customer/Tab/Renderer/Subject.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
class VladimirPopov_WebForms_Block_Adminhtml_Customer_Tab_Renderer_Subject | ||
extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract | ||
{ | ||
public function render(Varien_Object $row){ | ||
$subject = $row->getEmailSubject(); | ||
$title = str_replace("'","\'",$subject); | ||
return <<<HTML | ||
<a href="javascript:Admin_JsWebFormsResultModal('{$title}','{$this->getPopupUrl($row)}')">{$subject}</a> | ||
HTML; | ||
} | ||
|
||
public function getPopupUrl(Varien_Object $row){ | ||
return $this->getUrl('adminhtml/webforms_results/popup',array('id'=>$row->getId(),'customer_id'=>Mage::registry('current_customer')->getId())); | ||
} | ||
} |
144 changes: 144 additions & 0 deletions
144
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Customer/Tab/Results.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
<?php | ||
|
||
class VladimirPopov_WebForms_Block_Adminhtml_Customer_Tab_Results | ||
extends Mage_Adminhtml_Block_Widget_Grid | ||
{ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
$this->setId('customer_tab_results'); | ||
$this->setDefaultSort('created_time'); | ||
$this->setDefaultDir('desc'); | ||
$this->setUseAjax(true); | ||
$this->setAfter('tags'); | ||
$this->setEmptyText(Mage::helper('webforms')->__('No Results Found')); | ||
|
||
} | ||
|
||
protected function _prepareCollection() | ||
{ | ||
$collection = Mage::getModel('webforms/results')->getCollection() | ||
->addFilter('customer_id', $this->getRequest()->getParam('id')) | ||
->setLoadValues(true); | ||
$this->setCollection($collection); | ||
return parent::_prepareCollection(); | ||
} | ||
|
||
public function getGridUrl() | ||
{ | ||
return $this->getUrl('*/webforms_customer/results', array('id' => $this->getRequest()->getParam('id'))); | ||
} | ||
|
||
public function decorateStatus($value, $row, $column, $isExport) | ||
{ | ||
$class = ''; | ||
|
||
switch ($row->getApproved()) { | ||
case VladimirPopov_WebForms_Model_Results::STATUS_PENDING: | ||
$class = 'grid-severity-minor'; | ||
break; | ||
case VladimirPopov_WebForms_Model_Results::STATUS_APPROVED: | ||
$class = 'grid-severity-notice'; | ||
break; | ||
case VladimirPopov_WebForms_Model_Results::STATUS_NOTAPPROVED: | ||
$class = 'grid-severity-critical'; | ||
break; | ||
} | ||
|
||
$cell = '<span class="' . $class . '"><span>' . $value . '</span></span>'; | ||
return $cell; | ||
} | ||
|
||
protected function _prepareColumns() | ||
{ | ||
$renderer = 'VladimirPopov_WebForms_Block_Adminhtml_Results_Renderer_Id'; | ||
if ($this->_isExport) { | ||
$renderer = false; | ||
} | ||
$this->addColumn('id', array( | ||
'header' => Mage::helper('webforms')->__('ID'), | ||
'align' => 'right', | ||
'width' => '50px', | ||
'index' => 'id', | ||
'renderer' => $renderer | ||
)); | ||
|
||
$this->addcolumn('form', array( | ||
'header' => Mage::helper('webforms')->__('Web-form'), | ||
'index' => 'webform_id', | ||
'type' => 'options', | ||
'options' => Mage::getModel('webforms/webforms')->getGridOptions(), | ||
)); | ||
|
||
$this->addColumn('subject', array( | ||
'header' => Mage::helper('webforms')->__('Subject'), | ||
'filter' => false, | ||
'renderer' => 'VladimirPopov_WebForms_Block_Adminhtml_Customer_Tab_Renderer_Subject' | ||
)); | ||
|
||
$this->addColumn('approved', array( | ||
'header' => Mage::helper('webforms')->__('Approved'), | ||
'index' => 'approved', | ||
'type' => 'options', | ||
'width' => '140', | ||
'options' => Mage::getModel('webforms/results')->getApprovalStatuses(), | ||
'frame_callback' => array($this, 'decorateStatus') | ||
)); | ||
|
||
$this->addColumn('created_time', array( | ||
'header' => Mage::helper('webforms')->__('Date Created'), | ||
'index' => 'created_time', | ||
'type' => 'datetime', | ||
'width' => '200' | ||
)); | ||
|
||
return parent::_prepareColumns(); | ||
} | ||
|
||
protected function _prepareMassaction() | ||
{ | ||
$this->setMassactionIdField('id'); | ||
$this->getMassactionBlock()->setFormFieldName('id'); | ||
|
||
$this->getMassactionBlock()->addItem('delete', array( | ||
'label' => Mage::helper('webforms')->__('Delete'), | ||
'url' => $this->getUrl('*/webforms_results/massDelete', array('customer_id' => $this->getRequest()->getParam('id'))), | ||
'confirm' => Mage::helper('webforms')->__('Are you sure to delete selected results?'), | ||
)); | ||
|
||
$this->getMassactionBlock()->addItem('email', array( | ||
'label' => Mage::helper('webforms')->__('Send by e-mail'), | ||
'url' => $this->getUrl('*/webforms_results/massEmail', array('customer_id' => $this->getRequest()->getParam('id'))), | ||
'confirm' => Mage::helper('webforms')->__('Send selected results to specified e-mail address?'), | ||
'additional' => array( | ||
'recipient' => array( | ||
'name' => 'recipient_email', | ||
'type' => 'text', | ||
'label' => Mage::helper('webforms')->__('Recipient e-mail'), | ||
'value' => $this->getRecipientEmail(), | ||
) | ||
) | ||
)); | ||
|
||
$this->getMassactionBlock()->addItem('status', array( | ||
'label' => Mage::helper('webforms')->__('Update status'), | ||
'url' => $this->getUrl('*/webforms_results/massStatus', array('customer_id' => $this->getRequest()->getParam('id'))), | ||
'additional' => array( | ||
'status' => array( | ||
'name' => 'status', | ||
'type' => 'select', | ||
'class' => 'required-entry', | ||
'label' => Mage::helper('webforms')->__('Status'), | ||
'values' => Mage::getModel('webforms/results')->getApprovalStatuses() | ||
) | ||
) | ||
)); | ||
|
||
return $this; | ||
} | ||
|
||
public function getRecipientEmail() | ||
{ | ||
return Mage::app()->getWebsite(Mage::registry('current_customer')->getWebsiteId())->getConfig('webforms/email/email'); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Element/Checkboxes.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
class VladimirPopov_WebForms_Block_Adminhtml_Element_Checkboxes | ||
extends Varien_Data_Form_Element_Checkboxes | ||
{ | ||
public function getElementHtml() | ||
{ | ||
if($this->getRequired()){ | ||
$html = "<script>$$('#{$this->getHtmlId()}_container input').last().setAttribute('class','validate-one-required-by-name')</script>"; | ||
$this->setAfterElementHtml($html); | ||
} | ||
|
||
return parent::getElementHtml(); | ||
} | ||
|
||
// override default option id | ||
protected function _optionToHtml($option) | ||
{ | ||
$id = $this->getHtmlId().'_'.Mage::helper('webforms')->randomAlphaNum(); | ||
|
||
$html = '<li><input id="'.$id.'"'; | ||
foreach ($this->getHtmlAttributes() as $attribute) { | ||
if ($value = $this->getDataUsingMethod($attribute, $option['value'])) { | ||
$html .= ' '.$attribute.'="'.$value.'"'; | ||
} | ||
} | ||
$html .= ' value="'.$option['value'].'" />' | ||
. ' <label for="'.$id.'">' . $option['label'] . '</label></li>' | ||
. "\n"; | ||
return $html; | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Element/Customer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
class VladimirPopov_WebForms_Block_Adminhtml_Element_Customer extends Varien_Data_Form_Element_Abstract | ||
{ | ||
/** | ||
* @return string | ||
*/ | ||
public function getElementHtml() | ||
{ | ||
$config = array( | ||
'value' => $this->getValue(), | ||
'template' => 'webforms/result/customer.phtml' | ||
); | ||
$html = Mage::app()->getLayout()->createBlock('core/template', $this->getName(), $config)->toHtml(); | ||
$html .= $this->getAfterElementHtml(); | ||
|
||
return $html; | ||
} | ||
|
||
} |
71 changes: 71 additions & 0 deletions
71
app/code/community/VladimirPopov/WebForms/Block/Adminhtml/Element/Field.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
class VladimirPopov_WebForms_Block_Adminhtml_Element_Field | ||
extends Mage_Adminhtml_Block_Widget_Form_Renderer_Fieldset_Element | ||
{ | ||
|
||
protected function _construct() | ||
{ | ||
$this->setTemplate('webforms/form/renderer/fieldset/element.phtml'); | ||
} | ||
|
||
public function getDataObject() | ||
{ | ||
return $this->getElement()->getForm()->getDataObject(); | ||
} | ||
|
||
public function usedDefault() | ||
{ | ||
if(Mage::app()->getRequest()->getParam('store')){ | ||
$data = $this->getDataObject(); | ||
if($data){ | ||
$store_data = $data->getStoreData(); | ||
$id =$this->getElement()->getId(); | ||
if(is_array($store_data) && array_key_exists($id,$store_data)) | ||
return false; | ||
} | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
public function canDisplayUseDefault(){ | ||
if(Mage::app()->getRequest()->getParam('store')){ | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
public function checkFieldDisable() | ||
{ | ||
if ($this->canDisplayUseDefault() && $this->usedDefault()) { | ||
$this->getElement()->setDisabled(true); | ||
} | ||
return $this; | ||
} | ||
|
||
public function getScopeLabel() | ||
{ | ||
if(!Mage::app()->isSingleStoreMode()) | ||
return '[STORE VIEW]'; | ||
} | ||
|
||
/** | ||
* Retrieve element label html | ||
* | ||
* @return string | ||
*/ | ||
public function getElementLabelHtml() | ||
{ | ||
return $this->getElement()->getLabelHtml(); | ||
} | ||
|
||
/** | ||
* Retrieve element html | ||
* | ||
* @return string | ||
*/ | ||
public function getElementHtml() | ||
{ | ||
return $this->getElement()->getElementHtml(); | ||
} | ||
} |
Oops, something went wrong.