optie om ondersteuningsvorm per groep te archiveren
+ dearchiveren
This commit is contained in:
@@ -63,10 +63,19 @@ class Groepen extends MY_Controller{
|
||||
$groep->ondersteuningsvormen = $this->Ondersteuningsvormen_model->getvormen($orgid, $minnivo, $maxnivo);
|
||||
if ($groep->ondersteuningsvormen){
|
||||
foreach($groep->ondersteuningsvormen as $ondersteuningsvorm){
|
||||
// hier get aantal
|
||||
$ax = $this->Aantalxondersteuningsvorm_model->getaantal($groepid, $ondersteuningsvorm->id);
|
||||
if ($ax){ $ondersteuningsvorm->aantal = $ax->aantal; }
|
||||
else{ $ondersteuningsvorm->aantal =0; };
|
||||
$aantal = 0;
|
||||
$archief = 'F';
|
||||
$details = $this->Aantalxondersteuningsvorm_model->getdetails($groepid, $ondersteuningsvorm->id);
|
||||
if($details) {
|
||||
if ($details->aantal) $aantal = $details->aantal;
|
||||
if ($details->archief) $archief = $details->archief;
|
||||
}
|
||||
$ondersteuningsvorm->aantal = $aantal;
|
||||
$ondersteuningsvorm->archief = $archief;
|
||||
|
||||
$gebruikt = $this->Aantalxondersteuningsvorm_model->aantalGebruikt($orgid, $groepid, $ondersteuningsvorm->id);
|
||||
$ondersteuningsvorm->gebruikt = $gebruikt > 0 ? 'T' : 'F';
|
||||
|
||||
}
|
||||
}
|
||||
echo json_encode($groep);
|
||||
@@ -126,53 +135,120 @@ class Groepen extends MY_Controller{
|
||||
echo json_encode($groep);
|
||||
}
|
||||
|
||||
|
||||
function insertorupdateOS(){
|
||||
//TODO clean input
|
||||
if(!$this->userid) die;
|
||||
$osid = $this->clean_input('id');
|
||||
$orgid = $this->clean_input("orgid");
|
||||
$aantal = $this->clean_input('aantal');
|
||||
if (($osid == 0 || $osid == null) &&($aantal > 0)) {
|
||||
$data=array("organisatie_id" => $orgid,
|
||||
"naam" => $this->clean_input("naam"),
|
||||
"nivo" => $this->clean_input('nivo')
|
||||
|
||||
$osid = $this->clean_input('id');
|
||||
$orgid = $this->clean_input("orgid");
|
||||
$aantal = $this->clean_input('aantal');
|
||||
$archief = $this->clean_input('archief');
|
||||
|
||||
if ($archief !== 'T') $archief = 'F';
|
||||
|
||||
if (($osid == 0 || $osid == null) && ($aantal > 0)) {
|
||||
$data = array(
|
||||
"organisatie_id" => $orgid,
|
||||
"naam" => $this->clean_input("naam"),
|
||||
"nivo" => $this->clean_input('nivo')
|
||||
);
|
||||
$osid = $this->Ondersteuningsvormen_model->insert_record($data);
|
||||
}
|
||||
else {
|
||||
if ($orgid > 0){
|
||||
$data=array("naam" => $this->clean_input('naam'));
|
||||
$data = array("naam" => $this->clean_input('naam'));
|
||||
$this->Ondersteuningsvormen_model->update_record($data, $osid);
|
||||
}
|
||||
// update name
|
||||
}
|
||||
$data2= array("organisatie_id" => $orgid,
|
||||
"groep_id" => $this->clean_input('groepid'),
|
||||
"ondersteuningsvorm_id" => $osid);
|
||||
$aos =$this->Aantalxondersteuningsvorm_model->get_records_where($data2, TRUE);
|
||||
|
||||
$data2 = array(
|
||||
"organisatie_id" => $orgid,
|
||||
"groep_id" => $this->clean_input('groepid'),
|
||||
"ondersteuningsvorm_id" => $osid
|
||||
);
|
||||
|
||||
$aos = $this->Aantalxondersteuningsvorm_model->get_records_where($data2, TRUE);
|
||||
|
||||
if($aos){
|
||||
if ($this->clean_input('aantal') == 0) {
|
||||
//delete de regel
|
||||
if ($aantal == 0 && $archief !== 'T') {
|
||||
// delete alleen als het niet gearchiveerd is
|
||||
$this->Aantalxondersteuningsvorm_model->delete_record($aos->id);
|
||||
}
|
||||
else {
|
||||
// update de regel
|
||||
$data=array( "aantal" => $this->clean_input('aantal') );
|
||||
// update de regel (ook archief opslaan)
|
||||
$data = array(
|
||||
"aantal" => $aantal,
|
||||
"archief" => $archief
|
||||
);
|
||||
$this->Aantalxondersteuningsvorm_model->update_record($data, $aos->id);
|
||||
}
|
||||
}
|
||||
else{
|
||||
if ($this->clean_input('aantal') > 0){
|
||||
$data = array( "organisatie_id" => $orgid,
|
||||
"groep_id" => $this->clean_input('groepid'),
|
||||
"ondersteuningsvorm_id" => $osid,
|
||||
"aantal" => $this->clean_input('aantal'));
|
||||
// record bestaat nog niet: maak hem aan als er aantal > 0 is OF als het archief is
|
||||
if ($aantal > 0 || $archief === 'T'){
|
||||
$data = array(
|
||||
"organisatie_id" => $orgid,
|
||||
"groep_id" => $this->clean_input('groepid'),
|
||||
"ondersteuningsvorm_id" => $osid,
|
||||
"aantal" => $aantal,
|
||||
"archief" => $archief
|
||||
);
|
||||
$aantalid = $this->Aantalxondersteuningsvorm_model->insert_record($data);
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($osid);
|
||||
}
|
||||
|
||||
// function insertorupdateOS(){
|
||||
// //TODO clean input
|
||||
// if(!$this->userid) die;
|
||||
// $osid = $this->clean_input('id');
|
||||
// $orgid = $this->clean_input("orgid");
|
||||
// $aantal = $this->clean_input('aantal');
|
||||
// if (($osid == 0 || $osid == null) &&($aantal > 0)) {
|
||||
// $data=array("organisatie_id" => $orgid,
|
||||
// "naam" => $this->clean_input("naam"),
|
||||
// "nivo" => $this->clean_input('nivo')
|
||||
// );
|
||||
// $osid = $this->Ondersteuningsvormen_model->insert_record($data);
|
||||
// }
|
||||
// else {
|
||||
// if ($orgid > 0){
|
||||
// $data=array("naam" => $this->clean_input('naam'));
|
||||
// $this->Ondersteuningsvormen_model->update_record($data, $osid);
|
||||
// }
|
||||
// // update name
|
||||
// }
|
||||
// $data2= array("organisatie_id" => $orgid,
|
||||
// "groep_id" => $this->clean_input('groepid'),
|
||||
// "ondersteuningsvorm_id" => $osid);
|
||||
// $aos =$this->Aantalxondersteuningsvorm_model->get_records_where($data2, TRUE);
|
||||
// if($aos){
|
||||
// if ($this->clean_input('aantal') == 0) {
|
||||
// //delete de regel
|
||||
// $this->Aantalxondersteuningsvorm_model->delete_record($aos->id);
|
||||
// }
|
||||
// else {
|
||||
// // update de regel
|
||||
// $data=array( "aantal" => $this->clean_input('aantal') );
|
||||
// $this->Aantalxondersteuningsvorm_model->update_record($data, $aos->id);
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// if ($this->clean_input('aantal') > 0){
|
||||
// $data = array( "organisatie_id" => $orgid,
|
||||
// "groep_id" => $this->clean_input('groepid'),
|
||||
// "ondersteuningsvorm_id" => $osid,
|
||||
// "aantal" => $this->clean_input('aantal'));
|
||||
// $aantalid = $this->Aantalxondersteuningsvorm_model->insert_record($data);
|
||||
// }
|
||||
// }
|
||||
// echo json_encode($osid);
|
||||
// }
|
||||
|
||||
function getgroepen(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->clean_input('schoolID');
|
||||
@@ -240,6 +316,40 @@ class Groepen extends MY_Controller{
|
||||
$this->Aantalxondersteuningsvorm_model->delete_record_where(array("ondersteuningsvorm_id" => $osid));
|
||||
$this->Ondersteuningsvormen_model->delete_record($osid);
|
||||
}
|
||||
|
||||
function archiveerOS(){
|
||||
if (!$this->userid) die;
|
||||
if (!$this->writer) return;
|
||||
$vormID = $this->clean_input('vormID');
|
||||
$groepID = $this->clean_input('groepID');
|
||||
$orgID = $this->clean_input('orgID');
|
||||
$axovID =$this->Aantalxondersteuningsvorm_model->get_fieldvalue(["ondersteuningsvorm_id"=> $vormID, "groep_id" => $groepID], "id");
|
||||
if ($axovID) $this->Aantalxondersteuningsvorm_model->update_record(["archief"=> 'T', "aantal"=> 0], $axovID);
|
||||
else $data = [ 'organisatie_id' => $orgID,
|
||||
'groep_id' => $groepID,
|
||||
'ondersteuningsvorm_id' => $vormID,
|
||||
'archief' => 'T',
|
||||
'aantal' => 0];
|
||||
|
||||
$newid = $this->Aantalxondersteuningsvorm_model->insert_record($data);
|
||||
}
|
||||
|
||||
function activeerOS(){
|
||||
if (!$this->userid) die;
|
||||
if (!$this->writer) return;
|
||||
$vormID = $this->clean_input('vormID');
|
||||
$groepID = $this->clean_input('groepID');
|
||||
$orgID = $this->clean_input('orgID');
|
||||
$axovID =$this->Aantalxondersteuningsvorm_model->get_fieldvalue(["ondersteuningsvorm_id"=> $vormID, "groep_id" => $groepID], "id");
|
||||
if ($axovID) $this->Aantalxondersteuningsvorm_model->update_record(["archief"=> 'F'], $axovID);
|
||||
else $data = [ 'organisatie_id' => $orgID,
|
||||
'groep_id' => $groepID,
|
||||
'ondersteuningsvorm_id' => $vormID,
|
||||
'archief' => 'T',
|
||||
'aantal' => 0];
|
||||
|
||||
$newid = $this->Aantalxondersteuningsvorm_model->insert_record($data);
|
||||
}
|
||||
function getwriter(){
|
||||
$writer = false;
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole, 259) > 0){$writer = true;};
|
||||
|
||||
@@ -100,7 +100,8 @@ class MY_Controller extends CI_Controller{
|
||||
// public $version = '1.21.00';//2factor
|
||||
// public $version = '1.21.00L'; //2factor -twee
|
||||
// public $version = '1.21.01M'; //verbeteringen compact sop
|
||||
public $version = '1.21.02M '; //monfin, geen rode cijfers
|
||||
// public $version = '1.21.02M '; //monfin, geen rode cijfers
|
||||
public $version = '1.21.03M '; //mondiv ondersteuningsvorm archiveren per groep
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -19,6 +19,24 @@ class Aantalxondersteuningsvorm_model extends MY_Model{
|
||||
AND ondersteuningsvorm_id = {$ondersteuningsvorm}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
|
||||
function getdetails($groepid, $ondersteuningsvorm){
|
||||
$this->sql = " SELECT *
|
||||
FROM tb_aantalxondersteuningsvorm
|
||||
WHERE groep_id = {$groepid}
|
||||
AND ondersteuningsvorm_id = {$ondersteuningsvorm}";
|
||||
return $this->get_query_row();
|
||||
}
|
||||
|
||||
function aantalGebruikt($orgid, $groepid, $ondersteuningsvorm){
|
||||
$this->sql = " SELECT SUM(aantal) AS aantal
|
||||
FROM tb_aantalxondersteuningsvorm
|
||||
WHERE organisatie_id = {$orgid}
|
||||
AND ondersteuningsvorm_id = {$ondersteuningsvorm}
|
||||
AND groep_id <> {$groepid}";
|
||||
return $this->get_query_row('aantal');
|
||||
}
|
||||
|
||||
function getaantallen($vormid, $orgid,$schooljaarnr, $groepids){
|
||||
$this->sql ="SELECT G.id, G.naam, IF(AOS.id,aantal,0) AS aantal
|
||||
FROM tb_groepen G
|
||||
|
||||
@@ -131,8 +131,15 @@
|
||||
<td style="width: 45px" class="integer" data-bind="text: totplus"></td>
|
||||
</tr>
|
||||
<!-- ko foreach: ondersteuningsvormen -->
|
||||
<tr data-bind="visible: !$parent.geopend2() && nivo==2" >
|
||||
<td ><button class="delete" data-bind="click: $root.fDeleteOS, visible: orgid > 0 && $root.writer()"></button></td>
|
||||
<tr data-bind="visible: !$parent.geopend2() && nivo==2 && !archief()" >
|
||||
<td >
|
||||
<button class="delete"
|
||||
data-bind="click: $root.fDeleteOS, visible: orgid > 0 && !gebruikt && $root.writer()">
|
||||
</button>
|
||||
<i class="fa fa-archive"
|
||||
data-bind="click: $root.fArchiveOS, visible: orgid > 0 && gebruikt && $root.writer()">
|
||||
</i>
|
||||
</td>
|
||||
<td ><input style="width:100%"
|
||||
data-bind="textInput: naam,
|
||||
enable: orgid > 0 && $root.writer(),
|
||||
@@ -140,9 +147,9 @@
|
||||
</td>
|
||||
<td><input class = "integer"
|
||||
data-bind="textInput: aantal,
|
||||
attr:{'id' : 'aantal2-' + $index()},
|
||||
event:{input: $root.fCheckinput.bind($data, 'aantal2-'+$index() )},
|
||||
enable: $root.writer() && !$root.bezig()" /></td>
|
||||
attr:{'id' : 'aantal2-' + $index()},
|
||||
event:{input: $root.fCheckinput.bind($data, 'aantal2-'+$index() )},
|
||||
enable: $root.writer() && !$root.bezig()" /></td>
|
||||
|
||||
|
||||
</tr>
|
||||
@@ -150,9 +157,44 @@
|
||||
|
||||
<tr data-bind="visible: !geopend2()">
|
||||
<td></td>
|
||||
<td colspan=2> <button data-bind="click: $parent.fNewOndersteuning.bind($data,2), visible: $root.writer()">voeg ondersteuningsvorm toe</button></td>
|
||||
<td colspan=2 style="padding-top: 2px; padding-bottom: 5px;">
|
||||
<button class="btn-subtle"
|
||||
data-bind="click: $parent.fNewOndersteuning.bind($data,2), visible: $root.writer()">voeg ondersteuningsvorm toe
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr data-bind="visible: !geopend2()">
|
||||
|
||||
<!-- ko if:archiefplus() -->
|
||||
<tr data-bind="visible: !geopend2() && !archief2() ">
|
||||
<td></td>
|
||||
<td colspan=2 style="padding-top: 2px;">
|
||||
<button class="btn-subtle" data-bind="click: $parent.fToggleArchief.bind($data,2), visible: $root.writer()">toon archief
|
||||
</button></td>
|
||||
</tr>
|
||||
<tr data-bind="visible: !geopend2() && archief2() ">
|
||||
<td colspan=3 style="background-color: lightgrey;"> Gearchiveerde ondersteuningsvormen
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<!-- ko foreach: ondersteuningsvormen -->
|
||||
|
||||
<tr style="background-color: #f1f1f1;" data-bind="visible: !$parent.geopend2() && $parent.archief2() && nivo==2 && orgid > 0 && archief() && $root.writer()">
|
||||
<td >
|
||||
<button class="activeer" data-bind="click: $root.fActivateOS, ">
|
||||
</button>
|
||||
</td>
|
||||
<td colspan=2 data-bind="text: naam"></td>
|
||||
</tr>
|
||||
<!-- /ko -->
|
||||
<tr style="background-color: #f1f1f1;" data-bind="visible: !geopend2() && archief2() ">
|
||||
<td colspan=2 ></td>
|
||||
<td style="padding-top: 2px;"> <button class="btn-subtle" data-bind="click: $parent.fToggleArchief.bind($data,2), visible: $root.writer()">sluit</button></td>
|
||||
</tr>
|
||||
<!--/ko-->
|
||||
|
||||
|
||||
<tr data-bind="visible: !geopend2() ">
|
||||
<td colspan=3> <hr/></td>
|
||||
</tr>
|
||||
|
||||
@@ -165,8 +207,11 @@
|
||||
</tr>
|
||||
|
||||
<!-- ko foreach: ondersteuningsvormen -->
|
||||
<tr data-bind="visible: !$parent.geopend3() && nivo==3" >
|
||||
<td></td>
|
||||
<tr data-bind="visible: !$parent.geopend3() && nivo==3 && !archief() " >
|
||||
<td >
|
||||
<button class="delete" data-bind="click: $root.fDeleteOS, visible: orgid > 0 && !gebruikt && $root.writer()"></button>
|
||||
<i class="fa fa-archive" data-bind="click: $root.fArchiveOS, visible: orgid> 0 && gebruikt && $root.writer()"></i>
|
||||
</td>
|
||||
<td ><input style="width:100%"
|
||||
data-bind="textInput: naam,
|
||||
enable: orgid > 0,
|
||||
@@ -178,10 +223,35 @@
|
||||
enable: $root.writer() && !$root.bezig()" /></td>
|
||||
</tr>
|
||||
<!-- /ko -->
|
||||
<tr data-bind="visible: !geopend3()">
|
||||
<tr data-bind="visible: !geopend3() " style="padding-bottom: 5px;">
|
||||
<td></td>
|
||||
<td colspan=2> <button data-bind="click: $parent.fNewOndersteuning.bind($data,3), visible: $root.writer()">voeg ondersteuningsvorm toe</button></td>
|
||||
<td colspan=2 style="padding-top: 2px;"> <button class="btn-subtle" data-bind="click: $parent.fNewOndersteuning.bind($data,3), visible: $root.writer()">voeg ondersteuningsvorm toe</button></td>
|
||||
</tr>
|
||||
|
||||
<!-- ko if:archiefextra() -->
|
||||
<tr data-bind="visible: !geopend3() && !archief3()">
|
||||
<td></td>
|
||||
<td colspan=2 style="padding-top: 2px;"> <button class="btn-subtle" data-bind="click: $parent.fToggleArchief.bind($data,3), visible: $root.writer()">toon archief</button></td>
|
||||
</tr>
|
||||
<tr data-bind="visible: !geopend3() && archief3() ">
|
||||
<td colspan=3 style="background-color: lightgrey;"> Gearchiveerde ondersteuningsvormen</td>
|
||||
</tr>
|
||||
|
||||
<!-- ko foreach: ondersteuningsvormen -->
|
||||
|
||||
<tr style="background-color: #f1f1f1;" data-bind="visible: !$parent.geopend3() && $parent.archief3() && nivo==3 && orgid > 0 && archief() && $root.writer()">
|
||||
<td >
|
||||
<button class="activeer" data-bind="click: $root.fActivateOS "></button>
|
||||
</td>
|
||||
<td colspan=2 data-bind="text: naam"></td>
|
||||
</tr>
|
||||
<!-- /ko -->
|
||||
<tr style="background-color: #f1f1f1;" data-bind="visible: !geopend3() && archief3()">
|
||||
<td colspan=2></td>
|
||||
<td style="padding-top: 2px;"> <button class="btn-subtle" data-bind="click: $parent.fToggleArchief.bind($data,3), visible: $root.writer()">sluit</button></td>
|
||||
</tr>
|
||||
<!-- /ko -->
|
||||
|
||||
<tr data-bind="visible: !geopend3()">
|
||||
<td colspan=3> <hr/></td>
|
||||
</tr>
|
||||
@@ -193,8 +263,11 @@
|
||||
<td style="width: 45px" class= "integer" data-bind="text: totextraplus"></td>
|
||||
</tr>
|
||||
<!-- ko foreach: ondersteuningsvormen -->
|
||||
<tr data-bind="visible: !$parent.geopend4() && nivo==4">
|
||||
<td></td>
|
||||
<tr data-bind="visible: !$parent.geopend4() && nivo==4 && !archief()">
|
||||
<td >
|
||||
<button class="delete" data-bind="click: $root.fDeleteOS, visible: orgid > 0 && ! gebruikt && $root.writer()"></button>
|
||||
<i class="fa fa-archive" data-bind="click: $root.fArchiveOS, visible: orgid> 0 && gebruikt && $root.writer()"></i>
|
||||
</td>
|
||||
<td ><input style="width:100%"
|
||||
data-bind="textInput: naam,
|
||||
enable: orgid > 0,
|
||||
@@ -206,13 +279,37 @@
|
||||
enable: $root.writer() && !$root.bezig()" /></td>
|
||||
</tr>
|
||||
<!-- /ko -->
|
||||
<tr data-bind="visible: !geopend4()">
|
||||
<tr data-bind="visible: !geopend4()" style="padding-bottom: 5px;">
|
||||
<td></td>
|
||||
<td colspan=2> <button data-bind="click: $parent.fNewOndersteuning.bind($data,4), visible: $root.writer()">voeg ondersteuningsvorm toe</button></td>
|
||||
<td colspan=2 style="padding-top: 2px;"> <button class="btn-subtle" data-bind="click: $parent.fNewOndersteuning.bind($data,4), visible: $root.writer()">voeg ondersteuningsvorm toe</button></td>
|
||||
</tr>
|
||||
<!-- ko if: archiefextraplus() -->
|
||||
<tr data-bind="visible: !geopend4() && !archief4()">
|
||||
<td></td>
|
||||
<td colspan=2 style="padding-top: 2px;"> <button class="btn-subtle" style="background-color: #f1f1f1; " data-bind="click: $parent.fToggleArchief.bind($data,4), visible: $root.writer()">toon archief</button></td>
|
||||
</tr>
|
||||
<tr data-bind="visible: !geopend4() && archief4() ">
|
||||
<td colspan=3 style="background-color: lightgrey;"> Gearchiveerde ondersteuningsvormen</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<!-- ko foreach: ondersteuningsvormen -->
|
||||
|
||||
<tr style="background-color: #f1f1f1;" data-bind="visible: !$parent.geopend4() && $parent.archief4() && nivo==4 && orgid > 0 && archief() && $root.writer()">
|
||||
<td >
|
||||
<button class="activeer" data-bind="click: $root.fActivateOS "></button>
|
||||
</td>
|
||||
<td colspan=2 data-bind="text: naam"></td>
|
||||
</tr>
|
||||
<!-- /ko -->
|
||||
<tr style="background-color: #f1f1f1;" data-bind="visible: !geopend4() && archief4()">
|
||||
<td colspan=2></td>
|
||||
<td style="padding-top: 2px;"> <button class="btn-subtle" data-bind="click: $parent.fToggleArchief.bind($data,4), visible: $root.writer()">sluit</button></td>
|
||||
</tr>
|
||||
<tr data-bind="visible: !geopend4()">
|
||||
<td colspan=3> <hr/></td>
|
||||
</tr>
|
||||
<!-- /ko -->
|
||||
</table>
|
||||
<div>
|
||||
<p>Notitie</p>
|
||||
|
||||
Reference in New Issue
Block a user