File: /home/awaldron/_accomods/apidev.accomods.com/v1/_pdf_template.php
<?php
function pdf_template($strengths, $needs, $accomods) {
$html = '<html><head><style type="text/css">body{margin: 0; padding: 0; font-family: Arial, -apple-system, BlinkMacSystemFont, "Segoe UI", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif !important; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;} .pdf-header{color: #3E787D; font-weight: 700; border-top: solid 6px #97B92E; text-align: right; height: 75px; padding-top: 8px; margin-bottom: 30px; line-height: 1.2em;}.pdf-body{ margin: 0 10px; page-break-after: always;}h3, .h3{font-size: 1.75rem;}.pdf-body h4{margin-top: 40px;}a, a:link, a:active, a:visited{color: #97B92E; text-decoration: none;}.row{ width:100%; display: flex; flex-wrap: wrap; margin-right: -15px; margin-left: -15px;}.col-sm-6{flex: 0 0 50%; max-width: 50%;}.option-list h4{color: #3E787D; border-bottom: solid 1px #787985;}.select-table{width: 100%; page-break-after: always;}table{border-collapse: collapse;}.select-table td:nth-child(1), .select-table th:nth-child(1){width: 60px;}.select-table thead tr th, .select-table tbody tr:first-child td{border-top: solid 1px #787985;}.select-table thead tr th, .select-table tbody tr td{line-height: 38px; padding: 0 8px;}.select-table td:nth-child(2), .select-table th:nth-child(2){width: auto;}.select-table tbody tr:nth-child(odd){background-color: #f4f6f9;}.select-table td:nth-child(1), .select-table th:nth-child(1){width: 60px;}.select-table tbody tr td{border-bottom: solid 1px #d8dfe9;}.option-list div{display: block;overflow: auto;margin-bottom:6px;}.option-list div img{display:block;float:left;width: 23px;margin-right: 12px;}.option-list div div{display:block;float:left;width: calc(100% - 45px);}h2, .h2{font-size: 2rem;}h1, h2, h3, h4, h5{color: #3E787D;}.pdf-body h4{color: #000;}.select-table{width: 100%;}.select-table-title{color: $color-blue; padding-bottom: 10px;}.select-table thead tr th, .select-table tbody tr td{line-height: 38px; padding: 0 8px;}.select-table thead tr th, .select-table tbody tr:first-child td{border-top: solid 1px #787985;}.select-table thead tr td{border-bottom: solid 1px #787985;}.select-table tbody tr td{border-bottom: solid 1px #d8dfe9;}.select-table tbody tr:nth-child(odd){background-color: #f4f6f9;}.select-table td:nth-child(1), .select-table th:nth-child(1){width: 60px;}.select-table td:nth-child(2), .select-table th:nth-child(2){width: auto;}.select-table td:nth-child(3), .select-table th:nth-child(3){width: 120px;}.container{width: 100%; padding-right: 15px; padding-left: 15px; margin-right: auto; margin-left: auto; } .written-field { border-top: solid 1px #787985; margin: 30px 0; } th { text-align: left; } .col-sm-2 { flex: 0 0 16.666667%; max-width: 16.666667%; } .col-sm-4 { flex: 0 0 33.333333%; max-width: 33.333333%; } .col-sm-1 { flex: 0 0 8.333333%; max-width: 8.333333%; } .col-sm-7 { flex: 0 0 58.333333%; max-width: 58.333333%; } .col-sm-5 { flex: 0 0 41.666666%; max-width: 41.666666%; }
</style></head><body>';
$html .= '<div class="acco-modal-content"><div class="pdf-header"><div class="container"><div class="row">';
$html .= '<div class="col-sm-6" style="text-align:left;"><img src="http://api.accomods.com/logo.png" style="width:225px;height:44px;" /></div>';
$html .= '<div class="col-sm-6 blue" style="text-align:right;"><div style="padding-right:30px;">Action Driven Education<br>accomods.com</div></div>';
$html .= '</div></div></div>';
$html .= '<div class="container">';
$html .= '<div class="row">
<div class="col-sm-7">
<div class="written-field"> Student Name</div>
</div>
<div class="col-sm-1"> </div>
<div class="col-sm-4">
<div class="written-field"> Date</div>
</div>
</div>';
if (count($strengths) > 0 && count($needs) > 0) {
$html .= '<div class="row"><div class="col-sm-6 option-list"><h4>Student Strengths</h4>';
foreach ($strengths as $s) {
$html .= '<div><img src="https://api.accomods.com/check.png" /> <div>'.stripAttributes($s['Name']).'</div></div>';
}
$html .= '</div>';
$html .= '<div class="col-sm-6 option-list"><h4>Student Needs</h4>';
foreach ($needs as $n) {
$html .= '<div><img src="http://api.accomods.com/check.png" /> <div>'.stripAttributes($n['Name']).'</div></div>';
}
$html .= '</div></div></div>';
$html .= '<br/><br/>';
}
$html .= '<h4 class="blue">Accomod Index</h4>';
$html .= '<table class="select-table"><thead><tr><th>ID</th><th>Accomod Title</th></tr></thead><tbody>';
foreach ($accomods as $a) {
$html .= '<tr><td>'.$a['Key'].'</td><td>'.stripAttributes($a['Title']).'</a></td></tr>';
}
$html .= '</tbody></table>';
$html .= '<div class="accomod-list">';
foreach ($accomods as $a) {
$html .= '<div class="pdf-body"><h3 class="blue">'.$a['Key'].' - '.stripAttributes($a['Title']).'</h3>';
if (!empty($a['Subtitle'])) $html .= '<h3>'.stripAttributes($a['Subtitle']).'</h3>';
$html .= '<h4>Description of Accommodation or Modification:</h4><div>'.stripAttributes($a['Description'], 'None.').'</div>';
$html .= '<h4>Considerations:</h4><div>'.stripAttributes($a['Considerations'], 'None.').'</div>';
$html .= '<h4>Examples:</h4><div>'.stripAttributes($a['Examples'], 'None.').'</div>';
$html .= '<h4>Related downloads, links or other items:</h4><div>'.stripAttributes($a['RelatedLinks'], 'None.').'</div>';
$html .= '</div>';
}
$html .= '</div>';
$html .= '</div></body></html>';
return $html;
}
function pdf_email( $data, $filepath ) {
$txt = $data['data']['sender']['first'] . ' ' . $data['data']['sender']['last'] . ' has created an Accomods plan and would like you to view it.' . "\n\n"
. $data['data']['sender']['first'] . ' says: ' . "\n" . $data['data']['message'] . "\n\n\n";
$html = nl2br($txt);
$mail = new PHPMailer\PHPMailer\PHPMailer();
$mail->IsSMTP();
$mail->Mailer = "smtp";
$mail->Host = "mail.smtp2go.com";
$mail->Port = "2525"; // 8025, 587 and 25 can also be used. Use Port 465 for SSL.
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'tls';
$mail->Username = "accomods";
$mail->Password = "dTZpM29jb3l3MjAw";
$mail->From = $data['data']['sender']['email'];
$mail->FromName = $data['data']['sender']['last'].', '.$data['data']['sender']['first'];
foreach ($data['data']['emails'] as $em) {
$mail->AddAddress($em);
}
$mail->AddAddress($data['data']['sender']['email']);
$mail->AddReplyTo($data['data']['sender']['email'], $data['data']['sender']['last'].', '.$data['data']['sender']['first']);
$mail->addAttachment($filepath); // Add attachments
$mail->isHTML(true);
$mail->Subject = "Accomods Plan";
$mail->Body = $html;
return !!$mail->Send();
}
function send_pw_email( $email ) {
$url_email = str_ireplace('@', '%40', $email);
$html = '<html><head>';
$html .= '<style>.btn{display:inline-block;padding:10px 30px;color:#fff;background-color:#3e787d;text-decoration:none;font-size:16px;}</style>';
$html .= '<body>';
$html .= '<img src="http://api.accomods.com/logo.png" style="width:225px;height:44px;" />';
$html .= '<h2>Welcome to Accomods</h2>';
$html .= '<p><b>Your payment has been received and you may now complete your registration at the Accomods website.</b></p>';
$html .= '<p>If you haven\'t already done so, complete your registration by clicking the link below and you will be taken to a webpage where you will set your Accomods password.</p>';
$html .= '<p><a href="https://accomods.com/register/complete?thrivecart%5Bcustomer%5D%5Bemail%5D='.$url_email.'" class="btn">Set Your Accomods Password</a></p><br/>';
$html .= '<p>If you have any questions, comments, or concerns, please do not hesitate to contact us at <a href="mailto:admin@actiondriveneducation.com">admin@actiondriveneducation.com</a>.</p>';
$html .= '<p>Thank you for joining Accomods, we\'re excited to have you!</p>';
$html .= '</body></head></html>';
$mail = new PHPMailer\PHPMailer\PHPMailer();
$mail->IsSMTP();
$mail->Mailer = "smtp";
$mail->Host = "mail.smtp2go.com";
$mail->Port = "2525"; // 8025, 587 and 25 can also be used. Use Port 465 for SSL.
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'tls';
$mail->Username = "accomods";
$mail->Password = "dTZpM29jb3l3MjAw";
$mail->From = 'admin@actiondriveneducation.com';
$mail->FromName = 'Action Driven Education';
$mail->AddAddress($email);
$mail->AddReplyTo('admin@actiondriveneducation.com', 'Action Driven Education');
$mail->isHTML(true);
$mail->Subject = "Accomods: Complete Your Registration";
$mail->Body = $html;
return !!$mail->Send();
}
function monitoring_form_template($accomods) {
$html = '<html><head> <style type="text/css"> .pdf-body, .select-table{page-break-after: always}.option-list h4, .pdf-header, h1, h2, h3, h4, h5{color: #3e787d}.option-list h4, .select-table thead tr td{border-bottom: 1px solid #787985}body{margin: 0; padding: 0; font-family: Arial, -apple-system, BlinkMacSystemFont, "Segoe UI", Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif !important; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale}.pdf-header{font-weight: 700; border-top: 6px solid #97b92e; text-align: right; padding-top: 8px; margin-bottom: 20px; line-height: 1.2em}.select-table tbody tr:first-child td, .select-table thead tr th, .written-field{border-top: 1px solid #787985}.pdf-body{margin: 0 10px}.h3, h3{font-size: 1.75rem}a, a:active, a:link, a:visited{color: #97b92e; text-decoration: none}.row{width: 100%; display: flex; flex-wrap: wrap; margin-right: -15px; margin-left: -15px}.select-table{width: 100%}table{border-collapse: collapse}.option-list div{display: block; overflow: auto; margin-bottom: 6px}.option-list div img{display: block; float: left; width: 23px; margin-right: 12px}.option-list div div{display: block; float: left; width: calc(100% - 45px)}.h2, h2{font-size: 2rem}.pdf-body h4{margin-top: 40px; color: #000}.select-table-title{color: $ color-blue; padding-bottom: 10px}.select-table tbody tr td, .select-table thead tr th{line-height: 38px; padding: 0 8px}.select-table tbody tr td{border-bottom: 1px solid #d8dfe9}.select-table tbody tr:nth-child(odd){background-color: #f4f6f9}.select-table td:first-child, .select-table th:first-child{width: 60px}.select-table td:nth-child(2), .select-table th:nth-child(2){width: auto}.select-table td:nth-child(3), .select-table th:nth-child(3){width: 120px}.container{width: 100%; padding-right: 15px; padding-left: 15px; margin-right: auto; margin-left: auto}th{text-align: left}.col-sm-1{flex: 0 0 8.333333%; max-width: 8.333333%}.col-sm-2{flex: 0 0 16.666666%; max-width: 16.666666%}.col-sm-3{flex: 0 0 24.999999%; max-width: 24.999999%}.col-sm-4{flex: 0 0 33.333333%; max-width: 33.333333%}.col-sm-6{flex: 0 0 50%; max-width: 50%}.col-sm-7{flex: 0 0 58.333333%; max-width: 58.333333%}.col-sm-9{flex: 0 0 74.999999%; max-width: 74.999999%}.col-sm-10{flex: 0 0 83.333333%; max-width: 83.333333%}.monitoring-repeat{break-inside: avoid}.monitoring-image{margin-top: 15px}.writing-space{margin-top:0;}.written-field{font-size: 12px; font-weight: 700; color: #3e787d; padding-top: 3px; text-align: left; width: 100%;}.written-value{font-weight: 500; margin: 0 5px; padding-bottom: 6px; font-size: 15px; overflow: hidden; white-space: nowrap}.col-sm-5{flex: 0 0 41.666666%; max-width: 41.666666%;}.split-row{width: 100%; display: flex; flex-direction: row; justify-content: space-between; align-items: flex-end;}.logo-div{text-align: center; width: 275px;}.writing-div{width: calc( 100% - 300px ); display: flex; flex-direction: row; justify-content: space-between; align-items: flex-end;}.writing-div > div{width: 32%;}.logo{max-width: 100%; margin-bottom: 10px; display: block;}.title{font-size: 16px; color: #97b92e;}.repeat-header{width: 100%;}.section-head{width: 49%;}</style></head><body>';
foreach ($accomods as $acco) {
$html .= '
<div class="monitoring-repeat">
<div class="acco-modal-content">
<div class="pdf-header">
<div class="split-row">
<div class="logo-div">
<img src="http://api.accomods.com/logo.png" class="logo" />
</div>
<div class="writing-div">
<div>
<div class="writing-space"> </div>
<div class="written-field"> Student Name</div>
</div>
<div>
<div class="writing-space"> </div>
<div class="written-field"> Teacher(s)</div>
</div>
<div>
<div class="writing-space"> </div>
<div class="written-field"> Class/Subject</div>
</div>
</div>
</div>
</div>
<div class="split-row">
<div class="section-head">
<div class="written-value">'.$acco['key'].': '.$acco['title'].'</div>
<div class="written-field"> Accommodation / Modification</div>
</div>
<div class="section-head">
<div class="written-value">'.implode(', ',$acco['needs']).'</div>
<div class="written-field"> Supported Needs</div>
</div>
</div>
<div class="container">
<div class="row monitoring-image">
<div class="col-sm-12">
<img src="https://api.accomods.com/img/monitoring-table-lg.png" style="max-width: 100%" />
</div>
</div>
</div>
</div>
';
}
$html .= '</body></html>';
return $html;
}
/*
function monitoring_form_template_bak($accomods) {
$html = '<html><head><style type="text/css">
.pdf-body,.select-table{page-break-after:always}.option-list h4,.pdf-header,h1,h2,h3,h4,h5{color:#3e787d}.option-list h4,.select-table thead tr td{border-bottom:1px solid #787985}body{margin:0;padding:0;font-family:Arial,-apple-system,BlinkMacSystemFont,"Segoe UI",Oxygen,Ubuntu,Cantarell,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif!important;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.pdf-header{font-weight:700;border-top:6px solid #97b92e;text-align:right;height:75px;padding-top:8px;margin-bottom:20px;line-height:1.2em}.select-table tbody tr:first-child td,.select-table thead tr th,.written-field{border-top:1px solid #787985}.pdf-body{margin:0 10px}.h3,h3{font-size:1.75rem}a,a:active,a:link,a:visited{color:#97b92e;text-decoration:none}.row{width:100%;display:flex;flex-wrap:wrap;margin-right:-15px;margin-left:-15px}.col-sm-6{flex:0 0 50%;max-width:50%}.select-table{width:100%}table{border-collapse:collapse}.option-list div{display:block;overflow:auto;margin-bottom:6px}.option-list div img{display:block;float:left;width:23px;margin-right:12px}.option-list div div{display:block;float:left;width:calc(100% - 45px)}.h2,h2{font-size:2rem}.pdf-body h4{margin-top:40px;color:#000}.select-table-title{color:$color-blue;padding-bottom:10px}.select-table tbody tr td,.select-table thead tr th{line-height:38px;padding:0 8px}.select-table tbody tr td{border-bottom:1px solid #d8dfe9}.select-table tbody tr:nth-child(odd){background-color:#f4f6f9}.select-table td:first-child,.select-table th:first-child{width:60px}.select-table td:nth-child(2),.select-table th:nth-child(2){width:auto}.select-table td:nth-child(3),.select-table th:nth-child(3){width:120px}.container{width:100%;padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}th{text-align:left}.col-sm-2{flex:0 0 16.666667%;max-width:16.666667%}.col-sm-4{flex:0 0 33.333333%;max-width:33.333333%}.col-sm-1{flex:0 0 8.333333%;max-width:8.333333%}.col-sm-7{flex:0 0 58.333333%;max-width:58.333333%}.monitoring-repeat{margin-top:50px;break-inside:avoid}.monitoring-image{margin-top:15px}.written-field{font-size:12px;font-weight:700;margin:0 20px 0 0;color:#3e787d;padding-top:3px}.written-value{font-weight:400;margin:0 5px;padding-bottom:6px;font-size:16px;overflow:hidden;white-space:nowrap} .col-sm-5 { flex: 0 0 41.666666%; max-width: 41.666666%; }
</style></head><body>
<div class="acco-modal-content"><div class="pdf-header"><div class="container"><div class="row"><div class="col-sm-6" style="text-align:left;"><img src="http://api.accomods.com/logo.png" style="width:225px;height:44px;" /></div><div class="col-sm-6 blue" style="text-align:right;"><div style="padding-right:30px;font-size:24px">Accommodation Monitoring Form</div></div></div></div></div>
<div class="container">
<div class="row"><div class="col-sm-4"><div class="written-field"> Student Name</div></div><div class="col-sm-4"><div class="written-field"> Teacher(s)</div></div><div class="col-sm-4"><div class="written-field"> Class/Subject</div></div></div>';
foreach ($accomods as $acco) {
$html .= '
<div class="monitoring-repeat">
<div class="row">
<div class="col-sm-7">
<div class="written-value">'.$acco['key'].': '.$acco['title'].'</div>
<div class="written-field"> Accommodation / Modification:</div>
</div>
<div class="col-sm-5">
<div class="written-value">'.implode(', ',$acco['needs']).'</div>
<div class="written-field"> Supported Needs</div>
</div>
</div>
<div class="row monitoring-image">
<div class="col-sm-12">
<img src="https://api.accomods.com/img/monitoring-table-lg.png" style="max-width: 100%" />
</div>
</div>
</div>
';
}
$html .= '</div></body></html>';
return $html;
}
*/
?>