<?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_Mail extends Engine_Form
{

  public function init()
  {

    $settings = Engine_Api::_()->getApi('settings', 'core');
    $this->loadDefaultDecorators();
    $this->getDecorator('Description')->setOption('escape', false);

    $this
      ->setTitle('Reply to Entry')
      ->setDescription("Using this form below, you can reply to user who has contacted you through the form.");

    $this->addElement(
      'Text',
      'from_address',
      array(
        'label' => 'From:',
        'value' => $settings->getSetting('core.mail.from', 'admin@' . $_SERVER['HTTP_HOST']),
        'disable' => true,
        'validators' => array(
          'EmailAddress',
        )
      )
    );

    $this->addElement(
      'Text',
      'from_name',
      array(
        'label' => 'From (name):',
        'disable' => true,
        'value' => $settings->getSetting('core.mail.name', 'Site Admin'),
      )
    );

    $this->addElement(
      'Text',
      'subject',
      array(
        'label' => 'Subject:',
        'required' => true,
        'allowEmpty' => false,
      )
    );

    //UPLOAD PHOTO URL
    $editorOptions = array(
      'uploadUrl' => Zend_Controller_Front::getInstance()->getRouter()->assemble(array('module' => 'core', 'controller' => 'index', 'action' => 'upload-photo'), 'default', true),
    );

    $this->addElement(
      'TinyMce',
      'body',
      array(
        'label' => 'body',
        'description' => "Please enter reply message.",
        'required' => true,
        'allowEmpty' => false,
        'editorOptions' => $editorOptions,
      )
    );

    $this->addElement(
      'Checkbox',
      'note',
      array(
        'label' => 'Add this reply to the Note.',
        'description' => "",
      )
    );


    $this->addElement(
      'Button',
      'execute',
      array(
        'label' => 'Reply',
        'ignore' => true,
        'decorators' => array('ViewHelper'),
        'type' => 'submit'
      )
    );

    $this->addElement(
      'Cancel',
      'cancel',
      array(
        'prependText' => ' or ',
        'label' => 'cancel',
        'link' => true,
        'href' => '',
        'onclick' => 'javascript:parent.Smoothbox.close();',
        'decorators' => array(
          'ViewHelper'
        ),
      )
    );

    $this->addDisplayGroup(
      array(
        'execute',
        'cancel'
      ),
      'buttons'
    );
  }

}
