Adapt user insertion and logic to Física UB
Change-Id: Iece1abb1e2611c7fc77f379dca89ce3aead1a2d7
diff --git a/php/utils.php b/php/utils.php
index cc37c84..9598a27 100644
--- a/php/utils.php
+++ b/php/utils.php
@@ -3,8 +3,8 @@
function nomcurs($curs) {
$codi = (int)$curs - 1;
- $codiany = $codi % 3;
- $coditorn = intdiv($codi, 3);
+ $codiany = intdiv($codi, 3);
+ $coditorn = $codi % 3;
$any = "";
switch ($codiany) {
@@ -28,21 +28,21 @@
}
$torn = "";
- switch ($torn) {
+ switch ($coditorn) {
case 0:
- $torn = "matins";
+ $torn = "Matins";
break;
case 1:
- $torn = "mixt";
+ $torn = "Mixt";
break;
case 2:
- $torn = "tardes";
+ $torn = "Tardes";
break;
default:
$torn = "?";
}
- return "$any ($torn)";
+ return "$any - $torn";
}
function nomgrau($grau) {
@@ -83,6 +83,10 @@
public function nomgrau() {
return nomgrau($this->grau);
}
+
+ public function pista() {
+ return $this->nomgrau()." - ".$this->nomcurs();
+ }
}
function query($query) {
@@ -131,6 +135,7 @@
$user["mort"] = (int)$row[6];
$user["md5password"] = $row[7];
$user["bits"] = $row[8];
+ $user["pista"] = nomgrau($row[3])." - ".nomcurs($row[2]);
}
array_push($users, $user);