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

class Inspira_Form_Admin_Settings_Footer extends Engine_Form {

  public function init() {

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

    $this->setTitle('Manage Footer Settings')
            ->setDescription('You can configure the features for the footer of your website via the settings below.');

    $view = Zend_Registry::isRegistered('Zend_View') ? Zend_Registry::get('Zend_View') : null;

    //New File System Code
    $banner_options = array('' => '');
    $files = Engine_Api::_()->getDbTable('files', 'core')->getFiles(array('fetchAll' => 1, 'extension' => array('gif', 'jpg', 'jpeg', 'png', 'webp', 'svg')));
    foreach( $files as $file ) {
      $banner_options[$file->storage_path] = $file->name;
    }
    $view = Zend_Registry::isRegistered('Zend_View') ? Zend_Registry::get('Zend_View') : null;
    $fileLink = $view->baseUrl() . '/admin/files/';
    
    
    $this->addElement('Select', 'inspira_footer_logo', array(
        'label' => 'Footer Logo',
        'description' => 'Choose from below the footer logo for your website. [Note: You can add a new logo from the "File & Media Manager" section from here: <a href="' . $fileLink . '" target="_blank">File & Media Manager</a>.]',
        'multiOptions' => $banner_options,
        'escape' => false,
        'value' =>  $settings->getSetting('inspira.footer.logo'),
    ));
    $this->inspira_footer_logo->addDecorator('Description', array('placement' => Zend_Form_Decorator_Abstract::PREPEND, 'escape' => false));
    
    $this->addElement('Select', 'inspira_footer_background_image', array(
        'label' => 'Footer Background Image',
        'description' => 'Choose from below the footer background image for your website. [Note: You can add a new photo from the "File & Media Manager" section from here: <a href="' . $fileLink . '" target="_blank">File & Media Manager</a>.]',
        'multiOptions' => $banner_options,
        'escape' => false,
        'value' =>  $settings->getSetting('inspira.footer.background.image'),
    ));
    $this->inspira_footer_background_image->addDecorator('Description', array('placement' => Zend_Form_Decorator_Abstract::PREPEND, 'escape' => false));

    $fileLink = $view->baseUrl() . '/admin/menus/index/name/inspira_quicklinks_footer';
    $this->addElement('Radio',
      'inspira_quicklinksenable',
      array(
        'label' => 'Enable Quick Links',
        'description' => 'Do you want to enable quick links to your preferred links in the footer? If you choose Yes, the the menu items will display which have been configured from <a href="' . $fileLink . '" target="_blank">Click Here</a>.',
        'multiOptions' => array('1'=>'Yes','0'=>'No'),
        'value'=> $settings->getSetting('inspira.quicklinksenable', '1'),
    ));
    $this->inspira_quicklinksenable->addDecorator('Description', array('placement' => Zend_Form_Decorator_Abstract::PREPEND, 'escape' => false));


    $this->addElement('Radio',
      'inspira_helpenable',
      array(
          'label' => 'Enable Footer Menu Links',
          'description' => 'Do you want to enable the SocialEngine default <a href="admin/menus?name=core_footer" target="_blank">Footer Menu links in the footer</a>?',
          'multiOptions' => array('1'=>'Yes','0'=>'No'),
          'value'=>$settings->getSetting('inspira.helpenable', '1'),
    ));
    $this->inspira_helpenable->addDecorator('Description', array('placement' => Zend_Form_Decorator_Abstract::PREPEND, 'escape' => false));

    $this->addElement('Textarea', "inspira_leftcolhdingdes", array(
        'label' => 'Left Column Description',
        'description' => "Enter the left column description.",
        'value' => $settings->getSetting('inspira.leftcolhdingdes', 'Inspire creativity, community, and awareness! SocialEngine PHP - the best choice for community social networking software.'),
    ));
    $this->addElement('Text', "inspira_leftcolhdinglocation", array(
        'label' => 'Left Column Location',
        'description' => "Enter the left column location.",
        'value' => $settings->getSetting('inspira.leftcolhdinglocation', 'Los Angeles, USA'),
    ));
    $this->addElement('Text', "inspira_leftcolhdingemail", array(
        'label' => 'Left Column Email',
        'description' => "Enter the left column email.",
        'value' => $settings->getSetting('inspira.leftcolhdingemail', 'info@abc.com'),
    ));
    $this->addElement('Text', "inspira_leftcolhdingphone", array(
        'label' => 'Left Column Phone',
        'description' => "Enter the left column phone.",
        'value' => $settings->getSetting('inspira.leftcolhdingphone', '+91-1234567890'),
    ));

    $this->addElement('Text', "inspira_rightcolhdingtext", array(
        'label' => 'Right Column Heading Text',
        'description' => "Enter the right column heading text.",
        'value' => $settings->getSetting('inspira.rightcolhdingtext', 'WHY JOIN US?'),
    ));

    $this->addElement('Textarea', "inspira_rightcolhdingdes", array(
        'label' => 'Right Column Description',
        'description' => "Enter the right column description.",
        'value' => $settings->getSetting('inspira.rightcolhdingdes', 'We are a secure community with 5000+ active members who help you with your queries, post new updates and grow your network.'),
    ));

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