first commit

This commit is contained in:
2025-03-12 17:06:23 +01:00
commit 2241f7131f
13185 changed files with 1692479 additions and 0 deletions

View File

@@ -0,0 +1,118 @@
<?php
/**
* SOTESHOP/appFacebookRemarketingPlugin
*
*
* @package appFacebookRemarketingPlugin
* @author Pawel Byszewski <pawel@apes-apps.com>
*/
class appFacebookRemarketingBackendActions extends stAdminGeneratorActions
{
public function initializeParameters()
{
$this->webRequest = new stWebRequest();
$this->config = stConfig::getInstance('appFacebookRemarketingBackend');
if ($this->config->get('code_fbremarketing', $this->getRequestParameter('fbremarketing[code_fbremarketing]'), true) == '') {
$notice = '<a href="https://pl-pl.facebook.com/ads/manager/pixel/custom_audience_pixel/" target="_blank">'.$this->getContext()->getI18n()->__('Utwórz piksel').'</a>'."&nbsp;".$this->getContext()->getI18n()->__(' w menedżerze reklam Facebook.');
$this->setFlash("info", $notice, false);
$this->configuration_check = true;
} else {
$this->configuration_check = false;
}
$i18n = $this->getContext()->getI18n();
$this->labels = array(
'fbremarketing{code_fbremarketing}' => $i18n->__('Podaj indentyfikator piksela Facebooka'),
);
}
public function executeIndex()
{
$this->initializeParameters();
$i18n = $this->getContext()->getI18N();
$this->config = stConfig::getInstance('appFacebookRemarketingBackend');
$this->config->setCulture($this->getRequestParameter('culture', stLanguage::getOptLanguage()));
if ($this->getRequest()->getMethod() == sfRequest::POST)
{
$this->config->set('enable_fbremarketing', $this->getRequestParameter('fbremarketing[enable_fbremarketing]'));
$this->config->set('content_id', $this->getRequestParameter('fbremarketing[content_id]'));
$this->config->set('code_fbremarketing', $this->getRequestParameter('fbremarketing[code_fbremarketing]'), true);
$this->config->set('product_card', $this->getRequestParameter('fbremarketing[product_card]'));
$this->config->set('cart', $this->getRequestParameter('fbremarketing[cart]'));
$this->config->set('basket', $this->getRequestParameter('fbremarketing[basket]'));
$this->config->set('order', $this->getRequestParameter('fbremarketing[order]'));
if ($this->config->get('enable_fbremarketing') && $this->config->get('code_fbremarketing', null, true))
{
stAppStats::activate('Piksel Facebooka');
}
else
{
stAppStats::deactivate('Piksel Facebooka');
}
$this->config->save();
stFastCacheManager::clearCache();
$this->setFlash('notice', $i18n->__('Twoje zmiany zostały zapisane', null, 'stAdminGeneratorPlugin'));
$this->redirect('appFacebookRemarketingBackend/index?culture=' . $this->getRequestParameter('culture', stLanguage::getOptLanguage()));
}
$this->config->load();
$this->getBreadcrumbs()->add($i18n->__('Konfiguracja', null, 'stAdminGeneratorPlugin'));
}
public function validateIndex()
{
if ($this->getRequest()->getMethod() == sfRequest::POST)
stAuthUsersListener::checkModificationCredentials($this, $this->getRequest(), $this->getModuleName());
return true;
}
public function handleErrorIndex()
{
$this->initializeParameters();
$i18n = $this->getContext()->getI18N();
$this->getBreadcrumbs()->add($i18n->__('Konfiguracja', null, 'stAdminGeneratorPlugin'));
return sfView::SUCCESS;
}
protected function getBreadcrumbs(){
if (null === $this->breadcrumbs){
$i18n = $this->getContext()->getI18N();
$this->breadcrumbs = parent::getBreadcrumbs();
$this->breadcrumbs->add($i18n->__('Piksel Facebooka'), '@appFacebookRemarketingPlugin');
}
return $this->breadcrumbs;
}
}

View File

@@ -0,0 +1,13 @@
<?php
class appFacebookRemarketingBackendComponents extends sfComponents
{
public function executeListMenu()
{
}
}
?>

View File

