当前位置: 首页>>代码示例>>PHP>>正文


PHP Notification::renderEmail方法代码示例

本文整理汇总了PHP中Notification::renderEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP Notification::renderEmail方法的具体用法?PHP Notification::renderEmail怎么用?PHP Notification::renderEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Notification的用法示例。


在下文中一共展示了Notification::renderEmail方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: foreach

// Make sure this is the first time
// the user has used the website
if (!User::firstUse()) {
    Session::setError('Cannot register, you have already registered before.');
    Session::redirect('/');
}
// If the request is post, try and sign them up
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    foreach ($_POST['register'] as $key => $value) {
        if (is_array($value)) {
            $result = User::setEducation($value);
        } else {
            $result = User::setAttribute($key, $value);
        }
        if ($result == false) {
            Session::setError('Unable to complete your registration, please try again.');
            Session::redirect('/register');
        }
    }
    $user = User::getUser();
    $registration = UTSHelpsAPI::RegisterStudent(['StudentId' => $user['student_id'], 'DateOfBirth' => $user['dob'], 'Gender' => $user['gender'], 'Degree' => $user['degree'], 'Status' => $user['status'], 'FirstLanguage' => $user['first_language'], 'CountryOrigin' => $user['country_of_origin'], 'DegreeDetails' => $user['year'], 'AltContact' => $user['best_contact_no'], 'PreferredName' => $user['preferred_first_name'], 'HSC' => (bool) $user['hsc'], 'HSCMark' => $user['hsc_mark'], 'IELTS' => (bool) $user['ielts'], 'IELTSMark' => $user['ielts_mark'], 'TOEFL' => (bool) $user['toefl'], 'TOEFLMark' => $user['toefl_mark'], 'TAFE' => (bool) $user['tafe'], 'TAFEMark' => $user['tafe_mark'], 'CULT' => (bool) $user['cult'], 'CULTMark' => $user['cult_mark'], 'InsearchDEEP' => (bool) $user['insearch_deep'], 'InsearchDEEPMark' => $user['insearch_deep_mark'], 'InsearchDiploma' => (bool) $user['insearch_diploma'], 'InsearchDiplomaMark' => $user['insearch_diploma_mark'], 'FoundationCourse' => (bool) $user['foundation_course'], 'FoundationCourseMark' => $user['foundation_course_mark'], 'CreatorId' => 123456]);
    $message = Notification::renderEmail('emails/registration.html', ['name' => $user['name']]);
    Notification::sendEmail($user['email'], $user['name'], 'Registration Successful', $message);
    User::setFirstUse();
    User::setLastLogin();
    Session::setSuccess('You have successfully saved your registration details.');
    Session::redirect('/');
}
// Get the user
$page['user'] = User::getUser();
$page['educational-backgrounds'] = ['hsc' => ['label' => 'HSC', 'key' => 'hsc'], 'ielts' => ['label' => 'IELTS', 'key' => 'ielts'], 'toefl' => ['label' => 'TOEFL', 'key' => 'toefl'], 'tafe' => ['label' => 'TAFE', 'key' => 'tafe'], 'cult' => ['label' => 'CULT', 'key' => 'cult'], 'insearchDeep' => ['label' => 'Insearch DEEP', 'key' => 'insearchDeep'], 'insearchDiploma' => ['label' => 'Insearch Diploma', 'key' => 'insearchDiploma'], 'foundationCourse' => ['label' => 'Foundation Course', 'key' => 'foundationCourse']];
开发者ID:Outlaw11A,项目名称:SDP2015,代码行数:31,代码来源:register.php

示例2: pathinfo

        $page['field']['taught'] = $_POST['attendance']['taught'];
        $page['field']['learn'] = $_POST['attendance']['learn'];
    } else {
        // Make sure the file name does not contain php in it
        if (strpos($_FILES['attendance']['name']['file'], 'php')) {
            Session::setError('File rejected');
            Session::redirect('/bookings');
        }
        // Make the filename
        $extension = pathinfo($_FILES['attendance']['name']['file'], PATHINFO_EXTENSION);
        $filename = Attendance::generateRandomFileName() . '.' . $extension;
        // Upload file path
        $uploadedFile = $GLOBALS['file-directory'] . basename($filename);
        if (!move_uploaded_file($_FILES['attendance']['tmp_name']['file'], $uploadedFile)) {
            Session::setError('Unable to upload file, please try again.');
            Session::redirect('/bookings');
        }
        $createAttendance = Attendance::createAttendance($bookingId, $page['booking']->workshopID, $_POST['attendance']['learn'], $_POST['attendance']['taught'], $filename);
        $updateBooking = UTSHelpsAPI::UpdateWorkshopBooking(['workshopId' => $page['booking']->workshopID, 'studentId' => User::getPaddedId(), 'Attended' => 1, 'Canceled' => 0, 'userId' => 123]);
        if ($createAttendance && $updateBooking != null && $updateBooking->IsSuccess == 1) {
            // Send the email notification
            $user = User::getUser();
            $message = Notification::renderEmail('emails/record-attendance.html', ['name' => $user['name'], 'bookingId' => $bookingId]);
            Notification::sendEmail($user['email'], $user['name'], 'Recorded Attendance', $message);
            Session::setSuccess('Successfully recorded attendance for this booking.');
            Session::redirect('/bookings');
        }
        Session::setError('Unable to record attendance for this booking, please try again.');
        Session::redirect('/bookings');
    }
}
开发者ID:Outlaw11A,项目名称:SDP2015,代码行数:31,代码来源:attendance.php

