Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

follow the PSR2 coding style rules #65

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions src/InsaLan/ApiBundle/Controller/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public function indexAction(Request $request)
// look for a manager corresponding to user and provieded tournaments
$manager = $em->getRepository('InsaLanTournamentBundle:Manager')->findByUser($usr);
foreach ($manager as $m) {
if ($m->getTournament())
if (in_array($m->getTournament()->getShortname(),$t))
if($m->getPaymentDone()) {
if ($m->getTournament()) {
if (in_array($m->getTournament()->getShortname(), $t)) {
if ($m->getPaymentDone()) {
$res["err"] = null;
$res["tournament"] = "manager";

Expand All @@ -43,28 +43,30 @@ public function indexAction(Request $request)
$res["err"] = "no_paid_place";
// no return because we need to check if there is a player timezone_offset_get()
}
}
}
}

$player = $em->getRepository('InsaLanTournamentBundle:Player')->findByUser($usr);

foreach($player as $p) {
foreach ($player as $p) {
$res["err"] = "no_paid_place";

if ($p->getTournament()) {
if (in_array($p->getTournament()->getShortname(),$t))
if($p->getPaymentDone()) {
$res["err"] = null;
$res["tournament"] = $p->getTournament()->getShortname();
return new JsonResponse($res);
if (in_array($p->getTournament()->getShortname(), $t)) {
if ($p->getPaymentDone()) {
$res["err"] = null;
$res["tournament"] = $p->getTournament()->getShortname();
return new JsonResponse($res);
}
}
}

elseif ($p->getPendingTournament()) {
if (in_array($p->getPendingTournament()->getShortname(),$t))
if($p->getPaymentDone()) {
$res["err"] = null;
$res["tournament"] = $p->getPendingTournament()->getShortname();
return new JsonResponse($res);
} elseif ($p->getPendingTournament()) {
if (in_array($p->getPendingTournament()->getShortname(), $t)) {
if ($p->getPaymentDone()) {
$res["err"] = null;
$res["tournament"] = $p->getPendingTournament()->getShortname();
return new JsonResponse($res);
}
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/InsaLan/ApiBundle/Http/JsonResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

use Symfony\Component\HttpFoundation\Response;

class JsonResponse extends Response {
public function __construct($data) {
class JsonResponse extends Response
{
public function __construct($data)
{
parent::__construct();
$this->headers->set('Content-Type', 'application/json');
$this->setContent(json_encode($data));
Expand Down
24 changes: 13 additions & 11 deletions src/InsaLan/InsaLanBundle/API/Lol.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@

class Lol
{
protected $api;
protected $api;

public function __construct($apiKey) {
$this->api = new Api($apiKey);
$this->api->setRegion('euw');
//$this->api->remember(20);
//$this->api->limit(10, 10); // Set a limit of 10 requests per 10 seconds
//$this->api->limit(500, 600); // Set a limit of 500 requests per 600 (10 minutes) seconds
}
public function __construct($apiKey)
{
$this->api = new Api($apiKey);
$this->api->setRegion('euw');
//$this->api->remember(20);
//$this->api->limit(10, 10); // Set a limit of 10 requests per 10 seconds
//$this->api->limit(500, 600); // Set a limit of 500 requests per 600 (10 minutes) seconds
}

public function getApi() {
return $this->api;
}
public function getApi()
{
return $this->api;
}
}
6 changes: 3 additions & 3 deletions src/InsaLan/InsaLanBundle/Resources/public/css/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ li a:hover {
}

.text-justify {
text-align: justify;
text-align: justify;
}

.text-center {
Expand Down Expand Up @@ -954,8 +954,8 @@ li a:hover {
/** FOR STREAMS ONLY, TEMPORARY */

.streamsHeader {
top: 0px;
width: 100%;
top: 0px;
width: 100%;
height: 40px;
font-family: Oswald, sans-serif;
font-size: 20px;
Expand Down
84 changes: 42 additions & 42 deletions src/InsaLan/InsaLanBundle/Resources/public/js/global.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
window.addEvent('domready', function() {
window.addEvent('domready', function () {
// Close button for alert messages
$$('.alert-error, .alert-info, .alert-success').each(function(e) {
var button = new Element('button', {
type: 'button',
html: '×',
events: {
click: function() {
var fx = new Fx.Tween(this.parentNode, {
property: 'opacity',
onComplete: function() {
this.parentNode.dispose();
}.bind(this)
});
$$('.alert-error, .alert-info, .alert-success').each(function (e) {
var button = new Element('button', {
type: 'button',
html: '×',
events: {
click: function () {
var fx = new Fx.Tween(this.parentNode, {
property: 'opacity',
onComplete: function () {
this.parentNode.dispose();
}.bind(this)
});

fx.start(1, 0);
}
}
});
fx.start(1, 0);
}
}
});

button.inject(e, 'top');
});
button.inject(e, 'top');
});

{ // Highlight current module
var module = window.location.pathname;
if (module == '/' || module == '/app_dev.php/') {
module += 'news/';
}
{ // Highlight current module
var module = window.location.pathname;
if (module == '/' || module == '/app_dev.php/') {
module += 'news/';
}

$$('body > header nav li a').each(function(a) {
var p = a.pathname;
if (p == '/' || p == '/app_dev.php/') {
p += 'news/';
}
$$('body > header nav li a').each(function (a) {
var p = a.pathname;
if (p == '/' || p == '/app_dev.php/') {
p += 'news/';
}

if (0 === module.lastIndexOf(p, 0)) {
a.parentNode.addClass('active');
}
});
}
if (0 === module.lastIndexOf(p, 0)) {
a.parentNode.addClass('active');
}
});
}

// Streams actions

$$(".hideMask").addEvent("click", function() {
$$(".maskContent").hide();
$$("#mask").hide();
});
$$(".hideMask").addEvent("click", function () {
$$(".maskContent").hide();
$$("#mask").hide();
});

$$(".showMask").addEvent("click", function() {
$$("#" + this.dataset.target).show();
$$("#mask").show();
});
$$(".showMask").addEvent("click", function () {
$$("#" + this.dataset.target).show();
$$("#mask").show();
});
});
Loading