Events from Callite on EzPortal

Allgemeiner Support zum phpBB 2 Board und phpBB 2 Modifikationen
Forumsregeln
Auch wenn hier der Support für phpBB 2 weiterhin aufrecht erhalten bleibt, weisen wir darauf hin, dass das phpBB 2 nicht mehr offiziell unterstützt und weiterentwickelt wird!
Antworten
Michelle
Beiträge: 7
Registriert: Mi 12.Mai, 2004 04:14

Events from Callite on EzPortal

Beitrag von Michelle »

I apologize for asking this, as this may have been discussed already. But, I don't understand German and would appreciate any help you could give me.

Is there anyway to change the way the date is formated for this mod. My Callite has the correct format that I want (Sunday May 16, 2004 6:00 pm). However, the date shows up like this, 16.05.2004, with this mod.

Thank-you,
Michelle
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

Try this:

Code: Alles auswählen

#
#-----[ OPEN ]-----
#
portal.php

#
#-----[ FIND ]-----
#
			$start_date = substr($row['stamp'],8,2).".".substr($row['stamp'],5,2).".".substr($row['stamp'],0,4);
			$end_date = substr($row['eventspan'],8,2).".".substr($row['eventspan'],5,2).".".substr($row['eventspan'],0,4);

#
#-----[ AFTER, ADD ]-----
#
			$events_dateformat = ( !$userdata['user_dateformat'] ) ? $board_config['default_dateformat'] : $userdata['user_dateformat'];
			$events_timezone = ( !$userdata['user_timezone'] ) ? $board_config['board_timezone'] : $userdata['user_timezone'];

			$start_date = create_date($events_dateformat, $row['stamp'], events_timezone);
			$end_date = create_date($events_dateformat, $row['eventspan'], events_timezone);


#
#-----[ SAVE/CLOSE ALL FILES ]-----
#
# EoM
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
Michelle
Beiträge: 7
Registriert: Mi 12.Mai, 2004 04:14

Beitrag von Michelle »

This is the code correct? I tried editing the part that I highlighted in red..However that did not do what I thought it would. Could you please advise as to which part of the code I should edit..I do know how to edit the code I just don't know which part..

Thank you,
Michelle
//
// Events
//
if ($cal_config['number_events'] <> 0)
{
$day = create_date("j", time(), $userdata['user_timezone']);
$month = create_date("m", time(), $userdata['user_timezone']);
$year = create_date("Y", time(), $userdata['user_timezone']);


if ($cal_config['day_number'] == 0)
{
$sql_limit = ' LIMIT 0, ' . $cal_config['number_events'];
$event_span_date = '';
$sql_span = '';
}
else
{
$sql_limit = '';
$event_span_date = strtotime("$year-$month-$day 23:59:59 + $cal_days days");
$event_span_date = create_date("Y", $event_span_date, $userdata['user_timezone']).'-'.create_date("m", $event_span_date, $userdata['user_timezone']).'-'.create_date("j", $event_span_date, $userdata['user_timezone']).' 23:59:59';
$sql_span = " AND stamp <= '$event_span_date'";
}

$sql = "SELECT * FROM ".$table_prefix."calendar WHERE valid = 'yes'
AND stamp >= '$year-$month-$day 00:00:00'
$sql_span
ORDER BY stamp" . $sql_limit;

$check = 0;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not select Event data', '', __LINE__, __FILE__, $sql);
}
else
{
while ($row = $db->sql_fetchrow($result))
{
$check++;
$subject = stripslashes($row['subject']);
if ( strlen($subject) > $cal_config['subject_length']) {
if ((substr($subject,-3,1) == '(') && (substr($subject,-1,1) == ')')) {
// store the number of permits and tack them on the end of the shortened subject
$subjectnum = substr($subject,-2,1);
$subject = substr($subject, 0, -3);
}
$subject = substr($subject, 0, $cal_config['subject_length']);
$subject .= '..';
}
$start_date = substr($row['stamp'],8,2).".".substr($row['stamp'],5,2).".".substr($row['stamp'],0,4);
$end_date = substr($row['eventspan'],8,2).".".substr($row['eventspan'],5,2).".".substr($row['eventspan'],0,4);

if ( $start_date == $end_date )
{
$span = $start_date;
}
else
{
$span = $start_date . " - " . $end_date;
}
$subject = ( $userdata['session_logged_in'] ) ? '<a href="'. $phpbb_root_path .'calendar.'.$phpEx.'?id='. $row['id'] .'&mode=display&day='. substr($row['stamp'],8,2). '&month='.substr($row['stamp'],5,2).'&year='.substr($row['stamp'],0,4).'">'. $subject .'</a>' : $subject;
$author = ( $userdata['session_logged_in'] ) ? '<a href="'. $phpbb_root_path .'profile.'.$phpEx.'?mode=viewprofile&'. POST_USERS_URL .'='. $row['user_id'] .'">('. stripslashes($row['username']) .')</a>' : '('. stripslashes($row['username']) .')';
$template->assign_block_vars('event', array(
'SUBJECT' => $subject,
'SPAN' => $span,
'AUTHOR' => $author));
}
if ( $check == 0 )
{
$template->assign_block_vars('event', array(
'SUBJECT' => $lang["No_events"]));
}
}
}
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

