tussenopslag

This commit is contained in:
Monique
2022-11-08 10:10:41 +01:00
parent 5dfba96fc6
commit 8d3553318b
4 changed files with 75 additions and 30 deletions
@@ -111,7 +111,6 @@ class Lijsten
$this->setBrin(); $this->setBrin();
$this->setLabels(); $this->setLabels();
$this->setAmbities(); $this->setAmbities();
$this->setZprocent();
$this->setSchoolScores(); $this->setSchoolScores();
$this->setIndividueleScores(); $this->setIndividueleScores();
$this->setBestuurScores(); $this->setBestuurScores();
@@ -183,18 +182,38 @@ class Lijsten
} }
private function setAmbities(){ private function setAmbities(){
$ambitie = $this->CI->Ambities_model->getOrgAmbities($this->lijst->orgversieid, $this->orgid); $ambitieorgs = '';
$ambitieorgs = $this->getAmbitieOrgs($this->orgid, $ambitieorgs);
$ambitieorgs = rtrim($ambitieorgs, ',');
$toporgsarray = explode(',', $ambitieorgs);
$toporgs = '';
$index = 0;
for($i = count($toporgsarray)-1; $i >= 0 ; $i--) {
if($index < 2) {
$toporgs .= $toporgsarray[$i] . ',';
$index++;
}
}
$toporgs = rtrim($toporgs, ',' );
$ambitie = $this->CI->Ambities_model->mh_get_ambitie_orgversie($this->lijst->orgversieid, $ambitieorgs, $toporgs);
if (!in_array($ambitie, $this->ambitiearray, FALSE)) { if (!in_array($ambitie, $this->ambitiearray, FALSE)) {
$this->lijst->ambities = $ambitie; $this->lijst->ambities = $ambitie;
$this->ambitiearray [] = $ambitie; $this->ambitiearray [] = $ambitie;
} }
} }
private function setZprocent(){ private function getAmbitieOrgs($orgid, $ambitieorgs){
$this->zprocent = 0; $ambitieorgs .= $orgid . ',';
if(isset($this->lijst->ambities)){ $valtonder = $this->CI->Organisaties_model->get_fieldvalue(['id' => $orgid], 'valtonder_id');
$this->zprocent = $this->lijst->ambities->zprocent; if($valtonder != $orgid){
return $this->getAmbitieOrgs($valtonder, $ambitieorgs);
} }
return $ambitieorgs;
} }
private function setSchoolScores(){ private function setSchoolScores(){
+35 -1
View File
@@ -142,7 +142,41 @@ function mh_get_ambitie($moduleid, $ambitieorgs, $toporgs){
return $this->get_query_result(); return $this->get_query_result();
} }
function mh_get_ambitie_orgversie($orgversieid, $ambitieorgs, $toporgs){
$this->sql = " SELECT COALESCE(A.id, 0) AS ambitieID,
COALESCE(A.gem_score, 80) AS gemscore,
COUNT(Y.id) AS aantalY,
COALESCE(A.x_ijkpunten, ROUND(COUNT(Y.id) * 0.8)) AS xijkpunten,
COALESCE(A.z_procent, 60) AS zprocent,
OV.id AS orgversie_id,
COALESCE(O.soort, 0) AS soort,
O.id AS orgID,
CASE WHEN O.soort IS NULL THEN
'standaard'
WHEN O.soort = 1 THEN
'swv'
WHEN O.soort = 2 THEN
'regio'
WHEN O.soort = 3 THEN
'bestuur'
WHEN O.soort = 4 THEN
'school'
END AS ambitievan
FROM tb_orgversies OV
JOIN tb_versies V ON OV.versie_id = V.id
JOIN tb_ijkpunten Y ON V.id = Y.versie_id
LEFT JOIN tb_ambities A ON A.orgversie_id = OV.id
LEFT JOIN tb_organisaties O ON A.organisatie_id = O.id
WHERE (A.organisatie_id IN ({$ambitieorgs}) OR A.id IS NULL)
AND OV.organisatie_id IN ({$toporgs})
AND OV.id = {$orgversieid}
AND OV.actief = 1
AND Y.disabled = 'F'
ORDER BY soort DESC
LIMIT 1 ";
return $this->get_query_result();
}
+9 -5
View File
@@ -447,11 +447,15 @@
<div class="col-xs-5"> <div class="col-xs-5">
<h4 style="margin-top: 30px; margin-left: 10px;">Ambities</h4> <h4 style="margin-top: 30px; margin-left: 10px;">Ambities</h4>
<div data-bind="foreach: lijsten" style="margin: 5px"> <div data-bind="foreach: lijsten" style="margin: 5px">
<div class="col-xs-11" style="background-color:#f5f0f2; padding: 5px; padding-left: 10px;border-radius: 2px" data-bind="visible: ambities() == true"> <div class="col-xs-11" style="background-color:#f5f0f2; padding: 5px; padding-left: 10px;border-radius: 2px">
<p style="font-weight: bold; margin-bottom: 10px" data-bind="text: vantm + ':'"></p> <span style="font-weight: bold; margin-bottom: 10px" data-bind="text: vantm + ':'"></span>
<p style="margin-bottom: 10px"data-bind="text: 'gemiddelde score ' + gemscore + '%' "></p> <br>
<p style="margin-bottom: 10px"data-bind="text: 'minimaal ' + ijkpunten + ' ' + label + ' op ' + zprocent + ' % of hoger' "> <span data-bind="text: 'gemiddelde score ' + gemscore + '%' "></span>
</p> <br>
<span data-bind="text: 'minimaal ' + ijkpunten + ' ' + label + ' op ' + zprocent + ' % of hoger' ">
</span>
<br>
<span data-bind="text: '(ambitie ' + ambitievan + ')'"></span>
</div> </div>
</div> </div>
+6 -18
View File
@@ -128,24 +128,12 @@ ls.initIJkpuntenModel = function(){
this.jaartal = l.jaartal; this.jaartal = l.jaartal;
this.label = l.label; this.label = l.label;
this.ambities = ko.observable(false); this.gemscore = l.ambities.gemscore;
if(l.ambities) { this.ijkpunten = l.ambities.xijkpunten;
if (l.ambities.gemscore && l.ambities.xijkpunten && l.ambities.zprocent) { this.zprocent = l.ambities.zprocent;
dit.ambities(true); this.ambitievan = l.ambities.ambitievan;
}
}
this.gemscore = 0;
if(l.ambities) {
dit.gemscore = l.ambities.gemscore;
}
this.ijkpunten = 0;
if(l.ambities) {
dit.ijkpunten = l.ambities.xijkpunten;
}
this.zprocent = 0;
if(l.ambities) {
dit.zprocent = l.ambities.zprocent;
}
this.scores = ko.observableArray([]); this.scores = ko.observableArray([]);
this.erzijnscores = ko.observable(true); this.erzijnscores = ko.observable(true);