|
|
|
|
|
/student-portal-email-test/
/student-portal-email-test/
|
|
Student Portal Email Test
Student Portal Email Test
|
|
<templates:section>
<h1>Student Portal Email Test</h1>
<p>Enter your content here</p>
</templates:section>
<templates:section>
<h1>Student Portal Email Test</h1>
<p>Enter your content here</p>
</templates:section>
|
|
{"togglable_footerCTA":null,"togglable_memberCTA":"on","togglable_testCTA":null,"togglable_newslettercta":null}
{"togglable_footerCTA":null,"togglable_memberCTA":"on","togglable_testCTA":null,"togglable_newslettercta":null}
|
|
|
|
|
|
<?php
$arrPost = [];
$arrContacts = [];
sendNewPostEmail($arrPost);
function sendNewPostEmail($arrPost, $arrContacts = [])
{
if (!$arrContacts)
return;
$iCourseId = $arrPost['course_id'];
if (!$arrCourse = \Components\AF\Courses::get($iCourseId))
return;
// Set course title for either collective or private course
if ($arrCourse['course_type'] === 'collective')
{
$arrProduct = \Components\Commerce\Products::getIncludingDeleted($arrCourse['product_id']);
$strCourseTitle = $arrProduct['product_title'] ?? null;
} else
$strCourseTitle = $arrCourse['course_code'];
$strSubject = 'There\'s a new post for your ' . $strCourseTitle . ' class';
$strTemplatePageId = '/admin/af/courses/posts/email-templates/post-new/';
$iPostId = $arrPost['post_id'];
// Attachments
$arrAttachmentsData = [];
if ($arrAttachments = \Components\AF\Courses\Posts::attachmentsGet($iPostId))
{
$arrAttachmentsData['shared_folder_name'] = 'courses_posts_' . $iPostId; // Correspondence shared attachments folder
foreach ($arrAttachments as $strAttachment)
$arrAttachmentsData['attachments'][] = \Components\AF\Courses\Posts::getPrivateMediaDir() . $iPostId . '/' . $strAttachment;
}
// Build vars
$arrVariables = [
'course' => $arrCourse,
'post' => $arrPost,
'post_contact' => \Components\Customers\Contacts::get($arrPost['contact_id']),
'post_contact_title' => \Components\AF\Courses\Posts::renderTitleForContact($arrPost['contact_id'], $arrCourse['course_id']),
'course_title' => $strCourseTitle,
// 'media_attachments' => $arrMediaAttachments
];
// Send email notification
foreach ($arrContacts as $arrContact)
{
\Components\AF\StudentPortal::sendMail($arrContact, $strSubject, $strTemplatePageId, $arrVariables, $arrAttachmentsData);
}
}
?>
<?php
$arrPost = [];
$arrContacts = [];
sendNewPostEmail($arrPost);
function sendNewPostEmail($arrPost, $arrContacts = [])
{
if (!$arrContacts)
return;
$iCourseId = $arrPost['course_id'];
if (!$arrCourse = \Components\AF\Courses::get($iCourseId))
return;
// Set course title for either collective or private course
if ($arrCourse['course_type'] === 'collective')
{
$arrProduct = \Components\Commerce\Products::getIncludingDeleted($arrCourse['product_id']);
$strCourseTitle = $arrProduct['product_title'] ?? null;
} else
$strCourseTitle = $arrCourse['course_code'];
$strSubject = 'There\'s a new post for your ' . $strCourseTitle . ' class';
$strTemplatePageId = '/admin/af/courses/posts/email-templates/post-new/';
$iPostId = $arrPost['post_id'];
// Attachments
$arrAttachmentsData = [];
if ($arrAttachments = \Components\AF\Courses\Posts::attachmentsGet($iPostId))
{
$arrAttachmentsData['shared_folder_name'] = 'courses_posts_' . $iPostId; // Correspondence shared attachments folder
foreach ($arrAttachments as $strAttachment)
$arrAttachmentsData['attachments'][] = \Components\AF\Courses\Posts::getPrivateMediaDir() . $iPostId . '/' . $strAttachment;
}
// Build vars
$arrVariables = [
'course' => $arrCourse,
'post' => $arrPost,
'post_contact' => \Components\Customers\Contacts::get($arrPost['contact_id']),
'post_contact_title' => \Components\AF\Courses\Posts::renderTitleForContact($arrPost['contact_id'], $arrCourse['course_id']),
'course_title' => $strCourseTitle,
// 'media_attachments' => $arrMediaAttachments
];
// Send email notification
foreach ($arrContacts as $arrContact)
{
\Components\AF\StudentPortal::sendMail($arrContact, $strSubject, $strTemplatePageId, $arrVariables, $arrAttachmentsData);
}
}
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|