blabla dit si van mij

This commit is contained in:
Joachim Nielandt 2015-09-16 22:52:45 +02:00
parent a2e0989f2e
commit 33ebd4561e
5 changed files with 18 additions and 20 deletions

View File

@ -33,7 +33,7 @@ config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/championship/:idchampionship/team/:idteam/drivers', {templateUrl: 'partials/championship-team-drivers.html', controller: 'DriverCtrl'});
$routeProvider.when('/viewer', {templateUrl: 'partials/viewer.html', controller: 'ViewerCtrl'});
$routeProvider.when('/viewer/poule/:tier/:poule/overview', {templateUrl: 'partials/viewer-pouleoverview.html', controller: 'ViewerCtrl'});
$routeProvider.when('/viewer/poule/:tier/:poule/overview', {templateUrl: 'partials/viewer-pouleoverview.html', controller: 'PouleViewerCtrl'});
$routeProvider.when('/login', {templateUrl: 'partials/login.html', controller: 'LoginCtrl'});
$routeProvider.when('/register', {templateUrl: 'partials/register.html', controller: 'RegisterCtrl'});

View File

@ -2,7 +2,7 @@ angular.module('bananaraceApp.controllers').controller('OverviewCtrl', ['$scope'
//set route params in scope variables
$scope.currentChampionship = $routeParams.idchampionship;
console.log('OVERVIEW.JS LOADEDddd');
console.log('OVERVIEW.JS LOADED');
//data for the data gods
$scope.overviewdata = {};

View File

@ -1,35 +1,27 @@
angular.module('bananaraceApp.controllers').controller('ViewerCtrl', ['$scope', '$routeParams', 'TeamService', function($scope, $routeParams, TeamService) {
angular.module('bananaraceApp.controllers').controller('PouleViewerCtrl', ['$scope', '$routeParams', 'TeamService', function($scope, $routeParams, TeamService) {
//store all the teams
$scope.teamsInPoule = [];
$scope.currentTeamInPouleIndex = -1;
$scope.refreshTeamsForPoule = function() {
var idchampionship = $routeParams.idchampionship;
var tier = $routeParams.tier;
var poule = $routeParams.poule;
ViewerService.getTeamInPoule(idchampionship, tier, poule).
ViewerService.getTeamsForPoule(idchampionship, tier, poule).
success(function(data, status, headers, config) {
console.log('getTeamsInPoule successful...');
console.log('getTeamsForPoule successful...');
console.log(data);
if(data['ok']==true) {
$scope.teamsInPoule = data.teams;
} else {
console.log('call returned but wasnt ok: '+data['error']);
console.log('call returned but wasnt ok: '+data.error);
}
}).
error(function(data, status, headers, config) {
console.log('getTeamsInPoule failed...');
console.log('getTeamsForPoule failed...');
});
};
$scope.goToNextTeamInPoule = function() {
if($scope.teamsInPoule.length>0) {
//set up everything for the next team
$scope.currentTeamInPouleIndex = (($scope.currentTeamInPouleIndex+1)%$scope.teamsInPoule.length);
} else {
$scope.currentTeamInPouleIndex = -1;
}
};
//check if we need to load the teams for poule: only if
}]);

View File

@ -54,9 +54,6 @@ appServices.service('PouleService', function($http) {
});
appServices.service('TeamService', function($http) {
this.getTeams = function(idchampionship) {
return $http.post('server/getteams.php', {idchampionship:idchampionship});
@ -83,6 +80,7 @@ appServices.service('TeamService', function($http) {
};
});
appServices.service('RaceService', function($http) {
this.getDrives = function(idrace) {
return $http.post('server/getdrives.php', {idrace:idrace});
@ -123,6 +121,7 @@ appServices.service('RaceService', function($http) {
};
});
appServices.service('DriverService', function($http) {
this.getDrivers = function(idchampionship, idteam) {
return $http.post('server/getdrivers.php', {idchampionship:idchampionship, idteam:idteam});
@ -159,12 +158,19 @@ appServices.service('DriveService', function($http) {
};
});
appServices.service('OverviewService', function($http) {
this.getData = function(idchampionship) {
return $http.post('server/getoverviewofchampionship.php', {idchampionship:idchampionship});
};
});
appServices.service('ViewerService', function($http) {
this.getData = function(tier, poule, idchampionship) {
return $http.post('server/getoverviewofchampionship.php', {tier:tier, poule:poule, idchampionship:idchampionship});
};
});
appServices.service('MainService', function($http, $cookies) {
var activerace = null;

View File

@ -1,4 +1,4 @@
<?php
$dbconn = pg_connect("host=localhost port=5432 dbname=race user=postgres password=915015");
$dbconn = pg_connect("host=192.168.0.150 port=5432 dbname=race user=postgres password=915015");
echo pg_last_error($dbconn);
?>