LOK!'), IF(toets_lok = '', 'LOK?', toets_lok) ) lok, -- IF(SUBSTRING(toets_formula, 1, 7) = 'reserve', 1, 0) res, IF(toets_surv = '', 'DOC?', toets_surv) surv, toets_aantal aantal FROM toetsen WHERE file_id = $toetsrooster_id ORDER BY toets_date, toets_start, IF(SUBSTRING(toets_formula, 1, 7) = 'reserve', 1, 0), IF(SUBSTRING(toets_formula, 1, 7) = 'reserve', IF(toets_lok = '', '-', 'LOK!'), IF(toets_lok = '', 'LOK?', toets_lok) ) EOQ ); $zittingen = array(); $footnotesymbols = array ('¹', '²', '³', '⁴', '⁵', '⁶', '⁷', '⁸', '⁹'); $footnotes = array(); while (($row = $rows->fetchRow(MDB2_FETCHMODE_ASSOC))) { $zitting = $row['zitting']; if (!isset($zittingen[$zitting])) $zittingen[$zitting] = array(); $act = $row['act']; $survs = explode(',', $row['surv']); $current_footnote = ''; if ($row['eindtijd'] != $row['footnote']) { if (!isset($footnotes[$row['footnote']])) { if (count($footnotes) == count($footnotesymbols)) error_system("te weinig voetnootsymbolen"); $footnotes[$row['footnote']] = array('symbol' => $footnotesymbols[count($footnotes)], 'refcount' => 0); } foreach ($survs as $idx => $surv) { $survs[$idx] = strtoupper($surv); //.$footnotes[$row['footnote']]; } $current_footnote = $footnotes[$row['footnote']]['symbol']; } else { foreach ($survs as $idx => $surv) { $survs[$idx] = strtoupper($surv); } } $row['surv'] = implode(',', $survs); //echo("act=$act\n"); if (preg_match('/reserve\s*(\d+)/', $act, $matches)) { //echo("act=$act\n"); if (count(explode(',', $row['surv'])) != 1) error_system("meer dan 1 surveillant in 1 reserverol: {$row['surv']}"); if (!isset($zittingen[$zitting]['RES'])) $zittingen[$zitting]['RES'] = array(); $zittingen[$zitting]['RES'][$matches[1]-1][$row['tijd'].'-'.$row['eindtijd']] = array($row['surv'], $current_footnote); if ($current_footnote != '') $footnotes[$row['footnote']]['refcount']++; //print_r($matches); } else { $loks = explode(',', $row['lok']); if (count($loks) == 2) { // splits docenten $survs = explode(',', $row['surv']); $mid = round(count($survs)/2); //echo(count($survs)." ".$mid." "); $actlok = $act.' ('.$row['aantal'].'):'.$loks[0]; $count = 0; for ($i = 0; $i < $mid; $i++) { $surv = $survs[$i]; if (!isset($zittingen[$zitting][$actlok][$count])) $zittingen[$zitting][$actlok][$count] = array(); $zittingen[$zitting][$actlok][$count][$row['tijd'].'-'.$row['eindtijd']] = array($surv, $current_footnote); if ($current_footnote != '') $footnotes[$row['footnote']]['refcount']++; $count++; } $actlok = $act.' ('.$row['aantal'].'):'.$loks[1]; $count = 0; for ($i = $mid; $i < count($survs); $i++) { $surv = $survs[$i]; if (!isset($zittingen[$zitting][$actlok][$count])) $zittingen[$zitting][$actlok][$count] = array(); $zittingen[$zitting][$actlok][$count][$row['tijd'].'-'.$row['eindtijd']] = array($surv, $current_footnote); if ($current_footnote != '') $footnotes[$row['footnote']]['refcount']++; $count++; } } else { $actlok = $act.' ('.$row['aantal'].'):'.$row['lok']; if (!isset($zittingen[$zitting][$actlok])) $zittingen[$zitting][$actlok] = array(); $count = 0; foreach (explode(',', $row['surv']) as $surv) { if (!isset($zittingen[$zitting][$actlok][$count])) $zittingen[$zitting][$actlok][$count] = array(); $zittingen[$zitting][$actlok][$count][$row['tijd'].'-'.$row['eindtijd']] = array($surv, $current_footnote); if ($current_footnote != '') $footnotes[$row['footnote']]['refcount']++; $count++; } } } } $rows->seek(); $rooster = array(); function show($rooster, $start, $end) { for ($i = $start; $i <= $end; $i++) echo(implode("\t", $rooster[$i])."\n"); } foreach ($zittingen as $moment => $zitting) { $legenda1 = array(); $legenda2 = array(); $legenda3 = array(); $sizes = array(); $times = array(); foreach ($zitting as $activiteit => $info) { $sizes[$activiteit] = count($info); foreach ($info as $deelactiviteit) { foreach ($deelactiviteit as $tijdstip => $tmp) { $times[$tijdstip] = 1; } } } //echo("
$moment"); //echo("
");
	//print_r($zitting);
	//print_r($sizes);
	//print_r($times);
	$split = explode(' ', $moment);
	$wisselbaar = array();
	$legenda1[] = $split[0].' '.$split[1];
	$legenda2[] = $split[2];
	$legenda3[] = $split[3];
	foreach ($sizes as $activiteit => $size) {
		$split = explode(':', $activiteit);
		preg_match('/(.*) \((\d+)\)/', $split[0], $matches);
		//print_r($matches);
		for ($i = 1; $i <= $size; $i++) {
			if (count($split) == 1) {
				$legenda1[] = '';
				$legenda2[] = '';
				$legenda3[] = 'RES'.$i;
			} else {
				$wisselbaar[count($legenda1)] = 1;
				$legenda1[] = $matches[1];
				$legenda2[] = $matches[2].'lln';
				$legenda3[] = $split[1];
			}
		}
	}
	//print_r($legenda1);
	$rooster[] = $legenda1;
	$rooster[] = $legenda2;
	$rooster[] = $legenda3;
	$indices = array();
	$totalsize = 1;
	foreach ($sizes as $activiteit => $size) {
		$indices[$activiteit] = $totalsize;
		$totalsize += $size;
	}
	//echo("indices:\n");
	//print_r($indices);
	//echo("totalsize=$totalsize\n");
	foreach ($times as $time => $tmp) {
		$times[$time] = array_fill(0, $totalsize, '');
		$times[$time][0] = $time;
	}	

	foreach ($indices as $activiteit => $index) {
		//print_r($zitting[$activiteit]);
		foreach ($zitting[$activiteit] as $offset => $list) {
			foreach ($list as $tijdstip => $surv) {
				$times[$tijdstip][$index+$offset] = $surv; ////strtoupper($surv);
			}
		}
	}

	$index_start = count($rooster);
	foreach ($times as $time => $line) $rooster[] = $line;
	$index_end = count($rooster) - 1;

	// verwissel docenten in niet-reservekolommen (aangegeven
	// door $wisselbaar), zodat ze zoveel mogelijk in 1 kolom staan
	for ($i = $index_end; $i > $index_start; $i--) {
		foreach ($wisselbaar as $index => $tmp) {
			if (!is_array($rooster[$i][$index])) continue;
			$doc = $rooster[$i][$index][0];
			if ($doc == '') continue;
			//echo("beschouw $doc\n");
			$next = 0;
			foreach ($wisselbaar as $index2 => $tmp) {
				if ($rooster[$i-1][$index2][0] == $doc) {
					//echo("found in next row at $index2\n");
					$next = $index2;
					break;
				}
			}
			if ($next != 0 && $next != $index && /*$rooster[$i-1][$next] != '' &&*/ $rooster[$i-1][$index] != '') {
				$tmp = $rooster[$i-1][$next][0];
				$tmp2 = $rooster[$i-1][$index][0];
				$rooster[$i-1][$next][0] = $tmp2;
				$rooster[$i-1][$index][0] = $tmp;
			}
		}
	}

	// haal voetnoten weg bij docenten die zichzelf opvolgen
	for ($i = $index_start; $i < $index_end; $i++) {
		for ($j = 1; $j < count($rooster[$i]); $j++) {
			if (isset($rooster[$i][$j]) && isset($rooster[$i+1][$j]) && is_array($rooster[$i][$j]) &&  is_array($rooster[$i+1][$j]) && $rooster[$i][$j][0] == $rooster[$i+1][$j][0]) $rooster[$i][$j][1] = '';
		}
	}
	$rooster[] = array(' ');
	//print_r($rooster);
	//echo("
"); //exit; } array_pop($rooster); if (!isset($_GET['excel'])) { html_start(); ?>

Examensurveillancerooster (versie )

[verheuvel export]

Let op: eindtijden kunnen wegens tijdverlengers nog 30 minuten opschuiven. Afwijkende eindtijden: $symbol) { ?>
eindtijd

Raw data[verberg]

[show raw data] Examensurveillancerooster (versie ) $elt) { if (is_array($elt)) $line[$idx] = implode('', $elt); if ($elt == ' ') $line[$idx] = ''; if ($elt == 'DOC?') $line[$idx] = 'DOC?'; if ($elt == 'LOK?') $line[$idx] = 'LOK?'; } fputcsv($file, $line, ';'); } ?> Afwijkende eindtijden (afgezien van tijdverlengers): $symbol) { fputcsv($file, array($symbol['symbol'], $time), ';'); } } ?>