- checkperiode: losse komma uit SQL, vergelijk op orgversie_id i.p.v. FV.id, lijst telt mee in het schooljaar waarin geldigtm valt - Compacteversies: checkperiode per filledversie i.p.v. laatste versie - Compacteonderdelen: lijstblok zonder gekozen versie overslaan - Compactepaginas: schoolgegevens doorgeven aan paginacompact - paginacompact: jQuery van eigen server laden - sopcompact: bootstrap en OpenSans ingesloten in de pdf-html Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
235 lines
8.2 KiB
PHP
235 lines
8.2 KiB
PHP
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
class Compactepaginas
|
|
{
|
|
private $CI;
|
|
private $schooljaar;
|
|
private $onderdeel;
|
|
private $onderdelen;
|
|
private $onderdelendef;
|
|
private $orgGegevens;
|
|
private $legenda;
|
|
private $paginahtml;
|
|
private $pagina;
|
|
private $paginas;
|
|
private $vorigepagina = 1;
|
|
private $aantalpaginas;
|
|
private $compactarray;
|
|
private $blokjeshtml;
|
|
private $html;
|
|
|
|
private $gegevens;
|
|
private $gegevensarray = [];
|
|
private $compacteonderdelen;
|
|
private $sopid;
|
|
|
|
public function __construct($onderdelen, $paginas){
|
|
$this->CI = &get_instance();
|
|
$this->compacteonderdelen = $onderdelen;
|
|
$this->aantalpaginas = $paginas;
|
|
$this->handle();
|
|
}
|
|
|
|
public function getHtml(){
|
|
return $this->html;
|
|
}
|
|
|
|
public function getSopId(){
|
|
return $this->sopid;
|
|
}
|
|
|
|
private function handle(){
|
|
$this->setOrggegevens();
|
|
$this->setLegenda();
|
|
$this->setOnderdelen();
|
|
$this->SetSchooljaar();
|
|
// $this->loopOnderdelen();
|
|
// $this->setAantalPaginas();
|
|
$this->maakPaginas();
|
|
$this->loopPaginas();
|
|
$this->loopGegevensArray();
|
|
$this->setHtml();
|
|
}
|
|
|
|
private function setOrggegevens(){
|
|
$this->orgGegevens = $this->compacteonderdelen['orggegevens'];
|
|
}
|
|
|
|
private function setLegenda(){
|
|
$this->legenda = $this->compacteonderdelen['legenda'];
|
|
}
|
|
|
|
private function setOnderdelen(){
|
|
$this->onderdelen = $this->compacteonderdelen['onderdelen'];
|
|
}
|
|
|
|
|
|
private function setSchooljaar(){
|
|
$this->schooljaar = $this->compacteonderdelen['schooljaar'];
|
|
}
|
|
|
|
|
|
// private function loopOnderdelen(){
|
|
// foreach($this->onderdelen as $index => $this->onderdeel ) {
|
|
//// $this->setDivBreedte();
|
|
//// $this->setMiddelenBreedte();
|
|
// $this->setOnderdelenDef();
|
|
// }
|
|
// }
|
|
|
|
// private function setDivBreedte(){
|
|
// if (!$this->onderdeel['modulenr']) return;
|
|
// if($this->onderdeel['onderdeelnr'] != 1 && $this->onderdeel['onderdeelnr'] != 10 ) return;
|
|
// $aantalGroepen = count($this->onderdeel['data']['data']['groepen']);
|
|
// if($aantalGroepen > 8){
|
|
// $this->divBreed = 'T';
|
|
// $this->onderdeel['breed'] = 'T';
|
|
// }
|
|
// }
|
|
|
|
// private function setMiddelenBreedte(){
|
|
// if (!$this->onderdeel['onderdeelnr']) return;
|
|
// if($this->onderdeel['onderdeelnr'] != 7 || $this->middelenBreed == 'T') return;
|
|
// $this->middelenBreed = 'T';
|
|
// $this->onderdeel['breed'] = 'T';
|
|
// }
|
|
|
|
// private function setOnderdelenDef(){
|
|
// $this->onderdelendef[] = $this->onderdeel;
|
|
// }
|
|
|
|
// private function setAantalPaginas(){
|
|
// $ruimte = count($this->onderdelen);
|
|
// if($this->divBreed == 'T'){
|
|
// $ruimte = $ruimte + 1;
|
|
// }
|
|
// if($this->middelenBreed == 'T'){
|
|
// $ruimte = $ruimte + 1;
|
|
// }
|
|
//
|
|
// $this->aantalpaginas = ceil($ruimte/4);
|
|
// }
|
|
|
|
private function maakPaginas(){
|
|
for ($i = 0; $i < $this->aantalpaginas; $i++) {
|
|
$this->pagina = new stdClass;
|
|
$this->paginas [] = $this->pagina;
|
|
}
|
|
}
|
|
|
|
private function loopPaginas(){
|
|
foreach($this->paginas as $index=>$this->pagina){
|
|
$this->maakPaginaNummer($index);
|
|
$this->loopOnderdelendef();
|
|
$this->verzamelGegevens();
|
|
$this->setGegevensArray();
|
|
}
|
|
}
|
|
|
|
private function maakPaginaNummer($index){
|
|
$this->pagina->paginanummer = $index + 1;
|
|
}
|
|
|
|
private function loopOnderdelendef(){
|
|
foreach($this->onderdelen as $index=> $this->onderdeel){
|
|
if(!$this->onderdeel['modulenr']) continue;
|
|
if(intval($this->onderdeel['paginanr'])== $this->pagina->paginanummer) {
|
|
$this->setCompactArray();
|
|
$this->plaatsOnderdelenBreed();
|
|
$this->plaatsOnderdelenSmal();
|
|
}
|
|
}
|
|
}
|
|
|
|
private function setCompactArray(){
|
|
if(!isset($this->onderdeel['html']) || !isset($this->onderdeel['data'])) return;
|
|
$this->compactarray = ['html' => $this->onderdeel['html'],
|
|
'data' => $this->onderdeel['data'] ];
|
|
}
|
|
|
|
private function plaatsOnderdelenBreed(){
|
|
if(! isset($this->onderdeel['html']) || ! isset($this->onderdeel['data'])) return;
|
|
if ($this->onderdeel['breed']=='F' ) return;
|
|
if ($this->onderdeel['bloknr'] == 1 || $this->onderdeel['bloknr'] == 2) $this->pagina->boven = $this->compactarray;
|
|
if ($this->onderdeel['bloknr'] == 3 || $this->onderdeel['bloknr'] == 4) $this->pagina->onder = $this->compactarray;
|
|
}
|
|
|
|
private function plaatsOnderdelenSmal(){
|
|
if(! isset($this->onderdeel['html']) || ! isset($this->onderdeel['data'])) return;
|
|
if ($this->onderdeel['breed']== 'T') return;
|
|
switch( $this->onderdeel['bloknr']){
|
|
case 1: $this->pagina->linksboven = $this->compactarray;
|
|
break;
|
|
case 2: $this->pagina->rechtsboven = $this->compactarray;
|
|
break;
|
|
case 3: $this->pagina->linksonder = $this->compactarray;
|
|
break;
|
|
case 4: $this->pagina->rechtsonder = $this->compactarray;
|
|
}
|
|
}
|
|
|
|
private function verzamelGegevens(){
|
|
$boven = false;
|
|
if(isset($this->pagina->boven) && $this->pagina->boven) $boven = $this->pagina->boven;
|
|
$linksboven = false;
|
|
if(isset($this->pagina->linksboven)&& $this->pagina->linksboven) $linksboven = $this->pagina->linksboven;
|
|
$rechtsboven = false;
|
|
if(isset($this->pagina->rechtsboven)&& $this->pagina->rechtsboven)$rechtsboven = $this->pagina->rechtsboven;
|
|
$onder = "";
|
|
if(isset($this->pagina->onder)&& $this->pagina->onder) $onder = $this->pagina->onder;
|
|
$linksonder = false;
|
|
if(isset($this->pagina->linksonder)&&$this->pagina->linksonder) $linksonder = $this->pagina->linksonder;
|
|
$rechtsonder = false;
|
|
if(isset($this->pagina->rechtsonder)&& $this->pagina->rechtsonder)$rechtsonder = $this->pagina->rechtsonder;
|
|
|
|
|
|
$this->gegevens = ['schoolgegevens' => $this->orgGegevens,
|
|
'legenda' => $this->legenda,
|
|
'boven' => $boven,
|
|
'onder' => $onder,
|
|
'linksboven' => $linksboven,
|
|
'rechtsboven' => $rechtsboven,
|
|
'linksonder' => $linksonder,
|
|
'rechtsonder' => $rechtsonder,
|
|
'paginanummer' => $this->pagina->paginanummer,
|
|
'nieuwepagina' => false];
|
|
|
|
}
|
|
|
|
private function setGegevensArray(){
|
|
$this->gegevensarray[] = $this->gegevens;
|
|
}
|
|
|
|
private function loopGegevensArray(){
|
|
foreach($this->gegevensarray as $index => $this->gegevens){
|
|
$this->paginahtml = "";
|
|
$this->maakHtmlBlokjes();
|
|
$this->setBlokjesHtml();
|
|
}
|
|
}
|
|
|
|
private function maakHtmlBlokjes(){
|
|
$this->gegevens['nieuwepagina'] = false;
|
|
if ($this->pagina->paginanummer <> $this->vorigepagina) {
|
|
$this->gegevens['nieuwepagina'] = true;
|
|
$this->vorigepagina = $this->pagina->paginanummer;
|
|
}
|
|
$this->paginahtml = $this->CI->load->view("monpas/compactsop/blokjescompact", $this->gegevens, true);
|
|
}
|
|
|
|
private function setBlokjesHtml(){
|
|
if(!$this->paginahtml) return;
|
|
if ($this->blokjeshtml <= '') $this->blokjeshtml=$this->paginahtml;
|
|
else $this->blokjeshtml = $this->blokjeshtml .'<div style="page-break-before: always"></div>' .$this->paginahtml;
|
|
}
|
|
|
|
private function setHtml()
|
|
{
|
|
if (!$this->blokjeshtml) return;
|
|
$data = ['schooljaar' => $this->schooljaar,
|
|
'schoolgegevens' => $this->orgGegevens];
|
|
$html = $this->CI->load->view("monpas/compactsop/paginacompact", $data, true);
|
|
$this->html = str_replace('##PLACEHOLDER##', $this->blokjeshtml, $html);
|
|
}
|
|
}
|