88 lines
3.3 KiB
PHP
88 lines
3.3 KiB
PHP
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
class Hulpmiddelen extends MY_controller {
|
|
|
|
function __construct(){
|
|
parent::__construct();
|
|
$models = array('ijkpartituur/Modhulpmiddelen',
|
|
'ijkpartituur/ModActHulp',
|
|
'ijkpartituur/ModPartActxHulpmiddel',
|
|
'ijkpartituur/Documents_model',
|
|
"ijkpartituur/ModPartpijlers");
|
|
$this->load->model($models);
|
|
if ( ! $this->check_online_status() ) {
|
|
echo json_encode( array('offline' => TRUE) );
|
|
die;
|
|
};// if
|
|
}
|
|
|
|
public function index(){
|
|
}
|
|
function getLijst () {
|
|
$pijlerID = $this->clean_input("pijlerID");
|
|
$filterType = $this->clean_input("filterType");
|
|
$filterNaam=$this->clean_input("filterNaam");
|
|
$lijst = $this->Modhulpmiddelen->get_lijst($pijlerID,$filterType,$filterNaam);
|
|
if ($lijst) {
|
|
foreach ($lijst as $item ) {
|
|
$where=array("hulpID" => $item->id);
|
|
$item->deletable =!( $this->ModPartActxHulpmiddel->check_for_record($where) );
|
|
};
|
|
};
|
|
echo json_encode($lijst);
|
|
}
|
|
|
|
function getMiddelInfo (){
|
|
$middelID = $this->clean_input("middelID");
|
|
|
|
$middelen = $this->Modhulpmiddelen->get_middel($middelID);
|
|
$activiteiten = $this->ModActHulp->get_act_per_middel($middelID);
|
|
$documenten = $this->Documents_model->get_details(array('document_hulpmiddel_id'=>$middelID));
|
|
echo json_encode(array('middelen' => $middelen ,
|
|
'activiteiten' => $activiteiten ,
|
|
'documenten' => $documenten ) );
|
|
}
|
|
function updateMiddel(){
|
|
if ($this->Autorisaties_model->check_autorisatie($this->userrole,WRITER) <= 0) return;
|
|
$middelID = $this->clean_input('id');
|
|
$data = array("omschrijving" => $this->clean_input('omschrijving'),
|
|
"opmerkingen" => $this->clean_input("opmerkingen"),
|
|
"filenaam" => $this->clean_input("filenaam"),
|
|
"organisatieniveau" => $this->clean_input('type') );
|
|
|
|
$this->Modhulpmiddelen->update_record($data,$middelID);
|
|
}
|
|
function addHulpmiddel(){
|
|
if ($this->Autorisaties_model->check_autorisatie($this->userrole,WRITER) <= 0) return;
|
|
$data=array("omschrijving" => $this->clean_input('omschrijving'),
|
|
"pijlerID" => $this->clean_input("pijlerID"),
|
|
"bronID" => $this->globorgid,
|
|
"organisatieniveau" => $this->clean_input('type') );
|
|
$newID = $this->Modhulpmiddelen->insert_record($data);
|
|
$newMiddel = $this->Modhulpmiddelen->get_nieuwe_middel($newID);
|
|
$newMiddel[0]->deletable=true;
|
|
echo json_encode($newMiddel);
|
|
}
|
|
|
|
function deleteHulpmiddel(){
|
|
//TODO controle op recht op verwijderen en
|
|
// controle op hulpmiddel = foreign key
|
|
if ($this->Autorisaties_model->check_autorisatie($this->userrole,WRITER) <= 0) return;
|
|
$hulpID = $this->clean_input("hulpid");
|
|
$this->Modhulpmiddelen->delete_record($hulpID);
|
|
}
|
|
function getAlleHulpmiddelen(){
|
|
$data=$this->Modhulpmiddelen->get_alle_hulpmiddelen();
|
|
echo json_encode($data);
|
|
}
|
|
function getSelectedHulpmiddelen(){
|
|
$partpijlerID = $this->clean_input("pijlerID");
|
|
$where = array('id' => $partpijlerID);
|
|
$pijlerID = $this->ModPartpijlers->get_fieldvalue($where, 'pijlerID');
|
|
$partActID = $this->clean_input("taakID");
|
|
$includedhulp = $this->ModPartActxHulpmiddel->get_id_string($partActID);
|
|
$data = $this->Modhulpmiddelen->get_selected_hulpmiddelen($pijlerID, $includedhulp);
|
|
echo json_encode($data);
|
|
}
|
|
}
|