Please use BBCode CODE or QUOTE to reduce the page length. Thanks.

And no, the variables you named will be used to query the database.
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
Michelle
Beiträge: 7
Registriert: Mi 12.Mai, 2004 04:14

Beitrag von Michelle »

Oooh ok, I am sorry..I did not see all of the code you posted in the previous post..Too early in the morning for me I suppose. Thank-you so much.
Michelle
Beiträge: 7
Registriert: Mi 12.Mai, 2004 04:14

Beitrag von Michelle »

Ah, sorry to bother you again. However, the format is now correct but the date and time is wrong..
It says, Thu Jan 01, 1970 12:00 am.. All the other dates on the site are correct..
Any suggestions?
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

I've change the code above. Try it again.
If this will not work for you, I'll test it today afternoon on my testboard...
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
Michelle
Beiträge: 7
Registriert: Mi 12.Mai, 2004 04:14

Beitrag von Michelle »

Thank-you, it did not work.
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

Last try, before I'll test it:
Find in portal.php

Code: Alles auswählen

         $start_date = substr($row['stamp'],8,2).".".substr($row['stamp'],5,2).".".substr($row['stamp'],0,4); 
         $end_date = substr($row['eventspan'],8,2).".".substr($row['eventspan'],5,2).".".substr($row['eventspan'],0,4); 

         $events_dateformat = ( !$userdata['user_dateformat'] ) ? $board_config['default_dateformat'] : $userdata['user_dateformat']; 
         $events_timezone = ( !$userdata['user_timezone'] ) ? $board_config['board_timezone'] : $userdata['user_timezone']; 

         $start_date = create_date($events_dateformat, $row['stamp'], events_timezone); 
         $end_date = create_date($events_dateformat, $row['eventspan'], events_timezone);
and replace this lines with

Code: Alles auswählen

	 $start_date = mydateformat($row['stamp'], $userdata['user_dateformat']);
	 $end_date = mydateformat($row['eventspan'], $userdata['user_dateformat'], 1);
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
Michelle
Beiträge: 7
Registriert: Mi 12.Mai, 2004 04:14

Beitrag von Michelle »

Fatal error: Call to undefined function: mydateformat() in c:\inetpub\wwwroot\phpbb2\portal.php on line 171
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

Sorry, the function will be in calendar.php.
Delete the following code from calendar.php and insert this in includes/functions.php before "?>" (at the end):

Code: Alles auswählen

function mydateformat($thisdate, $dateformat='d M Y G:i', $span=0)
{
	global $cal_config;

	if ($cal_config['cal_dateformat']) {
		$dateformat = $cal_config['cal_dateformat'];
		}

	// date comes in as the following:
	$myr = substr($thisdate, 0, 4);
	$mym = substr($thisdate, 5, 2);
	$myd = substr($thisdate, 8, 2);
	$myh = substr($thisdate, 11, 2);
	$myn = substr($thisdate, 14, 2);
	$mys = substr($thisdate, 17, 2);

	if ($span || ($myh=='00' && $myn=='00' && $mys=='00')) {
		// Need to strip out any TIME references so...
		$timerefs = array ('a','A','B','g','G','h','H','i','I','s');
		while (list(,$val) = each ($timerefs))
			{
			$dateformat = ereg_replace($val, "", $dateformat);
			}
		// strip out any characters used for time
		$dateformat = ereg_replace('[:]', " ", $dateformat);
	}

	$returndate = date($dateformat, mktime ($myh,$myn,$mys,$mym,$myd,$myr));
	return $returndate;
}
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
Michelle
Beiträge: 7
Registriert: Mi 12.Mai, 2004 04:14

Beitrag von Michelle »

It worked! :) It has the end date on it..makes it look kinds funny..But that's ok..
Thanks so much. I really appreciate it.
Benutzeravatar
oxpus
Administrator
Beiträge: 28735
Registriert: Mo 27.Jan, 2003 22:13
Wohnort: Bad Wildungen
Kontaktdaten:

Beitrag von oxpus »

No problem. I'll everytime help if I can.
Karsten Ude
-={ Das Mädchen für alles }=-
Kein Support per Messenger, Email oder PN! Unaufgeforderte Nachrichten werden ignoriert!
No support per Messenger, Email or PM. Each unasked message will be ignored!
Antworten