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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Agenda extends MY_controller {
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('ijkpartituur/ModAgenda',
|
||||
'ijkpartituur/ModPartPijlers',
|
||||
"ijkpartituur/Partituurs_model",
|
||||
"ijkpartituur/Modpartactiviteiten");
|
||||
$this->load->model($models);
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
public function index(){
|
||||
}
|
||||
public function getPijlers(){
|
||||
$where=array("partituur_actief" => 1, 'partituur_organisatie_id' =>$this->globorgid);
|
||||
$partituur= $this->Partituurs_model->get_records_where($where,TRUE,FALSE);
|
||||
if ($partituur) {
|
||||
$partID=$partituur->id;
|
||||
$pijlers=$this->ModPartPijlers->get_pijlers_per_partituur($partID);
|
||||
}else{
|
||||
$partID=FALSE;
|
||||
$pijlers=FALSE;
|
||||
}
|
||||
echo json_encode(array("pijlers" =>$pijlers,
|
||||
"partID" =>$partID));
|
||||
}
|
||||
public function getActiviteiten(){
|
||||
if (!$this->userid) return;
|
||||
$pijlerID = $this->clean_input("pijlerid");
|
||||
$activiteiten = $this->Modpartactiviteiten->get_taaklijst($pijlerID);
|
||||
echo json_encode(array("activiteiten" => $activiteiten));
|
||||
}
|
||||
public function getActiviteitenPerDag(){
|
||||
if (!$this->userid) return;
|
||||
$pijlerID = $this->clean_input("pijlerID");
|
||||
$dag = $this->clean_input('dag');
|
||||
$maand = $this->clean_input('maand');
|
||||
$jaar = $this->clean_input('jaar');
|
||||
$activiteiten = $this->Modpartactiviteiten->get_taaklijst($pijlerID, $dag, $maand, $jaar);
|
||||
echo json_encode(array('activiteiten' => $activiteiten));
|
||||
}
|
||||
public function getItems(){
|
||||
if (!$this->userid) return;
|
||||
$pijlerID = $this->clean_input("PijlerID");
|
||||
$activiteitID = $this->clean_input("ActiviteitID");
|
||||
$maand = $this->clean_input("Maand");
|
||||
$jaar = $this->clean_input("Jaar");
|
||||
$items = $this->ModAgenda->get_items($pijlerID, $activiteitID, $maand, $jaar);
|
||||
echo json_encode(array('items' => $items));
|
||||
}
|
||||
public function saveEvent(){
|
||||
if (!$this->userid) return;
|
||||
$eventID = $this->clean_input("id");
|
||||
$data = array("toegang" => $this->clean_input('toegang') ,
|
||||
'wijzig' => $this->clean_input('wijzig') ,
|
||||
'pijlerID' => $this->clean_input('pijlerID') ,
|
||||
'activiteitID' => $this->clean_input('activiteitID') ,
|
||||
'colorcode' => $this->clean_input('color') ,
|
||||
'startUur' => $this->clean_input('startUur') ,
|
||||
'startMinuut' => $this->clean_input('startMinuut') ,
|
||||
'eindUur' => $this->clean_input('eindUur') ,
|
||||
'eindMinuut' => $this->clean_input('eindMinuut') ,
|
||||
'titel' => $this->clean_input('titel') ,
|
||||
'opmerking' => $this->clean_input('opmerking') ,
|
||||
);
|
||||
$this->ModAgenda->update_record($data, $eventID);
|
||||
}
|
||||
function newAfspraak(){
|
||||
if (!$this->userid) return;
|
||||
$data = array( "orgid" => $this->globorgid,
|
||||
"owner" => $this->userid,
|
||||
'dag' => $this->clean_input('dag'),
|
||||
'maand' => $this->clean_input('maand'),
|
||||
'jaar' => $this->clean_input('jaar'),
|
||||
"toegang" => $this->clean_input('toegang') ,
|
||||
'wijzig' => $this->clean_input('wijzig') ,
|
||||
'pijlerID' => $this->clean_input('pijlerID') ,
|
||||
'activiteitID' => $this->clean_input('activiteitID') ,
|
||||
'colorcode' => $this->clean_input('colorcode') ,
|
||||
'startUur' => $this->clean_input('startUur') ,
|
||||
'startMinuut' => $this->clean_input('startMinuut') ,
|
||||
'eindUur' => $this->clean_input('eindUur') ,
|
||||
'eindMinuut' => $this->clean_input('eindMinuut') ,
|
||||
'titel' => $this->clean_input('titel') ,
|
||||
'opmerking' => $this->clean_input('opmerking') ,
|
||||
);
|
||||
$newID = $this->ModAgenda->insert_record($data);
|
||||
$newItem = $this->ModAgenda->get_record_by_id($newID);
|
||||
$newItem->schrijf = 1;
|
||||
echo json_encode(array("items" =>$newItem));
|
||||
}
|
||||
function deleteAfspraak(){
|
||||
if (!$this->userid) return;
|
||||
$id = $this->clean_input("itemid");
|
||||
$this->ModAgenda->delete_record($id);
|
||||
}
|
||||
function getMinDag(){
|
||||
if (!$this->userid) return;
|
||||
$pijlerID = $this->uri->segment(4);
|
||||
$mindag = $this->ModAgenda->find_min_dag($pijlerID);
|
||||
echo json_encode($mindag);
|
||||
}
|
||||
function getMaxDag(){
|
||||
if (!$this->userid) return;
|
||||
$pijlerID = $this->uri->segment(4);
|
||||
$maxdag = $this->ModAgenda->find_max_dag($pijlerID);
|
||||
echo json_encode($maxdag);
|
||||
}
|
||||
function getMinMaxDagActiviteit(){
|
||||
if (!$this->userid) return;
|
||||
$pijlerID = $this->uri->segment(4);
|
||||
$actID = $this->uri->segment(5);
|
||||
$minmaxdag = $this->ModAgenda->find_minmax_dag($pijlerID,$actID);
|
||||
echo json_encode($minmaxdag);
|
||||
}
|
||||
function findEntries(){
|
||||
if (!$this->userid) return;
|
||||
$actID = $this->uri->segment(4);
|
||||
$where=array("activiteitID" => $actID);
|
||||
$items = $this->ModAgenda->check_for_record($where);
|
||||
echo json_encode($items);
|
||||
}
|
||||
} // einde class Agenda
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Description of Communicatie
|
||||
*
|
||||
* @author Theo Weijmer
|
||||
* @date juli 22, 2013
|
||||
*
|
||||
* @purpose
|
||||
*
|
||||
*/
|
||||
class Communicatie extends MY_Controller {
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array( 'ijkpartituur/Mails_model',
|
||||
'ijkpartituur/Mailadresses_model');
|
||||
$this->load->model($models);
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
function index(){
|
||||
$this->get_addresses();
|
||||
}
|
||||
|
||||
function save_email(){
|
||||
if (!$this->userid) return;
|
||||
$mailid = $this->uri->segment(4);
|
||||
$adressid = $this->uri->segment(5);
|
||||
$adress = $this->clean_input('adress');
|
||||
|
||||
$data = array( 'mailadress_adress' => $adress ,
|
||||
'mailadress_organisatie_id' => $this->globorgid ,
|
||||
'mailadress_mail_id' => $mailid );
|
||||
|
||||
$this->Mailadresses_model->save_record($data, $adressid);
|
||||
|
||||
$this->get_addresses();
|
||||
}
|
||||
|
||||
public function delete_adress(){
|
||||
if (!$this->userid) return;
|
||||
$adressid = $this->uri->segment(4);
|
||||
$this->Mailadresses_model->delete_record($adressid);
|
||||
$this->get_addresses();
|
||||
}
|
||||
|
||||
private function get_addresses(){
|
||||
if (!$this->userid) return;
|
||||
$mails = $this->Mails_model->get_details(array("(SELECT {$this->userrole} & mail_level) !=" => 0));
|
||||
|
||||
$data = array('mails'=>$mails);
|
||||
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,359 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Description of Documents
|
||||
*
|
||||
* @author Theo Weijmer
|
||||
* @date juni 11, 2013
|
||||
*
|
||||
* @purpose
|
||||
*
|
||||
*/
|
||||
class Documents extends MY_Controller {
|
||||
|
||||
public $rootpath;
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
if(!$this->userid) return;
|
||||
|
||||
$models = array('ijkpartituur/Documents_model',
|
||||
'ijkpartituur/Modhulpmiddelen',
|
||||
'ijkpartituur/Modhelpdesk',
|
||||
'ijkpartituur/Doctypes_model',
|
||||
'ijkpartituur/Doctags_model',
|
||||
'ijkpartituur/Tags_model',
|
||||
'ijkpartituur/ModReferenties');
|
||||
$this->load->model($models);
|
||||
$this->rootpath = str_replace('/public','',$_SERVER['DOCUMENT_ROOT']);
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
function index(){
|
||||
$doctypes = $this->Doctypes_model->get_details();
|
||||
|
||||
echo json_encode(array('doctypes'=>$doctypes));
|
||||
}
|
||||
|
||||
public function get_documents(){
|
||||
if (!$this->userid) return;
|
||||
$hulpid = $this->uri->segment(4);
|
||||
$upload = $this->check_upload($hulpid);
|
||||
$documents = $this->Documents_model->get_details(array('document_hulpmiddel_id'=>$hulpid));
|
||||
$documentid = $nontags = $selectedtags = FALSE;
|
||||
if($documents && count($documents)==1){
|
||||
$documentid = $documents[0]->id;
|
||||
$selectedtags = $this->Doctags_model->get_selected_tags($documentid);
|
||||
$nontags = $this->Doctags_model->get_non_selected_tags($documentid);
|
||||
}
|
||||
|
||||
$data = array( 'documents' => $documents ,
|
||||
'upload' => $upload ,
|
||||
'selectedtags' => $selectedtags,
|
||||
'nontags' => $nontags ,
|
||||
'documentid' => $documentid );
|
||||
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
public function upload_document(){
|
||||
if (!$this->userid) return;
|
||||
$hulpid = $this->uri->segment(4);
|
||||
$doctypeid = $this->uri->segment(5);
|
||||
$docid = $this->uri->segment(6);
|
||||
if(!$this->check_upload($docid) && $docid){
|
||||
$result = array('errors'=>json_encode('<p>u heeft geen rechten om documenten/dit document te uploaden</p>'));
|
||||
}else{
|
||||
$documentname = $this->input->post('name-upload-document');
|
||||
// $config['upload_path'] = $this->rootpath.'/tmp_uploads/';
|
||||
$config['upload_path'] = $this->partituurUpload;
|
||||
$config['allowed_types'] = 'doc|docx|jpg|gif|png|pdf|txt|ppt|pptx';
|
||||
$config['max_size'] = '10000';
|
||||
$this->load->library('upload', $config);
|
||||
|
||||
$uploadresult = $this->upload->do_upload();
|
||||
|
||||
if (!$uploadresult && !$docid){
|
||||
$result = array('errors'=>json_encode($config['upload_path']));
|
||||
//$result = array('errors'=>json_encode($this->upload->display_errors()));
|
||||
}else{
|
||||
|
||||
$data = array(
|
||||
'document_name' => $documentname ,
|
||||
'document_doctype_id' => $doctypeid ,
|
||||
'document_hulpmiddel_id' => $hulpid );
|
||||
|
||||
if(!$uploadresult){
|
||||
$result = array('errors'=>json_encode('<p>de gegevens zijn opgeslagen</p>'));
|
||||
}else{
|
||||
//check if there is already a file (docid!=0) unlink the old file
|
||||
if($docid){
|
||||
$file = $this->Documents_model->get_record_by_id($docid);
|
||||
|
||||
unlink($this->partituurSchatkist.$file->document_filename.$file->document_extension);
|
||||
}
|
||||
|
||||
$result = array('errors'=>json_encode('<p>uw bestand is succesvol geupload</p>'));
|
||||
|
||||
$document = $this->upload->data();
|
||||
|
||||
$this->load->helper('string');
|
||||
$newname = sha1(random_string('alnum', 16));
|
||||
|
||||
$data['document_original'] = $document['file_name'];
|
||||
$data['document_extension'] = $document['file_ext'] ;
|
||||
$data['document_size'] = $document['file_size'];
|
||||
$data['document_filename'] = $newname ;
|
||||
|
||||
$oldname = $this->partituurUpload.$document['file_name'];
|
||||
$newname = $this->partituurSchatkist.$newname.$document['file_ext'];
|
||||
|
||||
rename($oldname, $newname);
|
||||
}
|
||||
$this->Documents_model->save_record($data, $docid);
|
||||
}
|
||||
}
|
||||
$this->load->view('ijkpartituur/popups/uploadresult_view', $result);
|
||||
}
|
||||
|
||||
public function download_document(){
|
||||
if (!$this->userid) return;
|
||||
$this->load->helper('download');
|
||||
$docid = $this->uri->segment(4);
|
||||
$original='test';
|
||||
|
||||
if ($docid) {
|
||||
$file = $this->Documents_model->get_record_by_id($docid);
|
||||
$original = $file->document_original;
|
||||
$data = file_get_contents($this->partituurSchatkist.$file->document_filename.$file->document_extension);
|
||||
|
||||
}
|
||||
else {
|
||||
$info = $this->Modhelpdesk->get_helpdesk();
|
||||
$filenaam = $this->rootpath.'/documents/'.$info->handleiding;
|
||||
$original = "handleiding.pdf";
|
||||
$data= file_get_contents($filenaam);
|
||||
};
|
||||
force_download($original, $data);
|
||||
}
|
||||
|
||||
public function downloadHandleiding(){
|
||||
$this->load->helper('download');
|
||||
$info = $this->Modhelpdesk->get_helpdesk();
|
||||
$filenaam = $this->rootpath.'/'.$info->handleiding;
|
||||
$data = file_get_contents($filenaam);
|
||||
force_download("handleidingPartituur", $data);
|
||||
}
|
||||
|
||||
public function delete_document(){
|
||||
if (!$this->userid) return;
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) <=0 ) {
|
||||
return;
|
||||
}
|
||||
$docid = $this->uri->segment(4);
|
||||
$document = $this->Documents_model->get_record_by_id($docid);
|
||||
|
||||
if($this->check_upload($document->document_hulpmiddel_id)){
|
||||
$this->Doctags_model->delete_record_where(array('doctag_document_id'=>$docid));
|
||||
$this->Documents_model->delete_record($docid);
|
||||
|
||||
$filename = $document->document_filename.$document->document_extension;
|
||||
unlink($this->rootpath.'/schatkist/'.$filename);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function set_tags(){
|
||||
if (!$this->userid) return;
|
||||
$documentid = $this->uri->segment(4);
|
||||
|
||||
$this->send_tags($documentid);
|
||||
}
|
||||
|
||||
public function save_tag(){
|
||||
$documentid = $this->uri->segment(4);
|
||||
$tagname = $this->clean_input('tagname');
|
||||
|
||||
$tag = $this->Tags_model->get_records_where(array('UCASE(tag_name)'=>strtoupper($tagname)), TRUE);
|
||||
|
||||
if(!$tag){
|
||||
$newtag = $this->Tags_model->insert_record(array('tag_name'=>$tagname));
|
||||
$tag = $this->Tags_model->get_record_by_id($newtag);
|
||||
}
|
||||
|
||||
$data = array('doctag_tag_id'=>$tag->id, 'doctag_document_id'=>$documentid);
|
||||
if(!$this->Doctags_model->check_for_record($data)) $this->Doctags_model->insert_record($data);
|
||||
|
||||
$this->send_tags($documentid);
|
||||
}
|
||||
|
||||
public function add_tags(){
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) <=0) return;
|
||||
$documentid = $this->uri->segment(4);
|
||||
$newtags = $this->clean_input('newtags');
|
||||
|
||||
if($newtags){
|
||||
foreach($newtags as $newtag){
|
||||
$data = array('doctag_document_id'=>$documentid, 'doctag_tag_id'=>$newtag);
|
||||
if(!$this->Doctags_model->check_for_record($data)){
|
||||
$this->Doctags_model->insert_record($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->send_tags($documentid);
|
||||
}
|
||||
|
||||
public function remove_tag(){
|
||||
$documentid = $this->uri->segment(4);
|
||||
$tags = $this->clean_input('newtags');
|
||||
|
||||
if($tags){
|
||||
foreach($tags as $tag){
|
||||
$this->Doctags_model->delete_record_where(array('doctag_tag_id'=>$tag));
|
||||
$this->Tags_model->delete_record($tag);
|
||||
}
|
||||
}
|
||||
|
||||
$this->send_tags($documentid);
|
||||
}
|
||||
|
||||
public function remove_tags(){
|
||||
$documentid = $this->uri->segment(3);
|
||||
$removetags = $this->clean_input('removetags');
|
||||
|
||||
if($removetags){
|
||||
foreach($removetags as $removetag){
|
||||
$data = array('doctag_document_id'=>$documentid, 'doctag_tag_id'=>$removetag);
|
||||
$this->Doctags_model->delete_record_where($data);
|
||||
}
|
||||
}
|
||||
|
||||
$this->send_tags($documentid);
|
||||
}
|
||||
|
||||
private function send_tags($documentid){
|
||||
$nontags = $this->Doctags_model->get_non_selected_tags($documentid);
|
||||
|
||||
$selectedtags = $this->Doctags_model->get_selected_tags($documentid);
|
||||
|
||||
echo json_encode(array('nontags'=>$nontags, 'selectedtags'=>$selectedtags));
|
||||
|
||||
}
|
||||
|
||||
private function check_upload($hulpid){
|
||||
if($this->super){
|
||||
return TRUE;
|
||||
}else{
|
||||
$orgid = $this->Modhulpmiddelen->get_record_by_id($hulpid, 'bronID'); // was organisatie-ID
|
||||
if($this->globorgid==$orgid){
|
||||
return 1;
|
||||
}else{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function check_download($docid){
|
||||
if($this->super){
|
||||
return TRUE;
|
||||
}else{
|
||||
$hulpid = $this->Documents_model->get_record_by_id($docid, 'document_hulpmiddel_id');
|
||||
$orgid = $this->Modhulpmiddelen->get_record_by_id($hulpid, 'organisatie_id');
|
||||
if($orgid==1){
|
||||
return TRUE;
|
||||
}elseif($orid==$this->globorgid){
|
||||
return TRUE;
|
||||
}else{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function LSUpload(){
|
||||
if (!$this->userid) return;
|
||||
$refID = $this->uri->segment(4);
|
||||
$soort = $this->uri->segment(5);
|
||||
|
||||
if(!$this->super){
|
||||
$result = array('errors'=>json_encode('<p>u heeft geen rechten om documenten te uploaden</p>'));
|
||||
}else{
|
||||
$toonnaam = $this->input->post('toonnaam');
|
||||
|
||||
$config['upload_path'] = $this->partituurUpload;
|
||||
$config['allowed_types'] = 'doc|docx|jpg|gif|png|pdf|txt';
|
||||
$config['max_size'] = '10000';
|
||||
$this->load->library('upload', $config);
|
||||
|
||||
$uploadresult = $this->upload->do_upload();
|
||||
|
||||
if (!$uploadresult && !$refID){
|
||||
$result = array('errors'=>json_encode($this->upload->display_errors()));
|
||||
}else{
|
||||
|
||||
if(!$uploadresult){
|
||||
$result = array('errors'=>json_encode('<p>de gegevens zijn opgeslagen</p>'));
|
||||
}else{
|
||||
//check if there is already a file (refID!=0) unlink the old file
|
||||
if($refID){
|
||||
$file = $this->ModReferenties->get_record_by_id($refID);
|
||||
if ($file) {
|
||||
if ($file->hashnaam) {
|
||||
echo "file extension ".$file->doc_extension;
|
||||
if (file_exists($this->rootpath.'/docs/'.$file->hashnaam.$file->doc_extension)) {
|
||||
unlink($this->rootpath.'/docs/'.$file->hashnaam.$file->doc_extension);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$result = array('errors'=>json_encode('<p>Uw bestand is succesvol geupload</p>'));
|
||||
|
||||
$document = $this->upload->data();
|
||||
|
||||
$this->load->helper('string');
|
||||
$newname = sha1(random_string('alnum', 16));
|
||||
|
||||
$data = array( 'naam' => $toonnaam,
|
||||
'id' => $refID,
|
||||
'docnaam' => $document['file_name'],
|
||||
'soort' => $soort,
|
||||
'srtlink' => 'file');
|
||||
|
||||
$data['doc_extension'] = $document['file_ext'];
|
||||
$data['filesize'] = $document['file_size'];
|
||||
$data['hashnaam'] = $newname;
|
||||
|
||||
$oldname = $this->rootpath.'/tmp_uploads/'.$document['file_name'];
|
||||
$newname = $this->rootpath.'/docs/'.$newname.$document['file_ext'];
|
||||
|
||||
rename($oldname, $newname);
|
||||
|
||||
$refID = $this->ModReferenties->save_record($data, $refID);
|
||||
}
|
||||
}
|
||||
}
|
||||
$data = array('result' =>$result, 'id'=>$refID );
|
||||
$this->load->view('ijkpartituur/popups/Toonuploadresult', $data) ;
|
||||
}
|
||||
|
||||
public function LSDownloadDoc(){
|
||||
if (!$this->userid) return;
|
||||
$this->load->helper('download');
|
||||
$refID= $this->uri->segment(4);
|
||||
$original='test';
|
||||
|
||||
if ($refID) {
|
||||
$file = $this->ModReferenties->get_record_by_id($refID);
|
||||
$original = $file->docnaam;
|
||||
$data = file_get_contents($this->rootpath."/docs/".$file->hashnaam.$file->doc_extension);
|
||||
force_download($original, $data);
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Extrainfo extends MY_controller {
|
||||
public $rootpath;
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('ijkpartituur/ModReferenties','');
|
||||
$this->load->model($models);
|
||||
$this->rootpath = $_SERVER['DOCUMENT_ROOT'];
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
public function index(){
|
||||
}
|
||||
public function getRefs(){
|
||||
if (!$this->userid) return;
|
||||
$type = $this->clean_input('soort');
|
||||
$zoek =$this->clean_input("zoek");
|
||||
if ($zoek === 'undefined' ) {$zoek=false ;} ;
|
||||
$refs = $this->ModReferenties->get_refs($type,$zoek);
|
||||
echo json_encode(array('refs' =>$refs,
|
||||
'admin' =>$this->super));
|
||||
}
|
||||
public function newLitRef(){
|
||||
$data["soort"]=$this->uri->segment(4);
|
||||
if ($data["soort"] <= 0 ){ $data["soort"] = 1; }
|
||||
$data["srtlink"]='ext.ref';
|
||||
$newID = $this->ModReferenties->insert_record($data);
|
||||
$ref = $this->ModReferenties->get_record_by_id($newID);
|
||||
echo json_encode($ref);
|
||||
}
|
||||
public function saveRef(){
|
||||
if (!$this->userid) return;
|
||||
|
||||
$id = $this->clean_input("id");
|
||||
$link = $this->clean_input("link");
|
||||
$srtlink = $this->clean_input("srtlink");
|
||||
if ($srtlink == "url") {
|
||||
if ( strpos($link, "http://")=== 0 or strpos($link, "https://") === 0) { }
|
||||
else {$link="http://".$link ;};
|
||||
};
|
||||
$data= array('naam' => $this->input->post("naam"),
|
||||
'link' => $link,
|
||||
'opmerking' => $this->input->post("opmerking"),
|
||||
'srtlink' => $this->input->post("srtlink"));
|
||||
$this->ModReferenties->update_record($data, $id);
|
||||
}
|
||||
public function delRef() {
|
||||
if ($this->Autorisaties_model->check_autorisaties($this->userrole, WRITER) <=0 ) return;
|
||||
$id = $this->uri->segment(4);
|
||||
//als de referentie verwijst naar een document, delete het document
|
||||
$file = $this->ModReferenties->get_record_by_id($id);
|
||||
|
||||
if ($file) {
|
||||
if ($file->hashnaam) {
|
||||
$this->load->helper("file");
|
||||
unlink($this->rootpath.'/docs/'.$file->hashnaam.$file->doc_extension);
|
||||
};
|
||||
};
|
||||
$this->ModReferenties->delete_record($id);
|
||||
}
|
||||
} // einde class Extrainfo
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Fases extends MY_controller {
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('ijkpartituur/Modfases');
|
||||
$this->load->model($models);
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
public function index(){
|
||||
}
|
||||
function getFases(){
|
||||
$fases = $this->Modfases->get_fases();
|
||||
echo json_encode($fases);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
* Description of Mensactief
|
||||
*
|
||||
* @author Theo Weijmer
|
||||
* @date juli 23, 2013
|
||||
*
|
||||
* @purpose
|
||||
*
|
||||
*/
|
||||
class Mensactief extends MY_Controller {
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('ijkpartituur/ModPartPijlers',
|
||||
'ijkpartituur/Modpartactiviteiten');
|
||||
$this->load->model($models);
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
function index(){
|
||||
$pijlers = $this->ModPartPijlers->get_details(array('partituurID'=>$this->partituurid));
|
||||
|
||||
$users = $this->Modpartactiviteiten->set_matrixusers();
|
||||
|
||||
$data = array('users'=>$users, 'pijlers'=>$pijlers);
|
||||
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Mensen extends MY_controller {
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('ijkpartituur/Modpartactiviteiten',
|
||||
'shared/Orgusers_model',
|
||||
'ijkpartituur/Modpartactxorgusers');
|
||||
$this->load->model($models);
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
public function index(){
|
||||
}
|
||||
|
||||
public function getMensen(){
|
||||
if(!$this->userid) return;
|
||||
$mensen =$this->Orgusers_model->get_org_users($this->globorgid);
|
||||
if ($mensen) {
|
||||
foreach ($mensen as $mens){
|
||||
$mens->takenC = $this->Modpartactiviteiten->get_activiteiten_per_user($mens->id);
|
||||
$mens->takenU = $this->Modpartactxorgusers->get_activiteiten_per_user($mens->id);
|
||||
};
|
||||
};
|
||||
echo json_encode($mensen);
|
||||
}
|
||||
public function deleteVer(){
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) <= 0) return;
|
||||
$aID = $this->uri->segment(4);
|
||||
$wieID = $this->uri->segment(5);
|
||||
$wat = array('verantwoordelijke' => null);
|
||||
$this->Modpartactiviteiten->update_record($wat, $aID);
|
||||
$mens =$this->Orgusers_model->get_org_user($wieID);
|
||||
$mens->takenC = $this->Modpartactiviteiten->get_activiteiten_per_user($wieID);
|
||||
$mens->takenU = $this->Modpartactxorgusers->get_activiteiten_per_user($wieID);
|
||||
echo json_encode($mens);
|
||||
}
|
||||
public function deleteUit(){
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) <= 0) return;
|
||||
$aID = $this->uri->segment(4);
|
||||
$wieID = $this->uri->segment(5);
|
||||
$where =array('activiteitID' => $aID,
|
||||
'orguserID' =>$wieID);
|
||||
$this->Modpartactxorgusers->delete_record_where($where);
|
||||
$mens = $this->Orgusers_model->get_org_user($wieID);
|
||||
$mens->takenC = $this->Modpartactiviteiten->get_activiteiten_per_user($wieID);
|
||||
$mens->takenU = $this->Modpartactxorgusers->get_activiteiten_per_user($wieID);
|
||||
echo json_encode($mens);
|
||||
}
|
||||
} //einde class Mensen
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Niveaus extends MY_controller {
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('ijkpartituur/Niveaus_model');
|
||||
$this->load->model($models);
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
public function index(){
|
||||
}
|
||||
function getNiveaus(){
|
||||
$niveaus = $this->Niveaus_model->get_niveaus();
|
||||
echo json_encode($niveaus);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Nivoprofielen extends MY_controller {
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('ijkpartituur/Nivoprofielen_model',
|
||||
'ijkpartituur/Pijlers_model',
|
||||
"ijkpartituur/ModActiviteiten",
|
||||
"ijkpartituur/Versies_model",
|
||||
'ijkpartituur/Niveaus_model');
|
||||
$this->load->model($models);
|
||||
$this->load->library('monpas/kleurcodes');
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
public function index(){
|
||||
}
|
||||
|
||||
function getNiveaus($versieID=false){
|
||||
if (!$versieID ) { $versieID = $this->globProfielVersieID; };
|
||||
$niveaus = $this->Nivoprofielen_model->get_profielen_niveaus($versieID);
|
||||
return $niveaus;
|
||||
}
|
||||
function getPijlerprofiel(){
|
||||
$nivo = $this->uri->segment(4);
|
||||
$pijlerprofiel=$this->Nivoprofielen_model->get_profielen_profiel($nivo);
|
||||
echo json_encode(array('pijlerprofiel' =>$pijlerprofiel));
|
||||
}
|
||||
function savePijlerProfiel(){
|
||||
$niveauID=$this->input->post('niveauID');
|
||||
$profielArray = $this->input->post("pijlerwaarden");
|
||||
foreach ($profielArray as $profiel){
|
||||
$data =array('niveauID' =>$niveauID,
|
||||
'pijlerID' => $profiel['pijlerID'],
|
||||
'waarde' => $profiel['waarde']);
|
||||
$id = $profiel['profielID'];
|
||||
if ($id == 0){ $this->Nivoprofielen_model->save_record($data,false); }
|
||||
else { $this->Nivoprofielen_model->save_record($data, $id); };
|
||||
}; // for each
|
||||
}
|
||||
function getVersies(){
|
||||
$versies=$this->Versies_model->get_versies();
|
||||
return $versies;
|
||||
}
|
||||
function getPijlers($versieID=false){
|
||||
if (!$versieID) {$versieID = $this->globProfielVersieID;} ;
|
||||
$versieID = 1;
|
||||
|
||||
if ($this->super ) {
|
||||
$naam="gebruikersactiviteiten" ;
|
||||
$pijlernul= array("id" => 0,
|
||||
"volgorde" => 0,
|
||||
"naam" => "Gebruikersactiviteiten/inhouden",
|
||||
"omschrijving" => 'activiteiten aangemaakt door niet-framework gebruikers');
|
||||
$pijlers=$this->Pijlers_model->get_pijlers($versieID);
|
||||
array_push($pijlers, $pijlernul);
|
||||
}
|
||||
else{
|
||||
$pijlers= array(array("id" => 0,
|
||||
"volgorde" => 0,
|
||||
"naam" => "Eigen activiteiten/inhouden",
|
||||
'omschrijving' => "activiteiten aangemaakt door de gebruikers van de eigen organisatie"));
|
||||
};
|
||||
echo json_encode($pijlers);
|
||||
}
|
||||
function getPijlers2($versieID=false){
|
||||
if (!$versieID) { $versieID = $this->globProfielVersieID;} ;
|
||||
$pijlers=$this->Pijlers_model->get_pijlers($versieID);
|
||||
return $pijlers;
|
||||
}
|
||||
function getActiviteiten(){
|
||||
$pijlerid=$this->uri->segment(4);
|
||||
$activiteiten = $this->Activiteiten_model->get_activiteiten_per_pijler(0,$pijlerid);
|
||||
echo json_encode($activiteiten);
|
||||
}
|
||||
function saveVersion(){
|
||||
$data = $this->clean_input();
|
||||
$vID = $this->clean_input('id');
|
||||
$this->Versies_model->update_record($data, $vID);
|
||||
}
|
||||
function saveNewVersion(){
|
||||
$fromID= -1;
|
||||
$copyJN=true;
|
||||
if($this->uri->segment(3) == 'false') {$copyJN= false; };
|
||||
$data=$this->clean_input();
|
||||
$laatsteVersieID=-1;
|
||||
|
||||
if ($copyJN==true){
|
||||
$laatsteVersieID = $this->Versies_model->get_laatste_record();
|
||||
$where = array("fw_versie" =>$laatsteVersieID);
|
||||
$laatsteOTypen = $this->Niveaus_model->get_last_niveaus($laatsteVersieID);
|
||||
$laatstePijlers = $this->Pijlers_model->get_last_pijlers($laatsteVersieID);
|
||||
}; // if copyjn
|
||||
$newVersieID = $this->Versies_model->insert_record($data);
|
||||
$newVersie = $this->Versies_model->get_record_by_id($newVersieID,false,true);
|
||||
//NU INSERT kopieen
|
||||
if ($copyJN==true){
|
||||
foreach($laatstePijlers as $Pijler){
|
||||
$data = array("volgorde" => $Pijler->volgorde,
|
||||
"naam" => $Pijler->naam,
|
||||
"omschrijving" =>$Pijler->omschrijving,
|
||||
"fw_versie" => $newVersieID,
|
||||
"actief" => 1 );
|
||||
$newID = $this->Pijlers_model->insert_record($data);
|
||||
if ($fromID <=-1) {$fromID=$newID;};
|
||||
$laatsteProfielen = $this->Nivoprofielen_model->get_last_profielen($Pijler->id);
|
||||
foreach($laatsteProfielen as $Profiel){
|
||||
$data = array("niveauID " => $Profiel->niveauID,
|
||||
"pijlerID" => $newID,
|
||||
"waarde" => $Profiel->waarde);
|
||||
$this->Nivoprofielen_model->insert_record($data);
|
||||
}
|
||||
}; // for each laatste Pijlers
|
||||
foreach ($laatsteOTypen as $OType){
|
||||
$data=array("nummer" => $OType->nummer,
|
||||
"omschrijving" => $OType->omschrijving,
|
||||
"fw_versie" => $newVersieID,
|
||||
"actief" =>1);
|
||||
$newID = $this->Niveaus_model->insert_record($data);
|
||||
$this->Nivoprofielen_model->update_niveau($OType->id, $newID,$fromID);
|
||||
}; // for each OTypen
|
||||
};
|
||||
echo json_encode(array('newVersie'=>$newVersie));
|
||||
}
|
||||
|
||||
function deleteVersion(){
|
||||
if(!$this->Autorisaties_model->check_autorisatie($this->user_role, SUPERUSER) <=0) return;
|
||||
$ID = $this->uri->segment(4);
|
||||
// delete Niveaus
|
||||
$where = array("fw_versie" =>$ID);
|
||||
$this->Niveaus_model->delete_record_where($where);
|
||||
//delete profielen, zoek eerst de pijlers, verwijder dan de profielen
|
||||
$Pijlers =$this->Pijlers_model->get_records_where($where);
|
||||
foreach($Pijlers as $Pijler) {
|
||||
$where= array("pijlerID" =>$Pijler->id);
|
||||
$this->Nivoprofielen_model->delete_record_where($where);
|
||||
}; // foreach
|
||||
$where= array("fw_versie" =>$ID);
|
||||
$this->Pijlers_model->delete_record_where($where);
|
||||
$this->Versies_model->delete_record($ID);
|
||||
}
|
||||
function GetAll(){
|
||||
if(!$this->Autorisaties_model->check_autorisatie($this->user_role, SUPERUSER) <=0) return;
|
||||
|
||||
$versieID = $this->uri->segment(4);
|
||||
$versies='';
|
||||
if ($versieID == 0) {
|
||||
$versies = $this->getVersies();
|
||||
$versieID = $versies[0]->id;
|
||||
};
|
||||
|
||||
$niveaus = $this->getNiveaus($versieID);
|
||||
$pijlers = $this->getPijlers2($versieID);
|
||||
$kleurcodes = $this->kleurcodes->getkleurcodesfromdatabase();
|
||||
echo json_encode(array( 'versies' =>$versies,
|
||||
'niveaus' =>$niveaus,
|
||||
'pijlers' =>$pijlers,
|
||||
"kleurcodes"=> $kleurcodes));
|
||||
}
|
||||
function DeleteNiveaus(){
|
||||
$NiveauID = $this->uri->segment(4);
|
||||
//1. delete pijlerprofielen
|
||||
$where= array("niveauID" =>$NiveauID);
|
||||
$this->Nivoprofielen_model->delete_record_where($where);
|
||||
//2. delete niveau
|
||||
$this->Niveaus_model->delete_record($NiveauID);
|
||||
}
|
||||
function AddNiveau(){
|
||||
$where=array( 'nummer' => $this->clean_input("nummer"),
|
||||
"omschrijving" => $this->clean_input("omschrijving"),
|
||||
"fw_versie" => $this->clean_input("versie"),
|
||||
'actief' => 1);
|
||||
$newID = $this->Niveaus_model->insert_record($where);
|
||||
$newRecord = $this->Niveaus_model->get_record_by_id($newID);
|
||||
echo json_encode($newRecord);
|
||||
}
|
||||
function SaveNiveau(){
|
||||
$id = $this->clean_input("id");
|
||||
$data = array("nummer" => $this->clean_input('nummer'),
|
||||
"omschrijving" => $this->clean_input('omschrijving') );
|
||||
$this->Niveaus_model->update_record($data,$id);
|
||||
}
|
||||
function DeletePijler(){
|
||||
// verwijder eerst het bijbehorende pijlerprofiel
|
||||
// verwijder dan de pijler
|
||||
$niveauID = $this->uri->segment(5);
|
||||
$pijlerID = $this->uri->segment(4);
|
||||
$where =array("niveauID" => $niveauID,
|
||||
"pijlerID" => $pijlerID);
|
||||
$this->Niovprofielen_model->delete_record_where($where);
|
||||
$this->Pijlers_model->delete_record($pijlerID);
|
||||
}
|
||||
function SavePIJler(){
|
||||
$id = $this->input->post("id");
|
||||
$data=array('volgorde' =>$this->clean_input("volgorde"),
|
||||
'naam' => $this->clean_input("naam"));
|
||||
$this->Pijlers_model->update_record($data, $id);
|
||||
}
|
||||
function SaveProfiel(){
|
||||
$id = $this->input->post("id");
|
||||
$data=array('waarde' =>$this->input->post("waarde") );
|
||||
$this->Nivoprofielen_model->update_record($data, $id);
|
||||
}
|
||||
function AddPijler(){
|
||||
// add de pijler en add dan, indien nodig het rocrd voor profiel
|
||||
$where=array( 'volgorde' => $this->clean_input("volgorde"),
|
||||
"naam" => $this->clean_input("pijlernaam"),
|
||||
"fw_versie" => $this->clean_input("versie"));
|
||||
$newID = $this->Pijlers_model->insert_record($where);
|
||||
$newRecord = $this->Pijlers_model->get_record_by_id($newID);
|
||||
if ($this->input->post("niveauID") > 0){
|
||||
$where=array("niveauID" => $this->input->post("niveauID" ),
|
||||
"pijlerID" => $newID,
|
||||
'waarde ' => 1);
|
||||
$newProfID = $this->Nivoprofielen_model->insert_record($where);
|
||||
$newRecord->profielID = $newProfID;
|
||||
};
|
||||
echo json_encode($newRecord);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,491 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Partituur extends MY_Controller {
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('ijkpartituur/Autorisaties_model',
|
||||
'ijkpartituur/Partituurs_model',
|
||||
'shared/Users_model',
|
||||
'ijkpartituur/Eigenpijlers_model',
|
||||
'ijkpartituur/ModPartPijlers',
|
||||
'ijkpartituur/Niveaus_model',
|
||||
'ijkpartituur/Pages_model',
|
||||
'ijkpartituur/Eigenpijlers_model',
|
||||
'ijkpartituur/Part_eigenpijlers_model',
|
||||
'ijkpartituur/Nivoprofielen_model',
|
||||
'ijkpartituur/ModPijlers',
|
||||
"ijkpartituur/Modpartactiviteiten",
|
||||
'ijkpartituur/ModPartEigenActiviteiten',
|
||||
'ijkpartituur/ModRuweScores',
|
||||
'ijkpartituur/Modhelpdesk',
|
||||
"monpas/Ijkpunten_model",
|
||||
"monpas/Wenssituaties_model");
|
||||
$this->load->model($models);
|
||||
$this->load->library('monpas/kleurcodes');
|
||||
if(!$this->userid) return;
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
/**
|
||||
* Index Page for this controller.
|
||||
*/
|
||||
|
||||
public function index(){
|
||||
|
||||
$partituur = $this->get_active_partituur($this->globorgid);
|
||||
$profielen = $this->get_profielen();
|
||||
$medewerkers = $this->Users_model->get_users_by_organisatie($this->globorgid);
|
||||
$schoolmeterpijlers = $this->ModPijlers->get_pijlers($this->globProfielVersieID);
|
||||
$ExistsAct = false;
|
||||
$magNieuw = $this->writer;
|
||||
$isactievepart = false;
|
||||
if(!$partituur){
|
||||
//TODO: procedure om een nieuwe partituur aan te maken middels koppeling of schakelprogramma
|
||||
//echo json_encode(array('status'=>FALSE));
|
||||
//return;
|
||||
|
||||
if ($this->globorgid == SYSTEM){$status= TRUE;}
|
||||
else { $status=FALSE;}
|
||||
$partituurID='';
|
||||
}
|
||||
else {
|
||||
$status = TRUE;
|
||||
$partituurID=$partituur->id;
|
||||
$where=array('partituurID' => $partituur->id);
|
||||
$ExistsAct = $this->Modpartactiviteiten->check_for_record($where);
|
||||
$isactievepart = $partituur->actief;
|
||||
|
||||
}
|
||||
$mes1=$this->lang->line("mes-geenactievepartituur");
|
||||
$mes2=$this->lang->line("mes-geenrechten");
|
||||
$mes3=$this->lang->line('mes-ukuntnietverder');
|
||||
$mes4=$this->lang->line('mes-gegevensinvullen');
|
||||
$mes5=$this->lang->line('mes-startdatumvooreinddatum');
|
||||
$kleuren = $this->kleurcodes->getkleurcodesfromdatabase();
|
||||
|
||||
echo json_encode(array('status' => $status ,
|
||||
'partituurID' => $partituurID,
|
||||
'profielen' => $profielen,
|
||||
"schoolmeterpijlers" => $schoolmeterpijlers,
|
||||
'medewerkers' => $medewerkers,
|
||||
'write' => $this->writer,
|
||||
'allowDelete' => !$ExistsAct,
|
||||
'magNieuw' =>$magNieuw,
|
||||
'isactievepart' =>$isactievepart,
|
||||
'mes1' =>$mes1,
|
||||
'mes2' =>$mes2,
|
||||
'mes3' =>$mes3,
|
||||
'mes4' =>$mes4,
|
||||
'mes5' =>$mes5,
|
||||
'mes6' =>$this->lang->line('mes-startdatumaanpassen'),
|
||||
'mes7' =>$this->lang->line('mes-einddatumaanpassen') ,
|
||||
'mes8' =>$this->lang->line('mes-startdatuminvullen' ),
|
||||
'mes9' =>$this->lang->line('mes-einddatuminvullen'),
|
||||
'mes10' =>$this->lang->line('mes-geentoegang'),
|
||||
'mes11' =>$this->lang->line('mes-heelgetalinvullen'),
|
||||
'mes12' =>$this->lang->line('mes-nieuwenaam'),
|
||||
'mes13' =>$this->lang->line('mes-weetuzekerpartituur'),
|
||||
'mes14' =>$this->lang->line('mes-geengegevenswijzigen'),
|
||||
'mes15' =>$this->lang->line('mes-emailvervangen'),
|
||||
'mes16' =>$this->lang->line('mes-weetuzekerpartituurverwijderen'),
|
||||
'lbl1' =>$this->lang->line('lbl-partituurnaam'),
|
||||
'lbl2' =>$this->lang->line('lbl-startdatum'),
|
||||
'lbl3' =>$this->lang->line('lbl-einddatum'),
|
||||
'lbl4' =>$this->lang->line('lbl-scorevoor'),
|
||||
'lblja' =>$this->lang->line('lbl-ja'),
|
||||
'lblnee' =>$this->lang->line('lbl-nee'),
|
||||
'kleuren' =>$kleuren
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function WhichPagina(){
|
||||
if ($this->partituurid){
|
||||
$where=array("id" => $this->partituurid);
|
||||
$partituur = $this->Partituurs_model->get_fieldvalue($where, 'partituur_actief');
|
||||
}
|
||||
else {
|
||||
$where = array('partituur_organisatie_id'=>$this->globorgid, 'partituur_actief'=>1);
|
||||
$partituur = $this->Partituurs_model->get_single_details($where);
|
||||
}
|
||||
if ($partituur) {
|
||||
$ans = 3;
|
||||
}else{
|
||||
$ans = 2;
|
||||
// set het menu
|
||||
};
|
||||
$systemyesno = 0;
|
||||
if ($this->globorgid == SYSTEM) {$systemyesno = 1;};
|
||||
echo json_encode(array("pagina" =>$ans,
|
||||
"partID" =>$this->partituurid,
|
||||
"systemyesno" => $systemyesno)) ;
|
||||
}
|
||||
|
||||
public function get_submenu(){
|
||||
$menu = $this->Pages_model->get_usermenu_ls($this->userrole,0);
|
||||
echo json_encode(array('menu'=>$menu));
|
||||
}
|
||||
|
||||
public function check_session(){
|
||||
echo json_encode(array('session'=>$this->userid));
|
||||
}
|
||||
public function helpdeskinfo(){
|
||||
$info = $this->Modhelpdesk->get_helpdesk();
|
||||
echo json_encode($info);
|
||||
}
|
||||
|
||||
|
||||
public function resetVars (){
|
||||
$partituurID = $this->uri->segment(4);
|
||||
$where = array('partituurID' => $partituurID);
|
||||
$ExistsAct = $this->Modpartactiviteiten->check_for_record($where);
|
||||
$kosten = $this->Modpartactiviteiten->get_sum_kosten($partituurID);
|
||||
$gereed = $this->Modpartactiviteiten->get_gem_gereed($partituurID);
|
||||
$where =array("partituurID" =>$partituurID);
|
||||
$num =$this->Modpartactiviteiten->check_for_record($where);
|
||||
$allowchange = !$num;
|
||||
$num = $this->ModPartEigenActiviteiten->check_for_record($where);
|
||||
if ($num) {$allowchange = false;};
|
||||
echo json_encode(array( "allowDelete" => !$ExistsAct,
|
||||
'allowChange' =>$allowchange,
|
||||
"kosten" => $kosten,
|
||||
"gereed" => $gereed
|
||||
));
|
||||
}
|
||||
public function getPartituurActief(){
|
||||
$partituurid = $this->uri->segment(4);
|
||||
$actiefJN = 0;
|
||||
if ($partituurid > 0) {
|
||||
$where=array("id" =>$partituurid);
|
||||
$actiefJN = $this->Partituurs_model->get_fieldvalue ($where, 'partituur_actief');
|
||||
};
|
||||
if ($this->globorgid == SYSTEM){$actiefJN = 2;}
|
||||
echo json_encode($actiefJN);
|
||||
}
|
||||
|
||||
public function get_partituur(){
|
||||
$partituurid= $this->uri->segment(4);
|
||||
$data['status'] = FALSE;
|
||||
if($this->Autorisaties_model->check_partituur_access($partituurid, 1)){
|
||||
$data['status'] = TRUE;
|
||||
$data['write'] = $this->Autorisaties_model->check_partituur_access($partituurid, 2);
|
||||
|
||||
$data['partituur'] = $this->Partituurs_model->get_single_details(array('id'=>$partituurid));
|
||||
$data['magnieuw'] =$data['write'];
|
||||
if (! $data['partituur']->actief) {$data['write'] = false;};
|
||||
$data['isactievepart'] =$data['partituur']->actief;
|
||||
$where =array("partituurID" =>$partituurid);
|
||||
$num =$this->Modpartactiviteiten->check_for_record($where);
|
||||
$data['allowchange'] = !$num;
|
||||
$num = $this->ModPartEigenActiviteiten->check_for_record($where);
|
||||
if ($num) {$data['allowchange'] = false;};
|
||||
$data['partituur']->kosten = $this->Modpartactiviteiten->get_sum_kosten($partituurid);
|
||||
$data['partituur']->gereed = $this->Modpartactiviteiten->get_gem_gereed($partituurid);
|
||||
$data['pijlers'] = $this->ModPartPijlers->get_joined_details($partituurid);
|
||||
$data['partituren'] = $this->Partituurs_model->get_details(array('partituur_organisatie_id'=>$this->globorgid));
|
||||
$data['ruwescores'] =$this->ModRuweScores->get_scores($partituurid);
|
||||
}
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
// public function get_ruwe_sopscore(){
|
||||
// $url = 'http://www.framework-ed.nl/schakel/profiel_search.asp?School_ID=2908';
|
||||
// $curl = curl_init();
|
||||
|
||||
// curl_setopt_array($curl, array(
|
||||
// CURLOPT_RETURNTRANSFER => 1,
|
||||
// CURLOPT_URL => $url
|
||||
// ));
|
||||
|
||||
// $ruwescore = curl_exec($curl);
|
||||
|
||||
// $scores = explode('[', $ruwescore);
|
||||
// $score = '['.$scores[1];
|
||||
|
||||
// curl_close($curl);
|
||||
|
||||
// echo $score;
|
||||
// }
|
||||
|
||||
function get_partituren(){
|
||||
$data['partituren'] = $this->Partituurs_model->get_details(array('partituur_organisatie_id'=>$this->globorgid));
|
||||
echo json_encode($data);
|
||||
}
|
||||
public function get_unused_pijlers(){
|
||||
$partID = $this->uri->segment(3);
|
||||
$pijlers = $this->Eigenpijlers_model->get_pijlers_not_in_partituur($this->globorgid, $partID);
|
||||
echo json_encode(array("unusedpijlers"=>$pijlers));
|
||||
}
|
||||
|
||||
public function save_profiel(){
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole,WRITER) <=0) return;
|
||||
$status = FALSE;
|
||||
$partituurID= $this->clean_input("partituurID");
|
||||
$profielen = $this->clean_input('profiel');
|
||||
if($profielen){
|
||||
if($this->Autorisaties_model->check_partituur_access($partituurID, 1)){
|
||||
$status = TRUE;
|
||||
foreach($profielen as $profiel){
|
||||
$pijler = $this->ModPartPijlers->get_record_by_id($profiel['id']);
|
||||
if($profiel['huidig']!=$pijler->huidigniveau || $profiel['gewenst']!=$pijler->gewenstniveau){
|
||||
$data = array( 'huidigniveau' => $profiel['huidig'] ,
|
||||
'gewenstniveau' => $profiel['gewenst'] );
|
||||
$this->ModPartPijlers->update_record($data, $profiel['id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo json_encode(array('status'=>$status));
|
||||
}
|
||||
|
||||
public function get_standaard() {
|
||||
$profielid = $this->uri->segment(4);
|
||||
$partituurid= $this->uri->segment(5);
|
||||
|
||||
$status = FALSE;
|
||||
|
||||
if($this->Autorisaties_model->check_partituur_access($partituurid, 1)){
|
||||
$status = TRUE;
|
||||
$standaards = $this->Nivoprofielen_model->get_records_where(array('niveauID'=>$profielid));
|
||||
|
||||
}
|
||||
echo json_encode(array('status'=>$status, 'standaards'=>$standaards));
|
||||
}
|
||||
|
||||
public function opslaan_pleider(){
|
||||
$partituurid= $this->clean_input('partituurID');
|
||||
$pleiderid = $this->clean_input('pleiderID');
|
||||
|
||||
$status = FALSE;
|
||||
|
||||
if($this->Autorisaties_model->check_partituur_access($partituurid, 1)){
|
||||
$status = TRUE;
|
||||
$email = $this->Users_model->get_record_by_id($pleiderid, 'email',true);
|
||||
|
||||
$data = array('partituur_projectleider_id'=>$pleiderid);
|
||||
$this->Partituurs_model->update_record($data, $partituurid);
|
||||
}
|
||||
|
||||
echo json_encode(array("email"=>$email, "status"=>$status));
|
||||
}
|
||||
|
||||
public function opslaan_email(){
|
||||
$status = FALSE;
|
||||
|
||||
if($this->Autorisaties_model->check_partituur_access($partituurid, 1)){
|
||||
$status = TRUE;
|
||||
$partituurid= $this->clean_input('partituurID');
|
||||
$email = $this->clean_input('email');
|
||||
|
||||
$data = array('partituur_email'=>$email);
|
||||
$this->Partituurs_model->update_record($data, $partituurid);
|
||||
}
|
||||
|
||||
echo json_encode(array('status'=>$status));
|
||||
}
|
||||
|
||||
public function opslaan_dates(){
|
||||
$status = FALSE;
|
||||
$errorstr ='';
|
||||
$partituurid= $this->clean_input('partituurID');
|
||||
if($this->Autorisaties_model->check_partituur_access($partituurid, 1)){
|
||||
|
||||
$start = date2mysql($this->clean_input('vandatum'));
|
||||
$eind = date2mysql($this->clean_input('tmdatum'));
|
||||
// check of de nieuwe data kunnen, geven pijlerdata
|
||||
$MinMax = $this->ModPartPijlers->get_minmax_dag($partituurid);
|
||||
if ($MinMax[0]->mindag < $start) {
|
||||
$errorstr = 'startdatum moet kleiner of gelijk aan '.mysql2date($MinMax[0]->mindag).' zijn;';
|
||||
$start = $MinMax[0]->mindag; };
|
||||
|
||||
if ($MinMax[0]->maxdag > $eind){
|
||||
$errorstr .= ' einddatum moet groter of gelijk aan '.mysql2date($MinMax[0]->maxdag).' zijn.';
|
||||
$eind = $MinMax[0]->maxdag; };
|
||||
|
||||
$data = array('partituur_start'=>$start, 'partituur_eind'=>$eind);
|
||||
$this->Partituurs_model->update_record($data, $partituurid);
|
||||
echo json_encode(array('start' => mysql2date($start),
|
||||
'eind' => mysql2date($eind),
|
||||
'errorstr' => $errorstr));
|
||||
}
|
||||
else { echo json_encode(false); };
|
||||
}
|
||||
|
||||
function save_new_eigenpijler(){
|
||||
$status = $eigenpijlers = FALSE;
|
||||
$partituurid= $this->clean_input('partituurid');
|
||||
if($this->Autorisaties_model->check_partituur_access($partituurid, 1)){
|
||||
$status = TRUE;
|
||||
$pijlernaam = $this->clean_input('pijlernaam');
|
||||
$data = array('eigenpijler_naam'=>$pijlernaam, 'orgID'=>$this->globorgid);
|
||||
$newID = $this->Eigenpijlers_model->insert_record($data);
|
||||
$eigenpijlers = $this->Eigenpijlers_model->get_pijlers_not_in_partituur($this->globorgid, $partituurid);
|
||||
}
|
||||
|
||||
echo json_encode(array('status'=>$status, 'eigenpijlers'=>$eigenpijlers));
|
||||
}
|
||||
public function insert_eigen_pijlers(){
|
||||
$IDlijst = $this->clean_input('insertpijlerIDs');
|
||||
$partID = $this->clean_input('partituurID');
|
||||
foreach ($IDlijst as $newID) {
|
||||
$data= array("partituurID" => $partID,
|
||||
"eigenpijlerID" => $newID);
|
||||
$this->Part_eigenpijlers_model->insert_record($data);
|
||||
}
|
||||
echo json_encode(true);
|
||||
}
|
||||
private function get_active_partituur($orgid ){
|
||||
$where = array('partituur_organisatie_id'=>$orgid, 'partituur_actief'=>1);
|
||||
$partituur = $this->Partituurs_model->get_single_details($where);
|
||||
return $partituur;
|
||||
}
|
||||
|
||||
private function get_profielen(){
|
||||
$profielen = $this->Niveaus_model->get_details(array('actief'=>1, 'fw_versie' =>$this->globProfielVersieID));
|
||||
return $profielen;
|
||||
}
|
||||
public function getActievePartituur(){
|
||||
$where=array("partituur_organisatie_id" =>$this->globorgid,
|
||||
"partituur_actief" => 1);
|
||||
$partituur = $this->Partituurs_model->get_records_where($where,TRUE);
|
||||
echo json_encode($partituur);
|
||||
}
|
||||
|
||||
|
||||
// del_pijlers zorgt dat geselecteerde eigen pijler binnen de partituur worden verwijderd. De eigen pijlers worden dus niet uit tb_eigenpijlers verwijderd.
|
||||
|
||||
function del_pijlers(){
|
||||
//del pijlers krijgt een array van IDs van (eigen) pijlers die deleted
|
||||
//moeten worden. als aan een pijler geen activiteiten oid hangen, mag de pijler uit de db verwijderd worden.
|
||||
// anders hoeft er, wat betreft de db niets met de pijler te gebeuren
|
||||
//mag succes of failure teruggeven
|
||||
$delIDs = $this->input->post("eigenPijlerIds");
|
||||
foreach ($delIDs as $delID){
|
||||
$this->Part_eigenpijlers_model->delete_record($delID);
|
||||
}
|
||||
echo json_encode("true");
|
||||
}
|
||||
function del_eigen_pijlers(){
|
||||
// del eigen pijlers moet de eigen pijlers daadwerkelijk verwijderen.
|
||||
//in de function del_pijlers worden de pijlers uit de partituur verwijderd
|
||||
// deze functie verwijderd de eigenpijlers dus uit de db
|
||||
// dit mag alleen als de pijler niet gebruikt wordt in een partituur
|
||||
$delIDs = $this->input->post('eigenPijlerIds');
|
||||
$partID = $this->input->post('partituurID');
|
||||
foreach($delIDs as $delID){
|
||||
$where=array('eigenpijlerID' =>$delID);
|
||||
if($this->Part_eigenpijlers_model->get_result_count($where) <= 0){$this->Eigenpijlers_model->delete_record($delID) ;} ;
|
||||
};
|
||||
// haal de resterende eigenpijlers op en return deze
|
||||
$eigenpijlers= $this->Eigenpijlers_model->get_pijlers_not_in_partituur($this->globorgid, $partID);
|
||||
echo json_encode($eigenpijlers);
|
||||
}
|
||||
function del_partituur(){
|
||||
// moet de na delete meest recente partituur id teruggeven of -1
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) <=0) return;
|
||||
$partituurID=$this->uri->segment(4);
|
||||
// delete pijlers in partituur
|
||||
// als er activiteiten zijn mag de partiuur niet verwijderd worden.
|
||||
$where = array("partituurID" => $partituurID);
|
||||
$ExistsAct = $this->Modpartactiviteiten->check_for_record($where);
|
||||
if ($ExistsAct) {
|
||||
echo json_encode(0);
|
||||
}
|
||||
else {
|
||||
$this->ModPartPijlers->delete_record_where(array("partituurID" =>$partituurID));
|
||||
$this->Partituurs_model->delete_record($partituurID);
|
||||
$activeID=$this->get_active_partituur($this->globorgid);
|
||||
echo json_encode($activeID);
|
||||
};
|
||||
}
|
||||
function getscores(){
|
||||
$ovid = $this->clean_input("ovid");
|
||||
$scores = $this->Ijkpunten_model->getscores($ovid, $this->globorgid);
|
||||
echo json_encode($scores);
|
||||
}
|
||||
function nieuwe_partituur(){
|
||||
// functie krijgt via post een submitData arrray binnen met naam, vandatum, tmdatum en een json array met scores (id, naam, en waarde)
|
||||
// naam moet zijn ingevuld. vandatum en tmdatum mogen NIET undefined zijn
|
||||
// vanuit de opgegeven scores moet bepaald worden wat de pijlerwaarden (1 tm 5) zijn
|
||||
// functie moet als antwoord het ID van de nieuwe partituur geven.
|
||||
//daarnaast moet gekeken worden of bij de versie een wenssituatie is gemaakt. Deze wenssituatie moet
|
||||
// ook overgenomen worden naar de partituur.
|
||||
$oldpartituur = $this->clean_input("oldpartituur");
|
||||
$newnaam = $this->clean_input('naam');
|
||||
$vandatum = date2mysql($this->clean_input("vandatum") );
|
||||
$tmdatum = date2mysql($this->clean_input('tmdatum'));
|
||||
$versieid = $this->clean_input("versieid");
|
||||
$ovid = $this->clean_input("ovid");
|
||||
$scores = $this->Ijkpunten_model->getscores($ovid, $this->globorgid);
|
||||
|
||||
$data= array( 'partituur_organisatie_id'=> $this->globorgid ,
|
||||
'partituur_naam' => $newnaam,
|
||||
'partituur_actief' => 1,
|
||||
'partituur_start' => $vandatum,
|
||||
'partituur_eind' => $tmdatum);
|
||||
$newPID=$this->Partituurs_model->insert_record($data);
|
||||
$wenssituaties = $this->Wenssituaties_model->getgewenstvoorpartituur($ovid,$this->globorgid);
|
||||
foreach($scores as $score) {
|
||||
$waarde = 1;
|
||||
$res= round($score->somscore / $score->num);
|
||||
$waarde= $this->kleurcodes->getnummer($res);
|
||||
|
||||
switch ($score->nummer){
|
||||
case 1: $pijlerid = 1; break;
|
||||
case 2: $pijlerid = 2; break;
|
||||
case 3: $pijlerid = 3; break;
|
||||
case 4: $pijlerid = 4; break;
|
||||
case 5: $pijlerid = 5; break;
|
||||
case 6: $pijlerid = 6; break;
|
||||
case 7: $pijlerid = 7; break;
|
||||
case 8: $pijlerid = 8; break;
|
||||
case 9: $pijlerid = 9; break;
|
||||
case 10 : $pijlerid = 10; break;
|
||||
case 11 : $pijlerid = 11; break;
|
||||
case 12: $pijlerid = 12; break;
|
||||
case 13: $pijlerid = 13; break;
|
||||
}
|
||||
$gewenstniveau = 5;
|
||||
if ($wenssituaties){
|
||||
foreach($wenssituaties as $wens){
|
||||
if ($wens->nummer == $pijlerid) {
|
||||
$gewenstniveau =$wens->wens;
|
||||
break;
|
||||
} ; //if
|
||||
};
|
||||
};
|
||||
$data= array('partituurID' => $newPID,
|
||||
'pijlerID' => $pijlerid,
|
||||
'huidigniveau' => $waarde,
|
||||
'gewenstniveau' => $gewenstniveau,
|
||||
'start' =>$vandatum,
|
||||
'eind' =>$tmdatum);
|
||||
$this->ModPartPijlers->insert_record($data) ;
|
||||
$data2= array( "orgID" =>$this->globorgid,
|
||||
"partituurID" =>$newPID,
|
||||
"pijlerID" =>$pijlerid,
|
||||
"score" =>$res );
|
||||
$this->ModRuweScores->insert_record($data2);
|
||||
};
|
||||
$data=array('partituur_actief' => 0);
|
||||
if ($oldpartituur) {
|
||||
$this->Partituurs_model->update_record($data, $oldpartituur);
|
||||
};
|
||||
echo json_encode(array('id'=>$newPID));
|
||||
}
|
||||
public function setNaam (){
|
||||
if($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) <=0) return;
|
||||
$partID = $this->clean_input('id');
|
||||
$naam = $this->clean_input('naam');
|
||||
$data=array("partituur_naam" =>$naam);
|
||||
$this->Partituurs_model->update_record($data,$partID);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,526 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Planning extends MY_controller {
|
||||
public $rootpath;
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array('ijkpartituur/ModActiviteiten',
|
||||
'ijkpartituur/ModAgenda',
|
||||
'ijkpartituur/Modhulpmiddelen',
|
||||
'ijkpartituur/Modfases',
|
||||
'ijkpartituur/ModKosten',
|
||||
'ijkpartituur/ModActDoel',
|
||||
'ijkpartituur/ModActHulp',
|
||||
'ijkpartituur/Modpartactiviteiten',
|
||||
'ijkpartituur/ModPartPijlers',
|
||||
'shared/Orgusers_model',
|
||||
'shared/Users_model',
|
||||
'ijkpartituur/ModPartActxHulpmiddel',
|
||||
'ijkpartituur/ModPartActxDoelgroep',
|
||||
'ijkpartituur/Modpartactxorgusers',
|
||||
'ijkpartituur/ModPartActKosten',
|
||||
'ijkpartituur/ModPartActResultaten' ,
|
||||
'ijkpartituur/Partituurs_model',
|
||||
'ijkpartituur/ModAgenda',
|
||||
'ijkpartituur/ModPortfolio');
|
||||
$this->load->model($models);
|
||||
$this->rootpath = str_replace('/public', '', $_SERVER['DOCUMENT_ROOT']);
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
public function index(){
|
||||
}
|
||||
function getActiviteitenPerPijler(){
|
||||
//TODO haal alleen de activiteiten op die nog niet zijn opgenomen in de partituur
|
||||
// inclusief eigen activiteiten
|
||||
$partID= $this->uri->segment(4);
|
||||
$pijler = $this->uri->segment(5);
|
||||
|
||||
$actSet= $this->ModActiviteiten->get_partituur_activiteiten_per_pijler($partID, $pijler);
|
||||
if ($actSet) {
|
||||
// dus hieronder moeten alle partact worden vervangen door activiteit zelf!!
|
||||
foreach ($actSet as $activiteit) {
|
||||
$activiteit->actKosten = $this->ModKosten->get_kosten_per_activiteit($activiteit->id);
|
||||
$activiteit->actDoelgroepen = $this->ModActDoel->get_doelgroepen_per_act($activiteit->id);
|
||||
$activiteit->actHulpmiddelen = $this->Modhulpmiddelen->get_hulpmiddelenlijst_per_activiteit($activiteit->id);
|
||||
};
|
||||
};
|
||||
echo json_encode($actSet);
|
||||
}
|
||||
function getPlanning (){
|
||||
// $partituurID kan null zijn! id wordt meegegeven in de url . als de id 0 is moet de meest recente partituur opgehaald worden
|
||||
$partID= $this->partituurid;
|
||||
$where=array("partituur_actief" => 1, 'partituur_organisatie_id' =>$this->globorgid);
|
||||
$partituur= $this->Partituurs_model->get_records_where($where,TRUE,FALSE);
|
||||
$partID=$partituur->id;
|
||||
|
||||
$Npijlers=$this->ModPartPijlers->get_pijlers_per_partituur($partID);
|
||||
|
||||
foreach($Npijlers as $pijler){
|
||||
$pijler->start=date('d-m-Y', strtotime($pijler->start));
|
||||
$pijler->eind=date('d-m-Y', strtotime($pijler->eind));
|
||||
$pijler->taakLijst = $this->Modpartactiviteiten->get_taaklijst($pijler->id);
|
||||
if ($pijler->taakLijst ) {
|
||||
foreach($pijler->taakLijst as $taak){
|
||||
$taak->start=date('d-m-Y', strtotime($taak->start));
|
||||
$taak->eind=date('d-m-Y', strtotime($taak->eind));
|
||||
};
|
||||
}; // if not empty
|
||||
}
|
||||
|
||||
// lijst van medewerkers
|
||||
if ($this->globisbg) { $medewerkers = $this->Users_model->get_users_by_bg($this->globorgid);}
|
||||
else {$medewerkers = $this->Users_model->get_users_by_organisatie($this->globorgid); };
|
||||
// als sprake is van BG moeten per school de medewerkers worden opgehaald
|
||||
$fasen = $this->Modfases->get_fases();
|
||||
|
||||
echo json_encode(array('partituur' =>$partituur,
|
||||
'taken' => $Npijlers,
|
||||
'fasen' =>$fasen,
|
||||
'medewerkers' => $medewerkers,
|
||||
'canWrite' =>$this->writer,
|
||||
'canWriteOnParent'=> true,
|
||||
'selectedRow' =>1));
|
||||
}
|
||||
|
||||
function getGantt($partID) {
|
||||
// de datum wordt in miliseconden sinds 1970 verwacht
|
||||
$pijlers = $this->ModPartPijlers->get_pijlers_per_partituur($partID);
|
||||
$info=array();
|
||||
foreach ($pijlers as $pijler){
|
||||
array_push($info, $pijler);
|
||||
$pijleracts =$this->Modpartactiviteiten->get_activiteiten_per_partituur($partID, $pijler->id);
|
||||
if (! empty($pijleracts)) {
|
||||
foreach ($pijleracts as $act){
|
||||
array_push($info,$act);
|
||||
};
|
||||
}; // if
|
||||
};
|
||||
// zet alle data om in format dd-mm-yyyy
|
||||
foreach($info as $entry){
|
||||
$entry->start=date('d-m-Y', strtotime($entry->start));
|
||||
$entry->end=date('d-m-Y', strtotime($entry->end));
|
||||
}
|
||||
return $info;
|
||||
}// einde function getGanttInfo
|
||||
|
||||
|
||||
function getTaakInfo(){
|
||||
$taakid=$this->uri->segment(4);
|
||||
$taak =$this->Modpartactiviteiten->get_taak_info($taakid);
|
||||
$where=array('id' =>$taak->afhankelijkvanID);
|
||||
$taak->afhankelijkvanNaam =$this->Modpartactiviteiten->get_fieldvalue($where,'naam');
|
||||
|
||||
//get de hulpmiddelen bij deze taak
|
||||
$taak->hulpmiddelen=$this->ModPartActxHulpmiddel->get_hulpmiddelenlijst_per_activiteit($taakid, false);
|
||||
// get een lijst van orgusers (inclusief fullname) waaruit de verantwoordelijke gekozen mag worden
|
||||
|
||||
$taak->orgusers = $this->Orgusers_model->get_org_users($this->globorgid);
|
||||
|
||||
$taak->uitvoerenden = $this->Modpartactiviteiten->get_uitvoerenden_per_activiteit($taakid);
|
||||
$taak->overigeusers = $this->Modpartactiviteiten->get_overige_users_per_activiteit($taakid, $this->globorgid);
|
||||
$taak->doelgroepen = $this->ModPartActxDoelgroep->get_doelgroepen_per_act($taakid);
|
||||
$taak->kosten = $this->ModPartActKosten->get_kosten_per_activiteit($taakid);
|
||||
//get de documenten/notes bij deze activiteit
|
||||
$notes = $this->ModPortfolio->get_notes($taakid);
|
||||
|
||||
echo json_encode(array('taak'=>$taak, 'notes'=>$notes));
|
||||
}
|
||||
function DownloadNote (){
|
||||
$this->load->helper('download');
|
||||
$docid = $this->uri->segment(4);
|
||||
$original='test';
|
||||
|
||||
$file = $this->ModPortfolio->get_record_by_id($docid);
|
||||
$original = $file->docnaam;
|
||||
$data = file_get_contents("../docs/".$file->hashnaam.$file->doc_extension);
|
||||
|
||||
force_download($original, $data);
|
||||
}
|
||||
function DeleteNote(){
|
||||
$nID = $this->uri->segment(4);
|
||||
$file = $this->ModPortfolio->get_record_by_id($nID);
|
||||
|
||||
if ($file) {
|
||||
if ($file->hashnaam) {
|
||||
$this->load->helper("file");
|
||||
unlink('../docs/'.$file->hashnaam.$file->doc_extension);
|
||||
};
|
||||
};
|
||||
$this->ModPortfolio->delete_record($nID);
|
||||
}
|
||||
function addTaak (){
|
||||
//krijgt via submitData 4 vars binnen: partituurID, part-pijlerID, newTaakID, positie ('voor of na") en volgorde (dwz voor of na dit sequentienummer)
|
||||
// moet volgorde van alle activiteiten (onder een pijler) zo aanpassen dat die weer klopt
|
||||
// gegeven de nieuwe pijler.
|
||||
// moet de hele partituur (zie get_gantt ) weer teruggeven
|
||||
$actID = $this->clean_input('newTaakID');
|
||||
$partID = $this->clean_input('partituurID');
|
||||
$ppijlerID = $this->clean_input('pijlerID');
|
||||
$activiteit = $this->ModActiviteiten->get_record_by_id($actID, FALSE, TRUE);
|
||||
$partpijler = $this->ModPartPijlers->get_record_by_id($ppijlerID, FALSE,TRUE);
|
||||
$seq = $this->input->post('selSeq');
|
||||
|
||||
if ($this->clean_input('positie') == 'na') {$seq = $seq + 1; }
|
||||
else {$seq = $seq - 1;};
|
||||
$data = array('sequence' => $seq,
|
||||
'partituurID' => $partID,
|
||||
'pijlerID' => $ppijlerID,
|
||||
'activiteitID' => $actID,
|
||||
'naam' => $activiteit->naam,
|
||||
'omschrijving' => $activiteit->omschrijving,
|
||||
'start' =>$partpijler->start,
|
||||
'eind' =>$partpijler->eind,
|
||||
'duur' => $activiteit->duur,
|
||||
'niveau' =>$activiteit->inclusiviteitsniveau,
|
||||
'fase' =>$activiteit->faseID,
|
||||
'bronID' => $activiteit->bronID,
|
||||
'email_dagen' =>$activiteit->email_dagen,
|
||||
'email_naar_pl' => $activiteit->email_pleider,
|
||||
'email_naar_vw' => $activiteit->email_verantwoordelijke);
|
||||
$newID = $this->Modpartactiviteiten->insert_record($data);
|
||||
|
||||
// roep alle taken binnen de partpijler op en pas de sequentiewaarde aan
|
||||
$partactiviteiten =$this->Modpartactiviteiten->get_id_lijst($partID,$ppijlerID);
|
||||
|
||||
if ($partactiviteiten){
|
||||
$counter = 10;
|
||||
foreach($partactiviteiten as $acti) {
|
||||
$data=array("sequence" => $counter);
|
||||
$counter = $counter + 10;
|
||||
$this->Modpartactiviteiten->update_record($data, $acti->id);
|
||||
}
|
||||
};
|
||||
|
||||
// maak partactxkosten aan
|
||||
$actKosten = $this->ModKosten->get_records_where(array('activiteitID' =>$activiteit->id) );
|
||||
if ($actKosten){
|
||||
foreach ($actKosten as $actKost){
|
||||
$data=array('activiteitID' =>$newID,
|
||||
'omschrijving' =>$actKost->omschrijving,
|
||||
'kosten' => $actKost->kosten);
|
||||
$this->ModPartActKosten->insert_record($data);
|
||||
}
|
||||
};
|
||||
// maak partactxresultaten aan
|
||||
$data =array('activiteitID' =>$newID,
|
||||
'omschrijving' =>$activiteit->resultaatomschrijving);
|
||||
$this->ModPartActResultaten->insert_record($data);
|
||||
|
||||
// maak partactxdoelgroep aan
|
||||
$temDoelgroepen = $this->ModActDoel->get_records_where(array("activiteitID" => $activiteit->id));
|
||||
if ($temDoelgroepen){
|
||||
foreach($temDoelgroepen as $doelgroep){
|
||||
$data= array('activiteitID' => $newID,
|
||||
'doelgroepID' => $doelgroep->doelgroepID);
|
||||
$this->ModPartActxDoelgroep->insert_record($data);
|
||||
}
|
||||
}
|
||||
//maak partactxhulpmiddelen aan
|
||||
$temHulpmiddelen = $this->ModActHulp->get_records_where(array("actID" => $activiteit->id));
|
||||
if ($temHulpmiddelen){
|
||||
foreach ($temHulpmiddelen as $temHulpmiddel){
|
||||
$data=array('actID' =>$newID,
|
||||
'hulpID' => $temHulpmiddel->hulpID);
|
||||
$this->ModPartActxHulpmiddel->insert_record($data);
|
||||
}
|
||||
};
|
||||
// get de nieuwe takenlijst en return deze
|
||||
$Npijlers=$this->ModPartPijlers->get_pijlers_per_partituur($partID);
|
||||
|
||||
foreach($Npijlers as $pijler){
|
||||
$pijler->start=date('d-m-Y', strtotime($pijler->start));
|
||||
$pijler->eind=date('d-m-Y', strtotime($pijler->eind));
|
||||
$pijler->taakLijst = $this->Modpartactiviteiten->get_taaklijst($pijler->id);
|
||||
if ($pijler->taakLijst ) {
|
||||
foreach($pijler->taakLijst as $taak){
|
||||
$taak->start=date('d-m-Y', strtotime($taak->start));
|
||||
$taak->eind=date('d-m-Y', strtotime($taak->eind));
|
||||
};
|
||||
}; // if not empty
|
||||
}
|
||||
echo json_encode( array('taken' =>$Npijlers));
|
||||
}
|
||||
|
||||
function RemoveTaak(){
|
||||
$partActID = $this->clean_input('partActID');
|
||||
// delete partActKosten partActResultaten partActdoelgroep
|
||||
// partactHulpmiddel partActOrgusers
|
||||
$where = array('ActiviteitID' =>$partActID);
|
||||
$this->ModPartActKosten -> delete_record_where($where) ;
|
||||
$this->ModPartActResultaten ->delete_record_where($where) ;
|
||||
$this->ModPartActxDoelgroep->delete_record_where($where);
|
||||
$this->Modpartactxorgusers->delete_record_where($where);
|
||||
|
||||
$where = array('activiteitID' =>$partActID);
|
||||
$this->ModAgenda->delete_record_where($where);
|
||||
$where = array('actID ' =>$partActID);
|
||||
$this->ModPartActxHulpmiddel->delete_record_where($where);
|
||||
$this->Modpartactiviteiten->delete_record($partActID);
|
||||
|
||||
echo(true);
|
||||
}
|
||||
function AddHulpmiddel(){
|
||||
$actID = $this->uri->segment(4);
|
||||
$hulpID= $this->uri->segment(5);
|
||||
$data = array('actID' => $actID,
|
||||
'hulpID' =>$hulpID);
|
||||
$newID = $this->ModPartActxHulpmiddel->insert_record($data);
|
||||
$data = $this->ModPartActxHulpmiddel->get_hulpmiddelenlijst_per_activiteit($actID,$hulpID);
|
||||
echo json_encode($data);
|
||||
}
|
||||
function RemoveHulpmiddel(){
|
||||
$hID = $this->uri->segment(4);
|
||||
$this->ModPartActxHulpmiddel->delete_record($hID);
|
||||
}
|
||||
function SaveTaak(){
|
||||
$taakID = $this->clean_input("taakID");
|
||||
$data=array(
|
||||
"start" => date2mysql($this->clean_input("startdatum")),
|
||||
"eind" => date2mysql($this->clean_input("einddatum")),
|
||||
"duur" => $this->clean_input("duur"),
|
||||
"afhankelijkvanID" => $this->clean_input("afhankelijkvan"),
|
||||
"gereed " => $this->clean_input("gereed")
|
||||
);
|
||||
$this->Modpartactiviteiten->update_record($data,$taakID);
|
||||
}
|
||||
function SaveTaakData (){
|
||||
$taakID = $this->input->post("id");
|
||||
$data = array( "start" => date2mysql($this->clean_input("start")),
|
||||
"eind" => date2mysql($this->clean_input("eind")),
|
||||
"duur" => $this->clean_input("duur") );
|
||||
$this->Modpartactiviteiten->update_record($data,$taakID);
|
||||
|
||||
}
|
||||
function SavePerc(){
|
||||
$data = array("gereed" =>$this->clean_input("gereed"));
|
||||
$taakID = $this->clean_input("taakID");
|
||||
$this->Modpartactiviteiten->update_record($data,$taakID);
|
||||
}
|
||||
function SavePijlerData() {
|
||||
$pijlerID = $this->clean_input('id');
|
||||
$data = array( "start" => date2mysql($this->clean_input("start")),
|
||||
"eind" => date2mysql($this->clean_input("eind"))
|
||||
);
|
||||
$this->ModPartPijlers-> update_record($data,$pijlerID);
|
||||
}
|
||||
function SaveTaakDetails(){
|
||||
$taakID = $this->clean_input("taakID");
|
||||
$data=array("omschrijving" => textarea2html($this->clean_input("omschrijving")),
|
||||
"opmerkingen" => textarea2html($this->clean_input("opmerkingen")),
|
||||
"gereed" => $this->clean_input("gereed"),
|
||||
"verantwoordelijke" => $this->clean_input("verantwoordelijke"),
|
||||
"email_dagen" => $this->clean_input("email_dagen"),
|
||||
"email_naar_pl" => $this->clean_input("email_naar_pl"),
|
||||
"email_naar_vw" => $this->clean_input("email_naar_vw"),
|
||||
"email_adres" => $this->clean_input("email_adres")
|
||||
);
|
||||
$this->Modpartactiviteiten->update_record($data,$taakID);
|
||||
}
|
||||
function RemoveDoelgroep(){
|
||||
$dID = $this->uri->segment(4);
|
||||
$this->ModPartActxDoelgroep->delete_record($dID);
|
||||
}
|
||||
function getDoelgroepen(){
|
||||
//haal de doelgroepen op die nog niet in de activiteit zijn opgenomen
|
||||
$actID = $this->uri->segment(4);
|
||||
$result= $this->ModPartActxDoelgroep->get_other_doelgroepen($actID);
|
||||
echo json_encode($result);
|
||||
}
|
||||
function AddDoelgroep(){
|
||||
$dID = $this->uri->segment(4);
|
||||
$actID = $this->uri->segment(5);
|
||||
$data =array("activiteitID" => $actID,
|
||||
"doelgroepID" =>$dID );
|
||||
$newID = $this->ModPartActxDoelgroep->insert_record($data);
|
||||
$newRecord = $this->ModPartActxDoelgroep->get_doelgroep($newID);
|
||||
echo json_encode($newRecord);
|
||||
}
|
||||
function newKostenregel(){
|
||||
$actID = $this->uri->segment(4);
|
||||
$data = array("activiteitID" => $actID);
|
||||
$newID = $this->ModPartActKosten->insert_record($data);
|
||||
$newRecord = $this->ModPartActKosten->get_kosten_per_regel($newID);
|
||||
echo json_encode($newRecord);
|
||||
}
|
||||
function SaveKosten(){
|
||||
$kID = $this->clean_input("id");
|
||||
$where=array("omschrijving" =>$this->clean_input("omschrijving"),
|
||||
"kosten" =>bedrag2mysql($this->clean_input("kosten")) );
|
||||
$this->ModPartActKosten->update_record($where,$kID);
|
||||
}
|
||||
function DeleteKost(){
|
||||
$kID = $this->uri->segment(4);
|
||||
$this->ModPartActKosten->delete_record($kID);
|
||||
}
|
||||
function SaveResultaten(){
|
||||
$actID=$this->clean_input('id');
|
||||
$where = array('activiteitID' =>$actID);
|
||||
$data = array("resultaat"=>$this->clean_input('resultaat'));
|
||||
|
||||
$resID = $this->ModPartActResultaten->get_fieldvalue($where, 'id');
|
||||
if ($resID) {
|
||||
$this->ModPartActResultaten->update_record_where($data, $where);
|
||||
}
|
||||
else{
|
||||
$data= array('activiteitID' =>$actID,
|
||||
"resultaat"=>$this->clean_input('resultaat'));
|
||||
$this->ModPartActResultaten->insert_record($data);
|
||||
}
|
||||
|
||||
}
|
||||
function saveSequentie(){
|
||||
$seqlijst= $this->clean_input("seqlijst");
|
||||
foreach ($seqlijst as $seq2){
|
||||
$data=array("sequence" =>$seq2['seq']);
|
||||
$this->Modpartactiviteiten->update_record($data, $seq2['id']);
|
||||
}
|
||||
}
|
||||
function addUitvoerende(){
|
||||
$actID = $this->uri->segment(4);
|
||||
$orguserID = $this->uri->segment(5);
|
||||
$data=array("activiteitID" => $actID,
|
||||
"orguserID" => $orguserID);
|
||||
$this->Modpartactxorgusers->insert_record($data);
|
||||
}
|
||||
function addVerantwoordelijke(){
|
||||
$actID = $this->uri->segment(4);
|
||||
$orguserID = $this->uri->segment(5);
|
||||
$data = array("verantwoordelijke" => $orguserID);
|
||||
$this->Modpartactiviteiten->update_record($data,$actID);
|
||||
}
|
||||
function removeUitvoerende(){
|
||||
$actID = $this->uri->segment(4);
|
||||
$orguserID = $this->uri->segment(5);
|
||||
$data=array("activiteitID" => $actID,
|
||||
"orguserID" => $orguserID);
|
||||
$this->Modpartactxorgusers->delete_record_where($data);
|
||||
}
|
||||
function removeVerantwoordelijke(){
|
||||
$actID = $this->uri->segment(4);
|
||||
$data = array("verantwoordelijke"=>null);
|
||||
$this->Modpartactiviteiten->update_record($data,$actID);
|
||||
}
|
||||
|
||||
function MinMaxDag(){
|
||||
$partactID = $this->uri->segment(4);
|
||||
$partact = $this->Modpartactiviteiten->get_record_by_id($partactID);
|
||||
$partpijler = $this->ModPartPijlers->get_record_by_id($partact->pijlerID) ;
|
||||
$minStart = $partpijler->start;
|
||||
$maxEind = $partpijler->eind;
|
||||
if ($partact->duur) {$dagen = $partact->duur;}
|
||||
else {$dagen = 1;};
|
||||
$maxStart =DATE("Y-m-d", strtotime($maxEind.' - '.$dagen.' days ') );
|
||||
$minEind = DATE("Y-m-d", strtotime($partpijler->start.' + '.$dagen.' days ') );
|
||||
$agendaMinMax=$this->ModAgenda->find_minmax_dag($partpijler->id, $partact->id);
|
||||
if (!empty($agendaMinMax )) {
|
||||
if (isset($agendaMinMax[0]->mindag)){
|
||||
if (DATE("Y-m-d", strtotime($agendaMinMax[0]->mindag)) < $maxStart &&
|
||||
DATE("Y-m-d", strtotime($agendaMinMax[0]->mindag)) >= $minStart)
|
||||
{$maxStart= DATE("Y-m-d", strtotime($agendaMinMax[0]->mindag)) ;};
|
||||
};
|
||||
if (isset($agendaMinMax[0]->maxdag)) {
|
||||
if ( DATE("Y-m-d",Strtotime($agendaMinMax[0]->maxdag)) > $minEind &&
|
||||
DATE("Y-m-d",Strtotime($agendaMinMax[0]->maxdag)) <= $maxEind)
|
||||
{$minEind =DATE("Y-m-d",Strtotime($agendaMinMax[0]->maxdag));};
|
||||
};
|
||||
};
|
||||
echo json_encode(array("minStart" =>$minStart,
|
||||
"maxStart" =>$maxStart,
|
||||
"minEind" => $minEind,
|
||||
"maxEind" =>$maxEind));
|
||||
}
|
||||
function MinMaxDagVoorPijler(){
|
||||
$pijlerID = $this->uri->segment(4);
|
||||
$uitAct = $this->Modpartactiviteiten->get_minmax_activiteiten($pijlerID);
|
||||
$partituur = $this->Partituurs_model->get_record_by_id($this->partituurid);
|
||||
$minStart = $partituur->partituur_start;
|
||||
$maxEind =$partituur->partituur_eind;
|
||||
$maxStart = new DateTime($maxEind);
|
||||
$maxStart->modify("-1 day");
|
||||
$maxStart= $maxStart->format("Y-m-d");
|
||||
|
||||
$minEind = new DateTime($minStart) ; // was maxStart moet worden minStart + 1
|
||||
$minEind->modify('+1 day');
|
||||
$minEind = $minEind->format("Y-m-d");
|
||||
|
||||
if ($uitAct) {
|
||||
if($uitAct->minStart) {$maxStart = $uitAct->minStart;};
|
||||
if($uitAct->maxEind) {$minEind = $uitAct->maxEind;};
|
||||
};
|
||||
$agendaMinMax=$this->ModAgenda->find_minmax_dag($pijlerID);
|
||||
if (!empty($agendaMinMax )) {
|
||||
if (isset($agendaMinMax[0]->mindag)){
|
||||
if (DATE("Y-m-d", strtotime($agendaMinMax[0]->mindag)) < $maxStart &&
|
||||
DATE("Y-m-d", strtotime($agendaMinMax[0]->mindag)) >= $minStart)
|
||||
{$maxStart= DATE("Y-m-d", strtotime($agendaMinMax[0]->mindag)) ;};
|
||||
};
|
||||
if (isset($agendaMinMax[0]->maxdag)) {
|
||||
if ( DATE("Y-m-d",Strtotime($agendaMinMax[0]->maxdag)) > $minEind &&
|
||||
DATE("Y-m-d",Strtotime($agendaMinMax[0]->maxdag)) <= $maxEind)
|
||||
{$minEind =DATE("Y-m-d",Strtotime($agendaMinMax[0]->maxdag));};
|
||||
};
|
||||
};
|
||||
echo json_encode(array("minStart" =>$minStart,
|
||||
"maxStart" =>$maxStart,
|
||||
"minEind" => $minEind,
|
||||
"maxEind" =>$maxEind));
|
||||
}
|
||||
function LSUploadNote(){
|
||||
$nID = $this->uri->segment(4);
|
||||
$actID = $this->uri->segment(5);
|
||||
$toonnaam = $this->clean_input('toonnaam');
|
||||
|
||||
$config['upload_path'] = '../tmp_uploads/';
|
||||
$config['allowed_types'] = 'doc|docx|jpg|gif|png|pdf|txt';
|
||||
$config['max_size'] = '10000';
|
||||
|
||||
$this->load->library('upload', $config);
|
||||
|
||||
$uploadresult = $this->upload->do_upload();
|
||||
|
||||
if (!$uploadresult && !$docid){
|
||||
$result = array('errors'=>json_encode($this->upload->display_errors()));
|
||||
}else{
|
||||
if(!$uploadresult){
|
||||
$result = array('errors'=>json_encode('<p>de gegevens zijn opgeslagen</p>'));
|
||||
}else{
|
||||
//check if there is already a file (docid!=0) unlink the old file
|
||||
if($nID){
|
||||
$file = $this->ModPortfolio->get_record_by_id($nID);
|
||||
if ($file) {
|
||||
if ($file->hashnaam) {
|
||||
unlink('../docs/'.$file->hashnaam.$file->doc_extension);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$result = array('errors'=>json_encode('<p>uw bestand is succesvol geupload</p>'));
|
||||
$document = $this->upload->data();
|
||||
|
||||
$this->load->helper('string');
|
||||
$newname = sha1(random_string('alnum', 16));
|
||||
|
||||
$data = array( 'toonnaam' => $toonnaam,
|
||||
'id' => $nID,
|
||||
'partactID' => $actID,
|
||||
'orgID' => $this->globorgid,
|
||||
'docnaam' => $document['file_name']);
|
||||
|
||||
$data['doc_extension'] = $document['file_ext'];
|
||||
$data['hashnaam'] = $newname;
|
||||
|
||||
$oldname = '../tmp_uploads/'.$document['file_name'];
|
||||
$newname = '../docs/'.$newname.$document['file_ext'];
|
||||
rename($oldname, $newname);
|
||||
}
|
||||
$nID =$this->ModPortfolio->save_record($data, $nID);
|
||||
}
|
||||
$data = array('result' =>$result, 'id'=>$nID );
|
||||
$this->load->view('ijkpartituur/popups/ToonuploadNote', $data) ;
|
||||
}
|
||||
} // einde class Planning
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user