Merge branch 'feature/sopOverzichtPerCriterium'
This commit is contained in:
@@ -8,7 +8,9 @@ class Overzichtsop extends MY_Controller{
|
||||
"shared/Schooljaren_model",
|
||||
"shared/Organisaties_model",
|
||||
"shared/Orgusers_model",
|
||||
"monpas/Compactsop_model"
|
||||
"monpas/Compactsop_model",
|
||||
"monpas/Sorteringen_model",
|
||||
"monpas/Sorteerlabels_model",
|
||||
|
||||
|
||||
|
||||
@@ -17,12 +19,47 @@ class Overzichtsop extends MY_Controller{
|
||||
$this->load->helper('string');
|
||||
}
|
||||
|
||||
function getSchooljaren(){
|
||||
function getSchooljarenEnCriteria(){
|
||||
if (!$this->userid) die;
|
||||
$schooljaren = $this->Schooljaren_model->getschooljaren();
|
||||
echo json_encode($schooljaren);
|
||||
$org = $this->Organisaties_model->get_record_by_id($this->globorgid);
|
||||
if($org->soort == 4) $criteria = false;
|
||||
else {
|
||||
switch ($org->soort) {
|
||||
case 1:
|
||||
$swvID = $this->globorgid;
|
||||
break;
|
||||
case 2:
|
||||
$swvID = $org->valtonder_id;
|
||||
break;
|
||||
case 3:
|
||||
$swvID = $this->Organisaties_model->get_fieldvalue(['id' => $org->valtonder_id], 'valtonder_id');
|
||||
break;
|
||||
}
|
||||
|
||||
$criteria = $this->Sorteringen_model->get_criteriabijSWV($swvID);
|
||||
if (!$criteria) {
|
||||
$criteria = [];
|
||||
}
|
||||
$criterium = new stdClass();
|
||||
$criterium->id = 0;
|
||||
$criterium->swv_id = $swvID;
|
||||
$criterium->naam = "bestuur";
|
||||
array_unshift($criteria, $criterium);
|
||||
}
|
||||
|
||||
$data = [
|
||||
'schooljaren' => $schooljaren,
|
||||
'orgsoort' => $org->soort,
|
||||
'orgID' => $this->globorgid,
|
||||
'criteria' => $criteria
|
||||
];
|
||||
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getOrgsoort(){
|
||||
if (!$this->userid) die;
|
||||
$organisatie = $this->Organisaties_model->getorg($this->globorgid);
|
||||
@@ -33,90 +70,129 @@ class Overzichtsop extends MY_Controller{
|
||||
|
||||
}
|
||||
|
||||
function getoverzicht() {
|
||||
function getoverzicht()
|
||||
{
|
||||
if (!$this->userid) die;
|
||||
$schooljaarnr = $this->clean_input("schooljaarnr");
|
||||
$orgid = $this->clean_input("orgid");
|
||||
if ($orgid == 0) $orgid = $this->globorgid;
|
||||
$organisatie = $this->Organisaties_model->getorg($orgid);
|
||||
$criteriumID = $this->clean_input("criteriumID");
|
||||
|
||||
$organisatie = $this->Organisaties_model->getorg($this->globorgid);
|
||||
$organisatie->sop = 'F';
|
||||
$compactsopID = $this->Compactsop_model->get_fieldvalue(['organisatie_id' => $orgid,
|
||||
$compactsopID = $this->Compactsop_model->get_fieldvalue(['organisatie_id' => $this->globorgid,
|
||||
'schooljaarnummer' => $schooljaarnr], 'id');
|
||||
if ($compactsopID) $organisatie->sop = 'T';
|
||||
switch ($organisatie->soort) {
|
||||
case 4:
|
||||
echo json_encode(array("organisatie" => $organisatie, "soort" => 4,));
|
||||
break;
|
||||
case 3:
|
||||
$bgid = $organisatie->id;
|
||||
$organisatie->scholen = $this->Organisaties_model->getorgsvanaf($bgid);
|
||||
if ($organisatie->scholen) {
|
||||
foreach ($organisatie->scholen as $index => $school) {
|
||||
$school->sop = 'F';
|
||||
$compactsopID = $this->Compactsop_model->get_fieldvalue(
|
||||
['organisatie_id' => $school->id, 'schooljaarnummer' => $schooljaarnr], 'id');
|
||||
if ($compactsopID) $school->sop = 'T';
|
||||
}
|
||||
}
|
||||
echo json_encode(array("organisatie" => $organisatie, "soort" => 3));
|
||||
break;
|
||||
case 2:
|
||||
$kamerid = $organisatie->id;
|
||||
$organisatie->bgs = $this->Organisaties_model->getorgsvanaf($kamerid);
|
||||
if ($organisatie->bgs) {
|
||||
foreach ($organisatie->bgs as $bg) {
|
||||
$bg->sop = 'F';
|
||||
$compactsopID = $this->Compactsop_model->get_fieldvalue(
|
||||
['organisatie_id' => $bg->id, 'schooljaarnummer' => $schooljaarnr], 'id');
|
||||
if ($compactsopID) $bg->sop = 'T';
|
||||
$bg->scholen = $this->Organisaties_model->getorgsvanaf($bg->id);
|
||||
foreach ($bg->scholen as $index => $school) {
|
||||
if ($organisatie->soort == 4){
|
||||
echo json_encode(["soort" => 4,
|
||||
"organisatie" => $organisatie,
|
||||
"criteriumscholen" => false]);
|
||||
}
|
||||
|
||||
|
||||
if ($criteriumID > 0){
|
||||
$criteriumOrg = clone $organisatie;
|
||||
$criteriumresult = $this->overzichtPerCriterium($criteriumOrg, $schooljaarnr, $criteriumID);
|
||||
}
|
||||
if($organisatie->soort < 3 ||$criteriumID == 0 ) $niveauresult = $this->overzichtPerNiveau($organisatie, $schooljaarnr, $criteriumID);
|
||||
$niveauorgs = [];
|
||||
echo json_encode([
|
||||
'soort' => $organisatie->soort,
|
||||
'organisatie' => isset($niveauresult)? $niveauresult : false,
|
||||
'criteriumscholen' => isset($criteriumresult) ? $criteriumresult: false
|
||||
|
||||
]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
private function overzichtPerCriterium($criteriumOrg, $schooljaarnr, $criteriumID){
|
||||
|
||||
$lijst = [];
|
||||
$orgs = $this->Organisaties_model->getlistrecursief($criteriumOrg->id, $lijst);
|
||||
$orglist = implode(",", $orgs);
|
||||
$criteriumOrg->scholen = $this->Sorteerlabels_model->orgsEnSopsPerCriterium($schooljaarnr,$criteriumID,$criteriumOrg->id, $orglist );
|
||||
|
||||
return $criteriumOrg;
|
||||
|
||||
}
|
||||
|
||||
private function overzichtPerNiveau($organisatie, $schooljaarnr, $criteriumID){
|
||||
switch ($organisatie->soort) {
|
||||
case 3:
|
||||
$bgid = $organisatie->id;
|
||||
$organisatie->scholen = $this->Organisaties_model->getorgsvanaf($bgid);
|
||||
if ($organisatie->scholen) {
|
||||
foreach ($organisatie->scholen as $index => $school) {
|
||||
$school->sop = 'F';
|
||||
$compactsopID = $this->Compactsop_model->get_fieldvalue(
|
||||
['organisatie_id' => $school->id, 'schooljaarnummer' => $schooljaarnr], 'id');
|
||||
if ($compactsopID) $school->sop = 'T';
|
||||
}
|
||||
}
|
||||
}
|
||||
echo json_encode(array("organisatie" => $organisatie, "soort" => 2));
|
||||
break;
|
||||
case 1;
|
||||
$swvid = $organisatie->id;
|
||||
$organisatie->kamers = $this->Organisaties_model->getorgsvanaf($swvid);
|
||||
if ($organisatie->kamers) {
|
||||
if (!is_array($organisatie->kamers)) {
|
||||
$organisatie->kamers = objectToArray($organisatie->kamers);
|
||||
}
|
||||
foreach ($organisatie->kamers as $kamer) {
|
||||
$kamer->sop = 'F';
|
||||
$compactsopID = $this->Compactsop_model->get_fieldvalue(
|
||||
['organisatie_id' => $kamer->id, 'schooljaarnummer' => $schooljaarnr], 'id');
|
||||
if ($compactsopID) $kamer->sop = 'T';
|
||||
$kamer->bgs = $this->Organisaties_model->getorgsvanaf($kamer->id);
|
||||
if ($kamer->bgs) {
|
||||
foreach ($kamer->bgs as $bg) {
|
||||
$bg->sop = 'F';
|
||||
$compactsopID = $this->Compactsop_model->get_fieldvalue(
|
||||
['organisatie_id' => $bg->id, 'schooljaarnummer' => $schooljaarnr], 'id');
|
||||
if ($compactsopID) $bg->sop = 'T';
|
||||
break;
|
||||
case 2:
|
||||
$kamerid = $organisatie->id;
|
||||
$organisatie->bgs = $this->Organisaties_model->getorgsvanaf($kamerid);
|
||||
if ($organisatie->bgs) {
|
||||
foreach ($organisatie->bgs as $bg) {
|
||||
$bg->sop = 'F';
|
||||
$compactsopID = $this->Compactsop_model->get_fieldvalue(
|
||||
['organisatie_id' => $bg->id, 'schooljaarnummer' => $schooljaarnr], 'id');
|
||||
if ($compactsopID) $bg->sop = 'T';
|
||||
if($criteriumID == 0 ) {
|
||||
$bg->scholen = $this->Organisaties_model->getorgsvanaf($bg->id);
|
||||
foreach ($bg->scholen as $index => $school) {
|
||||
$school->sop = 'F';
|
||||
if($bg->scholen){
|
||||
foreach ($bg->scholen as $index => $school) {
|
||||
$school->sop = 'F';
|
||||
$compactsopID = $this->Compactsop_model->get_fieldvalue(
|
||||
['organisatie_id' => $school->id, 'schooljaarnummer' => $schooljaarnr], 'id');
|
||||
if ($compactsopID) $school->sop = 'T';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1;
|
||||
$swvid = $organisatie->id;
|
||||
$organisatie->kamers = $this->Organisaties_model->getorgsvanaf($swvid);
|
||||
if ($organisatie->kamers) {
|
||||
if (!is_array($organisatie->kamers)) {
|
||||
$organisatie->kamers = objectToArray($organisatie->kamers);
|
||||
}
|
||||
foreach ($organisatie->kamers as $kamer) {
|
||||
$kamer->sop = 'F';
|
||||
$compactsopID = $this->Compactsop_model->get_fieldvalue(
|
||||
['organisatie_id' => $kamer->id, 'schooljaarnummer' => $schooljaarnr], 'id');
|
||||
if ($compactsopID) $kamer->sop = 'T';
|
||||
$kamer->bgs = $this->Organisaties_model->getorgsvanaf($kamer->id);
|
||||
if ($kamer->bgs) {
|
||||
foreach ($kamer->bgs as $bg) {
|
||||
$bg->sop = 'F';
|
||||
$compactsopID = $this->Compactsop_model->get_fieldvalue(
|
||||
['organisatie_id' => $school->id, 'schooljaarnummer' => $schooljaarnr], 'id');
|
||||
if ($compactsopID) $school->sop = 'T';
|
||||
['organisatie_id' => $bg->id, 'schooljaarnummer' => $schooljaarnr], 'id');
|
||||
if ($compactsopID) $bg->sop = 'T';
|
||||
if($criteriumID == 0) {
|
||||
$bg->scholen = $this->Organisaties_model->getorgsvanaf($bg->id);
|
||||
if($bg->scholen) {
|
||||
foreach ($bg->scholen as $index => $school) {
|
||||
$school->sop = 'F';
|
||||
$compactsopID = $this->Compactsop_model->get_fieldvalue(
|
||||
['organisatie_id' => $school->id, 'schooljaarnummer' => $schooljaarnr], 'id');
|
||||
if ($compactsopID) $school->sop = 'T';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode([
|
||||
"organisatie" => $organisatie,
|
||||
"soort" => 1]);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
return $organisatie;
|
||||
}
|
||||
|
||||
|
||||
// function getAlfabetisch(){
|
||||
// if (!$this->userid) die;
|
||||
|
||||
@@ -28,4 +28,8 @@ class Compactsop_model extends MY_Model
|
||||
header( 'Content-Length: ' . filesize( $this->compactsoppath.$sop->pdfnaam ) );
|
||||
readfile( $this->compactsoppath . $sop->pdfnaam );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -26,6 +26,29 @@ class Sorteerlabels_model extends MY_Model{
|
||||
WHERE L.sortering_id = {$criteriumid}
|
||||
AND O.organisatie_id = {$schoolid} ";
|
||||
return $this->get_query_row('id');
|
||||
|
||||
}
|
||||
|
||||
function orgsEnSopsPerCriterium($schooljaarnr,$criteriumID,$orgid, $orglist){
|
||||
$this->sql =" SELECT O.id, O.soort, O.naamkort, O.plaats, O.brin, COALESCE(L.naam, 'niet ingedeeld') AS label,
|
||||
COALESCE(L.naam, 'ZZZZ') AS ordening,
|
||||
CASE WHEN C.id IS NULL THEN 'F'
|
||||
ELSE 'T'
|
||||
END AS sop
|
||||
|
||||
FROM tb_organisaties O
|
||||
LEFT JOIN tb_sorteerlabels_org OL ON O.id = OL.organisatie_id
|
||||
LEFT JOIN tb_sorteerlabels L ON OL.label_id = L.id
|
||||
LEFT JOIN tb_sorteringen S ON L.sortering_id = S.id
|
||||
LEFT JOIN tb_compactsops C ON O.id = C.organisatie_id
|
||||
|
||||
WHERE O.id IN ({$orglist})
|
||||
AND (S.id = {$criteriumID} OR S.id IS NULL)
|
||||
AND O.id <> {$orgid}
|
||||
AND O.soort = 4
|
||||
AND (C.schooljaarnummer = {$schooljaarnr} OR C.id IS NULL)
|
||||
GROUP BY O.id
|
||||
ORDER BY ordening, O.soort, O.naamkort ";
|
||||
|
||||
return $this->get_query_result();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
<table style="border: 1px solid #A28A29; margin-top: 30px;"
|
||||
<table style="border: 1px solid #A28A29; margin-top: 30px;width: 100%;"
|
||||
data-bind="with: $root.selectedOrg()">
|
||||
<thead>
|
||||
<tr style="border-bottom:1px solid #A28A29; ">
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
|
||||
|
||||
<table style="border: 1px solid #A28A29; width: 100%; margin-top: 30px;" data-bind="with: topOrg() ? topOrg(): ''" >
|
||||
<thead>
|
||||
<tr style="border-bottom:1px solid #A28A29; ">
|
||||
<th colspan="3" style="padding: 5px; color: white; background-color:#A28A29;">Compact SOPs per citerium</th>
|
||||
</tr>
|
||||
<tr style="border-bottom:1px solid #A28A29; ">
|
||||
<th style="padding: 5px; color: white; background-color:#A28A29">Download</th>
|
||||
<th style="padding: 5px; color: white; background-color:#A28A29 ">Soort</th>
|
||||
<th style="padding: 5px; color: white; background-color:#A28A29 ">Organisatie</th>
|
||||
|
||||
</tr>
|
||||
<tr style="border-bottom:1px solid #A28A29;" data-bind="visible: soort== 'BOP' ">
|
||||
<th data-bind="style: {backgroundColor: achtergrond} " >
|
||||
<button data-bind="visible: erIsEenSop(), click: $parent.fOpenPDF, style: {backgroundColor: kleur()} "
|
||||
class="buttonCompact glyphicon glyphicon-open"
|
||||
style=" height: 30px; width: 30px; padding-left: 8px; border-radius: 50%;
|
||||
box-shadow: none; border: none; float: left">
|
||||
</button></th>
|
||||
<th style="padding: 5px;" data-bind="text: soort, style: {backgroundColor: achtergrond()} "></th>
|
||||
<th style="padding: 5px;" data-bind="text: naam, style: {backgroundColor: achtergrond()} "></th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach: orgs">
|
||||
<tr data-bind="visible: $index() == 0 || $parent.orgs()[$index()-1].label != label " style="border-bottom:1px solid #A28A29; ">
|
||||
<td colspan ="3" data-bind="text: label" style="background-color: #faf7eb; text-align: center; font-weight: bold; vertical-align: text-top">
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="border-bottom:1px solid #A28A29; ">
|
||||
<td data-bind="style: {backgroundColor: achtergrond} " style="border-bottom:1px solid #A28A29; ">
|
||||
<button data-bind="visible: erIsEenSop(), click: $root.fOpenPDF, style: {backgroundColor: kleur()} "
|
||||
class="buttonCompact glyphicon glyphicon-open"
|
||||
style=" height: 30px; width: 30px; padding-left: 8px; border-radius: 50%;
|
||||
box-shadow: none; border: none; float: left">
|
||||
</button>
|
||||
</td>
|
||||
<td style="padding: 5px" data-bind="text: soort, style: {backgroundColor: achtergrond()} "></td>
|
||||
<td style="padding: 5px" data-bind="text: naam, style: {backgroundColor: achtergrond()} ">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -1,7 +1,12 @@
|
||||
<table style="border: 1px solid #A28A29; margin-top: 30px;"
|
||||
<table style="border: 1px solid #A28A29; margin-top: 30px; width: 100%;"
|
||||
data-bind="with: $root.selectedOrg()">
|
||||
|
||||
<thead>
|
||||
<!-- ko if: $parent.topOrg()-->
|
||||
<tr style="border-bottom: 1px solid white;">
|
||||
<th colspan="3" style="padding: 5px; color: white; background-color:#A28A29">Compact SWOP, ROPs en BOPs </th>
|
||||
</tr>
|
||||
<!-- /ko -->
|
||||
<tr>
|
||||
<th style="padding: 5px; color: white; background-color:#A28A29">Download</th>
|
||||
<th style="padding: 5px; color: white; background-color:#A28A29 ">Soort</th>
|
||||
@@ -33,7 +38,7 @@
|
||||
style=" height: 30px; width: 30px; padding-left: 8px; background-color: #8cff1a; float: left">
|
||||
</button>
|
||||
</td>
|
||||
<td style="padding: 5px; background-color: #f5f0f2;">ROP</td>
|
||||
<td style="padding: 5px; background-color: #f5f0f2;">BOP</td>
|
||||
<td style="padding: 5px; background-color: #f5f0f2;" data-bind="text: brin + ' ' + naam">
|
||||
</td>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<table style="width: 500px;" data-bind="with: $root.selectedOrg()">
|
||||
<table style="width: 100%;" data-bind="with: $root.selectedOrg()">
|
||||
<tr>
|
||||
<td style="padding: 5px">SOP</td>
|
||||
<td style="padding: 5px" data-bind="text: brin + ' ' + naam">
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
<table style="border: 1px solid #A28A29; margin-top: 30px;"
|
||||
data-bind="with: $root.selectedOrg()">
|
||||
<table style="border: 1px solid #A28A29; margin-top: 30px; width: 100%;"
|
||||
data-bind="with: selectedOrg() ">
|
||||
<thead>
|
||||
<!-- ko if: $parent.topOrg()-->
|
||||
<tr style="border-bottom: 1px solid white;">
|
||||
<th colspan="3" style="padding: 5px; color: white; background-color:#A28A29">Compact SWOP, ROPs en BOPs </th>
|
||||
</tr>
|
||||
<!-- /ko -->
|
||||
<tr style="border-bottom: 1px solid white;">
|
||||
<th style="padding: 5px; color: white; background-color:#A28A29">Download</th>
|
||||
<th style="padding: 5px; color: white; background-color:#A28A29 ">Soort</th>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<div class="col-sm-12 mainpagina" id ="pagsopoverzicht">
|
||||
<div class="row">
|
||||
<div class="col-xs-2"></div>
|
||||
<div class="col-xs-1"></div>
|
||||
|
||||
<div class="col-xs-9 " >
|
||||
<div class="col-xs-11 " >
|
||||
|
||||
<h4 data-bind="text: titel() ? subtitel() ? titel() + ' ' + subtitel() : titel(): '' ">
|
||||
</h4>
|
||||
@@ -11,26 +11,57 @@
|
||||
|
||||
|
||||
<p>Selecteer een schooljaar:</p>
|
||||
<select data-bind=" options: schooljaren,
|
||||
<select style="height: 25px; width: 150px;"
|
||||
data-bind=" options: schooljaren,
|
||||
optionsText: 'naam',
|
||||
value: $root.selectedSchooljaar,
|
||||
event: {change: fChangeSchooljaar}">
|
||||
</select>
|
||||
|
||||
<!-- ko if: orgsoort() == 4 -->
|
||||
<?php $this->load->view("monpas/compactsop/overzicht/_school"); ?>
|
||||
<!--/ko -->
|
||||
<div data-bind="visible: criteria().length > 1 && orgsoort() != 4">
|
||||
<p style="margin-top : 20px;">Kies een sorteercriterium:</p>
|
||||
<select style="height: 25px; width: 150px;"
|
||||
data-bind=" options : criteria,
|
||||
optionsText : 'naam',
|
||||
value : selectedCriterium,
|
||||
event : {change: fChangeCriterium}">
|
||||
</select>
|
||||
|
||||
<!-- ko if: orgsoort() == 3 -->
|
||||
<?php $this->load->view("monpas/compactsop/overzicht/_bestuur"); ?>
|
||||
<!--/ko -->
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
<!-- ko if: orgsoort() == 4 -->
|
||||
<div class="col-xs-4">
|
||||
<?php $this->load->view("monpas/compactsop/overzicht/_school"); ?>
|
||||
</div>
|
||||
<!--/ko -->
|
||||
|
||||
<!-- ko if: topOrg() -->
|
||||
<div class="col-xs-6">
|
||||
<?php $this->load->view("monpas/compactsop/overzicht/_criterium"); ?>
|
||||
</div>
|
||||
<!--/ko -->
|
||||
|
||||
<!-- ko if: orgsoort() == 3 && !topOrg() -->
|
||||
<div class="col-xs-6">
|
||||
<?php $this->load->view("monpas/compactsop/overzicht/_bestuur"); ?>
|
||||
</div>
|
||||
<!--/ko -->
|
||||
|
||||
<!-- ko if: orgsoort() == 2 -->
|
||||
<div class="col-xs-6">
|
||||
<?php $this->load->view("monpas/compactsop/overzicht/_regio"); ?>
|
||||
</div>
|
||||
<!--/ko -->
|
||||
|
||||
<!-- ko if: orgsoort() == 1 -->
|
||||
<div class="col-xs-6">
|
||||
<?php $this->load->view("monpas/compactsop/overzicht/_swv"); ?>
|
||||
</div>
|
||||
<!--/ko -->
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ko if: orgsoort() == 2 -->
|
||||
<?php $this->load->view("monpas/compactsop/overzicht/_regio"); ?>
|
||||
<!--/ko -->
|
||||
<!-- ko if: orgsoort() == 1 -->
|
||||
<?php $this->load->view("monpas/compactsop/overzicht/_swv"); ?>
|
||||
<!--/ko -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user