Select Git revision
P1Sequence.html
composeLetter.php 3.90 KiB
<?php
if (!isset($gCms)) exit;
//echo '<pre>'; print_r($records); echo '</pre>'; exit;
$contents = 'Upcoming Seminars at the Department of Automatic Control, LTH'
."\n------------------\n\n";
foreach ($records as $record) {
$contents .= $record->date . ' ' . $record->start;
if (isset($record->end)) {
$contents .= "--$record->end";
}
// if ($record->type != 'Standard') { $contents .= " $record->type"; }
if (isset($record->typeName)) { $contents .= ' ' . $record->typeName; }
$contents .= "\n $record->title";
foreach ($record->speakers as $speaker) {
$name = $speaker->name;
$contents .= "\n $name";
if (isset($speaker->affiliation)) {
$contents .= ", $speaker->affiliation";
}
}
if ($record->advisors) {
$contents .= "\n $record->title_advisor";
$marg = ' ';
if (count($record->advisors) > 1) { $marg = "\n "; }
foreach ($record->advisors as $speaker) {
$name = $speaker->name;
$contents .= $marg . $name;
if ($speaker->affiliation) {
$contents .= ", $speaker->affiliation";
}
}
}
if ($record->opponents) {
$contents .= "\n $record->title_opponent";
$marg = ' ';
if (count($record->opponents) > 1) { $marg = "\n "; }
foreach ($record->opponents as $speaker) {
$name = $speaker->name;
$contents .= $marg . $name;
if ($speaker->affiliation) {
$contents .= ", $speaker->affiliation";
}
}
}
if ($record->chairpersons) {
$contents .= "\n $record->title_chairperson";
$marg = ' ';
if (count($record->chaipersons) > 1) { $marg = "\n "; }
foreach ($record->chairpersons as $speaker) {
$name = $speaker->name;
$contents .= $marg . $name;
if ($speaker->affiliation) {
$contents .= ", $speaker->affiliation";
}
}
}
if ($record->examiners) {
$contents .= "\n $record->title_examiner";
$marg = ' ';
if (count($record->examiners) > 1) { $marg = "\n "; }
foreach ($record->examiners as $speaker) {
$name = $speaker->name;
$contents .= $marg . $name;
if ($speaker->affiliation) {
$contents .= ", $speaker->affiliation";
}
}
} if (isset($record->roomSentence)) {
$contents .= "\n\n $record->roomSentence";
}
$contents .= "\n------------------\n\n";
}
$contents .= 'All seminars are held at the Department of Automatic Control,'
. ' in the new seminar room M:2498 (on the second floor in the M-building),'
. ' unless stated otherwise.'. "\n\n"
. 'Further information, see http://www.control.lth.se/seminars.html.';
$place = $this->CreateFormStart($id, 'sendLetter', $returnid);
$smarty->assign('letter_Form', $place);
$address = 'seminars.dis@control.lth.se';
$place = $this->CreateInputText($id, 'address', $address, 60);
$smarty->assign('input_address', $place);
$subject = 'Seminars at Automatic Control';
$place = $this->CreateInputText($id, 'subject', $subject, 60);
$smarty->assign('input_subject', $place);
$place = $this->CreateTextArea(FALSE,$id,$contents,'contents');
$smarty->assign('letter_contents',$place);
$place = $this->CreateInputSubmit($id, 'sendIt', 'Send Letter');
$smarty->assign('submit_letter', $place);
$smarty->assign('end_letter_form', $this->CreateFormEnd());
// Display the populated template
echo $this->ProcessTemplate('sendLetter.tpl');
//echo '<pre>'; print_r($params); echo '</pre>';
//echo '<pre>'; print_r($contents); echo '</pre>';
//echo '<pre>'; print_r($records); echo '</pre>';
//file_put_contents("/tmp/letter.txt", $contents);
// $cmsmailer = $this->GetModuleInstance('CMSMailer');
// $cmsmailer->AddAddress('seminars.dis@control.lth.se');
// $cmsmailer->SetCharSet('utf-8');
// $cmsmailer->SetFrom('seminar_announcer@control.lth.se');
// $cmsmailer->SetFromName('Seminar Announcer');
// $cmsmailer->SetBody($contents);
// $cmsmailer->IsHTML(false);
// $cmsmailer->SetSubject('Seminars at Automatic Control');
// $cmsmailer->Send();
?>