Skip to content

Commit

Permalink
Report system. Refs #17
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuNls committed Jun 16, 2015
1 parent 3dc8f7f commit b079152
Show file tree
Hide file tree
Showing 69 changed files with 460 additions and 76 deletions.
2 changes: 1 addition & 1 deletion application/config/autoload.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
|
*/

$autoload['model'] = array('user');
$autoload['model'] = array('user', 'event');


/* End of file autoload.php */
Expand Down
21 changes: 21 additions & 0 deletions application/controllers/ajax.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ function login()
$password = $this->input->post('password');
if($this->user->login($email, $password))
{
$this->event->add($this->event->LOGIN_EMAIL);
$result['success'] = true;
}
else
{
$this->event->add($this->event->LOGIN_FAIL);
$result['success'] = false;
}

Expand Down Expand Up @@ -63,6 +65,8 @@ function facebookSignup()

if($this->user->signup($email, $password, $name, $firstname, $timezone, $country))
{
$this->event->add($this->event->LOGIN_FB);

$this->load->helper('mcapi');
$api = new MCAPI('eff18c4c882e5dc9b4c708a733239c82-us9');
$api->listSubscribe('7f94c4aa71', $email, '');
Expand Down Expand Up @@ -95,6 +99,9 @@ function facebookSignup()
$this->user->login($email, $password);
}
}else if($this->user->login($email, $password)){

$this->event->add($this->event->SIGN_UP_FB);

$result['success'] = "signin";
}else {
$result['success'] = false;
Expand All @@ -119,6 +126,8 @@ function signup()

if($this->user->signup($email, $password, $name, $firstname, $timezone, $country))
{

$this->event->add($this->event->SIGN_UP);

if('true' == $mailingList)
{
Expand Down Expand Up @@ -163,6 +172,8 @@ function signup()
}
else
{
$this->event->add($this->event->SIGN_UP_FAIL);

$result['success'] = false;
}

Expand All @@ -183,6 +194,8 @@ function askResetPassword()

if($resetToken != '')
{
$this->event->add($this->event->RESET_PASSWORD);

$this->load->library('email');

$config['protocol'] = "smtp";
Expand Down Expand Up @@ -229,6 +242,9 @@ function resetPassword()
{
if($this->input->post('resetToken'))
{

$this->event->add($this->event->RESET_PASSWORD_USE);

$result = array();

$resetToken = $this->input->post('resetToken');
Expand All @@ -255,6 +271,9 @@ function getReferenceTime()
function accuracyMeasure(){
if($this->input->post('measureId'))
{

$this->event->add($this->event->NEW_ACCURACY);

$referenceTime = $this->session->userdata('referenceTime');
$userTimezone = $this->input->post('userTimezone');

Expand Down Expand Up @@ -283,6 +302,8 @@ function baseMeasure()
{
if($this->input->post('watchId'))
{
$this->event->add($this->event->NEW_MEASURE);

$result = array();

$watchId = $this->input->post('watchId');
Expand Down
3 changes: 3 additions & 0 deletions application/controllers/home.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function __construct()

function index()
{

if(!$this->agent->is_mobile()){
array_push($this->_headerData['javaScripts'], "home.logic", "watch.animation");
}else{
Expand All @@ -22,6 +23,8 @@ function index()

function logout()
{
$this->event->add($this->event->LOGOUT);

$this->user->logout();
redirect(base_url());
}
Expand Down
Empty file modified application/controllers/index.html
100644 → 100755
Empty file.
23 changes: 15 additions & 8 deletions application/controllers/measures.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,13 @@ public function __construct()
$this->load->model('measure');
}

public function removeDuplicate($key){
if($key === "TMGfrXeb6WvCgNAjeKd4"){
$this->measure->removeDuplicate();
}else{
echo "Unauthorized";
}
}

public function index()
{

if($this->input->post('addWatch'))
{
$this->event->add($this->event->ADD_WATCH);

$brand = $this->input->post('brand');
$name = $this->input->post('name');
$yearOfBuy = $this->input->post('yearOfBuy');
Expand All @@ -39,6 +34,8 @@ public function index()
}
else if($this->input->post('deleteMeasures'))
{
$this->event->add($this->event->DELETE_ALL_MEASURES);

$measureId = $this->input->post('deleteMeasures');

if($this->measure->deleteMesure($measureId))
Expand All @@ -53,6 +50,8 @@ public function index()
}
else if($this->input->post('deleteWatch'))
{
$this->event->add($this->event->DELETE_WATCH);

$watchId = $this->input->post('deleteWatch');

if($this->watch->deleteWatch($watchId))
Expand All @@ -64,6 +63,8 @@ public function index()
$this->_bodyData['error'] = 'An error occured while deleting your watch.';
}
}

$this->event->add($this->event->BOARD_LOAD);

$this->_headerData['headerClass'] = 'blue';
$this->load->view('header', $this->_headerData);
Expand All @@ -79,6 +80,8 @@ public function index()

public function new_watch()
{
$this->event->add($this->event->ADD_WATCH);

$this->_headerData['headerClass'] = 'blue';
$this->load->view('header', $this->_headerData);

Expand All @@ -90,6 +93,8 @@ public function new_watch()
public function new_measure()
{

$this->event->add($this->event->MEASURE_LOAD);

$this->_headerData['headerClass'] = 'blue';
$this->load->view('header', $this->_headerData);

Expand All @@ -106,6 +111,8 @@ public function get_accuracy()
if($this->input->post('measureId') && $this->input->post('watchId'))
{

$this->event->add($this->event->ACCURACY_LOAD);

$this->_headerData['headerClass'] = 'blue';
array_push($this->_headerData['javaScripts'], "jquery.sharrre.min", "sharrre.logic", "watch.animation");
$this->load->view('header', $this->_headerData);
Expand Down
15 changes: 15 additions & 0 deletions application/controllers/modal.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,21 @@
class Modal extends MY_Controller
{

private function ctaClick(){
if($this->input->post('cta') != ""){
$cta = 'CTA_' . strtoupper ( $this->input->post('cta') );

if(property_exists($this->event, $cta)){
$this->event->add($this->event->{$cta});
}
}
}

public function accuracyWarning(){
if($this->input->post('ajax'))
{
$this->load->view('modal/accuracy-warning');
$this->event->add($this->event->ACCURACY_WARNING_POPUP);
}
else
{
Expand All @@ -18,6 +29,8 @@ public function login()
{
if($this->input->post('ajax'))
{
$this->ctaClick();
$this->event->add($this->event->LOGIN_POPUP);
$this->load->view('modal/login');
}
else
Expand All @@ -30,6 +43,8 @@ public function signUp()
{
if($this->input->post('ajax'))
{
$this->ctaClick();
$this->event->add($this->event->SIGN_UP_POPUP);
$this->load->view('modal/sign-up');
}
else
Expand Down
38 changes: 38 additions & 0 deletions application/controllers/report.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Report extends MY_Controller
{
public function __construct()
{
$this->_needLoggedIn = true;
parent::__construct();
$this->load->model('watch');
$this->load->model('measure');
$this->load->model('user');
}

function index()
{


$this->_headerData['headerClass'] = 'blue';
$this->load->view('header', $this->_headerData);

$this->_bodyData['events'] = $this->event->getEvents();
$this->_bodyData['eventsColumns'] = $this->event->EVENT_STRING;
$this->_bodyData['allEvents'] = $this->event->getAllEvents();

$this->_bodyData['measure'] = $this->measure->count_all();
$this->_bodyData['watch'] = $this->watch->count_all();
$this->_bodyData['user'] = $this->user->count_all();
$this->_bodyData['domain'] = $this->user->statsDomain();
$this->_bodyData['platforms'] = $this->event->getPlatforms();
$this->_bodyData['browsers'] = $this->event->getBrowsers();
$this->_bodyData['mobile'] = $this->event->mobileEvents();


$this->load->view('report', $this->_bodyData);
$this->load->view('footer');
}

}
Loading

0 comments on commit b079152

Please sign in to comment.