コード例 #1
0
 private function sendRequestNotifycation($user, $request)
 {
     $payment_guide = MovieViewerReviewPackPurchasePaymentGuide::create($this->_settings->payment, $request);
     $price_with_notes = plugin_movieviewer_render_price_with_notes($request->getPrice(), "回", true);
     $item_names = $this->getItemNames($request);
     $mail_builder = new MovieViewerReviewPackRequestNotificationMailBuilder($this->_settings->mail);
     $mail = $mail_builder->build($user, $item_names, $price_with_notes, $payment_guide->bank_transfer, $payment_guide->deadline);
     $result = $mail->send();
     if (!$result) {
         MovieViewerLogger::getLogger()->addError("再視聴申し込み通知エラー", array("error_statement" => $mail->ErrorInfo));
         // スタッフ向けはログのみで終わらせる
     }
 }
/**
 * [ブロック] 申し込みの詳細を生成する
 *
 * @param MovieViewerSettings                  $settings プラグインの設定
 * @param MovieViewerReviewPackPurchaseRequest $request  申し込み
 * 
 * @return string 申し込みの詳細(html)
 */
function plugin_movieviewer_review_purchase_start_convert_get_request_details($settings, $request)
{
    $courses = plugin_movieviewer_get_courses_repository()->find();
    $itemsByCourse = $request->getItemsByCourse();
    $item_description = "";
    foreach ($itemsByCourse as $course_id => $items) {
        $course = $courses->getCourse($course_id);
        $session_list = "";
        foreach ($items as $item) {
            $session = $course->getSession($item->session_id);
            $session_list .= "<li>{$session->describe()}</li>";
        }
        $item_description .= <<<TEXT
        {$course->describe()}
        <ul style='margin-left:0;'>
            {$session_list}
        </ul>
TEXT;
    }
    $payment_guide = MovieViewerReviewPackPurchasePaymentGuide::create($settings->payment, $request);
    $hsc = "plugin_movieviewer_hsc";
    if ($request->purchase_method === 'bank') {
        $bank_accounts_with_notes = nl2br($payment_guide->bank_transfer->bank_accounts_with_notes);
        $content_header_payment = <<<TEXT
        <tr><th>振込先</th><td>{$bank_accounts_with_notes}</td></tr>
TEXT;
    } else {
        $acceptable_brands = "";
        foreach ($payment_guide->credit_card->acceptable_brands as $brand) {
            $file_name = "logo_" . strtolower($brand) . ".gif";
            $acceptable_brand = <<<TEXT
            <img src="img/{$file_name}" ALT="{$brand}">
TEXT;
            $acceptable_brands .= $acceptable_brand;
        }
        $content_header_payment = <<<TEXT
        <tr><th>振込先<br>(利用可能なクレジットカード)</th>
        <td style='vertical-align:top;'>{$acceptable_brands}</td>
        </tr>
TEXT;
    }
    $price_with_notes = plugin_movieviewer_render_price_with_notes($request->getPrice(), "回", false);
    $content = <<<TEXT
    <p>
    <table class="movieviewer-purchase-request-details">
        <tr><th>項目</th><td>{$item_description}</td></tr>
        <tr><th>金額</th><td>{$price_with_notes}</td></tr>
        {$content_header_payment}
        <tr><th>振込期限</th><td>{$hsc($payment_guide->deadline->format("Y年m月d日"))}まで</td></tr>
    </table>
    </p>
TEXT;
    return $content;
}