forked from extern/egroupware
new template based mini calendar
This commit is contained in:
parent
fbf40f18ab
commit
95b43e0ec3
@ -1035,6 +1035,64 @@
|
||||
return $str;
|
||||
}
|
||||
|
||||
function mini_calendar($day,$month,$year,$link="") {
|
||||
global $phpgw, $phpgw_info, $view;
|
||||
|
||||
$date = $this->makegmttime(0,0,0,$month,$day,$year);
|
||||
$month_ago = intval(date("Ymd",mktime(0,0,0,$month - 1,$day,$year)));
|
||||
$month_ahead = intval(date("Ymd",mktime(0,0,0,$month + 1,$day,$year)));
|
||||
$monthstart = intval(date("Ymd",mktime(0,0,0,$month,1,$year)));
|
||||
$monthend = intval(date("Ymd",mktime(0,0,0,$month + 1,0,$year)));
|
||||
|
||||
$weekstarttime = $this->get_sunday_before($year,$month,1);
|
||||
if ($phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"] == "Monday") {
|
||||
$days = array(0 => "Monday", 1 => "Tuesday", 2 => "Wednesday", 3 => "Thursday", 4 => "Friday", 5 => "Saturday", 6 => "Sunday");
|
||||
$weekstarttime += (3600 * 25);
|
||||
} else {
|
||||
$days = array(0 => "Sunday", 1 => "Monday", 2 => "Tuesday", 3 => "Wednesday", 4 => "Thursday", 5 => "Friday", 6 => "Saturday");
|
||||
}
|
||||
$p = new Template($phpgw->common->get_tpl_dir('calendar'));
|
||||
$p->set_file(array("mini_cal" => "mini_cal.tpl"));
|
||||
$p->set_block("mini_cal","month_week");
|
||||
$p->set_block("mini_cal","day");
|
||||
$p->set_var("bgcolor",$phpgw_info["theme"]["bg_text"]);
|
||||
$p->set_var("bgcolor1",$phpgw_info["theme"]["bg_color"]);
|
||||
$p->set_var("month",lang($phpgw->common->show_date($date["raw"],"F"))." ".$year);
|
||||
$p->set_var("prevmonth",$phpgw->link($phpgw_info["server"]["webserver_url"]."/calendar/index.php","date=".$month_ago));
|
||||
$p->set_var("nextmonth",$phpgw->link($phpgw_info["server"]["webserver_url"]."/calendar/index.php","date=".$month_ahead));
|
||||
|
||||
$p->set_var('bgcolor2',$phpgw_info["theme"]["cal_dayview"]);
|
||||
for($i=0;$i<7;$i++) {
|
||||
$p->set_var('dayname',substr(lang($days[$i]),0,2));
|
||||
$p->parse('daynames','day',True);
|
||||
}
|
||||
for($i=$weekstarttime;date("Ymd",$i)<=$monthend;$i += (24 * 3600 * 7)) {
|
||||
for($j=0;$j<7;$j++) {
|
||||
$str = "";
|
||||
$cal = $this->gmtdate($i + ($j * 24 * 3600));
|
||||
if($cal["full"] >= $monthstart && $cal["full"] <= $monthend) {
|
||||
if($cal["full"] == $this->today["full"]) {
|
||||
$p->set_var('bgcolor2',$phpgw_info["theme"]["cal_today"]);
|
||||
} else {
|
||||
$p->set_var('bgcolor2','#FFFFFF');
|
||||
}
|
||||
if(!$this->printer_friendly) {
|
||||
$str .= "<a href=\"".$phpgw->link($phpgw_info["server"]["webserver_url"]."/calendar/".$link,"year=".$cal["year"]."&month=".$cal["month"]."&day=".$cal["day"])."\">";
|
||||
}
|
||||
$str .= $cal["day"];
|
||||
if(!$this->printer_friendly) $str .= "</a>";
|
||||
$p->set_var('dayname',$str);
|
||||
} else {
|
||||
$p->set_var('bgcolor2','FEFEFE');
|
||||
$p->set_var('dayname',$cal["day"]);
|
||||
}
|
||||
$p->parse('monthweek_day','day',True);
|
||||
}
|
||||
$p->parse('display_monthweek','month_week',True);
|
||||
$p->set_var('monthweek_day');
|
||||
}
|
||||
$p->pparse('out','mini_cal');
|
||||
}
|
||||
|
||||
function html_for_event_day_at_a_glance ($event) {
|
||||
global $phpgw, $phpgw_info;
|
||||
|
@ -12,14 +12,15 @@
|
||||
include($phpgw_info["server"]["app_inc"] . "/functions.inc.php");
|
||||
echo "<!-- Calendar info -->\n";
|
||||
$now = $phpgw->calendar->splitdate(mktime (0, 0, 0, $phpgw->calendar->today["month"], $phpgw->calendar->today["day"], $phpgw->calendar->today["year"]) - ((60 * 60) * $phpgw_info["user"]["preferences"]["common"]["tz_offset"]));
|
||||
|
||||
echo "<table border=\"0\" width=\"70%\" cellspacing=\"0\" cellpadding=\"0\"><tr><td align=\"center\">"
|
||||
. lang(date("F",$phpgw->calendar->today["raw"])) . " " .$phpgw->calendar->today["day"] . ", " . $phpgw->calendar->today["year"] ."</tr></td>"
|
||||
. "<tr><td bgcolor=\"".$phpgw_info["theme"]["bg_text"]."\" valign=\"top\">"
|
||||
. $phpgw->calendar->print_day_at_a_glance($now)."</td></tr></table>\n";
|
||||
echo "<!-- Calendar info -->\n";
|
||||
$phpgw->calendar->mini_calendar($phpgw->calendar->today["day"],$phpgw->calendar->today["month"],$phpgw->calendar->today["year"]);
|
||||
unset($phpgw->calendar);
|
||||
}
|
||||
|
||||
|
||||
$phpgw_info["server"]["app_inc"] = $tmp_app_inc;
|
||||
?>
|
||||
|
26
calendar/templates/default/mini_cal.tpl
Executable file
26
calendar/templates/default/mini_cal.tpl
Executable file
@ -0,0 +1,26 @@
|
||||
<table border="0" cellspacing="0" cellpadding="0" valign="top" bgcolor="{bgcolor}" cols="7">
|
||||
<tr valign="center" bgcolor="{bgcolor1}" bordercolor="{bgcolor1}">
|
||||
<td align="left" colspan="4"><font size="-2">{month}</font></td>
|
||||
<td align="right" colspan="3"><font size="-2"><a href="{prevmonth}">«</a> <a href="{nextmonth}">»</a></font></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td bgcolor="{bgcolor}" colspan="7">
|
||||
<table border="0" width="100%" cellspacing="1" cellpadding="2" valign="top" cols="7">
|
||||
<tr>
|
||||
{daynames}
|
||||
</tr>
|
||||
{display_monthweek}
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- BEGIN day -->
|
||||
<td bgcolor="{bgcolor2}" align="center"><font size="-2"><b>{dayname}</b></font></td>
|
||||
<!-- END day -->
|
||||
|
||||
<!-- BEGIN month_week -->
|
||||
<tr>
|
||||
{monthweek_day}
|
||||
</tr>
|
||||
<!-- END month_week -->
|
26
calendar/templates/verdilak/mini_cal.tpl
Executable file
26
calendar/templates/verdilak/mini_cal.tpl
Executable file
@ -0,0 +1,26 @@
|
||||
<table border="0" cellspacing="0" cellpadding="0" valign="top" bgcolor="{bgcolor}" cols="7">
|
||||
<tr valign="center" bgcolor="{bgcolor1}" bordercolor="{bgcolor1}">
|
||||
<td align="left" colspan="4"><font size="-2">{month}</font></td>
|
||||
<td align="right" colspan="3"><font size="-2"><a href="{prevmonth}">«</a> <a href="{nextmonth}">»</a></font></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td bgcolor="{bgcolor}" colspan="7">
|
||||
<table border="0" width="100%" cellspacing="1" cellpadding="2" valign="top" cols="7">
|
||||
<tr>
|
||||
{daynames}
|
||||
</tr>
|
||||
{display_monthweek}
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- BEGIN day -->
|
||||
<td bgcolor="{bgcolor2}" align="center"><font size="-2"><b>{dayname}</b></font></td>
|
||||
<!-- END day -->
|
||||
|
||||
<!-- BEGIN month_week -->
|
||||
<tr>
|
||||
{monthweek_day}
|
||||
</tr>
|
||||
<!-- END month_week -->
|
Loading…
Reference in New Issue
Block a user