Here is the code
Code: Select all
PHP Version: 4.3.11
Display Errors: On
Error Level: E_ALL
Register Globals: Off
index.php
Code: Select all
<?php
include "header.php";
include "php/orgcal/include/main.php";
extract($_GET);
if (empty($page))
$page = "body_content/welcome.html";
?>
<!--Left Content -->
<div id="leftcontent">
<div id="contentdivs">
<?php include "menu.php"; ?>
</div>
</div> <!-- end div leftcontent -->
<!--Right Content -->
<div id="rightcontent">
<div id="contentdivs">
<?php include "php/orgcal/miniCal.php"; ?> <---------- The part in question
</div>
</div>
<!--Main Content -->
<div id="centercontent">
<div id="contentdivs">
<?php include $page; ?>
</div>
</div>
<?php
include "footer.php";
?>
miniCal.php
Code: Select all
<?
if( !isset($_REQUEST['date']) )
$date = OrgCal::getTodaysDate();
else
$date = $_REQUEST['date'];
$mini = new OCMiniCal();
$body = $mini->drawMiniCalTable( $date, $return = true, "orgcal/" );
echo "<table class='box' cellspacing='0' width= 100%'> <tr class ='boxTitle'> <td>Calendar</td></tr> <tr class='boxContent'> <td>$body</td></tr> </table>";
?>
OCMiniCal.php
The code on line
82 generates the link so the link becomes
Code: Select all
http://localhost/index.php?page=php/orgcal/view.php?view=day&date=20050521
Code: Select all
<?php
/**
* OCMiniCal
*
* @author Kevin Southworth <southwo8@msu.edu>
* @copyright Copyright (c) 2004
* @version 0.1
* @since 2004-04-18
* @access public
**/
class OCMiniCal extends OCMonth {
/**
* OCMiniCal::OCMiniCal()
*
* @return
**/
function OCMiniCal() {
$this->OrgCal(); // parent constructor
}
/**
* OCMiniCal::drawMiniCalTable()
*
* @param $date
* @param boolean $returnHtml
* @return
**/
function drawMiniCalTable( $date, $returnHtml = false ) {
list($year,$month,$day) = $this->decDateStr($date);
$dstr = $this->encDateStr( $year, $month, 1 );
$wkstart_t = $this->getWeekStart($dstr);
$monthstart_t = $this->getMonthStart( $year, $month );
$monthend_t = $this->getMonthEnd( $year, $month );
// Pre-load event data - this is REQUIRED for getDateEvents() to return anything!
$this->fillEventCache( $this->stampToString($monthstart_t), $this->stampToString($monthend_t) );
$html = "\n<div class=\"center\">\n<table class=\"miniCal border\" cellspacing=\"0\" cellpadding=\"0\">\n";
#### Table heading ####
$monthName = $this->getMonthName( $month );
$prevLink = '<a href="'.$_SERVER['PHP_SELF'].'?date='.$this->getPreviousMonth($dstr).'" class="previous"><</a>';
$nextLink = '<a href="'.$_SERVER['PHP_SELF'].'?date='.$this->getNextMonth($dstr).'" class="next">></a>';
$html .= '<tr> <td class="miniCalHeader">'.$prevLink.'</td>';
$html .= '<td colspan="5" class="miniCalHeader">'.$monthName.' '.$year.'</td>';
$html .= '<td class="miniCalHeader">'.$nextLink.'</td> </tr>';
#### Day headings ####
$headings = '<tr>';
foreach( $this->getWeekdayNames('abbrev') as $dayName ) {
$headings .= '<td class="colHeader">'.$dayName.'</td>';
}
$headings .= '</tr>';
$html .= $headings;
### day cells output ###
$month_it = new OCMonthIterator($wkstart_t,$monthstart_t,$monthend_t);
while( $dateStr = $month_it->moveNext() ) {
list(,,$day) = $this->decDateStr($dateStr);
$todayDateStr = $this->getTodaysDate();
if( $month_it->isFirstInRow() ) {
$html .= "<tr>\n";
}
if( $dateStr == 'empty' ) { // no events for this day
$html .= "<td> </td>\n";
} else { // events exist for this day
$date_t = $this->stringToStamp( $dateStr );
$classes = '';
if( $this->dateIsWeekend( $date_t ) )
$classes = ' weekend';
if( $dateStr == $todayDateStr ) {
$classes = ' curDay';
}
### day cells ###
$dateEvents = $this->getDateEvents( $dateStr );
$dayNum = sprintf("%d",$day);
$dayLink = $dayNum;
if( (sizeof($dateEvents) > 0) && OrgCalAuth::checkViewAuth(-1) ) {
$dayLink = '<a href="view.php?view=day&date='.$dateStr.'" class="hasEvents">'.$dayNum.'</a>';
if( $dateStr != $todayDateStr )
$classes .= ' hasEvents';
}
$html .= '<td class="center miniCal normalDay'.$classes.'">';
$html .= $dayLink;
$html .= '</td>';
}
if( $month_it->isLastInRow() ) {
$html .= "</tr>\n";
}
} // end while loop for day cells
$html .= '</table> </div>';
return $html;
}
### Variables ###
}
?>
view.php
Note: I have tried to modify below code to accomodate my needs and so not all the variables are being used.
Code: Select all
<?php
/* view.php
*
* Handles the display of 'views' for OrgCal
* (e.g. Month, Week, Day)
*/
require_once 'include/main.php';
if( !isset($_REQUEST['date']) )
$date = OrgCal::getTodaysDate();
else
$date = $_REQUEST['date'];
// Controller
$view = $_REQUEST['view'];
switch( $view ) {
case 'event':
$title = 'OrgCal : Event View';
$sheets = OrgCalConfig::getEventStylesheets();
$eventObj = new OCEvent( $_REQUEST['id'] );
$html = $eventObj->drawEventTable( $return = true );
$html .= '<br />'.$eventObj->drawEventLinks( $date, $override = false, $return = true );
$body = $html;
break;
case 'day':
$title = 'OrgCal : Day View';
$sheets = OrgCalConfig::getDayStylesheets();
$dayObj = new OCDay();
$html = $dayObj->drawDayTable( $date, $return = true );
$body = $html;
$body .= '<br />'.$dayObj->drawNavTable( $date, $return = true );
break;
case 'week':
$title = 'OrgCal : Week View';
$sheets = OrgCalConfig::getWeekStylesheets();
$weekObj = new OCWeek();
$body = $weekObj->drawWeekTable( $date, $return = true );
$body .= '<br />'.$weekObj->drawNavTable( $date, $return = true );
break;
case 'month':
default:
$title = 'OrgCal : Month View';
$sheets = OrgCalConfig::getMonthStylesheets();
$monthObj = new OCMonth();
$body = $monthObj->drawMonthTable( $date, $return = true );
$body .= '<br />'.$monthObj->drawNavTable( $date, $return = true );
$body .= '<br />'.OrgCalAuth::drawUserBox(true);
}
?>
<!-- div for overLib -->
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
<?=$body?>
let me know if you need other parts of the code. I really appreciate all your help.
thanks,
- Maulesh