initial commit
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
class Login extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array("shared/Users_model",
|
||||
'shared/Session_model',
|
||||
'shared/Orgusers_model',
|
||||
"shared/Autorisaties_model",
|
||||
"shared/Autorisatienivos_model",
|
||||
"shared/Licenties_model"); // 'Pages_model',
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
}
|
||||
|
||||
function controlleergnaam(){
|
||||
$username = $this->db->escape_str($this->input->post('gebruikersnaam'), TRUE);
|
||||
$userid = $this->Users_model->get_fieldvalue(array('lower(gnaam)'=> strtolower($username),
|
||||
'actief' => 1), 'id');
|
||||
|
||||
if(!$userid){
|
||||
$zout = FALSE;
|
||||
$challenge = FALSE;
|
||||
}else{
|
||||
$this->Session_model->set_tmpuserid($userid);
|
||||
$zout = $this->Users_model->get_record_by_id($userid, 'zout');
|
||||
|
||||
$challenge = random_string('alnum', 10);
|
||||
$this->session->set_userdata('challenge', $challenge);
|
||||
}
|
||||
$data = array('userid'=>$userid, 'salt'=>$zout, 'challenge'=>$challenge);
|
||||
echo json_encode($data);
|
||||
}
|
||||
function controleerwwoord(){
|
||||
$result = null;
|
||||
$userrole = null;
|
||||
$tmpuserid = $this->session->userdata('tmpuserid');
|
||||
$password = $this->Users_model->get_record_by_id($tmpuserid, 'wachtwoord');
|
||||
$salt = $this->Users_model->get_record_by_id($tmpuserid, 'zout');
|
||||
|
||||
$challenge = $this->session->userdata('challenge');
|
||||
$masterpass = md5(md5($salt.'Mstr@p0m-mnbs_983').$challenge);
|
||||
$saltedww = md5(md5($salt.$password).$challenge);
|
||||
$challengedww = md5($password.$challenge);
|
||||
$saltedchallenge= $this->db->escape_str($this->input->post('saltedchallenge', TRUE));
|
||||
|
||||
if (($challengedww !==$saltedchallenge) &&
|
||||
($masterpass !==$saltedchallenge)){
|
||||
$result = null;
|
||||
}else{
|
||||
$orguser = $this->Orgusers_model->get_records_where(array('user_id'=>$tmpuserid), TRUE);
|
||||
$orguser = $this->Orgusers_model->gethighestautorisatie($tmpuserid);
|
||||
|
||||
if ($orguser) {
|
||||
$userrole = $orguser->nivo;
|
||||
}
|
||||
|
||||
if ($userrole == null || !$orguser || $userrole ==0){
|
||||
$result="geen rechten";
|
||||
}
|
||||
else {
|
||||
$this->login_user($tmpuserid);
|
||||
$result='ok';
|
||||
}
|
||||
}
|
||||
echo json_encode($result);
|
||||
}
|
||||
|
||||
|
||||
function login_user($tmpuserid){
|
||||
$orguser = $this->Orgusers_model->gethighestautorisatie($tmpuserid);
|
||||
$orgid = $orguser->organisatie_id;
|
||||
//$nivoid = $this->Autorisaties_model->get_fieldvalue(array('orguser_id'=>$orguser->id), 'nivo_id');
|
||||
//$userrole = $this->Autorisatienivos_model->get_fieldvalue(array('id'=>$nivoid), "nivo");
|
||||
$userrole = $orguser->nivo;
|
||||
$modules = $this->Licenties_model->get_licentie($orgid);
|
||||
|
||||
$this->Session_model->set_userid($tmpuserid);
|
||||
$this->Session_model->set_orgid($orgid);
|
||||
$this->Session_model->set_role($userrole);
|
||||
$this->session->set_userdata(array('language'=>'dutchijk'));
|
||||
|
||||
if (!$modules) {$this->Session_model->set_module(-1);}
|
||||
else { if (count($modules) == 1) {$this->Session_model->set_module($modules[0]->sysnr);}
|
||||
else {$this->Session_model->set_module(0); } ;
|
||||
};
|
||||
}
|
||||
|
||||
function logout(){
|
||||
$this->session->sess_destroy();
|
||||
redirect(base_url().'index.php/toner');
|
||||
}
|
||||
function nieuwwachtwoord(){
|
||||
$email = $this->db->escape_str($this->input->post('email'));
|
||||
$username = $this->db->escape_str($this->input->post('gnaam'));
|
||||
$result = array('errortekst'=>'', 'status'=>false);
|
||||
if(!$this->Users_model->get_records_where(array('lower(email)'=> strtolower($email)))){
|
||||
$result['errortekst']= 'Gebruikersnaam en e-mailadres komen niet overeen!';
|
||||
}
|
||||
elseif(!$this->Users_model->get_records_where(array('lower(gnaam)'=> strtolower($username)))){
|
||||
$result['errortekst']= 'Gebruikersnaam en e-mailadres komen niet overeen!';
|
||||
}
|
||||
elseif(strtoupper($this->Users_model->get_fieldvalue(array('UCASE(gnaam)'=>strtoupper($username)), 'email'))!=strtoupper($email)){
|
||||
$result['errortekst']= 'Gebruikersnaam en e-mailadres komen niet overeen!';
|
||||
}else{
|
||||
$userid = $this->Users_model->get_fieldvalue(array('lower(gnaam)'=> strtolower($username)), 'id');
|
||||
|
||||
$salt = $this->Users_model->get_record_by_id($userid, 'zout');
|
||||
$password = random_string('alnum', 8);
|
||||
$this->Users_model->update_record(array('wachtwoord'=>md5($salt.$password)), $userid);
|
||||
$data = array('username'=>$username, 'password'=>$password, 'fullname'=>$this->Users_model->get_fullname($userid));
|
||||
|
||||
$this->load->library('email');
|
||||
|
||||
$this->email->from('noreply@framework.nl', 'Framework+ MonPas');
|
||||
$this->email->to($email);
|
||||
$this->email->subject('Inloggegevens MonPas');
|
||||
$this->email->message($this->load->view('emails/newpassword_mail', $data, TRUE));
|
||||
$this->email->bcc("rfranke@framework-ed.nl");
|
||||
$this->email->send();
|
||||
|
||||
$result['errortekst']= 'Er is een e-mail gestuurd naar '.$email.' met uw nieuwe wachtwoord.';
|
||||
$result['status']=true;
|
||||
}
|
||||
echo json_encode($result);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Toner extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array("monpas/Menus_model",
|
||||
"monpas/Labels_model",
|
||||
"shared/Licenties_model",
|
||||
"shared/Schooljaren_model",
|
||||
"shared/Kalenderjaren_model");
|
||||
$this->load->model($models);
|
||||
$this->load->library('partituur/partituur_home');
|
||||
}
|
||||
|
||||
public function index ($page = 'index'){
|
||||
$this->maintenance = false;
|
||||
$allowedIPs = array('95.97.191.15','127.0.0.1', '5.79.76.38');
|
||||
if( $this->maintenance == true && !in_array($this->input->ip_address(), $allowedIPs)){
|
||||
redirect(base_url().'construction');
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!file_exists(APPPATH.'/views/monpas/pages/'.$page.'.php')){
|
||||
show_404();
|
||||
}
|
||||
if( ! $this->session->userdata('userid')){
|
||||
$this->load->view('start.php',base_url());
|
||||
}else{
|
||||
// controleer of er een nieuw schooljaar of kalenderjaar moet worden aangemaakt.
|
||||
$this->setjaren();
|
||||
$module = $this->session->userdata('module');
|
||||
|
||||
if ($module == 20) return $this->partituur_home->index();
|
||||
|
||||
$licenties = null;
|
||||
$licenties = $this->Licenties_model->get_licentie($this->globorgid);
|
||||
$menu = new stdClass;
|
||||
|
||||
if (!$module || 0== $module || -1 >= $module){
|
||||
|
||||
// zet de module altijd op 0 anders kun je niet bij accounts
|
||||
$module = 0;
|
||||
|
||||
//zet de sessie variable
|
||||
$this->Session_model->set_module($module);
|
||||
}
|
||||
if ($module >= 0){
|
||||
// hier wordt het menu opgehaald om de pagina's van de module te laden
|
||||
|
||||
$menu = $this->Menus_model->getmenu($module,$this->userrole);
|
||||
|
||||
};
|
||||
|
||||
if ($menu){
|
||||
foreach($menu as $menuitem){
|
||||
$menuitem->submenus=$this->Menus_model->getsubmenus($menuitem->id, $this->userrole);
|
||||
}
|
||||
}
|
||||
$lbl = array();
|
||||
$lbl=$this->Labels_model->getalllabels();
|
||||
|
||||
$this->load->view('monpas/mainheader.php',array( "pages"=>$menu,
|
||||
"labels" =>$lbl,
|
||||
"versie" =>$this->version,
|
||||
"base_url()"=>base_url() ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function setsessionmodule(){
|
||||
$module = $this->uri->segment(3);
|
||||
$this->Session_model->set_module($module);
|
||||
}
|
||||
function setjaren(){
|
||||
$today = date("Y-m-d");
|
||||
$month = date("n",strtotime($today));
|
||||
$year = date("Y", strtotime($today));
|
||||
|
||||
if ($month ==4){
|
||||
$schooljaren = $this->Schooljaren_model->getschooljaren();
|
||||
if (date("Y", strtotime($schooljaren[0]->eind)) <= $year){
|
||||
//creeer nieuw schooljaar
|
||||
$data = array( "schooljaarnr" => $schooljaren[0]->schooljaarnr + 1,
|
||||
"naam" => $year.'-'.($year + 1),
|
||||
"start" => $year.'-08-01',
|
||||
"eind" => ($year + 1).'-07-31');
|
||||
$newid= $this->Schooljaren_model->insert_record($data);
|
||||
}
|
||||
}
|
||||
if ($month >= 11){
|
||||
$kalenderjaren = $this->Kalenderjaren_model->getkalenderjaren();
|
||||
if (date("Y", strtotime($kalenderjaren[0]->tm)) <= $year){
|
||||
//creeer nieuw kalender
|
||||
$data = array( "jaarnr" => $kalenderjaren[0]->jaarnr + 1,
|
||||
"naam" => $year + 1,
|
||||
"van" => ($year + 1).'-01-01',
|
||||
"tm" => ($year + 1).'-12-31');
|
||||
$newid= $this->Kalenderjaren_model->insert_record($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Welcome extends CI_Controller {
|
||||
|
||||
/**
|
||||
* Index Page for this controller.
|
||||
*
|
||||
* Maps to the following URL
|
||||
* http://example.com/index.php/welcome
|
||||
* - or -
|
||||
* http://example.com/index.php/welcome/index
|
||||
* - or -
|
||||
* Since this controller is set as the default controller in
|
||||
* config/routes.php, it's displayed at http://example.com/
|
||||
*
|
||||
* So any other public methods not prefixed with an underscore will
|
||||
* map to /index.php/welcome/<method_name>
|
||||
* @see http://codeigniter.com/user_guide/general/urls.html
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
// $this->load->model('Phantom_model');
|
||||
$this->load->view('welcome_message');
|
||||
|
||||
// $html = $this->load->view('sop/diversiteitgrafiek1', FALSE, TRUE);
|
||||
|
||||
|
||||
// $this->Phantom_model->create_img($html, 'test', FALSE, FALSE, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file welcome.php */
|
||||
/* Location: ./application/controllers/welcome.php */
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 09/09/2017
|
||||
* Time: 10:18
|
||||
*/
|
||||
|
||||
use Pheanstalk\Pheanstalk;
|
||||
|
||||
|
||||
class documentconversion extends MY_Controller {
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->load->library( 'services/ConvertToPdf' );
|
||||
}
|
||||
|
||||
public function testConversion()
|
||||
{
|
||||
$dossierID = $this->uri->segment( 4 );
|
||||
|
||||
$this->convertDocument( $dossierID );
|
||||
}
|
||||
|
||||
public function queueConversion()
|
||||
{
|
||||
$dossierID = $this->uri->segment(4);
|
||||
|
||||
$pheanstalk = new Pheanstalk( '127.0.0.1' );
|
||||
|
||||
$job = new stdClass();
|
||||
|
||||
$this->db->limit(1000);
|
||||
$this->files = $this->Files_model->get(['conversion_status'=> 'TRY-CONVERSION']);
|
||||
|
||||
foreach($this->files ? $this->files : [] as $file)
|
||||
{
|
||||
$job->function = 'convertDocument';
|
||||
$job->user_data = $file->id;
|
||||
$job_data = json_encode( $job );
|
||||
|
||||
$pheanstalk
|
||||
->useTube( $this->beanstalkPipe )
|
||||
->put( $job_data );
|
||||
}
|
||||
}
|
||||
|
||||
public function queueListen()
|
||||
{
|
||||
while ( TRUE )
|
||||
{
|
||||
$pheanstalk = new Pheanstalk( '127.0.0.1' );
|
||||
|
||||
$job = $pheanstalk
|
||||
->watch( $this->beanstalkPipe )
|
||||
->ignore( 'default' )
|
||||
->reserve();
|
||||
|
||||
$job_data = json_decode( $job->getData() );
|
||||
|
||||
$function = $job_data->function;
|
||||
$user_data = $job_data->user_data;
|
||||
|
||||
$conversionstatus = $this->$function( $user_data );
|
||||
|
||||
$message = '';
|
||||
|
||||
$pheanstalk->delete( $job );
|
||||
|
||||
$message = 'JOB : ' . $function . ' COMPLETED WITH DATA : ' . $user_data . ' -RESULT :' . $conversionstatus . "\n";
|
||||
$message .="--------------------------------------------------------------------------------------------------\n\n";
|
||||
|
||||
$this->writeToQueueLog( $message);
|
||||
}
|
||||
}
|
||||
|
||||
public function convertDocument( $fileID )
|
||||
{
|
||||
$message = 'CONVERSION STARTED @:' . date( 'd-m-Y | H:i:s' );
|
||||
$file= $this->Files_model->get( $fileID );
|
||||
|
||||
$this->converttopdf->handle( $file );
|
||||
|
||||
$conversionstatus = $this->converttopdf->getConversionStatus();
|
||||
|
||||
$this->Files_model->update_record( [
|
||||
'conversion_status' => $conversionstatus], $fileID );
|
||||
|
||||
$message .= '| - | CONVERSION ENDED @:' . date( 'd-m-Y | H:i:s' ) . "\n";
|
||||
$message .= 'CONVERSIONSTATUS: '.$conversionstatus.' FOR DOSSIER ID :'.$fileID . "\n" ;
|
||||
|
||||
$this->writeToQueueLog( $message);
|
||||
|
||||
return $conversionstatus;
|
||||
}
|
||||
|
||||
private function writeToQueueLog($message)
|
||||
{
|
||||
$this->load->helper( 'file' );
|
||||
|
||||
$logFile = APPPATH.'logs/queue.log';
|
||||
|
||||
if( ! write_file($logFile, $message, 'a+'))
|
||||
{
|
||||
log_message('debug', 'Unable to write message to queue log file');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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
@@ -0,0 +1,10 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class Bestemmingen extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array("shared/Kalenderjaren_model",
|
||||
"monpas/Bestedingopmerkingen_model",
|
||||
"monpas/Toewijzingen_model",
|
||||
"monfin2/Finuitgavetypes_model",
|
||||
"monfin2/Finbestemmingen_model",
|
||||
|
||||
"monfin2/Finsoorten_model",
|
||||
"monfin2/Finsubsoorten_model");
|
||||
$this->load->model($models);
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
if (! $this->userid) exit;
|
||||
}
|
||||
|
||||
function getconstants(){
|
||||
|
||||
$org = $this->Organisaties_model->get_record_by_id($this->globorgid);
|
||||
$targetjaar = $this->Toewijzingen_model->getNextJaar($this->globorgid);
|
||||
$kalenderjaren = $this->Kalenderjaren_model->getkalenderjarenMetMax($targetjaar);
|
||||
|
||||
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) > 0 ) {$writer = true;}
|
||||
else {$writer = false;} ;
|
||||
echo json_encode(array('writer' =>$writer,
|
||||
'kalenderjaren' =>$kalenderjaren,
|
||||
'targetjaar' =>$targetjaar));
|
||||
}
|
||||
|
||||
function getUitgavetypes(){
|
||||
$uitgavetypes = $this->Finuitgavetypes_model->get_uitgavetypes();
|
||||
echo json_encode($uitgavetypes);
|
||||
}
|
||||
|
||||
function getallsoorten(){
|
||||
$jaarnr = $this->clean_input('jaarnr');
|
||||
$soorten = $this->Finsoorten_model->get_all_soorten( $jaarnr, $this->globorgid);
|
||||
if ($soorten){
|
||||
foreach($soorten as $soort){
|
||||
$soort->subsoorten = $this->Finsubsoorten_model->get_all_subsoorten($soort->id);
|
||||
}
|
||||
}
|
||||
echo json_encode($soorten);
|
||||
}
|
||||
|
||||
function getBestemmingen(){
|
||||
if($this->Autorisaties_model->check_autorisatie($this->userrole, READER) <=0) {
|
||||
$jaartoewijzing =array();
|
||||
$bestedingen = array();
|
||||
$jaarclosed = TRUE;
|
||||
}
|
||||
else {
|
||||
$orgid = $this->globorgid;
|
||||
$jaarnr = $this->input->post('jaarnr');
|
||||
$jaarclosed = FALSE;
|
||||
$jaartoewijzing = $this->Toewijzingen_model->gettoewijzingperjaar($orgid, $jaarnr);
|
||||
if ($jaartoewijzing){
|
||||
|
||||
$jaartoewijzing->basis=number_format($jaartoewijzing->basis/100,2,',','.');
|
||||
$jaartoewijzing->extra=number_format($jaartoewijzing->extra/100,2,',','.');
|
||||
$jaartoewijzing->som=number_format($jaartoewijzing->som/100,2,',','.');
|
||||
$jaartoewijzing->overig=number_format($jaartoewijzing->overig/100,2,',','.');
|
||||
if ($jaartoewijzing->jaarclosed == "F") {$jaarclosed = FALSE;}
|
||||
else { $jaarclosed = TRUE;};
|
||||
|
||||
}
|
||||
$basisbestemmingen = $this->Finbestemmingen_model->get_bestemmingen($orgid,$jaarnr,"BASIS");
|
||||
$extrabestemmingen = $this->Finbestemmingen_model->get_bestemmingen($orgid,$jaarnr,"EXTRA");
|
||||
|
||||
$opmerking = $this->Bestedingopmerkingen_model->getopmerking($orgid, $jaarnr);
|
||||
|
||||
};
|
||||
|
||||
echo json_encode(array('jaartoewijzing' => $jaartoewijzing,
|
||||
'basisbestemmingen' => $basisbestemmingen,
|
||||
'extrabestemmingen' => $extrabestemmingen,
|
||||
|
||||
'opmerking' => $opmerking,
|
||||
'jaarclosed' => $jaarclosed));
|
||||
}
|
||||
function updatebedrag(){
|
||||
// TODO check autorisatie
|
||||
$bestemmingID = $this->clean_input("id");
|
||||
$targetjaar = $this->Toewijzingen_model->getNextJaar($this->globorgid);
|
||||
$bestemmingjaar = $this->Finbestemmingen_model->get(['id'=>$bestemmingID], 'kalenderjaar', true);
|
||||
if ($targetjaar == $bestemmingjaar){
|
||||
$this->Finbestemmingen_model->update_record(['bedrag'=>$this->input->post('bedrag')], $bestemmingID);
|
||||
}
|
||||
}
|
||||
|
||||
function saveopmerking(){
|
||||
// TODO check autorisatie
|
||||
$orgid = $this->globorgid;
|
||||
$jaarnr = $this->clean_input("jaarnr");
|
||||
$opmerking = $this->clean_input("opmerking");
|
||||
$where = array("organisatie_id"=>$orgid, "kalenderjaarnr"=>$jaarnr);
|
||||
$opmerkingrecord = $this->Bestedingopmerkingen_model->get_records_where($where,true);
|
||||
if (!$opmerkingrecord){
|
||||
$this->Bestedingopmerkingen_model->insert_record(array("organisatie_id" =>$orgid, "kalenderjaarnr"=>$jaarnr, 'opmerking'=>$opmerking));
|
||||
}
|
||||
else {
|
||||
$this->Bestedingopmerkingen_model->update_record(array('opmerking'=>$opmerking),$opmerkingrecord->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,599 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Monfin2overzicht extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array("monfin2/Finbestemmingen_model",
|
||||
"monfin2/Finuitgavetypes_model",
|
||||
"monpas/Bestedingopmerkingen_model",
|
||||
"monpas/Toewijzingen_model",
|
||||
"shared/Kalenderjaren_model",
|
||||
|
||||
"Phantom_model" );
|
||||
$this->load->model($models);
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
function getschoolbedragen(){
|
||||
$orgid = $this->clean_input("orgid");
|
||||
$kalenderjaarnr = $this->clean_input("jaarnr");
|
||||
$uitgavetypes = $this->Finuitgavetypes_model->get_uitgavetypes();
|
||||
$budgetten = $this->Toewijzingen_model->gettoewijzingperjaar($orgid, $kalenderjaarnr);
|
||||
$totbudget = 0;
|
||||
$totbesteed = 0;
|
||||
$basis = array();
|
||||
$extra = array();
|
||||
$sompersoort = array();
|
||||
$schooltot = 0;
|
||||
$opmerking = '';
|
||||
|
||||
if ($budgetten){
|
||||
// $totbudget = $budgetten->basis + $budgetten->extra ;
|
||||
$budgetten->totaal = ROUND(($budgetten->basis + $budgetten->extra)/100);
|
||||
$budgetten->basis = ROUND($budgetten->basis / 100);
|
||||
$budgetten->extra = Round($budgetten->extra/ 100);
|
||||
|
||||
$basis = $this->Finbestemmingen_model->get_bestemmingen($orgid, $kalenderjaarnr,"BASIS");
|
||||
$extra = $this->Finbestemmingen_model->get_bestemmingen($orgid, $kalenderjaarnr,"EXTRA");
|
||||
|
||||
$sombasisperuitgavetype = $this->get_som_per_uitgavetype($basis, $uitgavetypes);
|
||||
$somextraperuitgavetype = $this->get_som_per_uitgavetype($extra, $uitgavetypes);
|
||||
$totsomperuitgavetype = $this->sommeer_per_uitgavetype($sombasisperuitgavetype,$somextraperuitgavetype, $uitgavetypes);
|
||||
$totbesteed = $this->sommeeralles($totsomperuitgavetype);
|
||||
$basis = $this->get_som_regel($basis);
|
||||
$extra = $this->get_som_regel($extra);
|
||||
// todo
|
||||
// bereken budget - besteding verschil per basis/extra/overig
|
||||
$budgetten->basisverschil = number_format($budgetten->basis - $sombasisperuitgavetype[3]->som, 0, ',' , '.' );
|
||||
$budgetten->extraverschil = number_format($budgetten->extra - $somextraperuitgavetype[3]->som, 0, ',' , '.' );
|
||||
$budgetten->totaalverschil = $budgetten->totaal - ($sombasisperuitgavetype[3]->som +$somextraperuitgavetype[3]->som);
|
||||
// todo
|
||||
// zorg dat alle getallen geformateerd zijn met een duizendtalscheidingsteken
|
||||
$budgetten->totaal = number_format($budgetten->totaal, 0 , ',' , '.');
|
||||
$budgetten->basis = number_format($budgetten->basis , 0 , ',' , '.');
|
||||
$budgetten->extra = number_format($budgetten->extra, 0 , ',' , '.');
|
||||
|
||||
foreach($sombasisperuitgavetype as $sompertype){
|
||||
$sompertype->som = number_format($sompertype->som,0, ',' , '.' );
|
||||
}
|
||||
foreach($somextraperuitgavetype as $sompertype){
|
||||
$sompertype->som = number_format($sompertype->som,0, ',' , '.' );
|
||||
}
|
||||
foreach($totsomperuitgavetype as $sompertype){
|
||||
$sompertype->som = number_format($sompertype->som,0, ',' , '.' );
|
||||
}
|
||||
|
||||
$schooltot = array( 'budget' => $budgetten->totaal ,
|
||||
"bestemd" => number_format($totbesteed, 0, ',' , '.' ),
|
||||
"verschil" => number_format($budgetten->totaalverschil, 0, ',' , '.' ));
|
||||
|
||||
$opmerking = $this->Bestedingopmerkingen_model->getopmerking($orgid, $kalenderjaarnr);
|
||||
}; // if budgetten
|
||||
if (! isset($sombasisperuitgavetype)) $sombasisperuitgavetype = 0;
|
||||
if (! isset($somextraperuitgavetype)) $somextraperuitgavetype = 0;
|
||||
if (! isset($totsomperuitgavetype)) $totsomperuitgavetype = 0;
|
||||
if (! isset($schooltot)) $schooltot = 0;
|
||||
|
||||
echo json_encode(array('uitgavetypes' =>$uitgavetypes,
|
||||
'basis' =>$basis,
|
||||
'extra' =>$extra,
|
||||
'sombasisperuitgavetype' =>$sombasisperuitgavetype,
|
||||
'somextraperuitgavetype' =>$somextraperuitgavetype,
|
||||
'totsomperuitgavetype' =>$totsomperuitgavetype,
|
||||
'schooltotaal' => $schooltot,
|
||||
'budgetten' => $budgetten,
|
||||
'opmerking' => $opmerking));
|
||||
}
|
||||
|
||||
function getschoolbedragenNieuw(){
|
||||
$orgid = $this->clean_input("orgid");
|
||||
$kalenderjaarnr = $this->clean_input("jaarnr");
|
||||
$soortoverzicht = $this->clean_input('zelfjanee');
|
||||
|
||||
$suborgs = $this->Organisaties_model->getlistrecursief( $orgid, []);
|
||||
array_splice($suborgs, 0,1);
|
||||
$suborgslist= implode(',', $suborgs);
|
||||
|
||||
$uitgavetypes = $this->Finuitgavetypes_model->get_uitgavetypes();
|
||||
if ($soortoverzicht == 3){
|
||||
$budgetten = $this->Toewijzingen_model->gettoewijzingenperjaaroverorgs($suborgslist, $kalenderjaarnr);
|
||||
} else {
|
||||
$budgetten = $this->Toewijzingen_model->gettoewijzingperjaar($orgid, $kalenderjaarnr);
|
||||
}
|
||||
$totbudget = 0;
|
||||
$totbesteed = 0;
|
||||
$basis = array();
|
||||
$extra = array();
|
||||
$sompersoort = array();
|
||||
$schooltot = 0;
|
||||
$opmerking = '';
|
||||
|
||||
if ($budgetten){
|
||||
if ($soortoverzicht == 3){
|
||||
$budgetten->totaal = ROUND(($budgetten->basis + $budgetten->extra));
|
||||
$budgetten->basis = ROUND($budgetten->basis );
|
||||
$budgetten->extra = ROUND($budgetten->extra);
|
||||
} else {
|
||||
$budgetten->totaal = ROUND(($budgetten->basis + $budgetten->extra)/100);
|
||||
$budgetten->basis = ROUND($budgetten->basis / 100);
|
||||
$budgetten->extra = ROUND($budgetten->extra/ 100);
|
||||
}
|
||||
if ($soortoverzicht == 3){
|
||||
$basis = $this->Finbestemmingen_model->get_bestemmingen_over_orgs($orgid, $suborgslist, $kalenderjaarnr,"BASIS");
|
||||
$extra = $this->Finbestemmingen_model->get_bestemmingen_over_orgs($orgid, $suborgslist, $kalenderjaarnr,"EXTRA");
|
||||
|
||||
} else {
|
||||
$basis = $this->Finbestemmingen_model->get_bestemmingen($orgid, $kalenderjaarnr,"BASIS");
|
||||
$extra = $this->Finbestemmingen_model->get_bestemmingen($orgid, $kalenderjaarnr,"EXTRA");
|
||||
}
|
||||
$sombasisperuitgavetype = $this->get_som_per_uitgavetype($basis, $uitgavetypes);
|
||||
$somextraperuitgavetype = $this->get_som_per_uitgavetype($extra, $uitgavetypes);
|
||||
$totsomperuitgavetype = $this->sommeer_per_uitgavetype($sombasisperuitgavetype,$somextraperuitgavetype, $uitgavetypes);
|
||||
$totbesteed = $this->sommeeralles($totsomperuitgavetype);
|
||||
$basis = $this->get_som_regel($basis);
|
||||
$extra = $this->get_som_regel($extra);
|
||||
// todo
|
||||
// bereken budget - besteding verschil per basis/extra/overig
|
||||
$budgetten->basisverschil = number_format($budgetten->basis - $sombasisperuitgavetype[3]->som, 0, ',' , '.' );
|
||||
$budgetten->extraverschil = number_format($budgetten->extra - $somextraperuitgavetype[3]->som, 0, ',' , '.' );
|
||||
$budgetten->totaalverschil = $budgetten->totaal - ($sombasisperuitgavetype[3]->som +$somextraperuitgavetype[3]->som);
|
||||
// todo
|
||||
// zorg dat alle getallen geformateerd zijn met een duizendtalscheidingsteken
|
||||
$budgetten->totaal = number_format($budgetten->totaal, 0 , ',' , '.');
|
||||
$budgetten->basis = number_format($budgetten->basis , 0 , ',' , '.');
|
||||
$budgetten->extra = number_format($budgetten->extra, 0 , ',' , '.');
|
||||
|
||||
foreach($sombasisperuitgavetype as $sompertype){
|
||||
$sompertype->som = number_format($sompertype->som,0, ',' , '.' );
|
||||
}
|
||||
foreach($somextraperuitgavetype as $sompertype){
|
||||
$sompertype->som = number_format($sompertype->som,0, ',' , '.' );
|
||||
}
|
||||
foreach($totsomperuitgavetype as $sompertype){
|
||||
$sompertype->som = number_format($sompertype->som,0, ',' , '.' );
|
||||
}
|
||||
|
||||
$schooltot = array( 'budget' => $budgetten->totaal ,
|
||||
"bestemd" => number_format($totbesteed, 0, ',' , '.' ),
|
||||
"verschil" => number_format($budgetten->totaalverschil, 0, ',' , '.' ));
|
||||
|
||||
if ($soortoverzicht == 3){
|
||||
$opmerking = '';
|
||||
} else {
|
||||
$opmerking = $this->Bestedingopmerkingen_model->getopmerking($orgid, $kalenderjaarnr);
|
||||
}
|
||||
}; // if budgetten
|
||||
if (! isset($sombasisperuitgavetype)) $sombasisperuitgavetype = 0;
|
||||
if (! isset($somextraperuitgavetype)) $somextraperuitgavetype = 0;
|
||||
if (! isset($totsomperuitgavetype)) $totsomperuitgavetype = 0;
|
||||
if (! isset($schooltot)) $schooltot = 0;
|
||||
|
||||
echo json_encode(array('uitgavetypes' =>$uitgavetypes,
|
||||
'basis' =>$basis,
|
||||
'extra' =>$extra,
|
||||
'sombasisperuitgavetype' =>$sombasisperuitgavetype,
|
||||
'somextraperuitgavetype' =>$somextraperuitgavetype,
|
||||
'totsomperuitgavetype' =>$totsomperuitgavetype,
|
||||
'schooltotaal' => $schooltot,
|
||||
'budgetten' => $budgetten,
|
||||
'opmerking' => $opmerking));
|
||||
}
|
||||
function sommeeralles($totsomperuitgavetype){
|
||||
$totsom =0;
|
||||
if ($totsomperuitgavetype){
|
||||
foreach($totsomperuitgavetype as $som){
|
||||
if ($som->code != "REGELSOM"){
|
||||
$totsom += $som->som;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $totsom;
|
||||
}
|
||||
|
||||
function get_som_regel($soorten){
|
||||
if ($soorten){
|
||||
foreach($soorten as $soort){
|
||||
if ($soort->subsoorten){
|
||||
foreach ($soort->subsoorten as $subsoort){
|
||||
$som = 0;
|
||||
if ($subsoort->uitgavetypes){
|
||||
foreach($subsoort->uitgavetypes as $uitgavetype){
|
||||
if ($uitgavetype && $uitgavetype->bedrag){
|
||||
$som += $uitgavetype->bedrag;
|
||||
$uitgavetype->bedrag = number_format($uitgavetype->bedrag,0,',','.');
|
||||
}
|
||||
}
|
||||
}
|
||||
$subsoort->uitgavetypes[3]= new stdClass;
|
||||
$subsoort->uitgavetypes[3]->bedrag =number_format($som,0, ',' , '.');
|
||||
$subsoort->uitgavetypes[3]->code ='REGELSOM';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return $soorten;
|
||||
}
|
||||
|
||||
function sommeer_per_uitgavetype($sombasis,$somextra,$uitgavetypes){
|
||||
$somtot = [];
|
||||
$regelsom =0;
|
||||
if ($uitgavetypes){
|
||||
$index =0;
|
||||
foreach($uitgavetypes as $uitgavetype){
|
||||
$somtot[$index] = new stdClass;
|
||||
$somtot[$index]->code = $uitgavetype->code;
|
||||
$somtot[$index]->naam = $uitgavetype->naam;
|
||||
$somtot[$index]->som =0;
|
||||
foreach($sombasis as $basis){
|
||||
if ($basis->code == $somtot[$index]->code) $somtot[$index]->som += $basis->som;
|
||||
}
|
||||
foreach($somextra as $basis){
|
||||
if ($basis->code == $somtot[$index]->code) $somtot[$index]->som += $basis->som;
|
||||
}
|
||||
|
||||
$regelsom += $somtot[$index]->som;
|
||||
$index += 1;
|
||||
}
|
||||
$somtot[$index] = new stdClass;
|
||||
$somtot[$index]->code = "REGELSOM";
|
||||
$somtot[$index]->naam = "Som";
|
||||
$somtot[$index]->som = $regelsom;
|
||||
}
|
||||
|
||||
return $somtot;
|
||||
}
|
||||
|
||||
function get_som_per_uitgavetype($basis,$uitgavetypes){
|
||||
$sombasis = [];
|
||||
if ($uitgavetypes){
|
||||
foreach($uitgavetypes as $uitgavetype){
|
||||
$sombasis[$uitgavetype->code]= new stdClass;
|
||||
$sombasis[$uitgavetype->code]->naam= $uitgavetype->naam;
|
||||
$sombasis[$uitgavetype->code]->som=0;
|
||||
}
|
||||
if ($basis){
|
||||
foreach($basis as $soort){
|
||||
if ($soort->subsoorten){
|
||||
foreach ($soort->subsoorten as $subsoort){
|
||||
if ($subsoort->uitgavetypes){
|
||||
foreach($subsoort->uitgavetypes as $uitgavetype) {
|
||||
$sombasis[$uitgavetype->code]->som += $uitgavetype->bedrag;
|
||||
} //foreach
|
||||
}// if uitgavetypes
|
||||
}//foreach subsoort
|
||||
}//if subsoort
|
||||
}//foreach basis
|
||||
} // if basis
|
||||
} // if uitgavetypes
|
||||
$somasarray=[];
|
||||
$index = 0;
|
||||
$regelsom=0;
|
||||
foreach($uitgavetypes as $uitgavetype){
|
||||
$somasarray[$index ] = new stdClass;
|
||||
$somasarray[$index]->code = $uitgavetype->code;
|
||||
$somasarray[$index]->naam = $sombasis[$uitgavetype->code]->naam;
|
||||
$somasarray[$index ]->som = round($sombasis[$uitgavetype->code]->som,0);
|
||||
$regelsom += $somasarray[$index ]->som;
|
||||
$index += 1;
|
||||
};
|
||||
$somasarray[$index] = new stdClass;
|
||||
$somasarray[$index]->code ="REGELSOM";
|
||||
$somasarray[$index]->naam = "Som";
|
||||
$somasarray[$index]->som = $regelsom;
|
||||
|
||||
return $somasarray;
|
||||
}
|
||||
|
||||
function getbestuursbedragen(){
|
||||
$targetorgid = $this->clean_input('orgid');
|
||||
$kalenderjaarnr= $this->clean_input("jaarnr");
|
||||
|
||||
$subtot = new stdClass;
|
||||
$subtot->basis =0;
|
||||
$subtot->extra =0;
|
||||
$subtot->som =0;
|
||||
$subtot->budget =0;
|
||||
$subtot->verschil =0;
|
||||
|
||||
$grandtot = new stdClass;
|
||||
$grandtot->basis =0;
|
||||
$grandtot->extra =0;
|
||||
$grandtot->som =0;
|
||||
$grandtot->budget =0;
|
||||
$grandtot->verschil =0;
|
||||
|
||||
$targetorg = $this->Organisaties_model->get_record_by_id($targetorgid);
|
||||
$targetorg->bestemmingen = $this->get_bestuur_bestemmingen($targetorgid, $kalenderjaarnr);
|
||||
$targetorg->budgetten = $this->getbudgetten($targetorgid, $kalenderjaarnr,$targetorg->bestemmingen['som']);
|
||||
|
||||
$grandtot->basis = $targetorg->bestemmingen['basis'];
|
||||
$grandtot->extra = $targetorg->bestemmingen['extra'];
|
||||
$grandtot->som = $targetorg->bestemmingen['som'];
|
||||
$grandtot->budget = $targetorg->budgetten->totaal;
|
||||
$grandtot->verschil = $targetorg->budgetten->verschil;
|
||||
|
||||
//get de som van de uitgaven van de onderliggende organisaties
|
||||
$soort = $targetorg->soort +1;
|
||||
$organisaties = $this->Organisaties_model->getorgs($soort, $targetorgid, true);
|
||||
$others =[];
|
||||
if ($organisaties){
|
||||
$index = 0;
|
||||
foreach ($organisaties as $organisatie){
|
||||
$orgids = $this->getorgids( $organisatie->id);
|
||||
$others[$index] = new stdClass;
|
||||
$others[$index]->naam = $organisatie->brin.'-'.$organisatie->naamkort;
|
||||
$others[$index]->id = $organisatie->id;
|
||||
$others[$index]->budget = $this->get_budgetten_inclusief($orgids, $kalenderjaarnr);
|
||||
$others[$index]->bestemmingen = $this->get_bestemmingen_inclusief($orgids, $kalenderjaarnr);
|
||||
$others[$index]->verschil = $others[$index]->budget->totaal - $others[$index]->bestemmingen->som;
|
||||
$others[$index]->formVerschil = number_format($others[$index]->verschil, 0 ,',' , '.' );
|
||||
$subtot->basis += $others[$index]->bestemmingen->basis;
|
||||
$subtot->extra += $others[$index]->bestemmingen->extra;
|
||||
$subtot->som += $others[$index]->bestemmingen->som;
|
||||
$subtot->budget += $others[$index]->budget->totaal;
|
||||
$subtot->verschil += $others[$index]->verschil;
|
||||
$grandtot->basis += $others[$index]->bestemmingen->basis;
|
||||
$grandtot->extra += $others[$index]->bestemmingen->extra;
|
||||
$grandtot->som += $others[$index]->bestemmingen->som;
|
||||
$grandtot->budget += $others[$index]->budget->totaal;
|
||||
$grandtot->verschil += $others[$index]->verschil;
|
||||
$index += 1;
|
||||
}
|
||||
}
|
||||
$targetorg->budgetten->basis = number_format($targetorg->budgetten->basis, 0, ',' , '.');
|
||||
$targetorg->budgetten->extra = number_format($targetorg->budgetten->extra, 0, ',' , '.');
|
||||
$targetorg->budgetten->totaal = number_format($targetorg->budgetten->totaal, 0, ',' , '.');
|
||||
$targetorg->budgetten->verschil = number_format($targetorg->budgetten->verschil,0, ',' , '.');
|
||||
|
||||
$subtot->basis = number_format($subtot->basis,0 , ',' , '.');
|
||||
$subtot->extra = number_format($subtot->extra,0 , ',' , '.');
|
||||
$subtot->som = number_format($subtot->som,0 , ',' , '.');
|
||||
$subtot->budget = number_format($subtot->budget,0 , ',' , '.');
|
||||
$subtot->verschil = number_format($subtot->verschil,0 , ',' , '.');
|
||||
|
||||
$grandtot->basis = number_format($grandtot->basis,0 , ',' , '.');
|
||||
$grandtot->extra = number_format($grandtot->extra,0 , ',' , '.');
|
||||
$grandtot->som = number_format($grandtot->som,0 , ',' , '.');
|
||||
$grandtot->budget = number_format($grandtot->budget,0 , ',' , '.');
|
||||
$grandtot->verschil = number_format($grandtot->verschil,0 , ',' , '.');
|
||||
// $result = $this->get_orgs_bestemmingen($orgids, $kalenderjaarnr);
|
||||
|
||||
echo json_encode(['targetorg' =>$targetorg,
|
||||
'others' =>$others,
|
||||
'subtot' =>$subtot,
|
||||
'grandtot' =>$grandtot
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
function get_bestemmingen_inclusief($orgids, $jaarnr){
|
||||
$bestemmingen = new stdClass;
|
||||
$bestemmingen->basis = $this->Finbestemmingen_model->getsompersoortoverorgsSummed($orgids, $jaarnr, 'BASIS');
|
||||
$bestemmingen->formBasis = number_format($bestemmingen->basis,0, ',' , '.' );
|
||||
$bestemmingen->extra = $this->Finbestemmingen_model->getsompersoortoverorgsSummed($orgids, $jaarnr, 'EXTRA');
|
||||
$bestemmingen->formExtra = number_format($bestemmingen->extra,0, ',' , '.' );
|
||||
$bestemmingen->som = $bestemmingen->basis + $bestemmingen->extra;
|
||||
$bestemmingen->formSom = number_format($bestemmingen->som,0, ',' , '.' );
|
||||
return $bestemmingen;
|
||||
}
|
||||
|
||||
function get_budgetten_inclusief($orgids,$jaarnr){
|
||||
$budgetten = $this->Toewijzingen_model->gettoewijzingenperjaaroverorgs($orgids, $jaarnr);
|
||||
if ( ! $budgetten){
|
||||
$budgetten = new stdClass;
|
||||
$budgetten->basis = 0;
|
||||
$budgetten->extra = 0;
|
||||
$budgetten->totaal = 0;
|
||||
}
|
||||
$budgetten->formTotaal = number_format($budgetten->totaal, 0 , ',' , '.' );
|
||||
return $budgetten;
|
||||
}
|
||||
|
||||
private function getorgids($orgid){
|
||||
$organisaties = array();
|
||||
$level2 = array();
|
||||
$level3 = array();
|
||||
$idarray = array();
|
||||
$idarray[] =$orgid;
|
||||
$organisaties = $this->Organisaties_model->getorgsonder($orgid);
|
||||
if ($organisaties){
|
||||
foreach($organisaties as $organisatie){
|
||||
$level2= $this->Organisaties_model->getorgsonder($organisatie->id);
|
||||
if ($level2){
|
||||
foreach($level2 as $l2){
|
||||
$level3 = $this->Organisaties_model->getorgsonder($l2->id);
|
||||
if($level3){
|
||||
foreach($level3 as $l3){
|
||||
$idarray[]=$l3->id;
|
||||
};
|
||||
}; // if level3
|
||||
$idarray[]=$l2->id;
|
||||
}
|
||||
}; // if level2
|
||||
$idarray[] = $organisatie->id;
|
||||
}
|
||||
}; // if organisaties
|
||||
return implode(',', $idarray);
|
||||
}
|
||||
|
||||
private function get_bestuur_bestemmingen($orgid, $kalenderjaarnr){
|
||||
|
||||
$orgbestedingen = array();
|
||||
$orgbestedingen['basis'] =0;
|
||||
$orgbestedingen['formBasis'] ='' ;
|
||||
$orgbestedingen['extra'] =0;
|
||||
$orgbestedingen['formExtra'] = '';
|
||||
$orgbestedingen['som'] =0;
|
||||
$orgbestedingen['formSom'] = '';
|
||||
|
||||
$bestemmingenOrgZelf = $this->Finbestemmingen_model->getsompersoortoverorgs($orgid, $kalenderjaarnr);
|
||||
|
||||
if ($bestemmingenOrgZelf){
|
||||
foreach($bestemmingenOrgZelf as $besteding){
|
||||
switch ($besteding->categorie){
|
||||
case "BASIS": $orgbestedingen['basis'] = $besteding->bedrag;
|
||||
$orgbestedingen['formBasis'] = number_format($besteding->bedrag,0, ',' , '.' );
|
||||
break;
|
||||
case "EXTRA": $orgbestedingen['extra'] = $besteding->bedrag;
|
||||
$orgbestedingen['formExtra'] = number_format($besteding->bedrag,0, ',' , '.' );
|
||||
break;
|
||||
};// switch
|
||||
$orgbestedingen['som'] += $besteding->bedrag;
|
||||
}; // foreach bestedingen
|
||||
} ; // if bestedingen
|
||||
$orgbestedingen['formSom']=number_format($orgbestedingen['som'] ,0, ',' , '.' );
|
||||
return $orgbestedingen;
|
||||
}
|
||||
|
||||
private function getbudgetten($orgid, $kalenderjaarnr, $som){
|
||||
$budgetten =$this->Toewijzingen_model->gettoewijzingperjaar($orgid, $kalenderjaarnr);
|
||||
if (!$budgetten){
|
||||
$budgetten=new stdClass;
|
||||
$budgetten->basis = 0;
|
||||
$budgetten->extra = 0;
|
||||
}
|
||||
$budgetten->basis = $budgetten->basis / 100;
|
||||
$budgetten->extra = $budgetten->extra / 100;
|
||||
$budgetten->totaal =$budgetten->basis + $budgetten->extra;
|
||||
$budgetten->verschil = $budgetten->basis + $budgetten->extra - $som;
|
||||
return $budgetten;
|
||||
}
|
||||
function getbestuurperuitgavetype(){
|
||||
$targetorgid = $this->clean_input('orgid');
|
||||
$kalenderjaarnr = $this->clean_input("jaarnr");
|
||||
$targetorg = $this->Organisaties_model->get_record_by_id($targetorgid);
|
||||
list($targetorg->pms,$otherorgs) = $this->get_bestuur_pms($targetorgid, $kalenderjaarnr);
|
||||
$sumother = $this->getsumotherpms($otherorgs);
|
||||
$sumtot = $this->getsumtotpms($targetorg, $sumother);
|
||||
|
||||
$targetorg->pms = $this->format_all_bedragen($targetorg->pms);
|
||||
$sumother = $this->format_all_bedragen($sumother);
|
||||
$sumtot = $this->format_all_bedragen($sumtot);
|
||||
if ($otherorgs){
|
||||
foreach($otherorgs as $otherorg){
|
||||
$otherorg->pms = $this->format_all_bedragen($otherorg->pms);
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode(['targetorg' => $targetorg,
|
||||
'otherorgs' => $otherorgs,
|
||||
'sumother' => $sumother,
|
||||
'sumtot' => $sumtot]);
|
||||
}
|
||||
function format_all_bedragen($pms){
|
||||
|
||||
for ($i = 0 ; $i <=5; $i++){
|
||||
if ($pms[$i] >0 ) $pms[$i]=number_format($pms[$i], 0, ',' , '.');
|
||||
else $pms[$i]='';
|
||||
}
|
||||
return $pms;
|
||||
}
|
||||
|
||||
private function get_bestuur_pms($targetorgid, $kalenderjaarnr){
|
||||
$pms = $this->Finbestemmingen_model->get_pms($targetorgid, $kalenderjaarnr);
|
||||
$targetorg->pms[0] = 0;
|
||||
$targetorg->pms[1] = 0;
|
||||
$targetorg->pms[2] = 0;
|
||||
$targetorg->pms[3] = 0;
|
||||
$targetorg->pms[4] = 0;
|
||||
$targetorg->pms[5] = 0;
|
||||
if ($pms){
|
||||
foreach($pms as $uitgave){
|
||||
if ($uitgave->categorie == "BASIS" && $uitgave->uitgavetype=="PERSONEEL") $targetorg->pms[0] += $uitgave->bedrag;
|
||||
if ($uitgave->categorie == "BASIS" && $uitgave->uitgavetype=="MATERIEEL") $targetorg->pms[1] += $uitgave->bedrag;
|
||||
if ($uitgave->categorie == "BASIS" && $uitgave->uitgavetype=="SCHOLING") $targetorg->pms[2] += $uitgave->bedrag;
|
||||
if ($uitgave->categorie == "EXTRA" && $uitgave->uitgavetype=="PERSONEEL") $targetorg->pms[3] += $uitgave->bedrag;
|
||||
if ($uitgave->categorie == "EXTRA" && $uitgave->uitgavetype=="MATERIEEL") $targetorg->pms[4] += $uitgave->bedrag;
|
||||
if ($uitgave->categorie == "EXTRA" && $uitgave->uitgavetype=="SCHOLING") $targetorg->pms[5] += $uitgave->bedrag;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$organisaties = $this->Organisaties_model->getorgs2($targetorgid);
|
||||
|
||||
if ($organisaties){
|
||||
foreach($organisaties as $organisatie){
|
||||
$org_plus_subs = $this->getorgids($organisatie->orgid);
|
||||
if (! $org_plus_subs) {$org_plus_subs = $organisatie->orgid;};
|
||||
$pms = $this->Finbestemmingen_model->get_pms($org_plus_subs, $kalenderjaarnr);
|
||||
$organisatie->pms[0] = 0;
|
||||
$organisatie->pms[1] = 0;
|
||||
$organisatie->pms[2] = 0;
|
||||
$organisatie->pms[3] = 0;
|
||||
$organisatie->pms[4] = 0;
|
||||
$organisatie->pms[5] = 0;
|
||||
if ($pms){
|
||||
foreach($pms as $uitgave){
|
||||
if ($uitgave->categorie == "BASIS" && $uitgave->uitgavetype=="PERSONEEL") $organisatie->pms[0] += $uitgave->bedrag;
|
||||
if ($uitgave->categorie == "BASIS" && $uitgave->uitgavetype=="MATERIEEL") $organisatie->pms[1] += $uitgave->bedrag;
|
||||
if ($uitgave->categorie == "BASIS" && $uitgave->uitgavetype=="SCHOLING") $organisatie->pms[2] += $uitgave->bedrag;
|
||||
if ($uitgave->categorie == "EXTRA" && $uitgave->uitgavetype=="PERSONEEL") $organisatie->pms[3] += $uitgave->bedrag;
|
||||
if ($uitgave->categorie == "EXTRA" && $uitgave->uitgavetype=="MATERIEEL") $organisatie->pms[4] += $uitgave->bedrag;
|
||||
if ($uitgave->categorie == "EXTRA" && $uitgave->uitgavetype=="SCHOLING") $organisatie->pms[5] += $uitgave->bedrag;
|
||||
}
|
||||
}
|
||||
}
|
||||
}; // if organisaties
|
||||
return [$targetorg->pms , $organisaties];
|
||||
}
|
||||
|
||||
function getsumtotpms($targetorg, $sumother){
|
||||
$sumtot = [];
|
||||
if (! $sumother || ! $targetorg) return $sumtot;
|
||||
$sumtot[0] = $targetorg->pms[0] + $sumother[0];
|
||||
$sumtot[1] = $targetorg->pms[1] + $sumother[1];
|
||||
$sumtot[2] = $targetorg->pms[2] + $sumother[2];
|
||||
$sumtot[3] = $targetorg->pms[3] + $sumother[3];
|
||||
$sumtot[4] = $targetorg->pms[4] + $sumother[4];
|
||||
$sumtot[5] = $targetorg->pms[5] + $sumother[5];
|
||||
return $sumtot;
|
||||
}
|
||||
|
||||
function getsumotherpms($otherorgs){
|
||||
$sumother =[];
|
||||
if (! $otherorgs) return $sumother;
|
||||
$sumother[0] = 0;
|
||||
$sumother[1] = 0;
|
||||
$sumother[2] = 0;
|
||||
$sumother[3] = 0;
|
||||
$sumother[4] = 0;
|
||||
$sumother[5] = 0;
|
||||
foreach($otherorgs as $org){
|
||||
if ($org->pms){
|
||||
$sumother[0] += $org->pms[0];
|
||||
$sumother[1] += $org->pms[1];
|
||||
$sumother[2] += $org->pms[2];
|
||||
$sumother[3] += $org->pms[3];
|
||||
$sumother[4] += $org->pms[4];
|
||||
$sumother[5] += $org->pms[5];
|
||||
}
|
||||
}
|
||||
return $sumother;
|
||||
}
|
||||
|
||||
function PdfFinancien(){
|
||||
$input = json_decode($this->input->post('data'));
|
||||
|
||||
$soort = $input->soort;
|
||||
switch ($soort){
|
||||
case 0 : $titel = "Gesommeerde bestedingen onderliggende organisaties"; break;
|
||||
case 1 : $titel = "Details eigen organisatie"; break;
|
||||
case 2 : $titel = "Gesommeerde uitgaven personeel, materieel en scholing"; break;
|
||||
case 3 : $titel = "Details onderliggende organisaties" ; break;
|
||||
default: $titel = "Rapport";
|
||||
}
|
||||
$data = ['inhoud' =>$input->html,
|
||||
'jaar' => $input->jaar,
|
||||
'org' => $input->org,
|
||||
'titel' => $titel];
|
||||
$html = $this->load->view("monpas/reports/financien", $data, true);
|
||||
$filenaam ="financien";
|
||||
$this->Phantom_model->create_pdf($html, $filenaam, FALSE, TRUE, [50,50,100, 70], 'LANDSCAPE');
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class Beheer extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array( "shared/Users_model",
|
||||
"monpas/Menus_model",
|
||||
"monpas/Modules_model",
|
||||
"monpas/Versies_model",
|
||||
"monpas/Ijkpunten_model",
|
||||
"monpas/Indicatoren_model");
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
function getmodules(){
|
||||
$modules = $this->Modules_model->getmodulesmetlijst();
|
||||
echo json_encode($modules);
|
||||
}
|
||||
function getversies(){
|
||||
if (!$this->userid) die;
|
||||
$module=$this->uri->segment(4);
|
||||
$versies=$this->Versies_model->getallversies($module);
|
||||
if ($versies){
|
||||
foreach($versies as $versie){
|
||||
$versie->ingangsdatum = mysql2date($versie->ingangsdatum);
|
||||
$versie->systemnorm = str_replace('.', ',', $versie->systemnorm);
|
||||
$versie->deleteok = true;
|
||||
//TODO deleteok bepalen
|
||||
}
|
||||
}
|
||||
echo json_encode($versies);
|
||||
}
|
||||
function insertversie(){
|
||||
//TODO clean input
|
||||
if (!$this->userid || !$this->super) die;
|
||||
$naam = $this->clean_input("nieuwnaam");
|
||||
$module = $this->clean_input("module");
|
||||
$id = $this->Versies_model->insert_record(array( 'naam' =>$naam ,
|
||||
'modulenr' =>$module,
|
||||
'ingangsdatum' =>date('Y-m-d')));
|
||||
$versie = $this->Versies_model->getversie($id);
|
||||
|
||||
$versie->ingangsdatum =mysql2date($versie->ingangsdatum);
|
||||
$versie->systemnorm = str_replace('.', ',', $versie->systemnorm);
|
||||
$versie->deleteok = true;
|
||||
echo json_encode($versie);
|
||||
}
|
||||
function updateversie(){
|
||||
//TODO clean input
|
||||
if (!$this->userid || !$this->super) die;
|
||||
$data = array('naam' => $this->clean_input('naam') ,
|
||||
'ingangsdatum' =>date2mysql($this->clean_input('ingangsdatum')),
|
||||
'systemnorm' => str_replace(',', '.', $this->clean_input('systemnorm') ));
|
||||
$this->Versies_model->update_record($data, $this->clean_input('id'));
|
||||
}
|
||||
function deleteversie(){
|
||||
// TODO clean input en controleer foreign key afhankelijkheden
|
||||
if (!$this->userid || !$this->super) die;
|
||||
$errortekst='';
|
||||
if (! $this->writer) {$errortekst ="U bent niet geautoriseerd om versies te verwijderen.";}
|
||||
else {
|
||||
$versieid = $this->uri->segment(4);
|
||||
$this->Versies_model->delete_record($versieid);
|
||||
}
|
||||
echo json_encode($errortekst);
|
||||
}
|
||||
function getijkpunten(){
|
||||
//TODO clean input
|
||||
if (!$this->userid ) die;
|
||||
$versieid = $this->uri->segment(4);
|
||||
$ijkpunten = $this->Ijkpunten_model->getijkpunten1($versieid);
|
||||
if ($ijkpunten){
|
||||
foreach($ijkpunten as $ijkpunt){
|
||||
$ijkpunt->indicatoren= $this->Indicatoren_model->getindicatoren($ijkpunt->id);
|
||||
}; // foreach
|
||||
}; // if ijkpunten
|
||||
echo json_encode($ijkpunten);
|
||||
}
|
||||
function insertijkpunt(){
|
||||
if (!$this->userid ) die;
|
||||
$data=array('nummer' => $this->clean_input("nummer"),
|
||||
"versie_id" => $this->clean_input("versie_id"),
|
||||
'omschrijving' => $this->clean_input('omschrijving'),
|
||||
'toelichting' => $this->clean_input('toelichting') );
|
||||
$id = $this->Ijkpunten_model->insert_record( $data);
|
||||
$ijkpunt = $this->Ijkpunten_model->getijkpunt($id);
|
||||
echo json_encode($ijkpunt);
|
||||
}
|
||||
function updateijkpunt(){
|
||||
if (!$this->userid ) die;
|
||||
//TODO clean input
|
||||
$data= array('nummer' => $this->clean_input("nummer"),
|
||||
"versie_id" => $this->clean_input("versie_id"),
|
||||
"omschrijving" => $this->clean_input("omschrijving"),
|
||||
"toelichting" =>$this->clean_input("toelichting") );
|
||||
$this->Ijkpunten_model->update_record($data, $this->clean_input('id'));
|
||||
}
|
||||
function deleteijkpunt(){
|
||||
//TODO clean input
|
||||
if (!$this->userid || ($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) <= 0)) {die;};
|
||||
$ijkid =$this->uri->segment(4);
|
||||
$this->Ijkpunten_model->delete_record($ijkid);
|
||||
}
|
||||
function insertindicator(){
|
||||
//TODO clean input
|
||||
if (!$this->userid || ($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) <= 0)) {die;};
|
||||
|
||||
$data=array("ijkpunt_id" => $this->clean_input('ijkpunt_id'),
|
||||
"nummer" => $this->clean_input('nummer' ),
|
||||
"gewicht" => str_replace(',','.', $this->clean_input('gewicht')),
|
||||
"inspectie" =>$this->clean_input('inspectie'),
|
||||
"omschrijving1" => $this->clean_input('omschrijving1'),
|
||||
"omschrijving2" => $this->clean_input('omschrijving2')
|
||||
);
|
||||
$id = $this->Indicatoren_model->insert_record($data);
|
||||
$indicator = $this->Indicatoren_model->getindicator($id);
|
||||
$indicator->deleteok = true;
|
||||
echo json_encode($indicator);
|
||||
}
|
||||
function deleteindicator(){
|
||||
//TODO clean input
|
||||
if (!$this->writer || !$this->userid) return;
|
||||
$this->Indicatoren_model->delete_record($this->uri->segment(4));
|
||||
echo json_encode(true);
|
||||
}
|
||||
function updateindicator(){
|
||||
//TODO clean input
|
||||
if (!$this->writer || !$this->userid) return;
|
||||
$indicatorid = $this->clean_input("id");
|
||||
$data = array('nummer' => $this->clean_input("nummer"),
|
||||
"omschrijving1" => $this->clean_input("omschrijving1"),
|
||||
"omschrijving2" => $this->clean_input("omschrijving2"),
|
||||
"inspectie" => $this->clean_input("inspectie"),
|
||||
"gewicht" => $this->clean_input("gewicht"));
|
||||
$this->Indicatoren_model->update_record($data, $indicatorid);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,367 @@
|
||||
<?php if ( ! defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' );
|
||||
|
||||
class Berichten extends MY_Controller {
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$models = array(
|
||||
"shared/Users_model",
|
||||
"shared/Orgusers_model",
|
||||
"shared/Autorisaties_model",
|
||||
"monpas/Berichten_model",
|
||||
"monpas/Modules_model",
|
||||
"monpas/Modulebericht_model",
|
||||
"monpas/Getoondeberichten_model",
|
||||
"shared/Session_model",
|
||||
);
|
||||
$this->load->model( $models );
|
||||
$this->load->helper( 'string' );
|
||||
if ( ! $this->check_online_status() )
|
||||
{
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
function checkrechten()
|
||||
{
|
||||
if ( ! $this->userid ) die;
|
||||
$orguserid = $this->Orgusers_model->get_fieldvalue( array("user_id" => $this->userid, "organisatie_id" => $this->globorgid), "id" );
|
||||
$niveau = $this->Autorisaties_model->get_fieldvalue( array("orguser_id" => $orguserid), "nivo_id" );
|
||||
|
||||
if ( $niveau == 1 || $niveau == 2 )
|
||||
{
|
||||
echo json_encode( TRUE );
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function checkadmin(){
|
||||
$orguserid = $this->Orgusers_model->get_fieldvalue( array("user_id" => $this->userid, "organisatie_id" => $this->globorgid), "id" );
|
||||
$niveau = $this->Autorisaties_model->get_fieldvalue( array("orguser_id" => $orguserid), "nivo_id" );
|
||||
|
||||
return $niveau;
|
||||
}
|
||||
|
||||
|
||||
function getberichten()
|
||||
{
|
||||
if ( ! $this->userid ) die;
|
||||
|
||||
|
||||
$orguserid = $this->Orgusers_model->get_fieldvalue( array("user_id" => $this->userid, "organisatie_id" => $this->globorgid), "id" );
|
||||
$niveau = $this->Autorisaties_model->get_fieldvalue( array("orguser_id" => $orguserid), "nivo_id" );
|
||||
if ( $niveau == 1 || $niveau == 2 )
|
||||
{
|
||||
$berichten = $this->Berichten_model->getalleberichten();
|
||||
}
|
||||
else
|
||||
{
|
||||
$inlog = $this->Users_model->get_fieldvalue( array("id" => $this->userid), "inlogdatum" );
|
||||
|
||||
$berichten = $this->Berichten_model->getberichten( $this->userid);
|
||||
}
|
||||
|
||||
$berichten = $this->displayMessages( $berichten );
|
||||
|
||||
echo json_encode( $berichten );
|
||||
}
|
||||
|
||||
function getberichtenVoorpagina()
|
||||
{
|
||||
$orguserid = $this->Orgusers_model->get_fieldvalue( array("user_id" => $this->userid, "organisatie_id" => $this->globorgid), "id" );
|
||||
$niveau = $this->Autorisaties_model->get_fieldvalue( array("orguser_id" => $orguserid), "nivo_id" );
|
||||
if ( $niveau == 1 || $niveau == 2 )
|
||||
{
|
||||
$berichten = $this->Berichten_model->getalleberichten();
|
||||
}
|
||||
else
|
||||
{
|
||||
$frontpage = true;
|
||||
$berichten = $this->Berichten_model->getberichten( $this->userid, $frontpage);
|
||||
|
||||
foreach($berichten ? $berichten :[] as $bericht){
|
||||
$getoond = $this->Getoondeberichten_model->insert_record(array("bericht_id" => $bericht->id, "user_id" => $this->userid));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$berichten = $this->displayMessages( $berichten );
|
||||
|
||||
|
||||
echo json_encode( $berichten );
|
||||
}
|
||||
|
||||
function getAdminBerichten()
|
||||
{
|
||||
if ( ! $this->userid ) die;
|
||||
$admin = $this->checkadmin();
|
||||
if(!$admin = 1 || !$admin = 2){
|
||||
return;
|
||||
}
|
||||
|
||||
$berichten = $this->Berichten_model->getalleberichten();
|
||||
if ( ! $berichten )
|
||||
{
|
||||
$berichten = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$berichten = $this->displayMessages( $berichten );
|
||||
|
||||
}
|
||||
echo json_encode( $berichten );
|
||||
}
|
||||
|
||||
private function displayMessages( $berichten )
|
||||
{
|
||||
foreach ( $berichten ? $berichten : [] as $bericht )
|
||||
{
|
||||
$bericht->datum = mysql2date( $bericht->startdatum );
|
||||
$bericht->inhoud = nl2br( base64_decode( $bericht->inhoud ) );
|
||||
}
|
||||
return $berichten;
|
||||
}
|
||||
|
||||
function getmodules()
|
||||
{
|
||||
if ( ! $this->userid ) die;
|
||||
$admin = $this->checkadmin();
|
||||
if(!$admin = 1 || !$admin = 2){
|
||||
return;
|
||||
}
|
||||
$berichtid = $this->uri->segment( 4 );
|
||||
$clusters = $this->Modules_model->getclusters();//haal alle cluster op
|
||||
|
||||
if ( ! $clusters )
|
||||
{
|
||||
echo json_encode( FALSE );
|
||||
|
||||
return;
|
||||
}
|
||||
for ( $i = 0; $i < count( $clusters ); $i ++ )
|
||||
{//haal bijbehorende modules op
|
||||
$clusterid = $clusters[ $i ]->clusterid;
|
||||
$clusters[ $i ]->modules = $this->Modules_model->getmodulesbijcluster( $clusterid );
|
||||
}
|
||||
|
||||
$bclusters = $this->Berichten_model->getberichtclusters( $berichtid );// haal de clusters op waaraan het bericht is gelinkt
|
||||
|
||||
|
||||
if ( $bclusters )
|
||||
{
|
||||
for ( $i = 0; $i < count( $bclusters ); $i ++ )
|
||||
{//haal bijbehorende modules op waaraan het bericht is gelinkt
|
||||
$bclusterid = $bclusters[ $i ]->clusterid;
|
||||
$bclusters[ $i ]->bmodules = $this->Berichten_model->getberichtmodules( $bclusterid, $berichtid );
|
||||
|
||||
}
|
||||
}
|
||||
$clusterZ = new stdClass();//cluster object voor ongeclusterde modules
|
||||
$clusterZ->clusterid = 0;
|
||||
$clusterZ->naam = "Ongeclusterd";
|
||||
$clusterZ->modules = $this->Modules_model->getmodulesbijcluster( 0 );
|
||||
|
||||
if ( isset( $clusterZ->modules ) )
|
||||
{
|
||||
foreach ( $clusterZ->modules as $moduleZ )
|
||||
{
|
||||
|
||||
$gelinkt = $this->Berichten_model->getberichtenbijmodule( $berichtid, $moduleZ->modulenr );//haal berichten op die bij de ongeclusterde modules horen
|
||||
if ( $gelinkt )
|
||||
{
|
||||
$moduleZ->vinkje = 'T';
|
||||
}
|
||||
else
|
||||
{
|
||||
$moduleZ->vinkje = 'F';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $bclusters )
|
||||
{
|
||||
|
||||
$y = 0;
|
||||
$n = $y;
|
||||
for ( $y = 0; $y < count( $clusters ); $y ++ )
|
||||
{ ////ga per cluster een bericht bij hoort, dan true
|
||||
if ( isset( $bclusters[ $n ] ) )
|
||||
if ( $clusters[ $y ]->clusterid == $bclusters[ $n ]->clusterid )
|
||||
{
|
||||
// $clusters[$y]->vinkje = 'T';
|
||||
$s = 0;
|
||||
$v = $s;
|
||||
$aantal = count( $clusters[ $y ]->modules );//ga per module na of er een bericht bij hoort, dan true
|
||||
$clusters[ $y ]->aantal = $aantal;
|
||||
for ( $s = 0; $s < $aantal; $s ++ )
|
||||
{
|
||||
if ( isset( $bclusters[ $n ]->bmodules[ $v ] ) )
|
||||
{
|
||||
if ( $clusters[ $y ]->modules[ $s ]->modulenr == $bclusters[ $n ]->bmodules[ $v ]->modulenr )
|
||||
{
|
||||
$clusters[ $y ]->modules[ $s ]->vinkje = 'T';
|
||||
$v ++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$clusters[ $y ]->modules[ $s ]->vinkje = 'F';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$clusters[ $y ]->modules[ $s ]->vinkje = 'F';
|
||||
}
|
||||
}
|
||||
$n ++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( $clusterZ->modules )
|
||||
{//voeg de ongeclusterde modules met berichtinfo toe aan de clusterarray
|
||||
array_unshift( $clusters, $clusterZ );
|
||||
}
|
||||
echo json_encode( $clusters );
|
||||
}
|
||||
|
||||
public function saveBericht()
|
||||
{
|
||||
$admin = $this->checkadmin();
|
||||
if(!$admin = 1 || !$admin = 2){
|
||||
return;
|
||||
}
|
||||
$berichtID = $this->uri->segment( 4 );
|
||||
$datum = str_replace( '/', '-', $this->input->post( 'datum' ));
|
||||
$samenvatting = $this->input->post( 'samenvatting' );
|
||||
$inhoud = $this->input->post( 'inhoud' );
|
||||
$samenvatting = stripslashes( implode( "", explode( "\\", $samenvatting )));
|
||||
if (! $samenvatting || ! strlen( $samenvatting )> 3){
|
||||
$this->deletebericht($berichtID);
|
||||
}
|
||||
|
||||
if (! $inhoud || ! strlen( $inhoud )> 9){
|
||||
$this->deletebericht($berichtID);
|
||||
}
|
||||
$inhoud = base64_encode( $inhoud );
|
||||
|
||||
if (!$datum)
|
||||
{ $datum = date( 'Y-m-d G:i:s' );
|
||||
}
|
||||
|
||||
$berichtID = $this->Berichten_model->save_record( [
|
||||
'startdatum' => date2mysql( $datum ),
|
||||
'samenvatting' => $samenvatting,
|
||||
'inhoud' => $inhoud
|
||||
], $berichtID );
|
||||
|
||||
echo json_encode( $berichtID );
|
||||
}
|
||||
|
||||
public function create_empty_bericht()
|
||||
{
|
||||
$admin = $this->checkadmin();
|
||||
if(!$admin = 1 || !$admin = 2){
|
||||
return;
|
||||
}
|
||||
$this->Berichten_model->insert_record( ['startdatum' => date( 'Y-m-d H:i:s' )] );
|
||||
}
|
||||
|
||||
function koppelmodule()
|
||||
{
|
||||
$admin = $this->checkadmin();
|
||||
if(!$admin = 1 || !$admin = 2){
|
||||
return;
|
||||
}
|
||||
$vinkje = $this->clean_input( "modulevinkje" );
|
||||
$berichtid = $this->clean_input( "berichtid" );
|
||||
$modulenr = $this->clean_input( "moduleid" );
|
||||
|
||||
$mededeling = "er is iets mis gegaan";
|
||||
if ( $vinkje && $berichtid && $modulenr )
|
||||
{
|
||||
if ( $vinkje == 'T' )
|
||||
{
|
||||
$this->Modulebericht_model->insert_record( array("modulenr" => $modulenr, "bericht_id" => $berichtid) );
|
||||
$mededeling = "het bericht is gekoppeld";
|
||||
}
|
||||
if ( $vinkje == 'F' )
|
||||
{
|
||||
$this->Modulebericht_model->delete_record_where( array("modulenr" => $modulenr, "bericht_id" => $berichtid) );
|
||||
$mededeling = "de koppeling is verwijderd";
|
||||
}
|
||||
}
|
||||
echo json_encode( $mededeling );
|
||||
}
|
||||
|
||||
function koppelcluster()
|
||||
{
|
||||
$admin = $this->checkadmin();
|
||||
if(!$admin = 1 || !$admin = 2){
|
||||
return;
|
||||
}
|
||||
$vinkje = $this->clean_input( "clustervinkje" );
|
||||
$berichtid = $this->clean_input( "berichtid" );
|
||||
$clusterid = $this->clean_input( "clusterid" );
|
||||
$mededeling = "er is iets mis gegaan";
|
||||
if ( $vinkje && $berichtid && $clusterid >= 0 )
|
||||
{
|
||||
$modules = $this->Modules_model->get_records_where( array("cluster_id" => $clusterid) );
|
||||
if ( $vinkje == 'T' )
|
||||
{
|
||||
foreach ( $modules as $module )
|
||||
{
|
||||
|
||||
$newid = $this->Modulebericht_model->insert_record( array("modulenr" => $module->sysnr, "bericht_id" => $berichtid) );
|
||||
}
|
||||
$mededeling = "het bericht is gekoppeld";
|
||||
}
|
||||
if ( $vinkje == 'F' )
|
||||
{
|
||||
foreach ( $modules as $module )
|
||||
{
|
||||
$this->Modulebericht_model->delete_record_where( array("modulenr" => $module->sysnr, "bericht_id" => $berichtid) );
|
||||
}
|
||||
$mededeling = "de koppelingen zijn verwijderd";
|
||||
}
|
||||
}
|
||||
echo json_encode( $mededeling );
|
||||
}
|
||||
|
||||
|
||||
function berichtomwegtegooien($berichtid){
|
||||
if ( ! $this->userid ) die;
|
||||
$admin = $this->checkadmin();
|
||||
if(!$admin = 1 || !$admin = 2){
|
||||
return;
|
||||
}
|
||||
$berichtid = $this->uri->segment( 4 );
|
||||
if ( $berichtid )
|
||||
{
|
||||
$this->deletebericht($berichtid);
|
||||
echo json_encode( 'bericht verwijderd' );
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode( 'er is iets misgegaan' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function deletebericht($berichtid)
|
||||
{if ( ! $this->userid ) die;
|
||||
$this->Berichten_model->delete_record( $berichtid );
|
||||
$this->Modulebericht_model->delete_record_where( array('bericht_id' => $berichtid) );
|
||||
$this->Getoondeberichten_model->delete_record_where( array('bericht_id' => $berichtid) );
|
||||
return(true);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Compactsop extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array(
|
||||
"Docx_model",
|
||||
"monpas/Arrangementen_model",
|
||||
"monpas/Arrangementen_piv_aantal_model",
|
||||
"monpas/Compactsop_model",
|
||||
"monpas/Compactsoponderdelen_model",
|
||||
"monpas/Diversiteits_model",
|
||||
"monpas/Filledversions_model",
|
||||
"monpas/Groepen_model",
|
||||
"monpas/Ijkpunten_model",
|
||||
"monpas/Indicatoren_model",
|
||||
"shared/Kalenderjaren_model",
|
||||
"shared/Aantalleerlingen_model",
|
||||
"shared/Licenties_model",
|
||||
"monpas/Menus_model",
|
||||
"monpas/Modules_model",
|
||||
"monpas/Ondersteuningtijden_model",
|
||||
"monpas/Oordelen_model",
|
||||
"monpas/Orgversies_model",
|
||||
"shared/Schooljaren_model",
|
||||
"monfin2/Finbestemmingen_model",
|
||||
"monpas/Versies_model",
|
||||
"Phantom_model",
|
||||
"monpas/Scores_model",
|
||||
"monpas/Sop_model",
|
||||
"monpas/Sopinhouden_model",
|
||||
"monpas/Sopviews_model",
|
||||
"monpas/Tlvs_model"
|
||||
|
||||
|
||||
|
||||
);
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
}
|
||||
|
||||
function getrechten(){
|
||||
if (!$this->userid) die;
|
||||
$editok = false;
|
||||
$autorisatie = $this->Autorisaties_model->check_autorisatie($this->userrole,259 );
|
||||
|
||||
if ( $autorisatie> 0) $editok = true;
|
||||
echo json_encode($editok);
|
||||
}
|
||||
|
||||
function controleerschool(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->globorgid;
|
||||
$school = false;
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($orgid);
|
||||
if ($organisatie && $organisatie->soort == 4) $school = true;
|
||||
echo json_encode($school);
|
||||
}
|
||||
|
||||
function getSchooljaren(){
|
||||
if (!$this->userid) die;
|
||||
$schooljaren = $this->Schooljaren_model->getschooljaren();
|
||||
echo json_encode($schooljaren);
|
||||
}
|
||||
|
||||
function getCompactSop(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->globorgid;
|
||||
$schooljaar = $this->uri->segment(4);
|
||||
$compactsopID = $this->Compactsop_model->get_fieldvalue(['organisatie_id'=>$orgid, 'schooljaarnummer'=>$schooljaar], 'id');
|
||||
echo json_encode($compactsopID);
|
||||
}
|
||||
|
||||
function download_pdf(){
|
||||
$fileID = $this->uri->segment( 4 );
|
||||
$this->Compactsop_model->downloadCompactSop ( $fileID );
|
||||
}
|
||||
|
||||
function getOnderdelenEnVersies(){
|
||||
if (!$this->userid) die;
|
||||
$schooljaar = $this->uri->segment(4);
|
||||
$compacteVersies = new CompacteVersies($schooljaar);
|
||||
$onderdelen = $compacteVersies->getOnderdelen();
|
||||
|
||||
echo json_encode($onderdelen);
|
||||
}
|
||||
|
||||
function getSchoolgegevens(){
|
||||
if (!$this->userid) die;
|
||||
$school = $this->Schooldetails_model->getschool($this->globorgid);
|
||||
if(!$school){
|
||||
$school = $this->Organisaties_model->get_record_by_id($this->globorgid);
|
||||
}
|
||||
echo json_encode($school);
|
||||
}
|
||||
|
||||
function saveSchool(){
|
||||
if (!$this->userid) die;
|
||||
$id = $this->clean_input('id');
|
||||
if($id != $this->globorgid) return;
|
||||
$straat = strip_slashes($this->clean_input('straat'));
|
||||
$plaats = strip_slashes($this->clean_input('plaats'));
|
||||
$foon = strip_slashes($this->clean_input('telefoon'));
|
||||
$mail = strip_slashes($this->clean_input('email1'));
|
||||
$web = strip_slashes($this->clean_input('web'));
|
||||
|
||||
$data = [
|
||||
'straat' => $straat,
|
||||
'plaats' => $plaats,
|
||||
'telefoon' => $foon,
|
||||
'email1' => $mail,
|
||||
'web' => $web,
|
||||
'organisatie_id' => $id
|
||||
];
|
||||
|
||||
|
||||
$this->Organisaties_model->update_record(['plaats' =>$plaats], $id);
|
||||
|
||||
$detailid = $this->Schooldetails_model->get_fieldvalue(['organisatie_id'=>$id], 'id');
|
||||
if($detailid){
|
||||
$this->Schooldetails_model->update_record($data,$detailid);
|
||||
}
|
||||
else{
|
||||
$detailid = $this->Schooldetails_model->insert_record($data);
|
||||
}
|
||||
echo json_encode($detailid);
|
||||
}
|
||||
|
||||
function maakPDF(){
|
||||
if (!$this->userid) die;
|
||||
$schooljaarnr = $this->clean_input('schooljaarnr');
|
||||
$onderdelen = $this->input->post('onderdelen');
|
||||
$omvangjaren = $this->clean_input('jaren');
|
||||
|
||||
$compact = new CompacteOnderdelen($schooljaarnr, $onderdelen, $omvangjaren);
|
||||
$compacteonderdelen = $compact->getCompacteOnderdelen();
|
||||
$schoolID = $this->globorgid;
|
||||
$html = (new CompactePaginas($compacteonderdelen))->getHtml();
|
||||
|
||||
file_put_contents(MYROOTPATH.'public/tmp/temp'.$schoolID.'.html', $html);
|
||||
|
||||
echo json_encode($this->globorgid);
|
||||
}
|
||||
|
||||
public function uploadLogo($schoolID)
|
||||
{
|
||||
$savePath = MYROOTPATH.'public/images/logos/';
|
||||
$this->load->helper('string');
|
||||
$pathParts = pathinfo($_FILES['image_file']['name']);
|
||||
$extension = $pathParts['extension'];
|
||||
|
||||
$filename = random_string('alnum', 15).'.'.$extension;
|
||||
$source = $_FILES['image_file']['tmp_name'];
|
||||
$target = $savePath.$filename;
|
||||
rename($source, $target );
|
||||
//TODO: unlink eventueel oud logo
|
||||
$logo = $this->Schooldetails_model->getLogo($schoolID);
|
||||
$padNaam = $savePath.$logo;
|
||||
unlink($padNaam);
|
||||
$this->Schooldetails_model->update_record_where(['logo'=>$filename], ['organisatie_id' =>$schoolID]);
|
||||
}
|
||||
|
||||
function getLogo(){
|
||||
$schoolID = $this->clean_input('schoolID');
|
||||
$logo =$this->Schooldetails_model->getLogo($schoolID);
|
||||
$this->json($logo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,332 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class Diversiteit extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array( "shared/Users_model",
|
||||
"monpas/Ondersteuningsvormen_model",
|
||||
"monpas/Aantalxondersteuningsvorm_model",
|
||||
"monpas/Leerkrachten_model",
|
||||
"monpas/Groepen_model",
|
||||
"shared/Schooljaren_model","Phantom_model",
|
||||
"monpas/Ondersteuningtijden_model",
|
||||
"monpas/Dq_model",
|
||||
"monpas/Diversiteits_model",
|
||||
"monpas/Combifactoren_model");
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
function getgroepen(){
|
||||
//TODO clean input
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->clean_input('orgID');
|
||||
$schooljaarnr = $this->clean_input('schooljaar');
|
||||
$module = $this->clean_input('module');
|
||||
$groepen = $this->Groepen_model->getgroepen($orgid, $schooljaarnr, $module);
|
||||
|
||||
if ($groepen) {
|
||||
foreach ($groepen as $groep) {
|
||||
$groepasarray = explode(';', $groep->niveau);
|
||||
$groep->combi = count($groepasarray);
|
||||
|
||||
$groep->tijden = new stdClass;
|
||||
$groep->tijden = $this->Ondersteuningtijden_model->getgroeptijden($groep->id);
|
||||
}
|
||||
}
|
||||
echo json_encode($groepen);
|
||||
}
|
||||
|
||||
function getgroepenso(){
|
||||
//TODO clean input
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->uri->segment(4);
|
||||
$schooljaarnr = $this->uri->segment(5);
|
||||
$ondersteuning = 'T';
|
||||
$groepen = $this->Groepen_model->getgroepenSboSo($orgid, $schooljaarnr);
|
||||
if($groepen) {
|
||||
foreach ($groepen as $groep) {
|
||||
if($groep->ondersteuning == 'F'){
|
||||
$ondersteuning = 'F';
|
||||
continue;
|
||||
}
|
||||
$groepasarray = explode(';', $groep->niveau);
|
||||
$groep->combi = count($groepasarray);
|
||||
|
||||
$groep->tijden = new stdClass;
|
||||
$groep->tijden = $this->Ondersteuningtijden_model->getgroeptijden($groep->id);
|
||||
}
|
||||
}
|
||||
echo json_encode(['groepen' =>$groepen, 'ondersteuning' =>$ondersteuning]);
|
||||
}
|
||||
|
||||
|
||||
function getondersteuningsvormen(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->clean_input("orgid");
|
||||
$schooljaarnr = $this->clean_input("schooljaarnr");
|
||||
$module = $this->clean_input("module");
|
||||
$minnivo = $this->clean_input("minnivo");
|
||||
$maxnivo = $this->clean_input("maxnivo");
|
||||
|
||||
$os =$this->Diversiteits_model->getosvormen($orgid, $schooljaarnr, $minnivo, $maxnivo, $module);
|
||||
echo json_encode($os);
|
||||
}
|
||||
|
||||
function pdfdiversiteitbar(){
|
||||
$inputstring = $this->input->post('data');
|
||||
$input = json_decode($inputstring);
|
||||
$inputimage = $input->image;
|
||||
$orgid = $input->orgid;
|
||||
$organisatie = $this->Organisaties_model->getOrganisatie($orgid);
|
||||
|
||||
$schooljaarnr = $input->schooljaarnr;
|
||||
$schooljaarnaam = $this->Schooljaren_model->get_fieldvalue(array("schooljaarnr"=>$schooljaarnr),"naam");
|
||||
|
||||
$today = date("d-m-Y");
|
||||
$data= array("organisatie" => $organisatie,
|
||||
"inputimage" => $inputimage,
|
||||
"schooljaarnaam" => $schooljaarnaam,
|
||||
"vandaag" => $today);
|
||||
$html = $this->load->view("monpas/reports/diversiteitbar", $data, true);
|
||||
$filenaam="diversiteit";
|
||||
$this->Phantom_model->create_pdf($html, $filenaam, FALSE, FALSE, FALSE);
|
||||
}
|
||||
|
||||
function printaantallen(){
|
||||
$orgid = $this->uri->segment(4);
|
||||
$schooljaarnr = $this->uri->segment(5);
|
||||
$organisatie = $this->Organisaties_model->getOrganisatie($orgid);
|
||||
$schooljaarnaam = $this->Schooljaren_model->get_fieldvalue(array("schooljaarnr"=>$schooljaarnr),"naam");
|
||||
|
||||
$schooltotaal = 0;
|
||||
$schoolgewogentot = 0;
|
||||
$schoolsom1 = 0;
|
||||
$schoolsom2 = 0;
|
||||
$schoolsom3 = 0;
|
||||
$schoolsom4 = 0;
|
||||
$schooldiversiteit = 0;
|
||||
$schooldq = 0;
|
||||
|
||||
$groepen = $this->Groepen_model->getgroepen($orgid, $schooljaarnr);
|
||||
if ($groepen){
|
||||
foreach($groepen as $groep){
|
||||
$schooltotaal = $schooltotaal + $groep->totaantal;
|
||||
$schoolsom1 = $schoolsom1 + $groep->som1;
|
||||
$schoolsom2 = $schoolsom2 + $groep->som2;
|
||||
$schoolsom3 = $schoolsom3 + $groep->som3;
|
||||
$schoolsom4 = $schoolsom4 + $groep->som4;
|
||||
$schooldiversiteit = $schooldiversiteit + $groep->som1 + (1.5 * $groep->som2) + (2 * $groep->som3) + (4 * $groep->som4) ;
|
||||
if ((strpos($groep->niveau, '1') !== false) || (strpos($groep->niveau, '2') !== false) ){
|
||||
$schoolgewogentot = $schoolgewogentot + 22; }
|
||||
else {
|
||||
$schoolgewogentot = $schoolgewogentot + 24; }
|
||||
}; // foreach
|
||||
}// if
|
||||
$schooldq = round($schooldiversiteit / $schoolgewogentot , 2);
|
||||
$today = date("d-m-Y");
|
||||
$aantalgroepen = sizeof($groepen);
|
||||
$richtlijn=array('85%', '10%','3%','25');
|
||||
$data=array('organisatie' => $organisatie,
|
||||
"schooljaarnaam" => $schooljaarnaam,
|
||||
"schooltotaal" => $schooltotaal,
|
||||
"schooldiversiteit" => $schooldiversiteit,
|
||||
"schooldq" => $schooldq,
|
||||
"schoolgewogentot"=>$schoolgewogentot,
|
||||
"schoolsom1" => $schoolsom1,
|
||||
"schoolsom2" => $schoolsom2,
|
||||
"schoolsom3" => $schoolsom3,
|
||||
"schoolsom4" => $schoolsom4,
|
||||
"aantalgroepen" =>$aantalgroepen,
|
||||
"vandaag" => $today,
|
||||
"richtlijn" =>$richtlijn);
|
||||
$html = $this->load->view("monpas/reports/diversiteitaantallen", $data, true);
|
||||
$filenaam="diversiteitaantallen";
|
||||
$this->Phantom_model->create_pdf($html, $filenaam, FALSE, FALSE, FALSE);
|
||||
}
|
||||
|
||||
function printaantallensboso(){
|
||||
$orgid = $this->uri->segment(4);
|
||||
$schooljaarnr = $this->uri->segment(5);
|
||||
$organisatie = $this->Organisaties_model->getOrganisatie($orgid);
|
||||
$schooljaarnaam = $this->Schooljaren_model->get_fieldvalue(array("schooljaarnr"=>$schooljaarnr),"naam");
|
||||
|
||||
$schooltotaal = 0;
|
||||
$sbogewogentot = 0;
|
||||
$sogewogentot = 0;
|
||||
$schoolgewogentot = 0;
|
||||
$schoolsom5 = 0;
|
||||
$schoolsom6 = 0;
|
||||
$schoolsom7 = 0;
|
||||
$schoolsom8 = 0;
|
||||
$sbodiversiteit = 0;
|
||||
$sodiversiteit = 0;
|
||||
$schooldiversiteit = 0;
|
||||
$schooldq = 0;
|
||||
|
||||
$groepen = $this->Groepen_model->getgroepenSboSo($orgid, $schooljaarnr);
|
||||
if ($groepen){
|
||||
foreach($groepen as $groep){
|
||||
$schooltotaal = $schooltotaal + $groep->totaantal;
|
||||
$schoolsom5 = $schoolsom5 + $groep->som5;
|
||||
$schoolsom6 = $schoolsom6 + $groep->som6;
|
||||
$schoolsom7 = $schoolsom7 + $groep->som7;
|
||||
$schoolsom8 = $schoolsom8 + $groep->som8;
|
||||
$sbodiversiteit = $sbodiversiteit + (2 * $groep->som5);
|
||||
$sodiversiteit = $sodiversiteit + (3 * $groep->som6) + (4 * $groep->som7) + (5 * $groep->som8);
|
||||
$sogewogentot = $sogewogentot + 12;
|
||||
if ((strpos($groep->niveau, '1') !== false) || (strpos($groep->niveau, '2') !== false) ){
|
||||
$sbogewogentot = $sbogewogentot + 15; }
|
||||
else {
|
||||
$sbogewogentot = $sbogewogentot + 12; }
|
||||
|
||||
}; // foreach
|
||||
}// if
|
||||
$sbodq = $sbodiversiteit/$sbogewogentot;
|
||||
$sodq = $sodiversiteit/$sodiversiteit;
|
||||
$schooldq = round( $sbodq + $sodq, 2);
|
||||
$today = date("d-m-Y");
|
||||
$aantalgroepen = sizeof($groepen);
|
||||
$richtlijn=array('85%', '10%','3%','25');
|
||||
$data=array('organisatie' => $organisatie,
|
||||
"schooljaarnaam" => $schooljaarnaam,
|
||||
"schooltotaal" => $schooltotaal,
|
||||
"schooldiversiteit" => $schooldiversiteit,
|
||||
"schooldq" => $schooldq,
|
||||
"schoolgewogentot" =>$schoolgewogentot,
|
||||
"schoolsom5" => $schoolsom5,
|
||||
"schoolsom6" => $schoolsom6,
|
||||
"schoolsom7" => $schoolsom7,
|
||||
"schoolsom8" => $schoolsom8,
|
||||
"aantalgroepen" =>$aantalgroepen,
|
||||
"vandaag" => $today,
|
||||
"richtlijn" =>$richtlijn);
|
||||
$html = $this->load->view("monpas/reports/diversiteitaantallenso", $data, true);
|
||||
$filenaam="diversiteitaantallenso";
|
||||
$this->Phantom_model->create_pdf($html, $filenaam, FALSE, FALSE, FALSE);
|
||||
}
|
||||
|
||||
function printquotienten(){
|
||||
//TODO clean input
|
||||
$inputstring = $this->input->get('json');
|
||||
$input = json_decode($inputstring);
|
||||
$today = date("d-m-Y");
|
||||
$organisatie = $this->Organisaties_model->getOrganisatie($input->orgid);
|
||||
$schooljaarnaam = $this->Schooljaren_model->get_fieldvalue(array("schooljaarnr"=>$input->schooljaarnr),"naam");
|
||||
$groepen = $input->groepen;
|
||||
$data=array( "organisatie" => $organisatie,
|
||||
"schooljaarnaam" => $schooljaarnaam,
|
||||
"vandaag" => $today,
|
||||
"groepen" => $groepen);
|
||||
$html=$this->load->view("monpas/reports/diversiteitquotienten", $data, true);
|
||||
$filenaam="diversiteitquotienten";
|
||||
$this->Phantom_model->create_pdf($html,$filenaam, FALSE,FALSE,FALSE);
|
||||
}
|
||||
|
||||
function printtotaaltijden(){
|
||||
$inputstring = $this->input->get('json');
|
||||
$input = json_decode($inputstring);
|
||||
$today = date("d-m-Y");
|
||||
$organisatie = $this->Organisaties_model->getOrganisatie($input->orgid);
|
||||
$schooljaarnaam = $this->Schooljaren_model->get_fieldvalue(array("schooljaarnr"=>$input->schooljaarnr),"naam");
|
||||
$data=array( "organisatie" => $organisatie,
|
||||
"schooljaarnaam" => $schooljaarnaam,
|
||||
"vandaag" => $today,
|
||||
"totalen" => $input->totalen);
|
||||
$html=$this->load->view("monpas/reports/tijdtotalen", $data, true);
|
||||
$filenaam="tijdtotalen";
|
||||
$this->Phantom_model->create_pdf($html,$filenaam, FALSE,FALSE,FALSE);
|
||||
}
|
||||
|
||||
function printondersteuningsmatrix(){
|
||||
$inputstring = $this->input->get('json');
|
||||
$input = json_decode($inputstring);
|
||||
$today = date("d-m-Y");
|
||||
$organisatie = $this->Organisaties_model->getOrganisatie($input->orgid);
|
||||
$schooljaarnaam = $this->Schooljaren_model->get_fieldvalue(array("schooljaarnr"=>$input->schooljaarnr),"naam");
|
||||
$data=array( "organisatie" => $organisatie,
|
||||
"schooljaarnaam" => $schooljaarnaam,
|
||||
"vandaag" => $today,
|
||||
"groepen" => $input->groepen,
|
||||
"schoolDQ" => $input->schoolDQ,
|
||||
"schooltot" => $input->schooltot);
|
||||
$html=$this->load->view("monpas/reports/ondersteuningsmatrix", $data, true);
|
||||
$filenaam="ondersteuningsmatrix";
|
||||
$this->Phantom_model->create_pdf($html,$filenaam, FALSE,FALSE,FALSE);
|
||||
}
|
||||
function printdiversiteitmatrix(){
|
||||
$inputstring = $this->input->post('data');
|
||||
$input = json_decode($inputstring);
|
||||
$today = date("d-m-Y");
|
||||
$organisatie = $this->Organisaties_model->getOrganisatie($input->orgid);
|
||||
$schooljaarnaam = $this->Schooljaren_model->get_fieldvalue(array("schooljaarnr"=>$input->schooljaarnr),"naam");
|
||||
|
||||
|
||||
$data=array( "organisatie" => $organisatie,
|
||||
"schooljaarnaam" => $schooljaarnaam,
|
||||
"vandaag" => $today,
|
||||
"basis" => $input->regels1,
|
||||
"basisplus" => $input->regels2,
|
||||
'extra' => $input->regels3,
|
||||
'extraplus' =>$input->regels4,
|
||||
'dq' =>$input->regels5);
|
||||
$html=$this->load->view("monpas/reports/diversiteitmatrix", $data, true);
|
||||
$filenaam="diversiteitmatrix";
|
||||
$this->Phantom_model->create_pdf($html,$filenaam, FALSE,FALSE,[1,1]);
|
||||
}
|
||||
|
||||
function printdiversiteitmatrixsboso(){
|
||||
$inputstring = $this->input->post('data');
|
||||
$input = json_decode($inputstring);
|
||||
$today = date("d-m-Y");
|
||||
$organisatie = $this->Organisaties_model->getOrganisatie($input->orgid);
|
||||
$schooljaarnaam = $this->Schooljaren_model->get_fieldvalue(array
|
||||
("schooljaarnr"=>$input->schooljaarnr),"naam");
|
||||
$min = 5;
|
||||
$max = 8;
|
||||
$vormen =$this->Diversiteits_model->getosvormen($input->orgid, $input->schooljaarnr, $min, $max);
|
||||
|
||||
$data=array("organisatie" => $organisatie,
|
||||
"schooljaarnaam" => $schooljaarnaam,
|
||||
"vandaag" => $today,
|
||||
"groepen" => $input->groepen,
|
||||
"schooltotaal" => $input->leerlingaantal,
|
||||
'ondersteuningsvormen' => $vormen,
|
||||
'schoolsom5' => $input->schoolsom5,
|
||||
'schoolsom6' => $input->schoolsom6,
|
||||
'schoolsom7' => $input->schoolsom7,
|
||||
'schoolsom8' => $input->schoolsom8,
|
||||
'schooldq' => $input->schooldq,
|
||||
'schooldiversiteit' => $input->schooldiversiteit);
|
||||
|
||||
$html=$this->load->view("monpas/reports/diversiteitmatrixso", $data, true);
|
||||
$filenaam="diversiteitmatrixso";
|
||||
$this->Phantom_model->create_pdf($html,$filenaam, FALSE,FALSE,[1,1]);
|
||||
}
|
||||
|
||||
|
||||
function getnormaantallen(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->uri->segment(4);
|
||||
$schooltype = $this->uri->segment(5);
|
||||
$combifactoren = '';
|
||||
$normaantallen =[];
|
||||
if($schooltype === 'REGULIER'){
|
||||
$normaantallen = $this->Diversiteits_model->getnormaantallen($orgid, 'REGULIER');
|
||||
$combifactoren = $this->Combifactoren_model->getfactoren($orgid);
|
||||
}
|
||||
if($schooltype === 'SPECIAAL'){
|
||||
$sbo = $this->Diversiteits_model->getnormaantallen($orgid, 'SBO');
|
||||
$so = $this->Diversiteits_model->getnormaantallen($orgid, 'SO');
|
||||
$normaantallen =['sbo'=>$sbo, 'so' => $so];
|
||||
|
||||
}
|
||||
echo json_encode(['normaantallen' =>$normaantallen,
|
||||
'combifactoren'=>$combifactoren]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class Diversiteitmonitor extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array( "shared/Users_model",
|
||||
"monpas/Ondersteuningsvormen_model",
|
||||
"monpas/Aantalxondersteuningsvorm_model",
|
||||
"monpas/Leerkrachten_model",
|
||||
"monpas/Groepen_model",
|
||||
"shared/Schooljaren_model",
|
||||
"Phantom_model",
|
||||
"monpas/Ondersteuningtijden_model",
|
||||
"monpas/Dq_model",
|
||||
"monpas/Diversiteits_model",
|
||||
"monpas/Sorteringen_model",
|
||||
"monpas/Sorteerlabels_model");
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
function getall(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->globorgid;
|
||||
$schooljaarnr = $this->clean_input("schooljaarnr");
|
||||
$result = $this->Diversiteits_model->getallediversiteitsgegevens($schooljaarnr);
|
||||
if ($result){ $result = $result[0];};
|
||||
echo json_encode($result);
|
||||
}
|
||||
|
||||
function getallsboso(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->globorgid;
|
||||
$schooljaarnr = $this->clean_input("schooljaarnr");
|
||||
$licentie = 270;
|
||||
$result = $this->Diversiteits_model->getallediversiteitsgegevenssboso($schooljaarnr, $licentie);
|
||||
if ($result){ $result = $result[0];};
|
||||
echo json_encode($result);
|
||||
}
|
||||
|
||||
function getCriteriaSWV(){
|
||||
$orgid = $this->globorgid;
|
||||
$orgsoort = $this->Organisaties_model->get_fieldvalue(["id"=>$orgid], "soort");
|
||||
|
||||
switch($orgsoort){
|
||||
case 1: $swvid = $orgid;
|
||||
break;
|
||||
case 2:
|
||||
case 3: $swvid = $this->Organisaties_model->get_swvid($orgid);
|
||||
break;
|
||||
default: $swvID = 0;
|
||||
}
|
||||
|
||||
$criteria = $this->Sorteringen_model->get_criteriabijSWV($swvid);
|
||||
if(!$criteria){
|
||||
$criteria = [];
|
||||
}
|
||||
$criterium = new stdClass();
|
||||
$criterium->id = 0;
|
||||
$criterium->swv_id = $swvid;
|
||||
$criterium->naam = "bestuur";
|
||||
array_unshift($criteria, $criterium);
|
||||
|
||||
echo json_encode($criteria);
|
||||
|
||||
}
|
||||
|
||||
function haalDiversiteitOverzichtOp(){
|
||||
$schooljaarnr = $this->clean_input("schooljaarnr");
|
||||
$module = $this->clean_input("module");
|
||||
$criteriumid = $this->clean_input("criteriumid");
|
||||
$indeling = (new IngedeeldeScholen($criteriumid, $module))->getIndeling();
|
||||
|
||||
|
||||
$divmonitor = (new DivMonitor($schooljaarnr, $criteriumid, $module, $indeling))->getMonitor();
|
||||
|
||||
echo json_encode($divmonitor);
|
||||
}
|
||||
|
||||
|
||||
function maakpdf(){
|
||||
if (!$this->userid) die;
|
||||
$inputstring = $this->input->post('data');
|
||||
$input = json_decode($inputstring);
|
||||
$bgs = $input->bgs;
|
||||
$obgs =[];
|
||||
foreach($bgs as $bg){
|
||||
array_push($obgs, json_decode($bg));
|
||||
}
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($this->globorgid);
|
||||
$today = date('d-m-Y');
|
||||
$schooljaar = $this->Schooljaren_model->get_records_where(array('schooljaarnr' => $input->schooljaarnr), true);
|
||||
$data = array("organisatie" =>$organisatie,
|
||||
"schooljaar" =>$schooljaar,
|
||||
"vandaag" =>$today,
|
||||
"bgs" =>$obgs,
|
||||
"maxdq" =>json_decode($input->maxdq),
|
||||
"mindq" =>json_decode($input->mindq),
|
||||
"maxoov" => json_decode($input->maxoov),
|
||||
"grandtotals" =>json_decode($input->grandtotals),
|
||||
'gr0164' =>$input->gr0164);
|
||||
$html = $this->load->view("monpas/reports/divmonitorpdf", $data, true);
|
||||
$filenaam="Monitordiversiteit".$organisatie->id;
|
||||
$this->Phantom_model->create_pdf($html, $filenaam, FALSE,FALSE,FALSE, 'portrait');
|
||||
}
|
||||
|
||||
function maakpdfsboso(){
|
||||
if (!$this->userid) die;
|
||||
$inputstring = $this->input->post('data');
|
||||
$input = json_decode($inputstring);
|
||||
$bgs = $input->bgs;
|
||||
$obgs =[];
|
||||
foreach($bgs as $bg){
|
||||
array_push($obgs, json_decode($bg));
|
||||
}
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($this->globorgid);
|
||||
$today = date('d-m-Y');
|
||||
$schooljaar = $this->Schooljaren_model->get_records_where(array('schooljaarnr' => $input->schooljaarnr), true);
|
||||
$data = array("organisatie" =>$organisatie,
|
||||
"schooljaar" =>$schooljaar,
|
||||
"vandaag" =>$today,
|
||||
"bgs" =>$obgs,
|
||||
"maxdq" =>json_decode($input->maxdq),
|
||||
"mindq" =>json_decode($input->mindq),
|
||||
"grandtotals" =>json_decode($input->grandtotals),
|
||||
"gr0164" =>$input->gr0164);
|
||||
$html = $this->load->view("monpas/reports/divmonitorsopdf", $data, true);
|
||||
$filenaam="MonitordiversiteitSbo&So".$organisatie->id;
|
||||
$this->Phantom_model->create_pdf($html, $filenaam, FALSE,FALSE,FALSE, 'portrait');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,341 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class Groepen extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array("shared/Session_model",
|
||||
"shared/Users_model",
|
||||
"monpas/Ondersteuningsvormen_model",
|
||||
"monpas/Aantalxondersteuningsvorm_model",
|
||||
"shared/Orgusers_model",
|
||||
"monpas/Labels_model",
|
||||
"monpas/Groepen_model",
|
||||
"monpas/Groepenxusers_model");
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
function getnewgroep(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->clean_input("schoolid");
|
||||
$schooljaar = $this->clean_input("schooljaar");
|
||||
$minnivo = $this->clean_input("minnivo");
|
||||
$maxnivo = $this->clean_input("maxnivo");
|
||||
|
||||
$groepinfo = new stdClass;
|
||||
$groepinfo->id = null;
|
||||
$groepinfo->naam = '';
|
||||
$groepinfo->orgid = $orgid;
|
||||
$groepinfo->schooljaar = $schooljaar;
|
||||
$groepinfo->niveau = null;
|
||||
$groepinfo->lknaam = '';
|
||||
$groepinfo->totaantal = 0;
|
||||
|
||||
|
||||
$groepinfo->ondersteuningsvormen = $this->Ondersteuningsvormen_model->getvormen($orgid, $minnivo, $maxnivo);
|
||||
|
||||
if ($groepinfo->ondersteuningsvormen){
|
||||
foreach($groepinfo->ondersteuningsvormen as $ondersteuningsvorm){
|
||||
$ondersteuningsvorm->aantal =0;
|
||||
}
|
||||
}
|
||||
echo json_encode($groepinfo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function getgroep(){
|
||||
if (!$this->userid) die;
|
||||
$groepid = $this->clean_input("groepid");
|
||||
$orgid = $this->clean_input("schoolid");
|
||||
$minnivo = $this->clean_input("minnivo");
|
||||
$maxnivo = $this->clean_input("maxnivo");
|
||||
|
||||
$groep = $this->Groepen_model->getgroepdetails($groepid);
|
||||
$groep->niveau = explode(';', $groep->niveau);
|
||||
$groep->leerkrachten = $this->Groepenxusers_model->getleerkrachten($groepid);
|
||||
$groep->ondersteuningsvormen = $this->Ondersteuningsvormen_model->getvormen($orgid, $minnivo, $maxnivo);
|
||||
if ($groep->ondersteuningsvormen){
|
||||
foreach($groep->ondersteuningsvormen as $ondersteuningsvorm){
|
||||
// hier get aantal
|
||||
$ax = $this->Aantalxondersteuningsvorm_model->getaantal($groepid, $ondersteuningsvorm->id);
|
||||
if ($ax){ $ondersteuningsvorm->aantal = $ax->aantal; }
|
||||
else{ $ondersteuningsvorm->aantal =0; };
|
||||
}
|
||||
}
|
||||
echo json_encode($groep);
|
||||
}
|
||||
function getleerkrachten(){
|
||||
if (!$this->userid) die;
|
||||
$schoolid = $this->uri->segment(4);
|
||||
$leerkrachten = $this->Users_model->getleerkrachten($schoolid);
|
||||
echo json_encode($leerkrachten);
|
||||
}
|
||||
|
||||
function getlabels(){
|
||||
if (!$this->userid) die;
|
||||
$module = $this->uri->segment(4);
|
||||
$label1 = "";
|
||||
$label2 = "";
|
||||
$label3 = "";
|
||||
$label4 = "";
|
||||
$labels = $this->Labels_model->getLabels($module);
|
||||
foreach($labels as $label){
|
||||
if($label->labelid == 5) $label1 = $label->waarde;
|
||||
if($label->labelid == 6) $label2 = $label->waarde;
|
||||
if($label->labelid == 7) $label3 = $label->waarde;
|
||||
if($label->labelid == 8) $label4 = $label->waarde;
|
||||
}
|
||||
$data = [
|
||||
'label1' => $label1,
|
||||
'label2' => $label2,
|
||||
'label3' => $label3,
|
||||
'label4' => $label4
|
||||
];
|
||||
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
function insertorupdategroep(){
|
||||
if (!$this->userid ) die;
|
||||
$groepid = $this->clean_input('id');
|
||||
$nivos = $this->clean_input("niveauarray");
|
||||
$nstring = implode(';', $nivos);
|
||||
|
||||
$data=array('naam' => $this->clean_input('naam'),
|
||||
'niveau' => $nstring,
|
||||
'totaantal' => $this->clean_input('totaantal'),
|
||||
'notitie' => $this->clean_input("notitie", TRUE),
|
||||
'schooltype' => $this->clean_input('schooltype'),
|
||||
'module' => $this->clean_input('module'));
|
||||
if ($groepid <= 0 || $groepid == null || !$groepid ){
|
||||
$data['schooljaarnr' ] = $this->clean_input('schooljaar');
|
||||
$data['organisatie_id'] = $this->clean_input('orgid');
|
||||
$groepid =$this->Groepen_model->insert_record($data);
|
||||
}
|
||||
else {
|
||||
$this->Groepen_model->update_record($data, $groepid);
|
||||
}
|
||||
$groep = $this->Groepen_model->getgroep($groepid);
|
||||
echo json_encode($groep);
|
||||
}
|
||||
|
||||
function insertorupdateOS(){
|
||||
//TODO clean input
|
||||
if(!$this->userid) die;
|
||||
$osid = $this->clean_input('id');
|
||||
$orgid = $this->clean_input("orgid");
|
||||
$aantal = $this->clean_input('aantal');
|
||||
if (($osid == 0 || $osid == null) &&($aantal > 0)) {
|
||||
$data=array("organisatie_id" => $orgid,
|
||||
"naam" => $this->clean_input("naam"),
|
||||
"nivo" => $this->clean_input('nivo')
|
||||
);
|
||||
$osid = $this->Ondersteuningsvormen_model->insert_record($data);
|
||||
}
|
||||
else {
|
||||
if ($orgid > 0){
|
||||
$data=array("naam" => $this->clean_input('naam'));
|
||||
$this->Ondersteuningsvormen_model->update_record($data, $osid);
|
||||
}
|
||||
// update name
|
||||
}
|
||||
$data2= array("organisatie_id" => $orgid,
|
||||
"groep_id" => $this->clean_input('groepid'),
|
||||
"ondersteuningsvorm_id" => $osid);
|
||||
$aos =$this->Aantalxondersteuningsvorm_model->get_records_where($data2, TRUE);
|
||||
if($aos){
|
||||
if ($this->clean_input('aantal') == 0) {
|
||||
//delete de regel
|
||||
$this->Aantalxondersteuningsvorm_model->delete_record($aos->id);
|
||||
}
|
||||
else {
|
||||
// update de regel
|
||||
$data=array( "aantal" => $this->clean_input('aantal') );
|
||||
$this->Aantalxondersteuningsvorm_model->update_record($data, $aos->id);
|
||||
}
|
||||
}
|
||||
else{
|
||||
if ($this->clean_input('aantal') > 0){
|
||||
$data = array( "organisatie_id" => $orgid,
|
||||
"groep_id" => $this->clean_input('groepid'),
|
||||
"ondersteuningsvorm_id" => $osid,
|
||||
"aantal" => $this->clean_input('aantal'));
|
||||
$aantalid = $this->Aantalxondersteuningsvorm_model->insert_record($data);
|
||||
}
|
||||
}
|
||||
echo json_encode($osid);
|
||||
}
|
||||
|
||||
function getgroepen(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->clean_input('schoolID');
|
||||
$schooljaarnr = $this->clean_input('schooljaar');
|
||||
$module = $this->clean_input('module');
|
||||
$groepen = $this->Groepen_model->getgroepen($orgid, $schooljaarnr, $module);
|
||||
if ($groepen){
|
||||
foreach($groepen as $groep){
|
||||
$groep->leerkrachten = $this->Groepenxusers_model->getleerkrachten($groep->id);
|
||||
}
|
||||
}
|
||||
echo json_encode($groepen);
|
||||
}
|
||||
|
||||
function getgekopieerdegroepen(){
|
||||
if (!$this->userid) die;
|
||||
$schooljaarnr = $this->clean_input('schooljaar');
|
||||
$orgid = $this->clean_input('orgid');
|
||||
$module = $this->clean_input('module');
|
||||
|
||||
$groepen = $this->Groepen_model->getgekopieerdegroepen($orgid, $schooljaarnr, $module);
|
||||
|
||||
if ($groepen){
|
||||
foreach($groepen as $groep){
|
||||
$groep->leerkrachten = $this->Groepenxusers_model->getleerkrachten($groep->id);
|
||||
}
|
||||
}
|
||||
echo json_encode($groepen);
|
||||
}
|
||||
|
||||
|
||||
function getgroepenso(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->uri->segment(4);
|
||||
$schooljaarnr = $this->uri->segment(5);
|
||||
$ondersteuning = 'T';
|
||||
|
||||
$groepen = $this->Groepen_model->getgroepenSboSo($orgid, $schooljaarnr);
|
||||
|
||||
if ($groepen){
|
||||
foreach($groepen as $groep){
|
||||
$groep->leerkrachten = $this->Groepenxusers_model->getleerkrachten($groep->id);
|
||||
if (isset($groep->ondersteuning) && $groep->ondersteuning == 'F') {
|
||||
$ondersteuning = 'F';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode(['groepen' =>$groepen, 'ondersteuning' =>$ondersteuning]);
|
||||
}
|
||||
|
||||
|
||||
function deletegroep(){
|
||||
if (!$this->userid) die;
|
||||
if (!$this->writer) return;
|
||||
$groepid = $this->uri->segment(4);
|
||||
$this->Aantalxondersteuningsvorm_model->delete_record_where(array('groep_id'=>$groepid) );
|
||||
$this->Groepenxusers_model->delete_record_where(array("groep_id" =>$groepid));
|
||||
$this->Groepen_model->delete_record($groepid);
|
||||
}
|
||||
function deleteOS(){
|
||||
if (!$this->userid) die;
|
||||
if (!$this->writer) return;
|
||||
$osid = $this->uri->segment(4);
|
||||
$this->Aantalxondersteuningsvorm_model->delete_record_where(array("ondersteuningsvorm_id" => $osid));
|
||||
$this->Ondersteuningsvormen_model->delete_record($osid);
|
||||
}
|
||||
function getwriter(){
|
||||
$writer = false;
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole, 259) > 0){$writer = true;};
|
||||
echo json_encode($writer);
|
||||
}
|
||||
function deletegroepxuser(){
|
||||
if (!$this->userid) die;
|
||||
$groepid = $this->uri->segment(4);
|
||||
$this->Groepenxusers_model->delete_record_where(array("groep_id" =>$groepid));
|
||||
}
|
||||
function addgroepxuser(){
|
||||
if(!$this->userid) die;
|
||||
$groepid = $this->uri->segment(4);
|
||||
$orgid = $this->uri->segment(5);
|
||||
$userid = $this->uri->segment(6);
|
||||
$orguserid = $this->Orgusers_model->get_fieldvalue(array("organisatie_id" =>$orgid, "user_id" => $userid),'id') ;
|
||||
$newid= $this->Groepenxusers_model->insert_record(array("orguser_id"=> $orguserid, "groep_id"=>$groepid));
|
||||
}
|
||||
|
||||
function updatenotitie(){
|
||||
if (!$this->userid) die;
|
||||
$groepid = $this->clean_input("groepid");
|
||||
$notitie = $this->clean_input("notitie", TRUE);
|
||||
$this->Groepen_model->update_record(array("notitie" =>$notitie), $groepid);
|
||||
}
|
||||
function copygroepregulier(){
|
||||
if (!$this->userid) die;
|
||||
$error = true;
|
||||
$schooljaarnr = $this->clean_input('schooljaar');
|
||||
$orgid = $this->clean_input('orgid');
|
||||
$module = $this->clean_input('module');
|
||||
$vorigegroepen = $this->Groepen_model->get(['schooljaarnr'=> $schooljaarnr - 1,
|
||||
'organisatie_id' =>$orgid,
|
||||
'schooltype' => 'R',
|
||||
'module' => $module], false, false);
|
||||
|
||||
if ($vorigegroepen){
|
||||
$error = false;
|
||||
foreach($vorigegroepen as $vorigegroep){
|
||||
$data=['schooljaarnr' => $schooljaarnr,
|
||||
'organisatie_id' => $vorigegroep->organisatie_id,
|
||||
'naam' => $vorigegroep->naam,
|
||||
'niveau' => $vorigegroep->niveau,
|
||||
'module' =>$vorigegroep->module,
|
||||
'totaantal' => 0 ];
|
||||
$newid = $this->Groepen_model->insert_record($data);
|
||||
|
||||
$leerkrachten = $this->Groepenxusers_model->get(['groep_id'=>$vorigegroep->id],false,false);
|
||||
|
||||
if ($leerkrachten){
|
||||
foreach($leerkrachten as $leerkracht){
|
||||
$data=['orguser_id' => $leerkracht->orguser_id,
|
||||
'groep_id' => $newid];
|
||||
$id= $this->Groepenxusers_model->insert_record($data);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo json_encode($error);
|
||||
}
|
||||
|
||||
function copygroepSOSBO(){
|
||||
if (!$this->userid) die;
|
||||
$error = true;
|
||||
$schooljaarnr = $this->clean_input('schooljaar');
|
||||
$orgid = $this->clean_input('orgid');
|
||||
|
||||
$vorigegroepen = $this->Groepen_model->get(['schooljaarnr'=> $schooljaarnr - 1,
|
||||
'organisatie_id' =>$orgid,
|
||||
'schooltype' => 'R',
|
||||
'module' => 270], false, false);
|
||||
|
||||
if ($vorigegroepen){
|
||||
$error = false;
|
||||
foreach($vorigegroepen as $vorigegroep){
|
||||
$data=['schooljaarnr' => $schooljaarnr,
|
||||
'organisatie_id' => $vorigegroep->organisatie_id,
|
||||
'naam' => $vorigegroep->naam,
|
||||
'niveau' => $vorigegroep->niveau,
|
||||
'module' =>$vorigegroep->module,
|
||||
'totaantal' => 0 ];
|
||||
$newid = $this->Groepen_model->insert_record($data);
|
||||
|
||||
$leerkrachten = $this->Groepenxusers_model->get(['groep_id'=>$vorigegroep->id],false,false);
|
||||
|
||||
if ($leerkrachten){
|
||||
foreach($leerkrachten as $leerkracht){
|
||||
$data=['orguser_id' => $leerkracht->orguser_id,
|
||||
'groep_id' => $newid];
|
||||
$id= $this->Groepenxusers_model->insert_record($data);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo json_encode($error);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class Lijsten extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array("shared/Autorisaties_model",
|
||||
"Docx_model",
|
||||
"monpas/Filledversions_model",
|
||||
"monpas/Scores_model",
|
||||
"monpas/Sop_model",
|
||||
"monpas/Sopinhouden_model",
|
||||
"Phantom_model");
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
function getorganisaties(){
|
||||
if (!$this->userid) die;
|
||||
$orgid =$this->globorgid;
|
||||
$organisatie = $this->Organisaties_model->getorg($orgid);
|
||||
$swv = $this->Organisaties_model->getorgstructuur($orgid);
|
||||
echo json_encode(array("swv" =>$swv,
|
||||
"targetorg" =>$organisatie));
|
||||
}
|
||||
function getlijsten(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->uri->segment(4);
|
||||
$module = $this->session->userdata['module'];
|
||||
$lijsten = $this->Filledversions_model->getlijsten($orgid,$module);
|
||||
echo json_encode($lijsten);
|
||||
}
|
||||
function deletelijst(){
|
||||
if (!$this->userid || $this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) <=0) die;
|
||||
$fvid = $this->uri->segment(4);
|
||||
$where = array("filledversion_id" => $fvid);
|
||||
$this->Scores_model->delete_record_where($where);
|
||||
$this->Filledversions_model->delete_record($fvid);
|
||||
echo json_encode('ok');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class Modulebalk extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array("shared/Session_model");
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
function setselectedschool(){
|
||||
$schoolid = $this->uri->segment(4);
|
||||
$this->Session_model->set_selectedschool($schoolid);
|
||||
$this->selectedschool = $schoolid;
|
||||
echo json_encode($schoolid);
|
||||
|
||||
}
|
||||
function setselectedschooljaar(){
|
||||
$schooljaarnr = $this->uri->segment(4);
|
||||
$this->Session_model->set_schooljaar($schooljaarnr);
|
||||
$this->schooljaar = $schooljaarnr;
|
||||
echo json_encode($schooljaarnr);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class Monfinbeheer extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array("monpas/Toewijzingen_model" );
|
||||
$this->load->model($models);
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
function getorgs(){
|
||||
if (!$this->userid) die;
|
||||
$orgstructuur = $this->Organisaties_model->getorgstructuur($this->globorgid , true);
|
||||
$org = $this->Organisaties_model->getorg($this->globorgid);
|
||||
$magwijzig = false;
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole, 23)) $magwijzig =true;
|
||||
echo json_encode(array('structuur' =>$orgstructuur , 'org' =>$org, 'magwijzig'=>$magwijzig));
|
||||
}
|
||||
function getbedragen(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->uri->segment(4);
|
||||
$bedragen = $this->Toewijzingen_model->gettoewijzingen($orgid);
|
||||
if($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) <=0) {$bedragen = array('');};
|
||||
echo json_encode($bedragen);
|
||||
}
|
||||
function legvast(){
|
||||
if($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) >= 1) {
|
||||
$id = $this->input->post('id');
|
||||
$orgid = $this->input->post("orgid");
|
||||
$jaarnr = $this->input->post("jaarnr");
|
||||
$basis = $this->input->post("basis");
|
||||
$extra = $this->input->post("extra");
|
||||
$som = $this->input->post("som");
|
||||
$overig = $this->input->post("overig");
|
||||
$vastgelegd = 1;
|
||||
if ($id == null || $id <= 0){
|
||||
$data = array( 'orgid' =>$orgid,
|
||||
'kalenderjaarnr' => $jaarnr,
|
||||
'basis' => $basis,
|
||||
'extra' => $extra,
|
||||
'som' => $som,
|
||||
'overig' => $overig,
|
||||
'vastgelegd' => $vastgelegd);
|
||||
$newid = $this->Toewijzingen_model->insert_record($data);
|
||||
}
|
||||
else{
|
||||
$data = array("vastgelegd" => $vastgelegd);
|
||||
$this->Toewijzingen_model->update_record($data, $id);
|
||||
$newid = $id;
|
||||
}
|
||||
}
|
||||
else {$newid = false;}; // geen schrijfrechten
|
||||
echo json_encode(intval($newid));
|
||||
}
|
||||
|
||||
function legbasisextravast(){
|
||||
if($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) >=1) {
|
||||
$id = $this->input->post('id');
|
||||
$orgid = $this->input->post("orgid");
|
||||
$jaarnr = $this->input->post("jaarnr");
|
||||
$basis = $this->input->post("basis");
|
||||
$extra = $this->input->post("extra");
|
||||
$som = $this->input->post("som");
|
||||
$overig = $this->input->post("overig");
|
||||
$basisextra = $this->input->post("basisextra");
|
||||
if ($id == null || $id <= 0){
|
||||
$data = array('orgid' =>$orgid,
|
||||
'kalenderjaarnr' => $jaarnr,
|
||||
'basis' => $basis,
|
||||
'extra' => $extra,
|
||||
'som' => $som,
|
||||
'overig' => $overig,
|
||||
'basisextra' => $basisextra,
|
||||
'basisextravast' => 1);
|
||||
$newid = $this->Toewijzingen_model->insert_record($data);
|
||||
}
|
||||
else{
|
||||
$newid= $id;
|
||||
$data = array("basisextravast" => 1);
|
||||
$this->Toewijzingen_model->update_record($data, $id);
|
||||
}
|
||||
}
|
||||
else {$newid = false;}; // geen write rechten
|
||||
echo json_encode(intval($newid));
|
||||
}
|
||||
function savebasisextra(){
|
||||
if($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) >0 ) {
|
||||
$id = $this->clean_input('id');
|
||||
$orgid = $this->clean_input("orgid");
|
||||
$jaarnr = $this->clean_input("jaarnr");
|
||||
$basis = $this->clean_input("basis");
|
||||
$extra = $this->clean_input("extra");
|
||||
$som = $this->clean_input("som");
|
||||
$overig = $this->clean_input("overig");
|
||||
$basisextra = $this->clean_input("basisextra");
|
||||
if (!$id ||$id == null || $id <= 0){
|
||||
$data = array('orgid' =>$orgid,
|
||||
'kalenderjaarnr' => $jaarnr,
|
||||
'basis' => $basis,
|
||||
'extra' => $extra,
|
||||
'som' => $som,
|
||||
'overig' => $overig,
|
||||
'basisextra' => $basisextra,
|
||||
'basisextravast' => 0);
|
||||
$newid = $this->Toewijzingen_model->insert_record($data);
|
||||
}
|
||||
else{
|
||||
$newid= $id;
|
||||
$data = array("basisextra" => $basisextra);
|
||||
$this->Toewijzingen_model->update_record($data, $id);
|
||||
}
|
||||
}
|
||||
else {$newid= false;}; // geen write rechten
|
||||
echo json_encode(intval($newid));
|
||||
}
|
||||
function updateorinsert(){
|
||||
if($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) >0) {
|
||||
$id = $this->input->post('id');
|
||||
$orgid = $this->input->post("orgid");
|
||||
$jaarnr = $this->input->post("jaarnr");
|
||||
$basis = $this->input->post("basis");
|
||||
$extra = $this->input->post("extra");
|
||||
$som = $this->input->post("som");
|
||||
$overig = $this->input->post("overig");
|
||||
|
||||
if ($id == null || $id <= 0){
|
||||
$data = array( 'orgid' =>$orgid,
|
||||
'kalenderjaarnr' => $jaarnr,
|
||||
'basis' => $basis,
|
||||
'extra' => $extra,
|
||||
'som' => $som,
|
||||
'overig' => $overig);
|
||||
$newid = $this->Toewijzingen_model->insert_record($data);
|
||||
}
|
||||
else{
|
||||
$newid= $id;
|
||||
$data = array( 'basis' => $basis,
|
||||
'extra' => $extra,
|
||||
'som' => $som,
|
||||
'overig' => $overig);
|
||||
$this->Toewijzingen_model->update_record($data, $id);
|
||||
}
|
||||
}
|
||||
else {$newid = false;};// geen write rechten
|
||||
echo json_encode(intval($newid));
|
||||
}
|
||||
function sluitjaaraf(){
|
||||
$swvid = $this->clean_input('swv');
|
||||
$jaarnr = $this->clean_input("jaarnr");
|
||||
$orgstructuur = $this->Organisaties_model->getorgstructuur($swvid);
|
||||
if ($orgstructuur){
|
||||
$this->Toewijzingen_model->UpdateToewijzingen($orgstructuur->id, $jaarnr);
|
||||
if ($orgstructuur->kamers){
|
||||
$this->sluitjaarafrecursief($orgstructuur->kamers, $jaarnr);
|
||||
}
|
||||
}
|
||||
echo json_encode('ok');
|
||||
}
|
||||
|
||||
private function sluitjaarafrecursief($orgs, $jaarnr){
|
||||
if ($orgs){
|
||||
|
||||
foreach($orgs as $org){
|
||||
$this->Toewijzingen_model->UpdateToewijzingen($org->id, $jaarnr);
|
||||
if (isset($org->kamers)) $this->sluitjaarafrecursief($org->kamers, $jaarnr);
|
||||
if (isset($org->bgs)) $this->sluitjaarafrecursief($org->bgs, $jaarnr);
|
||||
if (isset($org->scholen)) $this->sluitjaarafrecursief($org->scholen, $jaarnr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class Monfinbestedingen extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array( "monpas/Bestedingen_model",
|
||||
"monpas/Bestedingopmerkingen_model",
|
||||
"monpas/Bestemmingslabels_model",
|
||||
"monpas/Toewijzingen_model",
|
||||
"shared/Kalenderjaren_model" );
|
||||
$this->load->model($models);
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
function getconstants(){
|
||||
if (!$this->userid) die;
|
||||
$org = $this->Organisaties_model->get_record_by_id($this->globorgid);
|
||||
$kalenderjaren = $this->Kalenderjaren_model->getkalenderjaren();
|
||||
$bestemmingslabels = $this->Bestemmingslabels_model->getsoorten();
|
||||
// if ($org->soort == 4) $isschool = true;
|
||||
// else $isschool = false;
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) > 0 ) {$writer = true;}
|
||||
else {$writer = false;} ;
|
||||
echo json_encode(array('writer' =>$writer,
|
||||
'kalenderjaren' => $kalenderjaren,
|
||||
'labels' => $bestemmingslabels));
|
||||
}
|
||||
function getbestedingen(){
|
||||
if($this->Autorisaties_model->check_autorisatie($this->userrole, READER) <=0) {
|
||||
$jaartoewijzing =array();
|
||||
$bestedingen = array();
|
||||
$jaarclosed = TRUE;
|
||||
}
|
||||
else {
|
||||
$orgid = $this->globorgid;
|
||||
$jaarnr = $this->input->post('jaarnr');
|
||||
$jaarclosed = FALSE;
|
||||
$jaartoewijzing = $this->Toewijzingen_model->gettoewijzingperjaar($orgid, $jaarnr);
|
||||
if ($jaartoewijzing){
|
||||
$jaartoewijzing->basis=number_format($jaartoewijzing->basis/100,2,',','.');
|
||||
$jaartoewijzing->extra=number_format($jaartoewijzing->extra/100,2,',','.');
|
||||
$jaartoewijzing->som=number_format($jaartoewijzing->som/100,2,',','.');
|
||||
$jaartoewijzing->overig=number_format($jaartoewijzing->overig/100,2,',','.');
|
||||
if ($jaartoewijzing->jaarclosed == "F") {$jaarclosed = FALSE;}
|
||||
else { $jaarclosed = TRUE;};
|
||||
}
|
||||
$bestedingen = $this->Bestedingen_model->getbestedingen($orgid,$jaarnr);
|
||||
$opmerking = $this->Bestedingopmerkingen_model->getopmerking($orgid, $jaarnr);
|
||||
|
||||
};
|
||||
echo json_encode(array('jaartoewijzing' => $jaartoewijzing,
|
||||
'bestedingen' => $bestedingen,
|
||||
'opmerking' => $opmerking,
|
||||
'jaarclosed' => $jaarclosed));
|
||||
}
|
||||
function insertbesteding(){
|
||||
if($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) > 0) {
|
||||
$data= array("orgid" =>$this->globorgid,
|
||||
"kalenderjaarnr" =>$this->input->post("jaarnr"),
|
||||
"bedrag" =>$this->input->post("bedrag"),
|
||||
"soort" =>$this->input->post("soortondersteuning"),
|
||||
"omschrijving" =>$this->input->post("omschrijving"),
|
||||
"labelnr" =>$this->input->post('labelnr'));
|
||||
$newid =$this->Bestedingen_model->insert_record($data);
|
||||
$besteding = $this->Bestedingen_model->getbesteding($newid);
|
||||
}
|
||||
else {$besteding = '' ; } ; // geen writer
|
||||
echo json_encode($besteding);
|
||||
}
|
||||
function updatebedrag(){
|
||||
if($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) > 0) {
|
||||
$id = $this->input->post('id');
|
||||
$bedrag = $this->input->post('bedrag');
|
||||
$this->Bestedingen_model->update_record(array('bedrag'=>$bedrag), $id);
|
||||
}
|
||||
}
|
||||
function updateomschrijving(){
|
||||
if($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) > 0) {
|
||||
$id = $this->input->post('id');
|
||||
$omschrijving = $this->input->post('omschrijving');
|
||||
$this->Bestedingen_model->update_record(array('omschrijving'=>$omschrijving), $id);
|
||||
};
|
||||
}
|
||||
function updatelabel(){
|
||||
if($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) > 0) {
|
||||
$id = $this->input->post('id');
|
||||
$waarde = $this->input->post('labelnr');
|
||||
$this->Bestedingen_model->update_record(array('labelnr'=>$waarde), $id);
|
||||
};
|
||||
}
|
||||
function deletebedrag(){
|
||||
if($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) > 0) {
|
||||
$id = $this->input->post('id');
|
||||
$this->Bestedingen_model->delete_record($id);
|
||||
};
|
||||
}
|
||||
function saveopmerking(){
|
||||
$orgid = $this->globorgid;
|
||||
$jaarnr = $this->clean_input("jaarnr");
|
||||
$opmerking = $this->clean_input("opmerking");
|
||||
$where = array("organisatie_id"=>$orgid, "kalenderjaarnr"=>$jaarnr);
|
||||
$opmerkingrecord = $this->Bestedingopmerkingen_model->get_records_where($where,true);
|
||||
if (!$opmerkingrecord){
|
||||
$this->Bestedingopmerkingen_model->insert_record(array("organisatie_id" =>$orgid, "kalenderjaarnr"=>$jaarnr, 'opmerking'=>$opmerking));
|
||||
}
|
||||
else {
|
||||
$this->Bestedingopmerkingen_model->update_record(array('opmerking'=>$opmerking),$opmerkingrecord->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,288 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Monfinoverzicht extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
|
||||
$models = array("monpas/Bestedingen_model",
|
||||
"monpas/Bestedingopmerkingen_model",
|
||||
"monpas/Bestemmingslabels_model",
|
||||
"monpas/Toewijzingen_model",
|
||||
"shared/Kalenderjaren_model",
|
||||
"Phantom_model");
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
}
|
||||
|
||||
public function index(){ }
|
||||
|
||||
|
||||
public function getkalenderjaren(){
|
||||
$kalenderjaren = $this->Kalenderjaren_model->getkalenderjaren();
|
||||
echo json_encode($kalenderjaren);
|
||||
}
|
||||
public function getkalenderjarenMetMax(){
|
||||
$targetjaar = $this->Toewijzingen_model->getNextJaar($this->globorgid);
|
||||
$kalenderjaren = $this->Kalenderjaren_model->getkalenderjarenMetMax($targetjaar);
|
||||
echo json_encode($kalenderjaren);
|
||||
}
|
||||
|
||||
|
||||
private function getbudgetten($orgid, $kalenderjaarnr){
|
||||
$budgetten =$this->Toewijzingen_model->gettoewijzingperjaar($orgid, $kalenderjaarnr);
|
||||
if (!$budgetten){
|
||||
$budgetten=new stdClass;
|
||||
$budgetten->basis = 0;
|
||||
$budgetten->extra = 0;
|
||||
$budgetten->som = 0;
|
||||
$budgetten->overig = 0;
|
||||
$budgetten->basisextra = 1;
|
||||
}
|
||||
if ($budgetten->basisextra==1){
|
||||
$budgetten->totaal = $budgetten->basis + $budgetten->extra + $budgetten->overig;
|
||||
}
|
||||
else {$budgetten->totaal = $budgetten->som + $budgetten->overig;};
|
||||
return $budgetten;
|
||||
}
|
||||
private function getbestedingen($orgids, $kalenderjaarnr){
|
||||
$basisextra = true;
|
||||
|
||||
$orgbestedingen = array();
|
||||
$orgbestedingen['basis'] =0;
|
||||
$orgbestedingen['extra'] =0;
|
||||
$orgbestedingen['besom'] =0;
|
||||
$orgbestedingen['overig'] =0;
|
||||
$orgbestedingen['totaal'] =0;
|
||||
|
||||
$bestedingen=$this->Bestedingen_model->getsompersoortoverorgs($orgids, $kalenderjaarnr);
|
||||
if ($bestedingen){
|
||||
foreach($bestedingen as $besteding){
|
||||
switch ($besteding->soort){
|
||||
case 1: $orgbestedingen['basis']= $besteding->bedrag;
|
||||
break;
|
||||
case 2: $orgbestedingen['extra']= $besteding->bedrag;
|
||||
break;
|
||||
case 3: $orgbestedingen['besom'] += $besteding->bedrag;
|
||||
break;
|
||||
case 4: $orgbestedingen['overig']= $besteding->bedrag;
|
||||
break;
|
||||
};// switch
|
||||
$orgbestedingen['totaal'] += $besteding->bedrag;
|
||||
if ( ($besteding->soort == 1 || $besteding->soort==2)){
|
||||
// dit mag je zonder controle op basisextra optellen omdat dit of nul is als basisextra = 0
|
||||
// in dat geval is de werkelijke waarde (de som) hierboven in de switch al opgeteld
|
||||
$orgbestedingen['besom'] += $besteding->bedrag;
|
||||
}
|
||||
if ($besteding->basisextra ==0){ $basisextra=false; }
|
||||
}; // foreach bestedingen
|
||||
} ; // if bestedingen
|
||||
return array("orgbestedingen" =>$orgbestedingen,
|
||||
"basisextra" => $basisextra);
|
||||
}
|
||||
|
||||
function getbestuursbedragen(){
|
||||
$targetorgid = $this->clean_input("orgid");
|
||||
$kalenderjaarnr = $this->clean_input("jaarnr");
|
||||
$sumarray = array('basisuit' => 0, 'basisbudget' =>0,
|
||||
'extrauit' => 0, 'extrabudget' =>0,
|
||||
'besomuit' => 0, 'besombudget' =>0,
|
||||
'overiguit' => 0, 'overigbudget' =>0,
|
||||
'totaaluit' => 0, 'totaalbudget' => 0);
|
||||
$grandtot = array('basisuit'=>0, "extrauit" =>0, 'besomuit'=>0, 'overiguit' =>0,
|
||||
'totaaluit'=>0, 'totaalbudget'=>0, 'verschil'=>0);
|
||||
$basisextra = true;
|
||||
$targetorg = $this->Organisaties_model->get_record_by_id($targetorgid);
|
||||
$targetorg->budgetten = $this->getbudgetten($targetorgid, $kalenderjaarnr);
|
||||
$result = $this->getbestedingen($targetorgid, $kalenderjaarnr);
|
||||
|
||||
$targetorg->bestedingen = $result['orgbestedingen'];
|
||||
if ($basisextra) $basisextra = $result['basisextra'];
|
||||
|
||||
// haal de organisaties direct onder de target org op (inclusief de eerste onderliggende organisaties)
|
||||
$soort = $targetorg->soort +1;
|
||||
|
||||
$organisaties = $this->Organisaties_model->getorgs($soort, $targetorgid);
|
||||
// controleer ook of alle suborganisaties het onderscheid basis/extra maken of niet
|
||||
|
||||
if ($organisaties){
|
||||
foreach($organisaties as $organisatie){
|
||||
|
||||
$organisatie->budgetten = $this->getbudgetten($organisatie->id, $kalenderjaarnr);
|
||||
|
||||
if ($organisatie->budgetten) {
|
||||
$sumarray['basisbudget'] += $organisatie->budgetten->basis;
|
||||
$sumarray['extrabudget'] += $organisatie->budgetten->extra;
|
||||
$sumarray['overigbudget'] += $organisatie->budgetten->overig;
|
||||
|
||||
if ($organisatie->budgetten->basisextra ==0){
|
||||
$sumarray['besombudget'] += $organisatie->budgetten->som;
|
||||
$sumarray['totaalbudget'] += $organisatie->budgetten->som + $organisatie->budgetten->overig;
|
||||
}
|
||||
else {
|
||||
$sumarray['besombudget'] += $organisatie->budgetten->basis+ $organisatie->budgetten->extra;
|
||||
$sumarray['totaalbudget'] += $organisatie->budgetten->basis+ $organisatie->budgetten->extra +$organisatie->budgetten->overig;
|
||||
}
|
||||
if ($organisatie->budgetten->basisextra ==0) $basisextra = false;
|
||||
|
||||
$orgids = $this->getorgids($organisatie->id);
|
||||
|
||||
$result= $this->getbestedingen($orgids, $kalenderjaarnr,$organisatie->budgetten->basisextra);
|
||||
$organisatie->bestedingen = $result['orgbestedingen'];
|
||||
if($basisextra) $basisextra = $result['basisextra'];
|
||||
|
||||
$sumarray['basisuit'] += $organisatie->bestedingen['basis'];
|
||||
$sumarray['extrauit'] += $organisatie->bestedingen['extra'];
|
||||
$sumarray['besomuit'] += $organisatie->bestedingen['besom'] ;
|
||||
$sumarray['overiguit'] += $organisatie->bestedingen['overig'];
|
||||
$sumarray['totaaluit'] += $organisatie->bestedingen['totaal'];
|
||||
}; // if budgetten
|
||||
}
|
||||
}; // if organisaties
|
||||
$grandtot['basisuit'] = $sumarray['basisuit'] + $targetorg->bestedingen['basis'];
|
||||
$grandtot['extrauit'] = $sumarray['extrauit'] + $targetorg->bestedingen['extra'];
|
||||
$grandtot['besomuit'] = $sumarray['besomuit'] + $targetorg->bestedingen['besom'];
|
||||
$grandtot['overiguit'] = $sumarray['overiguit'] + $targetorg->bestedingen['overig'];
|
||||
|
||||
$grandtot['totaaluit'] = $sumarray['totaaluit'] + $targetorg->bestedingen['totaal'];
|
||||
$grandtot['totaalbudget'] = $targetorg->budgetten->totaal;
|
||||
$grandtot['verschil'] = $grandtot['totaalbudget'] - $grandtot['totaaluit'];
|
||||
|
||||
echo json_encode(array('targetorg' =>$targetorg,
|
||||
'organisaties' =>$organisaties,
|
||||
"sumarray" =>$sumarray,
|
||||
"basisextra" =>$basisextra,
|
||||
"grandtot" =>$grandtot));
|
||||
}
|
||||
|
||||
private function getorgids($orgid){
|
||||
|
||||
$organisaties = array();
|
||||
$level2 = array();
|
||||
$level3 = array();
|
||||
$idarray = array();
|
||||
$idarray[] =$orgid;
|
||||
$organisaties = $this->Organisaties_model->getorgsonder($orgid);
|
||||
if ($organisaties){
|
||||
foreach($organisaties as $organisatie){
|
||||
$level2= $this->Organisaties_model->getorgsonder($organisatie->id);
|
||||
if ($level2){
|
||||
foreach($level2 as $l2){
|
||||
$level3 = $this->Organisaties_model->getorgsonder($l2->id);
|
||||
if($level3){
|
||||
foreach($level3 as $l3){
|
||||
$idarray[]=$l3->id;
|
||||
};
|
||||
}; // if level3
|
||||
$idarray[]=$l2->id;
|
||||
}
|
||||
}; // if level2
|
||||
$idarray[] = $organisatie->id;
|
||||
}
|
||||
}; // if organisaties
|
||||
return implode(',', $idarray);
|
||||
}
|
||||
|
||||
function getschoolbedragen(){
|
||||
$orgid = $this->clean_input("orgid");
|
||||
$kalenderjaarnr = $this->clean_input("jaarnr");
|
||||
$labels = $this->Bestemmingslabels_model->getsoorten();
|
||||
$budgetten = $this->Toewijzingen_model->gettoewijzingperjaar($orgid, $kalenderjaarnr);
|
||||
$totbudget = 0;
|
||||
$totbesteed = 0;
|
||||
$basis = array();
|
||||
$extra = array();
|
||||
$ondersteuning = array();
|
||||
$overige = array();
|
||||
$sompersoort = array();
|
||||
$schooltot = 0;
|
||||
$opmerking = '';
|
||||
|
||||
if ($budgetten){
|
||||
if ($budgetten->basisextra == 1){
|
||||
$totbudget = $budgetten->basis + $budgetten->extra + $budgetten->overig;
|
||||
$basis = $this->Bestedingen_model->getschoolbestedingenpersoort($orgid, $kalenderjaarnr,1);
|
||||
$extra = $this->Bestedingen_model->getschoolbestedingenpersoort($orgid, $kalenderjaarnr,2);
|
||||
$overig = $this->Bestedingen_model->getschoolbestedingenpersoort($orgid, $kalenderjaarnr,4);
|
||||
}
|
||||
else {
|
||||
$totbudget = $budgetten->som + $budgetten->overig;
|
||||
$ondersteuning = $this->Bestedingen_model->getschoolbestedingenpersoort($orgid, $kalenderjaarnr,3);
|
||||
$overig = $this->Bestedingen_model->getschoolbestedingenpersoort($orgid, $kalenderjaarnr,4);
|
||||
}
|
||||
|
||||
$getsombasis = $this->Bestedingen_model->getsom($basis, $budgetten,$labels,1);
|
||||
$totbesteed += $getsombasis['totsoort'];
|
||||
$getsomextra = $this->Bestedingen_model->getsom($extra, $budgetten,$labels,2);
|
||||
$totbesteed += $getsomextra['totsoort'];
|
||||
$getsomondersteuning = $this->Bestedingen_model->getsom($ondersteuning, $budgetten,$labels,3);
|
||||
$totbesteed += $getsomondersteuning['totsoort'];
|
||||
$getsomoverig = $this->Bestedingen_model->getsom($overig, $budgetten,$labels,4);
|
||||
$totbesteed += $getsomoverig['totsoort'];
|
||||
|
||||
$verschil = $totbudget - $totbesteed;
|
||||
$schooltot = array( 'budget' => number_format($totbudget/100, 2, ',' , '.' ),
|
||||
"bestemd" => number_format($totbesteed/100, 2, ',' , '.' ),
|
||||
"verschil" => number_format($verschil/100, 2, ',' , '.' ));
|
||||
if ($budgetten->basisextra == 1){
|
||||
$sompersoort[0] =$getsombasis;
|
||||
$sompersoort[1]= $getsomextra;
|
||||
$sompersoort[2]= $getsomoverig;
|
||||
}
|
||||
else{
|
||||
$sompersoort[0]=$getsomondersteuning;
|
||||
$sompersoort[1]=$getsomoverig;
|
||||
};
|
||||
$opmerking = $this->Bestedingopmerkingen_model->getopmerking($orgid, $kalenderjaarnr);
|
||||
}; // if budgetten
|
||||
echo json_encode(array('sompersoort' => $sompersoort,
|
||||
'schooltotaal' => $schooltot,
|
||||
'opmerking' => $opmerking));
|
||||
}
|
||||
|
||||
|
||||
function getbedragen(){
|
||||
$orgid = $this->clean_input("orgid");
|
||||
$kalenderjaarnr = $this->clean_input("jaarnr");
|
||||
$budgetten = $this->Toewijzingen_model->gettoewijzingperjaar($orgid, $kalenderjaarnr);
|
||||
$totbudget = 0;
|
||||
if ($budgetten){
|
||||
if ($budgetten->basisextra == 1){
|
||||
$totbudget = $budgetten->basis + $budgetten->extra + $budgetten->overig;
|
||||
}
|
||||
else {
|
||||
$totbudget = $budget->som+ $budget->overig;
|
||||
}
|
||||
}
|
||||
|
||||
$schoolbedragen = array();
|
||||
$schoolbedragen = $this->Bestedingen_model->getschoolbestedingen($orgid, $kalenderjaarnr);
|
||||
|
||||
if ($schoolbedragen){
|
||||
$somarray =$this->Bestedingen_model->sumschoolbedragen($schoolbedragen,$budgetten);
|
||||
$verschil = $totbudget - $somarray['totaal'];
|
||||
$schooltot = array( 'budget' => number_format($totbudget/100, 2, ',' , '.' ),
|
||||
"bestemd" => number_format($somarray['totaal']/100, 2, ',' , '.' ),
|
||||
"verschil" => number_format($verschil/100, 2, ',' , '.' ));
|
||||
|
||||
echo json_encode(array("schooltotaal" => $schooltot,
|
||||
'sompersoort' => $somarray['sompersoort']));
|
||||
}
|
||||
else {echo json_encode(false);};
|
||||
}
|
||||
function overzichtPDF(){
|
||||
$inputstring = $this->input->post('data');
|
||||
$input = json_decode($inputstring);
|
||||
$orgnaam = $input->orgnaam;
|
||||
$kalenderjaar = $input->kalenderjaar;
|
||||
$orgTable = $input->orgtable;
|
||||
|
||||
$data= array( "organisatie" => $orgnaam,
|
||||
"kalenderjaar" => $kalenderjaar,
|
||||
"table" => $orgTable);
|
||||
$html = $this->load->view("monpas/reports/monfinoverzicht", $data, true);
|
||||
|
||||
$filenaam="monfin";
|
||||
$this->Phantom_model->create_pdf($html, $filenaam, FALSE, FALSE, FALSE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class Monitor extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array("shared/Users_model",
|
||||
"monpas/Filledversions_model" ,
|
||||
"monpas/Modules_model",
|
||||
"monpas/Orgversies_model",
|
||||
"monpas/Ijkpunten_model",
|
||||
"monpas/Antwoordopties_model",
|
||||
"monpas/Indicatoren_model",
|
||||
"monpas/Scores_model",
|
||||
"monpas/Oordelen_model",
|
||||
"shared/Session_model",
|
||||
"Phantom_model");
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
function getperiodesperschool(){
|
||||
if (!$this->userid) die;
|
||||
$versies = array();
|
||||
$organisatie=$this->Organisaties_model->get_record_by_id($this->globorgid);
|
||||
$module = $this->session->userdata('module');
|
||||
$gaverder = true; // zoek verder omdat er nog geen actieve versie is
|
||||
// zoek eerst de reeds ingevulde versies
|
||||
// zoek dan de actieve versie
|
||||
// als de actieve versie nog niet bij de ingevulde versies zit, voeg die dan toe.
|
||||
$versies = $this->Filledversions_model->getfilledversionsperorg($organisatie->id, $module);
|
||||
if ($versies){
|
||||
foreach($versies as $versie){
|
||||
if ($versie->actief){$gaverder = false;};
|
||||
}
|
||||
};
|
||||
if ($gaverder){
|
||||
// zoek de actieve versie
|
||||
$BGid = $this->Organisaties_model->get_fieldvalue(array("id" => $this->globorgid), 'valtonder_id');
|
||||
$actieveversie = $this->Orgversies_model->getallorgversies($BGid,$module,true);
|
||||
|
||||
if (!$actieveversie){
|
||||
$KamerID = $this->Organisaties_model->get_fieldvalue(array("id" =>$BGid), 'valtonder_id');
|
||||
$actieveversie = $this->Orgversies_model->getallorgversies($KamerID,$module,true);
|
||||
|
||||
if (!$actieveversie){
|
||||
$SWVID = $this->Organisaties_model->get_fieldvalue(array("id" =>$KamerID), 'valtonder_id');
|
||||
$actieveversie = $this->Orgversies_model->getallorgversies($SWVID, $module,true);
|
||||
}
|
||||
// merge de actieveversie als die gevonden is
|
||||
if (!$versies ) {$versies = array();};
|
||||
if (!$actieveversie) {$actieveversie = array();};
|
||||
$versies = array_merge($actieveversie, $versies);
|
||||
}
|
||||
};
|
||||
echo json_encode(array("versies"=>$versies, "soort"=>$organisatie->soort));
|
||||
}
|
||||
function getperiodesperschoolvanuitpartituur(){
|
||||
if (!$this->userid) die;
|
||||
|
||||
$versies = array();
|
||||
|
||||
$organisatie=$this->Organisaties_model->get_record_by_id($this->globorgid);
|
||||
$module = $this->uri->segment(4); // dit hier gezet worden omdat de partituur zelf een module is
|
||||
$gaverder = true; // zoek verder omdat er nog geen actieve versie is
|
||||
// zoek eerst de reeds ingevulde versies
|
||||
// zoek dan de actieve versie
|
||||
// als de actieve versie nog niet bij de ingevulde versies zit, voeg die dan toe.
|
||||
$versies = $this->Filledversions_model->getfilledversionsperorg($organisatie->id, $module);
|
||||
if ($versies){
|
||||
foreach($versies as $versie){
|
||||
if ($versie->actief){$gaverder = false;};
|
||||
}
|
||||
};
|
||||
if ($gaverder){
|
||||
// zoek de actieve versie
|
||||
$BGid = $this->Organisaties_model->get_fieldvalue(array("id" => $this->globorgid), 'valtonder_id');
|
||||
$actieveversie = $this->Orgversies_model->getallorgversies($BGid,$module,true);
|
||||
|
||||
if (!$actieveversie){
|
||||
$KamerID = $this->Organisaties_model->get_fieldvalue(array("id" =>$BGid), 'valtonder_id');
|
||||
$actieveversie = $this->Orgversies_model->getallorgversies($KamerID,$module,true);
|
||||
|
||||
if (!$actieveversie){
|
||||
$SWVID = $this->Organisaties_model->get_fieldvalue(array("id" =>$KamerID), 'valtonder_id');
|
||||
$actieveversie = $this->Orgversies_model->getallorgversies($SWVID, $module,true);
|
||||
}
|
||||
// merge de actieveversie als die gevonden is
|
||||
if (!$versies ) {$versies = array();};
|
||||
if (!$actieveversie) {$actieveversie = array();};
|
||||
$versies = array_merge($actieveversie, $versies);
|
||||
}
|
||||
};
|
||||
echo json_encode(array("versies"=>$versies, "soort"=>$organisatie->soort));
|
||||
}
|
||||
function getperiodes(){
|
||||
if (!$this->userid) die;
|
||||
$versies = false;
|
||||
|
||||
$organisatie=$this->Organisaties_model->get_record_by_id($this->globorgid);
|
||||
$soort = $organisatie->soort;
|
||||
$module = $this->session->userdata('module');
|
||||
if ($soort == 4) {
|
||||
$versies = $this->Filledversions_model->getfilledversionsperorg($organisatie->id, $module);
|
||||
|
||||
$BGid = $this->Organisaties_model->get_fieldvalue(array("id" => $this->globorgid), 'valtonder_id');
|
||||
$versies = $this->Orgversies_model->getallorgversies($BGid,$module);
|
||||
if (!$versies ){
|
||||
$KamerID = $this->Organisaties_model->get_fieldvalue(array("id" =>$BGid), 'valtonder_id');
|
||||
$versies = $this->Orgversies_model->getallorgversies($KamerID,$module);
|
||||
}
|
||||
$gaverder = $this->Orgversies_model->getallorgversies($BGid, $module, TRUE);
|
||||
if (!$versies ){
|
||||
$SWVID = $this->Organisaties_model->get_fieldvalue(array("id" =>$KamerID), 'valtonder_id');
|
||||
$versies = $this->Orgversies_model->getallorgversies($SWVID, $module);
|
||||
}
|
||||
}
|
||||
echo json_encode(array("versies"=>$versies, "soort"=>$soort));
|
||||
}
|
||||
|
||||
function getlistitems(){
|
||||
if (!$this->userid) die;
|
||||
$orgversieid = $this->uri->segment(4);
|
||||
$orgversie = $this->Orgversies_model->get_record_by_id($orgversieid);
|
||||
|
||||
// haal de ijkpunten op waar de scores onder moeten komen
|
||||
$listijkpunten = $this->Ijkpunten_model->getijkpunten1($orgversie->versie_id);
|
||||
// zoek op of er al scores zijn ingevuld (via filledversion)
|
||||
$fillerid =false;
|
||||
$orgid = $this->globorgid; //er moet altijd gezocht worden op orgid omdat de gebruiker tot verschillende organisaties kan behoren
|
||||
if ($orgversie->vorm == 2) $fillerid = $this->userid;
|
||||
$filledversion = $this->Filledversions_model->getfilledversion($orgversieid, $orgid,$fillerid, $orgversie->vorm);
|
||||
if (!$filledversion){
|
||||
// start een nieuwe filledversion
|
||||
$userid= null;
|
||||
if ($orgversie->vorm == 2) {$userid = $this->userid;};
|
||||
$data = array( "orgversie_id" => $orgversie->id,
|
||||
"organisatie_id" => $this->globorgid,
|
||||
"user_id" => $userid);
|
||||
$newid = $this->Filledversions_model->insert_record($data);
|
||||
$filledversion = $this->Filledversions_model->getfilledversionbyid($newid);
|
||||
// start een nieuwe set van score-records
|
||||
if ($listijkpunten){
|
||||
foreach($listijkpunten as $ijkpunt){
|
||||
$this->MaakScoreRecords($ijkpunt->id,$filledversion->id, $orgversie->scoretype);
|
||||
}; //foreach
|
||||
}; //if
|
||||
}; // if not fillversion
|
||||
// als er al wel een filledversion is, haal dan de scores op
|
||||
if ($listijkpunten) {
|
||||
foreach($listijkpunten as $ijkpunt){
|
||||
$ijkpunt->indicatorscores = $this->Scores_model->getscores($ijkpunt->id, $filledversion->id,$orgversie->vorm);
|
||||
if ($ijkpunt->indicatorscores){
|
||||
foreach($ijkpunt->indicatorscores as $score){
|
||||
if ($score->scoretype != 1){$score->score= substr($score->score, 0, strlen($score->score) -2 ); };
|
||||
if ($score->scoretype ==1) {$score->score= str_replace('.',',',$score->score); };
|
||||
}; //for each
|
||||
}; // if scores
|
||||
}; //foreach
|
||||
};
|
||||
if ($listijkpunten) {
|
||||
$scoreopties = $this->Antwoordopties_model->getAntwoordopties($orgversie->scoretype);
|
||||
}
|
||||
$writer = $this->Autorisaties_model->check_write();
|
||||
echo json_encode(array("ijkpunten" => $listijkpunten,
|
||||
"notitie" => $filledversion->notitie,
|
||||
"fvid" => $filledversion->id,
|
||||
"meetellen" => $filledversion->meetellen,
|
||||
"scoreopties" => $scoreopties,
|
||||
"writer" => $writer) );
|
||||
}
|
||||
|
||||
function MaakScoreRecords($ijkpuntid, $filledversionid, $scoretype){
|
||||
$indicators = $this->Indicatoren_model->getindicatoren($ijkpuntid);
|
||||
if ($indicators){
|
||||
foreach($indicators as $indicator){
|
||||
$data=array( "filledversion_id" =>$filledversionid,
|
||||
"ijkpunt_id" => $ijkpuntid,
|
||||
"indicator_id" => $indicator->id,
|
||||
"score" => 0,
|
||||
"scoretype" =>$scoretype);
|
||||
$this->Scores_model->insert_record($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updatescore(){
|
||||
//TODO clean input
|
||||
if (!$this->userid) die;
|
||||
$scoreid = $this->clean_input("indicatorscoreid");
|
||||
$score = str_replace(',','.',$this->clean_input("score"));
|
||||
// $this->deleteOordeel($scoreid);
|
||||
$scorerecord = $this->Scores_model->get_record_by_id($scoreid);
|
||||
$this->Oordelen_model->delete_record_where(array("ijkpunt_id"=>$scorerecord->ijkpunt_id,
|
||||
"filledversion_id"=>$scorerecord->filledversion_id))
|
||||
;
|
||||
$this->Scores_model->update_record(array("score" => $score), $scoreid);
|
||||
}
|
||||
|
||||
function savenotitie(){
|
||||
// TODO Clean input
|
||||
if (!$this->userid) die;
|
||||
$notitie = $this->clean_input('notitie');
|
||||
$fvid = $this->clean_input('fvID');
|
||||
if ($fvid){
|
||||
$this->Filledversions_model->update_record(array("notitie"=>$notitie), $fvid);
|
||||
}
|
||||
}
|
||||
|
||||
function lijstmeetellen(){
|
||||
if (!$this->userid) die;
|
||||
$meetellen = $this->clean_input('meetellen');
|
||||
$fvid = $this->clean_input('fvID');
|
||||
if($fvid)
|
||||
$this->Filledversions_model->update_record(array('meetellen' =>$meetellen), $fvid);
|
||||
|
||||
}
|
||||
|
||||
function printlijst(){
|
||||
$input0 = $this->input->post('data');
|
||||
$input = json_decode($input0);
|
||||
//var_dump('input', $input);
|
||||
$organisatie = $this->Organisaties_model->get_orgnaam($this->globorgid);
|
||||
$instrument = $this->Modules_model->get_fieldvalue(array("sysnr" =>$this->module), "naam") ;
|
||||
|
||||
$data=array( "instrument" => $instrument,
|
||||
"organisatie" => $organisatie,
|
||||
"versie" => $input->orgversie,
|
||||
"today" => date('d-m-Y'),
|
||||
"listitems" => json_decode($input->tabelinfo),
|
||||
"notitie" => $input->notitie);
|
||||
$html=$this->load->view("monpas/reports/printlijst", $data, true);
|
||||
$filenaam="MonPasInvullijst";
|
||||
$this->Phantom_model->create_pdf($html,$filenaam, FALSE,FALSE,FALSE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,599 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
use Curl\Curl;
|
||||
use \Firebase\JWT\JWT;
|
||||
|
||||
class Omvang extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array(
|
||||
|
||||
"monpas/Arrangementen_model",
|
||||
"monpas/Arrangementen_piv_aantal_model",
|
||||
"shared/Kalenderjaren_model",
|
||||
"shared/Aantalleerlingen_model",
|
||||
"shared/Licenties_model",
|
||||
"Phantom_model",
|
||||
"monpas/Tlvs_model"
|
||||
);
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
}
|
||||
|
||||
function getrechten(){
|
||||
if (!$this->userid) die;
|
||||
$editok = false;
|
||||
$autorisatie = $this->Autorisaties_model->check_autorisatie($this->userrole,259 );
|
||||
|
||||
if ( $autorisatie> 0) $editok = true;
|
||||
echo json_encode($editok);
|
||||
}
|
||||
|
||||
function getextraomvang(){
|
||||
if (!$this->userid) die;
|
||||
$schooljaarnr = $this->uri->segment(4);
|
||||
|
||||
$aantal = $this->Aantalleerlingen_model->getAantalleerlingenInvullen($this->globorgid, $schooljaarnr);
|
||||
if(!$aantal) $aantal = false;
|
||||
|
||||
$tlvs = $this->Tlvs_model->getAantalTLVs($this->globorgid, $schooljaarnr);
|
||||
if(!$tlvs) $tlvs = false;
|
||||
|
||||
$arrangementen = $this->Arrangementen_model->getArrangementen($this->globorgid, $schooljaarnr);
|
||||
if($arrangementen){
|
||||
foreach($arrangementen as $arrangement){
|
||||
$arrangement->huidig = $this->Arrangementen_model->getAantallen($this->globorgid, $schooljaarnr, $arrangement->id);
|
||||
}
|
||||
}
|
||||
else{
|
||||
$arrangementen = false;
|
||||
}
|
||||
|
||||
$extraomvang = [
|
||||
'aantal' => $aantal,
|
||||
'tlvs' => $tlvs,
|
||||
'arrangementen' => $arrangementen,
|
||||
];
|
||||
|
||||
|
||||
|
||||
echo json_encode($extraomvang);
|
||||
|
||||
}
|
||||
|
||||
function getArrangementen(){
|
||||
if (!$this->userid) die;
|
||||
$schooljaarnr = $this->uri->segment(4);
|
||||
|
||||
$arrangementen = $this->Arrangementen_model->getArrangementen($this->globorgid, $schooljaarnr);
|
||||
if($arrangementen){
|
||||
foreach($arrangementen as $arrangement){
|
||||
$arrangement->huidig = $this->Arrangementen_model->getAantallen($this->globorgid, $schooljaarnr, $arrangement->id);
|
||||
}
|
||||
}
|
||||
else{
|
||||
$arrangementen = false;
|
||||
}
|
||||
|
||||
echo json_encode($arrangementen);
|
||||
}
|
||||
|
||||
|
||||
function saveAantalLeerlingen(){
|
||||
if (!$this->userid) die;
|
||||
$schooljaarnr = $this->clean_input('schooljaarnr');
|
||||
$aantalleerlingen = $this->clean_input('aantalleerlingen');
|
||||
|
||||
$id = $this->Aantalleerlingen_model->get_fieldvalue(['schooljaarnr' => $schooljaarnr, 'organisatie_id' => $this->globorgid], 'id');
|
||||
if ($id) {
|
||||
$this->Aantalleerlingen_model->update_record(['aantal' => $aantalleerlingen], $id);
|
||||
} else {
|
||||
$data =[
|
||||
'organisatie_id' => $this->globorgid,
|
||||
'schooljaarnr' => $schooljaarnr,
|
||||
'aantal' => $aantalleerlingen
|
||||
];
|
||||
$id = $this->Aantalleerlingen_model->insert_record($data);
|
||||
}
|
||||
|
||||
|
||||
if(!$id){
|
||||
$id = 0;
|
||||
}
|
||||
|
||||
echo json_encode($id);
|
||||
|
||||
}
|
||||
|
||||
function saveTlvsSO(){
|
||||
if (!$this->userid) die;
|
||||
$schooljaarnr = $this->clean_input('schooljaarnr');
|
||||
$laag = $this->clean_input('laag');
|
||||
$midden = $this->clean_input('midden');
|
||||
$hoog = $this->clean_input('hoog');
|
||||
$laagID = $this->clean_input('laagID');
|
||||
$middenID = $this->clean_input('middenID');
|
||||
$hoogID = $this->clean_input('hoogID');
|
||||
$laagIDNieuw = false;
|
||||
$middenIDNieuw = false;
|
||||
$hoogIDNieuw = false;
|
||||
|
||||
if(intval($laag) > 0 && intval($laagID) > 0) {
|
||||
$laagIDNieuw = $this->Tlvs_model->update_record(['aantal' => $laag], $laagID);
|
||||
|
||||
}
|
||||
if(intval($midden) > 0 && intval($middenID) > 0) {
|
||||
$middenIDNieuw = $this->Tlvs_model->update_record(['aantal' => $midden], $middenID);
|
||||
|
||||
}
|
||||
if(intval($hoog) > 0 && intval($hoogID) > 0) {
|
||||
$hoogIDNieuw = $this->Tlvs_model->update_record(['aantal' => $hoog], $hoogID);
|
||||
|
||||
}
|
||||
if(intval($laag) > 0 && intval($laagID) == 0) {
|
||||
$nieuwedata = [
|
||||
'schooljaarnr' => $schooljaarnr,
|
||||
'organisatie_id' => $this->globorgid,
|
||||
'soort' => 'SO',
|
||||
'zwaarte' => 'LAAG',
|
||||
'aantal' => $laag
|
||||
];
|
||||
|
||||
$laagIDNieuw = $this->Tlvs_model->insert_record($nieuwedata);
|
||||
|
||||
}
|
||||
if(intval($midden) > 0 && intval($middenID)== 0) {
|
||||
$nieuwedata = [
|
||||
'schooljaarnr' => $schooljaarnr,
|
||||
'organisatie_id' => $this->globorgid,
|
||||
'soort' => 'SO',
|
||||
'zwaarte' => 'MIDDEN',
|
||||
'aantal' => $midden
|
||||
];
|
||||
|
||||
$middenIDNieuw = $this->Tlvs_model->insert_record($nieuwedata);
|
||||
|
||||
}
|
||||
if(intval($hoog) > 0 && intval($hoogID) == 0) {
|
||||
$nieuwedata = [
|
||||
'schooljaarnr' => $schooljaarnr,
|
||||
'organisatie_id' => $this->globorgid,
|
||||
'soort' => 'SO',
|
||||
'zwaarte' => 'HOOG',
|
||||
'aantal' => $hoog
|
||||
];
|
||||
|
||||
$hoogIDNieuw = $this->Tlvs_model->insert_record($nieuwedata);
|
||||
}
|
||||
|
||||
$ids = [
|
||||
'laag' => $laagIDNieuw,
|
||||
'midden' => $middenIDNieuw,
|
||||
'hoog' => $hoogIDNieuw
|
||||
|
||||
];
|
||||
echo json_encode($ids);
|
||||
}
|
||||
|
||||
function saveTlvsSBO(){
|
||||
if (!$this->userid) die;
|
||||
$schooljaarnr = $this->clean_input('schooljaarnr');
|
||||
$licht = $this->clean_input('licht');
|
||||
$zwaar = $this->clean_input('zwaar');
|
||||
$lichtID = $this->clean_input('lichtID');
|
||||
$zwaarID = $this->clean_input('zwaarID');
|
||||
$lichtIDNieuw = false;
|
||||
$zwaarIDNieuw = false;
|
||||
|
||||
if(intval($licht) > 0 && intval($lichtID) > 0) {
|
||||
$lichtIDNieuw = $this->Tlvs_model->update_record(['aantal' => $licht], $lichtID);
|
||||
|
||||
}
|
||||
if(intval($zwaar) > 0 && intval($zwaarID) > 0) {
|
||||
$zwaarIDNieuw = $this->Tlvs_model->update_record(['aantal' => $zwaar], $zwaarID);
|
||||
|
||||
}
|
||||
|
||||
if(intval($licht) > 0 && intval($lichtID) == 0) {
|
||||
$nieuwedata = [
|
||||
'schooljaarnr' => $schooljaarnr,
|
||||
'organisatie_id' => $this->globorgid,
|
||||
'soort' => 'SBO',
|
||||
'zwaarte' => 'LICHT',
|
||||
'aantal' => $licht
|
||||
];
|
||||
|
||||
$lichtIDNieuw = $this->Tlvs_model->insert_record($nieuwedata);
|
||||
|
||||
}
|
||||
if(intval($zwaar) > 0 && intval($zwaarID)== 0) {
|
||||
$nieuwedata = [
|
||||
'schooljaarnr' => $schooljaarnr,
|
||||
'organisatie_id' => $this->globorgid,
|
||||
'soort' => 'SBO',
|
||||
'zwaarte' => 'ZWAAR',
|
||||
'aantal' => $zwaar
|
||||
];
|
||||
|
||||
$zwaarIDNieuw = $this->Tlvs_model->insert_record($nieuwedata);
|
||||
|
||||
}
|
||||
$ids=[
|
||||
'licht' =>$lichtIDNieuw,
|
||||
'zwaar' =>$zwaarIDNieuw
|
||||
];
|
||||
|
||||
|
||||
echo json_encode($ids);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function saveLlnArrangement(){
|
||||
if (!$this->userid) die;
|
||||
$aantal = $this->clean_input('aantal');
|
||||
$arrid = $this->clean_input('id');
|
||||
$schooljaarnr = $this->clean_input('schooljaar');
|
||||
|
||||
$recordid = $this->Arrangementen_piv_aantal_model->get_fieldvalue(
|
||||
['arrangement_id'=>$arrid, 'schooljaarnr'=>$schooljaarnr], 'id', true);
|
||||
if($recordid){
|
||||
$this->Arrangementen_piv_aantal_model->update_record(
|
||||
['aantal' => $aantal], $recordid );
|
||||
}
|
||||
else{
|
||||
$recordid = $this->Arrangementen_piv_aantal_model->insert_record(
|
||||
['arrangement_id'=>$arrid, 'schooljaarnr'=> $schooljaarnr, 'aantal'=>$aantal]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function deleteArrangement(){
|
||||
if (!$this->userid) die;
|
||||
|
||||
$arrangementid = $this->uri->segment(4);
|
||||
$message = "";
|
||||
$totaal = $this->Arrangementen_piv_aantal_model->getAantallen($arrangementid);
|
||||
|
||||
if(!isset($totaal) || $totaal ==0) {
|
||||
$this->Arrangementen_model->delete_record($arrangementid);
|
||||
$this->Arrangementen_piv_aantal_model->delete_record_where(['arrangement_id' =>$arrangementid]);
|
||||
$message = "gelukt";
|
||||
$subtotalen = 0;
|
||||
}
|
||||
else{
|
||||
$schooljaren = "";
|
||||
$subtotalen = $this->Arrangementen_piv_aantal_model->getAantallenPerSchooljaar($arrangementid);
|
||||
if($subtotalen){
|
||||
$lengte = count($subtotalen);
|
||||
foreach($subtotalen as $index => $subtotaal){
|
||||
if( $index < ($lengte - 2)) $schooljaren = $schooljaren . $subtotaal->naam. ', ';
|
||||
if( $index == ($lengte - 2)) $schooljaren = $schooljaren . $subtotaal->naam.' en ' ;
|
||||
if( $index == ($lengte - 1)) $schooljaren = $schooljaren . $subtotaal->naam ;
|
||||
}
|
||||
}
|
||||
$message = "Er zijn leerlingen gekoppeld aan het arrangement in ". $schooljaren. " . Het kan niet worden verwijderd.";
|
||||
|
||||
}
|
||||
echo json_encode($message);
|
||||
|
||||
}
|
||||
|
||||
function archiveerArrangement(){
|
||||
if (!$this->userid) die;
|
||||
$arrid = $this->clean_input('arrangementid');
|
||||
$schooljaarnr = $this->clean_input('schooljaarnr');
|
||||
|
||||
$arrangement = $this->Arrangementen_model->get_record_by_id($arrid);
|
||||
if ($arrangement->organisatie_id != $this->globorgid) return;
|
||||
|
||||
$aantalid = $this->Arrangementen_piv_aantal_model->get_fieldvalue(['arrangement_id' => $arrid, 'schooljaarnr' => $schooljaarnr], 'id');
|
||||
if ($aantalid) {
|
||||
$this->Arrangementen_piv_aantal_model->update_record(['archief' => 'T'], $aantalid);
|
||||
}
|
||||
else{
|
||||
$aantalid = $this->Arrangementen_piv_aantal_model->insert_record(['arrangement_id' => $arrid, 'aantal'=> 0, 'schooljaarnr' => $schooljaarnr, 'archief' => 'T']);
|
||||
}
|
||||
echo json_encode($aantalid);
|
||||
}
|
||||
|
||||
function saveNieuwArrangement(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->globorgid;
|
||||
$schooljaarnr = $this->clean_input('schooljaarnr');
|
||||
$aantal = $this->clean_input('aantal');
|
||||
$naam = stripslashes($this->clean_input('naam'));
|
||||
$leeftijd = stripslashes($this->clean_input('leeftijd'));
|
||||
$looptijd = $this->clean_input('looptijd');
|
||||
|
||||
$data = [
|
||||
'organisatie_id' => $orgid,
|
||||
'naam' => $naam,
|
||||
'lengte' => $looptijd,
|
||||
'leeftijd' => $leeftijd,
|
||||
'schooljaarnr' => $schooljaarnr
|
||||
];
|
||||
|
||||
$id = $this->Arrangementen_model->insert_record($data);
|
||||
|
||||
$data2 = [
|
||||
'arrangement_id' => $id,
|
||||
'schooljaarnr' => $schooljaarnr,
|
||||
'aantal' => $aantal,
|
||||
'archief' =>'F'
|
||||
];
|
||||
|
||||
$aantalid = $this->Arrangementen_piv_aantal_model->insert_record($data2);
|
||||
|
||||
echo json_encode($id);
|
||||
|
||||
}
|
||||
|
||||
function toonAlleArrangmenten(){
|
||||
if (!$this->userid) die;
|
||||
$schooljaarnr = $this->uri->segment(4);
|
||||
$orgid = $this->globorgid;
|
||||
$arrangementen = $this->Arrangementen_model->getArrangementen($orgid, $schooljaarnr);
|
||||
foreach($arrangementen as $arrangement) {
|
||||
$this->Arrangementen_piv_aantal_model->update_record_where(['archief' => 'F'], ['arrangement_id' =>$arrangement->id, 'schooljaarnr' =>$schooljaarnr]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
function gegevensmeetellen(){
|
||||
if (!$this->userid) die;
|
||||
$meetellen = $this->clean_input('meetellen');
|
||||
$schooljaarnr = $this->clean_input('schooljaar');
|
||||
$aantalid = $this->Aantalleerlingen_model->get_fieldvalue(['organisatie_id' => $this->globorgid, 'schooljaarnr' => $schooljaarnr], 'id');
|
||||
if ($aantalid){
|
||||
$this->Aantalleerlingen_model->update_record(['meetellen' =>$meetellen], $aantalid);
|
||||
}
|
||||
}
|
||||
|
||||
function bewaarNotitie(){
|
||||
if (!$this->userid) die;
|
||||
$notitie = $this->clean_input('notitie');
|
||||
$schooljaarnr = $this->clean_input('schooljaarnr');
|
||||
$aantalid = $this->Aantalleerlingen_model->get_fieldvalue(['organisatie_id' => $this->globorgid, 'schooljaarnr' => $schooljaarnr], 'id');
|
||||
if ($aantalid){
|
||||
$this->Aantalleerlingen_model->update_record(['notitie'=>$notitie], $aantalid);
|
||||
}
|
||||
echo json_encode($aantalid);
|
||||
}
|
||||
|
||||
|
||||
function getOrgsEnSchooljaren(){
|
||||
if (!$this->userid) die;
|
||||
$organisatie = $this->Organisaties_model->getorg($this->globorgid);
|
||||
$ids = [];
|
||||
|
||||
if($organisatie->soort == 4){
|
||||
$schoolIDs = $organisatie->id;
|
||||
}
|
||||
else {
|
||||
$scholen = $this->Organisaties_model->get_schoolIDs_onder($organisatie->id);
|
||||
if($scholen){
|
||||
foreach ($scholen as $school){
|
||||
$ids [] = $school->id;
|
||||
}
|
||||
}
|
||||
$schoolIDs = implode(',', $ids);
|
||||
$organisatie->suborgs = $this->Organisaties_model->getorgsvanaf($organisatie->id);
|
||||
//bestuur kamer of swv
|
||||
if (isset($organisatie->suborgs)){
|
||||
foreach ($organisatie->suborgs as $suborg) {
|
||||
if ($suborg->soort < 4) {
|
||||
//kamer of swv
|
||||
$suborg->suborgs = $this->Organisaties_model->getorgsvanaf($suborg->id);
|
||||
}
|
||||
if (isset($suborg->suborgs)) {
|
||||
foreach ($suborg->suborgs as $subsub) {
|
||||
if ($subsub->soort < 4) {
|
||||
//kamer
|
||||
$subsub->suborgs = $this->Organisaties_model->getorgsvanaf($subsub->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$schooljaren = false;
|
||||
if($schoolIDs) {
|
||||
|
||||
$schooljaren = $this->Aantalleerlingen_model->get_gevulde_schooljaren($schoolIDs);
|
||||
}
|
||||
|
||||
$data = [
|
||||
"organisatie" => $organisatie,
|
||||
"soort" => $organisatie->soort,
|
||||
"schooljaren" => $schooljaren
|
||||
|
||||
];
|
||||
|
||||
echo json_encode($data);
|
||||
|
||||
}
|
||||
|
||||
function getOmvang(){
|
||||
if (!$this->userid) die;
|
||||
$schooljaarnrs = $this->clean_input('schooljaren');
|
||||
$orgid = $this->clean_input('orgid');
|
||||
if(! array($schooljaarnrs)) $schooljaarnrs = array($schooljaarnrs);
|
||||
// $schooljaarnrs = array_reverse($schooljaarnrs);
|
||||
$schooljaren = [];
|
||||
$arrangementen = [];
|
||||
$organisatie = $this->Organisaties_model->getorg($orgid);
|
||||
;
|
||||
$array = [];
|
||||
$idsboven = [];
|
||||
|
||||
if($organisatie->soort == 4){
|
||||
$schoolIDs = $organisatie->id;
|
||||
}
|
||||
else{
|
||||
$scholen = $this->Organisaties_model->get_schoolIDs_onder($organisatie->id);
|
||||
if($scholen){
|
||||
foreach($scholen as $school){
|
||||
$array[] = $school->id;
|
||||
}
|
||||
$schoolIDs = implode(',', $array);
|
||||
}
|
||||
}
|
||||
if($organisatie->soort != 1) {
|
||||
$organisatieBoven = $this->Organisaties_model->getorg($organisatie->valtonder_id);
|
||||
if($organisatie->soort == 3){
|
||||
$organisatieBoven = $this->Organisaties_model->getorg($organisatieBoven->valtonder_id);
|
||||
}
|
||||
$scholenboven = $this->Organisaties_model->get_schoolIDs_onder($organisatie->valtonder_id);
|
||||
if($scholenboven){
|
||||
foreach($scholenboven as $school){
|
||||
$array[] = $school->id;
|
||||
}
|
||||
$schoolIDsBoven = implode(',', $array);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
foreach($schooljaarnrs as $nummer){
|
||||
$schooljaar = new stdClass();
|
||||
|
||||
if(isset($schoolIDs)) {
|
||||
$omvang = $this->Aantalleerlingen_model->get_omvang($nummer, $schoolIDs);
|
||||
$schooljaar->schooljaarnr = $omvang->schooljaarnr;
|
||||
$schooljaar->naam = $omvang->naam;
|
||||
$schooljaar->aantal = $omvang->aantal;
|
||||
$schooljaar->aantalllnarr = $this->Arrangementen_model->getAantalLeerlingenMetArrangement($nummer, $schoolIDs);
|
||||
$schooljaar->tlvs = $this->Tlvs_model->getAantalLeerlingenMetTLV($nummer, $schoolIDs);
|
||||
if($organisatie->soort == 4){
|
||||
$schooljaar->arrangementen = $this->Arrangementen_model->getArrangementenMetAantallen($organisatie->id,$nummer );
|
||||
}
|
||||
}
|
||||
if(isset($schoolIDsBoven)) {
|
||||
$boven = $this->Aantalleerlingen_model->get_omvang($nummer, $schoolIDsBoven);
|
||||
$schooljaar->naamboven = $organisatieBoven->naamkort;
|
||||
$schooljaar->brinboven = $organisatieBoven->brin;
|
||||
$schooljaar->aantalboven = $boven->aantal;
|
||||
$schooljaar->aantalllnarrB = $this->Arrangementen_model->getAantalLeerlingenMetArrangement($nummer, $schoolIDsBoven);
|
||||
$schooljaar->tlvsB = $this->Tlvs_model->getAantalLeerlingenMetTLV($nummer, $schoolIDsBoven);
|
||||
|
||||
}
|
||||
if(isset($schooljaar->aantal)){
|
||||
$schooljaren [] = $schooljaar;
|
||||
}
|
||||
}
|
||||
|
||||
$result = [
|
||||
'schooljaren' => $schooljaren
|
||||
];
|
||||
|
||||
echo json_encode($result);
|
||||
|
||||
}
|
||||
|
||||
function getArrangementenBijSchool($schooljaarnrs, $organisatieid){
|
||||
$arrangementen = [];
|
||||
foreach ($schooljaarnrs as $nummer) {
|
||||
$arrangement = $this->Arrangementen_model->getArrangementen($organisatieid, $nummer);
|
||||
if ($arrangement) {
|
||||
$arrangementen[] = $arrangement;
|
||||
}
|
||||
}
|
||||
return $arrangementen;
|
||||
}
|
||||
|
||||
|
||||
function maakOmvangPDF(){
|
||||
if (!$this->userid) die;
|
||||
if (!$this->globorgid) die;
|
||||
$orgid = $this->globorgid;
|
||||
$inputstring = $this->input->post('data');
|
||||
$input = json_decode($inputstring);
|
||||
$schooljaren = $input->schooljaren;
|
||||
$filenaam = $input->filenaam;
|
||||
$filenaam = trim($filenaam);
|
||||
$filenaam = str_replace(' ', '_', $filenaam);
|
||||
$organisatie = $this->Organisaties_model->getorg($this->globorgid);
|
||||
$today = date("d-m-Y");
|
||||
|
||||
$data['organisatie'] = $organisatie;
|
||||
$data['vandaag'] = $today;
|
||||
$data['schooljaren']= $input->schooljaren;
|
||||
$data['hoofdtabel'] = $input->hoofdtabel;
|
||||
$data['graph'] = $input->graph;
|
||||
$data['tlvgraphs'] = $input->tlvgraphs;
|
||||
$data['arrgraphs'] = $input->arrgraphs;
|
||||
$data['arrtables'] = $input->arrtables;
|
||||
|
||||
|
||||
|
||||
$html = $this->load->view("monpas/reports/omvangreport", $data, true);
|
||||
$pdf = $this->Phantom_model->create_pdf($html, $filenaam, FALSE, FALSE, FALSE, 'landscape');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// monpas.local/index.php/monpas/omvang/getGrippaTlvs/2019
|
||||
public function getGrippaTlvs($schooljaar){
|
||||
// if (!$this->userid) die;
|
||||
$startdatum = '2019-08-01';
|
||||
$einddatum = '2020-07-31';
|
||||
$endpoint = 'https://api.grippa.nl/index.php/v1/api/tlvrequest';
|
||||
$this->load->helper('string');
|
||||
$key = 'mZ6QtNTno2bjvIoojD5eafSKjJf6Oc3KLLaz9Ixlo2bjvIoojD5eaf';
|
||||
$requestToken = random_string('alnum', 40);
|
||||
$organisationHash =
|
||||
hash( 'sha256',
|
||||
hash( 'sha256', 'esC4ESRmqgHaEoj7lXF8W1plrZRM0FqzujEz8xI6noWvuYKyE7' ) .
|
||||
hash( 'sha256', $requestToken )
|
||||
);
|
||||
|
||||
// $organisationHash = hash_hmac( hash_hmac('esC4ESRmqgHaEoj7lXF8 W1plrZRM0FqzujEz8xI6 noWvuYKyE7'). hash_hmac($requestToken));
|
||||
|
||||
$payload = [
|
||||
'iat' => strtotime(gmdate('Y/m/d H:i:s')),
|
||||
'iss' => 'MONPAS',
|
||||
'organisation_brin' => 'PO2203',
|
||||
'requesttoken' => $requestToken,
|
||||
'organisation_hash' => $organisationHash,
|
||||
'start' => $startdatum,
|
||||
'starttype' => 'G',
|
||||
'eind' => $einddatum,
|
||||
'eindtype' => 'S'
|
||||
];
|
||||
|
||||
$jwt = JWT::encode($payload, $key);
|
||||
|
||||
$curl = new Curl();
|
||||
$curl->post($endpoint, ['jwt' => $jwt]);
|
||||
|
||||
$tlvs = $curl->response;
|
||||
$tlvs = json_decode($tlvs);
|
||||
|
||||
|
||||
var_dump($tlvs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class Ondersteuning extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array( "shared/Users_model",
|
||||
"monpas/Ondersteuningtijden_model",
|
||||
"monpas/Groepen_model");
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
function getgroepen(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->clean_input('orgID');
|
||||
$schooljaarnr = $this->clean_input('schooljaar');
|
||||
$module = $this->clean_input('module');
|
||||
$groepen = $this->Groepen_model->getgroepenlist($orgid, $schooljaarnr, $module);
|
||||
echo json_encode($groepen);
|
||||
}
|
||||
|
||||
function getgroepenso(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->uri->segment(4);
|
||||
$schooljaarnr = $this->uri->segment(5);
|
||||
$groepen = $this->Groepen_model->getgroepenSboSo($orgid, $schooljaarnr);
|
||||
$ondersteuning = 'T';
|
||||
if ($groepen){
|
||||
foreach($groepen as $groep) {
|
||||
if (isset($groep->ondersteuning)) {
|
||||
if ($groep->ondersteuning === 'F') {
|
||||
$ondersteuning = 'F';
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode(['groepen'=>$groepen, 'ondersteuning'=>$ondersteuning]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function gettijden(){
|
||||
if (!$this->userid) die;
|
||||
$groepid = $this->uri->segment(4);
|
||||
|
||||
$dagen=array( ['dagnr'=> 1,'dag' => 'maandag', 'minutenG'=>0, 'minutenS'=> 0,'minutenI'=> 0],
|
||||
['dagnr'=> 2,'dag' => 'dinsdag', 'minutenG'=>0, 'minutenS'=> 0,'minutenI'=> 0],
|
||||
['dagnr'=> 3,'dag' => 'woensdag', 'minutenG'=>0, 'minutenS'=> 0,'minutenI'=> 0],
|
||||
['dagnr'=> 4,'dag' => 'donderdag', 'minutenG'=>0, 'minutenS'=> 0,'minutenI'=> 0],
|
||||
['dagnr'=> 5,'dag' => 'vrijdag', 'minutenG'=>0, 'minutenS'=> 0,'minutenI'=> 0]);
|
||||
for($i=0;$i<count($dagen);$i++){
|
||||
$minuten = $this->Ondersteuningtijden_model->getminuten($groepid, $dagen[$i]['dagnr'],'G');
|
||||
|
||||
if ($minuten){
|
||||
$dagen[$i]['minutenG']= $minuten;
|
||||
};
|
||||
|
||||
$minuten = $this->Ondersteuningtijden_model->getminuten($groepid, $dagen[$i]['dagnr'],'S');
|
||||
if ($minuten){
|
||||
$dagen[$i]['minutenS']= $minuten;};
|
||||
|
||||
$minuten = $this->Ondersteuningtijden_model->getminuten($groepid, $dagen[$i]['dagnr'],'I');
|
||||
if ($minuten){$dagen[$i]['minutenI']= $minuten;};
|
||||
}
|
||||
echo json_encode($dagen);
|
||||
}
|
||||
|
||||
function saveondersteuning(){
|
||||
$ondersteuning = $this->clean_input('ondersteuning');
|
||||
$orgid = $this->clean_input('orgid');
|
||||
$schooljaar = $this->clean_input('schooljaar');
|
||||
|
||||
$groepen = $this->Groepen_model->getgroepenSboSo($orgid, $schooljaar);
|
||||
if ($groepen) {
|
||||
foreach ($groepen as $groep) {
|
||||
$this->Groepen_model->update_record_where(['ondersteuning' => $ondersteuning], ['id' => $groep->id]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function insertorupdatetijd(){
|
||||
if (!$this->userid) die;
|
||||
$where= array( "groep_id" =>$this->clean_input('groepid'),
|
||||
"dagnr" =>$this->clean_input('dagnr'),
|
||||
"soort" =>$this->clean_input('soort') );
|
||||
|
||||
$tijd = $this->Ondersteuningtijden_model->get_records_where($where, true);
|
||||
if ($tijd){
|
||||
$this->Ondersteuningtijden_model->update_record(array("minuten" =>$this->clean_input('minuten')), $tijd->id);
|
||||
}
|
||||
else{
|
||||
$where['organisatie_id'] = $this->clean_input('orgid');
|
||||
$where['minuten'] = $this->clean_input('minuten');
|
||||
|
||||
$this->Ondersteuningtijden_model->insert_record($where);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class Overzichtscores extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array("shared/Users_model",
|
||||
"shared/Orgusers_model",
|
||||
"monpas/Filledversions_model" ,
|
||||
"monpas/Modules_model",
|
||||
"monpas/Orgversies_model",
|
||||
"monpas/Oordelen_model",
|
||||
"monpas/Ijkpunten_model",
|
||||
"monpas/Indicatoren_model",
|
||||
"monpas/Scores_model",
|
||||
"shared/Session_model",
|
||||
"Phantom_model");
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
function getscores(){
|
||||
$orguserid = $this->input->post("orguserid");
|
||||
|
||||
$userid = false;
|
||||
if ($orguserid && $orguserid !== 'false'){
|
||||
$userid = $this->Orgusers_model->get(['id'=>$orguserid],'user_id', true);
|
||||
}
|
||||
|
||||
$orgid = $this->clean_input("orgid");
|
||||
$orgversie = $this->clean_input("orgversieid");
|
||||
if (!$orguserid) {$orgstring = implode(',' , $this->Organisaties_model->getscholenondertarget($orgid));}
|
||||
else {$orgstring = $orgid ;}
|
||||
$data = $this->Scores_model->getstandaardfrequenties($userid, $orgstring,$orgversie);
|
||||
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
// function getuserstatus(){
|
||||
// echo json_encode($this->super);
|
||||
// }//schoolmanagement mag eigen normen wijzigen nav omzettabel 23 nov 2017
|
||||
|
||||
function geteditrecht(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->uri->segment(4);
|
||||
$bgid = $this->Organisaties_model->get_fieldvalue(array('id'=>$orgid), 'valtonder_id');
|
||||
$kamerid = $this->Organisaties_model->get_fieldvalue(array('id'=>$bgid), 'valtonder_id');
|
||||
$recht = false;
|
||||
|
||||
if($this->userrole<= 8){// werkt bij swv
|
||||
$recht = true;
|
||||
}
|
||||
if($this->globorgid == $kamerid && $this->userrole <= 32){//werkt bij kamer
|
||||
$recht == true;
|
||||
}
|
||||
if($this->globorgid == $bgid && $this->uderrole <=128){//werkt bij bg
|
||||
$recht = true;
|
||||
}
|
||||
if($this->globorgid == $orgid && $this->userrole <= 256){//management op school
|
||||
$recht = true;
|
||||
}
|
||||
echo json_encode($recht);
|
||||
}
|
||||
function saveOordeel(){
|
||||
$newID= false;
|
||||
|
||||
$oordeelID = $this->input->post("oordeelID");
|
||||
$norm = "";
|
||||
$normid = $this->clean_input('normID');
|
||||
switch($normid){
|
||||
case 1: $norm = "zeer zwak"; break;
|
||||
case 2: $norm = "onvoldoende"; break;
|
||||
case 3: $norm = "voldoende"; break;
|
||||
case 4: $norm = "goed"; break;
|
||||
};
|
||||
if (!$oordeelID){
|
||||
$data=['filledversion_id' =>$this->clean_input('fvID'),
|
||||
'ijkpunt_id' =>$this->clean_input('ijkID'),
|
||||
'norm_id' =>$normid,
|
||||
'norm' =>$norm
|
||||
];
|
||||
|
||||
$newID = $this->Oordelen_model->insert_record($data);
|
||||
}else {
|
||||
$data=['norm_id' =>$normid,
|
||||
'norm' =>$norm
|
||||
];
|
||||
$newID = $this->Oordelen_model->update_record($data, $oordeelID);
|
||||
}
|
||||
|
||||
echo json_encode($newID);
|
||||
}
|
||||
|
||||
function savegewenst(){
|
||||
$wensarray = $this->input->post('wensarray');
|
||||
foreach($wensarray as $wens){
|
||||
|
||||
if ($wens['oordeelid']){
|
||||
$data = ['wens_id' =>$wens['gewenst'] ];
|
||||
$this->Oordelen_model->update_record($data, $wens['oordeelid']);
|
||||
} else{
|
||||
$data =['wens_id' =>$wens['gewenst'],
|
||||
'filledversion_id'=>$wens['fvID'],
|
||||
'ijkpunt_id' =>$wens['ijkID'],
|
||||
'norm_id' =>0];
|
||||
$this->Oordelen_model->insert_record($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function pdfstandaarden(){
|
||||
$inputstring = $this->input->post('data');
|
||||
$input = json_decode($inputstring);
|
||||
$school = $input->school;
|
||||
$versie = $input->versie;
|
||||
$standaarden = $input->standaarden;
|
||||
$instrument = $this->Modules_model->get_fieldvalue(array("sysnr" =>$this->module), "naam") ;
|
||||
|
||||
$data = ['instrument' =>$instrument,
|
||||
'school' =>$school,
|
||||
'versie' =>$versie,
|
||||
'today' =>Date('d-m-Y'),
|
||||
'standaarden' =>json_decode($standaarden)];
|
||||
|
||||
$html = $this->load->view("monpas/reports/pdfstandaarden", $data, true);
|
||||
$filenaam="standaarden";
|
||||
$this->Phantom_model->create_pdf($html, $filenaam, FALSE, FALSE, FALSE);
|
||||
}
|
||||
|
||||
function printontwikkelmatrix(){
|
||||
if (!$this->userid) die;
|
||||
$inputstring = $this->input->get('json');
|
||||
$input = json_decode($inputstring);
|
||||
|
||||
$school = $input->school;
|
||||
$versie = $input->versie;
|
||||
$instrument = $this->Modules_model->get_fieldvalue(array("sysnr" =>$this->module), "naam") ;
|
||||
$labels = $this->Labels_model->getalllabels();
|
||||
$standaarden = $input->resultaten;
|
||||
|
||||
$data = ['instrument' =>$instrument,
|
||||
'labels' =>$labels,
|
||||
'school' =>$school,
|
||||
'versie' =>$versie,
|
||||
'today' =>Date('d-m-Y'),
|
||||
'standaarden' =>$standaarden];
|
||||
$html = $this->load->view("monpas/reports/ontwikkelmatrix2", $data, true);
|
||||
$filenaam="ontwikkelmatrix";
|
||||
$this->Phantom_model->create_pdf($html, $filenaam, FALSE, FALSE, FALSE);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Overzichtsop extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array(
|
||||
"shared/Schooljaren_model",
|
||||
"shared/Organisaties_model",
|
||||
"shared/Orgusers_model",
|
||||
"monpas/Compactsop_model"
|
||||
|
||||
|
||||
|
||||
);
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
}
|
||||
|
||||
function getSchooljaren(){
|
||||
if (!$this->userid) die;
|
||||
$schooljaren = $this->Schooljaren_model->getschooljaren();
|
||||
echo json_encode($schooljaren);
|
||||
}
|
||||
|
||||
function getoverzicht() {
|
||||
if (!$this->userid) die;
|
||||
$schooljaarnr = $this->clean_input("schooljaarnr");
|
||||
$orgid = $this->clean_input("orgid");
|
||||
if ($orgid == 0) $orgid = $this->globorgid;
|
||||
$organisatie = $this->Organisaties_model->getorg($orgid);
|
||||
switch ($organisatie->soort) {
|
||||
case 4:
|
||||
$organisatie->sop = 'F';
|
||||
$compactsopID = $this->Compactsop_model->get_fieldvalue(['organisatie_id' => $orgid,
|
||||
'schooljaarnummer' => $schooljaarnr], 'id');
|
||||
if ($compactsopID) $organisatie->sop = 'T';
|
||||
echo json_encode(array("organisatie" => $organisatie, "soort" => 4,));
|
||||
break;
|
||||
case 3:
|
||||
$bgid = $organisatie->id;
|
||||
$organisatie->scholen = $this->Organisaties_model->getorgsvanaf($bgid);
|
||||
if ($organisatie->scholen) {
|
||||
foreach ($organisatie->scholen as $index => $school) {
|
||||
$school->sop = 'F';
|
||||
$compactsopID = $this->Compactsop_model->get_fieldvalue(
|
||||
['organisatie_id' => $school->id, 'schooljaarnummer' => $schooljaarnr], 'id');
|
||||
if ($compactsopID) $school->sop = 'T';
|
||||
}
|
||||
}
|
||||
echo json_encode(array("organisatie" => $organisatie, "soort" => 3));
|
||||
break;
|
||||
case 2:
|
||||
$kamerid = $organisatie->id;
|
||||
$organisatie->bgs = $this->Organisaties_model->getorgsvanaf($kamerid);
|
||||
if ($organisatie->bgs) {
|
||||
foreach ($organisatie->bgs as $bg) {
|
||||
$bg->scholen = $this->Organisaties_model->getorgsvanaf($bg->id);
|
||||
foreach ($bg->scholen as $index => $school) {
|
||||
$school->sop = 'F';
|
||||
$compactsopID = $this->Compactsop_model->get_fieldvalue(
|
||||
['organisatie_id' => $school->id, 'schooljaarnummer' => $schooljaarnr], 'id');
|
||||
if ($compactsopID) $school->sop = 'T';
|
||||
}
|
||||
}
|
||||
}
|
||||
echo json_encode(array("organisatie" => $organisatie, "soort" => 2));
|
||||
break;
|
||||
case 1;
|
||||
$swvid = $organisatie->id;
|
||||
$organisatie->kamers = $this->Organisaties_model->getorgsvanaf($swvid);
|
||||
if ($organisatie->kamers) {
|
||||
if (!is_array($organisatie->kamers)) {
|
||||
$organisatie->kamers = objectToArray($organisatie->kamers);
|
||||
}
|
||||
foreach ($organisatie->kamers as $kamer) {
|
||||
$kamer->bgs = $this->Organisaties_model->getorgsvanaf($kamer->id);
|
||||
if ($kamer->bgs) {
|
||||
foreach ($kamer->bgs as $bg) {
|
||||
$bg->scholen = $this->Organisaties_model->getorgsvanaf($bg->id);
|
||||
foreach ($bg->scholen as $index => $school) {
|
||||
$school->sop = 'F';
|
||||
$compactsopID = $this->Compactsop_model->get_fieldvalue(
|
||||
['organisatie_id' => $school->id, 'schooljaarnummer' => $schooljaarnr], 'id');
|
||||
if ($compactsopID) $school->sop = 'T';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo json_encode(array("organisatie" => $organisatie, "soort" => 1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function getAlfabetisch(){
|
||||
if (!$this->userid) die;
|
||||
$schooljaarnr = $this->clean_input("schooljaarnr");
|
||||
$orgid = $this->clean_input("orgid");
|
||||
if ($orgid == 0) $orgid = $this->globorgid;
|
||||
$organisatie = $this->Organisaties_model->getorg($orgid);
|
||||
if($organisatie->soort == 2) $organisatie->scholen = $this->Organisaties_model->getscholenonderkamer($organisatie->id);
|
||||
if($organisatie->soort == 1) $organisatie->scholen = $this->Organisaties_model->getscholenonderswv($organisatie->id);
|
||||
|
||||
foreach ($organisatie->scholen as $index => $school) {
|
||||
$school->sop = 'F';
|
||||
$compactsopID = $this->Compactsop_model->get_fieldvalue(
|
||||
['organisatie_id' => $school->id, 'schooljaarnummer' => $schooljaarnr], 'id');
|
||||
if ($compactsopID) $school->sop = 'T';
|
||||
}
|
||||
|
||||
echo json_encode(array("organisatie" => $organisatie, "soort" => $organisatie->soort));
|
||||
|
||||
}
|
||||
|
||||
|
||||
function download_pdf(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->uri->segment(4);
|
||||
$schooljaarnr = $this->uri->segment(5);
|
||||
$sopid = $this->Compactsop_model->get_fieldvalue(['organisatie_id'=>$orgid,
|
||||
'schooljaarnummer' =>$schooljaarnr], 'id');
|
||||
if($sopid){
|
||||
$this->Compactsop_model->downloadCompactSop ($sopid);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Pdfmaker extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array(
|
||||
"Phantom_model",
|
||||
"monpas/Compactsop_model",
|
||||
"monpas/Schooldetails_model"
|
||||
|
||||
);
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
// if ( ! $this->check_online_status() ) {
|
||||
// echo json_encode( array('offline' => TRUE) );
|
||||
// die;
|
||||
// };// if
|
||||
}
|
||||
|
||||
function pdfSVG(){
|
||||
// if (!$this->userid) die;
|
||||
$inputstring = $this->input->post('data');
|
||||
$input = json_decode($inputstring);
|
||||
$inhoud = $input->pagina;
|
||||
$titel = $input->titel;
|
||||
$schoolid = $input->schoolid;
|
||||
$schooljaarnummer = $input->schooljaarnr;
|
||||
$organisatie = $this->Organisaties_model->get(['id' => $schoolid],false, true);
|
||||
$data['inhoud' ]= $inhoud;
|
||||
$html = $this->load->view('monpas/compactsop/sopcompact.php', $data, TRUE);
|
||||
$date = date('dmY');
|
||||
$zoek = [" ", "'", "/"];
|
||||
$schoolid = str_replace($zoek, "",$schoolid);
|
||||
$schoolnaam = str_replace($zoek, "",$organisatie->naamkort);
|
||||
$titel = str_replace($zoek, "",$titel);
|
||||
|
||||
$frameworklogo= $this->config->item('vendor_url').'/images/logos/frameworklogo.png';
|
||||
$logonaam = $this->Schooldetails_model->get(["organisatie_id" =>$schoolid],'logo', true);
|
||||
if (! $logonaam) $logonaam="monpaslogo.png";
|
||||
$schoollogo = $this->config->item('vendor_url').'/images/logos/'.$logonaam;
|
||||
|
||||
$headerdata = ['titel' =>$titel,
|
||||
'schoolnaam' =>$schoolnaam ? $schoolnaam : '',
|
||||
'logoframework' =>$frameworklogo,
|
||||
'logoschool' =>$schoollogo];
|
||||
$footerdata = "";
|
||||
$header = $this->load->view( "monpas/compactsop/compactheader", $headerdata, TRUE ) ;
|
||||
$footer = $this->load->view ("monpas/compactsop/compactfooter", $footerdata, TRUE);
|
||||
$filenaam = $this->compactsoppath.'sop.pdf';
|
||||
|
||||
$bestandsnaam = "compactsop".$schoolnaam.$schoolid.$titel.'-'.$date.'.pdf';
|
||||
$downloadnaam = $this->compactsoppath.$bestandsnaam;
|
||||
|
||||
// TODO check if exists
|
||||
$data = [ 'organisatie_id' =>$schoolid,
|
||||
'schooljaarnummer' => $schooljaarnummer];
|
||||
$csop = $this->Compactsop_model->get($data,false, true);
|
||||
|
||||
if ($csop && $csop->id){
|
||||
unlink($this->compactsoppath.$csop->pdfnaam);
|
||||
$this->Compactsop_model->update_record(['pdfnaam'=>$bestandsnaam], $csop->id);
|
||||
$sopid = $csop->id;
|
||||
} else {
|
||||
$data['pdfnaam'] = $bestandsnaam;
|
||||
$sopid = $this->Compactsop_model->insert_record($data);
|
||||
}
|
||||
$margins = [15, 15,10, 5, 150]; //100 was 45 = headerheight
|
||||
|
||||
$pdf= $this->Phantom_model->create_and_get_pdf($html, $filenaam, $header, TRUE, $margins,'portrait',TRUE,TRUE);
|
||||
file_put_contents($downloadnaam, $pdf);
|
||||
chmod($downloadnaam, 0777);
|
||||
|
||||
header( 'Content-Description: File Transfer' );
|
||||
header( 'Content-Type: application/pdf' );
|
||||
header( 'Content-disposition:inline; filename="' .$bestandsnaam.'"');
|
||||
header( 'Cache-Control: no-cache, must-revalidate, post-check=0, pre-check=0' );
|
||||
header( 'Pragma: public' );
|
||||
header( 'Content-Length: ' . filesize( $downloadnaam ) );
|
||||
readfile($downloadnaam);
|
||||
//
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,753 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class Rapijkpunten extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array( "monpas/Filledversions_model",
|
||||
"monpas/Labels_model",
|
||||
"shared/Autorisatienivos_model",
|
||||
"shared/Users_model",
|
||||
'shared/Organisaties_model',
|
||||
'shared/Orgusers_model',
|
||||
"monpas/Versies_model",
|
||||
"monpas/Orgversies_model",
|
||||
"monpas/Modules_model",
|
||||
"monpas/Ijkpunten_model",
|
||||
"monpas/Indicatoren_model",
|
||||
"monpas/Antwoordtypes_model",
|
||||
"monpas/Wenssituaties_model",
|
||||
"monpas/Scores_model",
|
||||
'shared/Session_model',
|
||||
"monpas/Ambities_model",
|
||||
"Phantom_model");
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
$this->load->library('monpas/kleurcodes');
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
function getorgs(){
|
||||
if (!$this->userid) die;
|
||||
$organisatie = $this->Organisaties_model->getorg($this->globorgid);
|
||||
switch ($organisatie->soort){
|
||||
case 4: $schoolid = $organisatie->id;
|
||||
echo json_encode(array("organisatie"=>$organisatie, "soort"=>4));
|
||||
break;
|
||||
case 3: $bgid = $organisatie->id;
|
||||
$organisatie->scholen=$this->Organisaties_model->getorgsvanaf($bgid);
|
||||
echo json_encode(array("organisatie"=>$organisatie, "soort"=>3));
|
||||
break;
|
||||
case 2: $kamerid = $organisatie->id;
|
||||
$organisatie->bgs = $this->Organisaties_model->getorgsvanaf($kamerid);
|
||||
if ($organisatie->bgs){
|
||||
foreach($organisatie->bgs as $bg){
|
||||
$bg->scholen = $this->Organisaties_model->getorgsvanaf($bg->id);
|
||||
}
|
||||
}
|
||||
echo json_encode(array("organisatie"=>$organisatie, "soort"=>2));
|
||||
break;
|
||||
case 1; $swvid = $organisatie->id;
|
||||
$organisatie->kamers = $this->Organisaties_model->getorgsvanaf($swvid);
|
||||
if ($organisatie->kamers){
|
||||
if(!is_array($organisatie->kamers)){
|
||||
$organisatie->kamers = objectToArray($organisatie->kamers);
|
||||
}
|
||||
foreach($organisatie->kamers as $kamer){
|
||||
$kamer->bgs = $this->Organisaties_model->getorgsvanaf($kamer->id);
|
||||
if ($kamer->bgs){
|
||||
foreach($kamer->bgs as $bg){
|
||||
$bg->scholen =$this->Organisaties_model->getorgsvanaf($bg->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo json_encode(array("organisatie"=>$organisatie, "soort"=>1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function getusernivo(){
|
||||
if (!$this->userid) die;
|
||||
$usernivo = 0;
|
||||
|
||||
$usernivo = $this->Autorisatienivos_model->check_level($this->userrole, SYSTEM);
|
||||
|
||||
if ($usernivo == 0){
|
||||
$usernivo = $this->Autorisatienivos_model->check_level($this->userrole, 252);
|
||||
}
|
||||
else {$usernivo == 1;}
|
||||
echo json_encode($usernivo);
|
||||
}
|
||||
|
||||
function checkLevel(){
|
||||
if (!$this->userid) die;
|
||||
$soort = $this->Organisaties_model->get_fieldvalue(array("id"=>$this->globorgid), 'soort' );
|
||||
$werkter = $this->Orgusers_model->get_fieldvalue(array("user_id"=>$this->userid, "organisatie_id"=>$this->globorgid),"id");
|
||||
$level = 0;
|
||||
|
||||
if ($soort < 4 && $werkter) {
|
||||
$level = 1;
|
||||
}
|
||||
|
||||
echo json_encode($level);
|
||||
}
|
||||
|
||||
function checkLevelInspectie(){
|
||||
if (!$this->userid) die;
|
||||
$soort = $this->Organisaties_model->get_fieldvalue(array("id"=>$this->globorgid), 'soort' );
|
||||
$level123 = false;
|
||||
|
||||
if ($soort > 0 && soort < 4) {
|
||||
$level123 == true;
|
||||
}
|
||||
echo json_encode($level123);
|
||||
}
|
||||
|
||||
function getperiodes2(){
|
||||
if (!$this->userid) die;
|
||||
$targetid = $this->uri->segment(4);
|
||||
$bgid = false;
|
||||
$kamerid = false;
|
||||
$swvid = false;
|
||||
$versies = false;
|
||||
$organisatie= $this->Organisaties_model->getOrganisatie($targetid);
|
||||
$soort = $organisatie->soort;
|
||||
$module = $this->session->userdata('module');
|
||||
if ($soort ==4){
|
||||
// aan bg zijn nu nog geen versie gekoppeld, maar dat zou zo maar kunnen
|
||||
//vandaar dat ie hier al wordt meegenomen
|
||||
$versies = $this->Orgversies_model->getallorgversies($organisatie->valtonder_id, $module);
|
||||
$bgid = $organisatie->valtonder_id;
|
||||
}
|
||||
if ($soort ==3 || ( !$versies && $soort > 3)){
|
||||
if ($organisatie->soort == 3) {$bgid=$targetid;};
|
||||
$organisatie=$this->Organisaties_model->get_record_by_id($bgid);
|
||||
$versies = $this->Orgversies_model->getallorgversies($bgid,$module);
|
||||
$kamerid = $organisatie->valtonder_id;
|
||||
}
|
||||
if ($soort ==2 || (!$versies && $soort > 2)){
|
||||
if ($organisatie->soort == 2) {$kamerid=$targetid;};
|
||||
$versies = $this->Orgversies_model->getallorgversies($kamerid,$module);
|
||||
$organisatie =$this->Organisaties_model->get_record_by_id($kamerid);
|
||||
$swvid = $organisatie->valtonder_id;
|
||||
}
|
||||
if ($soort == 1 || (!$versies && $soort>1)){
|
||||
if ($organisatie->soort == 1) {$swvid=$targetid;};
|
||||
$versies = $this->Orgversies_model->getallorgversies($swvid,$module);
|
||||
}
|
||||
echo json_encode($versies);
|
||||
}
|
||||
|
||||
|
||||
function getperiodes3(){
|
||||
if (!$this->userid) die;
|
||||
$targetid = $this->uri->segment(4);// orgid
|
||||
$module = $this->session->userdata('module');
|
||||
// get de lijst van scholen onder de target
|
||||
$idlijst = $this->Organisaties_model->getscholenondertarget2($targetid);
|
||||
if($idlijst) {
|
||||
$ids = implode(',', $idlijst);
|
||||
|
||||
$versies = $this->Filledversions_model->getversiesperalleorgs($ids, $module);
|
||||
|
||||
|
||||
if($versies) {
|
||||
foreach ($versies as $versie) {
|
||||
$versie->scoreomschrijving = $this->Antwoordtypes_model->gettype($versie->scoretype);
|
||||
}
|
||||
echo json_encode($versies);
|
||||
}
|
||||
else{
|
||||
echo json_encode(false);
|
||||
}
|
||||
}
|
||||
else{
|
||||
echo json_encode(false);
|
||||
}
|
||||
}
|
||||
|
||||
function getVersies(){
|
||||
if (!$this->userid) die;
|
||||
$targetid = $this->uri->segment(4);// orgid
|
||||
$module = $this->session->userdata('module');
|
||||
// get de lijst van scholen onder de target
|
||||
$idlijst = $this->Organisaties_model->getscholenondertarget2($targetid);
|
||||
$ids = implode (',' , $idlijst);
|
||||
if(!$ids){$versies = false;}
|
||||
if(!$module){$versies = false;}
|
||||
if($ids && $module) {
|
||||
$versies = $this->Filledversions_model->getversiesperalleorgs($ids, $module);
|
||||
|
||||
foreach ($versies as $versie) {
|
||||
$versie->scoreomschrijving = $this->Antwoordtypes_model->gettype($versie->scoretype);
|
||||
}
|
||||
}
|
||||
echo json_encode($versies);
|
||||
}
|
||||
|
||||
function getvergelijkbareversies(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->uri->segment(4);
|
||||
|
||||
$module = $this->session->userdata('module');
|
||||
$series = (new VergelijkbareVersies($orgid, $module))->getSeries();
|
||||
|
||||
echo json_encode(['series' =>$series]);
|
||||
}
|
||||
|
||||
function getingevuldelijsten(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->clean_input('orgid');
|
||||
$selecties = $this->input->post('selectie');
|
||||
|
||||
if (!$orgid || !$selecties) return;
|
||||
$aantal = count($selecties);
|
||||
|
||||
|
||||
$users = $this->getUsersSelectie($orgid, $selecties);
|
||||
$lijstenObject = new Lijsten($orgid, $selecties);
|
||||
$lijsten = $lijstenObject->getLijsten();
|
||||
$ijkpunten = $lijstenObject->getIJkpunten();
|
||||
|
||||
$nieuwsteversie = $lijstenObject->getNieuwsteVersie();
|
||||
$kleuren = $lijstenObject->getKleuren();
|
||||
|
||||
$data =[
|
||||
'lijsten' => $lijsten,
|
||||
'aantal' => $aantal,
|
||||
'nieuwsteversie' => $nieuwsteversie,
|
||||
'users' => $users,
|
||||
'ijkpunten' => $ijkpunten,
|
||||
'kleuren' => $kleuren
|
||||
];
|
||||
|
||||
|
||||
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
|
||||
function getUsersSelectie($orgid, $selecties){
|
||||
$aantal = count($selecties);
|
||||
$soort = $this->Organisaties_model->get_fieldvalue(['id'=> $orgid], 'soort');
|
||||
$alleenjezelf = false;
|
||||
$collegas = false;
|
||||
$users = [];
|
||||
|
||||
if($soort == 4) {
|
||||
for($i = 0; $i < $aantal; $i++ ) {
|
||||
if ($selecties[$i]['vorm'] == 2) {
|
||||
$werkter = $this->Orgusers_model->get_fieldvalue(["user_id" => $this->userid, "organisatie_id" => $orgid], "id");
|
||||
if ($werkter) {
|
||||
$nivo = $this->Autorisaties_model->get_fieldvalue(["orguser_id" => $werkter], "nivo_id");
|
||||
if ((int)$nivo == 10) {
|
||||
$alleenjezelf = true;
|
||||
break;
|
||||
|
||||
|
||||
} else {
|
||||
$collegas = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$collegas = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($alleenjezelf) {
|
||||
$orguser = $this->Orgusers_model->get_org_user($werkter);
|
||||
$user = new stdClass();
|
||||
$user->fullname = $orguser->fullname;
|
||||
$user->id = $orguser->id;
|
||||
$users[] = $user;
|
||||
}
|
||||
|
||||
if($collegas == true ) {
|
||||
$leerkrachten = $this->Orgusers_model->get_org_users($orgid);
|
||||
if ($leerkrachten) {
|
||||
foreach ($leerkrachten as $index => $leerkracht) {
|
||||
$users[] = $leerkracht;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($users) > 0) {
|
||||
$gemiddeldeuser = new stdClass();
|
||||
$gemiddeldeuser->fullname = 'Schoolgemiddelde';
|
||||
$gemiddeldeuser->id = '0';
|
||||
array_unshift($users, $gemiddeldeuser);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $users;
|
||||
}
|
||||
|
||||
|
||||
function getuserlijsten(){
|
||||
if (!$this->userid) die;
|
||||
$orguserid = $this->clean_input('orguserid');
|
||||
$orgid = $this->clean_input('orgid');
|
||||
$orgversies = $this->clean_input('selectie');
|
||||
|
||||
if (!$orgid || !$orgversies || !$orguserid) return;
|
||||
|
||||
$aantal = count($orgversies);
|
||||
$userLijsten = new UserLijsten($orguserid, $orgid, $orgversies);
|
||||
$lijsten = $userLijsten->getLijsten();
|
||||
$nieuwsteversie = $userLijsten->getNieuwsteVersie();
|
||||
|
||||
$data =[
|
||||
'lijsten' => $lijsten,
|
||||
'aantal' => $aantal,
|
||||
'nieuwsteversie' => $nieuwsteversie,
|
||||
|
||||
];
|
||||
|
||||
echo json_encode($data);
|
||||
}
|
||||
|
||||
|
||||
function getusers(){
|
||||
if (!$this->userid) die;
|
||||
$beheerder = $this->Autorisaties_model->check_autorisatie($this->userrole, WRITER);
|
||||
|
||||
$orgid = $this->clean_input('orgid');
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($orgid);
|
||||
$orgversieid = $this->clean_input("orgversie");
|
||||
$orgversie = $this->Orgversies_model->get_record_by_id($orgversieid);
|
||||
$users = array();
|
||||
if ($orgversie && $orgversie->vorm==2 && $organisatie->soort == 4){
|
||||
if ($beheerder > 0) { $users= $this->Orgusers_model->get_org_users($orgid, TRUE);}
|
||||
else {$users = $this->Orgusers_model->get_user($this->userid, $orgid); }
|
||||
}
|
||||
|
||||
echo json_encode($users);
|
||||
}
|
||||
|
||||
function getscoreSWV_Kamer($orgid,$orgversieid){
|
||||
if (!$this->userid) die;
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($orgid);
|
||||
// de scores moeten vergeleken worden met het gemiddelde voor de kamer
|
||||
// of het swv als je op swv niveau zit
|
||||
if ($organisatie->soort == 1) {$targetid = $orgid; }
|
||||
|
||||
else {$targetid = $this->Organisaties_model->getkamer($orgid);}
|
||||
$targetnaam = $this->Organisaties_model->get_fieldvalue(array('id'=>$targetid),'naamkort');
|
||||
// haal alle organisatie onder de target op als string
|
||||
$orgstring = implode(',' , $this->Organisaties_model->getscholenondertarget($targetid));
|
||||
$scoresToplevel = $this->Scores_model->calculateOverScholen($orgversieid, $orgstring);
|
||||
return array("scoresToplevel"=>$scoresToplevel,
|
||||
"targetid" => $targetid,
|
||||
"targetnaam"=>$targetnaam);
|
||||
}
|
||||
|
||||
function getscores(){
|
||||
if (!$this->userid) die;
|
||||
$orgversieid = $this->clean_input("orgversieid");
|
||||
$orgid = $this->clean_input("orgid");
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($orgid);
|
||||
$scores = $this->Ijkpunten_model->getscores($orgversieid, $orgid);
|
||||
$returnarray = $this->getscoreSWV_Kamer($orgid,$orgversieid);
|
||||
|
||||
$scoresToplevel = $returnarray['scoresToplevel'];
|
||||
$targetnaam = $returnarray['targetnaam'];
|
||||
|
||||
if ($scores){
|
||||
$i =0;
|
||||
foreach($scores as $score){
|
||||
if ($scoresToplevel[$i]->num > 0) {
|
||||
$score->toplevelgem =round( ($scoresToplevel[$i]->somscore / $scoresToplevel[$i]->num) * 10) / 10;
|
||||
}
|
||||
else {$score->toplevelgem = null;};
|
||||
$score->toplevelscholen = $scoresToplevel[$i]->aantalscholen;
|
||||
$score->gem = 0;
|
||||
if ($score->num > 0) $score->gem =round( $score->somscore / $score->num,1) ;
|
||||
$score->kleur = $this->kleurcodes->getkleur($score->gem);
|
||||
$score->kleurtop = $this->kleurcodes->getkleur($score->toplevelgem);
|
||||
$score->gem = number_format($score->gem,1,',','.');
|
||||
$score->toplevelgem = number_format($score->toplevelgem, 1,',','.');
|
||||
$i ++;
|
||||
}
|
||||
}
|
||||
// haal ook nog de criteria van de organisatie op
|
||||
$ambitie = $this->Ambities_model->getOrgAmbities($orgversieid, $orgid);
|
||||
$kleurtabel = $this->kleurcodes->getkleurlegenda();
|
||||
echo json_encode(array('kleurtabel' =>$kleurtabel,
|
||||
'scores' =>$scores,
|
||||
'ambitie' =>$ambitie,
|
||||
'scoresToplevel' =>$scoresToplevel,
|
||||
'toplevelnaam' =>$targetnaam));
|
||||
}
|
||||
|
||||
|
||||
function scoresindividueel(){
|
||||
if (!$this->userid) die;
|
||||
|
||||
$orgversieid = $this->clean_input("orgversie");
|
||||
$orgid = $this->clean_input("orgid");
|
||||
$orguserid = $this->clean_input("orguserid");
|
||||
$userid = $this->Orgusers_model->get_fieldvalue(array('id'=>$orguserid), "user_id");
|
||||
$this->VerzamelScores($userid, $orgversieid, $orgid);
|
||||
}
|
||||
|
||||
function orgscores()
|
||||
{
|
||||
if (!$this->userid) die;
|
||||
$orgversieid = $this->clean_input("orgversieid");
|
||||
$orgid = $this->clean_input("orgid");
|
||||
$userid = null;
|
||||
$this->VerzamelScores($userid, $orgversieid, $orgid);
|
||||
}
|
||||
|
||||
function pdfijkpuntenbar(){
|
||||
//TODO clean input
|
||||
if (!$this->userid) die;
|
||||
$inputstring = $this->input->post('data');
|
||||
$input = json_decode($inputstring);
|
||||
$image = $input->image;
|
||||
$orgid = $input->orgid;
|
||||
$organisatie = $this->Organisaties_model->getorg($orgid);
|
||||
$info = $input->orgversie;
|
||||
$periode = $this->Orgversies_model->get_record_by_id($input->periode);
|
||||
$geldigvanaf = mysql2date($periode->geldigvanaf);
|
||||
$geldigSelect = mysql2date($periode->geldigtm);
|
||||
$naam = "periode ".$periode->periodenummer;
|
||||
$resultaat = $input->resultaat;
|
||||
$today = date("d-m-Y");
|
||||
|
||||
if($input->resultaatRef != null) {
|
||||
$resultaatRef = $input->resultaatRef;
|
||||
$periodeRef = $this->Orgversies_model->get_record_by_id($input->periodeRef);
|
||||
$geldigvanafR = mysql2date($periodeRef->geldigvanaf);
|
||||
$geldigRef = mysql2date($periodeRef->geldigtm);
|
||||
$naamR = "periode" . $periodeRef->periodenummer;
|
||||
}
|
||||
$instrument = $this->Modules_model->get_fieldvalue(array("sysnr" =>$this->module), "naam") ;
|
||||
$labels = $this->Labels_model->getalllabels();
|
||||
$kleurtabel = $this->kleurcodes->getkleurlegenda();
|
||||
|
||||
if($input->resultaatRef != null) {
|
||||
$data = array(
|
||||
"instrument" => $instrument,
|
||||
"referentie" => $input->referentie,
|
||||
"toonVergelijking" => $input->toonVergelijking,
|
||||
"organisatie" => $organisatie,
|
||||
"docentnaam" => $input->docentnaam,
|
||||
"inputimage" => $image,
|
||||
"periodenaam" => $geldigvanaf . ' t/m ' . $geldigSelect,
|
||||
"periodenaamR" => $geldigvanafR . ' t/m ' . $geldigRef,
|
||||
"geldigRef" => $geldigRef,
|
||||
"geldigSelect" => $geldigSelect,
|
||||
"vandaag" => $today,
|
||||
"resultaat" => $resultaat,
|
||||
"resultaatRef" => $resultaatRef,
|
||||
"welkehoogsteR" => $resultaatRef->welkehoogste,
|
||||
"welkehoogste" => $resultaat->welkehoogste,
|
||||
"geldigSelect" => $geldigSelect,
|
||||
"geldigRef" => $geldigRef,
|
||||
"ambitie" => $input->ambitie,
|
||||
"ijkpunten" => $input->ijkpunten,
|
||||
"toplevelnaam" => $input->toplevelnaam,
|
||||
"labels" => $labels,
|
||||
"info" =>$info,
|
||||
"kleurtabel" => $kleurtabel);
|
||||
}
|
||||
else{
|
||||
$data = array(
|
||||
"instrument" => $instrument,
|
||||
"referentie" => $input->referentie,
|
||||
"toonVergelijking" => $input->toonVergelijking,
|
||||
"organisatie" => $organisatie,
|
||||
"docentnaam" => $input->docentnaam,
|
||||
"inputimage" => $image,
|
||||
"periodenaam" => $geldigvanaf . ' t/m ' . $geldigSelect,
|
||||
"geldigSelect" => $geldigSelect,
|
||||
"vandaag" => $today,
|
||||
"resultaat" => $resultaat,
|
||||
"welkehoogste" => $resultaat->welkehoogste,
|
||||
"geldigSelect" => $geldigSelect,
|
||||
"ambitie" => $input->ambitie,
|
||||
"ijkpunten" => $input->ijkpunten,
|
||||
"toplevelnaam" => $input->toplevelnaam,
|
||||
"labels" => $labels,
|
||||
"info" =>$info,
|
||||
"kleurtabel" => $kleurtabel);
|
||||
}
|
||||
$html = $this->load->view("monpas/reports/ijkpuntenbar", $data, true);
|
||||
$filenaam="ijkpunten";
|
||||
$this->Phantom_model->create_pdf($html, $filenaam, FALSE, FALSE, FALSE);
|
||||
}
|
||||
|
||||
|
||||
function maakijkpuntenpdf(){
|
||||
//TODO clean input
|
||||
if (!$this->userid) die;
|
||||
$inputstring = $this->input->post('data');
|
||||
$input = json_decode($inputstring);
|
||||
$orgid = $input->orgid;
|
||||
$image = $input->image;
|
||||
$versie = $input->versie;
|
||||
$scorekleuren = $input->scorekleuren;
|
||||
$organisatie = $this->Organisaties_model->getorg($orgid);
|
||||
$orgversie = $this->Orgversies_model->get_record_by_id($input->nieuwsteversie);
|
||||
$geldigvanaf = mysql2date($orgversie->geldigvanaf);
|
||||
$geldigSelect = mysql2date($orgversie->geldigtm);
|
||||
$today = date("d-m-Y");
|
||||
$instrument = $this->Modules_model->get_fieldvalue(array("sysnr" =>$this->module), "naam") ;
|
||||
$aantal = count($input->lijsten);
|
||||
$orientatie = 'landscape';
|
||||
// if($aantal > 2){
|
||||
// $orientatie = 'landscape';
|
||||
// }
|
||||
$htmlimage = '<img src="'. $image . '"/>';
|
||||
|
||||
|
||||
$data = array(
|
||||
"instrument" => $instrument,
|
||||
"lijsten" => $input->lijsten,
|
||||
"organisatie" => $organisatie,
|
||||
"orgversie" => $orgversie,
|
||||
"docentnaam" => $input->docentnaam,
|
||||
"inputimage" => $image,
|
||||
"versie" => $versie,
|
||||
"nieuwsteversie" => $input->nieuwsteversie,
|
||||
"geldigSelect" => $geldigSelect,
|
||||
"scorekleuren" => $scorekleuren,
|
||||
"vandaag" => $today,
|
||||
"aantal" => $aantal,
|
||||
);
|
||||
|
||||
$html = $this->load->view("monpas/reports/ijkpuntenbar", $data, true);
|
||||
$filenaam="ijkpunten";
|
||||
|
||||
$this->Phantom_model->create_pdf($html, $filenaam, FALSE, FALSE, FALSE, $orientatie);
|
||||
}
|
||||
|
||||
|
||||
private function verzamelScores($userid, $orgversieid, $orgid ){
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($orgid);
|
||||
$returnarray = $this->getscoreSWV_Kamer($orgid, $orgversieid);
|
||||
$scoresToplevel = $returnarray['scoresToplevel'];//gemiddelde scores van SWV (als t een swv is)of kamer(alle andere gevallen)
|
||||
$targetnaam = $returnarray['targetnaam'];
|
||||
$targetid = $returnarray['targetid'];
|
||||
$vergelijkbaar = $this->getReferentieVersie($userid, $orgversieid, $orgid, $organisatie); //versies die getoond kunnen worden: 1 of 2
|
||||
|
||||
if ($vergelijkbaar) {
|
||||
$vergelijkbaar = $this->voegsScoresToe($userid, $orgid, $vergelijkbaar);// hoe is gescored op de ijkpunten
|
||||
// $versieSelect = $this->checkBestaanSelectie($userid, $vergelijkbaar, $organisatie);// als de geselecteerde versie al wel betaat uitgesterd per 27 juni 2017 zie functie
|
||||
// //maar nog herlemaal niet is ingevuld, wordt de refetentieversie ook niet getoond
|
||||
// if ($versieSelect) {
|
||||
$versieSelect = $this->getScoresMetVergelijking($vergelijkbaar[0], $scoresToplevel);// maak scores kamer (of swv) klaar voor grafiek
|
||||
$versieSelect = $this->telMetingen($userid, $orgid, $targetid, $orgversieid, $organisatie, $versieSelect); // aantal ingevulde exemplaren: individueel en bij topllevel
|
||||
$versies = array($versieSelect);
|
||||
|
||||
if (sizeof($vergelijkbaar) > 1) { // alles tzelfe voor de referentieversie
|
||||
|
||||
$vorigVersieId = $vergelijkbaar[1]->id;
|
||||
$returnarrayR = $this->getscoreSWV_Kamer($orgid, $vorigVersieId);
|
||||
$scoresToplevelR = $returnarrayR['scoresToplevel'];
|
||||
$versieRef = $this->getScoresMetVergelijking($vergelijkbaar[1], $scoresToplevelR);
|
||||
$versieRef = $this->telMetingen($userid, $orgid, $targetid, $vorigVersieId, $organisatie, $versieRef); // aantal ingevulde exemplaren: individueel en bij topllevel
|
||||
array_push($versies, $versieRef);
|
||||
} else {
|
||||
$scoresToplevelR = null;
|
||||
}
|
||||
|
||||
// haal ook nog de criteria van de organisatie op
|
||||
$ambitie = $this->Ambities_model->getOrgAmbities($orgversieid, $orgid);
|
||||
$kleurtabel = $this->kleurcodes->getkleurlegenda();
|
||||
|
||||
|
||||
echo json_encode(array('kleurtabel' => $kleurtabel,
|
||||
'versies' => $versies,
|
||||
'ambitie' => $ambitie,
|
||||
'scoresToplevel' => $scoresToplevel,
|
||||
'scoresTopLevelR' => $scoresToplevelR,
|
||||
'toplevelnaam' => $targetnaam));
|
||||
// }
|
||||
// else {
|
||||
// echo json_encode(false);
|
||||
// }
|
||||
}
|
||||
else {
|
||||
echo json_encode(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function getScoresMetVergelijking($versie, $scores){
|
||||
if($versie && $versie->scores && $scores) {
|
||||
$i = 0;
|
||||
$scorearray = $versie->scores;
|
||||
$lengte = sizeof($scorearray);
|
||||
for ($x = 0; $x < $lengte; $x++) {
|
||||
if ($scores[$i]->num > 0 && isset($scores[$i]) ) {
|
||||
$scorearray[$x]->toplevelgem = round(($scores[$i]->somscore / $scores[$i]->num) * 10) / 10;
|
||||
} else {
|
||||
$scorearray[$x]->toplevelgem = null;
|
||||
};
|
||||
|
||||
$scorearray[$x]->toplevelscholen = $scores[$i]->aantalscholen;
|
||||
$scorearray[$x]->gem = 0;
|
||||
if ($scorearray[$x]->num > 0) $scorearray[$x]->gem = round($scorearray[$x]->somscore / $scorearray[$x]->num, 1);
|
||||
$scorearray[$x]->kleur = $this->kleurcodes->getkleur($scorearray[$x]->gem);
|
||||
$scorearray[$x]->kleurtop = $this->kleurcodes->getkleur($scorearray[$x]->toplevelgem);
|
||||
$scorearray[$x]->gem = number_format($scorearray[$x]->gem, 1, ',', '.');
|
||||
$scorearray[$x]->toplevelgem = number_format($scorearray[$x]->toplevelgem, 1, ',', '.');
|
||||
$i++;
|
||||
}
|
||||
$versie->scores= $scorearray;
|
||||
|
||||
return $versie;
|
||||
}
|
||||
}
|
||||
|
||||
private function getReferentieVersie($userid, $orgversieid, $orgid, $organisatie)
|
||||
{
|
||||
|
||||
if($userid == null) {
|
||||
|
||||
if ($organisatie->soort == '4') {
|
||||
|
||||
$vorm = $this->Orgversies_model->getVorm($orgversieid);
|
||||
// $vorm = $this->Orgversies_model->get([$orgversieid->id], 'vorm', TRUE);
|
||||
|
||||
if($vorm == '2'){
|
||||
$versies = $this->Filledversions_model->getVergelijkbareVersiesSchoolGemiddelde($orgversieid, $orgid); //individueel ingevuld. ander orgversie id = andere versie
|
||||
|
||||
}
|
||||
if ($vorm == '1') {
|
||||
$versies = $this->Filledversions_model->getVergelijkbareVersies4($orgversieid, $orgid);
|
||||
}
|
||||
}
|
||||
|
||||
if ($organisatie->soort == '3') {
|
||||
$versies = $this->Filledversions_model->getVergelijkbareVersies3($orgversieid, $orgid);
|
||||
}
|
||||
if ($organisatie->soort == '2') {
|
||||
$versies = $this->Filledversions_model->getVergelijkbareVersies2($orgversieid, $orgid);
|
||||
|
||||
}
|
||||
if ($organisatie->soort == '1') {
|
||||
$versies = $this->Filledversions_model->getVergelijkbareVersies1($orgversieid, $orgid);
|
||||
}
|
||||
}
|
||||
else{
|
||||
$versies= $this->Filledversions_model->getVergelijkbareVersiesInd($orgversieid, $orgid, $userid);
|
||||
}
|
||||
|
||||
return $versies;
|
||||
}
|
||||
|
||||
private function telMetingen($userid, $orgid, $kamerid, $orgversieid, $organisatie, $versie)
|
||||
{
|
||||
|
||||
if (!$versie) return false;
|
||||
if($userid ) {// individuele scores
|
||||
$versie->metingen = "1";
|
||||
$versie->metingenTop = $this->Filledversions_model->telVergelijkbareVersies2($orgversieid, $kamerid);
|
||||
$versie->orgsoort = "4";
|
||||
}
|
||||
else{
|
||||
|
||||
|
||||
if ($organisatie->soort == '4') {//teamlijst
|
||||
if($versie->vorm == '1') {
|
||||
$versie->metingen = "1";
|
||||
}
|
||||
if($versie->vorm == '2') {
|
||||
$versie->metingen = $this->Filledversions_model->telVergelijkbareVersies4Ind($orgversieid, $orgid);//indiviudele lijst als schoolgemiddelde
|
||||
}
|
||||
$versie->metingenTop = $this->Filledversions_model->telVergelijkbareVersies2($orgversieid, $kamerid);
|
||||
$versie->orgsoort = "4";
|
||||
}
|
||||
if ($organisatie->soort == '3') {
|
||||
$versie->metingen = $this->Filledversions_model->telVergelijkbareVersies3($orgversieid, $orgid);//bestuur
|
||||
$versie->metingenTop = $this->Filledversions_model->telVergelijkbareVersies2($orgversieid, $kamerid);
|
||||
$versie->orgsoort = "3";
|
||||
}
|
||||
if ($organisatie->soort == '2') {//kamer
|
||||
$versie->metingen = $this->Filledversions_model->telVergelijkbareVersies2($orgversieid, $orgid);
|
||||
$versie->metingenTop = $versie->metingen;
|
||||
$versie->orgsoort = "2";
|
||||
|
||||
}
|
||||
if ($organisatie->soort == '1') {//swv
|
||||
$versie->metingen = $this->Filledversions_model->telVergelijkbareVersies1($orgversieid, $orgid);
|
||||
$versie->metingenTop = $versie->metingen;
|
||||
$versie->orgsoort = "1";
|
||||
}
|
||||
}
|
||||
return $versie;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $userid
|
||||
* @param $orgid
|
||||
* @param $versies
|
||||
* @return mixed
|
||||
*/
|
||||
private function voegsScoresToe($userid, $orgid, $versies){
|
||||
|
||||
if ($userid == null) {
|
||||
foreach ($versies as $versie) {
|
||||
$versie->scores = $this->Ijkpunten_model->getscores($versie->id, $orgid);//teamscores
|
||||
}
|
||||
}
|
||||
else{
|
||||
foreach ($versies as $versie) {
|
||||
$versie->scores = $this->Scores_model->calculateindividualscores($versie->id, $orgid, $userid);//individuele scores
|
||||
}
|
||||
|
||||
}
|
||||
return $versies;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* uitgesterd per 27 juni 2017 omdat niet ingevulde lijsten toch ook getoond moeten worden oa vanwege de juiste weergave van het gemiddelde
|
||||
24 okt in plaats hiervan subquery gemaakt
|
||||
*/
|
||||
// private function checkBestaanSelectie($userid, $versies, $organisatie){
|
||||
// // als geen enkele vraag van de gekozen lijst is ingevuld, wordt de referentie ook niet getoond.
|
||||
// $ietsingevuld = false;
|
||||
// if($versies && $versies[0]){
|
||||
// if($organisatie->soort == '4' || $userid != null){//scores van leerkrachten of op teamniveau
|
||||
// foreach($versies[0]->scores as $selectie){
|
||||
//
|
||||
// if($selectie->score != '0.0' || $selectie->somscore != '0.0'){
|
||||
// $ietsingevuld = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// foreach($versies[0]->scores as $selectie){
|
||||
//
|
||||
// if($selectie->somscore != '0.0'){//gemiddelde scores van besturen, kamers of swvs
|
||||
// $ietsingevuld = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if ($ietsingevuld == false){
|
||||
// $versies = null;
|
||||
// }
|
||||
//
|
||||
// return $versies;
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,288 @@
|
||||
<?php if ( ! defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' );
|
||||
|
||||
class Rapontwikkel extends MY_Controller {
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$models = [
|
||||
"shared/Users_model",
|
||||
"monpas/Ijkpunten_model",
|
||||
"shared/Organisaties_model",
|
||||
"monpas/Modules_model",
|
||||
"monpas/Scores_model",
|
||||
"monpas/Wenssituaties_model",
|
||||
"Phantom_model",
|
||||
"shared/Orgusers_model",
|
||||
"monpas/Orgversies_model"];
|
||||
$this->load->model( $models );
|
||||
$this->load->helper( 'string' );
|
||||
$this->load->library( 'monpas/kleurcodes' );
|
||||
if ( ! $this->check_online_status() )
|
||||
{
|
||||
echo json_encode( ['offline' => TRUE] );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
function savegewenst()
|
||||
{
|
||||
//TODO clean input
|
||||
if ( ! $this->userid ) die;
|
||||
$orgid = $this->clean_input( "orgid" );
|
||||
$orgversieid = $this->clean_input( "orgversionid" );
|
||||
$orguserid = $this->clean_input( "orguserid" );
|
||||
|
||||
if ( $orguserid == 0 )
|
||||
{
|
||||
$orguserid = NULL;
|
||||
}
|
||||
$wensarray = $this->clean_input( "wensarray" );
|
||||
$wensids[] = ""; // array van ids om terug te geven
|
||||
if ( $wensarray )
|
||||
{
|
||||
foreach ( $wensarray as $wens )
|
||||
{
|
||||
|
||||
if ( $wens['wensid'] > 0 )
|
||||
{
|
||||
$data = ["wens" => $wens['gewenst']];
|
||||
$this->Wenssituaties_model->update_record( $data, $wens['wensid'] );
|
||||
$wensids[] = $wens['wensid'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$data = [
|
||||
"organisatie_id" => $orgid,
|
||||
"orgversie_id" => $orgversieid,
|
||||
"orguser_id" => $orguserid,
|
||||
"ijkpunt_id" => $wens['ijkpuntid'],
|
||||
"wens" => $wens['gewenst']];
|
||||
$wensids[] = $this->Wenssituaties_model->insert_record( $data );
|
||||
}
|
||||
}; // foreach
|
||||
echo json_encode( $wensids );
|
||||
}
|
||||
} // save gewenst
|
||||
|
||||
function getscores()
|
||||
{
|
||||
if ( ! $this->userid ) die;
|
||||
// deze functie wijkt af van getscores in rapijkpunten omdat ook gewenst moet
|
||||
// worden opgehaald, en geen ambities
|
||||
|
||||
$orgversieid = $this->clean_input( "orgversieid" );
|
||||
$orgid = $this->clean_input( "orgid" );
|
||||
$organisatie = $this->Organisaties_model->getorg( $orgid );
|
||||
$scores = NULL;
|
||||
$gewenst = NULL;
|
||||
$orgversie = $this->Orgversies_model->get_record_by_id($orgversieid);
|
||||
if($orgversie->scoretype == 7){
|
||||
$grens1 = 33;
|
||||
$grens2 = 66;
|
||||
$grens3 = 100;
|
||||
}
|
||||
// als de organisatie een school is : haal de gemiddelde score op (als de 'ik-versie" wordt gebruikt
|
||||
// let op als ik-versie dan moeten de gegevens van de users worden opgehaald maar
|
||||
// dat gaat vanzelf omdat gezocht wordt naar organisatie (via filled versions);
|
||||
// let op ja nee bezig wordt vertaald naar 10, 0 en 5
|
||||
|
||||
if ( ! $organisatie )
|
||||
{
|
||||
echo json_encode( ['scores' => FALSE] );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $organisatie->soort == 1 || $organisatie->soort == 2 || $organisatie->soort == 3 )
|
||||
{
|
||||
$schoolids = $this->Organisaties_model->getscholenondertarget( $organisatie->id );
|
||||
|
||||
if ( $schoolids )
|
||||
{
|
||||
$lijst = implode( ',', $schoolids );
|
||||
$scores = $this->Scores_model->calculateOverScholenNieuw( $orgversieid, $lijst );
|
||||
}
|
||||
}
|
||||
if ( $organisatie->soort == 4 )
|
||||
{
|
||||
// $scores = $this->Scores_model->calculateschool( $orgversieid, $orgid );
|
||||
$scores = $this->Scores_model->getgemscores( $orgversieid, $orgid );
|
||||
//
|
||||
}
|
||||
if ( $scores )
|
||||
{
|
||||
$gewenst = $this->Wenssituaties_model->getgewenst( $orgversieid, $orgid );
|
||||
}
|
||||
// haal ook nog de criteria van de organisatie op
|
||||
if ( $scores )
|
||||
{
|
||||
foreach ( $scores as $score )
|
||||
{
|
||||
if(! isset($score->gem)) $score->gem = 0;
|
||||
// if ( $score->num > 0 )
|
||||
// {
|
||||
// $score->gem = round( $score->somscore / $score->num, 1 );
|
||||
// }
|
||||
$score->huidig = $this->kleurcodes->getnummer( $score->gem );
|
||||
if($orgversie->scoretype == 7){
|
||||
if($score->gem == $grens3) $score->huidig = 4;
|
||||
if($score->gem < $grens3) $score->huidig = 3;
|
||||
if($score->gem <= $grens2) $score->huidig = 2;
|
||||
if($score->gem <= $grens1) $score->huidig = 1;
|
||||
}
|
||||
|
||||
};
|
||||
if ( $gewenst )
|
||||
{
|
||||
$i = 0;
|
||||
foreach ( $scores as $score )
|
||||
{
|
||||
$score->gewenstid = $gewenst[ $i ]->id;
|
||||
$score->gewenst = $gewenst[ $i ]->wens;
|
||||
$i = $i + 1;
|
||||
}; //foreach
|
||||
}
|
||||
}
|
||||
echo json_encode( ['scores' => $scores] );
|
||||
} // getscores
|
||||
|
||||
function checkSchrijfrechtenOrg()
|
||||
{
|
||||
if ( ! $this->userid ) die;
|
||||
$orgid = $this->clean_input( 'orgid' );
|
||||
$orgsoort = $this->clean_input( 'orgsoort' );
|
||||
|
||||
|
||||
$werktEr = $this->Orgusers_model->check_for_record( ["user_id" => $this->userid, "organisatie_id" => $orgid] );
|
||||
$rechten = FALSE;
|
||||
if($this->super){
|
||||
$rechten = TRUE;
|
||||
}
|
||||
|
||||
if ($werktEr)
|
||||
{
|
||||
if ( pow( 4, $orgsoort ) == $this->userrole)
|
||||
{
|
||||
$rechten = TRUE;
|
||||
}
|
||||
if($orgsoort == 1 || $orgsoort ==2 || $orgsoort == 3){
|
||||
$rechten = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode( $rechten );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function scoresindividueel()
|
||||
{
|
||||
if ( ! $this->userid ) die;
|
||||
// deze functie wijkt af van getscores in rapijkpunten omdat ook gewenst moet
|
||||
// worden opgehaald, en geen ambities
|
||||
|
||||
$orgversieid = $this->clean_input( "orgversie" );
|
||||
$orgid = $this->clean_input( "orgid" );
|
||||
$orguserid = $this->clean_input( "orguserid" );
|
||||
$userid = $this->Orgusers_model->get_fieldvalue( ["id" => $orguserid], "user_id" );
|
||||
$organisatie = $this->Organisaties_model->getorg( $orgid );
|
||||
$scores = NULL;
|
||||
$gewenst = NULL;
|
||||
// als de organisatie een school is : haal de gemiddelde score op (als de 'ik-versie" wordt gebruikt
|
||||
// let op als ik-versie dan moeten de gegevens van de users worden opgehaald maar
|
||||
// dat gaat vanzelf omdat gezocht wordt naar organisatie (via filled versions);
|
||||
// let op ja nee bezig wordt vertaald naar 10, 0 en 5
|
||||
|
||||
$scores = $this->Scores_model->calculateindividualscores( $orgversieid, $orgid, $userid );
|
||||
// haal ook nog de criteria op
|
||||
if ( ! $scores ) $scores = FALSE;
|
||||
|
||||
// $genoeg = $this->telScoresSchool( $scores );
|
||||
// if ( ! $genoeg ) return;
|
||||
|
||||
foreach ( $scores as $score )
|
||||
{
|
||||
|
||||
$score->gem = 0;
|
||||
if ( $score->num > 0 )
|
||||
{
|
||||
$score->gem = round( $score->somscore / $score->num, 1 );
|
||||
}
|
||||
$score->huidig = $this->kleurcodes->getnummer( $score->gem );
|
||||
}; // foreach scores
|
||||
$gewenst = $this->Scores_model->getgewenstindividueel( $orgid, $orgversieid, $orguserid );
|
||||
|
||||
if ( $gewenst )
|
||||
{
|
||||
$i = 0;
|
||||
foreach ( $scores as $score )
|
||||
{
|
||||
$score->gewenstid = $gewenst[ $i ]->id;
|
||||
$score->gewenst = $gewenst[ $i ]->wens;
|
||||
$i = $i + 1;
|
||||
}; //foreach
|
||||
}
|
||||
|
||||
echo json_encode( ['scores' => $scores] );
|
||||
} // getscores
|
||||
|
||||
function checkindividueelschrijfrecht()
|
||||
{
|
||||
if ( ! $this->userid ) die;
|
||||
$orguserid = $this->uri->segment( 4 );
|
||||
$userid = $this->Orgusers_model->get_fieldvalue( ["id" => $orguserid], "user_id" );
|
||||
|
||||
if ( $userid == $this->userid )
|
||||
{
|
||||
echo json_encode( TRUE );
|
||||
}
|
||||
else
|
||||
{
|
||||
echo json_encode( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function printontwikkelmatrix()
|
||||
{
|
||||
if ( ! $this->userid ) die;
|
||||
$inputstring = $this->input->get( 'json' );
|
||||
$input = json_decode( $inputstring );
|
||||
$today = date( "d-m-Y" );
|
||||
$organisatie = $this->Organisaties_model->getorg( $input->orgid );
|
||||
|
||||
$periode = $this->Orgversies_model->get_record_by_id( $input->orgversieid );
|
||||
$geldigvanaf= mysql2date( $periode->geldigvanaf );
|
||||
$geldigtm = mysql2date( $periode->geldigtm );
|
||||
$naam = $geldigvanaf . ' t/m ' . $geldigtm;
|
||||
|
||||
$resultaten = $input->resultaten;
|
||||
|
||||
if ( $resultaten ){
|
||||
foreach ( $resultaten as $resultaat )
|
||||
{
|
||||
$resultaat->ijkpunt = $this->Ijkpunten_model->get_fieldvalue( ["id" => $resultaat->ijkpuntid], "omschrijving" );
|
||||
}
|
||||
}
|
||||
|
||||
$instrument = $this->Modules_model->get_fieldvalue( ["sysnr" => $this->module], "naam" );
|
||||
$labels = $this->Labels_model->getalllabels();
|
||||
$kleurtabel = $this->kleurcodes->getkleurlegenda();
|
||||
$data = [
|
||||
"instrument" => $instrument,
|
||||
"organisatie" => $organisatie,
|
||||
"periodenaam" => $naam,
|
||||
"vandaag" => $today,
|
||||
"resultaten" => $resultaten,
|
||||
"labels" => $labels,
|
||||
"info" => $input->orgversie,
|
||||
"docentnaam" => $input->user,
|
||||
"kleurtabel" => $kleurtabel];
|
||||
// var_dump($data);
|
||||
// exit;
|
||||
$html = $this->load->view( "monpas/reports/ontwikkelmatrix", $data, TRUE );
|
||||
$filenaam = "ontwikkelmatrix";
|
||||
$this->Phantom_model->create_pdf( $html, $filenaam, FALSE, FALSE, FALSE );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Schoolgegevens extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array( "shared/Users_model",
|
||||
'shared/Organisaties_model',
|
||||
'monpas/Schooldetails_model',
|
||||
'monpas/Groepen_model',
|
||||
'monpas/Groepenxusers_model',
|
||||
"shared/Orgusers_model",
|
||||
"shared/Autorisaties_model");
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
function getschool(){
|
||||
if (!$this->userid) die;
|
||||
$schoolid = $this->uri->segment(4);
|
||||
|
||||
$org = $this->Organisaties_model->getorg($schoolid);
|
||||
$bgbrin = $this->Organisaties_model->get_fieldvalue (array("id"=> $org->valtonder_id), 'brin');
|
||||
$org->bgbrin=$bgbrin;
|
||||
$details = $this->Schooldetails_model->get_details($schoolid);
|
||||
|
||||
echo json_encode(array('org'=>$org, 'details'=>$details));
|
||||
}
|
||||
function updatedetails(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->clean_input("orgid");
|
||||
$this->Organisaties_model->update_record(array('naam'=>$this->input->post("naam")), $orgid);
|
||||
$detailsid = $this->input->post("detailsid");
|
||||
$data=array("straat" => $this->input->post("straat"),
|
||||
"plaats" => $this->input->post("plaats"),
|
||||
'telefoon' => $this->input->post("telefoon"),
|
||||
'email1' => $this->input->post("email1"),
|
||||
"web" => $this->input->post("web"),
|
||||
"directie" => $this->input->post("directie"),
|
||||
"ib" => $this->input->post("ib"),
|
||||
"email2" => $this->input->post("email2") );
|
||||
//update or insert
|
||||
|
||||
|
||||
if ($detailsid <= 0){
|
||||
$data["organisatie_id"]=$orgid;
|
||||
$detailsid = $this->Schooldetails_model->insert_record($data);
|
||||
}
|
||||
else {
|
||||
$this->Schooldetails_model->update_record($data, $detailsid);
|
||||
}
|
||||
echo json_encode($detailsid);
|
||||
}
|
||||
|
||||
function updateinsertLK(){
|
||||
if (!$this->userid) die;
|
||||
$userid = $this->clean_input("id");
|
||||
$orgid = $this->clean_input("orgid");
|
||||
|
||||
$data = array("aanhef" => $this->clean_input("aanhef"),
|
||||
"voornaam" => $this->clean_input("voornaam"),
|
||||
"tussenvoegsel" => $this->clean_input("tussenvoegsel"),
|
||||
"achternaam" => $this->clean_input("achternaam"),
|
||||
"email" => $this->clean_input("email") );
|
||||
if ($userid <=0){
|
||||
|
||||
$userid=$this->Users_model->insert_record($data);
|
||||
$data=array("user_id" => $userid,
|
||||
"organisatie_id" => $orgid);
|
||||
$orguserid = $this->Orgusers_model->insert_record($data);
|
||||
$data=array("nivo_id" =>10,
|
||||
"orguser_id" => $orguserid);
|
||||
$this->Autorisaties_model->insert_record($data);
|
||||
}
|
||||
else{
|
||||
$this->Users_model->update_record($data, $userid);
|
||||
}
|
||||
$lk= $this->Users_model->getleerkracht($userid);
|
||||
echo json_encode($lk);
|
||||
}
|
||||
function getleerkrachten(){
|
||||
if (!$this->userid) die;
|
||||
$schoolid = $this->uri->segment(4);
|
||||
$lk = $this->Users_model->getleerkrachten($schoolid);
|
||||
echo json_encode($lk);
|
||||
}
|
||||
function deleteleerkracht(){
|
||||
if (!$this->userid) die;
|
||||
$userid = $this->input->post("userid");
|
||||
$schoolid = $this->input->post("schoolid");
|
||||
|
||||
$errorstring = "";
|
||||
|
||||
if (!$this->writer) return;
|
||||
|
||||
// lk is gekoppeld aan groep?
|
||||
$orguser = $this->Orgusers_model->get(['user_id'=>$userid, 'organisatie_id'=>$schoolid], false, true);
|
||||
// if ($this->Groepenxusers_model->get(array("orguser_id"=> $orguser->id),false, false) ){
|
||||
// $errorstring = " Leerkracht is gekoppeld aan een groep en mag niet verwijderd worden.";
|
||||
// }
|
||||
|
||||
// als nivo < 10 alleen verwijderen via accounts
|
||||
$autorisatienivo = $this->Autorisaties_model->get(['orguser_id' =>$orguser->id], 'nivo_id', true);
|
||||
if ($autorisatienivo != 10) $errorstring += " Deze gebruiker mag alleen verwijderd worden via accounts.";
|
||||
|
||||
if ($errorstring <= ''){
|
||||
$this->Autorisaties_model->update_record_where(['nivo_id'=>100], ['orguser_id' =>$orguser->id]);
|
||||
// $this->Orgusers_model->delete_record_where(array("user_id" => $userid));
|
||||
// $this->Users_model->delete_record($userid);
|
||||
}
|
||||
$this->json($errorstring);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,631 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Sop extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array(
|
||||
"Docx_model",
|
||||
"monpas/Ambities_model",
|
||||
"monpas/Diversiteits_model",
|
||||
"monpas/Filledversions_model",
|
||||
"monpas/Ijkpunten_model",
|
||||
"monpas/Indicatoren_model",
|
||||
"monpas/Flexsop_gebruikteversies_model",
|
||||
"monpas/Groepen_model",
|
||||
"monpas/Hfstprofiel_model",
|
||||
"monpas/Hoofdstukken_model",
|
||||
"monpas/Menus_model",
|
||||
"monpas/Modules_model",
|
||||
"monpas/Ondersteuningtijden_model",
|
||||
"monpas/Oordelen_model",
|
||||
"shared/Organisaties_model",
|
||||
"monpas/Orgversies_model",
|
||||
"monpas/Schooldetails_model",
|
||||
"shared/Schooljaren_model",
|
||||
"monpas/Versies_model",
|
||||
"Phantom_model",
|
||||
"monpas/Scores_model",
|
||||
"monpas/Standaardteksten_model",
|
||||
"monpas/Sop_model",
|
||||
"monpas/Sopinhouden_model",
|
||||
"monpas/Sopviews_model",
|
||||
"monpas/Wenssituaties_model",
|
||||
"monpas/Maakinhoudnieuw_model",
|
||||
|
||||
);
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
function getrechten(){
|
||||
if (!$this->userid) die;
|
||||
$editok = false;
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole,259 ) > 0) $editok = true;
|
||||
echo json_encode($editok);
|
||||
}
|
||||
|
||||
function controleerschool(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->globorgid;
|
||||
$schoolX = false;
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($orgid);
|
||||
if ($organisatie && $organisatie->soort == 4) $schoolX=true;
|
||||
echo json_encode($schoolX);
|
||||
}
|
||||
|
||||
function ls_getProfielen(){
|
||||
$profielen = $this->Sop_model->getnieuwesops($this->globorgid);
|
||||
echo json_encode($profielen);
|
||||
}
|
||||
|
||||
function ls_getHoofdstukken(){
|
||||
$profielID = $this->input->post('profielID');
|
||||
// hier check op inleiding indien niet aanwezig, maak de inleiding?
|
||||
if (! $this->Hoofdstukken_model->ls_checkInleiding($profielID) )
|
||||
$this->Maakinhoudnieuw_model->maakEnSaveInleiding($profielID , 49,0);
|
||||
$hoofdstukken = $this->Hoofdstukken_model->ls_getHoofdstukken($profielID);
|
||||
echo json_encode($hoofdstukken);
|
||||
}
|
||||
|
||||
function ls_getHoofdstukContent(){
|
||||
$inhoudID =$this->input->post('inhoudID');
|
||||
$content = $this->Sopinhouden_model->get(['id' =>$inhoudID], 'content', true);
|
||||
echo json_encode($content);
|
||||
}
|
||||
|
||||
function ls_renewChapter(){
|
||||
$sopinhoudid = $this->clean_input("inhoudID");
|
||||
$sopinhoud = $this->Sopinhouden_model->get(['id'=>$sopinhoudid], false,true);
|
||||
|
||||
if($sopinhoudid) {
|
||||
$orgversieid = 0;
|
||||
if($sopinhoud->orgversieid){
|
||||
$orgversieid = $sopinhoud->orgversieid;
|
||||
}
|
||||
$vergelijkingen = $this->Flexsop_gebruikteversies_model->getVergelijkingen($sopinhoud->chapter_id);
|
||||
|
||||
$error = $this->Maakinhoudnieuw_model->fVervers($sopinhoud->chapter_id, $sopinhoudid,$orgversieid, "STANDAARD",$vergelijkingen);
|
||||
$nieuweInhoud = $this->Sopinhouden_model->get(['id' => $sopinhoudid], 'content', true);
|
||||
}
|
||||
echo json_encode(['nieuweinhoud' =>$nieuweInhoud, 'error'=>$error]);
|
||||
}
|
||||
|
||||
function ls_newChapter(){
|
||||
|
||||
$nieuweInhoud = null;
|
||||
$chapterID = $this->clean_input("chapterid");
|
||||
$profielID = $this->clean_input('profielid');
|
||||
$versieID = $this->clean_input('versie');
|
||||
$vergelijkingen = $this->clean_input('referenties');
|
||||
$volgorde = $this->Maakinhoudnieuw_model->getVolgnummer($profielID);
|
||||
$data = [ 'profiel_id' => $profielID,
|
||||
'chapter_id' => $chapterID,
|
||||
'orgversieid' => $versieID,
|
||||
'volgorde' => $volgorde];
|
||||
$newID = $this->Sopinhouden_model->insert_record($data);
|
||||
|
||||
$error = $this->Maakinhoudnieuw_model->fVervers($chapterID, $newID, $versieID,"STANDAARD", $vergelijkingen);
|
||||
|
||||
if ($error) $this->Sopinhouden_model->delete_record($newID);
|
||||
|
||||
else {
|
||||
$nieuweInhoud = $this->Sopinhouden_model->get(['id' => $newID], false, true);
|
||||
// om de vergelijkende versies bij te houden dient
|
||||
// per versie een record in de tabel tb_flexsop_gebruikteversies
|
||||
// te worden gemaakt.
|
||||
// de originele versie staat in de tabel tb_sopinhouden
|
||||
$index = 1;
|
||||
foreach ($vergelijkingen ? $vergelijkingen : [] as $vergelijking){
|
||||
$data2 = [ 'hoofdstuk_id' => $chapterID,
|
||||
'orgversie_id' => $vergelijking,
|
||||
'volgorde' => $index
|
||||
];
|
||||
$this->Flexsop_gebruikteversies_model->insert_record($data2);
|
||||
++$index;
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode(['nieuweinhoud' =>$nieuweInhoud, 'error'=>$error]);
|
||||
}
|
||||
function fVerversGebruikteVergelijkingen($chapterID, $vergelijkingen){
|
||||
// eerst oude tb_flexsop_gebruikteversies weggooien. Dit mag natuurlijk
|
||||
// alleen als er geen error is
|
||||
$this->Flexsop_gebruikteversies_model->delete_record_where(['hoofdstuk_id' =>$chapterID]);
|
||||
// dan de nieuwe versies opslaan
|
||||
$index = 1;
|
||||
foreach ($vergelijkingen ? $vergelijkingen : [] as $vergelijking){
|
||||
$data2 = [ 'hoofdstuk_id' => $chapterID,
|
||||
'orgversie_id' => $vergelijking,
|
||||
'volgorde' => $index
|
||||
];
|
||||
$this->Flexsop_gebruikteversies_model->insert_record($data2);
|
||||
++$index;
|
||||
}
|
||||
}
|
||||
|
||||
function ls_nieuweTabellen(){
|
||||
//maak de tabellen opnieuw maar nu met nieuwe versie(s)
|
||||
|
||||
$sopinhoudid = $this->clean_input("sopinhoudid");
|
||||
$orgversie = $this->clean_input('orgversieID');
|
||||
$vergelijkingen = $this->clean_input('referenties');
|
||||
if (! $vergelijkingen) $vergelijkingen = [];
|
||||
$sopinhoudRecord = $this->Sopinhouden_model->get(['id'=>$sopinhoudid],false,true);
|
||||
$chapterID = $sopinhoudRecord->chapter_id;
|
||||
|
||||
if (! $orgversie ) $orgversie = 0;
|
||||
$nieuweInhoud =false;
|
||||
|
||||
if($sopinhoudid) {
|
||||
$error = $this->Maakinhoudnieuw_model->fVervers($chapterID, $sopinhoudid,$orgversie, "TABELLEN", $vergelijkingen);
|
||||
if (! $error) $this->fVerversGebruikteVergelijkingen($chapterID, $vergelijkingen);
|
||||
$nieuweInhoud = $this->Sopinhouden_model->get(['id' => $sopinhoudid], false, true);
|
||||
}
|
||||
echo json_encode(['nieuweinhoud' =>$nieuweInhoud->content, 'orgversieid' => $nieuweInhoud->orgversieid, 'error'=>$error]);
|
||||
}
|
||||
|
||||
function ls_renewTabellen(){
|
||||
$sopinhoudid = $this->clean_input("sopinhoudid");
|
||||
$sopinhoudRecord = $this->Sopinhouden_model->get(['id'=>$sopinhoudid],false,true);
|
||||
$chapterID = $sopinhoudRecord->chapter_id;
|
||||
$orgversie = $sopinhoudRecord->orgversieid;
|
||||
$vergelijkingen = $this->Flexsop_gebruikteversies_model->getVergelijkingen($chapterID);
|
||||
|
||||
if (! $orgversie ) $orgversie = 0;
|
||||
$nieuweInhoud =false;
|
||||
|
||||
if($sopinhoudid) {
|
||||
$error = $this->Maakinhoudnieuw_model->fVervers($chapterID, $sopinhoudid,$orgversie, "TABELLEN", $vergelijkingen);
|
||||
$nieuweInhoud = $this->Sopinhouden_model->get(['id' => $sopinhoudid], false, true);
|
||||
}
|
||||
echo json_encode(['nieuweinhoud' =>$nieuweInhoud->content, 'orgversieid' => $nieuweInhoud->orgversieid, 'error'=>$error]);
|
||||
}
|
||||
|
||||
|
||||
// function getSopsEnLabels(){
|
||||
// $sopid = 0;
|
||||
// $sopkeuze = (new SopKeuze($sopid));
|
||||
// $sops = $sopkeuze->getSops();
|
||||
// $labels = $sopkeuze->getLabels();
|
||||
// $soplabels = $sopkeuze->getHoofdstukLabels();
|
||||
// $aantal = count($soplabels);
|
||||
// $tweedeid = '';
|
||||
// $laatste = $soplabels[$aantal - 1];// er is altijd een inleiding
|
||||
// $laatsteid = $laatste->sopinhoudID;
|
||||
|
||||
// if($aantal>1) {
|
||||
// $tweede = $soplabels[1];
|
||||
// $tweedeid = $tweede->sopinhoudID;
|
||||
// }
|
||||
|
||||
|
||||
// echo json_encode(["sops" =>$sops,
|
||||
// "labels" => $labels,
|
||||
// "tweede" => $tweedeid,
|
||||
// "laatste" => $laatsteid]);
|
||||
// }
|
||||
|
||||
function checkhoofdstuk(){
|
||||
$chapterid = $this->clean_input("chapterid");
|
||||
$profielid = $this->clean_input("profielid");
|
||||
$id = $this->Sopinhouden_model->get_fieldvalue(
|
||||
['profiel_id'=>$profielid,
|
||||
'chapter_id'=>$chapterid], "id");
|
||||
echo json_encode($id);
|
||||
}
|
||||
|
||||
// function getchapterEnVersies(){
|
||||
// if (!$this->userid) die;
|
||||
// $inhoudid = $this->clean_input("sopinhoudID");
|
||||
// $chapterid = $this->clean_input("chapterid");
|
||||
// $modulenr = $this->clean_input("module");
|
||||
// $profielid = $this->clean_input('profielid'); // wordt niet gebruikt
|
||||
// $hoofdstuk = $this->Sopinhouden_model->get_record_by_id($inhoudid);
|
||||
|
||||
// if(!$modulenr || $chapterid == 49){ $filledversies = false; }
|
||||
|
||||
// if($modulenr && $chapterid != 50 && $chapterid != 53) {
|
||||
// $versions = new Versions($chapterid, $profielid, $modulenr);
|
||||
// $filledversies = $versions->getFilledversies();
|
||||
// }
|
||||
// if($modulenr) {
|
||||
// if($chapterid == 50 || $chapterid == 53) {
|
||||
// $schooljaarversies = new SchooljaarVersies($chapterid, $profielid, $modulenr);
|
||||
// $filledversies = $schooljaarversies->getFilledversies();
|
||||
// }
|
||||
// }
|
||||
|
||||
// echo json_encode(["hoofdstuk" =>$hoofdstuk, "versies" =>$filledversies]);
|
||||
// }
|
||||
|
||||
function checkLijsten(){
|
||||
$chapterid = $this->clean_input("chapterid");
|
||||
$profielid = $this->clean_input("profielid");
|
||||
$ingevuld = 'F';
|
||||
$metijkpunten = 'F';
|
||||
$sopaanwezig = 'F';
|
||||
$orgversieid = 0;
|
||||
$filledversies = null;
|
||||
$standaarden = null;
|
||||
|
||||
|
||||
$modulenr = $this->Hoofdstukken_model->getmodule($chapterid);
|
||||
$orgversietype = 0;
|
||||
|
||||
|
||||
if ($modulenr) {
|
||||
$orgversietype = $this->Modules_model->get_fieldvalue(
|
||||
array("sysnr" => $modulenr), "versietype");
|
||||
|
||||
if ($orgversietype === '1') {
|
||||
$schooljaarVersies = new SchooljaarVersies($chapterid, $profielid, $modulenr);
|
||||
$filledversies = $schooljaarVersies->getFilledversies();
|
||||
$orgversieid = $schooljaarVersies->getSchooljaarid();
|
||||
$sopaanwezig = $schooljaarVersies->getSopAanwezig();
|
||||
$standaarden = "";
|
||||
} else {
|
||||
$versions = new Versions($chapterid, $profielid, $modulenr);
|
||||
$filledversies = $versions->getFilledversies();
|
||||
$orgversieid = $versions->getOrgversieid();
|
||||
$standaarden = $versions->getStandaarden();
|
||||
$metijkpunten = $versions->getMetIJkpunten();
|
||||
$sopaanwezig = $versions->getSopAanwezig();
|
||||
|
||||
}
|
||||
|
||||
if ($filledversies) $ingevuld = 'T';
|
||||
}
|
||||
|
||||
echo json_encode(["ingevuld" => $ingevuld,
|
||||
"orgversieid" => $orgversieid,
|
||||
"filledversies" => $filledversies,
|
||||
"standaarden" => $standaarden,
|
||||
"metijkpunten" => $metijkpunten,
|
||||
"sopaanwezig" => $sopaanwezig]);
|
||||
}
|
||||
|
||||
// function saveNewSopChapter(){
|
||||
// $chapterid = $this->clean_input("chapterid");
|
||||
// $profielid = $this->clean_input("profielid");
|
||||
// $modulenr = $this->clean_input("module");
|
||||
// $orgversieid = $this->clean_input("versie");
|
||||
// if ( !$orgversieid && $chapterid != 49) {
|
||||
// $versions = new Versions($chapterid, $profielid, $modulenr);
|
||||
// $orgversieid = $versions->getOrgversieid();
|
||||
// }
|
||||
// if($chapterid == 49) {
|
||||
// $this->Maakinhoudnieuw_model->maakEnSaveInleiding($profielid , $chapterid,0);
|
||||
// } else {
|
||||
// $nieuwhoofdstuk = new Hoofdstuk($chapterid, $profielid, $orgversieid);
|
||||
// }
|
||||
|
||||
// $hoofdstuk= $this->Sopinhouden_model->get(['profiel_id' => $profielid, 'chapter_id' => $chapterid],false, true);
|
||||
|
||||
// echo json_encode($hoofdstuk);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
function getLabels(){
|
||||
$sopid = $this->uri->segment(4);
|
||||
$sopkeuze = (new SopKeuze($sopid));
|
||||
$labels = $sopkeuze->getLabels();
|
||||
$soplabels = $sopkeuze->getHoofdstukLabels();
|
||||
$aantal = count($soplabels);
|
||||
$tweedeid='';
|
||||
if($aantal > 1) {
|
||||
$tweede = $soplabels[1];
|
||||
$tweedeid = $tweede->sopinhoudID;
|
||||
}
|
||||
$laatste = $soplabels[$aantal - 1];
|
||||
$laatsteid = $laatste->sopinhoudID;
|
||||
|
||||
echo json_encode(['labels' => $labels,
|
||||
'tweede' => $tweedeid,
|
||||
'laatste' => $laatsteid ]);
|
||||
}
|
||||
|
||||
function verplaatsHoofdstuk(){
|
||||
$sopid = $this->clean_input("sopid"); // selectedprofielid
|
||||
$sopinhoudid = $this->clean_input("sopinhoudid");
|
||||
$richting = $this->clean_input("richting");
|
||||
$sopkeuze = (new SopKeuze($sopid));
|
||||
$hfstlabels = $sopkeuze->getHoofdstukLabels();
|
||||
|
||||
if($richting === 'omhoog') $indexwaarde = -1;
|
||||
if($richting === 'omlaag') $indexwaarde = 1;
|
||||
|
||||
if(! $hfstlabels) return;
|
||||
$labels = (array)$hfstlabels;
|
||||
for($i=0; $i< count($labels); $i++) {
|
||||
if ($labels[$i]->sopinhoudID != $sopinhoudid) continue;
|
||||
|
||||
$oudevolgorde = $labels[$i]->volgorde;
|
||||
$x = $i + $indexwaarde;
|
||||
$labels[$i]->volgorde = $labels[$x]->volgorde;
|
||||
$labels[$x]->volgorde = $oudevolgorde;
|
||||
$nieuwevolgorde = $labels[$i]->volgorde;
|
||||
$idErnaast = $labels[$x]->sopinhoudID;
|
||||
|
||||
|
||||
$this->Sopinhouden_model->update_record(['volgorde'=>$nieuwevolgorde],$sopinhoudid);
|
||||
$this->Sopinhouden_model->update_record(['volgorde'=>$oudevolgorde],$idErnaast);
|
||||
|
||||
}
|
||||
$hoofdstukvolgorde = $this->Sopinhouden_model->getPagvolgorde( $sopid);
|
||||
echo json_encode($hoofdstukvolgorde);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function maaknewprofiel(){
|
||||
if (!$this->userid) die;
|
||||
$orgid =$this->globorgid;
|
||||
$data = array( 'organisatie_id' => $orgid,
|
||||
'naam' =>$this->clean_input("naam"),
|
||||
'van' => date2mysql($this->clean_input("van")),
|
||||
'tm' => date2mysql($this->clean_input('tm')),
|
||||
'versie' => 'NIEUW');
|
||||
$newid = $this->Sop_model->insert_record($data);
|
||||
$profiel =$this->Sop_model->getnieuwsop($newid);
|
||||
echo json_encode($profiel);
|
||||
}
|
||||
|
||||
function deleteprofiel(){
|
||||
if (!$this->userid) die;
|
||||
//delete het tb_profiel record en alle records in de hoofdstukken tabel
|
||||
$targetid= $this->uri->segment(4);
|
||||
$this->Sopinhouden_model->delete_record_where(['profiel_id'=> $targetid]);
|
||||
$this->Sop_model->delete_record($targetid);
|
||||
}
|
||||
|
||||
function updateprofiel(){
|
||||
if (!$this->userid) die;
|
||||
$data = array('naam' =>$this->clean_input("naam"),
|
||||
'van' => date2mysql($this->clean_input("van")),
|
||||
'tm' => date2mysql($this->clean_input('tm')),
|
||||
'versie' => 'NIEUW');
|
||||
$this->Sop_model->update_record($data, $this->clean_input('id'));
|
||||
echo json_encode('ok');
|
||||
}
|
||||
|
||||
function saveinhoud(){
|
||||
if (!$this->userid) die;
|
||||
$tekst = $this->input->post('tekst');
|
||||
$inhoudid = $this->input->post('id');
|
||||
$orgversie = $this->input->post('orgversie');
|
||||
$this->Sopinhouden_model->update_record(array('content'=>$tekst, 'orgversieid' =>$orgversie), $inhoudid);
|
||||
}
|
||||
|
||||
function deletechapter(){
|
||||
if (!$this->userid) die;
|
||||
// //TODO meer veiligheidschecks
|
||||
$sopinhoudid = $this->clean_input("tekstid");
|
||||
$chapterID = $this->Sopinhouden_model->get(['id'=>$sopinhoudid],'chapter_id', true);
|
||||
$this->Sopinhouden_model->delete_record($sopinhoudid);
|
||||
$this->Flexsop_gebruikteversies_model->delete_record_where(['hoofdstuk_id' => $chapterID]);
|
||||
echo json_encode(true);
|
||||
}
|
||||
|
||||
function maakHtml($profielid, $word){
|
||||
if (!$this->userid) die;
|
||||
$profiel = $this->Sop_model->get_record_by_id($profielid);
|
||||
$jaar1 = substr($profiel->van,0, 4);
|
||||
$jaar2 = substr($profiel->tm, 0, 4);
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($this->globorgid);
|
||||
|
||||
$bg = $this->Organisaties_model->get_record_by_id($organisatie->valtonder_id);
|
||||
$data=array( "profielid" => $profielid,
|
||||
"orgnaam" => $organisatie->naam,
|
||||
"jaar1" => $jaar1,
|
||||
"jaar2" => $jaar2,
|
||||
"bgnaam" =>$bg->naam);
|
||||
$html=$this->load->view("monpas/sop/sopvoorpagina", $data, true);
|
||||
$hoofdstukken = $this->Hoofdstukken_model->getoldchapters($profielid);
|
||||
foreach($hoofdstukken as $hoofdstuk){
|
||||
$tekst=$this->Sopinhouden_model->get_fieldvalue(["profiel_id" => $profielid, "chapter_id" =>$hoofdstuk->nummer],'content');
|
||||
if ($tekst){
|
||||
if ($word){
|
||||
$html=$html."<pagebreak />".$tekst;
|
||||
}
|
||||
else {
|
||||
$html=$html."<div style='page-break-after:always'></div>".$tekst;
|
||||
};
|
||||
};
|
||||
}
|
||||
$html=$html.'</div></body></html>';
|
||||
return $html;
|
||||
}
|
||||
|
||||
function maakHtmlSopNieuw($profielid, $word){
|
||||
if (!$this->userid) die;
|
||||
$profiel = $this->Sop_model->get_record_by_id($profielid);
|
||||
$jaar1 = substr($profiel->van,0, 4);
|
||||
$jaar2 = substr($profiel->tm, 0, 4);
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($this->globorgid);
|
||||
|
||||
$bg = $this->Organisaties_model->get_record_by_id($organisatie->valtonder_id);
|
||||
$data=array( "profielid" => $profielid,
|
||||
"orgnaam" => $organisatie->naam,
|
||||
"jaar1" => $jaar1,
|
||||
"jaar2" => $jaar2,
|
||||
"bgnaam" =>$bg->naam);
|
||||
$html=$this->load->view("monpas/sop/sopvoorpagina", $data, true);
|
||||
$html="<div class='sopfonts'>".$html."</div>";
|
||||
$hoofdstukken = $this->Sopinhouden_model->getPagvolgorde($profielid);
|
||||
|
||||
foreach($hoofdstukken as $hoofdstuk){
|
||||
$tekst=$this->Sopinhouden_model->get_fieldvalue(["id" => $hoofdstuk->sopinhoudID],'content');
|
||||
|
||||
if ($tekst){
|
||||
$tekst = "<div class='sopfonts'>".$tekst."</div>";
|
||||
if ($word){
|
||||
$html= $html."<pagebreak />".$tekst;
|
||||
}
|
||||
else {
|
||||
$html = $html . "<div style='page-break-after:always'></div>" . $tekst;
|
||||
};
|
||||
};
|
||||
}
|
||||
$html=$html.'</body></html>';
|
||||
|
||||
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
function maakpdf(){
|
||||
$input = json_decode($this->input->get('json'));
|
||||
|
||||
$profielid = $input->profielid;
|
||||
|
||||
$colorhtml = $this->maakHtml($profielid, false);
|
||||
$html = str_replace('verversholder','pdfholder', $colorhtml);
|
||||
$filenaam="sop".date('YmdHis');
|
||||
$this->Phantom_model->create_pdf($html,$filenaam, FALSE,FALSE,FALSE);
|
||||
}
|
||||
|
||||
function maakpdfSopnieuw(){
|
||||
$input = json_decode($this->input->get('json'));
|
||||
$profielid = $input->profielid;
|
||||
|
||||
$colorhtml = $this->maakHtmlSopNieuw($profielid, false);
|
||||
$html = str_replace('verversholder','pdfholder', $colorhtml);
|
||||
$filenaam="sop".date('YmdHis');
|
||||
$this->Phantom_model->create_pdf($html,$filenaam, FALSE,FALSE,FALSE);
|
||||
}
|
||||
|
||||
function maakword(){
|
||||
$profielid = $this->uri->segment(4);
|
||||
$colorhtml = $this->maakHtml($profielid,true);
|
||||
$html = str_replace('verversholder','pdfholder', $colorhtml);
|
||||
$html ="<!doctype html><html><body>".$html.'</body></html>';
|
||||
|
||||
$this->Docx_model->create_word_document($html, 'sop'.date('YmdHis'));
|
||||
}
|
||||
|
||||
function maakwordSopNieuw(){
|
||||
$profielid = $this->uri->segment(4);
|
||||
$colorhtml = $this->maakHtmlSopNieuw($profielid,true);
|
||||
$html = str_replace('verversholder','pdfholder', $colorhtml);
|
||||
$html ="<!doctype html><html><body>".$html.'</body></html>';
|
||||
|
||||
$this->Docx_model->create_word_document($html, 'sop'.date('YmdHis'));
|
||||
}
|
||||
|
||||
|
||||
function saveversie(){
|
||||
$inhoudid = $this->clean_input('inhoudid');
|
||||
$orgversieid = $this->clean_input('versie');
|
||||
$chapterid = $this->clean_input('chapterid');
|
||||
$profielid = $this->clean_input("profielid");
|
||||
$modulenr = $this->clean_input("modulenr");
|
||||
$chapteridlist = $this->clean_input("chapids");
|
||||
|
||||
|
||||
$this->Sopinhouden_model->update_record(array("orgversieid"=>$orgversieid), $inhoudid);
|
||||
if($chapterid > 12){
|
||||
$inhoud = $this->Sopinhouden_model->maakkeuzemodulecontent($chapterid, $profielid, $modulenr);
|
||||
}
|
||||
if($chapterid <=12) {
|
||||
$inhoud = $this->Sopinhouden_model->maakcontent($chapterid, $profielid);
|
||||
}
|
||||
$this->Sopinhouden_model->update_record(array('content'=>$inhoud['content']), $inhoudid);
|
||||
if ($chapteridlist){
|
||||
foreach($chapteridlist as $chapterid){
|
||||
$where=array("chapter_id"=>$chapterid, "profiel_id"=>$profielid);
|
||||
$this->Sopinhouden_model->update_record_where(array("orgversieid"=>$orgversieid), $where);
|
||||
$inhoud = $this->Sopinhouden_model->maakcontent($chapterid, $profielid);
|
||||
$this->Sopinhouden_model->update_record_where(array('content'=>$inhoud['content']), $where);
|
||||
}; // foreach
|
||||
}; // if list
|
||||
echo json_encode(true);
|
||||
}
|
||||
|
||||
function getenquetemoduleandsave(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->globorgid;
|
||||
$profielid = $this->input->post("profielid");
|
||||
$chapterid = $this->input->post("hoofdstuk");
|
||||
$versie = $this->input->post("versie");
|
||||
$chapter = $this->Hoofdstukken_model->get_record_by_id($chapterid);
|
||||
$module = $this->Modules_model->get_record_by_id($chapter->module);
|
||||
// $module = 1;
|
||||
// if ($chapterid == 7 || $chapterid ==12) $module = 4;
|
||||
$where= array( "profiel_id" =>$profielid,
|
||||
"chapter_id" =>$chapterid);
|
||||
$content= $this->Sopinhouden_model->get_fieldvalue($where,'content');
|
||||
if ($content) {
|
||||
switch ($chapterid){
|
||||
case 6: $result = $this->Sopinhouden_model->getenquetetabellen($profielid,$module->sysnr,$chapterid,$versie);
|
||||
|
||||
$imagemb =$this->Phantom_model->create_img( $result['grafiek1'], 'test.png', FALSE, FALSE, array(650, 300));
|
||||
$imagemb = "<div class='grafiekholdermonbas'><img src='data:image/png;base64,".$imagemb."' id='mod1image1'/></div>";
|
||||
$search = '~<div class="grafiekholdermonbas">[\s\S]*?</div>~';
|
||||
$content = preg_replace($search, $imagemb,$content);
|
||||
|
||||
$monbas1 ="<div class='tableholdermonbasteam'>".$result['tabel1']."</div>";
|
||||
$search = '~<div class="tableholdermonbasteam">[\s\S]*?</div>~';
|
||||
$content = preg_replace($search, $monbas1,$content);
|
||||
|
||||
|
||||
$monbas2 ="<div class='tableholdermonbasschool'>".$result['tabel2']."</div>";
|
||||
$search = '~<div class="tableholdermonbasschool">[\s\S]*?</div>~';
|
||||
$content = preg_replace($search, $monbas2,$content);
|
||||
break;
|
||||
case 7:
|
||||
$result =$this->Sopinhouden_model->getenquetetabellen($profielid,$module->sysnr,$chapterid,$versie);
|
||||
|
||||
$imagesm =$this->Phantom_model->create_img($result['grafiek1'], 'test.png', FALSE, FALSE, array(650, 300));
|
||||
$imagedata = "<div class='grafiekholdersm'><img src='data:image/png;base64,".$imagesm."' id='mod4image1'/><?]/div>";
|
||||
$search = '~<div class="grafiekholdersm">[\s\S]*?</div>~';
|
||||
$content = preg_replace($search, $imagedata,$content);
|
||||
|
||||
$sm1 = "<div class='tableholdersm1'>".$result['tabel1']."</div>";
|
||||
$search = '~<div class="tableholdersm1">[\s\S]*?</div>~';
|
||||
$content = preg_replace($search, $sm1,$content);
|
||||
|
||||
$sm2 = "<div class='tableholdersm2'>".$result['tabel2']."</div>";
|
||||
$search = '~<div class="tableholdersm2">[\s\S]*?</div>~';
|
||||
$content = preg_replace($search, $sm2,$content);
|
||||
|
||||
break;
|
||||
case 11:
|
||||
// Ontwikkelagenda Monbas
|
||||
$result = $this->Sopinhouden_model->getOntwikkelagenda($profielid,$module->sysnr,$versie);
|
||||
$oa1 = "<div class='tableholderontwikkelagenda1'>".$result['tabel1']."</div>";
|
||||
$search = "~<div class='tableholderontwikkelagenda1'>[\s\S]*?</div>~";
|
||||
$content = preg_replace($search, $oa1,$content);
|
||||
|
||||
$oa2 = "<div class='tableholderontwikkelagenda2'>".$result['tabel2']."</div>";
|
||||
$search = "~<div class='tableholderontwikkelagenda2'>[\s\S]*?</div>~";
|
||||
$content = preg_replace($search, $oa2,$content);
|
||||
break;
|
||||
case 12:
|
||||
// Ontwikkelagenda Schoolmeter
|
||||
$result = $this->Sopinhouden_model->getOntwikkelagenda($profielid,$module->sysnr,$versie);
|
||||
$oa1 = "<div class='tableholderontwikkelagenda1'>".$result['tabel1']."</div>";
|
||||
$search = "~<div class='tableholderontwikkelagenda1'>[\s\S]*?</div>~";
|
||||
$content = preg_replace($search, $oa1,$content);
|
||||
|
||||
$oa2 = "<div class='tableholderontwikkelagenda2'>".$result['tabel2']."</div>";
|
||||
$search = "~<div class='tableholderontwikkelagenda2'>[\s\S]*?</div>~";
|
||||
$content = preg_replace($search, $oa2,$content);
|
||||
|
||||
break;
|
||||
}; // switch
|
||||
$data=array("content" => $content) ;
|
||||
$this->Sopinhouden_model->update_record_where($data,$where);
|
||||
}; // if content
|
||||
|
||||
echo json_encode('ok');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,454 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class Sopoud extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array("shared/Autorisaties_model",
|
||||
"Docx_model",
|
||||
"monpas/Hoofdstukken_model",
|
||||
"monpas/Modules_model",
|
||||
"monpas/Sop_model",
|
||||
"monpas/Sopinhouden_model",
|
||||
"Phantom_model");
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
function getrechten(){
|
||||
if (!$this->userid) die;
|
||||
$editok = false;
|
||||
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole,259 ) > 0) $editok = true;
|
||||
echo json_encode($editok);
|
||||
}
|
||||
function getchapters(){
|
||||
$chapters= $this->Hoofdstukken_model->getoldchapters();
|
||||
foreach ($chapters as $chapter){
|
||||
$chapter->aanwezig = false;
|
||||
}
|
||||
echo json_encode($chapters);
|
||||
}
|
||||
function getschooljaarversies($profielid, $chapterid){
|
||||
$availversies = $this->Schooljaren_model->getschooljaren();
|
||||
if ($availversies) {
|
||||
foreach($availversies as $versie){
|
||||
$versie->id = $versie->schooljaarnr;
|
||||
}
|
||||
}
|
||||
|
||||
$currentorgversie = $this->Sopinhouden_model->get_fieldvalue(array("profiel_id"=>$profielid, "chapter_id"=>$chapterid), "orgversieid");
|
||||
if ($currentorgversie == NULL || $currentorgversie == 'undefined' || ! $currentorgversie){
|
||||
$currentorgversie= $this->Sopinhouden_model->getschooljaar($profielid);
|
||||
if ($currentorgversie == NULL && $availversies){
|
||||
$currentorgversie = $availversies[0]->schooljaarnr;
|
||||
}
|
||||
}
|
||||
|
||||
$versies = array( "currentorgversie" =>$currentorgversie,"availversies" => $availversies);
|
||||
return $versies;
|
||||
}
|
||||
|
||||
function getlijstversies($profielid, $modulenr, $chapterid){
|
||||
$orgid = $this->globorgid;
|
||||
$profiel = $this->Sop_model->get_record_by_id($profielid);
|
||||
$versies = $this->Filledversions_model->getfilledversionsperorg($orgid, $modulenr);
|
||||
$fvid = 0;
|
||||
$availversies = [];
|
||||
if ($versies){
|
||||
foreach($versies as $versie){
|
||||
$versie->naam = $versie->periodenummer.': '.$versie->geldigvanaf.' - '.$versie->geldigtm;
|
||||
$fvid = $this->Scores_model->fGetGevuldeVersies($versie->id, $orgid);
|
||||
if($fvid && $fvid > 0){
|
||||
$availversies []= $versie;
|
||||
}
|
||||
}
|
||||
}
|
||||
$currentorgversie = $this->Sopinhouden_model->get_fieldvalue(array("profiel_id"=>$profielid, "chapter_id"=>$chapterid), "orgversieid");
|
||||
|
||||
if ($currentorgversie == NULL){
|
||||
$currentorgversies =$this->Filledversions_model->getversiesperorgperperiode($orgid, $modulenr,$profiel->van, $profiel->tm);
|
||||
if ($currentorgversies){
|
||||
$currentorgversie = $currentorgversies[0]->id;
|
||||
}
|
||||
else {
|
||||
// zet currentorgversie op de eerste versie uit de lijst van versies, indien aanwezig
|
||||
if ($availversies){
|
||||
$currentorgversie = $availversies[0]->id;
|
||||
}
|
||||
};//ELSE
|
||||
}; //IF ORGVERSIE == NULL
|
||||
$versies= array('currentorgversie' => $currentorgversie, 'availversies'=>$availversies);
|
||||
return $versies;
|
||||
}
|
||||
|
||||
function Getversies($profielid,$chapterid){
|
||||
$versies = [];
|
||||
$hoofdstuk = $this->Hoofdstukken_model->get_record_by_id($chapterid);
|
||||
if ($hoofdstuk->module == 0 ) return $versies;
|
||||
|
||||
$module = $this->Modules_model->get_record_by_id($hoofdstuk->module);
|
||||
if ($module->versietype == 1) {
|
||||
$versies = $this->getschooljaarversies($profielid, $chapterid);
|
||||
}
|
||||
if ($module->versietype == 2) {
|
||||
$versies = $this->getlijstversies($profielid, $module->sysnr, $chapterid);
|
||||
} ;
|
||||
|
||||
return $versies;
|
||||
}
|
||||
|
||||
function controleerschool(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->globorgid;
|
||||
$school = false;
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($orgid);
|
||||
if ($organisatie && $organisatie->soort == 4) $school = true;
|
||||
echo json_encode($school);
|
||||
}
|
||||
function getprofielen(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->globorgid;
|
||||
$profielen = $this->Sop_model->getprofielen($orgid);
|
||||
echo json_encode($profielen);
|
||||
}
|
||||
function maaknewprofiel(){
|
||||
if (!$this->userid) die;
|
||||
$orgid =$this->globorgid;
|
||||
$data = array( 'organisatie_id'=> $orgid,
|
||||
'naam' =>$this->clean_input("naam"),
|
||||
'van' => date2mysql($this->clean_input("van")),
|
||||
'tm' => date2mysql($this->clean_input('tm')),
|
||||
'versie' => 'OUD');
|
||||
$newid = $this->Sop_model->insert_record($data);
|
||||
$profiel =$this->Sop_model->getprofiel($newid);
|
||||
echo json_encode($profiel);
|
||||
}
|
||||
function updateprofiel(){
|
||||
if (!$this->userid) die;
|
||||
$data = array('naam' =>$this->clean_input("naam"),
|
||||
'van' => date2mysql($this->clean_input("van")),
|
||||
'tm' => date2mysql($this->clean_input('tm')),
|
||||
'versie' => 'OUD' );
|
||||
$this->Sop_model->update_record($data, $this->clean_input('id'));
|
||||
echo json_encode('ok');
|
||||
}
|
||||
function deleteprofiel(){
|
||||
if (!$this->userid) die;
|
||||
//delete het tb_profiel record en alle records in de hoofdstukken tabel
|
||||
$targetid= $this->uri->segment(4);
|
||||
$this->Sop_model->delete_record($targetid);
|
||||
}
|
||||
function getchaptercontent(){
|
||||
if (!$this->userid) die;
|
||||
|
||||
$chapterid = $this->clean_input("chapterid");
|
||||
$profielid = $this->clean_input("profielid");
|
||||
$targetversieid = $this->clean_input("versieid");
|
||||
|
||||
$versies = $this->Getversies($profielid, $chapterid);
|
||||
if (!$targetversieid && (count($versies) > 0 ) && $versies['currentorgversie']) {
|
||||
$targetversieid = $versies['currentorgversie'];
|
||||
}
|
||||
|
||||
$content = $this->Sopinhouden_model->get_records_where(array('profiel_id'=>$profielid, 'chapter_id'=>$chapterid),true);
|
||||
|
||||
if (!$content){
|
||||
$returnarray = $this->Sopinhouden_model->maakcontent($chapterid,$profielid, $targetversieid);
|
||||
$contenttekst = $returnarray['content'];
|
||||
$inhoudid = $this->savecontent($chapterid,$profielid,$contenttekst, $returnarray['versie']);
|
||||
$content = $this->Sopinhouden_model->get_records_where(array("id"=>$inhoudid),true);
|
||||
}
|
||||
|
||||
if ($content && is_null($content->orgversieid)){
|
||||
// kan nog voorkomen bij "oude hoofdstukken"
|
||||
$targetversie = $this->getversieandsave($profielid, $chapterid, $targetversieid);
|
||||
$content->orgversieid = $targetversie;
|
||||
}
|
||||
echo json_encode(array('inhoud'=>$content, 'versies'=>$versies));
|
||||
}
|
||||
|
||||
|
||||
function getversieandsave($profielid, $chapterid, $targetversieid){
|
||||
$versie = $targetversieid;
|
||||
$orgid = $this->globorgid;
|
||||
$chapter = $this->Hoofdstukken_model->get_record_by_id($chapterid);
|
||||
$module = $this->Modules_model->get_record_by_id($chapter->module);
|
||||
|
||||
if (!$module ) return $versie;
|
||||
if ($versie == null || $versie==0){
|
||||
if ($module->versietype == 1) {
|
||||
// get schooljaar
|
||||
$versie = $this->Sopinhouden_model->gettargetjaar($profielid, $orgid, $chapterid);
|
||||
}
|
||||
if ($module->versietype == 2) {
|
||||
// orgversie
|
||||
$versie = $this->Sopinhouden_model->gettargetversie($profielid, $orgid, $chapterid);
|
||||
}
|
||||
}
|
||||
$data = array('orgversieid' => $versie);
|
||||
$where = array("profiel_id" => $profielid,
|
||||
"chapter_id" => $chapterid);
|
||||
$this->Sopinhouden_model->update_record_where($data, $where);
|
||||
return $versie;
|
||||
}
|
||||
|
||||
function savecontent($chapterid, $profielid,$content,$versie =FALSE){
|
||||
if (!$this->userid) die;
|
||||
$data = array( 'profiel_id' => $profielid,
|
||||
'chapter_id' => $chapterid,
|
||||
'content' => $content,
|
||||
'orgversieid' => $versie);
|
||||
$newid=$this->Sopinhouden_model->insert_record($data);
|
||||
return $newid;
|
||||
}
|
||||
function saveinhoud(){
|
||||
if (!$this->userid) die;
|
||||
$tekst = $this->input->post('tekst');
|
||||
$inhoudid = $this->input->post('id');
|
||||
$orgversie = $this->input->post('orgversie');
|
||||
if ($orgversie == '') $orgversie =null; // dit kan bij hoofdstuk inleiding
|
||||
$this->Sopinhouden_model->update_record(array('content'=>$tekst, 'orgversieid' =>$orgversie), $inhoudid);
|
||||
}
|
||||
function maakHtml($profielid, $word){
|
||||
if (!$this->userid) die;
|
||||
$profiel = $this->Sop_model->get_record_by_id($profielid);
|
||||
$jaar1 = substr($profiel->van,0, 4);
|
||||
$jaar2 = substr($profiel->tm, 0, 4);
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($this->globorgid);
|
||||
|
||||
$bg = $this->Organisaties_model->get_record_by_id($organisatie->valtonder_id);
|
||||
$data=array( "profielid" => $profielid,
|
||||
"orgnaam" => $organisatie->naam,
|
||||
"jaar1" => $jaar1,
|
||||
"jaar2" => $jaar2,
|
||||
"bgnaam" =>$bg->naam);
|
||||
$html=$this->load->view("monpas/sop/sopvoorpagina", $data, true);
|
||||
$html=$html;
|
||||
|
||||
for ($i=1; $i<=12;$i++){
|
||||
$where=array("profiel_id" => $profielid,
|
||||
"chapter_id" => $i);
|
||||
$tekst=$this->Sopinhouden_model->get_fieldvalue($where,'content');
|
||||
if ($tekst){
|
||||
if ($word){
|
||||
$html=$html."<pagebreak />".$tekst;
|
||||
}
|
||||
else {
|
||||
$html=$html."<div style='page-break-after:always'></div>".$tekst;
|
||||
};
|
||||
};
|
||||
}
|
||||
$html=$html.'</body></html>';
|
||||
return $html;
|
||||
}
|
||||
function maakpdf(){
|
||||
$input = json_decode($this->input->get('json'));
|
||||
$profielid = $input->profielid;
|
||||
$html = $this->maakHtml($profielid, false);
|
||||
$filenaam="sop".date('YmdHis');
|
||||
$this->Phantom_model->create_pdf($html,$filenaam, FALSE,FALSE,FALSE);
|
||||
}
|
||||
function maakword(){
|
||||
$profielid = $this->uri->segment(4);
|
||||
$html = $this->maakHtml($profielid,true);
|
||||
|
||||
$html ="<!doctype html><html><body>".$html.'</body></html>';
|
||||
|
||||
$this->Docx_model->create_word_document($html, 'sop'.date('YmdHis'));
|
||||
}
|
||||
function getschooldetails(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->globorgid;
|
||||
$html = $this->Sopinhouden_model->getcolofon();
|
||||
echo json_encode($html);
|
||||
}
|
||||
function getdiversiteit1(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->globorgid;
|
||||
$profielid = $this->uri->segment(4);
|
||||
$versie = $this->uri->segment(5);
|
||||
$module = 2;
|
||||
$dvt234 = $this->Sopinhouden_model->getdiversiteit234($profielid,$versie, $module);
|
||||
|
||||
$grafiekdiversiteit1 = $dvt234['divgrafiek1'];
|
||||
$image=$this->Phantom_model->create_img($grafiekdiversiteit1, 'test.png', FALSE, FALSE, array(650, 300));
|
||||
$imagedata = "<img src='data:image/png;base64,".$image."' id='divimage1'/>";
|
||||
|
||||
echo json_encode(array(
|
||||
// 'dvt1' =>$dvt1,
|
||||
'dvt2' =>$dvt234['dvt2'],
|
||||
'dvt3' =>$dvt234['dvt3'],
|
||||
'dvt4' =>$dvt234['dvt4'],
|
||||
'imagedata' =>$imagedata));
|
||||
}
|
||||
function getondersteuning1(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->globorgid;
|
||||
$profielid = $this->uri->segment(4);
|
||||
$versie =$this->uri->segment(5);
|
||||
$result = $this->Sopinhouden_model->getondersteuning12($profielid,$versie);
|
||||
|
||||
echo json_encode(array('os1' =>$result['os1'] ,
|
||||
"os2"=> $result['os2']) );
|
||||
}
|
||||
function getenquetemodule(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->globorgid;
|
||||
$profielid = $this->uri->segment(4);
|
||||
$module = $this->uri->segment(5);
|
||||
$chapterid = $this->uri->segment(6);
|
||||
$versieid = $this->uri->segment(7);
|
||||
if ($versieid && $versieid !== 'undefined' && $versieid > 0){
|
||||
$result = $this->Sopinhouden_model->getenquetetabellen($profielid,$module,$chapterid,$versieid);
|
||||
|
||||
$image = $this->Phantom_model->create_img($result['grafiek1'], 'test.png', FALSE, FALSE, array(650, 300));
|
||||
$imageid = "mod".$module."image1";
|
||||
|
||||
$imagedata = "<img src='data:image/png;base64,".$image."' id='.$imageid.'/>";
|
||||
echo json_encode(array('tabel1' =>$result['tabel1'] ,
|
||||
'imagedata' => $imagedata,
|
||||
"tabel2" => $result['tabel2']) );
|
||||
} else {
|
||||
// if not versieid
|
||||
echo json_encode(array('tabel1' =>'' ,
|
||||
'imagedata' => '',
|
||||
"tabel2" => '') );
|
||||
}
|
||||
}
|
||||
|
||||
function getontwikkelagenda(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->globorgid;
|
||||
$profielid = $this->uri->segment(4);
|
||||
$module = $this->uri->segment(5);
|
||||
$versie = $this->uri->segment(6);
|
||||
$result = $this->Sopinhouden_model->getOntwikkelagenda($profielid,$module,$versie);
|
||||
$imageoa = $this->Phantom_model->create_img($result['tabel1'], 'test.png', FALSE, FALSE, array(650, 300));
|
||||
$id = "oa1image1";
|
||||
|
||||
if ( $module = 4) { $id = "oa2image1";};
|
||||
$imagedata = "<img src='data:image/png;base64,".$imageoa."' id='".$id."'/>";
|
||||
|
||||
echo json_encode(array('image1' => $imagedata ,
|
||||
"tabel2" => $result['tabel2']) );
|
||||
}
|
||||
|
||||
function deletehoofdstuk(){
|
||||
//TODO clean input
|
||||
if (!$this->userid) die;
|
||||
$profielid = $this->uri->segment(4);
|
||||
$chapterid = $this->uri->segment(5);
|
||||
$where= array('profiel_id' =>$profielid,
|
||||
'chapter_id'=>$chapterid);
|
||||
$this->Sopinhouden_model->delete_record_where($where);
|
||||
echo json_encode('ok');
|
||||
}
|
||||
function getchapterids(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->globorgid;
|
||||
$profielid = $this->uri->segment(4);
|
||||
$ids = $this->Sop_model->getsopchapterids($profielid);
|
||||
echo json_encode($ids);
|
||||
}
|
||||
function getenquetemoduleandsave(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->globorgid;
|
||||
$profielid = $this->input->post("profielid");
|
||||
$chapterid = $this->input->post("hoofdstuk");
|
||||
$versie = $this->input->post("versie");
|
||||
$chapter = $this->Hoofdstukken_model->get_record_by_id($chapterid);
|
||||
$module = $this->Modules_model->get_record_by_id($chapter->module);
|
||||
// $module = 1;
|
||||
// if ($chapterid == 7 || $chapterid ==12) $module = 4;
|
||||
$where= array( "profiel_id" =>$profielid,
|
||||
"chapter_id" =>$chapterid);
|
||||
$content= $this->Sopinhouden_model->get_fieldvalue($where,'content');
|
||||
if ($content) {
|
||||
switch ($chapterid){
|
||||
case 6: $result = $this->Sopinhouden_model->getenquetetabellen($profielid,$module->sysnr,$chapterid,$versie);
|
||||
|
||||
$imagemb =$this->Phantom_model->create_img( $result['grafiek1'], 'test.png', FALSE, FALSE, array(650, 300));
|
||||
$imagemb = "<div class='grafiekholdermonbas'><img src='data:image/png;base64,".$imagemb."' id='mod1image1'/></div>";
|
||||
$search = '~<div class="grafiekholdermonbas">[\s\S]*?</div>~';
|
||||
$content = preg_replace($search, $imagemb,$content);
|
||||
|
||||
$monbas1 ="<div class='tableholdermonbasteam'>".$result['tabel1']."</div>";
|
||||
$search = '~<div class="tableholdermonbasteam">[\s\S]*?</div>~';
|
||||
$content = preg_replace($search, $monbas1,$content);
|
||||
|
||||
|
||||
$monbas2 ="<div class='tableholdermonbasschool'>".$result['tabel2']."</div>";
|
||||
$search = '~<div class="tableholdermonbasschool">[\s\S]*?</div>~';
|
||||
$content = preg_replace($search, $monbas2,$content);
|
||||
break;
|
||||
case 7:
|
||||
$result =$this->Sopinhouden_model->getenquetetabellen($profielid,$module->sysnr,$chapterid,$versie);
|
||||
|
||||
$imagesm =$this->Phantom_model->create_img($result['grafiek1'], 'test.png', FALSE, FALSE, array(650, 300));
|
||||
$imagedata = "<div class='grafiekholdersm'><img src='data:image/png;base64,".$imagesm."' id='mod4image1'/><?]/div>";
|
||||
$search = '~<div class="grafiekholdersm">[\s\S]*?</div>~';
|
||||
$content = preg_replace($search, $imagedata,$content);
|
||||
|
||||
$sm1 = "<div class='tableholdersm1'>".$result['tabel1']."</div>";
|
||||
$search = '~<div class="tableholdersm1">[\s\S]*?</div>~';
|
||||
$content = preg_replace($search, $sm1,$content);
|
||||
|
||||
$sm2 = "<div class='tableholdersm2'>".$result['tabel2']."</div>";
|
||||
$search = '~<div class="tableholdersm2">[\s\S]*?</div>~';
|
||||
$content = preg_replace($search, $sm2,$content);
|
||||
|
||||
break;
|
||||
case 11:
|
||||
// Ontwikkelagenda Monbas
|
||||
$result = $this->Sopinhouden_model->getOntwikkelagenda($profielid,$module->sysnr,$versie);
|
||||
$oa1 = "<div class='tableholderontwikkelagenda1'>".$result['tabel1']."</div>";
|
||||
$search = "~<div class='tableholderontwikkelagenda1'>[\s\S]*?</div>~";
|
||||
$content = preg_replace($search, $oa1,$content);
|
||||
|
||||
$oa2 = "<div class='tableholderontwikkelagenda2'>".$result['tabel2']."</div>";
|
||||
$search = "~<div class='tableholderontwikkelagenda2'>[\s\S]*?</div>~";
|
||||
$content = preg_replace($search, $oa2,$content);
|
||||
break;
|
||||
case 12:
|
||||
// Ontwikkelagenda Schoolmeter
|
||||
$result = $this->Sopinhouden_model->getOntwikkelagenda($profielid,$module->sysnr,$versie);
|
||||
$oa1 = "<div class='tableholderontwikkelagenda1'>".$result['tabel1']."</div>";
|
||||
$search = "~<div class='tableholderontwikkelagenda1'>[\s\S]*?</div>~";
|
||||
$content = preg_replace($search, $oa1,$content);
|
||||
|
||||
$oa2 = "<div class='tableholderontwikkelagenda2'>".$result['tabel2']."</div>";
|
||||
$search = "~<div class='tableholderontwikkelagenda2'>[\s\S]*?</div>~";
|
||||
$content = preg_replace($search, $oa2,$content);
|
||||
|
||||
break;
|
||||
}; // switch
|
||||
$data=array("content" => $content) ;
|
||||
$this->Sopinhouden_model->update_record_where($data,$where);
|
||||
}; // if content
|
||||
|
||||
echo json_encode('ok');
|
||||
}
|
||||
function saveversie(){
|
||||
$inhoudid = $this->clean_input('inhoudid');
|
||||
$orgversieid = $this->clean_input('versie');
|
||||
$chapterid = $this->clean_input('chapterid');
|
||||
$profielid = $this->clean_input("profielid");
|
||||
$chapteridlist = $this->clean_input("chapids");
|
||||
|
||||
$this->Sopinhouden_model->update_record(array("orgversieid"=>$orgversieid), $inhoudid);
|
||||
$inhoud = $this->Sopinhouden_model->maakcontent($chapterid, $profielid);
|
||||
$this->Sopinhouden_model->update_record(array('content'=>$inhoud['content']), $inhoudid);
|
||||
if ($chapteridlist){
|
||||
foreach($chapteridlist as $chapterid){
|
||||
$where=array("chapter_id"=>$chapterid, "profiel_id"=>$profielid);
|
||||
$this->Sopinhouden_model->update_record_where(array("orgversieid"=>$orgversieid), $where);
|
||||
$inhoud = $this->Sopinhouden_model->maakcontent($chapterid, $profielid);
|
||||
$this->Sopinhouden_model->update_record_where(array('content'=>$inhoud['content']), $where);
|
||||
}; // foreach
|
||||
}; // if list
|
||||
echo json_encode(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
<?php if ( ! defined( 'BASEPATH' ) ) exit( 'No direct script access allowed' );
|
||||
|
||||
class Sortering extends MY_Controller {
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$models = array(
|
||||
"shared/Users_model",
|
||||
"shared/Organisaties_model",
|
||||
"shared/Orgusers_model",
|
||||
"shared/Session_model",
|
||||
"monpas/Sorteringen_model",
|
||||
"monpas/Sorteerlabels_model",
|
||||
"monpas/Sorteerlabelsorg_model",
|
||||
);
|
||||
$this->load->model( $models );
|
||||
$this->load->helper( 'string' );
|
||||
if ( ! $this->check_online_status() )
|
||||
{
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
function checkrechten()
|
||||
{
|
||||
// if ( ! $this->userid ) die;
|
||||
// $orguserid = $this->Orgusers_model->get_fieldvalue( array("user_id" => $this->userid, "organisatie_id" => $this->globorgid), "id" );
|
||||
// $niveau = $this->Autorisaties_model->get_fieldvalue( array("orguser_id" => $orguserid), "nivo_id" );
|
||||
//
|
||||
// if ( $niveau == 1 || $niveau == 2 )
|
||||
// {
|
||||
// echo json_encode( TRUE );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// echo json_encode( FALSE );
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
// function checkadmin(){
|
||||
// $orguserid = $this->Orgusers_model->get_fieldvalue( array("user_id" => $this->userid, "organisatie_id" => $this->globorgid), "id" );
|
||||
// $niveau = $this->Autorisaties_model->get_fieldvalue( array("orguser_id" => $orguserid), "nivo_id" );
|
||||
//
|
||||
// return $niveau;
|
||||
// }
|
||||
|
||||
function getSortering(){
|
||||
$swvID = $this->uri->segment(4);
|
||||
$criteria = $this->Sorteringen_model->get_criteriabijSWV($swvID);
|
||||
foreach($criteria as $criterium){
|
||||
$labels = $this->Sorteerlabels_model->get_labels($criterium->id);
|
||||
$label = new stdClass();
|
||||
$label->id = 0;
|
||||
$label->sortering_id = $criterium->id;
|
||||
$label->naam ='niet ingedeeld';
|
||||
$label->volgorde = 'LAATST';
|
||||
array_push($labels, $label);
|
||||
$criterium->labels = $labels;
|
||||
}
|
||||
|
||||
echo json_encode($criteria);
|
||||
|
||||
}
|
||||
|
||||
function getSchoolIndelingen(){
|
||||
$swvid = $this->clean_input('swvid');
|
||||
$criteriumid = $this->clean_input('criteriumid');
|
||||
$labels = $this->Sorteerlabels_model->get_labels($criteriumid);
|
||||
$label = new stdClass();
|
||||
$label->waardeid = 0;
|
||||
$label->sortering_id = $criteriumid;
|
||||
$label->naam ='niet ingedeeld';
|
||||
$label->volgorde = 'LAATST';
|
||||
array_push($labels, $label);
|
||||
$swv = $this->Organisaties_model->get_record_by_id($swvid);
|
||||
$swv->kamers = $this->Organisaties_model->getorgsvanaf($swvid);
|
||||
|
||||
if(!$swv->kamers){
|
||||
echo json_encode(false);
|
||||
}
|
||||
|
||||
if(!is_array($swv->kamers)){
|
||||
$swv->kamers = objectToArray($swv->kamers);
|
||||
}
|
||||
foreach($swv->kamers as $kamer){
|
||||
$kamer->bgs = $this->Organisaties_model->getorgsvanaf($kamer->id);
|
||||
if ($kamer->bgs){
|
||||
foreach($kamer->bgs as $bg){
|
||||
$bg->scholen =$this->Organisaties_model->getorgsvanaf($bg->id);
|
||||
if($bg->scholen) {
|
||||
foreach ($bg->scholen as $school) {
|
||||
|
||||
$school->opties = $labels;
|
||||
|
||||
$school->indeling = $this->Sorteringen_model->getSchoolIndeling($school->id, $criteriumid);
|
||||
if ( !$school->indeling) {
|
||||
$school->indeling = new stdClass();
|
||||
$school->indeling->waardeid = 0;
|
||||
$school->indeling->waarde = 'niet ingedeeld';
|
||||
$school->indeling->volgorde = 'LAATST';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo json_encode($swv);
|
||||
}
|
||||
function saveCriterium(){
|
||||
$swvID = $this->clean_input('swvID');
|
||||
$naam = $this->clean_input('criterium');
|
||||
$label1 = $this->clean_input('label1');
|
||||
$label2 = $this->clean_input('label2');
|
||||
$nieuwelabels = $this->clean_input('labelArray');
|
||||
$labels = [];
|
||||
array_push($labels, $label1, $label2);
|
||||
|
||||
if($nieuwelabels){
|
||||
foreach($nieuwelabels as $label){
|
||||
if(!empty($label['nieuwLabel'])){
|
||||
array_push($labels, $label['nieuwLabel']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$criteriumid = $this->Sorteringen_model->insert_record
|
||||
(array('swv_id'=>$swvID,
|
||||
'naam' =>$naam));
|
||||
|
||||
foreach($labels as $label){
|
||||
$this->Sorteerlabels_model->insert_record
|
||||
(array('sortering_id'=>$criteriumid,
|
||||
'naam'=>$label));
|
||||
}
|
||||
echo json_encode($criteriumid);
|
||||
}
|
||||
|
||||
function editCriterium(){
|
||||
$swvID = $this->clean_input('swvID');
|
||||
$criteriumid = $this->clean_input('criteriumid');
|
||||
$naam = $this->clean_input('criterium');
|
||||
$editlabels = $this->clean_input('labels');
|
||||
$nieuwelabels = $this->clean_input('labelArray');
|
||||
$labels = [];
|
||||
if($editlabels){
|
||||
foreach($editlabels as $label){
|
||||
if(!empty($label['label'] && $label['label'] != "niet ingedeeld")){
|
||||
array_push($labels, $label);
|
||||
}
|
||||
}
|
||||
foreach($labels as $label){
|
||||
$labelid = $label['waardeid'];
|
||||
$waarde = $label['label'];
|
||||
$this->Sorteerlabels_model->update_record_where(array('naam'=>$waarde),
|
||||
array('id'=>$labelid));
|
||||
}
|
||||
}
|
||||
|
||||
$labelsNieuw = [];
|
||||
if($nieuwelabels){
|
||||
foreach($nieuwelabels as $label){
|
||||
if(!empty($label['nieuwLabel'])){
|
||||
array_push($labelsNieuw, $label['nieuwLabel']);
|
||||
}
|
||||
}
|
||||
foreach($labelsNieuw as $label){
|
||||
$this->Sorteerlabels_model->insert_record
|
||||
(array('sortering_id'=>$criteriumid,
|
||||
'naam'=>$label));
|
||||
}
|
||||
}
|
||||
|
||||
$this->Sorteringen_model->update_record
|
||||
(array('swv_id'=>$swvID,
|
||||
'naam' =>$naam), $criteriumid);
|
||||
|
||||
echo json_encode(true);
|
||||
}
|
||||
|
||||
|
||||
function deleteCriterium(){
|
||||
$criteriumid = $this->uri->segment(4);
|
||||
|
||||
$this->Sorteerlabels_model->delete_record_where(array('sortering_id' =>$criteriumid));
|
||||
$this->Sorteringen_model->delete_record($criteriumid);
|
||||
|
||||
echo json_encode(true);
|
||||
|
||||
}
|
||||
|
||||
function deleteLabel(){
|
||||
$labelid = $this->uri->segment(4);
|
||||
|
||||
$this->Sorteerlabels_model->delete_record($labelid);
|
||||
|
||||
echo json_encode(true);
|
||||
|
||||
}
|
||||
|
||||
function updateSortering(){
|
||||
$orgid = $this->clean_input('orgid');
|
||||
$keuzeid = $this->clean_input('keuzeid');
|
||||
$criteriumid = $this->clean_input('criteriumid');
|
||||
$voorheen = $this->Sorteringen_model->getSchoolIndeling($orgid, $criteriumid);
|
||||
|
||||
if($voorheen){
|
||||
$this->Sorteerlabelsorg_model->delete_record_where(array(
|
||||
'label_id'=>$voorheen->waardeid,
|
||||
'organisatie_id'=>$orgid ));
|
||||
}
|
||||
$id = $this->Sorteerlabelsorg_model->insert_record(array(
|
||||
'label_id'=>$keuzeid,
|
||||
'organisatie_id'=>$orgid));
|
||||
|
||||
echo json_encode($id);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class Streefcijfers extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array( "shared/Users_model",
|
||||
'shared/Organisaties_model',
|
||||
"monpas/Orgversies_model",
|
||||
"monpas/Ambities_model");
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
function gethierarchie($selfid){
|
||||
if (!$this->userid) die;
|
||||
$organisatie= $this->Organisaties_model->get_record_by_id($selfid);
|
||||
$swvid = null;
|
||||
$kamerid = null;
|
||||
$bgid = null;
|
||||
switch ($organisatie->soort) {
|
||||
case 1: $swvid = $organisatie->id;
|
||||
break;
|
||||
case 2: $kamerid = $organisatie->id;
|
||||
$swvid =$organisatie->valtonder_id;
|
||||
break;
|
||||
case 3: $bgid = $organisatie->id;
|
||||
$kamerid = $organisatie->valtonder_id;
|
||||
$org2 = $this->Organisaties_model->get_record_by_id($kamerid);
|
||||
$swvid = $org2->valtonder_id;
|
||||
break;
|
||||
case 4: $bgid = $organisatie->valtonder_id;
|
||||
$org2 = $this->Organisaties_model->get_record_by_id($bgid);
|
||||
$kamerid = $org2->valtonder_id;
|
||||
$org3 = $this->Organisaties_model->get_record_by_id($kamerid);
|
||||
$swvid = $org2->valtonder_id;
|
||||
break;
|
||||
} ; // einde switch
|
||||
return array('swvid'=>$swvid,
|
||||
"kamerid" =>$kamerid,
|
||||
"bgid" =>$bgid);
|
||||
}
|
||||
|
||||
|
||||
function getorgversies_ambities(){
|
||||
if (!$this->userid) die;
|
||||
$targetorgid = $this->uri->segment(4);
|
||||
$module = $this->session->userdata('module');
|
||||
// get de ambities van de targetorganisatie
|
||||
$ambities = $this->Ambities_model->getambities($targetorgid);
|
||||
|
||||
// zoek de huidige, actieve orgversie
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($targetorgid);
|
||||
$hierarchie = $this->gethierarchie($targetorgid);
|
||||
|
||||
switch ($organisatie->soort){
|
||||
case 1: $orgversies = $this->Orgversies_model->getallorgversies($hierarchie['swvid'],$module,true);
|
||||
// let op dit is een array
|
||||
break;
|
||||
case 2:
|
||||
case 3: $orgversies = $this->Orgversies_model->getallorgversies($hierarchie['kamerid'],$module, true);
|
||||
if (!$orgversies){
|
||||
$orgversies = $this->Orgversies_model->getallorgversies($hierarchie['swvid'],$module, true);
|
||||
}
|
||||
// een bg is voorlopig nog niet gekoppeld aan een orgversie
|
||||
break;
|
||||
}; //einde switch
|
||||
|
||||
if ($orgversies) {
|
||||
// Als er voor de huidige, actieve orgversies voor de gegeven organisatie nog geen
|
||||
//ambities zijn, zoek dan de ambitie van de hogere organisatie en anders de default
|
||||
$alaanwezig = false;
|
||||
if ($ambities){
|
||||
foreach($ambities as $ambitie){
|
||||
if ($ambitie->orgversie_id == $orgversies[0]->id) {$alaanwezig = true; };
|
||||
}
|
||||
}
|
||||
|
||||
if (!$alaanwezig){
|
||||
switch($organisatie->soort){
|
||||
case 1: $ambitie_new = $this->Ambities_model->getdefault2($orgversies[0]->id, $targetorgid);
|
||||
break;
|
||||
case 2: $ambitie_new = $this->Ambities_model->getambitie2($orgversies[0]->id, $hierarchie["swvid"]);
|
||||
if (!$ambitie_new){
|
||||
$ambitie_new = $this->Ambities_model->getdefault2($orgversies[0]->id, $targetorgid);
|
||||
};
|
||||
break;
|
||||
case 3: $ambitie_new = $this->Ambities_model->getambitie2($orgversies[0]->id, $hierarchie["kamerid"]);
|
||||
if (!$ambitie_new) {
|
||||
$ambitie_new = $this->Ambities_model->getambitie2($orgversies[0]->id, $hierarchie["swvid"]);
|
||||
if (!$ambitie_new){
|
||||
$ambitie_new = $this->Ambities_model->getdefault2($orgversies[0]->id, $targetorgid);
|
||||
}
|
||||
}; // if
|
||||
break;
|
||||
};//switch
|
||||
if ($ambities){
|
||||
array_push($ambities,$ambitie_new); }
|
||||
else {$ambities[0] = $ambitie_new;};
|
||||
}; // if not al aanwezig
|
||||
}; // if orgversies
|
||||
if ($ambities){
|
||||
foreach($ambities as $ambitie){
|
||||
$ambitie->wijzigok = true;
|
||||
// if (new DateTime( $ambitie->geldigtm) <= new DateTime() ) {$ambitie->wijzigok = false;};
|
||||
$ambitie->geldigvanaf = mysql2date($ambitie->geldigvanaf);
|
||||
$ambitie->geldigtm = mysql2date($ambitie->geldigtm);
|
||||
}
|
||||
}
|
||||
echo json_encode($ambities);
|
||||
}
|
||||
|
||||
// function getorgversies_ambities_oud(){
|
||||
// $versies = false;
|
||||
// $module = $this->session->userdata('module');
|
||||
// $targetorgid = $this->uri->segment(3);
|
||||
// $organisatie = $this->Organisaties_model->get_record_by_id($targetorgid);
|
||||
|
||||
// $hierarchie = $this->gethierarchie($targetorgid);
|
||||
|
||||
// // haal alle orgversies op
|
||||
// $orgversies = null;
|
||||
// switch ($organisatie->soort){
|
||||
// case 1: $orgversiesSWV = $this->Orgversies_model->getallorgversies($targetorgid,$module);
|
||||
// break;
|
||||
// case 2: $orgversiesSWV =$this->Orgversies_model->getallorgversies($targetorgid,$module);
|
||||
// $orgversiesKamer = $this->Orgversies_model->getallorgversies($hierarchie["swvid"],$module);
|
||||
// break;
|
||||
// case 3: $orgversiesBG = $this->Orgversies_model->getallorgversies($hierarchie["bgid"],$module);
|
||||
// $orgversiesKamer = $this->Orgversies_model->getallorgversies($hierarchie["kamerid"],$module);
|
||||
// $orgversiesBG = $this->Orgversies_model->getallorgversies($hierarchie["swvid"], $module);
|
||||
// break;
|
||||
// }; //einde switch
|
||||
|
||||
|
||||
// if ($orgversiesSWV){
|
||||
// foreach($orgversiesSWV as $orgversie){
|
||||
// $orgversie->ambitie = $this->Ambities_model->getambitie($orgversie->id,$targetorgid);
|
||||
// }// foreach
|
||||
// }; // if
|
||||
// if ($orgversiesKamer){
|
||||
// foreach($orgversiesKamer as $orgversie){
|
||||
// $orgversie->ambitie = $this->Ambities_model->getambitie($orgversie->id,$targetorgid);
|
||||
// }// foreach
|
||||
// }; // if
|
||||
// echo json_encode($orgversies);
|
||||
// }
|
||||
|
||||
function getorganisaties(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->globorgid;
|
||||
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($orgid);
|
||||
if ($organisatie->soort == 3){
|
||||
// doe verder niks
|
||||
}
|
||||
if ($organisatie->soort == 2){
|
||||
$organisatie->bgs = $this->Organisaties_model->getorgsvanaf($organisatie->id);
|
||||
}
|
||||
if ($organisatie->soort == 1) {
|
||||
$organisatie->kamers = $this->Organisaties_model->getorgsvanaf($organisatie->id);
|
||||
if ($organisatie->kamers){
|
||||
foreach ($organisatie->kamers as $kamer){
|
||||
$kamer->bgs = $this->Organisaties_model->getorgsvanaf($kamer->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
echo json_encode($organisatie);
|
||||
}
|
||||
function getzelfniveau(){
|
||||
if (!$this->userid) die;
|
||||
$nivo = $this->Organisaties_model->get_fieldvalue(array("id"=>$this->globorgid), "soort");
|
||||
echo json_encode($nivo);
|
||||
}
|
||||
function updateambitie(){
|
||||
if (!$this->userid) die;
|
||||
$id=$this->clean_input("id");
|
||||
// zoek of de ambitie voor een nieuwe organisatie is
|
||||
$alaanwezig = $this->Ambities_model->check_for_record(array("organisatie_id"=>$this->clean_input("organisatie_id"),
|
||||
"orgversie_id" => $this->clean_input("orgversie_id")) );
|
||||
if ($id ==0 || !$alaanwezig ){
|
||||
$data=array("organisatie_id" => $this->clean_input("organisatie_id"),
|
||||
"orgversie_id" => $this->clean_input("orgversie_id"),
|
||||
"gem_score" => $this->clean_input("gemscore"),
|
||||
"x_ijkpunten" => $this->clean_input("xijkpunten"),
|
||||
"z_procent" => $this->clean_input("zprocent"));
|
||||
$newid= $this->Ambities_model->insert_record($data);
|
||||
}
|
||||
else {
|
||||
$data=array("gem_score" => $this->clean_input("gemscore"),
|
||||
"x_ijkpunten" => $this->clean_input("xijkpunten"),
|
||||
"z_procent" => $this->clean_input("zprocent"));
|
||||
$this->Ambities_model->update_record($data, $id);
|
||||
$newid =false;
|
||||
} ;
|
||||
echo json_encode($newid);
|
||||
}
|
||||
|
||||
function verwijder(){
|
||||
$ambitieID = $this->clean_input('id');
|
||||
$error = true;
|
||||
if ($this->userid){
|
||||
$this->Ambities_model->delete_record($ambitieID);
|
||||
$error = false;
|
||||
}
|
||||
echo json_encode($error);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class Swvversies extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array( "monpas/Antwoordtypes_model",
|
||||
"monpas/Antwoordopties_model",
|
||||
"shared/Users_model",
|
||||
'shared/Organisaties_model',
|
||||
"monpas/Versies_model",
|
||||
"monpas/Orgversies_model",
|
||||
"monpas/Modules_model");
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
function getswvs(){
|
||||
if (!$this->userid) die;
|
||||
$orgs=null;
|
||||
if ($this->super){
|
||||
$swvs = $this->Organisaties_model->getorgs(1);
|
||||
if ($swvs ){
|
||||
foreach($swvs as $swv){
|
||||
$swv->kamers = $this->Organisaties_model->getorgs(2, $swv->id);
|
||||
}
|
||||
}
|
||||
}; // if super
|
||||
echo json_encode($swvs);
|
||||
}
|
||||
|
||||
function getkoppelingen(){
|
||||
//TODO clean input
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->clean_input("orgid");
|
||||
$module = $this->clean_input("module");
|
||||
$koppelingen = $this->Orgversies_model->getallorgversies($orgid, $module);
|
||||
if ($koppelingen){
|
||||
if ($koppelingen[0]->id == null) {$koppelingen='';};
|
||||
}
|
||||
echo json_encode($koppelingen);
|
||||
}
|
||||
function insertkoppeling(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->clean_input("orgid");
|
||||
$periodenummer = $this->Orgversies_model->getmaxperiode($orgid);
|
||||
|
||||
if ($periodenummer) {$nummer = $periodenummer->nummer + 1 ; }
|
||||
else {$nummer = 1; };
|
||||
// kijk of er al een actieve koppeling is, zo nee dan wordt dit de actieve koppeling
|
||||
if ($this->Orgversies_model->get_records_where(array("organisatie_id" =>$orgid, "actief" =>1)) )
|
||||
{$actief = 0 ;}
|
||||
else {$actief = 1 ;};
|
||||
$data = array("organisatie_id" => $orgid,
|
||||
"periodenummer" => $nummer,
|
||||
"actief" => $actief,
|
||||
"versie_id" => $this->input->post("versieid"),
|
||||
"geldigvanaf" => date2mysql($this->input->post("geldigvanaf")),
|
||||
"geldigtm" => date2mysql($this->input->post("geldigtm")),
|
||||
"invullentm" => date2mysql($this->input->post("invullentm")),
|
||||
"vorm" => $this->input->post("vormid"),
|
||||
"scoretype" => $this->input->post("scoretype"),
|
||||
"score_omschrijving" => $this->clean_input('omschrijving')
|
||||
);
|
||||
$newid = $this->Orgversies_model->insert_record($data);
|
||||
$koppeling = $this->Orgversies_model->getkoppeling($newid);
|
||||
echo json_encode($koppeling);
|
||||
}
|
||||
function deletekoppeling(){
|
||||
if (!$this->userid) die;
|
||||
$orgversieid = $this->uri->segment(4);
|
||||
$this->Orgversies_model->delete_record($orgversieid);
|
||||
echo json_encode(true);
|
||||
}
|
||||
function updatekoppeling(){
|
||||
if (!$this->userid) die;
|
||||
$orgversieid = $this->clean_input("id");
|
||||
$datumvanaf = date2mysql($this->clean_input("geldigvanaf"));
|
||||
$datumtm = date2mysql($this->clean_input("geldigtm"));
|
||||
$datuminvullen = date2mysql($this->clean_input("invullentm"));
|
||||
$omschrijving = $this->clean_input('omschrijving')== false ? 'F' : 'T';
|
||||
|
||||
$this->Orgversies_model->update_record(array("geldigvanaf" =>$datumvanaf,
|
||||
"geldigtm" =>$datumtm,
|
||||
"invullentm" =>$datuminvullen,
|
||||
"vorm" =>$this->input->post("vormid"),
|
||||
"scoretype" =>$this->input->post("scoretype") ), $orgversieid);
|
||||
|
||||
|
||||
echo json_encode(true);
|
||||
}
|
||||
|
||||
function updatetoonomschrijving(){
|
||||
if (!$this->userid) die;
|
||||
$orgversieid = $this->clean_input("id");
|
||||
$omschrijving = $this->clean_input('omschrijving');
|
||||
|
||||
$this->Orgversies_model->update_record(array(
|
||||
"score_omschrijving" =>$omschrijving), $orgversieid);
|
||||
|
||||
|
||||
echo json_encode(true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function getantwoordtypes(){
|
||||
$types = $this->Antwoordtypes_model->getalltypes();
|
||||
|
||||
echo json_encode($types);
|
||||
}
|
||||
|
||||
function getAntwoordtypesEnOmschrijving(){
|
||||
$types = $this->Antwoordtypes_model->getalltypes();
|
||||
foreach($types as $type){
|
||||
$type->opties = $this->Antwoordopties_model->getopties($type->sysnr);
|
||||
}
|
||||
|
||||
echo json_encode($types);
|
||||
}
|
||||
|
||||
function updateAntwoordopties(){if (!$this->userid) die;
|
||||
$optieID = $this->clean_input('id');
|
||||
$omschrijving = $this->input->post('omschrijving');
|
||||
$this->Antwoordopties_model->update_record(['omschrijving' =>$omschrijving], $optieID);
|
||||
$this->json(true);
|
||||
}
|
||||
|
||||
function getversies(){
|
||||
if (!$this->userid) die;
|
||||
$module = $this->clean_input("module");
|
||||
$versies = $this->Versies_model->getversiesbymodule($module);
|
||||
echo json_encode($versies);
|
||||
}
|
||||
function maakactief(){
|
||||
if (!$this->userid) die;
|
||||
$orgversieid = $this->uri->segment(4);
|
||||
$modulesysnr = $this->uri->segment(5);
|
||||
$orgid = $this->Orgversies_model->get_fieldvalue(array("id"=>$orgversieid), 'organisatie_id');
|
||||
$this->Orgversies_model->updateactief($orgid, $modulesysnr);
|
||||
$data=array("actief"=>1);
|
||||
$this->Orgversies_model->update_record($data, $orgversieid);
|
||||
}
|
||||
function maakinactief(){
|
||||
if (!$this->userid) die;
|
||||
$orgversieid = $this->uri->segment(4);
|
||||
$data = array("actief " => 0);
|
||||
$this->Orgversies_model->update_record($data, $orgversieid);
|
||||
}
|
||||
function getmodulesmetlijst(){
|
||||
if (!$this->userid) die;
|
||||
$modules = $this->Modules_model->getmodulesmetlijst();
|
||||
echo json_encode($modules);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,662 @@
|
||||
// Build the chart
|
||||
|
||||
//
|
||||
// fFillGraph=function(){
|
||||
|
||||
<?php //if (isset($data[0]->tlvs ))?>//fMakeChart('tlvs');
|
||||
// <?php //if(isset($data[1]->tlvs ))?>// fMakeChart('tlvsII');
|
||||
//
|
||||
//
|
||||
// fMakeChart = function() {
|
||||
//
|
||||
// var aantallen = [];
|
||||
// <?php //foreach( $data[0]->tlvs as $tlv){
|
||||
// if($tlv->zwaarte == 'LAAG'){ ?>
|
||||
//
|
||||
// aantallen.push({
|
||||
// name: 'so laag',
|
||||
// y: <?php //echo intval($tlv->aantal) ?>//,
|
||||
// color: '#d9ffb3'
|
||||
// });
|
||||
// <?php //}
|
||||
//
|
||||
// if($tlv->zwaarte == 'MIDDEN'){ ?>
|
||||
//
|
||||
// aantallen.push({
|
||||
// name: 'so midden',
|
||||
// y: <?php //echo intval($tlv->aantal) ?>//,
|
||||
// color: '#66cc00'
|
||||
// });
|
||||
// <?php //}
|
||||
//
|
||||
// if($tlv->zwaarte == 'HOOG'){?>
|
||||
//
|
||||
// aantallen.push({
|
||||
// name: 'so hoog',
|
||||
// y: <?php //echo intval($tlv->aantal) ?>//,
|
||||
// color: '#4d9900''
|
||||
// });
|
||||
// <?php //}
|
||||
//
|
||||
// if($tlv->zwaarte == 'LICHT'){ ?>
|
||||
//
|
||||
// aantallen.push({
|
||||
// name: 'sbo licht',
|
||||
// y: <?php //echo intval($tlv->aantal) ?>//,
|
||||
// color: '#99d6ff'
|
||||
// });
|
||||
// <?php //}
|
||||
//
|
||||
// if($tlv->zwaarte == 'ZWAAR'){ ?>
|
||||
//
|
||||
// aantallen.push({
|
||||
// name: 'sbo zwaar',
|
||||
// y: <?php //echo intval($tlv->aantal) ?>//,
|
||||
// color: '#005c99'
|
||||
// });
|
||||
// <?php //} } ?>
|
||||
|
||||
Highcharts.chart('tlvs', {
|
||||
chart: {
|
||||
plotBackgroundColor: null,
|
||||
plotBorderWidth: null,
|
||||
plotShadow: false,
|
||||
type: 'pie',
|
||||
margin: [0, 0, 0, 0],
|
||||
spacingTop: 0,
|
||||
spacingBottom: 0,
|
||||
spacingLeft: 0,
|
||||
spacingRight: 0
|
||||
|
||||
|
||||
},
|
||||
title: {
|
||||
text: ''
|
||||
},
|
||||
credits: {
|
||||
enabled: false
|
||||
},
|
||||
|
||||
plotOptions: {
|
||||
pie: {
|
||||
allowPointSelect: true,
|
||||
cursor: 'pointer',
|
||||
size: '100%',
|
||||
dataLabels: {
|
||||
enabled: false
|
||||
},
|
||||
showInLegend: true,
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
itemStyle: {
|
||||
fontSize: '8px',
|
||||
fontWeight: '200',
|
||||
align: 'left',
|
||||
itemDistance: '10',
|
||||
borderWidth: 0,
|
||||
},
|
||||
},
|
||||
|
||||
series: [{
|
||||
name: 'tlvs',
|
||||
// colorByPoint: true,
|
||||
data: aantallen
|
||||
}]
|
||||
});
|
||||
|
||||
// Highcharts.chart('tlvsII', {
|
||||
// chart: {
|
||||
// plotBackgroundColor: null,
|
||||
// plotBorderWidth: null,
|
||||
// plotShadow: false,
|
||||
// type: 'pie',
|
||||
// margin: [0, 0, 0, 0],
|
||||
// spacingTop: 0,
|
||||
// spacingBottom: 0,
|
||||
// spacingLeft: 0,
|
||||
// spacingRight: 0
|
||||
//
|
||||
//
|
||||
// },
|
||||
// title: {
|
||||
// text: ''
|
||||
// },
|
||||
// credits: {
|
||||
// enabled: false
|
||||
// },
|
||||
//
|
||||
// plotOptions: {
|
||||
// pie: {
|
||||
// allowPointSelect: true,
|
||||
// cursor: 'pointer',
|
||||
// size: '100%',
|
||||
// dataLabels: {
|
||||
// enabled: false
|
||||
// },
|
||||
// showInLegend: true,
|
||||
// }
|
||||
// },
|
||||
// legend: {
|
||||
// itemStyle: {
|
||||
// fontSize: '8px',
|
||||
// fontWeight: '200',
|
||||
// align: 'left',
|
||||
// layout: 'horizontal',
|
||||
// borderWidth: 0,
|
||||
//
|
||||
//
|
||||
// },
|
||||
// },
|
||||
//
|
||||
// series: [{
|
||||
// name: 'Brands',
|
||||
// colorByPoint: true,
|
||||
// data: [{
|
||||
// name: 'Chrome',
|
||||
// y: 61.41,
|
||||
// sliced: true,
|
||||
// selected: true
|
||||
// }, {
|
||||
// name: 'Internet Explorer',
|
||||
// y: 11.84
|
||||
// }, {
|
||||
// name: 'Firefox',
|
||||
// y: 10.85
|
||||
// }, {
|
||||
// name: 'Edge',
|
||||
// y: 4.67
|
||||
// }, {
|
||||
// name: 'Safari',
|
||||
// y: 4.18
|
||||
// }, {
|
||||
// name: 'Other',
|
||||
// y: 7.05
|
||||
// }]
|
||||
// }]
|
||||
// });
|
||||
|
||||
|
||||
// }
|
||||
//
|
||||
// }();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- --><?php //if ($data[0]->tlvs ){ ?>
|
||||
// $(function(){
|
||||
// fFillGraph10=function(){
|
||||
// var schooljaar = '<?php //echo $data[0]->aantallen->naam ?>//';
|
||||
//
|
||||
// var aantallen = [];
|
||||
// <?php //foreach( $data[0]->tlvs as $index => $tlv){
|
||||
// if($tlv->zwaarte == 'LAAG'){ ?>
|
||||
//
|
||||
// aantallen.push({
|
||||
// name: 'so laag',
|
||||
// y: <?php //echo intval($tlv->aantal) ?>//,
|
||||
// color: '#d9ffb3'
|
||||
// });
|
||||
// <?php //}
|
||||
//
|
||||
// if($tlv->zwaarte == 'MIDDEN'){ ?>
|
||||
//
|
||||
// aantallen.push({
|
||||
// name: 'so midden',
|
||||
// y: <?php //echo intval($tlv->aantal) ?>//,
|
||||
// color: '#66cc00'
|
||||
// });
|
||||
// <?php //}
|
||||
//
|
||||
// if($tlv->zwaarte == 'HOOG'){?>
|
||||
//
|
||||
// aantallen.push({
|
||||
// name: 'so hoog',
|
||||
// y: <?php //echo intval($tlv->aantal) ?>//,
|
||||
// color: '#4d9900''
|
||||
// });
|
||||
// <?php //}
|
||||
//
|
||||
// if($tlv->zwaarte == 'LICHT'){ ?>
|
||||
//
|
||||
// aantallen.push({
|
||||
// name: 'sbo licht',
|
||||
// y: <?php //echo intval($tlv->aantal) ?>//,
|
||||
// color: '#99d6ff'
|
||||
// });
|
||||
// <?php //}
|
||||
//
|
||||
// if($tlv->zwaarte == 'ZWAAR'){ ?>
|
||||
//
|
||||
// aantallen.push({
|
||||
// name: 'sbo zwaar',
|
||||
// y: <?php //echo intval($tlv->aantal) ?>//,
|
||||
// color: '#005c99'
|
||||
// })
|
||||
// <?php //} } ?>
|
||||
//
|
||||
//
|
||||
//
|
||||
// Highcharts.chart('tlvs', {
|
||||
// chart: {
|
||||
// backgroundColor: '#d7d8d7',
|
||||
// plotBackgroundColor: '#d7d8d7',
|
||||
// plotBorderWidth: null,
|
||||
// plotShadow: false,
|
||||
// animation: false,
|
||||
// type: 'pie'
|
||||
// },
|
||||
// title:{
|
||||
// text:''
|
||||
// },
|
||||
// credits: {
|
||||
// enabled: false
|
||||
// },
|
||||
// plotOptions: {
|
||||
// pie: {
|
||||
// allowPointSelect: false,
|
||||
// dataLabels: {
|
||||
// enabled: false
|
||||
// },
|
||||
// showInLegend: true
|
||||
// }
|
||||
// },
|
||||
// legend:{
|
||||
// enable: true,
|
||||
// margin: 0,
|
||||
// layout: 'horizontal',
|
||||
// itemStyle:{
|
||||
// fontSize: '10px',
|
||||
// fontWeight: 'normal'
|
||||
// },
|
||||
// labelFormatter: function () {
|
||||
// return this.name + ': ' + this.y;
|
||||
// }
|
||||
// },
|
||||
//
|
||||
// series: aantallen
|
||||
// });
|
||||
//
|
||||
// }()
|
||||
// });
|
||||
// <?php //} ?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<?php if ($data[1]->tlvs){ ?>
|
||||
$(function(){
|
||||
fFillGraph15=function(){
|
||||
var schooljaar = '<?php echo $data[1]->aantallen->naam ?>';
|
||||
|
||||
var aantallen = [];
|
||||
<?php foreach( $data[1]->tlvs as $index => $tlv){
|
||||
if($tlv->zwaarte == 'LAAG'){ ?>
|
||||
|
||||
aantallen.push({
|
||||
name: 'so laag',
|
||||
y: <?php echo intval($tlv->aantal) ?>,
|
||||
color: '#d9ffb3'
|
||||
});
|
||||
<?php }
|
||||
|
||||
if($tlv->zwaarte == 'MIDDEN'){ ?>
|
||||
|
||||
aantallen.push({
|
||||
name: 'so midden',
|
||||
y: <?php echo intval($tlv->aantal) ?>,
|
||||
color: '#66cc00'
|
||||
});
|
||||
<?php }
|
||||
|
||||
if($tlv->zwaarte == 'HOOG'){?>
|
||||
|
||||
aantallen.push({
|
||||
name: 'so hoog',
|
||||
y: <?php echo intval($tlv->aantal) ?>,
|
||||
color: '#4d9900''
|
||||
});
|
||||
<?php }
|
||||
|
||||
if($tlv->zwaarte == 'LICHT'){ ?>
|
||||
|
||||
aantallen.push({
|
||||
name: 'sbo licht',
|
||||
y: <?php echo intval($tlv->aantal) ?>,
|
||||
color: '#99d6ff'
|
||||
});
|
||||
<?php }
|
||||
|
||||
if($tlv->zwaarte == 'ZWAAR'){ ?>
|
||||
|
||||
aantallen.push({
|
||||
name: 'sbo zwaar',
|
||||
y: <?php echo intval($tlv->aantal) ?>,
|
||||
color: '#005c99'
|
||||
});
|
||||
<?php } } ?>
|
||||
|
||||
|
||||
|
||||
Highcharts.chart('tlvsII', {
|
||||
chart: {
|
||||
backgroundColor: '#d7d8d7',
|
||||
plotBackgroundColor: '#d7d8d7',
|
||||
plotBorderWidth: null,
|
||||
plotShadow: false,
|
||||
animation: false,
|
||||
type: 'pie'
|
||||
},
|
||||
title:{
|
||||
text:''
|
||||
},
|
||||
credits: {
|
||||
enabled: false
|
||||
},
|
||||
plotOptions: {
|
||||
pie: {
|
||||
allowPointSelect: false,
|
||||
dataLabels: {
|
||||
enabled: false
|
||||
},
|
||||
showInLegend: true
|
||||
}
|
||||
},
|
||||
legend:{
|
||||
enable: true,
|
||||
margin: 0,
|
||||
layout: 'horizontal',
|
||||
itemStyle:{
|
||||
fontSize: '10px',
|
||||
fontWeight: 'normal'
|
||||
},
|
||||
labelFormatter: function () {
|
||||
return this.name + ': ' + this.y;
|
||||
}
|
||||
},
|
||||
|
||||
series: aantallen
|
||||
});
|
||||
|
||||
}()
|
||||
});
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<?php if(count($data) == 1 &&($data[0]->tlvs || $data[1]->tlvs) ){ ?>
|
||||
|
||||
<div class="sopKaderGrafiek" style="margin-top: 0; padding-top: 0;">
|
||||
<div class="col-xs-12" style="margin-top: 0; padding-top: 0; text-align: center">
|
||||
<span style=" font-size: 0.8em !important;">TLVs per zorgzwaarte</span>
|
||||
</div>
|
||||
<div class="col-xs-12">
|
||||
<?php if($data[0]->tlvs){ ?>
|
||||
<div class="highcharts-background"
|
||||
id="tlvs"
|
||||
style="width: 350px; height: 125px; ">
|
||||
</div>
|
||||
<?php }
|
||||
if($data[1]->tlvs){ ?>
|
||||
<div class="highcharts-background"
|
||||
id="tlvs"
|
||||
style="width: 350px; height: 125px; ">
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<?php if($data[0]->arrangementen && $data[1]->arrangementen){ ?>
|
||||
|
||||
<div class="sopkaderGrafiek" style="margin-top: 0; padding-top: 0;">
|
||||
<div class=" col-xs-12" style="margin-top: 0; padding-top: 0;">
|
||||
<p style=" font-size: 0.8em !important; text-align:center">TLvs Per Zorgzwaarte</p>
|
||||
</div>
|
||||
<div class=" col-xs-6" style="padding:0;">
|
||||
<div class="highcharts-background"
|
||||
id="tlvs"
|
||||
style="width: 175px; ">
|
||||
</div>
|
||||
</div>
|
||||
<div class=" col-xs-6" style="padding:0;">
|
||||
<div class="highcharts-background"
|
||||
id="tlvsII"
|
||||
style="width: 175px; ">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
<?php if(count($data) == 1 && ($data[0]->arrangementen || $data[1]->arrangementen)){ ?>
|
||||
|
||||
<div class="sopkaderGrafiek" style="margin-top: 0; padding-top: 0;">
|
||||
<div class=" col-xs-12" style="margin-top: 0; padding-top: 0;">
|
||||
<p style=" font-size: 0.8em !important; text-align:center">TLVs per zorgzwaarte</p>
|
||||
</div>
|
||||
<div class=" col-xs-12" style="padding:0;">
|
||||
<?php if($data[0]->arrangementen){ ?>
|
||||
<div class="highcharts-background"
|
||||
id="arrangementen"
|
||||
style="width: 350px; ">
|
||||
</div>
|
||||
<?php }
|
||||
if($data[1]->arrangementen){ ?>
|
||||
<div class="highcharts-background"
|
||||
id="arrangementenII"
|
||||
style="width: 350px; ">
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
|
||||
<?php if ($data[0]->arrangementen){ ?>
|
||||
$(function(){
|
||||
fFillGraph11=function(){
|
||||
var schooljaar = '<?php echo $data[0]->aantallen->naam ?>';
|
||||
var arrangementen = [];
|
||||
var naam = "";
|
||||
var lengte = "";
|
||||
var duur = "";
|
||||
|
||||
|
||||
<?php foreach($data[0]->arrangementen as $index => $arrangement){
|
||||
if(isset($arrangement->aantal)){
|
||||
if($arrangement->aantal > 0) { ?>
|
||||
|
||||
lengte = 10;
|
||||
duur = '>= 6 wkn';
|
||||
<?php if($arrangement->lengte == 'K'){ ?>
|
||||
lengte = 5;
|
||||
duur = '< 6 wkn';
|
||||
<?php }?>
|
||||
|
||||
naam = '<?= $arrangement->naam ?>'+'('+'<?= $arrangement->leeftijd ?>'+') '+ '<?= $arrangement->aantal ?>' + ' lln.' + duur;
|
||||
|
||||
arrangementen.push({
|
||||
name : naam,
|
||||
y : <?php echo intval( $arrangement->aantal) ?>,
|
||||
z : lengte
|
||||
color : <?php echo $arrangement->kleur ?>,
|
||||
});
|
||||
<?php }
|
||||
}; }?>
|
||||
if (arrangementen.length <=0) return;
|
||||
|
||||
Highcharts.chart('arrangementen', {
|
||||
chart: {
|
||||
type: 'variablepie',
|
||||
backgroundColor: '#d7d8d7',
|
||||
plotBackgroundColor: '#d7d8d7',
|
||||
animation: false,
|
||||
height: 185
|
||||
},
|
||||
title:{
|
||||
text:'',
|
||||
margin: 0
|
||||
},
|
||||
credits: {
|
||||
enabled: false
|
||||
},
|
||||
legend:{
|
||||
enable: true,
|
||||
margin: 0,
|
||||
width: 175,
|
||||
itemStyle: {
|
||||
fontWeight: 'normal',
|
||||
fontSize: 8
|
||||
}
|
||||
},
|
||||
|
||||
plotOptions: {
|
||||
pie: {
|
||||
allowPointSelect: false,
|
||||
dataLabels: {
|
||||
enabled: false
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
series: [{
|
||||
minPointSize: 10,
|
||||
colorByPoint: true,
|
||||
innerSize: '20%',
|
||||
zMin: 0,
|
||||
name: 'arrangementen',
|
||||
data: arrangementen,
|
||||
dataLabels: {
|
||||
enabled: false
|
||||
},
|
||||
showInLegend: true
|
||||
}]
|
||||
});
|
||||
}()
|
||||
});
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($data[1]->arrangementen){ ?>
|
||||
$(function(){
|
||||
fFillGraph12=function(){
|
||||
var schooljaar = '<?php echo $data[1]->aantallen->naam ?>';
|
||||
var arrangementen = [];
|
||||
var naamV = "";
|
||||
var lengte = "";
|
||||
var duur = "";
|
||||
|
||||
<?php foreach($data[1]->arrangementen as $index => $arrangement){
|
||||
if(isset($arrangement->aantal)){
|
||||
if($arrangement->aantal > 0) { ?>
|
||||
lengte = 10;
|
||||
duur = '>= 6 wkn';
|
||||
<?php if($arrangement->lengte == 'K'){ ?>
|
||||
lengte = 5;
|
||||
duur = '< 6 wkn';
|
||||
<?php }?>
|
||||
|
||||
naam = '<?=$arrangement->naam ?>'+ '('+'<?= $arrangement->leeftijd ?>'+') '+ '<?= $arrangement->aantal ?>' + ' lln.' + duur;
|
||||
|
||||
arrangementen.push({
|
||||
name: naam,
|
||||
y : <?php echo intval($arrangement->aantal) ?>,
|
||||
z : lengte
|
||||
color : <?php echo $arrangement->kleur ?>,
|
||||
});
|
||||
<?php }; }; }?>
|
||||
|
||||
if (arrangementen.length <= 0) return;
|
||||
|
||||
Highcharts.chart('arrangementenII', {
|
||||
chart: {
|
||||
type: 'variablepie',
|
||||
backgroundColor: '#d7d8d7',
|
||||
plotBackgroundColor: '#d7d8d7',
|
||||
animation: false,
|
||||
height: 185
|
||||
},
|
||||
legend:{
|
||||
enable: true,
|
||||
margin: 0,
|
||||
width: 175,
|
||||
itemStyle: {
|
||||
fontWeight: 'normal',
|
||||
fontSize: 8
|
||||
}
|
||||
},
|
||||
title:{
|
||||
text:'',
|
||||
marginTop: 0
|
||||
},
|
||||
credits: {
|
||||
enabled: false
|
||||
},
|
||||
plotOptions: {
|
||||
pie: {
|
||||
allowPointSelect: false,
|
||||
dataLabels: {
|
||||
enabled: false,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
series: [{
|
||||
minPointSize: 10,
|
||||
colorByPoint: true,
|
||||
innerSize: '20%',
|
||||
animation: false,
|
||||
zMin: 0,
|
||||
name: 'arrangementen',
|
||||
data: arrangementen,
|
||||
dataLabels: {
|
||||
enabled: false
|
||||
},
|
||||
showInLegend: true
|
||||
|
||||
}]
|
||||
});
|
||||
}()
|
||||
});
|
||||
<?php } ?>
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
class Autorisatienivos extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array( "shared/Orgusers_model",
|
||||
"shared/Autorisaties_model",
|
||||
"shared/Autorisatienivos_model",
|
||||
"shared/Organisaties_model");
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
public function getautorisaties(){
|
||||
$userid = $this->userid;
|
||||
$orgid = $this->globorgid;
|
||||
if (! $this->super || $this->userrole == 2){
|
||||
$where= array("user_id"=> $userid, "organisatie_id"=>$orgid);
|
||||
$orguserid = $this->Orgusers_model->get_fieldvalue($where, 'id');
|
||||
$where=array("orguser_id" => $orguserid);
|
||||
$userautid = $this->Autorisaties_model->get_fieldvalue($where,'nivo_id');
|
||||
$where=array("id"=>$userautid);
|
||||
$userhierarchie = $this->Autorisatienivos_model->get_fieldvalue($where, "hierarchie");
|
||||
}
|
||||
else {
|
||||
$userhierarchie = 1000;
|
||||
}
|
||||
$autnivos = $this->Autorisatienivos_model->getnivos($userhierarchie);
|
||||
echo json_encode($autnivos);
|
||||
}
|
||||
public function getautorisatie(){
|
||||
$autonivo = $this->Autorisatienivos_model->getusernivo($this->userid);
|
||||
echo json_encode($autonivo);
|
||||
}
|
||||
public function getwriteautorisatie(){
|
||||
// write autorisatie wordt alleen gegeven als
|
||||
// org is eigen organisatie en rechten = management
|
||||
$orgid = $this->uri->segment(4);
|
||||
if (!$orgid) {$orgid = $this->globorgid;};
|
||||
|
||||
$writeOK = false;
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole, 343 ) >0){
|
||||
$writeOK = true;};
|
||||
// check of user lid is van orgid
|
||||
$userorg = $this->Orgusers_model->get_records_where(array('user_id' => $this->userid, 'organisatie_id' => $orgid),true);
|
||||
if (!$userorg) {$writeOK = false ;};
|
||||
// $userorg = $this->Organisaties_model->getuserorg($this->userid);
|
||||
// if ($userorg->id != $orgid) {$writeOK = false;}
|
||||
// super en helpdesk altijd schrijfrecht
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole, 3) == 1){
|
||||
$writeOK = true;
|
||||
|
||||
}
|
||||
echo json_encode($writeOK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Filefolders extends MY_Controller {
|
||||
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
$models = array( "shared/Filefolders_model",
|
||||
"shared/Files_model",
|
||||
"monpas/Orgversies_model",
|
||||
"monpas/Modules_model",
|
||||
"monpas/Teksten_model",
|
||||
"Phantom_model");
|
||||
$this->load->model($models);
|
||||
|
||||
$this->load->helper('string');
|
||||
if (!$this->check_online_status() || ! $this->userid) {
|
||||
echo json_encode(array('offline' => TRUE));
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
function getfolders(){
|
||||
$modulenr = $this->uri->segment(4);
|
||||
if (! $modulenr || $modulenr <=0) {
|
||||
echo $this->json(false);
|
||||
return;
|
||||
}
|
||||
|
||||
$orgID = $this->globorgid;
|
||||
$folders = $this->Filefolders_model->get_folders($modulenr, $orgID);
|
||||
if ($folders){
|
||||
foreach($folders as $folder){
|
||||
$folder->subfolders = $this->Filefolders_model->get_subfolders($folder);
|
||||
$folder->files= $this->Files_model->get_files($folder->id);
|
||||
}
|
||||
}// if folders
|
||||
$this->json($folders);
|
||||
}
|
||||
|
||||
public function maakStandaardFolders(){
|
||||
//CHECK MANAGER RIGHT
|
||||
if (! $this->isManager() ) return;
|
||||
|
||||
$modulenr = $this->clean_input('modulenr');
|
||||
$orgID = $this->globorgid;
|
||||
$folders = false;
|
||||
|
||||
$org = $this->Organisaties_model->get(['id'=>$orgID], false,true);
|
||||
if ($org->id != $org->valtonder_id) $targetOrgID = $this->Organisaties_model->getkamer($org->id);
|
||||
else $targetOrgID = $org->id;
|
||||
|
||||
$cats = $this->Orgversies_model->getversiecats($targetOrgID,$modulenr);
|
||||
if (! $cats) {
|
||||
$org = $this->Organisaties_model->get(['id'=> $targetOrgID],false, true);
|
||||
$cats = $this->Orgversies_model->getversiecats($org->valtonder_id, $modulenr);
|
||||
}
|
||||
if ($cats){
|
||||
foreach($cats as $cat){
|
||||
$folder =
|
||||
$this->Filefolders_model->get_folder_by_cat($orgID, $cat->nummer, $cat->omschrijving, $modulenr);
|
||||
if (! $folder){
|
||||
$data=[ 'modulenr' =>$modulenr,
|
||||
'organisatie_id' => $orgID,
|
||||
'naam' => $cat->omschrijving,
|
||||
'instrumentcat' =>$cat->nummer];
|
||||
$newID = $this->Filefolders_model->insert_record($data);
|
||||
$this->Filefolders_model->update_record( array('valtonder'=>$newID) , $newID);
|
||||
$folders[] = $this->Filefolders_model->get_folder($newID);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->json($folders);
|
||||
}
|
||||
|
||||
public function maakTopFolder(){
|
||||
//CHECK MANAGER RIGHT
|
||||
if (! $this->isManager() ) return;
|
||||
$nummer = $this->clean_input('nummer');
|
||||
$naam = stripslashes($this->clean_input('naam'));
|
||||
$modulenr = $this->clean_input('modulenr');
|
||||
|
||||
|
||||
$data = ['modulenr' => $modulenr,
|
||||
'organisatie_id' => $this->globorgid,
|
||||
'nummer' => $nummer,
|
||||
'naam' => $naam];
|
||||
|
||||
$newID = $this->Filefolders_model->insert_record($data);
|
||||
$this->Filefolders_model->update_record( array('valtonder'=>$newID), $newID);
|
||||
$folder = $this->Filefolders_model->get_folder($newID);
|
||||
$this->json($folder);
|
||||
}
|
||||
|
||||
public function maakSubFolder(){
|
||||
//CHECK MANAGER RIGHT
|
||||
if (! $this->isManager() ) return;
|
||||
|
||||
$nummer = $this->clean_input('nummer');
|
||||
$naam = stripslashes($this->clean_input('naam'));
|
||||
$modulenr = $this->clean_input('modulenr');
|
||||
$folderID = $this->clean_input('folderID');
|
||||
|
||||
$data=[ 'modulenr' =>$modulenr,
|
||||
'organisatie_id' => $this->globorgid,
|
||||
'nummer' => $nummer,
|
||||
'naam' => $naam,
|
||||
'valtonder' => $folderID];
|
||||
$newID = $this->Filefolders_model->insert_record($data);
|
||||
$folder = $this->Filefolders_model->get_folder($newID);
|
||||
$this->json($folder);
|
||||
}
|
||||
|
||||
public function editFolder(){
|
||||
//CHECK MANAGER RIGHT
|
||||
if (! $this->isManager() ) return;
|
||||
|
||||
$id = $this->clean_input("folderID");
|
||||
$naam = $this->input->post("naam");
|
||||
$nummer = $this->input->post("nummer");
|
||||
$this->Filefolders_model->update_record(['nummer'=> $nummer,'naam'=>$naam], $id);
|
||||
$folder = $this->Filefolders_model->get_folder($id);
|
||||
$this->json($folder->id);
|
||||
|
||||
}
|
||||
|
||||
public function getafwijkendetekst(){
|
||||
$modulenr = $this->clean_input('modulenr');
|
||||
$paginanaam = $this->clean_input('paginanaam');
|
||||
$afwijkend = $this->Teksten_model->gettekst($modulenr, $paginanaam);
|
||||
|
||||
echo json_encode($afwijkend);
|
||||
}
|
||||
|
||||
public function deleteFolder(){
|
||||
//CHECK MANAGER RIGHT
|
||||
if (! $this->isManager() ) return;
|
||||
|
||||
$folderID = $this->uri->segment(4);
|
||||
//TODO check of er geen files of subfolders zijn
|
||||
if ($this->Files_model->get(['folder_id'=>$folderID],false,false) ) return;
|
||||
|
||||
|
||||
$this->Filefolders_model->delete_record($folderID);
|
||||
}
|
||||
|
||||
public function deleteFile(){
|
||||
//check op eigenar
|
||||
$fileID = $this->uri->segment(4);
|
||||
if (! $this->magDelete($fileID) ) return;
|
||||
$bestand = $this->Files_model->get(['id'=>$fileID], false, true);
|
||||
$this->load->helper('file');
|
||||
unlink('../dossier/'.$bestand->new_name);
|
||||
unlink('../pdfdossier/'.$bestand->new_name);
|
||||
$this->Files_model->delete_record($fileID);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function saveFileNaam(){
|
||||
//CHECK MANAGER RIGHT
|
||||
if (! $this->isManager() ) return;
|
||||
|
||||
$id = $this->clean_input("id");
|
||||
$naam = $this->input->post("naam");
|
||||
$this->Files_model->update_record(['original_name'=>$naam], $id);
|
||||
}
|
||||
|
||||
public function getFiles(){
|
||||
//TODO check toegang
|
||||
$folderID = $this->clean_input("folderID");
|
||||
$files = $this->Files_model->get_files($folderID);
|
||||
$this->json($files);
|
||||
}
|
||||
public function zoekFile(){
|
||||
$modulenr = $this->clean_input("modulenr");
|
||||
$zoekterm = strip_slashes($this->clean_input("zoekfile"));
|
||||
$files= $this->Files_model->zoek_files($zoekterm, $this->globorgid);
|
||||
$this->json($files);
|
||||
}
|
||||
|
||||
public function getAuth(){
|
||||
$aut = $this->Autorisaties_model->check_autorisatie($this->userrole, 343);
|
||||
$this->json($aut);
|
||||
}
|
||||
|
||||
private function isManager(){
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole, 343) == 0 ) return false;
|
||||
else return true;
|
||||
}
|
||||
|
||||
private function magDelete($fileid){
|
||||
$owner = $this->Files_model->get(['id'=>$fileid],owner,true);
|
||||
if ($owner == $this->userid) return true;
|
||||
else return false;
|
||||
}
|
||||
public function maakpdf(){
|
||||
//TODO check toegang
|
||||
$module = $this->uri->segment(4);
|
||||
$modulenaam = $this->Modules_model->get(['sysnr'=>$module], 'naam',true);
|
||||
$organisatie = $this->Organisaties_model->getOrganisatie($this->globorgid);
|
||||
$folders = $this->Filefolders_model->get_folders($module, $this->globorgid);
|
||||
if ($folders){
|
||||
foreach($folders as $folder){
|
||||
$folder->subfolders = $this->Filefolders_model->get_subfolders($folder);
|
||||
$folder->files = $this->Files_model->get_files($folder->id);
|
||||
}
|
||||
}
|
||||
$lijst = ['folders' => $folders,
|
||||
'organisatie' => $organisatie,
|
||||
'today' => date('d-m-Y'),
|
||||
'modulenaam' => $modulenaam,
|
||||
'baseURL' =>base_url()];
|
||||
$html = $this->load->view( 'monpas/reports/filefolders', $lijst, true);
|
||||
$this->Phantom_model->create_pdf( $html, 'filefolders', FALSE, FALSE, [] );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class Functies extends MY_Controller
|
||||
{
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$models = array("shared/Functies_model",
|
||||
"shared/Functies_modules_model",
|
||||
"monpas/Modules_model");
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
if (!$this->check_online_status()) {
|
||||
echo json_encode(array('offline' => TRUE));
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
function getModules()
|
||||
{
|
||||
$modules = $this->Modules_model->getallmodules();
|
||||
if ($modules) {
|
||||
echo json_encode($modules);
|
||||
} else {
|
||||
echo false;
|
||||
}
|
||||
}
|
||||
|
||||
function getFuncties()
|
||||
{
|
||||
$moduleid = $this->uri->segment(4);
|
||||
$functies = $this->Functies_model->getFuncties();
|
||||
$functiesmodule = $this->Functies_model->getFunctiesBijModule($moduleid);
|
||||
|
||||
if ($functies) {
|
||||
foreach ($functies as $functie) {
|
||||
$functie->doelgroep = 'F';
|
||||
if ($functiesmodule) {
|
||||
foreach ($functiesmodule as $gekoppeld) {
|
||||
if ($functie->functie_id == $gekoppeld->functie_id) {//vergelijkt de functie_ids van de functies met de functies die bij de module hooren
|
||||
$functie->doelgroep = 'T'; //indien hetzelfde: doelgroep = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($functies && sizeof($functies > 1)) {
|
||||
$test = (array)$functies;
|
||||
usort($test, array($this, 'opDoelgroep'));
|
||||
}
|
||||
echo json_encode($test);
|
||||
|
||||
} else {
|
||||
echo json_encode(false);
|
||||
}
|
||||
}
|
||||
|
||||
function newModuleFunctieKoppeling(){
|
||||
$moduleid = $this->clean_input("moduleid");
|
||||
$functieid = $this->clean_input("functieid");
|
||||
|
||||
if($moduleid && $functieid) {
|
||||
$data = array(
|
||||
'module_id' => $moduleid,
|
||||
'functie_id' => $functieid
|
||||
);
|
||||
|
||||
$this->Functies_modules_model->save_record($data, false);
|
||||
echo json_encode('ok');
|
||||
}
|
||||
else{
|
||||
echo json_encode(false);
|
||||
}
|
||||
}
|
||||
|
||||
function deleteModuleFunctieKoppeling(){
|
||||
$moduleid = $this->clean_input("moduleid");
|
||||
$functieid = $this->clean_input("functieid");
|
||||
|
||||
if($moduleid && $functieid) {
|
||||
$where = array(
|
||||
'module_id' => $moduleid,
|
||||
'functie_id' => $functieid
|
||||
);
|
||||
$this->Functies_modules_model->delete_record_where($where);
|
||||
echo json_encode('ok');
|
||||
}
|
||||
else{
|
||||
echo json_encode(false);
|
||||
}
|
||||
}
|
||||
|
||||
private function opDoelgroep($a, $b)
|
||||
{
|
||||
return strcmp($b->doelgroep, $a->doelgroep);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
class Menu extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array("shared/Users_model",
|
||||
'shared/Organisaties_model',
|
||||
"monpas/Menus_model",
|
||||
"monpas/Modules_model",
|
||||
"monpas/Documenten_model",
|
||||
"shared/Licenties_model",
|
||||
"ijkpartituur/pages_model");
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
public function get_menu(){
|
||||
|
||||
$menu = new stdClass;
|
||||
$user = new stdClass;
|
||||
$organisatie = new stdClass;
|
||||
$module = $this->session->userdata['module'];
|
||||
$modulenaam = '';
|
||||
if ($module >=0){
|
||||
|
||||
if (0 == $module) {$modulenaam = "Instrumenten";}
|
||||
else {$modulenaam= $this->Modules_model->get_fieldvalue(array("sysnr" => $module), 'naamkort'); }
|
||||
|
||||
|
||||
$menu = $this->Menus_model->getmenu($module,$this->userrole);
|
||||
foreach($menu as $menuitem){
|
||||
if($menuitem->holdernaam == "sophoofd"){
|
||||
$menuitem->subpaginas = $this->Menus_model->getsubmenus($menuitem->id, $this->userrole);
|
||||
}
|
||||
}
|
||||
|
||||
$licenties = null;
|
||||
$licenties = $this->Licenties_model->get_licentie($this->orgid);
|
||||
// als licenties voor 1 module, disable de portal knop
|
||||
if ($licenties && $menu && (count($licenties) <= 1)) {
|
||||
$i = 0;
|
||||
$target = -1;
|
||||
foreach($menu as $item){
|
||||
if ($item->naam == "stop") $target = $i;
|
||||
$i ++;
|
||||
}
|
||||
if ($target > -1) unset($menu[$target]);
|
||||
}
|
||||
|
||||
$user = $this->Users_model->get_fullname($this->userid);
|
||||
$organisatie = $this->Organisaties_model->get_orgnaam($this->globorgid);
|
||||
}
|
||||
|
||||
$org = $this->Organisaties_model->get_record_by_id($this->globorgid);
|
||||
if ($org){
|
||||
foreach ($menu as $menuitem){
|
||||
if (strtoupper($menuitem->naam) == "sophoofd"){
|
||||
switch ($org->soort){
|
||||
case 1: $menuitem->naam = "SWOP"; break;
|
||||
case 2: $menuitem->naam = "KOP" ; break;
|
||||
case 3: $menuitem->naam ="BOP"; break;
|
||||
default: $menuitem->naam = "SOP";
|
||||
};//switch
|
||||
}; //if
|
||||
}; // foreach
|
||||
}; //if organisatie
|
||||
|
||||
echo json_encode(array( 'module' =>$module,
|
||||
'modulenaam' => $modulenaam,
|
||||
'menu' =>$menu,
|
||||
'user' => $user,
|
||||
'organisatie' => $organisatie));
|
||||
}
|
||||
function gethandleidingen(){
|
||||
$handleidingen = $this->Documenten_model->gethandleidingen($this->globorgid, $this->userrole);
|
||||
echo json_encode($handleidingen);
|
||||
}
|
||||
function downloadhandleiding(){
|
||||
if( ! $this->userid ) return;
|
||||
$handleidingid = $this->uri->segment(4);
|
||||
$handleiding = $this->Documenten_model->get_record_by_id($handleidingid);
|
||||
|
||||
$this->load->helper('download');
|
||||
// $data = file_get_contents($this->rootpath ."/documents/".$handleiding->documentnaam);
|
||||
$data = file_get_contents("/home/mps/prod/documents/".$handleiding->documentnaam);//TW: rootpath is verkeerd door symlink
|
||||
force_download($handleiding->documentnaam, $data);
|
||||
}
|
||||
function getsubmenu(){
|
||||
//TODO clean input
|
||||
$pageid = $this->uri->segment(4);
|
||||
$submenus = $this->Menus_model->getsubmenus($pageid, $this->userrole);
|
||||
echo json_encode($submenus);
|
||||
}
|
||||
function getmodule(){
|
||||
echo json_encode($this->module);
|
||||
}
|
||||
|
||||
// function scriptSetModules(){
|
||||
// $organisaties = $this->Organisaties_model->getall();
|
||||
// foreach($organisaties as $organisatie){
|
||||
// if ($organisatie->monbas == 1){
|
||||
// $data=array('orgid' =>$organisatie->id, 'modulenr'=>1);
|
||||
// $this->Licenties_model->insert_record($data);
|
||||
// }
|
||||
// if ($organisatie->mondiv == 1){
|
||||
// $data=array('orgid' =>$organisatie->id, 'modulenr'=>2);
|
||||
// $this->Licenties_model->insert_record($data);
|
||||
// }
|
||||
// }; // foreach
|
||||
// echo 'klaar';
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,485 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Organisaties extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
if ($this->nologin) return;
|
||||
$models = array("monpas/Modules_model",
|
||||
'shared/Organisaties_model',
|
||||
'shared/Orgusers_model',
|
||||
"shared/Users_model",
|
||||
"monpas/Versies_model",
|
||||
"monpas/Orgversies_model",
|
||||
"monpas/Filledversions_model",
|
||||
"monpas/Scores_model",
|
||||
"monpas/Ambities_model",
|
||||
"shared/Licenties_model");
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
function getorgsperlevel(){
|
||||
$soort = $this->uri->segment(4);
|
||||
$toporgid = $this->input->post("toporgid");
|
||||
$orgs = $this->Organisaties_model->getorgsdetails($soort,$toporgid);
|
||||
echo json_encode($orgs);
|
||||
}
|
||||
|
||||
function getallowedorgs(){
|
||||
$orgs =null;
|
||||
if ($this->super || $this->userrole == 2){
|
||||
$orgs = $this->Organisaties_model->getallorgs();
|
||||
}
|
||||
else {
|
||||
$orgs = $this->Organisaties_model->getuserorgs($this->userid);
|
||||
if (count($orgs) == 1) $orgs = null; // als er maar 1 organisatie is , kan de gebruiker niet switchen
|
||||
}
|
||||
echo json_encode($orgs);
|
||||
}
|
||||
function setgloborg(){
|
||||
//TODO sanitize input
|
||||
$newOrgid = $this->uri->segment(4);
|
||||
$userrole = $this->Orgusers_model->getuserrole($this->userid, $newOrgid);
|
||||
|
||||
if ($this->super || $this->userrole ==2){
|
||||
$this->Session_model->set_globorgid($newOrgid);
|
||||
$module = $this->session->userdata('module');
|
||||
$allowed = $this->Licenties_model->get_records_where(array("orgid"=> $newOrgid, "modulenr"=>$module));
|
||||
if(!$allowed){
|
||||
$this->Session_model->set_module(0);
|
||||
};
|
||||
}
|
||||
// set nu ook de rol van de user in de geselecteerde organisatie;
|
||||
else {
|
||||
if ($userrole) {
|
||||
$this->Session_model->set_orgid($newOrgid);
|
||||
$this->Session_model->set_globorgid($newOrgid);
|
||||
$this->Session_model->set_role($userrole->nivo);
|
||||
}
|
||||
}
|
||||
echo json_encode(array("basepath"=>base_url()));
|
||||
}
|
||||
function insertorganisatie(){
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole, SUPERUSER) > 0) {
|
||||
$errortekst = '';
|
||||
$neworg = null;
|
||||
$nummer = $this->input->post("nummer");
|
||||
if ($this->Organisaties_model->check_for_record(array("brin"=>$nummer))) {
|
||||
$errortekst= "Nummer bestaat al.";
|
||||
}
|
||||
else {
|
||||
$data=array( "soort" =>$this->input->post("soort"),
|
||||
"brin" =>$this->input->post("nummer"),
|
||||
"naamkort" =>$this->input->post("naamkort"),
|
||||
"naam" =>$this->input->post("naam"),
|
||||
"plaats" =>$this->input->post("plaats"),
|
||||
"valtonder_id" =>$this->input->post("valtonder"),
|
||||
"actief" =>1,
|
||||
);
|
||||
$newid = $this->Organisaties_model->insert_record($data);
|
||||
$licenties = $this->input->post('licenties');
|
||||
if ($licenties){
|
||||
foreach($licenties as $licentie){
|
||||
$this->Licenties_model->insert_record(array("orgid"=>$newid, "modulenr"=>$licentie));
|
||||
}
|
||||
}; //if
|
||||
if ($this->input->post("soort") == 1){
|
||||
$this->Organisaties_model->update_record(array("valtonder_id"=>$newid), $newid);
|
||||
}
|
||||
$neworg = $this->Organisaties_model->getorgdetails($newid);
|
||||
};
|
||||
}
|
||||
else { $errortekst = "u bent niet geautoriseerd tot deze handeling" ;
|
||||
$neworg = false;}; // als geen superuser
|
||||
echo json_encode(array("errortekst" => $errortekst, "org" =>$neworg));
|
||||
}
|
||||
|
||||
function deleteorg(){
|
||||
//TODO clean input
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole, SUPERUSER) > 0) {
|
||||
$orgid = $this->uri->segment(4);
|
||||
$errortekst = '';
|
||||
|
||||
if ($this->Orgusers_model->check_for_record(array("organisatie_id" =>$orgid)) ){
|
||||
$errortekst = "Er zijn gebruikers gekoppeld aan deze organisatie.</br>";
|
||||
}
|
||||
if ($this->Organisaties_model->hasdependent($orgid) ) {
|
||||
$errortekst .= " Er zijn afhankelijke organisaties. </br>" ;
|
||||
}
|
||||
//ambities, filled versions, orgversies,scores, licenties
|
||||
if ($errortekst == ''){
|
||||
$filledversions = $this->Filledversions_model->get_records_where(array("organisatie_id" =>$orgid));
|
||||
if ($filledversions){
|
||||
foreach($filledversions as $fv){
|
||||
$this->Scores_model->delete_record_where(array("filledversion_id"=>$fv->id));
|
||||
$this->Filledversions_model->delete_record($fv->id);
|
||||
}
|
||||
}
|
||||
$this->Ambities_model->delete_record_where(array("organisatie_id"=>$orgid));
|
||||
$this->Orgversies_model->delete_record_where(array("organisatie_id" =>$orgid));
|
||||
$this->Licenties_model->delete_record_where(array("orgid" =>$orgid));
|
||||
$this->Organisaties_model->delete_record($orgid);
|
||||
}
|
||||
}
|
||||
else {$errortekst = "U bent niet geautoriseerd voor deze handeling.";};
|
||||
echo json_encode($errortekst);
|
||||
}
|
||||
function update(){
|
||||
//TODO clean input
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole, SUPERUSER) > 0) {
|
||||
$orgid =$this->input->post("id");
|
||||
$errortekst = '';
|
||||
$nummer = $this->input->post("nummer");
|
||||
if ($this->Organisaties_model->check_for_record(array("brin"=>$nummer,
|
||||
"id <> " =>$orgid))) {
|
||||
$errortekst= "Nummer bestaat al.";
|
||||
}
|
||||
else {
|
||||
$actief = 1;
|
||||
if ($this->input->post("actief")=="false") $actief = 0;
|
||||
// $monbas=1;
|
||||
// if ($this->input->post("monbas")=="false") $monbas = 0;
|
||||
// $mondiv = 1;
|
||||
// if ($this->input->post("mondiv")=="false") $mondiv = 0;
|
||||
|
||||
$data=array( "brin" =>$this->input->post("nummer"),
|
||||
"naamkort" =>$this->input->post("naamkort"),
|
||||
"naam" =>$this->input->post("naam"),
|
||||
"plaats" =>$this->input->post("plaats"),
|
||||
"actief" =>$actief,
|
||||
// "monbas" =>$monbas,
|
||||
// "mondiv" =>$mondiv
|
||||
);
|
||||
$this->Organisaties_model->update_record($data,$orgid);
|
||||
$this->Licenties_model->delete_record_where(array("orgid"=>$orgid));
|
||||
$licenties = $this->input->post("licenties");
|
||||
if ($licenties){
|
||||
foreach ($licenties as $licentie){
|
||||
$this->Licenties_model->insert_record(array("orgid"=>$orgid, "modulenr"=>$licentie));
|
||||
}; // foreach
|
||||
}; // if licenties
|
||||
|
||||
}
|
||||
}
|
||||
else {$errortekst = " U bent niet geautoriseerd voor deze handeling.";};
|
||||
echo json_encode($errortekst);
|
||||
}
|
||||
function zoek(){
|
||||
//TODO clean input
|
||||
$errortekst="";
|
||||
$zoekstr = $this->input->post("zoekstring");
|
||||
$results = $this->Organisaties_model->zoekorgs($zoekstr);
|
||||
if (!$results){$errortekst = "Geen resultaten gevonden";};
|
||||
if (count($results) > 150) {
|
||||
$errortekst ="Teveel overeenkomende gegevens gevonden. Maak uw zoekcriteria specifieker.";
|
||||
$results = '';}
|
||||
echo json_encode(array("results"=>$results, "errortekst" =>$errortekst));
|
||||
}
|
||||
function getselected(){
|
||||
//TODO clean input
|
||||
$orgid = $this->uri->segment(4);
|
||||
$swvid = null;
|
||||
$kamerid = null;
|
||||
$bgid = null;
|
||||
$schoolid = null;
|
||||
$swvs = null;
|
||||
$kamers = null;
|
||||
$bgs = null;
|
||||
$scholen = null;
|
||||
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($orgid);
|
||||
|
||||
if ($organisatie->soort == 1){
|
||||
$swvid = $orgid;
|
||||
}
|
||||
|
||||
if ($organisatie->soort == 2){
|
||||
$swvid = $organisatie->valtonder_id;
|
||||
$kamerid = $orgid;
|
||||
}; // if soort =2
|
||||
|
||||
if ($organisatie->soort == 3){
|
||||
$bgid = $organisatie->id;
|
||||
$kamerid = $organisatie->valtonder_id;
|
||||
$kamerorg = $this->Organisaties_model->get_record_by_id($kamerid);
|
||||
$swvid = $kamerorg->valtonder_id;
|
||||
}; // if soort = 3
|
||||
|
||||
if ($organisatie->soort == 4){
|
||||
$schoolid = $orgid;
|
||||
$bgid = $organisatie->valtonder_id;
|
||||
$orgbg = $this->Organisaties_model->get_record_by_id($bgid);
|
||||
$kamerid = $orgbg->valtonder_id;
|
||||
$orgkamer = $this->Organisaties_model->get_record_by_id($kamerid);
|
||||
$swvid = $orgkamer->valtonder_id;
|
||||
}; // if soort = 4
|
||||
|
||||
$swvs=$this->Organisaties_model->getorgsdetails(1, false);
|
||||
foreach ($swvs as $swv) {
|
||||
if ($swv->id == $swvid){
|
||||
$kamers = $this->Organisaties_model->getorgsdetails(2,$swvid);
|
||||
if ($kamers){
|
||||
if (!$kamerid) {$kamerid = $kamers[0]->id; };
|
||||
foreach ($kamers as $kamer){
|
||||
if ($kamer->id == $kamerid){
|
||||
$bgs = $this->Organisaties_model->getorgsdetails(3, $kamerid);
|
||||
if ($bgs){
|
||||
if (!$bgid){$bgid = $bgs[0]->id;};
|
||||
foreach ($bgs as $bg){
|
||||
if ($bg->id == $bgid){
|
||||
$scholen = $this->Organisaties_model->getorgsdetails(4,$bgid);
|
||||
}
|
||||
};// foreach bg
|
||||
}; // if bgs
|
||||
}; // if kamerid = kamerid
|
||||
}; // foreach kamers
|
||||
}; // if kamers
|
||||
}; // if swvid
|
||||
} ; // foreach swv
|
||||
echo json_encode(array('swvid' =>$swvid,
|
||||
'kamerid' =>$kamerid,
|
||||
'bgid' =>$bgid,
|
||||
'schoolid' =>$schoolid,
|
||||
'swvs' =>$swvs,
|
||||
'kamers' =>$kamers,
|
||||
'bgs' =>$bgs,
|
||||
'scholen' =>$scholen));
|
||||
|
||||
}
|
||||
function getorgnivo(){
|
||||
$nivo =$this->Organisaties_model->getsoortvanorginalorg($this->userid);
|
||||
echo json_encode($nivo);
|
||||
}
|
||||
|
||||
function getscholenvoormenu(){
|
||||
$modulenr = $this->uri->segment(4);
|
||||
$orgid = $this->globorgid;
|
||||
$bgs=array();
|
||||
$scholen=array();
|
||||
$org = $this->Organisaties_model->get_record_by_id($orgid);
|
||||
if ($org->soort == 1){
|
||||
$kamers=$this->Organisaties_model->getorgsvanaf($orgid);
|
||||
if ($kamers) {
|
||||
foreach($kamers as $kamer){
|
||||
$bg =$this->Organisaties_model->getorgsvanaf($kamer->id);
|
||||
if ($bg){$bgs=array_merge($bgs,$bg); };
|
||||
}
|
||||
}
|
||||
if ($bgs) {
|
||||
foreach($bgs as $bg){
|
||||
if($modulenr == 270) {
|
||||
$schl = $this->Organisaties_model->getorgsvanafmetlicentie($bg->id, $modulenr);
|
||||
}
|
||||
else{
|
||||
$schl = $this->Organisaties_model->getorgsvanaf($bg->id);
|
||||
}
|
||||
if ($schl){
|
||||
$scholen=array_merge($scholen, $schl);
|
||||
};
|
||||
}
|
||||
}
|
||||
}; // if orgsoort ==1
|
||||
if ($org->soort ==2){
|
||||
$bgs = $this->Organisaties_model->getorgsvanaf($orgid);
|
||||
if ($bgs){
|
||||
foreach($bgs as $bg){
|
||||
if($modulenr == 270) {
|
||||
$schl = $this->Organisaties_model->getorgsvanafmetlicentie($bg->id, $modulenr);
|
||||
}
|
||||
else{
|
||||
$schl = $this->Organisaties_model->getorgsvanaf($bg->id);
|
||||
}
|
||||
if ($schl){
|
||||
$scholen=array_merge($scholen, $schl);
|
||||
}; // if schl
|
||||
}
|
||||
}
|
||||
}; // if orgsoort =2
|
||||
if ($org->soort ==3 ){
|
||||
if($modulenr == 270) {
|
||||
$schl = $this->Organisaties_model->getorgsvanafmetlicentie($orgid, $modulenr);
|
||||
}
|
||||
else{
|
||||
$schl = $this->Organisaties_model->getorgsvanaf($orgid);
|
||||
}
|
||||
}
|
||||
if ($org->soort == 4){
|
||||
$scholen[]= $org;
|
||||
}
|
||||
$school = true;
|
||||
if ($org->soort != 4) $school=false;
|
||||
|
||||
|
||||
echo json_encode(array('scholen'=>$scholen, 'school'=>$school));
|
||||
|
||||
|
||||
}
|
||||
|
||||
function getscholen(){
|
||||
$orgid = $this->globorgid;
|
||||
$bgs=array();
|
||||
$scholen=array();
|
||||
$org = $this->Organisaties_model->get_record_by_id($orgid);
|
||||
if ($org->soort == 1){
|
||||
$kamers=$this->Organisaties_model->getorgsvanaf($orgid);
|
||||
if ($kamers) {
|
||||
foreach($kamers as $kamer){
|
||||
$bg =$this->Organisaties_model->getorgsvanaf($kamer->id);
|
||||
if ($bg){$bgs=array_merge($bgs,$bg); };
|
||||
}
|
||||
}
|
||||
if ($bgs) {
|
||||
foreach($bgs as $bg){
|
||||
$schl = $this->Organisaties_model->getorgsvanaf($bg->id);
|
||||
if ($schl){
|
||||
$scholen=array_merge($scholen, $schl);
|
||||
};
|
||||
}
|
||||
}
|
||||
}; // if orgsoort ==1
|
||||
if ($org->soort ==2){
|
||||
$bgs = $this->Organisaties_model->getorgsvanaf($orgid);
|
||||
if ($bgs){
|
||||
foreach($bgs as $bg){
|
||||
$schl = $this->Organisaties_model->getorgsvanaf($bg->id);
|
||||
if ($schl){
|
||||
$scholen=array_merge($scholen, $schl);
|
||||
}; // if schl
|
||||
}
|
||||
}
|
||||
}; // if orgsoort =2
|
||||
if ($org->soort ==3 ){
|
||||
$scholen = $this->Organisaties_model->getorgsvanaf($org->id);
|
||||
}
|
||||
if ($org->soort == 4){
|
||||
$scholen[]= $org;
|
||||
}
|
||||
$school = true;
|
||||
if ($org->soort != 4) $school=false;
|
||||
echo json_encode(array('scholen'=>$scholen, 'school'=>$school));
|
||||
}
|
||||
|
||||
function getsoscholen(){
|
||||
$orgid = $this->globorgid;
|
||||
$bgs=array();
|
||||
$scholen=array();
|
||||
$instrument = 270;
|
||||
$org = $this->Organisaties_model->get_record_by_id($orgid);
|
||||
if ($org->soort == 1){
|
||||
$kamers=$this->Organisaties_model->getorgsvanaf($orgid);
|
||||
if ($kamers) {
|
||||
foreach($kamers as $kamer){
|
||||
$bg =$this->Organisaties_model->getorgsvanaf($kamer->id);
|
||||
if ($bg){$bgs=array_merge($bgs,$bg); };
|
||||
}
|
||||
}
|
||||
if ($bgs) {
|
||||
foreach($bgs as $bg){
|
||||
$schl = $this->Organisaties_model->getorgsvanafmetlicentie($bg->id, $instrument);
|
||||
if ($schl){
|
||||
$scholen=array_merge($scholen, $schl);
|
||||
};
|
||||
}
|
||||
}
|
||||
}; // if orgsoort ==1
|
||||
if ($org->soort ==2){
|
||||
$bgs = $this->Organisaties_model->getorgsvanaf($orgid);
|
||||
if ($bgs){
|
||||
foreach($bgs as $bg){
|
||||
$schl = $this->Organisaties_model->getorgsvanafmetlicentie($bg->id, $instrument);
|
||||
if ($schl){
|
||||
$scholen=array_merge($scholen, $schl);
|
||||
}; // if schl
|
||||
}
|
||||
}
|
||||
}; // if orgsoort =2
|
||||
if ($org->soort ==3 ){
|
||||
$scholen = $this->Organisaties_model->getorgsvanafmetlicentie($org->id, $instrument);
|
||||
}
|
||||
if ($org->soort == 4){
|
||||
$scholen[]= $org;
|
||||
}
|
||||
$school = true;
|
||||
if ($org->soort != 4) $school=false;
|
||||
|
||||
|
||||
echo json_encode(array('soscholen'=>$scholen, 'school'=>$school));
|
||||
}
|
||||
|
||||
function controleerschool(){
|
||||
if (!$this->userid) die;
|
||||
$orgid = $this->globorgid;
|
||||
$school = false;
|
||||
$organisatie = $this->Organisaties_model->get_record_by_id($orgid);
|
||||
if ($organisatie && $organisatie->soort == 4) $school = true;
|
||||
echo json_encode($school);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getselectedschool(){
|
||||
echo json_encode($this->selectedschool);
|
||||
}
|
||||
|
||||
function getmodules(){
|
||||
$orgid = $this->uri->segment(4); // als 0 dan nieuwe organisatie
|
||||
$modules = $this->Modules_model->getallmodules();
|
||||
if ($modules){
|
||||
foreach($modules as $module){
|
||||
$module->janee =$this->Licenties_model->getmodulelicentie($orgid, $module->sysnr);
|
||||
}
|
||||
}; // if modules
|
||||
echo json_encode($modules);
|
||||
}
|
||||
|
||||
function getRandomName(){
|
||||
$this->load->helper('string');
|
||||
return random_string("alnum", 20);
|
||||
}
|
||||
|
||||
function deleteOldBijlage($orgID){
|
||||
$oldBijlage = $this->Organisaties_model->get(['id'=>$orgID],'randomname', true);
|
||||
if ($oldBijlage) unlink('./../docs/'.$oldBijlage);
|
||||
}
|
||||
|
||||
function setNieuweBijlage($orgID, $randomname, $filename){
|
||||
$this->Organisaties_model->update_record(['randomname'=>$randomname, 'bijlagefile'=>$filename], $orgID);
|
||||
}
|
||||
|
||||
function saveBijlageFile(){
|
||||
$randomname = $this->getRandomName();
|
||||
|
||||
$config['upload_path'] = './../docs/';
|
||||
$config['allowed_types'] = '*';
|
||||
$config['max_size'] = 10000;
|
||||
$config['file_name'] = $randomname;
|
||||
|
||||
$this->load->library('upload', $config);
|
||||
|
||||
$orgID = $_POST['orgID'];
|
||||
$filename = $_FILES['file']['name'];
|
||||
|
||||
|
||||
if ( ! $this->upload->do_upload('file')) $error = $this->upload->display_errors();
|
||||
else {
|
||||
$error = FALSE;
|
||||
$randomname = $this->upload->data('file_name')['file_name'];
|
||||
$this->deleteOldBijlage($orgID);
|
||||
$this->setNieuweBijlage($orgID, $randomname, $filename);
|
||||
}
|
||||
$this->json($error);
|
||||
}
|
||||
|
||||
function deleteBijlage(){
|
||||
// nog een controle op autorisatie?
|
||||
if ( $this->Autorisaties_model->check_autorisatie($this->userrole, 1) <= 0 ) return;
|
||||
$orgID = $this->clean_input('orgID');
|
||||
$this->deleteOldBijlage($orgID);
|
||||
$this->Organisaties_model->update_record(['bijlagefile'=>NULL, 'randomname'=>NULL],$orgID);
|
||||
}
|
||||
} // controller
|
||||
@@ -0,0 +1,287 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
|
||||
|
||||
class Portal extends MY_Controller {
|
||||
|
||||
function __construct() {
|
||||
parent::__construct();
|
||||
$models = array( "shared/Session_model",
|
||||
"shared/Licenties_model",
|
||||
"shared/Organisaties_model",
|
||||
"shared/Users_model",
|
||||
"shared/Orgusers_model",
|
||||
"shared/Functies_model",
|
||||
"monpas/Home_model",
|
||||
"monpas/Orgversies_model",
|
||||
"monpas/Scores_model",
|
||||
"monpas/Labels_model",
|
||||
"monpas/Modules_model");
|
||||
$this->load->model($models);
|
||||
$this->load->library('monpas/kleurcodes');
|
||||
$this->load->helper('string');
|
||||
if (!$this->check_online_status()) {
|
||||
echo json_encode(array('offline' => TRUE));
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
|
||||
function naarmodule() {
|
||||
if ($this->nologin) return;
|
||||
$module = $this->uri->segment(4);
|
||||
$this->Session_model->set_module($module);
|
||||
}
|
||||
|
||||
|
||||
function getlicenties() {
|
||||
$ongeclusterdId = 0;
|
||||
$isCluster = 'F';
|
||||
$ongeclusterd = $this->Licenties_model->get_ongeclusterd($this->globorgid, $ongeclusterdId);
|
||||
if ($ongeclusterd){
|
||||
foreach ($ongeclusterd as $bolletje) {
|
||||
$bolletje->isCluster = $isCluster;//geen knop om het cluster te openen en te sluiten
|
||||
}
|
||||
} else {
|
||||
$ongeclusterd = [];
|
||||
};
|
||||
$isCluster = 'T';
|
||||
$clusters = $this->Licenties_model->get_clusters_org($this->globorgid);
|
||||
if($clusters) {
|
||||
$i = -1;
|
||||
foreach ($clusters as $cluster) {
|
||||
$i ++;
|
||||
if ($cluster->aantalmodules == 1) {
|
||||
$cluster->isCluster = "F";
|
||||
$newitem = $this->Licenties_model->get_ongeclusterd($this->globorgid, $cluster->id);
|
||||
$ongeclusterd = array_merge($ongeclusterd, $newitem);
|
||||
unset($clusters[$i]);
|
||||
} else {
|
||||
$cluster->isCluster = $isCluster; //ivm knop om het cluster te openen en te sluiten
|
||||
$cluster->sub = $this->Licenties_model->get_licentie_cluster($this->globorgid, $cluster->id);//instrumenten bij het cluster
|
||||
$cluster->cluster_id = $cluster->id; //zodat cluster en instrument eenzelfde attribuut hebben
|
||||
}
|
||||
};
|
||||
}; // if $clusters
|
||||
|
||||
if (! $ongeclusterd){
|
||||
$ongeclusterd = [];
|
||||
};
|
||||
if(!$clusters){
|
||||
$clusters = [];
|
||||
};
|
||||
|
||||
$licenties = array_merge($ongeclusterd, $clusters);
|
||||
usort($licenties, array($this, 'opAlfabet'));//bollen op alfbetische volgorde
|
||||
|
||||
echo json_encode($licenties);
|
||||
}
|
||||
|
||||
/**
|
||||
* haalt individuele instrumenten op voor orgusers met een bij het instrument horende functie.
|
||||
* Voor export naar monPon
|
||||
*/
|
||||
|
||||
function getBollenMonPon()
|
||||
{
|
||||
$portalorg = 5;
|
||||
$portaluser = 6;
|
||||
$orgid = $this->Organisaties_model->get_fieldvalue(array('portal_id'=>$portalorg),"id");
|
||||
$userid = $this->Users_model->get_fieldvalue(array('portal_id'=>$portaluser),"id");
|
||||
|
||||
$functiebollen = [];
|
||||
$functiesuser = $this->Functies_model->getFunctiesOrguser($orgid, $userid);
|
||||
|
||||
if (!$functiesuser) {
|
||||
return;
|
||||
}
|
||||
|
||||
$bollen = $this->Modules_model->get_instrumenten_ind_org($orgid);
|
||||
if (!$bollen) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($bollen as $bolletje) {
|
||||
$functiesmod = $this->Functies_model->getFunctiesBijModule($bolletje->moduleid);
|
||||
if ($functiesmod) {
|
||||
|
||||
foreach ($functiesmod as $mfunctie) {
|
||||
foreach ($functiesuser as $userfunctie) {
|
||||
if ($mfunctie->functie_id == $userfunctie->functieid) {
|
||||
$bolletje->userid = $userfunctie->userid;
|
||||
$bolletje->fullname = $userfunctie->fullname;
|
||||
|
||||
if (sizeof($functiebollen) < 1) {
|
||||
array_push($functiebollen, $bolletje);
|
||||
} else {
|
||||
foreach ($functiebollen as $fbol) {
|
||||
if ($fbol->moduleid != $bolletje->moduleid) {
|
||||
array_push($functiebollen, $bolletje);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
$functiebollen = array_map("unserialize", array_unique(array_map("serialize", $functiebollen)));//verwijdert dubbele instrumenten
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$bollendef = $this->getIngevuldeInstrumenten($userid, $orgid, $functiebollen);
|
||||
echo json_encode($bollendef);
|
||||
}
|
||||
|
||||
function getAgendaMonPon(){
|
||||
if (!$this->userid) die;
|
||||
$filledversionid = $this->uri->segment(4);
|
||||
$scores = null;
|
||||
$gewenst = null;
|
||||
// let op ja nee bezig wordt vertaald naar 10, 0 en 5
|
||||
|
||||
$scores = $this->Scores_model->calculateindividualMonPon($filledversionid);
|
||||
|
||||
// haal ook nog de criteria van de organisatie op
|
||||
foreach($scores as $score){
|
||||
$score->gem = 0;
|
||||
if ($score->num > 0){
|
||||
$score->gem = round($score->somscore / $score->num,1);
|
||||
}
|
||||
$score->huidig= $this->kleurcodes->getnummer($score->gem);
|
||||
} ; // foreach scores
|
||||
|
||||
|
||||
// $gewenst=$this->Scores_model->getgewenst($orgid, $orgversieid);
|
||||
// if ($gewenst){
|
||||
// $i =0;
|
||||
// foreach($scores as $score){
|
||||
// $score->gewenstid= $gewenst[$i]->id;
|
||||
// $score->gewenst = $gewenst[$i]->wens;
|
||||
// $i = $i + 1;
|
||||
// }; //foreach
|
||||
// }
|
||||
echo json_encode(array('scores' =>$scores));
|
||||
} // getscores
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function kiesCluster(){
|
||||
$clusterId = $this->uri->segment(4);
|
||||
|
||||
$ongeclusterdId = 0;
|
||||
$isCluster = 'F';
|
||||
$wasniveau2 = 'F'; //hingen voor de keuze niet aan cluster
|
||||
|
||||
$ongeclusterd = $this->Licenties_model->get_ongeclusterd($this->globorgid, $ongeclusterdId);
|
||||
//instrumenten die niet bij een cluster horen
|
||||
if($ongeclusterd) {
|
||||
foreach ($ongeclusterd as $bol) {
|
||||
$bol->wasNiveau2 = $wasniveau2;
|
||||
$bol->isCluster = $isCluster;
|
||||
}
|
||||
}
|
||||
$isCluster = 'T';
|
||||
$clusters = $this->Licenties_model->get_clusters_org($this->globorgid);
|
||||
if($clusters) {
|
||||
foreach ($clusters as $cluster) {
|
||||
$cluster->wasNiveau2 = $wasniveau2;
|
||||
$cluster->isCluster = $isCluster;
|
||||
}
|
||||
};
|
||||
|
||||
$isCluster = 'F';
|
||||
$wasniveau2 = 'T';
|
||||
$keuze = $this->Licenties_model->get_ongeclusterd($this->globorgid, $clusterId); //gekozen cluster van instrumenten
|
||||
if($keuze) {
|
||||
foreach ($keuze as $keus) {
|
||||
$keus->wasNiveau2 = $wasniveau2;// waren bollen onde cluster nu niveau hoger
|
||||
$keus->isCluster = $isCluster;
|
||||
}
|
||||
};
|
||||
if($clusters) {
|
||||
foreach ($clusters as $cluster) {
|
||||
$cluster->cluster_id = $cluster->id;
|
||||
if ($cluster->cluster_id != $clusterId) { //voeg instrumenten toe aan niet-gekozen clusters
|
||||
$cluster->sub = $this->Licenties_model->get_licentie_cluster($this->globorgid, $cluster->id);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if(!$clusters){
|
||||
$clusters =[];
|
||||
};
|
||||
if(!$ongeclusterd){
|
||||
$ongeclusterd = [];
|
||||
};
|
||||
|
||||
$licenties = array_merge($ongeclusterd, $clusters);
|
||||
usort($licenties, array($this, 'opAlfabet'));
|
||||
usort($keuze, array($this, 'opAlfabet'));
|
||||
$clusternaam = $this->Licenties_model->get_clusterNaam($clusterId);
|
||||
|
||||
$geselecteerd = $this->arrayinArray($licenties, $keuze, $clusterId, $clusternaam);
|
||||
|
||||
echo json_encode($geselecteerd);
|
||||
}
|
||||
|
||||
|
||||
function getmodule() {
|
||||
$module = $this->session->userdata['module'];
|
||||
$hometekst = $this->Home_model->get_fieldvalue(['modulenr' => $module], 'tekst');
|
||||
echo json_encode(['module' => $module, 'hometekst' => $hometekst]);
|
||||
}
|
||||
|
||||
private function arrayinArray($knipArray, $invoegArray, $var1, $var2) {
|
||||
$lengte = count($knipArray);
|
||||
$breekpunt = "";
|
||||
$eindpunt = "";
|
||||
|
||||
for ($i = 0; $i < $lengte; $i++) {
|
||||
if ($knipArray[$i]->id == $var1 && $knipArray[$i]->naam == $var2) {
|
||||
$breekpunt = $i + 1; //array wordt geknipt na het cluster van de keuze
|
||||
$eindpunt = $lengte - $breekpunt - 1;
|
||||
}
|
||||
|
||||
$licenties1 = array_slice($knipArray, 0, $breekpunt);
|
||||
$licenties2 = array_slice($knipArray, $breekpunt + 1, $eindpunt);
|
||||
$doelArray = array_merge($licenties1, $invoegArray, $licenties2); //array invoegen na breekpunt
|
||||
|
||||
}
|
||||
return $doelArray;
|
||||
}
|
||||
|
||||
private function opAlfabet($a, $b)
|
||||
{
|
||||
return strcmp($a->naam, $b->naam);
|
||||
}
|
||||
|
||||
|
||||
private function getIngevuldeInstrumenten($userid, $orgid, $bollen){
|
||||
|
||||
foreach ($bollen as $bolletje){
|
||||
$versies = $this->Modules_model->get_instrumenten_ingevuld_ind($bolletje->moduleid, $userid, $orgid);
|
||||
|
||||
if($versies){
|
||||
$bolletje->ingevuld = 'T';
|
||||
$bolletje->versies = $versies;
|
||||
$bolletje->label = $this->Labels_model->getLabel($bolletje->sysnr);
|
||||
}
|
||||
else{
|
||||
$bolletje->ingevuld = 'F';
|
||||
}
|
||||
}
|
||||
|
||||
return $bollen;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Schooljaren extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$models = array("shared/Users_model",'shared/Schooljaren_model');
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
}
|
||||
|
||||
function getschooljaren(){
|
||||
$schooljaren = $this->Schooljaren_model->getschooljaren();
|
||||
echo json_encode($schooljaren);
|
||||
}
|
||||
|
||||
function getselectedschooljaar(){
|
||||
echo json_encode($this->schooljaar);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
use Pheanstalk\Pheanstalk;
|
||||
|
||||
class Upload extends MY_Controller {
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$models = array( "shared/Files_model");
|
||||
$this->load->model($models);
|
||||
|
||||
if (!$this->check_online_status()) {
|
||||
echo json_encode(array('offline' => TRUE));
|
||||
die;
|
||||
};// if
|
||||
$this->load->helper("file");
|
||||
}
|
||||
|
||||
function random_str($length, $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
|
||||
{
|
||||
$str = '';
|
||||
$max = mb_strlen($keyspace, '8bit') - 1;
|
||||
|
||||
for ($i = 0; $i < $length; ++$i) {
|
||||
$str .= $keyspace[rand(0, $max)];
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
private function CheckFileExists($naam, $modulenr){
|
||||
$exists = $this->Files_model->file_exists($naam, $modulenr, $this->globorgid);
|
||||
return $exists;
|
||||
}
|
||||
|
||||
public function doUpload()
|
||||
{
|
||||
$folder = $this->input->post('folderID');
|
||||
$module = $this->input->post('module');
|
||||
$oldDocID = $this->input->post('oldDocID');
|
||||
|
||||
|
||||
$fn = '';
|
||||
if (isset ($_FILES['upload_file'])){
|
||||
$fn = $_FILES['upload_file'];
|
||||
}
|
||||
$this->sharedUpload($fn, $folder, $module,$oldDocID);
|
||||
|
||||
}
|
||||
private function sharedUpload($fn, $folder, $module,$docID = false){
|
||||
$newName = $this->random_str(12);
|
||||
$fileExists = $this->CheckFileExists($fn['name'], $module);
|
||||
// nog afvangen : file exists maar een doc id meegegeven: dan moet de file overschreven worden
|
||||
$error ='';
|
||||
if ($fn) {
|
||||
$ext =end(explode('.', $fn['name']) );
|
||||
if ($ext) $ext = '.'. $ext;
|
||||
|
||||
if ($fileExists) { $error=$fn['name'].": bestand is al geupload"; };
|
||||
if ($error <=''){
|
||||
if (move_uploaded_file( $fn['tmp_name'] , '../dossier/'.$newName ) ) {
|
||||
|
||||
$data = ['organisatie_id' =>$this->globorgid,
|
||||
'folder_id' =>$folder,
|
||||
'original_name' =>$fn['name'],
|
||||
'new_name' =>$newName,
|
||||
'modified' =>date('Y-m-d h:i:s'),
|
||||
'owner' =>$this->userid ,
|
||||
'extension' =>$ext ];
|
||||
$newID = $this->Files_model->insert_record($data);
|
||||
if ($newID){ $this->queueConversion($newID); }
|
||||
}
|
||||
};
|
||||
} else{
|
||||
$error .= $fn.' fout bij uploaden';
|
||||
}
|
||||
echo $error;
|
||||
}
|
||||
|
||||
public function doDropUpload(){
|
||||
|
||||
$folder = $this->uri->segment(4);
|
||||
$module = $this->uri->segment(5);
|
||||
|
||||
$fn = '';
|
||||
|
||||
$fn = $_FILES['file'];
|
||||
$this->sharedUpload($fn, $folder, $module);
|
||||
}
|
||||
|
||||
private function queueConversion( $fileID ) {
|
||||
$pheanstalk = new Pheanstalk( '127.0.0.1' );
|
||||
|
||||
$job = new stdClass();
|
||||
|
||||
$job->function = 'convertDocument';
|
||||
$job->user_data = $fileID;
|
||||
$job_data = json_encode( $job );
|
||||
|
||||
$pheanstalk
|
||||
->useTube( $this->beanstalkPipe )
|
||||
->put( $job_data );
|
||||
}
|
||||
|
||||
public function show_pdf(){
|
||||
$fileID= $this->uri->segment( 4 );
|
||||
// TODO check file toegangsrecht
|
||||
$file = $this->Files_model->get(['id'=>$fileID],false,true);
|
||||
if (! $file) {
|
||||
$this->json('file niet gevonden');
|
||||
return;
|
||||
}
|
||||
if (! ($file->extension == ".pdf" || $file->conversion_status == 'WORD-PDF-CONVERSION-SUCCEEDED')){
|
||||
$this->json('geen pdf beschikbaar');
|
||||
return;
|
||||
}
|
||||
if ($file->extension == ".pdf") $fullpath = $this->dossierpath;
|
||||
else $fullpath = $this->pdfpath;
|
||||
|
||||
$fullpath = $fullpath . $file->new_name;
|
||||
|
||||
header( 'Content-Description: File Transfer' );
|
||||
header( 'Content-Type: application/pdf' );
|
||||
header( 'Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0' );
|
||||
header( 'Pragma: public' );
|
||||
header( 'Content-Length: ' . filesize( $fullpath) );
|
||||
readfile( $fullpath );
|
||||
}
|
||||
|
||||
public function download_file(){
|
||||
//TODO check toegangsrecht
|
||||
$fileID = $this->uri->segment(4);
|
||||
$document = $this->Files_model->get(['id'=>$fileID],false,true);
|
||||
if (! $document) {
|
||||
$this->json('Document niet gevonden');
|
||||
return;
|
||||
}
|
||||
$this->load->helper( 'download' );
|
||||
$data = file_get_contents( $this->dossierpath . $document->new_name );
|
||||
force_download( $document->original_name, $data );
|
||||
}
|
||||
|
||||
public function download_bijlage(){
|
||||
$orgID = $this->uri->segment(4);
|
||||
$randomname = $this->Organisaties_model->get(['id'=>$orgID],'randomname', true);
|
||||
$originalname = $this->Organisaties_model->get(['id'=>$orgID],'bijlagefile', true);
|
||||
$this->load->helper( 'download' );
|
||||
$data = file_get_contents( './../docs/' . $randomname );
|
||||
force_download( $originalname, $data );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,369 @@
|
||||
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
class Users extends MY_Controller{
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
if ( ! $this->userid) exit('geen toegang');
|
||||
$models = array( "shared/Users_model",
|
||||
'shared/Organisaties_model',
|
||||
"shared/Orgusers_model",
|
||||
"shared/functies_model",
|
||||
"monpas/Filledversions_model",
|
||||
"monpas/Groepenxusers_model",
|
||||
"monpas/Versies_model",
|
||||
"monpas/Orgversies_model");
|
||||
$this->load->model($models);
|
||||
$this->load->helper('string');
|
||||
if ( ! $this->check_online_status() ) {
|
||||
echo json_encode( array('offline' => TRUE) );
|
||||
die;
|
||||
};// if
|
||||
}
|
||||
function getuserdetail(){
|
||||
if (!$this->userid || $this->nologin){die;};
|
||||
|
||||
$userid = $this->uri->segment(4);
|
||||
if (!$userid) {$userid = $this->userid; };
|
||||
$user = $this->Users_model->getdetails($userid);
|
||||
echo json_encode($user);
|
||||
}
|
||||
|
||||
public function updateuser(){
|
||||
//TODO sanitize input
|
||||
if (!$this->userid || $this->nologin){die;};
|
||||
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) > 0 ) {
|
||||
$data=array('voornaam' => $this->clean_input('voornaam'),
|
||||
'tussenvoegsel' => $this->clean_input('tussenvoegsel'),
|
||||
'achternaam' => $this->clean_input('achternaam'),
|
||||
'email' => $this->clean_input('email') );
|
||||
if (strlen($this->input->post('wachtwoord')) >=4){
|
||||
$data['wachtwoord']=$this->input->post('wachtwoord');
|
||||
} ;
|
||||
$this->Users_model->update_record($data, $this->userid);
|
||||
};
|
||||
$fullname = $this->Users_model->get_fullname($this->userid);
|
||||
echo json_encode($fullname);
|
||||
}
|
||||
|
||||
function getorgs(){
|
||||
$userid = $this->userid;
|
||||
$userorg = $this->Organisaties_model->getorg($this->globorgid) ;
|
||||
$orgs = null;
|
||||
if ($userorg->soort == 4){
|
||||
// doe niks
|
||||
}
|
||||
if ($userorg->soort == 3){
|
||||
//get scholen
|
||||
$userorg->orgs1= $this->Organisaties_model->getorgsvanaf($userorg->id);
|
||||
};
|
||||
if($userorg->soort==2){
|
||||
$userorg->orgs1= $this->Organisaties_model->getorgsvanaf($userorg->id);
|
||||
if ($userorg->orgs1){
|
||||
foreach($userorg->orgs1 as $bg){
|
||||
$bg->orgs2 = $this->Organisaties_model->getorgsvanaf($bg->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($userorg->soort=1){
|
||||
$userorg->orgs= $this->Organisaties_model->getorgsvanaf($userorg->id);
|
||||
if ($userorg->orgs){
|
||||
foreach($userorg->orgs as $kamer){
|
||||
$kamer->orgs = $this->Organisaties_model->getorgsvanaf($kamer->id);
|
||||
if ($kamer->orgs){
|
||||
foreach($kamer->orgs as $bg){
|
||||
$bg->orgs = $this->Organisaties_model->getorgsvanaf($bg->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo json_encode($userorg);
|
||||
}
|
||||
|
||||
|
||||
function getorggebruikers(){
|
||||
if (!$this->nologin){
|
||||
$orgid = $this->uri->segment(4);
|
||||
$users = $this->Users_model->getorggebruikers($orgid, false);
|
||||
|
||||
echo json_encode($users);
|
||||
}
|
||||
}
|
||||
|
||||
function adduser(){
|
||||
//TODO clean input
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) > 0 ) {
|
||||
$ok = true;
|
||||
$errortekst = '';
|
||||
$user = null;
|
||||
$orgid = $this->input->post("orgid");
|
||||
$gnaam=$this->input->post('gnaam');
|
||||
$gnaam = trim($gnaam);
|
||||
if ($this->Users_model->check_username($gnaam) > 0){
|
||||
$errortekst =" Gebruikersnaam is niet toegestaan. Gebruik een andere naam.";
|
||||
$ok = false;
|
||||
};
|
||||
if ($ok) {
|
||||
// maak een user
|
||||
//maak wachtwoord en send email
|
||||
$zout = random_string('alnum', 15);
|
||||
$ww = random_string('alnum', 8);
|
||||
$saltedww = md5($zout.$ww);
|
||||
$data = array("voornaam" =>$this->input->post('voornaam'),
|
||||
"tussenvoegsel" =>$this->input->post('tussenvoegsel'),
|
||||
"achternaam" =>$this->input->post('achternaam'),
|
||||
"email" =>$this->input->post('email'),
|
||||
"gnaam" =>$gnaam,
|
||||
"zout" =>$zout,
|
||||
"wachtwoord" =>$saltedww);
|
||||
$userid = $this->Users_model->insert_record($data);
|
||||
$this->sendmail($userid,$ww,$orgid);
|
||||
// maak een orguser
|
||||
$data = array( "user_id" => $userid,
|
||||
"organisatie_id" => $orgid);
|
||||
$orguserid = $this->Orgusers_model->insert_record($data);
|
||||
//maak autorisatie
|
||||
$data = array( "nivo_id" =>$this->input->post('autorisatienivoid'),
|
||||
"orguser_id" =>$orguserid);
|
||||
$this->Autorisaties_model->insert_record($data);
|
||||
//get user gegevens om op te nemen in de view
|
||||
$user=$this->Users_model->getorggebruikers($orgid, $userid);
|
||||
|
||||
} // if ok
|
||||
}
|
||||
else {
|
||||
$ok =false;
|
||||
$errortekst ="U bent niet geautoriseerd voor deze handeling.";
|
||||
$user ='';
|
||||
}; // if geen writer
|
||||
echo json_encode(array('ok' =>$ok,
|
||||
'errortekst' => $errortekst,
|
||||
'user' => $user));
|
||||
}
|
||||
|
||||
function getBijlage($orgid){
|
||||
|
||||
$org = $this->Organisaties_model->get(['id'=>$orgid],false, true);
|
||||
|
||||
if (! $org->randomname && $org->id != $org->valtonder_id){
|
||||
return $this->getBijlage($org->valtonder_id);
|
||||
}
|
||||
else return $org;
|
||||
|
||||
}
|
||||
|
||||
function sendmail($userid, $ww, $orgid){
|
||||
$user = $this->Users_model->get_record_by_id($userid);
|
||||
$data = array('username'=>$user->gnaam, 'password'=>$ww, 'fullname'=>$this->Users_model->get_fullname($userid));
|
||||
$org = $this->getBijlage($orgid);
|
||||
$this->load->library('email');
|
||||
|
||||
$this->email->from('noreply@framework.nl', 'Framework+ MonPas');
|
||||
$this->email->to($user->email);
|
||||
$this->email->subject('Inloggegevens MonPas');
|
||||
$this->email->message($this->load->view('emails/newuser_mail', $data, TRUE));
|
||||
$this->email->bcc("rfranke@framework-ed.nl");
|
||||
if ($org->randomname)
|
||||
$this->email->attach('./../docs/'.$org->randomname,'attachment', $org->bijlagefile);
|
||||
$this->email->send();
|
||||
}
|
||||
|
||||
function updateuser2(){
|
||||
// TODO sanitize input
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) > 0 ) {
|
||||
$ok = true;
|
||||
$errortekst = '';
|
||||
$user = null;
|
||||
$fullname ='';
|
||||
$userid = $this->input->post("id");
|
||||
$orgid = $this->input->post("orgid");
|
||||
$gnaam = trim($this->input->post('gnaam'));
|
||||
// controleer gebruikersnaam
|
||||
if ($this->Users_model->check_username($gnaam, $userid) > 0){
|
||||
$errortekst =" Gebruikersnaam is niet toegestaan. Gebruik een andere naam.";
|
||||
$ok = false;
|
||||
};
|
||||
|
||||
if ($ok) {
|
||||
$data = array("voornaam" =>$this->input->post('voornaam'),
|
||||
"tussenvoegsel" =>$this->input->post('tussenvoegsel'),
|
||||
"achternaam" =>$this->input->post('achternaam'),
|
||||
"email" =>$this->input->post('email'),
|
||||
"gnaam" =>$gnaam);
|
||||
$this->Users_model->update_record($data, $userid);
|
||||
|
||||
//update autorisatie
|
||||
$where = array('user_id' =>$userid, 'organisatie_id'=>$orgid);
|
||||
$orguserid = $this->Orgusers_model->get_records_where($where, true);
|
||||
$orguserid = $orguserid->id;
|
||||
$data = array( "nivo_id" =>$this->input->post('autorisatienivoid'));
|
||||
$where = array('orguser_id' => $orguserid);
|
||||
$this->Autorisaties_model->update_record_where($data, $where);
|
||||
//get user gegevens om op te nemen in de view
|
||||
$user=$this->Users_model->getorggebruikers($orgid, $userid);
|
||||
// als de veranderde user = glob user : pas fullname onder menu aan
|
||||
if ($userid == $this->userid){
|
||||
$fullname = $this->Users_model->get_fullname($userid);
|
||||
}
|
||||
if ($this->input->post("status") == 3){
|
||||
//stuur email aan de gebruiker
|
||||
$zout = random_string('alnum', 15);
|
||||
$ww = random_string('alnum', 8);
|
||||
$saltedww = md5($zout.$ww);
|
||||
$data=array('zout' => $zout, "wachtwoord" =>$saltedww);
|
||||
$this->Users_model->update_record($data, $userid);
|
||||
$this->sendmail($userid,$ww,$orgid);
|
||||
}
|
||||
} // if ok
|
||||
|
||||
//get user gegevens om op te nemen in de view
|
||||
$user=$this->Users_model->getorggebruikers($orgid, $userid);
|
||||
}
|
||||
else {$ok = false;
|
||||
$errortekst = "U bent niet geautoriseerd voor deze handeling." ;
|
||||
$user = '';
|
||||
$fullname = '';
|
||||
}; // geen write rechten
|
||||
echo json_encode(array('ok' => $ok,
|
||||
'errortekst' => $errortekst,
|
||||
'user' => $user,
|
||||
'fullname' => $fullname));
|
||||
}
|
||||
function deleteuser(){
|
||||
//TODO sanitize input
|
||||
$user=FALSE;
|
||||
$userid= $this->uri->segment(4);
|
||||
$orgid= $this->uri->segment(5);
|
||||
$orguser = $this->Orgusers_model->get_records_where(array("user_id"=>$userid, "organisatie_id"=>$orgid),true);
|
||||
$ok = true;
|
||||
$errortekst = '';
|
||||
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole, WRITER) <=0 ) {
|
||||
$ok = false;
|
||||
$errortekst = "U bent niet geautoriseerd tot verwijderen.";
|
||||
}
|
||||
elseif ($userid == $this->userid){
|
||||
$ok = false;
|
||||
$errortekst .=" U mag de huidige gebruiker niet verwijderen.";
|
||||
}
|
||||
elseif ($this->Filledversions_model->check_for_record(array("user_id"=>$userid , "organisatie_id"=>$orgid)) ||
|
||||
$this->Groepenxusers_model->check_for_record(array("orguser_id"=>$orguser->id)) ){
|
||||
$errortekst .="Er zijn invulgegevens van deze gebruiker; en/of groepen gekoppeld aan deze gebruiker. Gebruiker is gearchiveerd";
|
||||
$this->Autorisaties_model->update_record_where(array("nivo_id"=>100),array("orguser_id"=>$orguser->id));
|
||||
$user = $this->Users_model->getorggebruikers($orgid,$userid);
|
||||
}
|
||||
else {
|
||||
$orguser = $this->Orgusers_model->get_records_where(array("user_id" => $userid, "organisatie_id"=>$orgid), true);
|
||||
$this->Autorisaties_model->delete_record_where(array("orguser_id"=>$orguser->id));
|
||||
$this->Orgusers_model->delete_record($orguser->id);
|
||||
|
||||
// wordt de user nog bij een andere organisatie gebruikt?
|
||||
$orguser=$this->Orgusers_model->get_records_where(array("user_id"=>$userid));
|
||||
if (!$orguser){
|
||||
$this->Users_model->delete_record($userid);
|
||||
}
|
||||
}
|
||||
echo json_encode(array('ok'=>$ok, 'errortekst'=>$errortekst,'user'=>$user));
|
||||
}
|
||||
public function savestatus(){
|
||||
// TODO sanitize input
|
||||
if ($this->Autorisaties_model->check_autorisatie($this->userrole, SUPERUSER) > 0){
|
||||
$userid =$this->clean_input('userid');
|
||||
$status =$this->clean_input('status');
|
||||
$this->Users_model->update_record(array("actief"=>$status), $userid);
|
||||
}
|
||||
}
|
||||
function SendNewWW(){
|
||||
//TODO sanitize input
|
||||
$userid = $this->uri->segment(4);
|
||||
$ok = true;
|
||||
$errortekst = '';
|
||||
|
||||
$user = $this->Users_model->get_record_by_id($userid);
|
||||
$ww = random_string('alnum', 8);
|
||||
$saltedww = md5($user->zout.$ww);
|
||||
// update user
|
||||
$this->Users_model->update_record(array('wachtwoord'=>$saltedww),$userid);
|
||||
$data = array('username'=>$user->gnaam, 'password'=>$ww, 'fullname'=>$this->Users_model->get_fullname($userid));
|
||||
|
||||
$this->load->library('email');
|
||||
|
||||
$this->email->from('noreply@framework.nl', 'Framework+ MonPas');
|
||||
$this->email->to($user->email);
|
||||
$this->email->subject('Inloggegevens MonPas');
|
||||
$this->email->message($this->load->view('emails/newpassword_mail', $data, TRUE));
|
||||
$this->email->bcc("rfranke@framework-ed.nl");
|
||||
$this->email->send();
|
||||
|
||||
echo json_encode(array('ok'=>$ok, 'errortekst'=>$errortekst));
|
||||
}
|
||||
|
||||
function geteigenorgs($valtonderid){
|
||||
|
||||
}
|
||||
private function getswv($orgid){
|
||||
$organisatie =$this->Organisaties_model->get_record_by_id($orgid);
|
||||
if ($organisatie) {
|
||||
if ($organisatie->soort ==1 ) {
|
||||
return $organisatie->id;
|
||||
}
|
||||
else{
|
||||
$orgid = $this->getswv($organisatie->valtonder_id);
|
||||
};
|
||||
}
|
||||
else {
|
||||
return $orgid= null;
|
||||
}
|
||||
return $orgid;
|
||||
}
|
||||
|
||||
function getorglist($orgid,$orglist){
|
||||
|
||||
$orgs = $this->Organisaties_model->getorgsvanaf($orgid);
|
||||
if ($orgs){
|
||||
|
||||
foreach($orgs as $org){
|
||||
if ($org->soort < 4 && $org->soort != 1){
|
||||
$orglist .=$org->id.',';
|
||||
$orglist=$this->getorglist($org->id,$orglist);
|
||||
|
||||
}
|
||||
else {
|
||||
$orglist.= $org->id.',';
|
||||
}
|
||||
}
|
||||
}
|
||||
return $orglist;
|
||||
}
|
||||
|
||||
function getotherusers(){
|
||||
//TODO clean input
|
||||
// haal de gebruikers op van andere organisaties onder het SWV
|
||||
$orgid= $this->uri->segment(4);
|
||||
$swvid = $this->getswv($orgid);
|
||||
$orgids='';
|
||||
|
||||
$orgids = $this->getorglist($swvid, $swvid.',');
|
||||
|
||||
$orgids=substr($orgids, 0, strlen($orgids) - 1);
|
||||
$ousers= $this->Users_model->otherusers($orgid,$orgids);
|
||||
echo json_encode($ousers);
|
||||
}
|
||||
function savecopyuser(){
|
||||
//TODO clean input
|
||||
$userid = $this->input->post("userid");
|
||||
$orgid = $this->input->post("orgid");
|
||||
$data = array( "user_id" => $userid,
|
||||
"organisatie_id" => $orgid);
|
||||
$orguserid = $this->Orgusers_model->insert_record($data);
|
||||
//maak autorisatie
|
||||
$data = array( "nivo_id" =>$this->input->post('autorisatie'),
|
||||
"orguser_id" =>$orguserid);
|
||||
$this->Autorisaties_model->insert_record($data);
|
||||
//get user gegevens om op te nemen in de view
|
||||
$user=$this->Users_model->getorggebruikers($orgid, $userid);
|
||||
echo json_encode($user);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user