[ Index ] |
|
Code source de e107 0.7.8 |
1 <?php 2 /* 3 + ----------------------------------------------------------------------------+ 4 | e107 website system 5 | 6 | ©Steve Dunstan 2001-2002 7 | http://e107.org 8 | jalist@e107.org 9 | 10 | Released under the terms and conditions of the 11 | GNU General Public License (http://gnu.org). 12 | 13 | $Source: /cvsroot/e107/e107_0.7/e107_plugins/blogcalendar_menu/blogcalendar_menu.php,v $ 14 | $Revision: 1.9 $ 15 | $Date: 2005/12/28 16:12:59 $ 16 | $Author: sweetas $ 17 +----------------------------------------------------------------------------+ 18 | Based on code by: Thomas Bouve (crahan@gmx.net) 19 */ 20 if (!defined('e107_INIT')) { exit; } 21 22 require_once(e_PLUGIN."blogcalendar_menu/calendar.php"); 23 require_once(e_PLUGIN."blogcalendar_menu/functions.php"); 24 25 // ------------------------------ 26 // initialization + fetch options 27 // ------------------------------ 28 $prefix = e_PLUGIN."blogcalendar_menu"; 29 $marray = array(BLOGCAL_M1, BLOGCAL_M2, BLOGCAL_M3, BLOGCAL_M4, 30 BLOGCAL_M5, BLOGCAL_M6, BLOGCAL_M7, BLOGCAL_M8, 31 BLOGCAL_M9, BLOGCAL_M10, BLOGCAL_M11, BLOGCAL_M12); 32 $pref['blogcal_ws'] = "monday"; 33 34 // ---------------------------------------------- 35 // get the requested and current date information 36 // ---------------------------------------------- 37 list($cur_year, $cur_month, $cur_day) = explode(" ", date("Y n j")); 38 if (strstr(e_QUERY, "day")) { 39 $tmp = explode(".", e_QUERY); 40 $item = $tmp[1]; 41 $req_year = substr($item, 0, 4); 42 $req_month = substr($item, 4, 2); 43 // decide on the behaviour here, do we highlight 44 // the day being viewed? or only 'today'? 45 //$req_day = substr($item, 6, 2); 46 // if the requested year and month are the current, then add 47 // the current day to the mix so the calendar highlights it 48 if (($req_year == $cur_year) && ($req_month == $cur_month)) { 49 $req_day = $cur_day; 50 } else { 51 $req_day = ""; 52 } 53 } 54 else if(strstr(e_QUERY, "month")) { 55 $tmp = explode(".", e_QUERY); 56 $item = $tmp[1]; 57 $req_year = substr($item, 0, 4); 58 $req_month = substr($item, 4, 2); 59 // if the requested year and month are the current, then add 60 // the current day to the mix so the calendar highlights it 61 if (($req_year == $cur_year) && ($req_month == $cur_month)) { 62 $req_day = $cur_day; 63 } else { 64 $req_day = ""; 65 } 66 } else { 67 $req_year = $cur_year; 68 $req_month = $cur_month; 69 $req_day = $cur_day; 70 } 71 72 // ------------------------------- 73 // create the month selection item 74 // ------------------------------- 75 $month_selector = "<div class='forumheader' style='text-align: center; margin-bottom: 2px;'>"; 76 $month_selector .= "<select name='activate' onchange='urljump(this.options[selectedIndex].value)' class='tbox'>"; 77 78 // get all newsposts since the beginning of the year till now 79 // ------------------------------------------- 80 // get links to all newsitems in current month 81 // ------------------------------------------- 82 $month_start = mktime(0, 0, 0, $req_month, 1, $req_year); 83 $lastday = date("t", $month_start); 84 $month_end = mktime(23, 59, 59, $req_month, $lastday, $req_year); 85 $start = mktime(0, 0, 0, 1, 1, $req_year); 86 $end = time(); 87 $sql->db_Select("news", "news_id, news_datestamp", "news_class IN (".USERCLASS_LIST.") AND news_datestamp > ".intval($start)." AND news_datestamp < ".intval($end)); 88 while ($news = $sql->db_Fetch()) 89 { 90 $xmonth = date("n", $news['news_datestamp']); 91 if (!isset($month_links[$xmonth]) || !$month_links[$xmonth]) 92 { 93 $month_links[$xmonth] = e_BASE."news.php?month.".formatDate($req_year, $xmonth); 94 } 95 if($news['news_datestamp'] >= $month_start AND $news['news_datestamp'] <= $month_end) 96 { 97 $xday = date("j", $news['news_datestamp']); 98 if (!isset($day_links[$xday]) || !$day_links[$xday]) 99 { 100 $day_links[$xday] = e_BASE."news.php?day.".formatDate($req_year, $req_month, $xday); 101 } 102 } 103 } 104 105 // if we're listing the current year, add the current month to the list regardless of posts 106 if ($req_year == $cur_year) { 107 $month_links[$cur_month] = e_BASE."news.php?month.".formatDate($cur_year, $cur_month); 108 } 109 110 // go over the link array and create the option fields 111 foreach($month_links as $index => $val) { 112 $month_selector .= "<option value='".$val."'"; 113 $month_selector .= ($index == $req_month)?" selected='selected'": 114 ""; 115 $month_selector .= ">".$marray[$index-1]."</option>"; 116 } 117 118 // close the select item 119 $month_selector .= "</select></div>"; 120 121 122 // ------------------------ 123 // create and show calendar 124 // ------------------------ 125 $menu = "<div style='text-align: center;'><table border='0' cellspacing='7'>"; 126 $menu .= "<tr><td>$month_selector"; 127 $menu .= "<div style='text-align:center'>".calendar($req_day, $req_month, $req_year, $day_links, $pref['blogcal_ws'])."</div>"; 128 $menu .= "<div class='forumheader' style='text-align: center; margin-top:2px;'><span class='smalltext'><a href='$prefix/archive.php'>".BLOGCAL_L2."</a></span></div></td></tr>"; 129 $menu .= "</table></div>"; 130 $ns->tablerender(BLOGCAL_L1." ".$req_year, $menu, 'blog_calender'); 131 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Apr 1 01:23:32 2007 | par Balluche grâce à PHPXref 0.7 |