initial commit
This commit is contained in:
@@ -0,0 +1,183 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Activiteiten extends MY_controller {
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('ijkpartituur/Modactiviteiten',
|
||||
'ijkpartituur/Modhulpmiddelen',
|
||||
'ijkpartituur/ModActDoel',
|
||||
'ijkpartituur/ModActHulp',
|
||||
'ijkpartituur/ModKosten',
|
||||
"ijkpartituur/ModDoelgroepen");
|
||||
$this->load->model($models);
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
public function index(){
|
||||
}
|
||||
function getActiviteiten () {
|
||||
if (!$this->userid) die;
|
||||
$pijlerID = $this->clean_input('pijler');
|
||||
$zoekstring = $this->clean_input("filter");
|
||||
// id = 0 betekent dat "eigen" activiteiten moeten worden opgehaald
|
||||
// als de gebruiker behoort tot framework zijn dat alle activiteiten die door alle gebruikers van andere
|
||||
// organisaties zijn ingevoerd; anders de activiteiten behorende bij de eigen organisatie
|
||||
if ($this->super){$bronID = 0;}
|
||||
else {$bronID = $this->globorgid;};
|
||||
$activiteiten = $this->Modactiviteiten->get_activiteiten_per_pijler($pijlerID, $bronID,$zoekstring);
|
||||
|
||||
$activiteitenlijst = array();
|
||||
$i = 0;
|
||||
if($activiteiten){
|
||||
foreach ($activiteiten as $activiteit){
|
||||
$i += 1;
|
||||
$activiteitenlijst[$i]['id'] = $activiteit->id;
|
||||
$activiteitenlijst[$i]['pijlerID'] =$pijlerID;
|
||||
$activiteitenlijst[$i]['naam'] = $activiteit->naam;
|
||||
}
|
||||
}
|
||||
echo json_encode($activiteitenlijst);
|
||||
}
|
||||
function getActiviteitInfo (){
|
||||
if (!$this->userid) die;
|
||||
$activiteitID = $this->clean_input('aID');
|
||||
$AInfo = $this->Modactiviteiten->getAInfo($activiteitID);
|
||||
$AInfo[0]->wijzigbaar = TRUE;
|
||||
$pijlerID = $AInfo[0]->pijlerID;
|
||||
$hulpmiddelen = $this->ModActHulp->middelen_per_activiteit($activiteitID);
|
||||
$otherhulp =$this->ModActHulp->middelen_niet_in_activiteit($activiteitID, $pijlerID);
|
||||
$doelgroepen =$this->ModActDoel->doelgroepen_per_activiteit($activiteitID);
|
||||
$otherdoel = $this->ModActDoel->doelgroepen_niet_in_activiteit($activiteitID);
|
||||
$kosten = $this->Modactiviteiten->get_kosten_per_activiteit($activiteitID);
|
||||
echo json_encode(array("Ainfo" => $AInfo,
|
||||
"Hulpmiddelen" =>$hulpmiddelen ,
|
||||
"Other" =>$otherhulp,
|
||||
"Doelgroepen" =>$doelgroepen,
|
||||
"OtherDoel" =>$otherdoel,
|
||||
"Kosten" =>$kosten));
|
||||
}
|
||||
function OpslaanActiviteit(){
|
||||
// krijgt een post binnen vanuit model_activiteiten
|
||||
if (!$this->userid) die;
|
||||
$bronID = $this->clean_input('bron') ;
|
||||
if ($bronID <= 0) {$bronID = $this->globorgid;};
|
||||
$data=array('naam ' => $this->clean_input('naam') ,
|
||||
'omschrijving' => $this->clean_input('omschrijving'),
|
||||
'resultaatomschrijving' => $this->clean_input('resomschrijving') ,
|
||||
'inclusiviteitsniveau' => $this->clean_input('inclusiviteitsniveau') ,
|
||||
'faseID' => $this->clean_input('fase'),
|
||||
'duur' =>$this->clean_input('duur') ,
|
||||
'email_dagen' =>$this->clean_input('dagen'),
|
||||
'email_pleider' =>$this->clean_input('mail1'),
|
||||
'email_verantwoordelijke' => $this->clean_input('mail2'),
|
||||
'bronID' => $bronID );
|
||||
|
||||
$this->Modactiviteiten->update_record($data, $this->input->post("id") );
|
||||
}
|
||||
function DeleteActiviteit(){
|
||||
if (!$this->userid) die;
|
||||
$actID = $this->uri->segment(4);
|
||||
$where = array("activiteitID" =>$actID);
|
||||
$this->ModKosten->delete_record_where($where);
|
||||
$this->ModActDoel->delete_record_where($where);
|
||||
$where=array('actID'=>$actID);
|
||||
$this->ModActHulp->delete_record_where($where);
|
||||
$this->Modactiviteiten->delete_record($actID);
|
||||
}
|
||||
function GetOtherDoelgroep() {
|
||||
if (!$this->userid) die;
|
||||
$actID = $this->uri-> segment(4);
|
||||
$groepen = $this->ModActDoel->doelgroepen_niet_in_activiteit($actID);
|
||||
echo json_encode($groepen);
|
||||
}
|
||||
function NewActiviteit(){
|
||||
if (!$this->userid) die;
|
||||
$data=array('pijlerID' => $this->clean_input('pijlerID'),
|
||||
'naam ' => $this->clean_input('naam') ,
|
||||
'omschrijving' => $this->clean_input('omschrijving'),
|
||||
'inclusiviteitsniveau' => $this->clean_input('niveau') ,
|
||||
'faseID' => $this->clean_input('fase'),
|
||||
'bronID' => $this->globorgid );
|
||||
$newID = $this->Modactiviteiten->insert_record($data);
|
||||
$newact = new stdClass;
|
||||
$newact->id = strval($newID);
|
||||
$newact->pijlerID = $this->clean_input('pijlerID');
|
||||
$newact->naam = $this->clean_input('naam');
|
||||
|
||||
echo json_encode($newact);
|
||||
}
|
||||
function DeleteHulpmiddel(){
|
||||
if (!$this->userid) die;
|
||||
$actID = $this->uri->segment(4);
|
||||
$hulpID = $this->uri->segment(5);
|
||||
$this->ModActHulp->delete_link($actID, $hulpID);
|
||||
}
|
||||
function AddHulpmiddel(){
|
||||
if (!$this->userid) die;
|
||||
$actID = $this->uri->segment(4);
|
||||
$hulpID = $this->uri->segment(5);
|
||||
$data = array("actID" =>$actID,
|
||||
"hulpID" =>$hulpID);
|
||||
$this->ModActHulp->insert_record($data);
|
||||
}
|
||||
function AddDoelgroeplink(){
|
||||
if (!$this->userid) die;
|
||||
$actID = $this->uri->segment(4);
|
||||
$groepID = $this->uri->segment(5);
|
||||
$data = array("activiteitID" =>$actID,
|
||||
"doelgroepID" =>$groepID);
|
||||
$this->ModActDoel->insert_record($data);
|
||||
}
|
||||
function deleteDoelgroepLink(){
|
||||
if (!$this->userid) die;
|
||||
$actID = $this->uri->segment(4);
|
||||
$hulpID = $this->uri->segment(5);
|
||||
$this->ModActDoel->delete_link($actID, $hulpID);
|
||||
}
|
||||
function getAlleDoelgroepen(){
|
||||
if (!$this->userid) die;
|
||||
$doelgroepen = $this->ModDoelgroepen->getAll();
|
||||
foreach ($doelgroepen as $doelgroep){
|
||||
$doelgroep->deletable = $this->ModDoelgroepen->findNoUse($doelgroep->id);
|
||||
}
|
||||
echo json_encode($doelgroepen);
|
||||
}
|
||||
function deleteDoelgroep(){
|
||||
if (!$this->userid) die;
|
||||
$doelID = $this->clean_input("doelid");
|
||||
$this->ModDoelgroepen->delete_record($doelID);
|
||||
}
|
||||
function AddDoelgroep(){
|
||||
if (!$this->userid) die;
|
||||
$naam = $this->uri->segment(3);
|
||||
$data = array('omschrijving' => $naam);
|
||||
$this->ModDoelgroepen->insert_record($data);
|
||||
}
|
||||
function AddKostenregel(){
|
||||
if (!$this->userid) die;
|
||||
$actID = $this->clean_input('actID');
|
||||
$data = array("activiteitID" =>$this->input->post('actID'),
|
||||
"omschrijving" =>$this->input->post('omschrijving'),
|
||||
"kosten" => $this->input->post('bedrag'));
|
||||
$newID = $this->ModKosten->insert_record($data);
|
||||
$regel = $this->Modactiviteiten->get_kosten_per_kost($newID);
|
||||
echo json_encode($regel);
|
||||
}
|
||||
function DeleteKostenregel(){
|
||||
if (!$this->userid) die;
|
||||
//TODO rechten op delete controleren
|
||||
$kostID = $this->uri->segment(4);
|
||||
$this->ModKosten->delete_record($kostID);
|
||||
}
|
||||
function UpdateKostenregel(){
|
||||
if (!$this->userid) die;
|
||||
$id=$this->clean_input('id');
|
||||
$data = array("omschrijving" => $this->clean_input('omschrijving'),
|
||||
"kosten" => $this->clean_input('bedrag') );
|
||||
$this->ModKosten->update_record($data,$id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user