예제 #1
0
 private function ConfirmSignup(Raidplan $raidplan, Raidplan_display $raidplan_display)
 {
     global $config;
     $signup_id = request_var('signup_id', 0);
     $signup = new RaidplanSignup();
     $signup->confirmsignup($signup_id);
     $confirmed = $raidplan->getSignups();
     if ($config['rp_rppushmode'] == 0 && $confirmed['confirmed'] > 0) {
         //autopush
         $raidplan->raidplan_push();
     }
     $signup->signupmessenger(5, $raidplan, $this->cal->getEventlist());
     $raidplan->Get_Raidplan();
     $raidplan->Check_auth();
     $raidplan_display->DisplayRaidplan($raidplan);
 }
예제 #2
0
 /**
  * @see calendar::display()
  *
  */
 public function display()
 {
     global $auth, $user, $config, $template, $phpEx, $phpbb_root_path;
     $this->date['num'] = "01";
     $this->date['fday'] = $this->get_firstday($this->date['num'], $this->date['month_no'], $this->date['year']);
     $number_days = date("t", mktime(0, 0, 0, $this->date['month_no'], $this->date['day'], $this->date['year']));
     $calendar_header_txt = $user->lang['MONTH_OF'] . sprintf($user->lang['LOCAL_DATE_FORMAT'], $user->lang['datetime'][$this->date['month']], $this->date['day'], $this->date['year']);
     $counter = 0;
     $Raidplandisplay = new Raidplan_display($this->viewPlanner);
     // fill array of raid days
     $firstday = $this->Get1stDayofMonth($this->timestamp);
     $lastday = $this->GetLastDayofMonth($this->timestamp);
     //gets array with raid days
     $raiddays = $Raidplandisplay->GetRaiddaylist($firstday, $lastday);
     //gets array with birthdays
     $birthdays = $this->generate_birthday_list($firstday, $lastday);
     for ($j = 1; $j < $number_days + 1; $j++, $counter++) {
         // if it is the first week
         if ($j == 1) {
             // find how many place holders we need before day 1
             if ($this->date['fday'] < 7) {
                 $this->date['fday'] = $this->date['fday'] + 1;
                 for ($i = 1; $i < $this->date['fday']; $i++, $counter++) {
                     // create dummy days (place holders)
                     if ($i == 1) {
                         $calendar_days['START_WEEK'] = true;
                     } else {
                         $calendar_days['START_WEEK'] = false;
                     }
                     $calendar_days['END_WEEK'] = false;
                     $calendar_days['HEADER_CLASS'] = '';
                     $calendar_days['DAY_CLASS'] = '';
                     $calendar_days['NUMBER'] = 0;
                     $calendar_days['DUMMY_DAY'] = true;
                     $calendar_days['ADD_LINK'] = '';
                     $calendar_days['BIRTHDAYS'] = '';
                     $template->assign_block_vars('calendar_days', $calendar_days);
                 }
             }
         }
         // start creating the data for the real days
         $calendar_days['START_WEEK'] = false;
         $calendar_days['END_WEEK'] = false;
         $calendar_days['DUMMY_DAY'] = false;
         $calendar_days['HEADER_CLASS'] = '';
         $calendar_days['DAY_CLASS'] = '';
         $calendar_days['NUMBER'] = 0;
         $calendar_days['ADD_LINK'] = '';
         $calendar_days['BIRTHDAYS'] = '';
         if ($counter % 7 == 0) {
             $calendar_days['START_WEEK'] = true;
         }
         if ($counter % 7 == 6) {
             $calendar_days['END_WEEK'] = true;
         }
         $calendar_days['NUMBER'] = $j;
         if ($auth->acl_gets('u_raidplanner_create_public_raidplans', 'u_raidplanner_create_group_raidplans', 'u_raidplanner_create_private_raidplans')) {
             $calendar_days['ADD_LINK'] = append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=planner&amp;view=raidplan&amp;action=showadd&amp;calD=" . $j . "&amp;calM=" . $this->date['month_no'] . "&amp;calY=" . $this->date['year']);
         }
         $calendar_days['U_DAY_VIEW_URL'] = append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=planner&amp;view=day&amp;calD=" . $j . "&amp;calM=" . $this->date['month_no'] . "&amp;calY=" . $this->date['year']);
         $calendar_days['U_WEEK_VIEW_URL'] = append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=planner&amp;view=week&amp;calD=" . $j . "&amp;calM=" . $this->date['month_no'] . "&amp;calY=" . $this->date['year']);
         $calendar_days['U_MONTH_VIEW_URL'] = append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=planner&amp;view=month&amp;calD=" . $j . "&amp;calM=" . $this->date['month_no'] . "&amp;calY=" . $this->date['year']);
         //highlight selected day
         if ($j == $this->date['day']) {
             $calendar_days['DAY_CLASS'] = 'highlight';
         }
         //highlight today
         $start_hi_time = mktime(0, 0, 0, $this->date['month_no'], $j, $this->date['year']) + date('Z');
         $end_hi_time = $start_hi_time + 86399;
         $hi_time = time() + $user->timezone + $user->dst;
         if ($start_hi_time <= $hi_time && $end_hi_time >= $hi_time) {
             $calendar_days['HEADER_CLASS'] = 'highlight';
             $calendar_days['DAY_CLASS'] = 'highlight';
         }
         // if user cannot add raid/appointments in the past
         $calendar_days['ADD_RAID_ICON'] = false;
         if ($config['rp_enable_past_raids']) {
             $calendar_days['ADD_RAID_ICON'] = true;
         } else {
             $a = 1;
             // if yesterday then don't enable
             if ((int) $this->date['month_no'] > (int) date('m') || (int) $this->date['month_no'] == (int) date('m') && $j >= (int) date('d') || (int) $this->date['year'] > (int) date('Y')) {
                 $calendar_days['ADD_RAID_ICON'] = true;
             }
         }
         // add birthdays
         $calendar_days['BIRTHDAYS'] = "";
         if ($auth->acl_get('u_raidplanner_view_raidplans') && $auth->acl_get('u_viewprofile')) {
             // find birthdays
             if (is_array($birthdays)) {
                 //loop the bdays
                 foreach ($birthdays as $birthday) {
                     if ($birthday['day'] == $j) {
                         $calendar_days['BIRTHDAYS'] = $birthday['bdays'];
                     }
                 }
             }
         }
         $template->assign_block_vars('calendar_days', $calendar_days);
         // if has right to see raidplans
         if ($auth->acl_get('u_raidplanner_view_raidplans')) {
             $hit = false;
             if (isset($raiddays) && is_array($raiddays)) {
                 foreach ($raiddays as $raidday) {
                     if ($raidday['day'] == $j) {
                         if (isset($Raidplandisplay)) {
                             // note not recreating a new raidplan object for each date. that would take too much mem.
                             // we just reuse the same object and reset its properties
                             $raidplan_output = $Raidplandisplay->DisplayCalendarRaidTooltip($this->date['month_no'], $j, $this->date['year'], $this->group_options, "month");
                             foreach ($raidplan_output as $raid) {
                                 $template->assign_block_vars('calendar_days.raidplans', $raid['raidinfo']);
                                 foreach ($raid['userchars'] as $key => $char) {
                                     $template->assign_block_vars('calendar_days.raidplans.userchars', $char);
                                 }
                                 unset($char);
                                 unset($key);
                                 foreach ($raid['raidroles'] as $key => $raidrole) {
                                     $template->assign_block_vars('calendar_days.raidplans.raidroles', $raidrole);
                                 }
                                 unset($raidrole);
                                 unset($key);
                             }
                             $hit = true;
                         }
                     }
                 }
                 // remove hit
                 if ($hit) {
                     $shifted = array_shift($raiddays);
                 }
             }
         }
     }
     $counter--;
     $dummy_end_day_count = 6 - $counter % 7;
     for ($i = 1; $i <= $dummy_end_day_count; $i++) {
         // create dummy days (place holders)
         $calendar_days['START_WEEK'] = false;
         if ($i == $dummy_end_day_count) {
             $calendar_days['END_WEEK'] = true;
         } else {
             $calendar_days['END_WEEK'] = false;
         }
         $calendar_days['HEADER_CLASS'] = '';
         $calendar_days['DAY_CLASS'] = '';
         $calendar_days['NUMBER'] = 0;
         $calendar_days['DUMMY_DAY'] = true;
         $calendar_days['ADD_LINK'] = '';
         $calendar_days['BIRTHDAYS'] = '';
         $template->assign_block_vars('calendar_days', $calendar_days);
     }
     $template->assign_vars(array('CALENDAR_HEADER' => $calendar_header_txt, 'DAY_IMG' => $user->img('button_calendar_day', 'DAY'), 'WEEK_IMG' => $user->img('button_calendar_week', 'WEEK'), 'S_PLANNER_MONTH' => true, 'S_DISPLAY_NAME' => $config['rp_show_name'] == 1 ? true : false, 'D0' => $this->daynames[0], 'D1' => $this->daynames[1], 'D2' => $this->daynames[2], 'D3' => $this->daynames[3], 'D4' => $this->daynames[4], 'D5' => $this->daynames[5], 'D6' => $this->daynames[6], 'S_POST_ACTION' => append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=planner&amp;view=month")));
 }
예제 #3
0
 /**
  * @see calendar::display()
  *
  */
 public function display()
 {
     global $auth, $user, $config, $template, $phpEx, $phpbb_root_path;
     $calendar_header_txt = sprintf($user->lang['LOCAL_DATE_FORMAT'], $this->date['dayname'], $user->lang['datetime'][$this->date['month']], $this->date['day'], $this->date['year']);
     $hour_mode = $config['rp_hour_mode'];
     // add an url to add raids ?
     $add_raidplan_url = "";
     $addlink = false;
     if ($auth->acl_gets('u_raidplanner_create_public_raidplans', 'u_raidplanner_create_group_raidplans', 'u_raidplanner_create_private_raidplans')) {
         $add_raidplan_url = append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=planner&amp;view=raidplan&amp;action=showadd&amp;calD=" . $this->date['day'] . "&amp;calM=" . $this->date['month_no'] . "&amp;calY=" . $this->date['year']);
         if ((int) $this->date['month_no'] > (int) date('m') || (int) $this->date['month_no'] == (int) date('m') && (int) $this->date['day'] >= (int) date('d') || (int) $this->date['year'] > (int) date('Y')) {
             $addlink = true;
         }
     }
     $calendar_days['BIRTHDAYS'] = "";
     if ($auth->acl_get('u_raidplanner_view_raidplans') && $auth->acl_get('u_viewprofile')) {
         $birthdays = $this->generate_birthday_list($this->Get1stDayofMonth($this->timestamp), $this->GetLastDayofMonth($this->timestamp));
         if (isset($birthdays[$this->date['day']])) {
             $birthdays = $birthdays[$this->date['day']]['bdays'];
             $template->assign_block_vars('all_day', array('BIRTHDAYS' => (string) $birthdays));
         }
     }
     // Is the user able to view ANY raidplans?
     if ($auth->acl_get('u_raidplanner_view_raidplans')) {
         // get raid info
         $raidplan_output = array();
         $Raidplandisplay = new Raidplan_display($this->viewPlanner);
         // get all raids on this day
         $raidplan_output = $Raidplandisplay->DisplayCalendarRaidTooltip($this->date['month_no'], $this->date['day'], $this->date['year'], $this->group_options, "day");
     }
     /* assemble events */
     /* loop every hour */
     for ($i = 0; $i < 24; $i++) {
         if ($hour_mode == 12) {
             $time_header['TIME'] = $i % 12;
             if ($time_header['TIME'] == 0) {
                 $time_header['TIME'] = 12;
             }
             $time_header['AM_PM'] = $user->lang['PM'];
             if ($i < 12) {
                 $time_header['AM_PM'] = $user->lang['AM'];
             }
         } else {
             $o = "";
             if ($i < 10) {
                 $o = "0";
             }
             $time_header['TIME'] = $o . $i;
             $time_header['AM_PM'] = "";
         }
         $raidslots = array();
         foreach ($raidplan_output as $key => $raid) {
             if (substr($key, 0, 2) == $time_header['TIME']) {
                 $raidslots[$time_header['TIME']] = 1;
             }
         }
         $template->assign_block_vars('time_slots', array('TIME' => $time_header['TIME'], 'AM_PM' => $time_header['AM_PM'], 'S_MARKED' => array_key_exists($time_header['TIME'], $raidslots) == true ? true : false));
         // loop the raidplans for each hour
         foreach ($raidplan_output as $key => $raid) {
             //does the raid hour match this hour slot?
             if (substr($key, 0, 2) == $time_header['TIME']) {
                 // color this timeslot as taken.
                 //add it to template
                 $template->assign_block_vars('time_slots.raidplans', $raid['raidinfo']);
                 foreach ($raid['userchars'] as $key => $char) {
                     $template->assign_block_vars('time_slots.raidplans.userchars', $char);
                 }
                 unset($char);
                 unset($key);
                 foreach ($raid['raidroles'] as $key => $raidrole) {
                     $template->assign_block_vars('time_slots.raidplans.raidroles', $raidrole);
                 }
                 unset($raidrole);
                 unset($key);
             }
         }
     }
     $template->assign_vars(array('CALENDAR_HEADER' => $calendar_header_txt, 'BIRTHDAYS' => $calendar_days['BIRTHDAYS'], 'DAY' => $this->date['day'], 'ADD_LINK' => $add_raidplan_url, 'S_ADD_LINK' => $addlink, 'S_PLANNER_DAY' => true, 'EVENT_COUNT' => count($raidplan_output)));
 }
예제 #4
0
 /**
  * @see calendar::display()
  *
  */
 public function display()
 {
     global $auth, $user, $config, $template, $phpEx, $phpbb_root_path;
     // get date number
     $this->date['fday'] = $this->get_firstday($this->date['day'], $this->date['month_no'], $this->date['year']);
     $number_days = 7;
     $calendar_header_txt = $user->lang['WEEK_OF'] . sprintf($user->lang['LOCAL_DATE_FORMAT'], $user->lang['datetime'][$this->date['month']], $this->date['day'], $this->date['year']);
     $counter = 0;
     $j_start = $this->date['day'] - $this->date['fday'];
     $prev_month_no = $this->date['month_no'] - 1;
     $prev_year_no = $this->date['year'];
     if ($prev_month_no == 0) {
         $prev_month_no = 12;
         $prev_year_no--;
     }
     $prev_month_day_count = date("t", mktime(0, 0, 0, $prev_month_no, 25, $prev_year_no));
     // how many days are in this month?
     $month_day_count = date("t", mktime(0, 0, 0, $this->date['month_no'], 25, $this->date['year']));
     $next_month_no = $this->date['month_no'] + 1;
     $next_year_no = $this->date['year'];
     if ($next_month_no == 13) {
         $next_month_no = 1;
         $next_year_no++;
     }
     if ($j_start < 0) {
         $fdaystamp = gmmktime(0, 0, 0, $this->date['month_no'] - 1, $j_start + $prev_month_day_count, $prev_year_no);
     } else {
         $fdaystamp = gmmktime(0, 0, 0, $this->date['month_no'], $j_start, $this->date['year']);
     }
     if ($j_start + $number_days > $month_day_count) {
         $ldaystamp = gmmktime(0, 0, 0, $next_month_no, $j_start + $number_days - $month_day_count, $next_year_no);
     } else {
         $ldaystamp = gmmktime(0, 0, 0, $this->date['month_no'], $j_start + $number_days, $this->date['year']);
     }
     // array of raid days
     $Raidplandisplay = new Raidplan_display($this->viewPlanner);
     $raiddays = $Raidplandisplay->GetRaiddaylist($fdaystamp, $ldaystamp);
     // array of bdays
     $birthdays = $this->generate_birthday_list($fdaystamp, $ldaystamp);
     for ($j = $j_start; $j < $j_start + 7; $j++, $counter++) {
         if ($j < 1) {
             //past month
             $true_j = $prev_month_day_count + $j;
             $true_m = $prev_month_no;
             $true_y = $prev_year_no;
         } else {
             if ($j > $month_day_count) {
                 $true_j = $j - $month_day_count;
                 $true_m = $next_month_no;
                 $true_y = $next_year_no;
             } else {
                 // 1 <= $j <= $month_day_count
                 $true_j = $j;
                 $true_m = $this->date['month_no'];
                 $true_y = $this->date['year'];
             }
         }
         // start creating the data for the real days
         $calendar_days['START_WEEK'] = false;
         $calendar_days['END_WEEK'] = false;
         $calendar_days['DUMMY_DAY'] = false;
         $calendar_days['HEADER_CLASS'] = '';
         $calendar_days['DAY_CLASS'] = '';
         $calendar_days['NUMBER'] = 0;
         $calendar_days['ADD_LINK'] = '';
         $calendar_days['BIRTHDAYS'] = '';
         if ($counter % 7 == 0) {
             $calendar_days['START_WEEK'] = true;
         }
         if ($counter % 7 == 6) {
             $calendar_days['END_WEEK'] = true;
         }
         $calendar_days['NUMBER'] = $true_j;
         if ($auth->acl_gets('u_raidplanner_create_public_raidplans', 'u_raidplanner_create_group_raidplans', 'u_raidplanner_create_private_raidplans')) {
             $calendar_days['ADD_LINK'] = append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=planner&amp;view=raidplan&amp;action=showadd&amp;calD=" . $true_j . "&amp;calM=" . $true_m . "&amp;calY=" . $true_y);
         }
         $calendar_days['U_DAY_VIEW_URL'] = append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=planner&amp;view=day&amp;calD=" . $true_j . "&amp;calM=" . $true_m . "&amp;calY=" . $true_y);
         $calendar_days['U_MONTH_VIEW_URL'] = append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=planner&amp;view=month&amp;calD=" . $true_j . "&amp;calM=" . $true_m . "&amp;calY=" . $true_y);
         if ($true_j == $this->date['day'] && $true_m == $this->date['month_no'] && $true_y == $this->date['year']) {
             $calendar_days['DAY_CLASS'] = 'highlight';
         }
         //highlight current day
         $test_start_hi_time = mktime(0, 0, 0, $true_m, $true_j, $true_y) + date('Z');
         $test_end_hi_time = $test_start_hi_time + 86399;
         $test_hi_time = time() + $user->timezone + $user->dst;
         if ($test_start_hi_time <= $test_hi_time && $test_end_hi_time >= $test_hi_time) {
             $calendar_days['HEADER_CLASS'] = 'highlight';
             $calendar_days['DAY_CLASS'] = 'highlight';
         }
         // if user cannot add raid/appointments in the past
         $calendar_days['ADD_RAID_ICON'] = false;
         if ($config['rp_enable_past_raids']) {
             $calendar_days['ADD_RAID_ICON'] = true;
         } else {
             // if yesterday then don't enable
             if ($true_m > date('m') || $true_m == date('m') && $true_j >= date('d') || (int) $this->date['year'] > (int) date('Y')) {
                 $calendar_days['ADD_RAID_ICON'] = true;
             }
         }
         $calendar_days['BIRTHDAYS'] = "";
         if ($auth->acl_get('u_raidplanner_view_raidplans') && $auth->acl_get('u_viewprofile')) {
             // find birthdays
             if (is_array($birthdays)) {
                 //loop the bdays
                 foreach ($birthdays as $birthday) {
                     if ($birthday['day'] == $j) {
                         $calendar_days['BIRTHDAYS'] = $birthday['bdays'];
                     }
                 }
             }
         }
         $template->assign_block_vars('calendar_days', $calendar_days);
         // if can see raids
         if ($auth->acl_get('u_raidplanner_view_raidplans')) {
             $hit = false;
             if (isset($raiddays) && is_array($raiddays)) {
                 // loop all days having raids
                 foreach ($raiddays as $raidday) {
                     if ($raidday['day'] == $true_j) {
                         //raid(s) found get detail
                         $raidplan_output = $Raidplandisplay->DisplayCalendarRaidTooltip($true_m, $true_j, $true_y, $this->group_options, $this->mode);
                         foreach ($raidplan_output as $raid) {
                             $template->assign_block_vars('calendar_days.raidplans', $raid['raidinfo']);
                             foreach ($raid['userchars'] as $key => $char) {
                                 $template->assign_block_vars('calendar_days.raidplans.userchars', $char);
                             }
                             unset($char);
                             unset($key);
                             foreach ($raid['raidroles'] as $key => $raidrole) {
                                 $template->assign_block_vars('calendar_days.raidplans.raidroles', $raidrole);
                             }
                             unset($raidrole);
                             unset($key);
                         }
                         $hit = true;
                     }
                 }
                 // remove hit
                 if ($hit) {
                     $shifted = array_shift($raiddays);
                 }
             }
         }
     }
     $template->assign_vars(array('CALENDAR_HEADER' => $calendar_header_txt, 'DAY_IMG' => $user->img('button_calendar_day', 'DAY'), 'MONTH_IMG' => $user->img('button_calendar_month', 'MONTH'), 'S_PLANNER_WEEK' => true, 'S_DISPLAY_NAME' => $config['rp_show_name'] == 1 ? true : false, 'D0' => $this->daynames[0], 'D1' => $this->daynames[1], 'D2' => $this->daynames[2], 'D3' => $this->daynames[3], 'D4' => $this->daynames[4], 'D5' => $this->daynames[5], 'D6' => $this->daynames[6], 'S_POST_ACTION' => append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=planner&amp;view=week")));
 }