Skip to content

Commit

Permalink
obsolete stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
homberghp committed Apr 9, 2019
1 parent d43c477 commit 5dca0ab
Show file tree
Hide file tree
Showing 7 changed files with 430 additions and 0 deletions.
132 changes: 132 additions & 0 deletions deprecated/absenten.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<?php
requireCap(CAP_SYSTEM);
require_once 'component.php';
require_once 'navigation2.php';

require_once 'SimpleTableFormatter.php';
require_once 'mailFunctions.php';

$pp = array( );
$page = new PageContainer();
$page->setTitle( "Plan absentdag" );
$nav = new Navigation( $tutor_navtable, basename(__FILE__), "Plan een absentdag" );
$page->addBodyComponent( $nav );


//$css = "<link rel='stylesheet' type='text/css' href='style/tablesorterstyle.css'/>";
//$page->addScriptResource('js/jquery.min.js');
//$page->addScriptResource('js/jquery.tablesorter.js');
//$page->addJqueryFragment( '$("#myTable").tablesorter({widgets: [\'zebra\'],headers: {0:{sorter:false}}});' );
//$page->addHeadText($css);
$page->addHeadFragment( 'templates/tinymce_include.html' );
$pp['subject_de'] = 'Einladung zum Schnuppertag an der Fontys FH in Venlo';
$pp['subject_nl'] = 'Uitnodiging voor een absentdag bij Fontys Hogescholen in Venlo';

$pp['mailbody_de'] = file_get_contents( 'templates/absent_mailbody_de.html', true );
$pp['mailbody_nl'] = file_get_contents( 'templates/absent_mailbody_nl.html', true );

$sql = "select 0 as sorter,m.*,s.roepnaam||coalesce(' '||s.tussenvoegsel||' ',' ')||s.achternaam as mail_author\n"
. " from absentmail m join student_email s on (owner=snummer) where owner=$peer_id \n"
. "union\n"
. "select 1 as sorter,m.*,s.roepnaam||coalesce(' '||s.tussenvoegsel||' ',' ')||s.achternaam as mail_author\n"
. "from absentmail m join student_email s on (owner=snummer) \n"
. "order by sorter,absent_datum desc limit 1";
$resultSet = $dbConn->Execute( $sql );
if ( $resultSet !== false && !$resultSet->EOF ) {
$pp = array_merge( $pp, $resultSet->fields );
}
$sqlsender = "select rtrim(email1) as sender,roepnaam||coalesce(' '||tussenvoegsel,'')||' '||achternaam as sender_name," .
"coalesce(signature," .
"'sent by the peerweb service on behalf of '||roepnaam||coalesce(' '||tussenvoegsel,'')||' '||achternaam)\n" .
" as signature from student_email left join email_signature using(snummer) where snummer='$peer_id'";
$rs = $dbConn->Execute( $sqlsender );
if ( !$rs->EOF ) {
extract( $rs->fields );
} else {
$replyto = '[email protected]';
$sender_name = 'Pieter van den Hombergh';
$signature = '';
}

if ( isSet( $_POST['mailbody_de'] ) ) {
$pp['mailbody_de'] = preg_replace( '/"/', '\'', $_POST['mailbody_de'] );
}
if ( isSet( $_POST['subject_de'] ) ) {
$pp['subject_de'] = $_POST['subject_de'];
}

if ( isSet( $_POST['mailbody_nl'] ) ) {
$pp['mailbody_nl'] = preg_replace( '/"/', '\'', $_POST['mailbody_nl'] );
}
if ( isSet( $_POST['subject_nl'] ) ) {
$pp['subject_nl'] = $_POST['subject_nl'];
}

if ( isSet( $_POST['absent_datum'] ) ) {
$pp['absent_datum'] = $_POST['absent_datum'];
}
if ( isSet( $_POST['domail'] ) ) {
$mailbody_nl = preg_replace( "/'/", "''", $pp['mailbody_nl'] );
$mailbody_de = preg_replace( "/'/", "''", $pp['mailbody_de'] );
$sql = "insert into absentmail (owner,absent_datum,subject_nl,subject_de,mailbody_nl,mailbody_de)\n" .
"select {$peer_id},'{$pp['absent_datum']}','{$pp['subject_nl']}','{$pp['subject_de']}','{$mailbody_nl}','{$mailbody_de}'"
. "where ($peer_id,'{$pp['absent_datum']}') not in (select owner,absent_datum from absentmail)";
$dbConn->Execute( $sql );
$result = $dbConn->Affected_Rows();
if ( $result == 0 ) {
$sql = "update absentmail set subject_nl='{$pp['subject_nl']}',\n"
. "subject_de='{$pp['subject_de']}',\n"
. "mailbody_nl='{$mailbody_nl}',\n"
. "mailbody_de='{$mailbody_de}'\n"
. "where owner={$peer_id} and absent_datum='{$pp['absent_datum']}'";
$dbConn->Execute( $sql );
$result = $dbConn->Affected_Rows();
}
}


