public function DisplayRaidplan(Raidplan $raidplan) { global $auth, $user, $config, $template, $phpEx, $phpbb_root_path; global $db; // check if it is private if (!$raidplan->getAuthCansee()) { trigger_error('PRIVATE_RAIDPLAN'); } // event image on top $eventtype = $raidplan->getEventType(); if (!isset($this->eventlist[$eventtype])) { //this event is closed, so fetch the whole eventlist including closed ones. $this->eventlist = new \bbdkp\controller\raidplanner\rpevents(0); $this->eventlist = $this->eventlist->events; } if (strlen($this->eventlist[$eventtype]['imagename']) > 1) { $eventimg = $phpbb_root_path . "images/bbdkp/event_images/" . $this->eventlist[$eventtype]['imagename'] . ".png"; } else { $eventimg = $phpbb_root_path . "images/bbdkp/event_images/dummy.png"; } // we need to find out the time zone to display // if anon then get board timezone or else get the users timezone if ($user->data['user_id'] == ANONYMOUS) { //grab board default $tz = $config['board_timezone']; } else { // get user setting $tz = (int) $user->data['user_timezone']; } // translate raidplan start and end time into user's timezone $day = gmdate("d", $raidplan->getStartTime()); $month = gmdate("n", $raidplan->getStartTime()); $year = gmdate('Y', $raidplan->getStartTime()); // format the raidplan message $bbcode_options = OPTION_FLAG_BBCODE + OPTION_FLAG_SMILIES + OPTION_FLAG_LINKS; $body = $raidplan->getBody(); $bbcode = $raidplan->getBbcode(); $message = generate_text_for_display($body, isset($bbcode['uid']) ? $bbcode['uid'] : '', isset($bbcode['bitfield']) ? $bbcode['bitfield'] : '', $bbcode_options); // add raid ? $add_raidplan = false; if ($auth->acl_gets('u_raidplanner_create_public_raidplans', 'u_raidplanner_create_group_raidplans', 'u_raidplanner_create_private_raidplans')) { $add_raidplan = true; } $edit_raidplan = false; if ($user->data['is_registered'] && $auth->acl_get('u_raidplanner_edit_raidplans') && ($user->data['user_id'] == $raidplan->getPoster() || $auth->acl_get('m_raidplanner_edit_other_users_raidplans'))) { $edit_raidplan = true; } $delete_raidplan = false; if ($user->data['is_registered'] && $auth->acl_get('u_raidplanner_delete_raidplans') && ($user->data['user_id'] == $raidplan->getPoster() || $auth->acl_get('m_raidplanner_delete_other_users_raidplans'))) { $delete_raidplan = true; } $day_view_url = append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=planner&view=day&calD=" . $day . "&calM=" . $month . "&calY=" . $year); $week_view_url = append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=planner&view=week&calD=" . $day . "&calM=" . $month . "&calY=" . $year); $month_view_url = append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=planner&view=month&calD=" . $day . "&calM=" . $month . "&calY=" . $year); /* make url for signup action */ $signup_url = append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=planner&view=raidplan&action=signup&raidplanid=" . $raidplan->id); // show button with url to push raidplan to bbdkp // this appears only if // 1) rp_rppushmode == 1 // 2) the user belongs to group having u_raidplanner_push permission // 3) there are confirmations $push_raidplan = false; $signuplist = $raidplan->getSignups(); if ($auth->acl_gets('u_raidplanner_push') && $config['rp_rppushmode'] == 1 && $signuplist['confirmed'] > 0) { $push_raidplan = true; } // display signups if ($raidplan->getAccesslevel() > 0) { //show my characters for signup foreach ($raidplan->getMychars() as $key => $mychar) { $template->assign_block_vars('mychars', array('MEMBER_ID' => $mychar['id'], 'MEMBER_NAME' => $mychar['name'], 'MEMBER_SELECTED' => $mychar['signedup_val'] >= 1 ? ' selected="selected"' : '')); } unset($key); unset($mychar); //loop all roles $roles = $raidplan->getRaidroles(); foreach ($roles as $key => $role) { // loop signups per role $template->assign_block_vars('raidroles', array('ROLE_ID' => $key, 'ROLE_DISPLAY' => count($role['role_signups']) > 0 ? true : false, 'ROLE_NAME' => $role['role_name'], 'ROLE_NEEDED' => $role['role_needed'], 'ROLE_SIGNEDUP' => $role['role_signedup'], 'ROLE_CONFIRMED' => $role['role_confirmed'], 'ROLE_COLOR' => $role['role_color'], 'S_ROLE_ICON_EXISTS' => strlen($role['role_icon']) > 1 ? true : false, 'ROLE_ICON' => strlen($role['role_icon']) > 1 ? $phpbb_root_path . "images/bbdkp/role_icons/" . $role['role_icon'] . ".png" : '')); $this->Signups_show_confirmed($raidplan, $role); $this->Signups_show_available($raidplan, $role); } $this->Signups_display_notavail($raidplan); } $template->assign_vars(array('DEBUG_NUMQUERIES' => $db->num_queries['normal'], 'S_LOCKED' => $raidplan->getLocked(), 'S_FROZEN' => $raidplan->getFrozen(), 'S_NOCHAR' => $raidplan->getNochar(), 'S_SIGNED_UP' => $raidplan->getSignedUp(), 'S_SIGNED_OFF' => $raidplan->getSignedOff(), 'S_CONFIRMED' => $raidplan->getConfirmed(), 'S_CANSIGNUP' => $raidplan->getSignupsAllowed(), 'S_LEGITUSER' => $user->data['is_bot'] || $user->data['user_id'] == ANONYMOUS ? false : true, 'S_SIGNUPMAYBE' => $raidplan->getSignedUpMaybe(), 'RAID_TOTAL' => (int) $raidplan->getRaidTeamNeeded(), 'TZ' => $user->lang['tz'][$tz], 'S_BBDKP' => $raidplan->getRaidId() > 0 ? true : false, 'BBDKPLINK' => $raidplan->getRaidId() > 0 ? append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=raid&raid_id=" . $raidplan->getRaidId()) : '', 'L_RAID_ON' => sprintf($user->lang['RAID_ON'], $this->eventlist[$raidplan->getEventType()]['event_name'], $user->format_date($raidplan->getStartTime(), $config['rp_date_format'], true)), 'CURR_CONFIRMED_COUNT' => $signuplist['confirmed'], 'S_CURR_CONFIRMED_COUNT' => $signuplist['confirmed'] > 0 ? true : false, 'CURR_CONFIRMEDPCT' => sprintf("%.2f%%", $raidplan->getRaidTeamNeeded() > 0 ? round($signuplist['confirmed'] / $raidplan->getRaidTeamNeeded(), 2) * 100 : 0), 'CURR_YES_COUNT' => $signuplist['yes'], 'S_CURR_YES_COUNT' => $signuplist['yes'] + $signuplist['maybe'] > 0 ? true : false, 'CURR_YESPCT' => sprintf("%.2f%%", $raidplan->getRaidTeamNeeded() > 0 ? round($signuplist['yes'] / $raidplan->getRaidTeamNeeded(), 2) * 100 : 0), 'CURR_MAYBE_COUNT' => $signuplist['maybe'], 'S_CURR_MAYBE_COUNT' => $signuplist['maybe'] > 0 ? true : false, 'CURR_MAYBEPCT' => sprintf("%.2f%%", $raidplan->getRaidTeamNeeded() > 0 ? round($signuplist['maybe'] / $raidplan->getRaidTeamNeeded(), 2) * 100 : 0), 'CURR_NO_COUNT' => $signuplist['no'], 'S_CURR_NO_COUNT' => $signuplist['no'] > 0 ? true : false, 'CURR_NOPCT' => sprintf("%.2f%%", $raidplan->getRaidTeamNeeded() > 0 ? round($signuplist['no'] / $raidplan->getRaidTeamNeeded(), 2) * 100 : 0), 'CURR_TOTAL_COUNT' => $signuplist['yes'] + $signuplist['maybe'], 'ETYPE_DISPLAY_NAME' => $this->eventlist[$raidplan->getEventType()]['event_name'], 'EVENT_COLOR' => $this->eventlist[$raidplan->getEventType()]['color'], 'EVENT_IMAGE' => $eventimg, 'SUBJECT' => $raidplan->getSubject(), 'RAIDPLANNERMESSAGE' => $message, 'INVITE_TIME' => $user->format_date($raidplan->getInviteTime(), $config['rp_date_time_format'], true), 'START_TIME' => $user->format_date($raidplan->getStartTime(), $config['rp_date_time_format'], true), 'START_DATE' => $user->format_date($raidplan->getStartTime(), $config['rp_date_format'], true), 'END_TIME' => $user->format_date($raidplan->getEndTime(), $config['rp_date_time_format'], true), 'U_SIGNUP_MODE_ACTION' => $signup_url, 'RAID_ID' => $raidplan->id, 'S_PLANNER_RAIDPLAN' => true, 'POSTER' => $raidplan->getPosterUrl(), 'INVITED' => $raidplan->getInviteList(), 'TEAM_NAME' => $raidplan->getRaidteamname(), 'S_EDITRAID' => $edit_raidplan, 'S_DELETERAID' => $delete_raidplan, 'S_ADDRAID' => $add_raidplan, 'S_PUSHRAID' => $push_raidplan, 'DAY_IMG' => $user->img('button_calendar_day', 'DAY'), 'WEEK_IMG' => $user->img('button_calendar_week', 'WEEK'), 'MONTH_IMG' => $user->img('button_calendar_month', 'MONTH'), 'U_DAY_VIEW_URL' => $day_view_url, 'U_WEEK_VIEW_URL' => $week_view_url, 'U_MONTH_VIEW_URL' => $month_view_url)); }