@@ -0,0 +1,17 @@
<div class="list-menu">
<ul>
<li class="selected">
<?php echo link_to(__('Konfiguracja'),'appFacebookRemarketingBackend/index')?>
</li>
<li>
<?php if (sfContext::getInstance()->getUser()->getCulture() == 'pl_PL'): ?>
<a href="https://www.sote.pl/docs/piksel-facebooka" target="_blank"><?php echo __('Dokumentacja'); ?></a>
<?php else : ?>
<a href="https://www.soteshop.com/docs/facebook_pixel" target="_blank"><?php echo __('Documentation'); ?></a>
<?php endif; ?>
</li>
</ul>
</div>
<div class="clr"></div>

View File

@@ -0,0 +1,74 @@
<?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date', 'VisualEffect', 'stAdminGenerator') ?>
<?php st_view_slot_start('application-menu') ?>
<?php st_include_component('appFacebookRemarketingBackend', 'listMenu') ?>
<?php st_view_slot_end() ?>
<?php echo st_get_admin_head(array('@appFacebookRemarketingBackend', __('Piksel Facebooka'), 'appFacebookRemarketingPlugin.svg'), __('Piksel Facebooka')) ?>
<?php st_include_partial('stAdminGenerator/message', array('labels' => $labels)); ?>
<?php echo form_tag('appFacebookRemarketingBackend/index?culture='.$config->getCulture(), array('id' => 'sf_admin_config_form', 'name' => 'sf_admin_config_form', 'class' => 'admin_form')) ?>
<fieldset>
<div class="content">
<div class="form-row">
<?php echo st_admin_get_form_field('fbremarketing[enable_fbremarketing]', __('Włącz'), true, 'checkbox_tag', array('checked' => $config->get('enable_fbremarketing'))); ?>
</div>
<div class="form-row">
<?php echo st_admin_get_form_field('fbremarketing[code_fbremarketing]', __('Identyfikator Piksela Facebooka'), $config->get('code_fbremarketing', null, true), 'input_tag', array('required' => true, 'autocomplete' => "off", 'help' => __('Identyfikator można znaleźć przy pikselu w panelu Facebook. Identyfikator występuje też w kodzie piksela. Jest to ciąg cyfr.'))) ?>
</div>
<div class="row">
<?php echo label_for('fbremarketing[content_id]', __('Identyfikacja produktu')) ?>
<div class="field">
<?php echo select_tag('fbremarketing[content_id]', options_for_select(array('product_code' => __('Po kodzie produktu'), 'product_id' => __('Po ID produktu')), $config->get('content_id')), array('help' => __('Warość pola: content_id'))); ?>
<br class="st_clear_all" />
</div>
</div>
</div>
</fieldset>
<fieldset>
<h2><?php echo __('Rejestrowanie zdarzeń');?></h2>
<div class="content">
<div class="form-row">
<?php echo st_admin_get_form_field('fbremarketing[product_card]', __('Wyświetlanie produktu'), true, 'checkbox_tag', array('checked' => $config->get('product_card'), 'help' =>__('Akcja: ViewContent'))); ?>
</div>
<div class="form-row">
<?php echo st_admin_get_form_field('fbremarketing[cart]', __('Dodanie do koszyka'), true, 'checkbox_tag', array('checked' => $config->get('cart'), 'help' =>__('Akcja: AddToCart'))); ?>
</div>
<div class="form-row">
<?php echo st_admin_get_form_field('fbremarketing[basket]', __('Rozpoczęcie realizacji zamówienia'), true, 'checkbox_tag', array('checked' => $config->get('basket'), 'help' =>__('Akcja: InitiateCheckout'))); ?>
</div>
<div class="form-row">
<?php echo st_admin_get_form_field('fbremarketing[order]', __('Rozpoczęcie realizacji zamówienia'), true, 'checkbox_tag', array('checked' => $config->get('order'), 'help' =>__('Akcja: Purchase'))); ?>
</div>
</div>
</fieldset>
<div id="config_actions">
<?php echo st_get_admin_actions_head() ?>
<?php echo st_get_admin_action('save', __('Zapisz', null, 'stAdminGeneratorPlugin'), null, array('name' => 'save')) ?>
<?php echo st_get_admin_actions_foot() ?>
</div>
</form>
<?php echo st_get_admin_foot() ?>
<script type="text/javascript">
jQuery(function($) {
$(document).ready(function() {
$('#config_actions').stickyBox();
fieldsetVisibility();
});
});
</script>

View File

@@ -0,0 +1,4 @@
fields:
fbremarketing{code_fbremarketing}:
required:
msg: Proszę uzupełnić pole.