This repository has been archived by the owner on Aug 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from blopa/develop
Develop
- Loading branch information
Showing
10 changed files
with
294 additions
and
35 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
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 @@ | ||
<?php | ||
class Werules_Chatbot_Block_Enable extends Mage_Core_Block_Html_Select | ||
{ | ||
public function _toHtml() | ||
{ | ||
$options = Mage::getSingleton('chatbot/enable')->toOptionArray(); | ||
if (!$this->getOptions()) | ||
{ | ||
foreach ($options as $option) | ||
{ | ||
$this->addOption($option['value'], $option['label']); | ||
} | ||
} | ||
|
||
return parent::_toHtml(); | ||
} | ||
|
||
public function setInputName($value) | ||
{ | ||
return $this->setName($value); | ||
} | ||
} |
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,52 @@ | ||
<?php | ||
class Werules_Chatbot_Block_Replies extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract | ||
{ | ||
protected $_itemRenderer; | ||
|
||
public function _prepareToRender() | ||
{ | ||
$this->addColumn('catch_phrase', array( | ||
'label' => Mage::helper('core')->__('Phrase'), | ||
'style' => 'width: 250px' | ||
)); | ||
$this->addColumn('reply_phrase', array( | ||
'label' => Mage::helper('core')->__('Reply'), | ||
'style' => 'width: 250px' | ||
)); | ||
$this->addColumn('similarity', array( | ||
'label' => Mage::helper('core')->__('Similarity (%)'), | ||
'style' => 'width: 50px', | ||
//'type' => 'number', | ||
//'maxlength' => '3', | ||
'class' => 'input-number validate-number validate-number-range number-range-1-100' | ||
)); | ||
$this->addColumn('match_case', array( | ||
'label' => Mage::helper('core')->__('Match Case'), | ||
'renderer' => $this->_getRenderer() | ||
)); | ||
|
||
$this->_addAfter = false; | ||
$this->_addButtonLabel = Mage::helper('core')->__('Add'); | ||
} | ||
|
||
protected function _getRenderer() | ||
{ | ||
if (!$this->_itemRenderer) | ||
{ | ||
$this->_itemRenderer = $this->getLayout()->createBlock( | ||
'werules_chatbot/enable', | ||
'', | ||
array('is_render_to_js_template' => true) | ||
)->setExtraParams("style='width: auto;'"); | ||
} | ||
return $this->_itemRenderer; | ||
} | ||
|
||
protected function _prepareArrayRow(Varien_Object $row) | ||
{ | ||
$row->setData( | ||
'option_extra_attr_' . $this->_getRenderer()->calcOptionHash($row->getData('match_case')), | ||
'selected="selected"' | ||
); | ||
} | ||
} |
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
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
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
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
Oops, something went wrong.