Files
2025-03-12 17:06:23 +01:00

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')."&nbsp;".$this->getContext()->getI18n()->__('krótki przewodnik uruchomienia płatności CashBill.')."&nbsp;".'<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>'."&nbsp;".$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;
}
}