Made sure championship visibility can be toggled too.
This commit is contained in:
parent
8eb58be172
commit
5f135408db
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
.idea
|
||||
*.iml
|
||||
@ -31,6 +31,9 @@ angular.module('bananaraceApp.controllers').controller('ChampionshipsCtrl', ['$s
|
||||
});
|
||||
};
|
||||
|
||||
$scope.togglePublishResultsForChampionship = function(championship) {
|
||||
ChampionshipService.togglePublishResultsForChampionship(championship);
|
||||
}
|
||||
$scope.addChampionship = function(newchampionship) {
|
||||
console.log("adding: "+newchampionship);
|
||||
ChampionshipService.addChampionship(newchampionship).
|
||||
|
||||
@ -21,6 +21,20 @@ appServices.service('ChampionshipService', function ($http) {
|
||||
name: newchampionship.name
|
||||
});
|
||||
};
|
||||
|
||||
this.togglePublishResultsForChampionship = function (championship) {
|
||||
console.log('toggling publish results for championship' + championship.idchampionship);
|
||||
$http.post('server/config.php', {
|
||||
action: 'togglePublishResultsForChampionship',
|
||||
idchampionship: championship.idchampionship
|
||||
}).success(function (data, status, headers, config) {
|
||||
if (championship.publishresults === 'f') {
|
||||
championship.publishresults = 't';
|
||||
} else if (championship.publishresults === 't') {
|
||||
championship.publishresults = 'f';
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
appServices.service('PouleService', function ($http) {
|
||||
@ -357,6 +371,7 @@ appServices.service('MainService', function ($http, $cookies) {
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
//load the current config
|
||||
this.refreshConfig();
|
||||
});
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div ng-show="race.totaltime == null">
|
||||
<a href="#/championship/{{currentChampionship}}/poule/{{tier.tier}}/{{poule.poule}}/race/{{race.idrace}}/measurements"
|
||||
<a href="#/championship/{{currentChampionship}}/poule/{{tier.tier}}/{{poule.poule}}/race/{{race.idrace}}/measurements">
|
||||
<i class="fa fa-hourglass-start"></i>
|
||||
</a>
|
||||
</div>
|
||||
@ -53,7 +53,7 @@
|
||||
</div>
|
||||
<div class="row" ng-show="team.races.length==0">
|
||||
<div class="col-xs-2">
|
||||
<a href="#/championship/{{currentChampionship}}/poule/{{tier.tier}}/{{poule.poule}}/races"
|
||||
<a href="#/championship/{{currentChampionship}}/poule/{{tier.tier}}/{{poule.poule}}/races">
|
||||
<i class="fa fa-car"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@ -10,8 +10,9 @@
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-addon" id="sizing-addon2">Naam</span>
|
||||
<input type="text" class="form-control" aria-describedby="sizing-addon2" ng-model="newchampionship.name">
|
||||
<span class="input-group-addon" id="sizing-addon3">Naam</span>
|
||||
<input type="text" class="form-control" aria-describedby="sizing-addon2"
|
||||
ng-model="newchampionship.name">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-success" ng-click="addChampionship(newchampionship);">Toevoegen</button>
|
||||
</span>
|
||||
@ -26,14 +27,30 @@
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<table class="table table-striped table-condensed">
|
||||
<tr><th>Naam</th><th>Acties</th></tr>
|
||||
<tr>
|
||||
<th>Naam</th>
|
||||
<th>Acties</th>
|
||||
</tr>
|
||||
<tr ng-repeat="championship in championships">
|
||||
<td>{{championship.name}}</td>
|
||||
<td>
|
||||
<a class="btn btn-info btn-sm" href="#/championship/{{championship.idchampionship}}/poules">Bekijk poules</a>
|
||||
<a class="btn btn-info btn-sm" href="#/championship/{{championship.idchampionship}}/teams">Bekijk teams</a>
|
||||
<a class="btn btn-info btn-sm" href="#/championship/{{championship.idchampionship}}/overview">Overzicht</a>
|
||||
<button class="btn btn-danger btn-sm" ng-click="deleteChampionship(championship);" tooltip="Verwijderen!">
|
||||
<a class="btn btn-info btn-sm" href="#/championship/{{championship.idchampionship}}/poules">Bekijk
|
||||
poules</a>
|
||||
<a class="btn btn-info btn-sm" href="#/championship/{{championship.idchampionship}}/teams">Bekijk
|
||||
teams</a>
|
||||
<a class="btn btn-info btn-sm"
|
||||
href="#/championship/{{championship.idchampionship}}/overview">Overzicht</a>
|
||||
<button class="btn btn-default btn-sm"
|
||||
ng-class="{'btn-success' : championship.publishresults === 't', 'btn-warning' : championship.publishresults === 'f'}"
|
||||
ng-click="togglePublishResultsForChampionship(championship);"
|
||||
tooltip="Maak het kampioenschap publiek voor de deelnemers">
|
||||
<span
|
||||
class="glyphicon"
|
||||
ng-class="{'glyphicon-eye-open' : championship.publishresults === 't', 'glyphicon-eye-close' : championship.publishresults === 'f'}">
|
||||
</span>
|
||||
</button>
|
||||
<button class="btn btn-danger btn-sm" ng-click="deleteChampionship(championship);"
|
||||
tooltip="Verwijderen!">
|
||||
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
|
||||
</button>
|
||||
</td>
|
||||
@ -50,7 +67,8 @@
|
||||
<div class="panel-body">
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-addon" id="sizing-addon2">Naam</span>
|
||||
<input type="text" class="form-control" aria-describedby="sizing-addon2" ng-model="newchampionship.name">
|
||||
<input type="text" class="form-control" aria-describedby="sizing-addon2"
|
||||
ng-model="newchampionship.name">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" class="btn btn-success" ng-click="addChampionship(newchampionship)">Toevoegen</button>
|
||||
</span>
|
||||
|
||||
@ -19,6 +19,10 @@ if ($action == 'setActiveIdRace') {
|
||||
$idrace = $post['idrace'];
|
||||
$togglepublishresults = pg_prepare($dbconn, "togglepublishresults", "update race set publishresults = not publishresults where idrace = $1");
|
||||
$togglepublishresults = pg_execute($dbconn, "togglepublishresults", array($idrace));
|
||||
} else if ($action == 'togglePublishResultsForChampionship') {
|
||||
$idchampionship = $post['idchampionship'];
|
||||
$togglepublishresults = pg_prepare($dbconn, "togglepublishresults", "update championship set publishresults = not publishresults where idchampionship = $1");
|
||||
$togglepublishresults = pg_execute($dbconn, "togglepublishresults", array($idchampionship));
|
||||
} else if ($action == 'getConfig') {
|
||||
$getconfig = pg_prepare($dbconn, "getconfig", "select activerace activeidrace, tier, poule, idchampionship from config inner join race on activerace = idrace");
|
||||
$getconfig = pg_execute($dbconn, "getconfig", array());
|
||||
|
||||
6
server/phpinfo.php
Normal file
6
server/phpinfo.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Show all information, defaults to INFO_ALL
|
||||
phpinfo();
|
||||
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user