private function canStartOffering($last_confirmation)
 {
     // 何も購入していない場合は、いつでもオファーを開始できる
     if ($last_confirmation === null) {
         return true;
     }
     // 直近の視聴期限をすぎている場合は、いつでもオファーを開始できる
     if ($last_confirmation->viewing_period->isExpired()) {
         return true;
     }
     // 直近の視聴期限の前月1日以降であれば、オファーを開始できる
     $first_day_of_last_month = plugin_movieviewer_get_first_day_of_last_month($last_confirmation->viewing_period->date_end);
     return new DateTime() >= $first_day_of_last_month;
 }
    function generateMessage($user, $context)
    {
        if (mb_ereg_match('N1-', $user->memberId) == true) {
            //N1- 会員の場合、非表示
            return;
        }
        $confirmations = $user->getValidDealPackConfirmations();
        if (count($confirmations) === 0) {
            return;
        }
        $context = "";
        foreach ($confirmations as $confirmation) {
            $pack = $confirmation->getPack();
            // 終了前月1日よりも前の場合は表示しない
            $first_day_of_last_month = plugin_movieviewer_get_first_day_of_last_month($confirmation->viewing_period->date_end);
            if (new DateTime() < $first_day_of_last_month) {
                continue;
            }
            $reportDeadline = $confirmation->viewing_period->date_end->format('m月d日');
            $reportName = $pack->describe();
            $reportLinkId = $pack->getReportFormId();
            $context .= <<<TEXT
            <h3>{$reportName}のレポート提出期間中です。</h3>
            レポートの提出期限は{$reportDeadline}までです。
            <div align="right">提出はこちらから→ 
            <a href='https://ws.formzu.net/fgen/{$reportLinkId}/' class='ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only'>
            {$reportName}</a></div><br>
TEXT;
        }
        return $context;
    }