funciton that queries the ProfilUpdates now takes a associative array instead of multiple separate parameters

This commit is contained in:
SimonGschnell
2024-02-05 11:17:07 +01:00
parent 6e55382d15
commit a2d0f9e39a
5 changed files with 25 additions and 40 deletions
+8 -12
View File
@@ -12,11 +12,11 @@ class ProfilUpdate extends Auth_Controller
public function __construct(){
parent::__construct([
'index' => ['student/anrechnung_beantragen:r', 'user:r'], // TODO(chris): permissions?
'getAllRequests' => ['student/anrechnung_beantragen:r', 'user:r'],
'getProfilUpdates' => ['student/anrechnung_beantragen:r', 'user:r'],
'acceptProfilRequest'=>['user:r'],
'denyProfilRequest'=>['user:r'],
'show'=>['user:r'],
'getPendingRequests'=>['user:r'],
]);
@@ -45,20 +45,16 @@ class ProfilUpdate extends Auth_Controller
echo json_encode($res);
}
public function getAllRequests(){
$res = $this->ProfilChangeModel->getProfilUpdate();
public function getProfilUpdates($status=null){
if(isset($status)){
$res = $this->ProfilChangeModel->getProfilUpdate(["status"=>$status]);
}else{
$res = $this->ProfilChangeModel->getProfilUpdate();
}
$res = hasData($res)? getData($res) : null;
echo json_encode($res);
}
public function getPendingRequests(){
$res = $this->ProfilChangeModel->loadWhere(["status"=>"pending"]);
$res = hasData($res)? getData($res) : [];
echo json_encode($res);
}
public function acceptProfilRequest(){