package org.cacert.gigi.dbObjects;
+import java.util.Date;
+
import org.cacert.gigi.database.DBEnum;
import org.cacert.gigi.dbObjects.wrappers.DataContainer;
private Country country;
- public Assurance(int id, User from, Name to, String location, String method, int points, String date, Country country) {
+ private Date expireDate;
+
+ public Assurance(int id, User from, Name to, String location, String method, int points, String date, Country country, Date expireDate) {
this.id = id;
this.from = from;
this.to = to;
this.points = points;
this.date = date;
this.country = country;
-
+ this.expireDate = expireDate;
}
public User getFrom() {
public Country getCountry() {
return country;
}
+
+ public Date getExpireDate() {
+ return expireDate;
+ }
+
+ public boolean isExpired() {
+ boolean expired = false;
+ if (expireDate == null) {
+ expired = false;
+ } else {
+ Date now = new Date();
+ expired = expireDate.before(now);
+ }
+ return expired;
+ }
}
private Assurance assuranceByRes(GigiResultSet res) {
try {
- return new Assurance(res.getInt("id"), User.getById(res.getInt("from")), Name.getById(res.getInt("to")), res.getString("location"), res.getString("method"), res.getInt("points"), res.getString("date"), res.getString("country") == null ? null : Country.getCountryByCode(res.getString("country"), CountryCodeType.CODE_2_CHARS));
+ return new Assurance(res.getInt("id"), User.getById(res.getInt("from")), Name.getById(res.getInt("to")), res.getString("location"), res.getString("method"), res.getInt("points"), res.getString("date"), res.getString("country") == null ? null : Country.getCountryByCode(res.getString("country"), CountryCodeType.CODE_2_CHARS), res.getTimestamp("expire"));
} catch (GigiApiException e) {
throw new Error(e);
}
final Assurance[] assurances = (Assurance[]) vars.get(assuranceArray);
if (assurer) {
vars.put("verb", l.getTranslation("To (User Id)"));
+ vars.put("info", "");
} else {
vars.put("verb", l.getTranslation("From"));
vars.put("myName", "yes");
+ vars.put("info", l.getTranslation("Coloured rows show expired nucleus bonus verifications which are not counted to the total of verification points."));
}
IterableDataset assuranceGroup = new IterableDataset() {
vars.put("date", assurance.getDate());
vars.put("location", assurance.getLocation() + " (" + (assurance.getCountry() == null ? l.getTranslation("not given") : assurance.getCountry().getName()) + ")");
vars.put("points", assurance.getPoints());
+ vars.put("expired", assurance.isExpired());
i++;
return true;
}
<td><?=_Method?></td>
</tr>
<? foreach($assurances) {?>
-<tr>
+<tr <? if($expired) { ?> class="info" <? } ?> >
<? if($support) { ?>
<td><a href="/support/user/<?=$linkId?>/"><?=$id?></a></td>
<? } else { ?>
<td><?=$method?></td>
</tr>
<? } ?>
-</table>
\ No newline at end of file
+</table>
+<?=$info?>
\ No newline at end of file