function auto_gen_link($url, $name, $title = '', $ajax_id = '', $auto_normalize_url = true, $popup = false) { if (eps_use_ajax()) { return gen_ajax_link($url, $name, $title, $ajax_id, $auto_normalize_url, $popup); } else { return gen_link($url, $name, $title, false, $popup); } }
function create($base_url) { if (strpos($base_url, '?') !== false) { $base_url .= '&'; } else { $base_url .= '?'; } $d_names = $this->days; $m_names = $this->months; list($this_y, $this_m) = $this->get(); $events = $this->get_event(); // Num days $this_m_numday = cal_days_in_month(CAL_GREGORIAN, $this_m, $this_y); $this_m_first_infos = $this->get_date_info($this_m, 1, $this_y); $this_m_last_infos = $this->get_date_info($this_m, $this_m_numday, $this_y); $today_infos = $this->get_today_info(); $today_str = $this->gen_date_str($today_infos); // Navigator $nav_prev_m = $this_m - 1; $nav_prev_y = $nav_next_y = $this_y; $nav_next_m = $this_m + 1; if ($nav_prev_m < 1) { $nav_prev_m = 12; $nav_prev_y--; } if ($nav_next_m > 12) { $nav_next_m = 1; $nav_next_y++; } // Calendar's Start & End $start = 1 - $this->my_wday($this_m_first_infos); $end = $this_m_numday + (6 - $this->my_wday($this_m_last_infos)); // Start Creating $cal = '<div class="calendar"><table cellspacing="0">' . "\n"; // Header $cal .= '<tr><td colspan="7" class="cal_head">'; $cal .= '<span>' . gen_ajax_link('eps=calendar&y=' . $nav_prev_y . '&m=' . $nav_prev_m, '«', '', 'calendar_content') . '</span>'; $cal .= '<span>' . $m_names[$this_m] . ' - ' . $this_y . '</span>'; $cal .= '<span>' . gen_ajax_link('eps=calendar&y=' . $nav_next_y . '&m=' . $nav_next_m, '»', '', 'calendar_content') . '</span>'; $cal .= '</td></tr>' . "\n"; // Days of Week $cal .= '<tr class="cal_head2">'; foreach ($d_names as $v) { $cal .= '<td>' . $v . '</td>'; } // This Close Tag "</tr>" Is In Loop Below; // Days in Month for ($i = $start; $i <= $end; $i++) { $cur_infos = $this->get_date_info($this_m, $i, $this_y); $cur_str = $this->gen_date_str($cur_infos); // New Row if ($this->my_wday($cur_infos) == 0) { $cal .= '</tr>' . "\n" . '<tr>'; } $title = $style = ''; // Event if (!empty($events[$cur_str])) { $cur_infos['mday'] = '<strong>' . $cur_infos['mday'] . '</strong>'; $title = $events[$cur_str]; } // Other Month if ($cur_infos['mon'] != $this_m) { $style = 'cal_other'; } else { if ($this->my_wday($cur_infos) == 5) { $style = 'cal_sat'; } else { if ($this->my_wday($cur_infos) == 6) { $style = 'cal_sun'; } } } // Today if ($cur_str == $today_str) { $style .= empty($style) ? 'cal_today' : ' cal_today'; } $cal .= '<td' . (!empty($style) ? ' class="' . $style . '"' : '') . (!empty($title) ? ' title="' . $title . '"' : '') . '>' . $cur_infos['mday'] . '</td>'; } $cal .= '</tr></table></div>'; return $cal; }