= '$select_date 00:00:00' AND publish_up <= '$select_date 23:59:59')"
. "\n OR (publish_down >= '$select_date 00:00:00' AND publish_down <= '$select_date 23:59:59')"
. "\n OR (publish_up <= '$select_date 00:00:00' AND publish_down >= '$select_date 23:59:59')"
. "\n OR (publish_up >= '$select_date 00:00:00' AND publish_down <= '$select_date 23:59:59')" // added RC3
. "\n )"
. "\nAND state = '1' ORDER BY publish_up ASC";
*/
/*
$sql = "SELECT #__events.* FROM #__categories AS b, #__events"
. "\n WHERE #__events.catid = b.id AND b.access <= $gid AND #__events.access <= $gid AND"
. "\n ((publish_up >= '$select_date 00:00:00' AND publish_up <= '$select_date 23:59:59')"
. "\n OR (publish_down >= '$select_date 00:00:00' AND publish_down <= '$select_date 23:59:59')"
. "\n OR (publish_up <= '$select_date 00:00:00' AND publish_down >= '$select_date 23:59:59')"
. "\n OR (publish_up >= '$select_date 00:00:00' AND publish_down <= '$select_date 23:59:59')" // added RC3
. "\n )"
. "\nAND #__events.state = '1' ORDER BY publish_up ASC";
/*
/* GWE change to allow mambelfish to work!*/
$query = "SELECT #__events.*"
. "\n FROM #__events"
. "\n WHERE #__events.catid IN(".accessibleCategoryList().")"
. "\n AND #__events.access <= $gid"
. "\n AND ((publish_up >= '$select_date 00:00:00' AND publish_up <= '$select_date 23:59:59')"
. "\n OR (publish_down >= '$select_date 00:00:00' AND publish_down <= '$select_date 23:59:59')"
. "\n OR (publish_up <= '$select_date 00:00:00' AND publish_down >= '$select_date 23:59:59')"
. "\n OR (publish_up >= '$select_date 00:00:00' AND publish_down <= '$select_date 23:59:59')" // added RC3
. "\n )"
. "\n AND #__events.state = '1'"
. "\n ORDER BY publish_up ASC"
;
$database->setQuery( $query );
$detevent = $database->loadObjectList();
return $detevent;
}
function listEventsByMonth( $year, $month, $order ){
global $database, $gid;
$select_date = $year . '-' . $month . '-01 00:00:00';
$select_date_fin = $year . '-' . $month . '-' . date( 't', mktime( 0, 0, 0, ( $month + 1 ), 0, $year ))
. ' 23:59:59';
if( !$order ){
$order = 'publish_up';
}
// dmcd May 7/04 added category access condition
/*
$sql = "SELECT #__events.* FROM #__categories AS b, #__events
WHERE #__events.catid = b.id AND b.access <= $gid AND #__events.access <= $gid AND
(((publish_up >= '$select_date%' AND publish_up <= '$select_date_fin%')
OR (publish_down >= '$select_date%' AND publish_down <= '$select_date_fin%')
OR (publish_up >= '$select_date%' AND publish_down <= '$select_date_fin%')
OR (publish_up <= '$select_date%' AND publish_down >= '$select_date_fin%'))
AND #__events.state = '1') ORDER BY $order ASC"; //publish_up ASC, reccurtype ASC
*/
/* GWE change to allow mambelfish to work!*/
$query = "SELECT #__events.*"
. "\n FROM #__events"
. "\n WHERE #__events.catid IN(".accessibleCategoryList().")"
. "\n AND #__events.access <= $gid"
. "\n AND (((publish_up >= '$select_date%' AND publish_up <= '$select_date_fin%')"
. "\n OR (publish_down >= '$select_date%' AND publish_down <= '$select_date_fin%')"
. "\n OR (publish_up >= '$select_date%' AND publish_down <= '$select_date_fin%')"
. "\n OR (publish_up <= '$select_date%' AND publish_down >= '$select_date_fin%')"
. "\n )"
. "\n AND #__events.state = '1')"
. "\n ORDER BY $order ASC" //publish_up ASC, reccurtype ASC
;
$database->setQuery( $query );
$detevent = $database->loadObjectList();
return $detevent;
}
// listEventsByWeek NOT USED
/*
function listEventsByWeek ($year,$month,$day,$offset) {
global $database;
$rows_per_page=20;
if (empty($offset) || !$offset) $offset=1;
$from = ($offset-1) * $rows_per_page;
$limit = "LIMIT $from, $rows_per_page";
$startday = $cfg->get("com_startday");
$numday=((date("w",mktime(0,0,0,$month,$day,$year))-$startday)%7);
if ($numday == -1){
$numday = 6;
}
$week_start = mktime (0, 0, 0, $month, ($day - $numday), $year );
$week_end = $week_start + ( 3600 * 24 * 6 );
$startdate = date ( "Y-m-d 00:00:00", $week_start );
$enddate = date ( "Y-m-d 23:59:59", $week_end );
$sql = "SELECT * FROM #__events
WHERE ((publish_up >= '$startdate%' AND publish_up <= '$enddate%')
OR (publish_down >= '$startdate%' AND publish_down <= '$enddate%')
OR (publish_up >= '$startdate%' AND publish_down <= '$enddate%')
OR (publish_down >= '$enddate%' AND publish_up <= '$startdate%'))
AND state = '1' ORDER BY publish_up ASC $limit";
$database->setQuery($sql);
$detevent = $database->loadObjectList();
return $detevent;
}
*/
function listEventsByYear( $year, $limitstart, $limit ) {
global $database, $gid;
$rows_per_page = $limit;
if( empty( $limitstart ) || !$limitstart ){
$limitstart = 0;
}
$limit = "LIMIT $limitstart, $rows_per_page";
// dmcd May 7/04 added category access condition
/*
$sql = "SELECT * FROM #__categories AS b, #__events
WHERE #__events.catid = b.id AND b.access <= $gid AND #__events.access <= $gid AND
publish_up LIKE '$year%' AND (publish_down >= '$year%' OR publish_down = '0000-00-00 00:00:00')
AND #__events.state = '1' ORDER BY publish_up ASC $limit";
*/
/* GWE change to allow mambelfish to work!*/
$query = "SELECT *"
. "\n FROM #__events"
. "\n WHERE #__events.catid IN(".accessibleCategoryList().")"
. "\n AND #__events.access <= $gid"
. "\n AND publish_up LIKE '$year%'"
. "\n AND (publish_down >= '$year%' OR publish_down = '0000-00-00 00:00:00')"
. "\n AND #__events.state = '1'"
. "\n ORDER BY publish_up ASC $limit"
;
$database->setQuery( $query );
$detevent = $database->loadObjectList();
return $detevent;
}
function showEventsByYear( $year, $limit, $limitstart ){
global $database, $option, $Itemid, $gid, $mosConfig_list_limit;
global $mainframe,$cfg;
include_once(mosMainFrame::getBasePath()."/administrator/components/com_events/colorMap.php");
$query = "SELECT *"
. "\n FROM #__categories as b, #__events"
. "\n WHERE #__events.catid = b.id"
. "\n AND b.access <= $gid"
. "\n AND #__events.access <= $gid"
. "\n AND publish_up"
. "\n LIKE '$year%'"
. "\n AND (publish_down >= '$year%' OR publish_down = '0000-00-00 00:00:00')"
. "\n AND #__events.state = '1'"
;
$database->setQuery( $query );
$counter = $database->loadObjectList();
$total = count( $counter );
// MLr: discuss replacing _CAL_CONF_EVENT_LIST_ROWS_PPG with $mosConfig_list_limit
$limit = $limit ? $limit : $cfg->get("com_calEventListRowsPpg");
if( $total <= $limit ) {
$limitstart = 0;
}
if ($cfg->get("com_showrepeats")) {
echo '
' . "\n";
} else {
$rows = listEventsByYear( $year, $limitstart, $limit );
$num_events = count( $rows );
$chdate = '';
echo '
' . "\n";
}
showNavTableText( $year, $total, $limitstart, $limit, 'view_year' );
}
function showEventsByDate( $year, $month, $day ){
global $database, $option, $Itemid, $catid;
global $mainframe;
include_once(mosMainFrame::getBasePath()."/administrator/components/com_events/colorMap.php");
$select_date = sprintf( '%4d-%02d-%02d', $year, $month, $day );
$rows = listEventsByDate( $select_date );
usort( $rows, 'sortEvents' );
$num_events = count( $rows );
$chhours = '';
$printcount = 0;
$new_rows_events = array();
if( $num_events > 0 ){
for( $r = 0; $r < $num_events; $r++ ){
$row = $rows[$r];
$event_up = new mosEventDate( $row->publish_up );
$event_up->day = sprintf( '%02d', $event_up->day );
$event_up->month = sprintf( '%02d', $event_up->month );
$event_up->year = sprintf( '%4d', $event_up->year );
$start_time = ( defined( '_CAL_USE_STD_TIME' ) && _CAL_USE_STD_TIME == 'YES' ) ? $event_up->get12hrTime() : $event_up->get24hrTime();
// if start and end times are the same show no start time
$event_down = new mosEventDate( $row->publish_down );
$end_time = (defined("_CAL_USE_STD_TIME") && _CAL_USE_STD_TIME == "YES") ? $event_down->get12hrTime() : $event_down->get24hrTime();
if ($start_time == $end_time) {
$start_time = " ";
}
$new_contactlink = mosEventsHTML::getUserMailtoLink( $row->id, $row->created_by );
$new_catname = mosEventsHTML::getCategoryName( $row->catid );
$checkprint = new mosEventRepeat( $row, $year, $month, $day );
if( $checkprint->viewable == true ){
$new_rows_events[] = array($start_time,
$row->id,
$row->title,
$event_up->year,
$event_up->month,
$event_up->day,
$new_contactlink,
$row->catid,
$new_catname,
$row->color_bar,
$row->useCatColor);
$printcount++;
}
}
}
//////////////////////////////////// AFFICHAGE DU TABLEAU
echo '
' . "\n";
// showNavTableText(10, 10, $num_events, $offset, '');
}
function showEventsByWeek( $year, $month, $day ){
global $mosConfig_offset, $database, $option, $Itemid;
global $mainframe, $cfg;
include_once(mosMainFrame::getBasePath()."/administrator/components/com_events/colorMap.php");
// Other methode to investigate
//$rows = listEventsByWeek ($year,$month,$day,$offset);
//$max_events = count($rows);
$startday = $cfg->get("com_startday");
$numday = (( date( 'w', mktime( 0, 0, 0, $month, $day, $year )) - $startday ) %7 );
if( $numday == -1 ){
$numday = 6;
}
$week_start = mktime( 0, 0, 0, $month, ( $day - $numday ), $year );
$this_date = new mosEventDate();
$this_date->setDate( strftime( '%Y', $week_start ), strftime( '%m', $week_start ), strftime( '%d', $week_start ));
//$this_date->setDate( date ( "Y", $week_start ),date ( "m", $week_start ),date ( "d", $week_start ));
$this_enddate = clone( $this_date );
$this_enddate->addDays( +6 );
$startdate = mosEventsHTML::getDateFormat( $this_date->year, $this_date->month, $this_date->day, 1 );
$enddate = mosEventsHTML::getDateFormat( $this_enddate->year, $this_enddate->month, $this_enddate->day ,1 );
echo '
' . "\n";
//showNavTableText(20, 20, $max_events, $offset, 'view_week');
}
function showCalendar( $rows, $year, $month, $day ){
global $mosConfig_offset, $database, $option, $Itemid;
global $mosConfig_absolute_path;
global $mosConfig_live_site;
global $cfg;
$cellcount = count( $rows );
usort( $rows, 'sortEvents' );
while( list( $key, $value ) = each( $rows )) {
$id_Array[] = $value->id;
$title_Array[] = $value->title;
// $content_Array[] = $value->content; // new mic
$color_Array[] = $value->color_bar;
$publish_up_Array[] = $value->publish_up;
$publish_down_Array[] = $value->publish_down;
$reccurtype_Array[] = $value->reccurtype;
$reccurday_Array[] = $value->reccurday;
$reccurweekdays_Array[] = $value->reccurweekdays;
}
$thisday = $year . '-' . $month . '-' . $day;
$day_name = array( _CAL_LANG_SUNDAYSHORT, _CAL_LANG_MONDAYSHORT, _CAL_LANG_TUESDAYSHORT, _CAL_LANG_WEDNESDAYSHORT, _CAL_LANG_THURSDAYSHORT, _CAL_LANG_FRIDAYSHORT, _CAL_LANG_SATURDAYSHORT );
// $y=date("Y");
$month_name = EventsHelper::getMonthName( $month );
if( $month <= '9' & ereg( "(^[1-9]{1})", $month )) {
$month = '0' . $month;
}
mosCommonHTML::loadOverlib();
//if( _CAL_CONF_TT_SHADOW == 1 ){ // disbled only for test [mic]
if( !defined( '_LOAD_OVERLIB_SHADOW' )){
define( '_LOAD_OVERLIB_SHADOW', 1 ); ?>
' . "\n";
echo '' . "\n";
if( $num_events > 0 ){
for( $r = 0; $r < $num_events; $r++ ) {
$row = &$rows[$r];
$event_up = new mosEventDate( $row->publish_up );
$event_up->day = sprintf( '%02d', $event_up->day );
$event_up->month = sprintf( '%02d', $event_up->month );
$event_up->year = sprintf( '%4d', $event_up->year );
$event_day_month_year = $event_up->day . $event_up->month . $event_up->year;
$event_day_month = $event_up->day . $event_up->month;
$catname = mosEventsHTML::getCategoryName( $row->catid );
$contactlink = mosEventsHTML::getUserMailtoLink( $row->id, $row->created_by );
// skip rows with no current events
if( $row->reccurtype == 5 & $month != $event_day_month ){
continue;
}
if(( $event_day_month_year <> $chdate ) && $chdate <> '' ){
echo '
' . "\n";
}
if( $event_day_month_year <> $chdate ){
echo '';
if( $event_up->month == strftime( '%m', time() + ( $mosConfig_offset*60*60 ) )
&& $event_up->year == strftime( '%Y', time() + ( $mosConfig_offset*60*60 ) )
&& $event_up->day == strftime( '%d', time() + ( $mosConfig_offset*60*60 ) )
) {
$bg = ' class="ev_td_today"';
} else {
$bg = ' class="ev_td_left"'; //ev_td_left
}
echo '| ';
echo mosEventsHTML::getDateFormat( $event_up->year, $event_up->month, $event_up->day, 4 );
echo ' | ' . "\n";
echo '' . "\n";
echo '';
echo '| '; // class='ev_td_left'>";
$chcat = '';
}
if(( $row->catid <> $chcat ) && $chcat <> '' ){
echo ' | ' . "\n";
}
if( $row->catid <> $chcat ){
echo '| '; // class='ev_td_left'
echo '';
HTML_events::viewEventCatRow ( $row->catid, $catname, 'view_cat', $event_up->year, $event_up->month, $event_up->day, $option, $Itemid );
echo ' :: | ' . "\n";
echo '' . "\n"; // class='ev_td_right'>\n";
}
if( $row->reccurtype == 5 ){ //each year
if( $month == $event_day_month ){
HTML_events::viewEventRow ( $row->id, $row->title, 'view_detail', $event_up->year, $event_up->month, $event_up->day, $contactlink, $option, $Itemid );
} else {
echo ' ';
}
} else {
HTML_events::viewEventRow ( $row->id, $row->title, 'view_detail', $event_up->year, $event_up->month, $event_up->day, $contactlink, $option, $Itemid );
}
$chcat = $row->catid;
$chdate = $event_day_month_year;
}
echo ' | ' . "\n";
} else {
//echo " |
";
//echo "| \n";
echo _CAL_LANG_NO_EVENTFOR . ' ' . mosEventsHTML::getDateFormat( $year, $month, '', 3 ) . '';
} // end if
echo ' |
' . "\n";
echo '
' . "\n";
//showNavTableText(10, 10, $num_events, 1, $option, 'view_year', $Itemid);
}
?>