<?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 $promoCode = '';

  public function render()
  {
	$promoCode = empty($_GET['promo']) ? '' : strtolower($_GET['promo']);
	$this->promoCode = $promoCode && !empty($this->siteDetails->promos[$promoCode]) ? $promoCode : '';

    // 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>' .
	  '<style>#headingContent{min-height:0 !IMPORTANT; margin-bottom:0 !IMPORTANT;}</style>'

    );
    $this->panes->onload->append('content', 
      "menu.init('mainMenu', ['Contact', 'Quotations']);\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/child_counting.png" alt="Child Counting" title="Child Counting" 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 request a quotation.</p>
                      <p>Alternatively you make like to <a href="/contact/booking" title="Book a consultation">Book a consultation</a> and meet with us.</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>
						'.($this->promoCode == 'qjy6dg' ? '<p style="color:green; margin-top:10px; font-weight:bold">10% DISCOUNT COUPON OFFER APPLIED!</p><p style="color:green; margin-bottom:10px; font-size:12px;">'.$this->siteDetails->promos[$this->promoCode].'</p>' : '').'
                        <!--p>
                          If you are requesting a quote for our standard services,
                           and we can provide your quotation or estimation given your submitted information,
                           then you will recieve your quote in reply,
                           otherwise will will recommend you
                           <a href="/booking" title="Book a consultation">Book a consultation</a> and meet with us.<br /><br />
                        </p-->
    ');
    $this->panes->main->append('template', $this->draughtPageRequest());
    $this->panes->main->append('content', '
                      </div>
    ');
    $this->panes->right->append('widget', 'BlockLinks');
    $this->panes->bottom->append('widget', 'Footer');

    $this->write();
  }
  
  private function setMetaDataByActionSwitch($action = '')
  {
    if ($action === 'send') {
      $this->title = 'Thankyou. Quote Pending';
      $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, ' .
                                            'quote, quotation, estimation, sent, thankyou, thank you';
    } else {
      $this->title = 'Request a Quotation';
      $this->siteDetails->metaDescription = $this->siteDetails->company . ' quote form. Please use the below form to request a quotation/estimation.';
      $this->siteDetails->metaKeywords    = $this->siteDetails->company . ', application developer, application, developer, app, software, Australia, AU, AUS, OZ, AUD, information technology, ' .
                                            'quote, quotation, estimation, 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());
}

?>
