<?php
// PHP Script: index.asp
// Description: *.com index page
// DATE: 26-11-2009
// AUTHOR: 'Eugene Kerner' <ekerner@ekerner.com>
// REVISION: 1.0

require_once('../config/SetEnv.php');
require_once('EKerner/WebApp/PostValidating.php');

class webpage extends EKerner_WebApp_PostValidating
{

  public function render()
  {
    // html meta data ...
    $this->setMetaDataByActionSwitch($_GET['action']);
    
    $this->panes->head->append('content',
      '<link rel="stylesheet" type="text/css" href="/css/accordion.css" />' . "\n    " .
      '<script type="text/javascript" src="/js/accordion.jq"></script>'

    );
    $this->panes->onload->append('content', 
      "menu.init('mainMenu', ['Contact', 'Feedback']);\n" . 
      $this->validator->getKeypressHandlerJq()
    );
    
    // page content ...
    $this->panes->banner->append('widget', 'ContactLinks');
    $this->panes->left->append('widget', 'GenreMenu');
    $this->panes->heading->append('content', '
                      <img class="floatRight headingImage" src="/images/content/ecstatic_man_with_laptop2.png" alt="Ecstatic man with laptop" title="Yipee!" style="cursor:help;" width="118px" height="100px" />
                      <h2><img src="/images/icons/letter_icon.png" alt="Letter Icon" width="25" height="25" />' . $this->title . '</h2>
                      <p>Please use the below form to send us your feedback, suggestions, and opinions.</p>
                      <p>If your contact requires a reply then we will do so ASAP.</p>
                      <p>Related information: 
                         <a href="http://www.acma.gov.au/WEB/STANDARD/pc=PC_310294" onclick="window.open(\'http://www.acma.gov.au/WEB/STANDARD/pc=PC_310294\'); return false;" title="SPAM is Illegal">Australian SPAM Law</a> | 
                         <a href="/terms" title="Terms &amp; Conditions">Our Terms &amp; Conditions</a></p>
                      <p class="alignRight"><a href="/contact">all contact meduim &raquo;</a></p>
    ');
    $this->panes->main->append('content', '
                      <div class="p">
                        <h4>Online Contact Form</h4>
                        <p>
                          Your opinion matters to us, we listen to our clients and endeavor to build our enterprise based on your wants and needs.<br />
                          Whether your ecstatic, irate, or simply have info to share, please use the below form to express yourself to us. <br /><br />
                        </p>
    ');
    $this->panes->main->append('template', $this->draughtPageRequest());
    $this->panes->main->append('content', '
                      </div>
    ');
    $this->panes->main->append('widget', 'ServiceSelector');
    $this->panes->right->append('widget', 'BlockLinks');
    $this->panes->bottom->append('widget', 'Footer');

    $this->write();
  }
  
  private function setMetaDataByActionSwitch($action = '')
  {
    if ($action === 'send') {
      $this->title = 'Thankyou for your Feedback';
      $this->siteDetails->metaDescription = $this->siteDetails->company . ' value your opinion and thank you greatly for your feedback.';
      $this->siteDetails->metaKeywords    = $this->siteDetails->company . ', application developer, application, developer, app, software, Australia, AU, AUS, OZ, AUD, information technology, ' .
                                            'feedback, suggestions, opinions, sent, thankyou, thank you';
    } else {
      $this->title = 'Send us Feedback';
      $this->siteDetails->metaDescription = $this->siteDetails->company . ' feedback form. Please use the below form to send us your feedback, suggestions, and opinions.';
      $this->siteDetails->metaKeywords    = $this->siteDetails->company . ', application developer, application, developer, app, software, Australia, AU, AUS, OZ, AUD, information technology, ' .
                                            'feedback, suggestions, opinions, send, ecstatic, irate';
    }
    $this->siteDetails->metaTitle       = $this->title . ' &middot; ' . $this->siteDetails->company . ' &middot; ' . $this->siteDetails->caption;
  }
    
  protected function formFieldsValid()
  {
    return ($_POST['comments'] && $_POST['fullName']);
  }
    
}


try {
  $webpage = new webpage();
  $webpage->render();
} catch (Exception $e) {
  die($e->getMessage());
}

?>
