<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/

class Gdpr_Form_Admin_Cookie extends Engine_Form
{

  public function init()
  {

    $settings = Engine_Api::_()->getApi('settings', 'core');

    $this->setTitle('Cookies Consent Settings')
      ->setDescription('Here, you can configure the settings for the Cookie consents. You can enter the text for the cookie contest banner, choose colors for it. You can also choose the options to be displayed in the banner with the placement and design.');

    $this->addElement('Textarea', 'gdpr_bannertext', array(
      'label' => 'Cookie Consent Banner Text',
      'description' => 'Enter the text for the Cookie banner content in the box below.',
      'required' => true,
      'allowEmpty' => false,
      'value' => $settings->getSetting('gdpr_bannertext', 'We use cookies to personalise site content, social media features and to analyse our traffic. We also share information about your use of this site with our advertising and social media partners.'),
    )
    );

    $this->addElement('Select', 'gdpr_bannerstyle', array(
      'label' => 'Banner Design Template',
      'description' => 'Choose the banner template from the designs below.',
      'required' => true,
      'allowEmpty' => false,
      'multiOptions' => array(
        'top_center' => 'Banner in Top Center',
        'bottom_center' => 'Banner in Bottom Center',
        'left' => 'Left Banner',
        'right' => 'Right Banner',
      ),
      'value' => $settings->getSetting('gdpr_bannerstyle', 'top_center'),
    )
    );


    $this->addElement('MultiCheckbox', 'gdpr_banneroption', array(
      'label' => 'Banner Options',
      'description' => 'Choose the options to be shown in the cookie banner.',
      'required' => true,
      'allowEmpty' => false,
      'multiOptions' => array('changeSettings' => 'Change Settings', 'readMore' => 'Read More', 'accept' => 'Accept'),
      'value' => json_decode($settings->getSetting('gdpr_banneroption', '["changeSettings","readMore","accept"]')),
    )
    );

    $this->addElement('Text', 'gdpr_bannerbackgroundcolor', array(
      'label' => 'Background Color',
      'class' => 'SEcolor',
      'required' => true,
      'allowEmpty' => false,
      'description' => 'Choose the background color of the banner.',
      'value' => $settings->getSetting('gdpr_bannerbackgroundcolor', '#fff'),
    )
    );

    $this->addElement('Text', 'gdpr_bannertextcolor', array(
      'label' => 'Banner Text Color',
      'class' => 'SEcolor',
      'required' => true,
      'allowEmpty' => false,
      'description' => 'Choose the text color of the banner.',
      'value' => $settings->getSetting('gdpr_bannertextcolor', '#555'),
    )
    );

    $this->addElement('Text', 'gdpr_bannerlinkcolor', array(
      'label' => 'Banner Link Color',
      'class' => 'SEcolor',
      'required' => true,
      'allowEmpty' => false,
      'description' => 'Choose the link color of the banner.',
      'value' => $settings->getSetting('gdpr_bannerlinkcolor', '#3960bb'),
    )
    );

    $this->addElement('Text', 'gdpr_privacyurl', array(
      'label' => 'Privacy Policy Page URL',
      'required' => true,
      'allowEmpty' => false,
      'description' => 'Enter the URL of the privacy Policy Page of your website.',
      'value' => $settings->getSetting('gdpr_privacyurl', 'help/privacy'),
    )
    );

    // Add submit button
    $this->addElement('Button', 'submit', array(
      'label' => 'Save Changes',
      'type' => 'submit',
      'ignore' => true
    )
    );
  }

}
