} $mailbody = file_get_contents($templatefile, true); $mailbody .= $signature; if (isset($_POST['mailbody'])) { $mailbody = preg_replace('/"/', '\'', $_POST['mailbody']); // $dbConn->log($mailbody); } if (isset($_POST['formsubject'])) { $formsubject = $_POST['formsubject']; } if (isset($_POST['snmailto']) && isset($_POST['domail'])) { $snmailto = $_POST['snmailto']; $mailset = '\'' . implode("','", $snmailto) . '\''; $sql = "select distinct email1,email2, tutor_email, \n" . "s.roepnaam ||' '||coalesce(s.voorvoegsel,'')||' '||s.achternaam as name\n" . ", afko, description,milestone,assessment_due as due \n" . " from prj_grp pg \n" . " join student s on (s.snummer=pg.snummer) \n" . " join prj_tutor pt on(pt.prjtg_id=pg.prjtg_id) \n" . " join tutor t on(userid=tutor_id) \n" . " join prj_milestone pm on(pt.prjm_id=pm.prjm_id) \n" . " join project p on (pm.prj_id=p.prj_id)\n" . " join tutor_data td on (pt.tutor_id=td.tutor_id)" . " left join alt_email aem on (s.snummer=aem.snummer)\n" . "where s.snummer in ({$mailset}) and pm.prjm_id={$prjm_id}"; $dbConn->log($sql); formMailer($dbConn, $sql, $formsubject, $mailbody, $sender, $sender_name); } $page_opening = "These students are overdue with filling in their peer assessment forms."; $nav = new Navigation(array(), basename($PHP_SELF), $page_opening); $page = new PageContainer(); $page->addBodyComponent($nav); ob_end_clean(); if (hasCap(CAP_SYSTEM)) { $tutor_select = ""; } else { $tutor_select = " and (tutor='{$tutor}' or tutor_owner='{$tutor}') "; } ob_start(); $prjSel->setWhere("assessment_due <now() and pm.prj_milestone_open=true"); $prj_id_selector = $prjSel->getWidget(); $sqlhead = "select afko as code,pm.milestone as milstn,pt.grp_num,\n" . "s.snummer as snmailto,s.snummer,\n" . "achternaam||coalesce(', '||voorvoegsel,'') as achternaam\n" . ",roepnaam, s.snummer,pm.assessment_due as due,tutor\n";
$dbConn->Execute($sql); $result = $dbConn->Affected_Rows(); if ($result == 0) { $sql = "update meeloopmail 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 meeloop_datum='{$pp['meeloop_datum']}'"; $dbConn->Execute($sql); $result = $dbConn->Affected_Rows(); } } if (isset($_POST['mail']) && isset($_POST['domail'])) { $mail = $_POST['mail']; $mailset = '\'' . implode("','", $mail) . '\''; $sql_de = "select meelopen_id,email as email1, \n" . "roepnaam ||' '||coalesce(tussenvoegsel,'')||' '||achternaam as name\n" . "from meelopen\n" . "where taal ='DE' and meelopen_id in ({$mailset})"; $sql_nl = "select meelopen_id,email as email1, \n" . "roepnaam ||' '||coalesce(tussenvoegsel,'')||' '||achternaam as name\n" . "from meelopen\n" . "where taal ='NL' and meelopen_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 meelopen set invitation=now()::date where meelopen_id in ({$mailset});\n" . "update meeloopmail set invitation_datum = now()::date where owner={$peer_id} and meeloop_datum='{$pp['meeloop_datum']}';\n" . "commit"; $rs = $dbConn->Execute($sql); if ($rs === false) { $dbConn->Execute('rollback'); } } $sql = "select '<input type=''checkbox'' name=''mail[]'' value='''||meelopen_id||'''/>' as chk,\n" . "achternaam,roepnaam,tussenvoegsel,plaats,land,postcode,email,sex,datum_in,invitation \n" . "from meelopen 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='meeloop studenten'" . " style='empty-cells:show;border-collapse:collapse' border='1'>"); $page->addHtmlFragment('templates/meeloopdag.html', $pp); $page->addHeadText(file_get_contents('templates/simpledatepicker.html')); $page->addScriptResource('js/jquery-1.7.1.min.js'); $page->addScriptResource('js/jquery-ui-1.8.17.custom.min.js'); $page->addJqueryFragment('$(\'#meeloop_datum\').datepicker(dpoptions);');