Explorar o código

Default Year filter to current year

Alan Lam %!s(int64=7) %!d(string=hai) anos
pai
achega
ca227784ac
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      controllers/projects.php

+ 4 - 0
controllers/projects.php

@@ -16,6 +16,10 @@ $id = http::value("id", "int");
 $name = http::value("name", "trim");
 $name = http::value("name", "trim");
 $year = http::value("year", "int");
 $year = http::value("year", "int");
 
 
+if($year === false) {
+	$year = date("Y");
+}
+
 if($id) $nvp["id"] = $id;
 if($id) $nvp["id"] = $id;
 if($name) $nvp["name"] = (new Constraint("CONTAINS"))->setValues($name);
 if($name) $nvp["name"] = (new Constraint("CONTAINS"))->setValues($name);
 if($year) {
 if($year) {