From c833f179b7b10aef3ca3a914eca2fc3d31b6c909 Mon Sep 17 00:00:00 2001 From: mathieu Date: Thu, 9 Jul 2015 18:26:19 -0400 Subject: [PATCH] Add home page CTR. #17 --- application/controllers/home.php | 13 +++++++++++-- application/models/event.php | 12 ++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/application/controllers/home.php b/application/controllers/home.php index 4f2b07f6..619084a0 100755 --- a/application/controllers/home.php +++ b/application/controllers/home.php @@ -50,22 +50,31 @@ function result(){ private function homeMessage(){ $randBrands = rand ( 0 , 2 ); + $randWatches = rand ( 0 , 3 ); $watchBrands = array('Seiko', 'Rolex', 'Omega'); $videos = array('Omega', 'Rolex', 'Zenith', 'Vacheron'); $video = vid_url('Zenith.mp4'); + if(!$this->user->isLoggedIn()){ + + $homePage = "HOME_PAGE_" . $randWatches; + + $this->event->add($this->event->{$homePage}); + + } + if(!$this->agent->is_mobile()){ return array('title'=>$this->measure ->getMeasuresCountByWatchBrand($watchBrands[$randBrands]) . ' ' . $watchBrands[$randBrands] . ' measured on Toolwatch.io', - 'video_url'=>vid_url($videos[rand ( 0 , 3 )]) . '.mp4'); + 'video_url'=>vid_url($videos[$randWatches]) . '.mp4'); }else{ return array('title'=>$this->measure ->getMeasuresCountByWatchBrand($watchBrands[$randBrands]) . ' ' . $watchBrands[$randBrands] . ' measured on Toolwatch.io', - 'video_url'=>img_url($videos[rand ( 0 , 3 )]) . '.png'); + 'video_url'=>img_url($videos[$randWatches]) . '.png'); } } diff --git a/application/models/event.php b/application/models/event.php index 1e4c3b69..0a4f24de 100755 --- a/application/models/event.php +++ b/application/models/event.php @@ -30,9 +30,13 @@ class Event extends MY_Model public $ACCURACY_SOMETHING_WRONG = 25; public $LOGIN_POPUP = 26; public $SIGN_UP_POPUP = 27; + public $HOME_PAGE_0 = 28; + public $HOME_PAGE_1 = 29; + public $HOME_PAGE_2 = 30; + public $HOME_PAGE_3 = 31; public $EVENT_STRING; - protected $nbEvent = 27; + protected $nbEvent = 31; protected $masks; function __construct() @@ -47,7 +51,11 @@ function __construct() 'CTR_SIGNUP_FB' => array($this->SIGN_UP, $this->SIGN_UP_FB), 'CTR_LOGIN' => array($this->LOGIN_EMAIL, $this->LOGIN_POPUP), 'CTR_LOGIN_FB' => array($this->LOGIN_FB, $this->LOGIN_POPUP), - 'MEASURE_COMPLETION' => array($this->NEW_ACCURACY, $this->NEW_MEASURE) + 'MEASURE_COMPLETION' => array($this->NEW_ACCURACY, $this->NEW_MEASURE), + 'CTR_HOME_0' => array($this->SIGN_UP, $this->HOME_PAGE_0), + 'CTR_HOME_1' => array($this->SIGN_UP, $this->HOME_PAGE_1), + 'CTR_HOME_2' => array($this->SIGN_UP, $this->HOME_PAGE_2), + 'CTR_HOME_3' => array($this->SIGN_UP, $this->HOME_PAGE_3) ); $this->EVENT_STRING = "'DATE',";