Change curs/grau values

Change-Id: I26ac5b62b428667a51eff197259e0afcfe1ae4f6
diff --git a/php/utils.php b/php/utils.php
index 80c5d84..cc37c84 100644
--- a/php/utils.php
+++ b/php/utils.php
@@ -2,22 +2,66 @@
 	require_once('db.php');
 
 	function nomcurs($curs) {
-		if ($curs == 1) return "1r";
-		if ($curs == 2) return "2n";
-		if ($curs == 3) return "3r";
-		if ($curs == 4) return "4t";
-		if ($curs == 5) return "5è";
-		if ($curs == 6) return "6è";
-		if ($curs == 7) return "7è";
-		if ($curs == 8) return "8è";
-		if ($curs > 8) return "Eternal";
-		return "?";
+		$codi = (int)$curs - 1;
+		$codiany = $codi % 3;
+		$coditorn = intdiv($codi, 3);
+
+		$any = "";
+		switch ($codiany) {
+			case 0:
+				$any = "2018 o abans";
+				break;
+			case 1:
+				$any = "2019";
+				break;
+			case 2:
+				$any = "2020";
+				break;
+			case 3:
+				$any = "2021";
+				break;
+			case 4:
+				$any = "2022";
+				break;
+			default:
+				$any = "?";
+		}
+
+		$torn = "";
+		switch ($torn) {
+			case 0:
+				$torn = "matins";
+				break;
+			case 1:
+				$torn = "mixt";
+				break;
+			case 2:
+				$torn = "tardes";
+				break;
+			default:
+				$torn = "?";
+		}
+
+		return "$any ($torn)";
 	}
 
 	function nomgrau($grau) {
-		if ($grau == 0) return "MAT";
-		if ($grau == 1) return "EST";
-		if ($grau == 2) return "MAMME";
+		switch ($grau) {
+			case 1:
+				return "Física";
+			case 2:
+				return "Química";
+			case 3:
+				return "Electrònica";
+			case 4:
+				return "Materials";
+			case 5:
+				return "Màster astrofísica i partícules";
+			case 6:
+				return "Màster fotònica";
+			default:
+				return "?";
+		}
 	}
 
 	class User{