Welcome to Geeklog, Anonymous Tuesday, December 10 2024 @ 03:20 pm EST
Geeklog Forums
evList event list 1.1 available
Page navigation
Status: offline
samstone
Forum User
Full Member
Registered: 09/29/02
Posts: 820
Oooooo... that's so cool. How did I miss it!
For the time being, for the events that occur, let's say every first and third Thursday, I can just make two entries to cover it. I just have to move the recurring statement, "This event recur monthly" form the templates.
Thanks,
Sam
For the time being, for the events that occur, let's say every first and third Thursday, I can just make two entries to cover it. I just have to move the recurring statement, "This event recur monthly" form the templates.
Thanks,
Sam
23
22
Quote
Status: offline
samstone
Forum User
Full Member
Registered: 09/29/02
Posts: 820
What is the end of the following line from index.php for the event listing do?
It produces a /2 at the end of the url and the event detail shows a date from 1969.
I copy the code from the functions.inc for the centerblock and fixed the problem, but I hope I didn't leave out something important
$titlelink = COM_buildURL($_CONF['site_url'] . '/evlist/event.php?eid=' . $A['id'] . $timestamp);
I am trying to figure out a way to show the end time without repeating the date if it is the same day. And during event creation or editing permission to enter the end time without having to reenter the end date, if it is the same day, would be also desirable.
Thanks,
Sam
Text Formatted Code
$titlelink = COM_buildURL($_CONF['site_url'] . '/evlist/event.php?eid=' . $A['id'] . $timestamp . $andrange . $andcat);It produces a /2 at the end of the url and the event detail shows a date from 1969.
I copy the code from the functions.inc for the centerblock and fixed the problem, but I hope I didn't leave out something important
Text Formatted Code
$titlelink = COM_buildURL($_CONF['site_url'] . '/evlist/event.php?eid=' . $A['id'] . $timestamp);
I am trying to figure out a way to show the end time without repeating the date if it is the same day. And during event creation or editing permission to enter the end time without having to reenter the end date, if it is the same day, would be also desirable.
Thanks,
Sam
15
19
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
Quote by: samstone
It produces a /2 at the end of the url and the event detail shows a date from 1969.
What is the end of the following line from index.php for the event listing do?
Text Formatted Code
$titlelink = COM_buildURL($_CONF['site_url'] . '/evlist/event.php?eid=' . $A['id'] . $timestamp . $andrange . $andcat);It produces a /2 at the end of the url and the event detail shows a date from 1969.
Well, the end of that line just adds link variables, e.g., the date range and the category if any exist. I haven't run into the "/2" thing yet. maybe you can give me a step by step so that i can reproduce what you did and see if there is a problem.
Quote by: samstone
I am trying to figure out a way to show the end time without repeating the date if it is the same day. And during event creation or editing permission to enter the end time without having to reenter the end date, if it is the same day, would be also desirable.
I'm not going to change the way the dates display in my copy, but you can try something like this for the event display...
find the evlist_display_event() function in event.php, and at about line 186 find the following:
Text Formatted Code
$dateend1 = '<br />' . $LANG_EVLIST03[4] . $A['date_end1'];Text Formatted Code
$dateend1 = '<br />' . $LANG_EVLIST03[4];if ($A['date_end1'] != $A['date_start1']){
$dateend1 .= $A['date_end1'];
} else {
$dateend1 = '';
}
18
23
Quote
Status: offline
samstone
Forum User
Full Member
Registered: 09/29/02
Posts: 820
The producing of /2 might have to do with url rewrite being on, since I didn't do any different than the normal step of clicking on the event list. Maybe if you turn url rewrite on, you will be able to reproduce it.
The code works. I have to figure out how to deal with the ', ' issue. I replaced it with '- ' but it messed up the look if the date existed. In any case, you have given me enough clue as to where to fix.
I am also trying to figure out if there is a way to make it store the end time without having to reenter the end date when it is on the same day.
Thanks,
Sam
The code works. I have to figure out how to deal with the ', ' issue. I replaced it with '- ' but it messed up the look if the date existed. In any case, you have given me enough clue as to where to fix.
I am also trying to figure out if there is a way to make it store the end time without having to reenter the end date when it is on the same day.
Thanks,
Sam
17
19
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
if there is an end date, why would you have to enter it again? the field responsible for the end date in the editor is already loaded when you go to edit the event.
and if the url rewrite is on then the "/2" is not a bug, it would be the category variable. that shouldn't cause you a problem.
and if the url rewrite is on then the "/2" is not a bug, it would be the category variable. that shouldn't cause you a problem.
17
20
Quote
Status: offline
samstone
Forum User
Full Member
Registered: 09/29/02
Posts: 820
Let's say I create an event. I enter the start date and time.
Then if I leave the end date blank and enter only the end time (to save a few clicks). The program won't save the end time at all. So the end time would never show, unless I enter both end date and end time.
It's not a big problem. It might annoy some users, and it might create a condition for more errors. If we can improve it, that's always a bonus.
As mentioned previously, I have already removed that part that created the /2 problem, I just hope it doesn't cause other problem for removing it.
As far as I remember, all of them showed /2, no matter what category they are in. The event did show up, except with a different date from December, 1969. I wasn't even born yet
Thanks,
Sam
Then if I leave the end date blank and enter only the end time (to save a few clicks). The program won't save the end time at all. So the end time would never show, unless I enter both end date and end time.
It's not a big problem. It might annoy some users, and it might create a condition for more errors. If we can improve it, that's always a bonus.
As mentioned previously, I have already removed that part that created the /2 problem, I just hope it doesn't cause other problem for removing it.
As far as I remember, all of them showed /2, no matter what category they are in. The event did show up, except with a different date from December, 1969. I wasn't even born yet
Thanks,
Sam
14
22
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
k, i see what you mean about entering the date. i'll have a look at that and see what i can do. What happens now in saving the event is a check for an end date, if there is none, then no further checking for time is done. I should be able to separate that out.
and hmmm... i turned on url rewrite to check out the "/2" thing. the date range as well as the category is displayed that way. if it isn't showing a category, then 2 will correspond to the "upcoming" date range. if you choose to view the "past" date range, or the "this week" date range, then you'll see that number change accordingly. By itself it won't have an effect on the dates that are displayed. But removing it might have an effect on pagination, ie, where the second page displays the default date range rather than the selected date range.
I remember a bug or two dealing with the 1969 issue, but i thought i cleared all that up. Give me your basic event details and i'll reproduce that event and see what happens.
and hmmm... i turned on url rewrite to check out the "/2" thing. the date range as well as the category is displayed that way. if it isn't showing a category, then 2 will correspond to the "upcoming" date range. if you choose to view the "past" date range, or the "this week" date range, then you'll see that number change accordingly. By itself it won't have an effect on the dates that are displayed. But removing it might have an effect on pagination, ie, where the second page displays the default date range rather than the selected date range.
I remember a bug or two dealing with the 1969 issue, but i thought i cleared all that up. Give me your basic event details and i'll reproduce that event and see what happens.
22
22
Quote
Status: offline
samstone
Forum User
Full Member
Registered: 09/29/02
Posts: 820
My basic event is very simple. Except it is a recurring event.
Title: Men's Friday night AA group
Summery: Men's Friday night AA group meets in fellowship room.
No detail
set date to recur every Friday from 7 - 9 p.m.
The date shows correctly on the event list, and on the centerblock. The only difference is the center block link doesn't have /2, and event list has. If I click on the center block the event page shows the correct date, but the event list (with the /2) shows the event with 1969 date.
I don't understand that you said /2 is for pagination. So far I see there is no reason for an event (detail page) to have more than one page of detail.
BTW, I'm using MySQL 4.1.22. Don't have the courage to upgrade yet, worrying things might break. Could the MySQL version the cause? PHP, however, is 5.2.5.
Thanks,
Sam
Title: Men's Friday night AA group
Summery: Men's Friday night AA group meets in fellowship room.
No detail
set date to recur every Friday from 7 - 9 p.m.
The date shows correctly on the event list, and on the centerblock. The only difference is the center block link doesn't have /2, and event list has. If I click on the center block the event page shows the correct date, but the event list (with the /2) shows the event with 1969 date.
I don't understand that you said /2 is for pagination. So far I see there is no reason for an event (detail page) to have more than one page of detail.
BTW, I'm using MySQL 4.1.22. Don't have the courage to upgrade yet, worrying things might break. Could the MySQL version the cause? PHP, however, is 5.2.5.
Thanks,
Sam
24
20
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
the "/2" is not a problem and is functioning properly. It is meant to only be on the list page where you would paginate if you had enough events to list. Also, the "/2" is not the cause of the weird date. So far I'm not able to reproduce this oddity. Your mysql and php versions don't seem to be a problem.
before we go on let's check something... in your event list, for the event you described above, your event link should contain two timestamps before the /2. Is that right? it should be like: event.php/1234567890/1234567890/2 or something like that. The two large numbers correspond to $timestamp and $andrange, which you mentioned earlier you might have removed because you were trying to get rid of the /2. Put them back and your date should be fine.
The three variables are all necessary for links in the list to function properly, most especially to pass the proper date to event.php.
So, put the variables back how they were, then send me what the link looks like so i can test the numbers.
before we go on let's check something... in your event list, for the event you described above, your event link should contain two timestamps before the /2. Is that right? it should be like: event.php/1234567890/1234567890/2 or something like that. The two large numbers correspond to $timestamp and $andrange, which you mentioned earlier you might have removed because you were trying to get rid of the /2. Put them back and your date should be fine.
The three variables are all necessary for links in the list to function properly, most especially to pass the proper date to event.php.
So, put the variables back how they were, then send me what the link looks like so i can test the numbers.
20
20
Quote
Status: offline
samstone
Forum User
Full Member
Registered: 09/29/02
Posts: 820
Here is the url
http://localhost/evlist/event.php/20080212184138228/2
There is only one set of numbers, not like the way you described.
I can also simply add or remove the /2 from the address bar to produce the different date.
Thanks,
Sam
http://localhost/evlist/event.php/20080212184138228/2
There is only one set of numbers, not like the way you described.
I can also simply add or remove the /2 from the address bar to produce the different date.
Thanks,
Sam
14
21
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
yup, you're missing an entire variable. the date wont be calculated properly without the second variable. Either you've edited the file or your file is corrupt (index.php). Restore the original and your date issue should go away.
If you want i can send you my latest index.php. If so, shoot me an email.
If you want i can send you my latest index.php. If so, shoot me an email.
22
25
Quote
Status: offline
samstone
Forum User
Full Member
Registered: 09/29/02
Posts: 820
Now I see. In my attempt to add the start time (time_start1) in the event list, I happened to comment out the part that I shouldn't. I wasn't quite sure what I was doing though. Now it is corrected and displaying the way I wanted it.
Please check my index.php and see if there is any potential problem with the codes that I added (cut and paste from event.php). I marked the added codes as "Sam added."
// +-----------------------------------------------------------------------------+
// | evList A calendar solution for Geeklog |
// | Date: Aug, 2007 |
// +-----------------------------------------------------------------------------+
// | index.php |
// +-----------------------------------------------------------------------------+
// | Copyright (C) 2007 by: |
// | evList Plugin Author: |
// | Alford Deeley - ajdeeley@summitpages.ca |
// +-----------------------------------------------------------------------------+
// | Geeklog Common Code |
// | Copyright (C) 2000-2007 by the following authors: |
// | Authors: Tony Bibbs - tony@tonybibbs.com |
// | Mark Limburg - mlimburg@users.sourceforge.net |
// | Jason Whittenburg - jwhitten@securitygeeks.com |
// | Dirk Haun - dirk@haun-online.de |
// +-----------------------------------------------------------------------------+
// | |
// | This program is licensed under the terms of the GNU General Public License |
// | as published by the Free Software Foundation; either version 2 |
// | of the License, or (at your option) any later version. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
// | See the GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +-----------------------------------------------------------------------------+
require_once('../lib-common.php');
if (!function_exists('evlist_hit')){
//just refresh page to index
print COM_refresh($_CONF['site_url']);
exit;
}
if (DB_getItem($_TABLES['evlist_settings'], 'allow_anon_view') != '1' && $_USER['uid'] < 2) {
$display = COM_siteHeader ('menu', $LANG_EVLIST00[4]);
$display .= COM_startBlock ($LANG_EVLIST00[4], '',
COM_getBlockTemplate ('_msg_block', 'header'));
$display .= $LANG_EVLIST00[5];
$display .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
$display .= COM_siteFooter ();
COM_accessLog ("An anonymous user, {$_SERVER['REMOTE_ADDR']}, tried to illegally access the evList index page.");
echo $display;
exit;
}
function evlist_listevents($range = '', $category = '') {
global $_CONF, $_USER, $_TABLES, $LANG_EVLIST02, $LANG_EVLIST03;
$retval = '';
$t = new Template($_CONF['path'] . 'plugins/evlist/templates/');
$t->set_file('index', 'index.thtml');
$Sresult = DB_query("SELECT allow_anon_add, allow_user_add, allow_html, enable_categories FROM {$_TABLES['evlist_settings']}");
$S = DB_fetchArray($Sresult);
if (($_USER['uid'] < 2 && $S['allow_anon_add'] == '1') || ($_USER['uid'] > 1 && $S['allow_user_add'] == '1') || SEC_hasRights('evlist.edit')) {
$add_event_link = '<a href="' . $_CONF['site_url'] . '/evlist/event.php?op=new'
. '">' . $LANG_EVLIST02[17] . '</a>';
} else {
$add_event_link = '';
}
$t->set_var(array(
'action' => $_CONF['site_url'] . '/evlist/index.php',
'query_label' => $LANG_EVLIST02[10],
'range_options' => evlist_getRangeOptions($range),
'go' => $LANG_EVLIST02[16],
'add_event_link' => $add_event_link
));
if ($S['enable_categories'] == '1') {
if (DB_count($_TABLES['evlist_categories'], 'status', '1') >= 1) {
$t->set_file('category_form', 'category_dd.thtml');
$t->set_var(array(
'category_label' => $LANG_EVLIST03[22],
'category_options' => evlist_getCategoryOptions($category)
));
$t->parse ('category_dd','category_form');
}
}
$result = evlist_events_query($range, '', $category);
if (empty($result)) {
//return empty list msg
$t->set_var('empty_listmsg', $LANG_EVLIST02[1]);
} else {
//populate list
$t->set_file(array(
'item' => 'list_item.thtml',
'editlinks' => 'edit_links.thtml',
'category_form' => 'category_dd.thtml'
));
if (!empty($range)) {
$andrange = '&range=' . $range;
} else $andrange = '&range=2';
if (!empty($category)) {
$andcat = '&cat=' . $category;
} else $andcat = '';
while ($A = DB_fetchArray($result)) {
if ($A['recurring'] == '1') {
//are we displaying a recurrence?
//if so add a timestamp to the appropriate urls.
$timestamp = "&ts=" . strtotime($A['date_start1']);
} else $timestamp = '&ts=0';
$titlelink = COM_buildURL($_CONF['site_url'] . '/evlist/event.php?eid=' . $A['id'] . $timestamp . $andrange . $andcat);
$titlelink = '<a href="' . $titlelink . '">' . COM_stripslashes($A['title']) . '</a>';
$summary = PLG_replaceTags(COM_stripslashes($A['summary']));
$datesummary = sprintf($LANG_EVLIST02[3], evlist_displayFormatedDate(strtotime($A['date_start1'])));
$morelink = COM_buildURL($_CONF['site_url'] . '/evlist/event.php?eid=' . $A['id'] . $timestamp . $andrange . $andcat);
$morelink = '<a href="' . $morelink . '">' . $LANG_EVLIST02[4] . '</a>';
$contactlink = $_CONF['site_url'] . '/profiles.php?uid=' . $A['owner_id'];
$contactlink = '<a href="' . $contactlink . '">' . $LANG_EVLIST02[5] . '</a>';
// Sam added for showing start datetime
# check for $timestamp here and supply the appropriate dates.
# timestamp represents the interval between the original and the new start date.
# you are viewing a recurrence of an event so dates will not be as original.
# add the diff between date_start1 and timestamp to the other dates
if (!empty($timestamp)) {
$timediff = $timestamp - strtotime($A['date_start1']);
$A['date_start1'] = evlist_displayFormatedDate($timestamp);
$A['date_end1'] = (!empty($A['date_end1']) && $A['date_end1'] != '0000-00-00') ? evlist_displayFormatedDate(strtotime($A['date_end1']) + $timediff) : '';
$A['date_start2'] = (!empty($A['date_start2']) && $A['date_start2'] != '0000-00-00') ? evlist_displayFormatedDate(strtotime($A['date_start2']) + $timediff) : '';
$A['date_end2'] = (!empty($A['date_end2']) && $A['date_end2'] != '0000-00-00') ? evlist_displayFormatedDate(strtotime($A['date_end2']) + $timediff) : '';
} else {
$A['date_start1'] = evlist_displayFormatedDate(strtotime($A['date_start1']));
$A['date_end1'] = (!empty($A['date_end1']) && $A['date_end1'] != '0000-00-00') ? evlist_displayFormatedDate(strtotime($A['date_end1'])) : '';
$A['date_start2'] = (!empty($A['date_start2']) && $A['date_start2'] != '0000-00-00') ? evlist_displayFormatedDate(strtotime($A['date_start2'])) : '';
$A['date_end2'] = (!empty($A['date_end2']) && $A['date_end2'] != '0000-00-00') ? evlist_displayFormatedDate(strtotime($A['date_end2'])) : '';
}
if (!empty($A['date_start1']) && $A['date_start1'] != '0000-00-00') {
//$datestart1 = evlist_displayFormatedDate(strtotime($A['date_start1']));
$datestart1 = $LANG_EVLIST03[3] . $A['date_start1'];
if (!empty($A['time_start1'])) {
$timestart1 = ', ' . evlist_displayFormatedTime(strtotime($A['time_start1']));
} else {
$timestart1 = '';
}
if ($A['allday'] == '1') {
$allday = '<br />' . $LANG_EVLIST03[14];
} else {
$allday = '';
}
if ($A['recurring'] == '1') {
$every = array(1 => $LANG_EVLIST03[17], 2 => $LANG_EVLIST03[18],
3 => $LANG_EVLIST03[19], 4 => $LANG_EVLIST03[20], 5 => $LANG_EVLIST03[18]);
switch ($A['rec_option']) {
case 1:
case 2:
case 3:
case 5:
$recurring = '<br />' . sprintf($LANG_EVLIST03[15], $every[$A['rec_option']]);
break;
case 4:
$weekstart = $S['week_begins'];//DB_getItem($_TABLES['evlist_settings'], 'week_begins');
if ($weekstart == 1) {
$weekdaysA = array(1 => $LANG_EVLIST12[1]);
} else {
$weekdaysA = array(0 => $LANG_EVLIST12[1]);
}
array_push($weekdaysA, $LANG_EVLIST12[2], $LANG_EVLIST12[3], $LANG_EVLIST12[4],
$LANG_EVLIST12[5], $LANG_EVLIST12[6], $LANG_EVLIST12[7]);
$daynumsA = explode(";", $A['rec_data']);
$daynumsA = explode(",", $daynumsA[0]);
$daycount = count($daynumsA);
$weekdays = '';
for ($i = 0; $i < $daycount; $i++) {
if (!empty($daynumsA[$i])) {
if ($i == $daycount - 1) {
if ($daycount > 0 ) {
$weekdays .= $LANG_EVLIST03[21];
}
$weekdays .= $weekdaysA[$daynumsA[$i]];
} else {
$weekdays .= $weekdaysA[$daynumsA[$i]] . ', ';
}
}
}
$recurring = '<br />' . sprintf($LANG_EVLIST03[15], sprintf($every[$A['rec_option']], $weekdays));
break;
#case 6:
# $recurring = '<br />' . sprintf();
# break;
}
} else {
$recurring = '';
}
} else {
//of course this should never happen cuz ds1 is now required
$datestart1 = '';
}
if (!empty($A['date_end1']) && $A['date_end1'] != '0000-00-00') {
//$dateend1 = evlist_displayFormatedDate(strtotime($A['date_end1']));
$dateend1 = '<br />' . $LANG_EVLIST03[4] . $A['date_end1'];
if (!empty($A['time_end1'])) {
$timeend1 = ', ' . evlist_displayFormatedTime(strtotime($A['time_end1']));
} else {
$timeend1 = '';
}
} else {
$dateend1 = '';
}
if (!empty($A['date_start2']) && $A['date_start2'] != '0000-00-00') {
//$datestart2 = evlist_displayFormatedDate(strtotime($A['date_start2']));
$datestart2 = '<br />' . $LANG_EVLIST03[3] . $A['date_start2'];
if (!empty($A['time_start2'])) {
$timestart2 = ', ' . evlist_displayFormatedTime(strtotime($A['time_start2']));
} else {
$timestart2 = '';
}
} else {
$datestart2 = '';
}
if (!empty($A['date_end2']) && $A['date_end2'] != '0000-00-00') {
//$dateend2 = evlist_displayFormatedDate(strtotime($A['date_end2']));
$dateend2 = '<br />' . $LANG_EVLIST03[4] . $A['date_end2'];
if (!empty($A['time_end2'])) {
$timeend2 = ', ' . evlist_displayFormatedTime(strtotime($A['time_end2']));
} else {
$timeend2 = '';
}
} else {
$dateend2 = '';
}
// End Sam added
$t->set_var(array(
'title' => $titlelink,
'date_summary' => $datesummary,
'summary' => $summary,
'more_link' => $morelink,
'contact_link' => $contactlink,
// Sam added
'time_start1' => $timestart1,
'time_start2' => $timestart2,
// End Sam added
));
//display delete and edit links
if (SEC_hasRights('evlist.edit')) {
$editlink = $_CONF['site_url'] . '/evlist/event.php?eid=' . $A['id'] . '&op=edit';
$editlink = '<a href="' . $editlink . '">' . $LANG_EVLIST03[8] . '</a>';
$t->set_var('edit_link', $editlink);
$deletelink = $_CONF['site_url'] . '/evlist/event.php?eid=' . $A['id'] . '&op=del';
$deletelink = '<a href="' . $deletelink . '">' . $LANG_EVLIST03[9] . '</a>';
$t->set_var('delete_link', $deletelink);
$t->parse('edit_links', 'editlinks');
}
$t->parse ('event_item','item', true);
}
}
$t->parse ('output', 'index');
$retval .= $t->finish($t->get_var('output'));
return $retval;
}
/*
* Main Function
*/
COM_setArgNames(array('op','range','cat'));
$op = COM_applyFilter(COM_getArgument('op'));
$range = COM_applyFilter(COM_getArgument('range'),true);
$category = COM_applyFilter(COM_getArgument('cat'),true);
if (!empty($category)) {
$catname = DB_getItem($_TABLES['evlist_categories'], 'name', "id = '$category'");
}
#if (!empty($_REQUEST['op'])) {
# $op = COM_applyFilter($_REQUEST['op'], true);
#} else $op = '';
#if (!empty($_REQUEST['range'])) {
# $range = COM_applyFilter($_REQUEST['range'], true);
#} else $range = '';
#if (!empty($_REQUEST['cat'])) {
# $category = COM_applyFilter($_REQUEST['cat'], true);
# $catname = DB_getItem($_TABLES['evlist_categories'], 'name', "id = '$category'");
#} else $category = '';
if (!empty($_REQUEST['msg'])) {
$msg = COM_applyFilter($_REQUEST['msg'], true);
} else $msg = '';
// Sam changed the following line
// $display = COM_siteHeader();
$display = COM_siteHeader('menu', $LANG_EVLIST00[2]);
if (!empty($msg)) {
//msg block
$display .= COM_startBlock('','','blockheader-message.thtml');
$display .= $LANG_EVLIST07[$msg];
$display .= COM_endBlock('blockfooter-message.thtml');
}
if ($range == '1') { // past events
$block_title = $LANG_EVLIST02[8];
if (!empty($category)) {
$block_title .= ' / ' . $LANG_EVLIST02[15] . ': ' . $catname;
}
} elseif ($range == '2') { // upcoming events
$block_title = $LANG_EVLIST02[9];
if (!empty($category)) {
$block_title .= ' / ' . $LANG_EVLIST02[15] . ': ' . $catname;
}
} elseif ($range == '3') { // next 7 days
$block_title = $LANG_EVLIST02[11];
if (!empty($category)) {
$block_title .= ' / ' . $LANG_EVLIST02[15] . ': ' . $catname;
}
} elseif ($range == '4') { // next 1 month
$block_title = $LANG_EVLIST02[12];
if (!empty($category)) {
$block_title .= ' / ' . $LANG_EVLIST02[15] . ': ' . $catname;
}
} else { // upcoming events
$block_title = $LANG_EVLIST02[2];
if (!empty($category)) {
$block_title .= ' / ' . $LANG_EVLIST02[15] . ': ' . $catname;
}
}
$display .= COM_startBlock($block_title);
//more ops to come later if needed
if ($op == 'list') {
$display .= evlist_listevents($range, $category);
} else {
//default
$display .= evlist_listevents($range, $category);
}
$display .= evlist_pagenav($range, $category);
$display .= COM_endBlock();
$display .= COM_siteFooter(true);
echo $display;
?>
Using this added coded, I added {time_start1}{time_start2} to the list_item.thtml.
BTW, I also don't really understand the logic of time_start2
Thanks,
Sam
Please check my index.php and see if there is any potential problem with the codes that I added (cut and paste from event.php). I marked the added codes as "Sam added."
Text Formatted Code
<?php// +-----------------------------------------------------------------------------+
// | evList A calendar solution for Geeklog |
// | Date: Aug, 2007 |
// +-----------------------------------------------------------------------------+
// | index.php |
// +-----------------------------------------------------------------------------+
// | Copyright (C) 2007 by: |
// | evList Plugin Author: |
// | Alford Deeley - ajdeeley@summitpages.ca |
// +-----------------------------------------------------------------------------+
// | Geeklog Common Code |
// | Copyright (C) 2000-2007 by the following authors: |
// | Authors: Tony Bibbs - tony@tonybibbs.com |
// | Mark Limburg - mlimburg@users.sourceforge.net |
// | Jason Whittenburg - jwhitten@securitygeeks.com |
// | Dirk Haun - dirk@haun-online.de |
// +-----------------------------------------------------------------------------+
// | |
// | This program is licensed under the terms of the GNU General Public License |
// | as published by the Free Software Foundation; either version 2 |
// | of the License, or (at your option) any later version. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
// | See the GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software Foundation, |
// | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
// | |
// +-----------------------------------------------------------------------------+
require_once('../lib-common.php');
if (!function_exists('evlist_hit')){
//just refresh page to index
print COM_refresh($_CONF['site_url']);
exit;
}
if (DB_getItem($_TABLES['evlist_settings'], 'allow_anon_view') != '1' && $_USER['uid'] < 2) {
$display = COM_siteHeader ('menu', $LANG_EVLIST00[4]);
$display .= COM_startBlock ($LANG_EVLIST00[4], '',
COM_getBlockTemplate ('_msg_block', 'header'));
$display .= $LANG_EVLIST00[5];
$display .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
$display .= COM_siteFooter ();
COM_accessLog ("An anonymous user, {$_SERVER['REMOTE_ADDR']}, tried to illegally access the evList index page.");
echo $display;
exit;
}
function evlist_listevents($range = '', $category = '') {
global $_CONF, $_USER, $_TABLES, $LANG_EVLIST02, $LANG_EVLIST03;
$retval = '';
$t = new Template($_CONF['path'] . 'plugins/evlist/templates/');
$t->set_file('index', 'index.thtml');
$Sresult = DB_query("SELECT allow_anon_add, allow_user_add, allow_html, enable_categories FROM {$_TABLES['evlist_settings']}");
$S = DB_fetchArray($Sresult);
if (($_USER['uid'] < 2 && $S['allow_anon_add'] == '1') || ($_USER['uid'] > 1 && $S['allow_user_add'] == '1') || SEC_hasRights('evlist.edit')) {
$add_event_link = '<a href="' . $_CONF['site_url'] . '/evlist/event.php?op=new'
. '">' . $LANG_EVLIST02[17] . '</a>';
} else {
$add_event_link = '';
}
$t->set_var(array(
'action' => $_CONF['site_url'] . '/evlist/index.php',
'query_label' => $LANG_EVLIST02[10],
'range_options' => evlist_getRangeOptions($range),
'go' => $LANG_EVLIST02[16],
'add_event_link' => $add_event_link
));
if ($S['enable_categories'] == '1') {
if (DB_count($_TABLES['evlist_categories'], 'status', '1') >= 1) {
$t->set_file('category_form', 'category_dd.thtml');
$t->set_var(array(
'category_label' => $LANG_EVLIST03[22],
'category_options' => evlist_getCategoryOptions($category)
));
$t->parse ('category_dd','category_form');
}
}
$result = evlist_events_query($range, '', $category);
if (empty($result)) {
//return empty list msg
$t->set_var('empty_listmsg', $LANG_EVLIST02[1]);
} else {
//populate list
$t->set_file(array(
'item' => 'list_item.thtml',
'editlinks' => 'edit_links.thtml',
'category_form' => 'category_dd.thtml'
));
if (!empty($range)) {
$andrange = '&range=' . $range;
} else $andrange = '&range=2';
if (!empty($category)) {
$andcat = '&cat=' . $category;
} else $andcat = '';
while ($A = DB_fetchArray($result)) {
if ($A['recurring'] == '1') {
//are we displaying a recurrence?
//if so add a timestamp to the appropriate urls.
$timestamp = "&ts=" . strtotime($A['date_start1']);
} else $timestamp = '&ts=0';
$titlelink = COM_buildURL($_CONF['site_url'] . '/evlist/event.php?eid=' . $A['id'] . $timestamp . $andrange . $andcat);
$titlelink = '<a href="' . $titlelink . '">' . COM_stripslashes($A['title']) . '</a>';
$summary = PLG_replaceTags(COM_stripslashes($A['summary']));
$datesummary = sprintf($LANG_EVLIST02[3], evlist_displayFormatedDate(strtotime($A['date_start1'])));
$morelink = COM_buildURL($_CONF['site_url'] . '/evlist/event.php?eid=' . $A['id'] . $timestamp . $andrange . $andcat);
$morelink = '<a href="' . $morelink . '">' . $LANG_EVLIST02[4] . '</a>';
$contactlink = $_CONF['site_url'] . '/profiles.php?uid=' . $A['owner_id'];
$contactlink = '<a href="' . $contactlink . '">' . $LANG_EVLIST02[5] . '</a>';
// Sam added for showing start datetime
# check for $timestamp here and supply the appropriate dates.
# timestamp represents the interval between the original and the new start date.
# you are viewing a recurrence of an event so dates will not be as original.
# add the diff between date_start1 and timestamp to the other dates
if (!empty($timestamp)) {
$timediff = $timestamp - strtotime($A['date_start1']);
$A['date_start1'] = evlist_displayFormatedDate($timestamp);
$A['date_end1'] = (!empty($A['date_end1']) && $A['date_end1'] != '0000-00-00') ? evlist_displayFormatedDate(strtotime($A['date_end1']) + $timediff) : '';
$A['date_start2'] = (!empty($A['date_start2']) && $A['date_start2'] != '0000-00-00') ? evlist_displayFormatedDate(strtotime($A['date_start2']) + $timediff) : '';
$A['date_end2'] = (!empty($A['date_end2']) && $A['date_end2'] != '0000-00-00') ? evlist_displayFormatedDate(strtotime($A['date_end2']) + $timediff) : '';
} else {
$A['date_start1'] = evlist_displayFormatedDate(strtotime($A['date_start1']));
$A['date_end1'] = (!empty($A['date_end1']) && $A['date_end1'] != '0000-00-00') ? evlist_displayFormatedDate(strtotime($A['date_end1'])) : '';
$A['date_start2'] = (!empty($A['date_start2']) && $A['date_start2'] != '0000-00-00') ? evlist_displayFormatedDate(strtotime($A['date_start2'])) : '';
$A['date_end2'] = (!empty($A['date_end2']) && $A['date_end2'] != '0000-00-00') ? evlist_displayFormatedDate(strtotime($A['date_end2'])) : '';
}
if (!empty($A['date_start1']) && $A['date_start1'] != '0000-00-00') {
//$datestart1 = evlist_displayFormatedDate(strtotime($A['date_start1']));
$datestart1 = $LANG_EVLIST03[3] . $A['date_start1'];
if (!empty($A['time_start1'])) {
$timestart1 = ', ' . evlist_displayFormatedTime(strtotime($A['time_start1']));
} else {
$timestart1 = '';
}
if ($A['allday'] == '1') {
$allday = '<br />' . $LANG_EVLIST03[14];
} else {
$allday = '';
}
if ($A['recurring'] == '1') {
$every = array(1 => $LANG_EVLIST03[17], 2 => $LANG_EVLIST03[18],
3 => $LANG_EVLIST03[19], 4 => $LANG_EVLIST03[20], 5 => $LANG_EVLIST03[18]);
switch ($A['rec_option']) {
case 1:
case 2:
case 3:
case 5:
$recurring = '<br />' . sprintf($LANG_EVLIST03[15], $every[$A['rec_option']]);
break;
case 4:
$weekstart = $S['week_begins'];//DB_getItem($_TABLES['evlist_settings'], 'week_begins');
if ($weekstart == 1) {
$weekdaysA = array(1 => $LANG_EVLIST12[1]);
} else {
$weekdaysA = array(0 => $LANG_EVLIST12[1]);
}
array_push($weekdaysA, $LANG_EVLIST12[2], $LANG_EVLIST12[3], $LANG_EVLIST12[4],
$LANG_EVLIST12[5], $LANG_EVLIST12[6], $LANG_EVLIST12[7]);
$daynumsA = explode(";", $A['rec_data']);
$daynumsA = explode(",", $daynumsA[0]);
$daycount = count($daynumsA);
$weekdays = '';
for ($i = 0; $i < $daycount; $i++) {
if (!empty($daynumsA[$i])) {
if ($i == $daycount - 1) {
if ($daycount > 0 ) {
$weekdays .= $LANG_EVLIST03[21];
}
$weekdays .= $weekdaysA[$daynumsA[$i]];
} else {
$weekdays .= $weekdaysA[$daynumsA[$i]] . ', ';
}
}
}
$recurring = '<br />' . sprintf($LANG_EVLIST03[15], sprintf($every[$A['rec_option']], $weekdays));
break;
#case 6:
# $recurring = '<br />' . sprintf();
# break;
}
} else {
$recurring = '';
}
} else {
//of course this should never happen cuz ds1 is now required
$datestart1 = '';
}
if (!empty($A['date_end1']) && $A['date_end1'] != '0000-00-00') {
//$dateend1 = evlist_displayFormatedDate(strtotime($A['date_end1']));
$dateend1 = '<br />' . $LANG_EVLIST03[4] . $A['date_end1'];
if (!empty($A['time_end1'])) {
$timeend1 = ', ' . evlist_displayFormatedTime(strtotime($A['time_end1']));
} else {
$timeend1 = '';
}
} else {
$dateend1 = '';
}
if (!empty($A['date_start2']) && $A['date_start2'] != '0000-00-00') {
//$datestart2 = evlist_displayFormatedDate(strtotime($A['date_start2']));
$datestart2 = '<br />' . $LANG_EVLIST03[3] . $A['date_start2'];
if (!empty($A['time_start2'])) {
$timestart2 = ', ' . evlist_displayFormatedTime(strtotime($A['time_start2']));
} else {
$timestart2 = '';
}
} else {
$datestart2 = '';
}
if (!empty($A['date_end2']) && $A['date_end2'] != '0000-00-00') {
//$dateend2 = evlist_displayFormatedDate(strtotime($A['date_end2']));
$dateend2 = '<br />' . $LANG_EVLIST03[4] . $A['date_end2'];
if (!empty($A['time_end2'])) {
$timeend2 = ', ' . evlist_displayFormatedTime(strtotime($A['time_end2']));
} else {
$timeend2 = '';
}
} else {
$dateend2 = '';
}
// End Sam added
$t->set_var(array(
'title' => $titlelink,
'date_summary' => $datesummary,
'summary' => $summary,
'more_link' => $morelink,
'contact_link' => $contactlink,
// Sam added
'time_start1' => $timestart1,
'time_start2' => $timestart2,
// End Sam added
));
//display delete and edit links
if (SEC_hasRights('evlist.edit')) {
$editlink = $_CONF['site_url'] . '/evlist/event.php?eid=' . $A['id'] . '&op=edit';
$editlink = '<a href="' . $editlink . '">' . $LANG_EVLIST03[8] . '</a>';
$t->set_var('edit_link', $editlink);
$deletelink = $_CONF['site_url'] . '/evlist/event.php?eid=' . $A['id'] . '&op=del';
$deletelink = '<a href="' . $deletelink . '">' . $LANG_EVLIST03[9] . '</a>';
$t->set_var('delete_link', $deletelink);
$t->parse('edit_links', 'editlinks');
}
$t->parse ('event_item','item', true);
}
}
$t->parse ('output', 'index');
$retval .= $t->finish($t->get_var('output'));
return $retval;
}
/*
* Main Function
*/
COM_setArgNames(array('op','range','cat'));
$op = COM_applyFilter(COM_getArgument('op'));
$range = COM_applyFilter(COM_getArgument('range'),true);
$category = COM_applyFilter(COM_getArgument('cat'),true);
if (!empty($category)) {
$catname = DB_getItem($_TABLES['evlist_categories'], 'name', "id = '$category'");
}
#if (!empty($_REQUEST['op'])) {
# $op = COM_applyFilter($_REQUEST['op'], true);
#} else $op = '';
#if (!empty($_REQUEST['range'])) {
# $range = COM_applyFilter($_REQUEST['range'], true);
#} else $range = '';
#if (!empty($_REQUEST['cat'])) {
# $category = COM_applyFilter($_REQUEST['cat'], true);
# $catname = DB_getItem($_TABLES['evlist_categories'], 'name', "id = '$category'");
#} else $category = '';
if (!empty($_REQUEST['msg'])) {
$msg = COM_applyFilter($_REQUEST['msg'], true);
} else $msg = '';
// Sam changed the following line
// $display = COM_siteHeader();
$display = COM_siteHeader('menu', $LANG_EVLIST00[2]);
if (!empty($msg)) {
//msg block
$display .= COM_startBlock('','','blockheader-message.thtml');
$display .= $LANG_EVLIST07[$msg];
$display .= COM_endBlock('blockfooter-message.thtml');
}
if ($range == '1') { // past events
$block_title = $LANG_EVLIST02[8];
if (!empty($category)) {
$block_title .= ' / ' . $LANG_EVLIST02[15] . ': ' . $catname;
}
} elseif ($range == '2') { // upcoming events
$block_title = $LANG_EVLIST02[9];
if (!empty($category)) {
$block_title .= ' / ' . $LANG_EVLIST02[15] . ': ' . $catname;
}
} elseif ($range == '3') { // next 7 days
$block_title = $LANG_EVLIST02[11];
if (!empty($category)) {
$block_title .= ' / ' . $LANG_EVLIST02[15] . ': ' . $catname;
}
} elseif ($range == '4') { // next 1 month
$block_title = $LANG_EVLIST02[12];
if (!empty($category)) {
$block_title .= ' / ' . $LANG_EVLIST02[15] . ': ' . $catname;
}
} else { // upcoming events
$block_title = $LANG_EVLIST02[2];
if (!empty($category)) {
$block_title .= ' / ' . $LANG_EVLIST02[15] . ': ' . $catname;
}
}
$display .= COM_startBlock($block_title);
//more ops to come later if needed
if ($op == 'list') {
$display .= evlist_listevents($range, $category);
} else {
//default
$display .= evlist_listevents($range, $category);
}
$display .= evlist_pagenav($range, $category);
$display .= COM_endBlock();
$display .= COM_siteFooter(true);
echo $display;
?>
Using this added coded, I added {time_start1}{time_start2} to the list_item.thtml.
BTW, I also don't really understand the logic of time_start2
Thanks,
Sam
22
18
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
The code seems ok.. It's seems to be copy and paste from event.php. I don't think that'll cause any difficulties.
Time_start2 deals with a different type of event. It deals with split events where there are two start times.
Glad it's all working!
Time_start2 deals with a different type of event. It deals with split events where there are two start times.
Glad it's all working!
24
15
Quote
Status: offline
samstone
Forum User
Full Member
Registered: 09/29/02
Posts: 820
The plugin is running well so far. Now I see it can go another level - to use Geeklog's multilingual feature.
I think it can be separated at categories, but having categories assignable to different languages and display only the events from categories related to the current language.
Any thoughts?
Thanks,
Sam
I think it can be separated at categories, but having categories assignable to different languages and display only the events from categories related to the current language.
Any thoughts?
Thanks,
Sam
20
18
Quote
Status: Banned
machinari
Forum User
Full Member
Registered: 03/22/04
Posts: 1512
an interesting idea. however, I won't be able to think about it until mid-april or so. Feel free to inject your ideas into the code. or shoot me an email with a more specific example of what it will look like.
17
24
Quote
Page navigation
All times are EST. The time is now 03:20 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content