if ( isSet( $_POST['mail'] ) && isSet( $_POST['domail'] ) ) {

$mail = $_POST['mail'];
$mailset = '\'' . implode( "','", $mail ) . '\'';

$sql_de = "select absent_id,email as email1, \n"
. "roepnaam ||' '||coalesce(tussenvoegsel,'')||' '||achternaam as name\n"
. "from absent\n"
. "where taal ='DE' and absent_id in ($mailset)";
$sql_nl = "select absent_id,email as email1, \n"
. "roepnaam ||' '||coalesce(tussenvoegsel,'')||' '||achternaam as name\n"
. "from absent\n"
. "where taal ='NL' and absent_id in ($mailset)";
//$dbConn->log( $sql );
formMailer( $dbConn, $sql_de, $pp['subject_de'], $pp['mailbody_de'], $sender, $sender_name );
formMailer( $dbConn, $sql_nl, $pp['subject_nl'], $pp['mailbody_nl'], $sender, $sender_name );
// update invitation
$sql = "begin work;\n"
. "update absent set invitation=now()::date where absent_id in ($mailset);\n"
. "update absentmail set invitation_datum = now()::date where owner=$peer_id and absent_datum='{$pp['absent_datum']}';\n"
. "commit";
$rs = $dbConn->Execute( $sql );
if ( $rs === false ) {
$dbConn->Execute( 'rollback' );
}
}

$sql = "select '<input type=''checkbox'' name=''mail[]'' value='''||absent_id||'''/>' as chk,\n"
. "achternaam,roepnaam,tussenvoegsel,plaats,land,postcode,email,sex,datum_in,invitation \n"
. "from where participation isnull order by invitation desc,land,achternaam";

$pp['rtable'] = new SimpleTableFormatter( $dbConn, $sql, $page );
$pp['rtable']->setCheckColumn( 0 )
->setCheckName( 'mail[]' )
->setColorChangerColumn( 10 )
->setTabledef( "<table id='myTable' class='tablesorter' summary='absent studenten'"
. " style='empty-cells:show;border-collapse:collapse' border='1'>" );
$page->addHtmlFragment( 'templates/absentdag.html', $pp );
$page->addHeadText( file_get_contents( 'templates/simpledatepicker.html' ) );
$page->addScriptResource( 'js/jquery.min.js' );
$page->addScriptResource( 'js/jquery-ui.custom.min.js' );
$page->addJqueryFragment( '$(\'#absent_datum\').datepicker(dpoptions);' );

$page->show();
?>
148 changes: 148 additions & 0 deletions deprecated/buit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
<?php
requireCap(CAP_SYSTEM);
require_once('peerutils.php');
require_once('validators.php');
require_once('simplequerytable.php');

