Skip to content

Instantly share code, notes, and snippets.

@chrisjimallen
Created February 18, 2013 08:02
Show Gist options
  • Save chrisjimallen/4975783 to your computer and use it in GitHub Desktop.
Save chrisjimallen/4975783 to your computer and use it in GitHub Desktop.
<?php
class LandingPagesController extends AppController {
var $uses = array();
var $name = 'LandingPages';
var $helpers = array('Html', 'Form');
var $layout = 'landingpage';
/**
* intellinav
*
*/
function beforeFilter() {
parent::beforeFilter();
if((!isset($this->request->params['requested'])) && (!$this->request->is('ajax'))){//if its a normal page request and not requestaction or ajax
$this->Session->write('home',$this->request->here);
if(!$this->Session->check("lpnav")){
$this->Session->write('lpnav',true);
}
}
}
//Sitepal
function worldPhoneBuy() {
$ourIP = $this->Tracking->checkIP( env('REMOTE_ADDR') );
//perform check to clear session if country is not worldphone capable
if($country = $this->Session->read('tariff.countryname')){
//check country is capable
$hasWorldPhone = ClassRegistry::init('Country')->hasWorldPhone($country);
if(!$hasWorldPhone){
$this->Session->destroy();
}
}
$compatibility = $this->Session->read('tariff.message');
$classicLink = '<span class="spanlink showgreen">Classic</span>';
$deluxeLink = '<span class="spanlink showpurple">Deluxe</span>';
$androidLink = '<span class="spanlink showblue">Android</span>';
$message['budgetList'] = implode(", ",ClassRegistry::init('Country')->getCountries('budget'));
$message['classicList'] = implode(", ",ClassRegistry::init('Country')->getCountries('classic'));
$css_classes = 'clearfix message subtitle pbottom';
switch($compatibility){
case 'budget':
$message['classic'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'</p>'; //<p class="warning message mbottom">You will need a <span class="spanlink showgreen">Classic</span> or <span class="spanlink showpurple">Deluxe</span> phone for Chile</p>';
$message['budget'] = '<p class="'.$css_classes.' red">You will need a '.$classicLink.', '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
$message['deluxe'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'</p>';
$message['android'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'<p>';
$message['common'] = '<p class="'.$css_classes.' red bold">You will need a '.$classicLink.', '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
break;
case 'deluxe':
$message['classic'] = '<p class="'.$css_classes.' red">You will need a '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
$message['budget'] = '<p class="'.$css_classes.' red">You will need a '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
$message['deluxe'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'<p>';
$message['android'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'<p>';
$message['common'] = '<p class="'.$css_classes.' red bold">You will need a '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
break;
default:
$message['classic'] = '<p class="'.$css_classes.' green">All of our phones will work in '.$country.'</p>';
$message['budget'] = '<p class="'.$css_classes.' green">All of our phones will work in '.$country.'</p>';
$message['deluxe'] = '<p class="'.$css_classes.' green">All of our phones will work in '.$country.'</p>';
$message['android'] = '<p class="'.$css_classes.' green">All of our phones will work in '.$country.'</p>';
$message['common'] = '<p class="'.$css_classes.' green bold">All of our phones will work in '.$country.'</p>';
}
$datarate = $this->Session->read('tariff.datarate');
$message['datarate'] = '<p class="message blue pbottom">Date usage in '.$country.' is charged at a rate of '.$datarate.'¢ for every 10kb.';
$this->set('message', $message );
//for monthly banner
$month = strtolower(date('F'));//fb($month);
$this->set('month',$month);
}
function worldPhoneBuyClean() {
$this->layout = 'homecorp';
$ourIP = $this->Tracking->checkIP( env('REMOTE_ADDR') );
//perform check to clear session if country is not worldphone capable
if($country = $this->Session->read('tariff.countryname')){
//check country is capable
$hasWorldPhone = ClassRegistry::init('Country')->hasWorldPhone($country);
if(!$hasWorldPhone){
$this->Session->destroy();
}
}
$compatibility = $this->Session->read('tariff.message');
$classicLink = '<span class="spanlink showgreen">Classic</span>';
$deluxeLink = '<span class="spanlink showpurple">Deluxe</span>';
$androidLink = '<span class="spanlink showblue">Android</span>';
$message['budgetList'] = implode(", ",ClassRegistry::init('Country')->getCountries('budget'));
$message['classicList'] = implode(", ",ClassRegistry::init('Country')->getCountries('classic'));
$css_classes = 'clearfix message subtitle pbottom';
switch($compatibility){
case 'budget':
$message['classic'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'</p>'; //<p class="warning message mbottom">You will need a <span class="spanlink showgreen">Classic</span> or <span class="spanlink showpurple">Deluxe</span> phone for Chile</p>';
$message['budget'] = '<p class="'.$css_classes.' red">You will need a '.$classicLink.', '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
$message['deluxe'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'</p>';
$message['android'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'<p>';
$message['common'] = '<p class="'.$css_classes.' red bold">You will need a '.$classicLink.', '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
break;
case 'deluxe':
$message['classic'] = '<p class="'.$css_classes.' red">You will need a '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
$message['budget'] = '<p class="'.$css_classes.' red">You will need a '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
$message['deluxe'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'<p>';
$message['android'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'<p>';
$message['common'] = '<p class="'.$css_classes.' red bold">You will need a '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
break;
default:
$message['classic'] = '<p class="'.$css_classes.' green">All of our phones will work in '.$country.'</p>';
$message['budget'] = '<p class="'.$css_classes.' green">All of our phones will work in '.$country.'</p>';
$message['deluxe'] = '<p class="'.$css_classes.' green">All of our phones will work in '.$country.'</p>';
$message['android'] = '<p class="'.$css_classes.' green">All of our phones will work in '.$country.'</p>';
$message['common'] = '<p class="'.$css_classes.' green bold">All of our phones will work in '.$country.'</p>';
}
$datarate = $this->Session->read('tariff.datarate');
$message['datarate'] = '<p class="message blue pbottom">Date usage in '.$country.' is charged at a rate of '.$datarate.'¢ for every 10kb.';
$this->set('message', $message );
//for monthly banner
$month = strtolower(date('F'));//fb($month);
$this->set('month',$month);
}
function worldPhoneBuyTest() {
$ourIP = $this->Tracking->checkIP( env('REMOTE_ADDR') );
//perform check to clear session if country is not worldphone capable
if($country = $this->Session->read('tariff.countryname')){
//check country is capable
$hasWorldPhone = ClassRegistry::init('Country')->hasWorldPhone($country);
if(!$hasWorldPhone){
$this->Session->destroy();
}
}
$compatibility = $this->Session->read('tariff.message');
$classicLink = '<span class="spanlink showgreen">Classic</span>';
$deluxeLink = '<span class="spanlink showpurple">Deluxe</span>';
$androidLink = '<span class="spanlink showblue">Android</span>';
$message['budgetList'] = implode(", ",ClassRegistry::init('Country')->getCountries('budget'));
$message['classicList'] = implode(", ",ClassRegistry::init('Country')->getCountries('classic'));
$css_classes = 'clearfix message subtitle pbottom';
switch($compatibility){
case 'budget':
$message['classic'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'</p>'; //<p class="warning message mbottom">You will need a <span class="spanlink showgreen">Classic</span> or <span class="spanlink showpurple">Deluxe</span> phone for Chile</p>';
$message['budget'] = '<p class="'.$css_classes.' red">You will need a '.$classicLink.', '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
$message['deluxe'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'</p>';
$message['android'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'<p>';
$message['common'] = '<p class="'.$css_classes.' red bold">You will need a '.$classicLink.', '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
break;
case 'deluxe':
$message['classic'] = '<p class="'.$css_classes.' red">You will need a '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
$message['budget'] = '<p class="'.$css_classes.' red">You will need a '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
$message['deluxe'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'<p>';
$message['android'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'<p>';
$message['common'] = '<p class="'.$css_classes.' red bold">You will need a '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
break;
default:
$message['classic'] = '<p class="'.$css_classes.' green">All of our phones will work in '.$country.'</p>';
$message['budget'] = '<p class="'.$css_classes.' green">All of our phones will work in '.$country.'</p>';
$message['deluxe'] = '<p class="'.$css_classes.' green">All of our phones will work in '.$country.'</p>';
$message['android'] = '<p class="'.$css_classes.' green">All of our phones will work in '.$country.'</p>';
$message['common'] = '<p class="'.$css_classes.' green bold">All of our phones will work in '.$country.'</p>';
}
$datarate = $this->Session->read('tariff.datarate');
$message['datarate'] = '<p class="message blue pbottom">Date usage in '.$country.' is charged at a rate of '.$datarate.'¢ for every 10kb.';
$this->set('message', $message );
//for monthly banner
$month = strtolower(date('F'));//fb($month);
$this->set('month',$month);
}
function fourPhones() {
$ourIP = $this->Tracking->checkIP( env('REMOTE_ADDR') );
//perform check to clear session if country is not worldphone capable
if($country = $this->Session->read('tariff.countryname')){
//check country is capable
$hasWorldPhone = ClassRegistry::init('Country')->hasWorldPhone($country);
if(!$hasWorldPhone){
$this->Session->destroy();
}
}
$compatibility = $this->Session->read('tariff.message');
$classicLink = '<span class="spanlink showgreen">Classic</span>';
$deluxeLink = '<span class="spanlink showpurple">Deluxe</span>';
$message['budgetList'] = implode(", ",ClassRegistry::init('Country')->getCountries('budget'));
$message['classicList'] = implode(", ",ClassRegistry::init('Country')->getCountries('classic'));
$css_classes = 'clearfix message subtitle';
switch($compatibility){
case 'budget':
$message['classic'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'</p>'; //<p class="warning message mbottom">You will need a <span class="spanlink showgreen">Classic</span> or <span class="spanlink showpurple">Deluxe</span> phone for Chile</p>';
$message['budget'] = '<p class="'.$css_classes.' red">You will need a '.$classicLink.' or '.$deluxeLink.' phone for '.$country.'</p>';
$message['deluxe'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'</p>';
$message['common'] = '<p class="'.$css_classes.' red bold">You will need a '.$classicLink.' or '.$deluxeLink.' phone for '.$country.'</p>';
break;
case 'deluxe':
$message['classic'] = '<p class="'.$css_classes.' red">You will need a '.$deluxeLink.' phone for '.$country.'</p>';
$message['budget'] = '<p class="'.$css_classes.' red">You will need a '.$deluxeLink.' phone for '.$country.'</p>';
$message['deluxe'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'<p>';
$message['common'] = '<p class="'.$css_classes.' red bold">You will need a '.$deluxeLink.' phone for '.$country.'</p>';
break;
default:
$message['classic'] = '<p class="'.$css_classes.' green">All of our phones will work in '.$country.'</p>';
$message['budget'] = '<p class="'.$css_classes.' green">All of our phones will work in '.$country.'</p>';
$message['deluxe'] = '<p class="'.$css_classes.' green">All of our phones will work in '.$country.'</p>';
$message['common'] = '<p class="'.$css_classes.' green bold">All of our phones will work in '.$country.'</p>';
}
$datarate = $this->Session->read('tariff.datarate');
$message['datarate'] = '<p class="message blue pbottom">Date usage in '.$country.' is charged at a rate of '.$datarate.'¢ for every 10kb.';
$this->set('message', $message );
//for monthly banner
$month = strtolower(date('F'));//fb($month);
$this->set('month',$month);
}
function gsmWorldPhone() {
$this->layout = 'gsmworldphone';
$datarate = $this->Session->read('tariff.datarate');
//$message['datarate'] = '<p class="message blue pbottom">Date usage in '.$country.' is charged at a rate of '.$datarate.'¢ for every 10kb.';
$this->set('message', $message );
}
// Tren & Mike's New World Phone Landing Page
function worldPhones() {
$this->layout = 'worldphonetest';
$ourIP = $this->Tracking->checkIP( env('REMOTE_ADDR') );
//perform check to clear session if country is not worldphone capable
if($country = $this->Session->read('tariff.countryname')){
//check country is capable
$hasWorldPhone = ClassRegistry::init('Country')->hasWorldPhone($country);
if(!$hasWorldPhone){
$this->Session->destroy();
}
}
$compatibility = $this->Session->read('tariff.message');
$classicLink = '<span class="spanlink showgreen">Classic</span>';
$deluxeLink = '<span class="spanlink showpurple">Deluxe</span>';
$androidLink = '<span class="spanlink showblue">Android</span>';
$message['budgetList'] = implode(", ",ClassRegistry::init('Country')->getCountries('budget'));
$message['classicList'] = implode(", ",ClassRegistry::init('Country')->getCountries('classic'));
$css_classes = 'clearfix message subtitle pbottom';
switch($compatibility){
case 'budget':
$message['classic'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'</p>'; //<p class="warning message mbottom">You will need a <span class="spanlink showgreen">Classic</span> or <span class="spanlink showpurple">Deluxe</span> phone for Chile</p>';
$message['budget'] = '<p class="'.$css_classes.' red">You will need a '.$classicLink.', '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
$message['deluxe'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'</p>';
$message['android'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'<p>';
$message['common'] = '<p class="'.$css_classes.' red bold">You will need a '.$classicLink.', '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
break;
case 'deluxe':
$message['classic'] = '<p class="'.$css_classes.' red">You will need a '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
$message['budget'] = '<p class="'.$css_classes.' red">You will need a '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
$message['deluxe'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'<p>';
$message['android'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'<p>';
$message['common'] = '<p class="'.$css_classes.' red bold">You will need a '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
break;
default:
$message['classic'] = '<p class="'.$css_classes.' green">All of our phones will work in '.$country.'</p>';
$message['budget'] = '<p class="'.$css_classes.' green">All of our phones will work in '.$country.'</p>';
$message['deluxe'] = '<p class="'.$css_classes.' green">All of our phones will work in '.$country.'</p>';
$message['android'] = '<p class="'.$css_classes.' green">All of our phones will work in '.$country.'</p>';
$message['common'] = '<p class="'.$css_classes.' green bold">All of our phones will work in '.$country.'</p>';
}
$datarate = $this->Session->read('tariff.datarate');
$message['datarate'] = '<p class="message blue pbottom">Date usage in '.$country.' is charged at a rate of '.$datarate.'¢ for every 10kb.';
$this->set('message', $message );
//for monthly banner
$month = strtolower(date('F'));//fb($month);
$this->set('month',$month);
}
//
// ========================================================== Upgrade SPLIT TEST 24/06/2011 =======================================================
// ====================================================================================================================================================
// ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
// ========================================================== Upgrade SPLIT TEST 24/06/2011 =======================================================
// ====================================================================================================================================================
//==================================================== FREE SHIPPING
//gsm sim card purchase
function worldSim() {
//get the country list for the 'countries covered section'
$countries = implode(", ",ClassRegistry::init('Country')->getCountries());
$this->set('countries', $countries );
}
//satellite phone rental
function satPhoneRent() {
}
//satellite phone rental
function satPhoneRentTest() {
}
//satellite phone rental
function satPhoneRents() {
}
//japanese cellphone purchase
function japanPhoneRent() {
}
function japanPhoneRentTest() {
}
//korean cellphone rental
function koreaPhoneRent() {
}
//===========================================================================================================================================================================================
//======================================================================================== Keyword Specific Pages ===========================================================================
//===========================================================================================================================================================================================
function europePhone(){
$ourIP = $this->Tracking->checkIP( env('REMOTE_ADDR') );
//perform check to clear session if country is not worldphone capable
if($country = $this->Session->read('tariff.countryname')){
//check country is capable
$hasWorldPhone = ClassRegistry::init('Country')->hasWorldPhone($country);
if(!$hasWorldPhone){
$this->Session->destroy();
}
}
$compatibility = $this->Session->read('tariff.message');
$classicLink = '<span class="spanlink showgreen">Classic</span>';
$deluxeLink = '<span class="spanlink showpurple">Deluxe</span>';
$androidLink = '<span class="spanlink showblue">Android</span>';
$message['budgetList'] = implode(", ",ClassRegistry::init('Country')->getCountries('budget'));
$message['classicList'] = implode(", ",ClassRegistry::init('Country')->getCountries('classic'));
$css_classes = 'clearfix message subtitle pbottom';
switch($compatibility){
case 'budget':
$message['classic'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'</p>'; //<p class="warning message mbottom">You will need a <span class="spanlink showgreen">Classic</span> or <span class="spanlink showpurple">Deluxe</span> phone for Chile</p>';
$message['budget'] = '<p class="'.$css_classes.' red">You will need a '.$classicLink.', '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
$message['deluxe'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'</p>';
$message['android'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'<p>';
$message['common'] = '<p class="'.$css_classes.' red bold">You will need a '.$classicLink.', '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
break;
case 'deluxe':
$message['classic'] = '<p class="'.$css_classes.' red">You will need a '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
$message['budget'] = '<p class="'.$css_classes.' red">You will need a '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
$message['deluxe'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'<p>';
$message['android'] = '<p class="'.$css_classes.' green">This phone will work in '.$country.'<p>';
$message['common'] = '<p class="'.$css_classes.' red bold">You will need a '.$deluxeLink.' or '.$androidLink.' phone for '.$country.'</p>';
break;
default:
$message['classic'] = '<p class="'.$css_classes.' green">All of our phones will work in '.$country.'</p>';
$message['budget'] = '<p class="'.$css_classes.' green">All of our phones will work in '.$country.'</p>';
$message['deluxe'] = '<p class="'.$css_classes.' green">All of our phones will work in '.$country.'</p>';
$message['android'] = '<p class="'.$css_classes.' green">All of our phones will work in '.$country.'</p>';
$message['common'] = '<p class="'.$css_classes.' green bold">All of our phones will work in '.$country.'</p>';
}
$datarate = $this->Session->read('tariff.datarate');
$message['datarate'] = '<p class="message blue pbottom">Date usage in '.$country.' is charged at a rate of '.$datarate.'¢ for every 10kb.';
$this->set('message', $message );
//for monthly banner
$month = strtolower(date('F'));//fb($month);
$this->set('month',$month);
}
function fontFix(){
$this->layout = 'fontfix';
}
//===========================================================================================================================================================================================
//======================================================================================== Keyword Specific Pages ===========================================================================
//===========================================================================================================================================================================================
function worldPhoneUpgrade(){
$this->layout = 'fancybox';
}
//free shipping
function worldPhoneUpgradeTest(){
$this->layout = 'fancybox';
}
function newtemplate(){
$this->layout = 'homecorp';
}
function travelawards(){
$this->layout = 'travelawards';
}
function __hasWorldPhone($country = null){
$query = "SELECT DISTINCT countryName FROM countries AS Country INNER JOIN countries_networks AS n ON Country.id = n.country_id WHERE Country.countryname = '".$country."' AND n.network_id IN (1,14)";
//fb($query);
$result = ClassRegistry::init('Product')->query($query);
return !empty($result);
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment