|
@@ -4,7 +4,7 @@ class Project extends Model {
|
|
|
|
|
|
|
|
protected static $table = "project";
|
|
protected static $table = "project";
|
|
|
protected static $id_field = "id";
|
|
protected static $id_field = "id";
|
|
|
- protected static $fillable_fields = ["customer_id", "template_id", "name", "test_count", "min_age", "max_age", "default_tester_fee", "time_of_day", "tester_can_claim", "template_overrides_json", "dts_start", "dts_deadline", "dts_created", "dts_updated", "dts_report"];
|
|
|
|
|
|
|
+ protected static $fillable_fields = ["customer_id", "template_id", "name", "test_count", "min_age", "max_age", "default_tester_fee", "time_of_day", "tester_can_claim", "template_overrides_json", "dts_start", "dts_deadline", "dts_created", "dts_updated", "dts_report", "dts_finished", "user_id_finished"];
|
|
|
|
|
|
|
|
protected static $field_map = [
|
|
protected static $field_map = [
|
|
|
];
|
|
];
|
|
@@ -83,6 +83,10 @@ class Project extends Model {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function getURL() {
|
|
|
|
|
+ return "/account/projects/{$this->id}";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public function isAnytime() {
|
|
public function isAnytime() {
|
|
|
return $this->time_of_day == "A";
|
|
return $this->time_of_day == "A";
|
|
|
}
|
|
}
|
|
@@ -100,6 +104,22 @@ class Project extends Model {
|
|
|
return time() > $deadline_unix;
|
|
return time() > $deadline_unix;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function markFinished() {
|
|
|
|
|
+
|
|
|
|
|
+ if(!Core::$user) throw new Exception("Trying to mark project as finished while not logged in.");
|
|
|
|
|
+ if(!Core::$user->isAdmin()) throw new Exception("Trying to mark project as finished with non-admin account.");
|
|
|
|
|
+
|
|
|
|
|
+ $this->dts_finished = Util::getUTCDateTime();
|
|
|
|
|
+ $this->user_id_finished = Core::$user->id;
|
|
|
|
|
+ return $this->commit();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function markUnfinished() {
|
|
|
|
|
+ $this->dts_finished = null;
|
|
|
|
|
+ $this->user_id_finished = null;
|
|
|
|
|
+ return $this->commit();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
?>
|