added credits
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user