attend($attendance_initial_bonus, $attendance_step_bonus, $attendance_max_bonus, $attendance_continuous_bonus)){ // list($count, $cdays, $points) = $result; // stdhead($lang_attendance['title']); // begin_main_frame(); // begin_frame($lang_attendance['success']); // printf('

'.$lang_attendance['attend_info'].'

', $count, $cdays, $points); // end_frame(); // echo ''; // end_main_frame(); // stdfoot(); //}else{ // stderr($lang_attendance['sorry'], $lang_attendance['already_attended']); //} \Nexus\Nexus::css('vendor/fullcalendar-5.10.2/main.min.css', 'header', true); \Nexus\Nexus::js('vendor/fullcalendar-5.10.2/main.min.js', 'footer', true); \Nexus\Nexus::js('vendor/fullcalendar-5.10.2/locales/zh-cn.js', 'footer', true); $today = \Carbon\Carbon::today(); $tomorrow = \Carbon\Carbon::tomorrow(); $end = $today->clone()->endOfMonth(); $start = $today->clone()->subMonth(2); $rep = new \App\Repositories\AttendanceRepository(); $attendance = $rep->attend($CURUSER['id']); $logs = $attendance->logs()->where('date', '>=', $start->format('Y-m-d'))->get()->keyBy('date'); $interval = new \DateInterval('P1D'); $period = new \DatePeriod($start, $interval, $end); $events = []; foreach ($period as $value) { if ($value->gte($tomorrow)) { continue; } $checkDate = $value->format('Y-m-d'); $eventBase = ['start' => $checkDate, 'end' => $checkDate]; if ($logs->has($checkDate)) { $logValue = $logs->get($checkDate); $events[] = array_merge($eventBase, ['display' => 'background']); if ($logValue->points > 0) { $events[] = array_merge($eventBase, ['title' => $logValue->points]); } if ($logValue->is_retroactive) { $events[] = array_merge($eventBase, ['title' => $lang_attendance['retroactive_event_text'], 'display' => 'list-item']); } } else { $events[] = array_merge($eventBase, ['groupId' => 'to_do', 'display' => 'list-item']); } } $eventStr = json_encode($events); $validRangeStr = json_encode(['start' => $start->format('Y-m-d'), 'end' => $end->format('Y-m-d')]); $js = <<total_days; $cdays = $attendance->days; $points = $attendance->points; stdhead($lang_attendance['title']); begin_main_frame(); begin_frame($lang_attendance['success']); printf('

'.$lang_attendance['attend_info'].$lang_attendance['retroactive_description'].'

', $count, $cdays, $points, $CURUSER['attendance_card']); end_frame(); echo '
'; echo ''; end_main_frame(); stdfoot(); } else { stderr($lang_attendance['sorry'], $lang_attendance['already_attended']); }