parent
0ddc1e8caa
commit
802e23320b
@ -1,136 +0,0 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
/** |
||||
* Blog calendar |
||||
* @package chamilo.blogs |
||||
*/ |
||||
/** |
||||
* Code |
||||
*/ |
||||
|
||||
// including the global |
||||
require_once '../inc/global.inc.php'; |
||||
|
||||
// the variables for the days and the months |
||||
// Defining the shorts for the days |
||||
$DaysShort = api_get_week_days_short(); |
||||
// Defining the days of the week to allow translation of the days |
||||
$DaysLong = api_get_week_days_long(); |
||||
// Defining the months of the year to allow translation of the months |
||||
$MonthsLong = api_get_months_long(); |
||||
|
||||
?> |
||||
<html> |
||||
<head> |
||||
<title>Calendar</title> |
||||
|
||||
<style type="text/css"> |
||||
table.calendar |
||||
{ |
||||
width: 100%; |
||||
font-size: 11px; |
||||
font-family: verdana, arial, helvetica, sans-serif; |
||||
} |
||||
table.calendar .monthyear |
||||
{ |
||||
background-color: #4171B5; |
||||
text-align: center; |
||||
color: #ffffff; |
||||
} |
||||
table.calendar .daynames |
||||
{ |
||||
background-color: #D3DFF1; |
||||
text-align: center; |
||||
} |
||||
table.calendar td |
||||
{ |
||||
width: 25px; |
||||
height: 25px; |
||||
background-color: #f5f5f5; |
||||
text-align: center; |
||||
} |
||||
table.calendar td.selected |
||||
{ |
||||
border: 1px solid #ff0000; |
||||
background-color: #FFCECE; |
||||
} |
||||
table.calendar td a |
||||
{ |
||||
width: 25px; |
||||
height: 25px; |
||||
text-decoration: none; |
||||
} |
||||
table.calendar td a:hover |
||||
{ |
||||
background-color: #ffff00; |
||||
} |
||||
table.calendar .monthyear a |
||||
{ |
||||
text-align: center; |
||||
color: #ffffff; |
||||
} |
||||
table.calendar .monthyear a:hover |
||||
{ |
||||
text-align: center; |
||||
color: #ff0000; |
||||
background-color: #ffff00; |
||||
} |
||||
</style> |
||||
<script type="text/javascript"> |
||||
<!-- |
||||
/* added 2004-06-10 by Michael Keck |
||||
* we need this for Backwards-Compatibility and resolving problems |
||||
* with non DOM browsers, which may have problems with css 2 (like NC 4) |
||||
*/ |
||||
var isDOM = (typeof(document.getElementsByTagName) != 'undefined' |
||||
&& typeof(document.createElement) != 'undefined') |
||||
? 1 : 0; |
||||
var isIE4 = (typeof(document.all) != 'undefined' |
||||
&& parseInt(navigator.appVersion) >= 4) |
||||
? 1 : 0; |
||||
var isNS4 = (typeof(document.layers) != 'undefined') |
||||
? 1 : 0; |
||||
var capable = (isDOM || isIE4 || isNS4) |
||||
? 1 : 0; |
||||
// Uggly fix for Opera and Konqueror 2.2 that are half DOM compliant |
||||
if (capable) { |
||||
if (typeof(window.opera) != 'undefined') { |
||||
var browserName = ' ' + navigator.userAgent.toLowerCase(); |
||||
if ((browserName.indexOf('konqueror 7') == 0)) { |
||||
capable = 0; |
||||
} |
||||
} else if (typeof(navigator.userAgent) != 'undefined') { |
||||
var browserName = ' ' + navigator.userAgent.toLowerCase(); |
||||
if ((browserName.indexOf('konqueror') > 0) && (browserName.indexOf('konqueror/3') == 0)) { |
||||
capable = 0; |
||||
} |
||||
} // end if... else if... |
||||
} // end if |
||||
//--> |
||||
</script> |
||||
<script type="text/javascript" src="tbl_change.js"></script> |
||||
<script type="text/javascript"> |
||||
<!-- |
||||
var month_names = new Array( |
||||
<?php |
||||
foreach($MonthsLong as $index => $month){ |
||||
echo '"'.$month.'",'; |
||||
} |
||||
?> |
||||
""); |
||||
var day_names = new Array( |
||||
<?php |
||||
foreach($DaysShort as $index => $day) |
||||
{ |
||||
echo '"'.$day.'",'; |
||||
} |
||||
?> |
||||
""); |
||||
//--> |
||||
</script> |
||||
</head> |
||||
<body onLoad="initCalendar();"> |
||||
<div id="calendar_data"></div> |
||||
<div id="clock_data"></div> |
||||
</body> |
||||
</html> |
||||
@ -1,159 +0,0 @@ |
||||
var day; |
||||
var month; |
||||
var year; |
||||
var hour; |
||||
var minute; |
||||
var second; |
||||
var clock_set = 0; |
||||
|
||||
/** |
||||
* Opens calendar window. |
||||
* |
||||
* @param string form name |
||||
* @param string field name |
||||
*/ |
||||
function openCalendar(form, field) { |
||||
window.open("./calendar.php", "calendar", "width=260,height=250,status=no"); |
||||
day = eval("document." + form + "." + field + "day.options["+ "document." + form + "." + field + "day.selectedIndex].value"); |
||||
month = eval("document." + form + "." + field + "month.options["+ "document." + form + "." + field + "month.selectedIndex].value"); |
||||
month = month-1; |
||||
year = eval("document." + form + "." + field + "year.options["+ "document." + form + "." + field + "year.selectedIndex].value"); |
||||
formName = form; |
||||
fieldName =field; |
||||
} |
||||
|
||||
/** |
||||
* Formats number to two digits. |
||||
* |
||||
* @param int number to format. |
||||
*/ |
||||
function formatNum2(i, valtype) { |
||||
f = (i < 10 ? '0' : '') + i; |
||||
if (valtype && valtype != '') { |
||||
switch(valtype) { |
||||
case 'month': |
||||
f = (f > 12 ? 12 : f); |
||||
break; |
||||
|
||||
case 'day': |
||||
f = (f > 31 ? 31 : f); |
||||
break; |
||||
} |
||||
} |
||||
|
||||
return f; |
||||
} |
||||
|
||||
/** |
||||
* Formats number to four digits. |
||||
* |
||||
* @param int number to format. |
||||
*/ |
||||
function formatNum4(i) { |
||||
return (i < 1000 ? i < 100 ? i < 10 ? '000' : '00' : '0' : '') + i; |
||||
} |
||||
|
||||
/** |
||||
* Initializes calendar window. |
||||
*/ |
||||
function initCalendar() { |
||||
if (!year && !month && !day) { |
||||
day = window.opener.day; |
||||
month = window.opener.month; |
||||
year = window.opener.year; |
||||
if (isNaN(year) || isNaN(month) || isNaN(day) || day == 0) { |
||||
dt = new Date(); |
||||
year = dt.getFullYear(); |
||||
month = dt.getMonth(); |
||||
day = dt.getDate(); |
||||
} |
||||
} else { |
||||
/* Moving in calendar */ |
||||
if (month > 11) { |
||||
month = 0; |
||||
year++; |
||||
} |
||||
if (month < 0) { |
||||
month = 11; |
||||
year--; |
||||
} |
||||
} |
||||
|
||||
if (document.getElementById) { |
||||
cnt = document.getElementById("calendar_data"); |
||||
} else if (document.all) { |
||||
cnt = document.all["calendar_data"]; |
||||
} |
||||
|
||||
cnt.innerHTML = ""; |
||||
|
||||
str = "" |
||||
|
||||
//heading table
|
||||
str += '<table class="calendar"><tr><th class="monthyear" width="50%">'; |
||||
str += '<a href="javascript:month--; initCalendar();">«</a> '; |
||||
str += month_names[month]; |
||||
str += ' <a href="javascript:month++; initCalendar();">»</a>'; |
||||
str += '</th><th class="monthyear" width="50%">'; |
||||
str += '<a href="javascript:year--; initCalendar();">«</a> '; |
||||
str += year; |
||||
str += ' <a href="javascript:year++; initCalendar();">»</a>'; |
||||
str += '</th></tr></table>'; |
||||
|
||||
str += '<table class="calendar"><tr>'; |
||||
for (i = 0; i < 7; i++) { |
||||
str += "<th class='daynames'>" + day_names[i] + "</th>"; |
||||
} |
||||
str += "</tr>"; |
||||
|
||||
var firstDay = new Date(year, month, 1).getDay(); |
||||
var lastDay = new Date(year, month + 1, 0).getDate(); |
||||
|
||||
str += "<tr>"; |
||||
|
||||
dayInWeek = 0; |
||||
for (i = 0; i < firstDay; i++) { |
||||
str += "<td> </td>"; |
||||
dayInWeek++; |
||||
} |
||||
for (i = 1; i <= lastDay; i++) { |
||||
if (dayInWeek == 7) { |
||||
str += "</tr><tr>"; |
||||
dayInWeek = 0; |
||||
} |
||||
|
||||
dispmonth = 1 + month; |
||||
actVal = formatNum4(year) + "-" + formatNum2(dispmonth, 'month') + "-" + formatNum2(i, 'day'); |
||||
if (i == day) { |
||||
style = ' class="selected"'; |
||||
} else { |
||||
style = ''; |
||||
} |
||||
str += "<td" + style + "><a href=\"javascript:returnDate(" + i +","+month+","+year + ");\">" + i + "</a></td>" |
||||
dayInWeek++; |
||||
} |
||||
for (i = dayInWeek; i < 7; i++) { |
||||
str += "<td> </td>"; |
||||
} |
||||
|
||||
str += "</tr></table>"; |
||||
|
||||
cnt.innerHTML = str; |
||||
} |
||||
|
||||
/** |
||||
* Returns date from calendar. |
||||
* |
||||
* @param string date text |
||||
*/ |
||||
function returnDate(d,m,y) { |
||||
cmd = "window.opener.document."+window.opener.formName+"."+window.opener.fieldName+"day.selectedIndex = "+(d-1); |
||||
eval(cmd); |
||||
cmd = "window.opener.document."+window.opener.formName+"."+window.opener.fieldName+"month.selectedIndex = "+m; |
||||
eval(cmd); |
||||
date = new Date(); |
||||
year = date.getFullYear()-1; |
||||
cmd = "window.opener.document."+window.opener.formName+"."+window.opener.fieldName+"year.selectedIndex = "+(y-year); |
||||
eval(cmd); |
||||
window.close(); |
||||
} |
||||
Loading…
Reference in new issue