65 lines
2.4 KiB
PHP
65 lines
2.4 KiB
PHP
<?php
|
|
|
|
class stCashBillBackendActions extends stActions {
|
|
|
|
public function initializeParameters() {
|
|
|
|
$this->webRequest = new stWebRequest();
|
|
$this->config = stConfig::getInstance('stCashBillBackend');
|
|
|
|
if ($this->config->get('shop_id', $this->getRequestParameter('config[shop_id]'), true) != '' && $this->config->get('secret_key', $this->getRequestParameter('config[secret_key]'), true) != '')
|
|
{
|
|
|
|
$this->configuration_check = true;
|
|
|
|
} else {
|
|
|
|
$this->configuration_check = false;
|
|
|
|
}
|
|
|
|
$i18n = $this->getContext()->getI18n();
|
|
$this->labels = array(
|
|
'config{shop_id}' => $i18n->__('Identyfikator'),
|
|
'config{secret_key}' => $i18n->__('Klucz'),
|
|
);
|
|
}
|
|
|
|
public function executeIndex() {
|
|
$this->initializeParameters();
|
|
if ($this->getRequest()->getMethod() == sfRequest::POST) {
|
|
$this->config->setFromRequest('config');
|
|
$this->config->save();
|
|
|
|
$this->setFlash('notice', $this->getContext()->getI18n()->__('Twoje zmiany zostały zapisane', null, 'stAdminGeneratorPlugin'));
|
|
}
|
|
|
|
if ($this->config->get('shop_id', $this->getRequestParameter('config[shop_id]'), true) != '' && $this->config->get('secret_key', $this->getRequestParameter('config[secret_key]'), true) != '')
|
|
{
|
|
|
|
$this->configuration_check = true;
|
|
|
|
} else {
|
|
|
|
$notice = $this->getContext()->getI18n()->__('Zobacz')." ".$this->getContext()->getI18n()->__('krótki przewodnik uruchomienia płatności CashBill.')." ".'<a href="http://www.cashbill.pl/download/integracje/Platnosci/PlatnosciCashBillSOTE.pdf" target="_blank">'.$this->getContext()->getI18n()->__('krótki przewodnik uruchomienia płatności CashBill.').'</a>'." ".$this->getContext()->getI18n()->__('Sprawdź promocyjne warunki dla klientów SOTE.');
|
|
|
|
|
|
$this->setFlash("info", $notice, false);
|
|
|
|
$this->configuration_check = false;
|
|
|
|
}
|
|
}
|
|
|
|
public function validateIndex() {
|
|
if ($this->getRequest()->getMethod() == sfRequest::POST)
|
|
stAuthUsersListener::checkModificationCredentials($this, $this->getRequest(), $this->getModuleName());
|
|
return true;
|
|
}
|
|
|
|
public function handleErrorIndex() {
|
|
$this->initializeParameters();
|
|
return sfView::SUCCESS;
|
|
}
|
|
}
|