示例3:

<?php

// Make sure the id is specified
if (!array_key_exists('id', $_POST) && $_POST['id'] == null) {
    Session::returnJsonMessage(['success' => false, 'message' => 'No workshop ID provided, unable to join workshop waiting list.']);
}
$id = $_POST['id'];
$waitinglist = UTSHelpsAPI::CreateWorkshopWaiting(['workshopId' => $id, 'studentId' => User::getPaddedId(), 'userId' => '123']);
if ($waitinglist != null && $waitinglist->IsSuccess == 1) {
    // Send the email notification
    $user = User::getUser();
    $message = Notification::renderEmail('emails/waiting-list.html', ['name' => $user['name'], 'workshopId' => $id]);
    Notification::sendEmail($user['email'], $user['name'], 'Joined Waiting List', $message);
    Session::returnJsonMessage(['success' => true, 'message' => 'Successfully joined waiting list!']);
}
Session::returnJsonMessage(['success' => false, 'message' => 'Unable to join waiting list, you have already joined it.']);
开发者ID:Outlaw11A,项目名称:SDP2015,代码行数:16,代码来源:join-waiting-list.php

示例4: foreach

// Make sure the id is specified
if (!array_key_exists('id', $_POST) && $_POST['id'] == null) {
    Session::returnJsonMessage(['success' => false, 'message' => 'No workshop ID provided, unable to book workshop.']);
}
$id = $_POST['id'];
// Check if the person hasn't already signed up to the workshop before
$bookings = UTSHelpsAPI::SearchWorkshopBookings(['studentId' => User::getPaddedId(), 'pageSize' => 9999, 'active' => true]);
if ($bookings != null && $bookings->IsSuccess == 1) {
    // Make sure the user hasn't already booked this workshop before.
    foreach ($bookings->Results as $booking) {
        if ($booking->workshopID == (int) $id && $booking->BookingArchived == null) {
            Session::returnJsonMessage(['success' => false, 'message' => 'You have already booked this workshop, unable to book workshop.']);
        }
    }
} else {
    Session::returnJsonMessage(['success' => false, 'message' => 'Unable to book workshop, an unknown error occured.']);
}
// If the user has too many strikes, don't allow them to book.
if (User::getStrikes() >= User::getMaxStrikes()) {
    Session::returnJsonMessage(['success' => false, 'message' => 'Unable to create booking, you have too many strikes.']);
}
// This user hasn't booked the workshop before, we can safely book it now.
$booking = UTSHelpsAPI::CreateWorkshopBooking(['workshopId' => $id, 'studentId' => User::getPaddedId(), 'userId' => 123]);
if ($booking != null && $booking->IsSuccess == 1) {
    // Send the email notification to the user
    $user = User::getUser();
    $message = Notification::renderEmail('emails/booking.html', ['name' => $user['name'], 'workshopId' => $id]);
    Notification::sendEmail($user['email'], $user['name'], 'Booking Created', $message);
    Session::returnJsonMessage(['success' => true, 'message' => 'Successfully booked workshop!']);
}
Session::returnJsonMessage(['success' => false, 'message' => 'Unable to create booking, please try again.']);
开发者ID:Outlaw11A,项目名称:SDP2015,代码行数:31,代码来源:book.php

示例5: Award

         $data = ['task' => $notice->task, 'extra' => '<a style="position: fixed; bottom:0; text-align:center;padding:25px 0;background-color:#FF6666;width:100%;color:white;font-family: Montserrat, Arial, sans-serif;text-transform:uppercase;font-size:12px;letter-spacing:1px;" href="' . $back_url . '">Back to Admin</a>'];
         // award info
         if (Input::get('event') == Notification::NOTIFICATION_NEW_AWARD) {
             $data['award'] = new Award(['user_id' => Auth::id(), 'project_id' => Project::getRandomID(), 'name' => Input::get('award_type', Award::AWARD_CLAIMED_5)]);
         }
         // get emails
         $emails = explode(',', Input::get('emails', 'tvanderlin@ideo.com'));
         // filter fake ones
         $emails = array_filter($emails, function ($a) {
             if (filter_var($a, FILTER_VALIDATE_EMAIL)) {
                 return $a;
             }
         });
         $pre_render = Input::get('pre_render', false) == "on" ? true : false;
         if (Input::get('view')) {
             return $notice->renderEmail($data)->downloadHtml();
         }
         // get the subject
         $subject = Input::get('subject', Auth::user()->getName() . " Halp Email Test:" . $notice->event . " " . uniqid());
         $status = $notice->sendEmailToGroup($emails, $subject, $data);
         return ['status' => $status, 'notice' => $notice, 'input' => Input::all()];
         dd($notice);
     });
 });
 // ------------------------------------------------------------------------
 // Notifications
 // ------------------------------------------------------------------------
 Route::group(['prefix' => 'notifications'], function () {
     Route::get('/', function () {
         return View::make('admin.notifications.index', ['active_link' => 'notifications', 'notifications' => Notification::orderBy('created_at', 'DESC')->get()]);
     });
开发者ID:vanderlin,项目名称:halp,代码行数:31,代码来源:admin_routes.php


注:本文中的Notification::renderEmail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。