initial commit
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user