added credits

This commit is contained in:
Tóth Richárd
2019-08-05 17:59:01 +02:00
parent 1f7b0a06d0
commit d760306d97
6 changed files with 275 additions and 172 deletions

View File

@@ -657,11 +657,34 @@ class user_kid extends user_parent {
}
$de_array[] = $new_diary_entry;
}
//itt csak hivatkozással adjuk át a tömböt, a calculate_balance kiszámolja, belerakja és visszadja
$this->calculate_balance($de_array, $this);
}
public function get_credit_color($has_credit, $credit, $trainingPrice) {
//vizsgálni kell, hogy: negatív egyenleg előfordulhat-e
//ha igen, van-e hitelezés
//ha igen, túllepte-e PIROS
//ha nem, akkor SÁRGA
//ha nincs, akkor azonnal PIROS
if ($this->get_uk_balance() < 0 || ($this->get_uk_balance() - $trainingPrice) < 0) {
if (!$has_credit) {
return 'restricted';
}
else {
if ($this->get_uk_credit() < $credit) {
return 'credit-warning';
}
else {
return 'credit-restricted';
}
}
}
return false;
}
}
?>