From 2753e6266a2dc269397c1c0ccb3b5b788fb22c9a Mon Sep 17 00:00:00 2001 From: William Date: Wed, 2 Mar 2022 07:24:27 +0100 Subject: [PATCH] Commit --- app/lib/App/Teamtable/Team.php | 11 +++++++++++ app/model/Teamtable.php | 22 +++++++++++++++------- 2 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 app/lib/App/Teamtable/Team.php diff --git a/app/lib/App/Teamtable/Team.php b/app/lib/App/Teamtable/Team.php new file mode 100644 index 0000000..2a74912 --- /dev/null +++ b/app/lib/App/Teamtable/Team.php @@ -0,0 +1,11 @@ +execute([$LagID]); } - public function getTeamByID(int $LagID) # Mixed, array if exists, false if not + /** + * Returns mixed, array if exists, FALSE if not. + */ + public function getTeamByID(int $LagID) { $sth = $this->dbh->prepare('SELECT * FROM lagtabell WHERE LagID = ?'); $sth->execute([$LagID]); return $sth->fetch(PDO::FETCH_ASSOC); } - // why this is so long who cares??? + /** + * Why this is so long who cares??? + */ public function updateTeamByID( int $id, string $LagNavn, @@ -76,7 +81,9 @@ class Teamtable return $this->dbh->lastInsertId(); } - // Check if team is empty by comparing it to the template + /** + * Check if team is empty by comparing it to the template + */ public function isEqualEmptyTemplate(array $team): bool { $template = $this->template; @@ -88,8 +95,9 @@ class Teamtable return TRUE; } - // Return true if team exists, false if not - // ;)) + /** + * Returns TRUE if team exists, FALSE if not + */ public function recieveStick(string $cardnumber): bool { $sth = $this->dbh->prepare('SELECT * FROM lagtabell WHERE Kortnummer = ?'); @@ -98,12 +106,12 @@ class Teamtable $row = $sth->fetch(PDO::FETCH_ASSOC); if ($row) { - // Team exists, insert into time table + // team exists, insert into time table $sth = $this->dbh->prepare('INSERT INTO tidtabell (LagID) VALUES (?)'); $sth->execute([$row['LagID']]); return TRUE; } - // Team does not exist, lets create it + // team does not exist, lets create it $sth = $this->dbh->prepare( "INSERT INTO `lagtabell` (`LagNavn`, `Bedrift`, `Kortnummer`, `Lagleder`, `Telefon`, `Deltagere`, `Runder`) VALUES (?, ?, ?, ?, ?, ?, ?)" );