if ( isSet( $_REQUEST['newscancode'] ) ) {
$id = validate( $_REQUEST['newscancode'], 'integer', '0' );
} else if ( isSet( $_REQUEST['id'] ) ) {
$id = $_REQUEST['id'];
} else {
$id = 0;
}
$boxes = array( );
$sql = "select id,roepnaam||coalesce(' '||tussenvoegsel||' '::text,' ')||achternaam as name,\n" .
"straat||' '||huisnr as adres, plaats,country as land,postcode,gebdat,omschrijving_studieprog,status,cohort,'fotos/'||coalesce(rp.snummer,0)||'.jpg' as foto, \n" .
"rtrim(coalesce(ju.diplvo,j.diplvo)) as diplvo,\n" .
"rtrim(coalesce(ju.cijfer,j.cijfer)) as cijfer,\n" .
"rtrim(coalesce(ju.betbew,j.betbew)) as betbew,\n" .
"rtrim(coalesce(ju.pasprt,j.pasprt)) as pasprt,\n" .
"rtrim(coalesce(ju.uittre,j.uittre)) as uittre,\n" .
"rtrim(coalesce(ju.renrij,j.renrij)) as renrij \n" .
"from jaaglijst j join jaag_naws naws using(id) left join (select * from jaaglijst_update where id=$id \n" .
"\tand trans_id=(select max(trans_id) from jaaglijst_update where id=$id))ju using(id) \n" .
"join iso3166 i on (naws.land=i.a3) left join registered_photos rp on (id=snummer) where id=$id \n";
$resultSet = $dbConn->execute( $sql );
if ( $resultSet === false ) {
echo ( "<br>Cannot get jaagbuit data with " . $sql . " reason " . $dbConn->ErrorMsg() . "<br>");
}
if ( !$resultSet->EOF ) {
extract( $resultSet->fields );
$checks = array( 'diplvo', 'cijfer', 'betbew', 'pasprt', 'uittre', 'renrij' );
$rownr = 0;
foreach ( $checks as $check ) {
switch ( $check ) {
case 'diplvo':
$title = 'Kopie Diploma<br/> vooropleiding';
$img = 'images/diploma_thumb.jpg';
break;
case 'cijfer':
$title = 'Gewaarmerkte <br/>Cijferlijst';
$img = 'images/rapport_thumb.gif';
break;
case 'betbew':
$title = 'Betalingsbewijs';
$img = 'images/bankafschrift_thumb.jpg';
break;
case 'pasprt':
$title = 'Kopie paspoort';
$img = 'images/passport_thumb.jpg';
break;
case 'uittre':
$title = 'Uittreksel<br/>bevolkingsregister';
$img = 'images/bevolkingsregister_thumb.jpg';
break;
case 'renrij':
$title = 'Herinschrijving<br/>studielink';
$img = 'images/studielinklogo_thumb.png';
break;
}

if ( $resultSet->fields[$check] == 'Voltooid' || $resultSet->fields[$check] == 'Vrijstelling' ) {
$widgetcells = "<td colspan='2' style='text-align:center;font-weight:normal;font-style:italic;font-size:80%'>" . $resultSet->fields[$check] . "</td>";
} else {
if ( $resultSet->fields[$check] == 'Ingeleverd' ) {
$checked = 'checked';
} else {
$checked = '';
}
$widgetcells = "\t<td class='button'>\n" .
"\t\t<button type='button' onclick=\"javascript:toggle('$check')\">\t" .
"\t\t\t<img align='middle' src='$img'/>\n" .
"\t\t</button>\n" .
"\t</td>\n" .
"\t<td><input type='checkbox' name='$check' id='$check' value='Ingeleverd' $checked />\n" .
"\t\t<input type='hidden' name='boxes[]' value='$check'/>\n" .
"\t</td>\n";
}

$boxwidget = "<tr class='" . (($rownr++ % 2) ? 'odd' : 'even') . " big'>\n" .
"<td class='itemtext'>$title</td>\n" .
$widgetcells .
"</tr>\n";
$boxes[$check] = $boxwidget;
}
} else {
$name = 'NOT FOUND';
}

$sqlhistory = "select \n" .
"to_char(ts,'YYYY-MM-DD HH24:MI') as date_time,\n" .
"rtrim(coalesce(ju.diplvo,j.diplvo)) as diplvo,\n" .
"rtrim(coalesce(ju.cijfer,j.cijfer)) as cijfer,\n" .
"rtrim(coalesce(ju.betbew,j.betbew)) as betbew,\n" .
"rtrim(coalesce(ju.pasprt,j.pasprt)) as pasprt,\n" .
"rtrim(coalesce(ju.uittre,j.uittre)) as uittre, \n" .
"rtrim(coalesce(ju.renrij,j.renrij)) as renrij, \n" .
" trans_id,operator,op_name as operator_name\n" .
" from jaaglijst j left join jaaglijst_update ju using (id) natural join transaction_operator where id =$id\n" .
"union\n" .
"select to_char((select value::timestamp from peer_settings where key='jaag_import'),'YYYY-MM-DD HH24:MI') as date_time,\n" .
"j.diplvo, \n" .
"j.cijfer,\n" .
"j.betbew,\n" .
"j.pasprt,\n" .
"j.uittre, \n" .
"j.renrij, \n" .
" 0 as trans_id,0 as operator,'Initial import from PS' as operator_name\n" .
" from jaaglijst j where id =$id\n" .
"order by trans_id desc";
$resultSet = $dbConn->execute( $sqlhistory );
if ( $resultSet === false ) {
echo ( "<br>Cannot get prj_id milestone " . $sql . " reason " . $dbConn->ErrorMsg() . "<br>");
}
$hisTable = "<table border='1' style='border-collapse:collapse'>
<tr>
<th class='tabledata head' style='text-algin:left;'>Date time</th>
<th class='tabledata head' style='text-algin:left;'>Diplvo</th>
<th class='tabledata head' style='text-algin:left;'>Cijfer</th>
<th class='tabledata head' style='text-algin:left;'>Betbew</th>
<th class='tabledata head' style='text-algin:left;'>Pasprt</th>
<th class='tabledata head' style='text-algin:left;'>Uittre</th>
<th class='tabledata head' style='text-algin:left;'>Studielink</th>
<th class='tabledata head' style='text-algin:left;'>Trans id</th>
<th class='tabledata head' style='text-algin:left;'>Operator</th>
<th class='tabledata head' style='text-algin:left;'>Operator name</th>
</tr>\n";

while ( !$resultSet->EOF ) {
extract( $resultSet->fields );
$hisTable .= "<tr>\n\t<td>$date_time</td>\n" .
"\t<td class='$diplvo'>$diplvo</td>\n" .
"\t<td class='$cijfer'>$cijfer</td>\n" .
"\t<td class='$betbew'>$betbew</td>\n" .
"\t<td class='$pasprt'>$pasprt</td>\n" .
"\t<td class='$uittre'>$uittre</td>\n" .
"\t<td class='$renrij'>$renrij</td>\n" .
"\t<td style='text-align:right'>$trans_id</td>\n" .
"\t<td style='text-align:center'>$operator</td>\n" .
"\t<td>$operator_name</td>\n" .
"</tr>\n";
$resultSet->moveNext();
}
$hisTable .="</table>\n";
include 'templates/buit.xhtml';
?>
65 changes: 65 additions & 0 deletions deprecated/vang.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php
// phpinfo();
requireCap(CAP_SYSTEM);
if (isSet($_REQUEST['id']) &&
isSet($_REQUEST['boxes'])) {
$id=$_REQUEST['id'];
$sql1 = "select id, \n".
"rtrim(coalesce(ju.diplvo,j.diplvo)) as diplvo,\n".
"rtrim(coalesce(ju.cijfer,j.cijfer)) as cijfer,\n".
"rtrim(coalesce(ju.betbew,j.betbew)) as betbew,\n".
"rtrim(coalesce(ju.pasprt,j.pasprt)) as pasprt,\n".
"rtrim(coalesce(ju.uittre,j.uittre)) as uittre, \n".
"rtrim(coalesce(ju.renrij,j.renrij)) as renrij, \n".
"coalesce(trans_id,0) as trans_id from jaaglijst j \n".
"left join (select * from jaaglijst_update where id=$id and trans_id=(select max(trans_id) ".
"from jaaglijst_update where id=$id)) ju using(id)\n"."where id=$id\n";
$dbConn->log($sql1);
$resultSet=$dbConn->execute($sql1);
if ($resultSet === false ) {
echo "cannot execlute <pre>$sql1</pre>, cause <pre>".$dbConn->ErrorMsg()."</pre>\n";
}
$mustInsert=false;
$ov = array();
$ov['diplvo'] = $resultSet->fields['diplvo'];
$ov['cijfer'] = $resultSet->fields['cijfer'];
$ov['betbew'] = $resultSet->fields['betbew'];
$ov['pasprt'] = $resultSet->fields['pasprt'];
$ov['uittre'] = $resultSet->fields['uittre'];
$ov['renrij'] = $resultSet->fields['renrij'];
// echo "<pre>\n$sql1</pre>\n";
// echo "<pre>\nov=";
// print_r($resultSet->fields);
// print_r($ov);

foreach ($_REQUEST['boxes'] as $box) {
if (isSet($_REQUEST[$box])) {
$ov[$box] = 'Ingeleverd';
} else {
$ov[$box] = 'Gestart';
}
if ($resultSet->fields[$box] != $ov[$box] ) {
$mustInsert = $mustInsert || true;
}
}
if ($mustInsert) {
$trans_id = $dbConn->transactionStart('jaaglijst update');
extract($ov);
$sql = "insert into jaaglijst_update (id,cijfer,betbew,diplvo,pasprt,uittre,renrij,trans_id)\n".
"values($id ,'$cijfer','$betbew','$diplvo','$pasprt','$uittre','$renrij',$trans_id);\n";
$dbConn->log($sql);
$rts=$dbConn->execute($sql);
if ($rts===false){
$dbConn->Execute("rollback;");
die("Cannot get update with $sql cause ".$dbConn->ErrorMsg());
} else {
$dbConn->transactionEnd();
}
}
// // echo "<pre>\nov=";
// print_r($ov);
// echo $mustInsert.' + '.$sql;
// echo "</pre>\n";
}
header('Location: '.$_SERVER['HTTP_REFERER']);
?>
Loading

0 comments on commit 5dca0ab

Please sign in to comment.