Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Countdown Calendar
This discussion has been closed.
Comments
$Panel->AddList('Events', 90);
Note the "90" - I've played around with it, so that it now appears where I want it to.
So, although I'm not the original author, I've renamed everything, and added a couple of corrections, as specified in this discussion, and here is my own version of 'default.php', which seems to work just fine. Perhaps the author could update it for us in the add-ons repository, if everyone else checks that this works without too much problem in their own systems:
<?php /* Extension Name: Countdown Calendar Extension Url: http://lussumo.com/community/discussion/3446/ Description: Shows upcoming gigs Version: 1.1 Author: Nick Drew Author Url: http://www.glosunit.co.uk Comments: Huge thanks to SirNot, jimw, and Minisweeper for making this possible. */ $Context->Configuration['PREFERENCE_CalendarEnabled'] = 1; $Context->Dictionary['EnableCalendar'] = 'Enable the countdown calendar?'; $Context->AddToDelegate('PreferencesForm', 'Constructor', 'CountdownCalendar_Preferences'); function CountdownCalendar_Preferences(&$Prefs) { if($Prefs->IsPostBack) $Prefs->AddPreference('Calendar', 'EnableCalendar', 'CalendarEnabled'); } if($Context->Session->User->Preference('CalendarEnabled') && isset($Head)) { if(!isset($Panel)) return; $Panel->AddList('Countdown Calendar', 90); $fp = fopen('extensions/Calendar/cal.txt', 'rb'); // Reads the text file if(!$fp) return; while ($row = fgetcsv($fp, 1000)) { list($title, $date, $venue, $url) = $row; list($month, $day, $year, $hour, $minute, $second ) = sscanf($date, "%d/%d/%d %d:%d:%d"); $curdate = mktime( $hour, $minute, $second, $month, $day, $year ); $curdate = ($curdate - 54000); $diff = $curdate - time(); // the number of hours if ($diff >= 2592000) // Checks if the time difference is more than a month (roughly translated as 30 days) { $diff = $diff / 2592000; $diff = round($diff); if ($diff < 2) // if there's only one month left, will remove the 's' after month, got to be grammatically correct eh? $Panel->AddListItem('Countdown Calendar', ''.$title.'<br /><font color="#999999"><i>at ' .$venue .'<br />1 month left</i></font>', $url); else $Panel->AddListItem('Countdown Calendar', ''.$title.'<br><font color="#999999"><i>at '.$venue .'<br />'.$diff.' months left</i></font>', $url); } else if ($diff >= 86400 and $diff < 2592000) // Checks if the time difference is more than a day { $diff = $diff / 86400; $diff = round($diff); if ($diff < 2) // if there's only one day left, will remove the 's' after day $Panel->AddListItem('Countdown Calendar', ''.$title.'<br /><font color="#999999"><i>at ' .$venue .'<br />1 day left</i></font>', $url); else $Panel->AddListItem('Countdown Calendar', ''.$title.'<br /><font color="#999999"><i>at ' .$venue .'<br />'.$diff.' days left</i></font>', $url); } else if ($diff > 0 and $diff < 86400 ) // Checks if the time difference is less than a day { $diff = $diff / 3600; $diff = round($diff); if ($diff < 2) // if there's only one hour left, will remove the 's' after hour $Panel->AddListItem('Countdown Calendar', ''.$title.'<br /><font color="#999999"><i>at ' .$venue .'<br />1 hour left</i></font>', $url); else $Panel->AddListItem('Countdown Calendar', ''.$title.'<br /><font color="#999999"><i>at' .$venue .'<br />'.$diff.' hours left</i></font>', $url); } } fclose($fp); } ?>
Once the dates pass, nothing is displayed.
Posted: Thursday, 22 March 2007 at 10:26AM (AEDT)
"Warning: fopen(extensions/Calendar/cal.txt) [function.fopen]: failed to open stream: No such file or directory in /home/hebele/public_html/hebel/extensions/Calendar/default.php on line 26
fsfdfs"
the "fsfdfs" part is my comment text
Posted: Thursday, 22 March 2007 at 11:09AM (AEDT)
Line 26 right now is:
$fp = fopen('extensions/Calendar/cal.txt', 'rb');
It should be changed to:
$fp = fopen($Configuration['APPLICATION_PATH'].'extensions/Calendar/cal.txt', 'rb');
Any ideas?
a) Let me completely edit the .txt file through PHP
b) Let me add separate fields through the csv stuff, delete rows and edit rows
Thanks
( fwiw, yeah I've been looking on Google for ages and for some reason can't find anything useful )
Notice: Undefined offset: 1 in /home/.latoya/leisurep/chicagofixedgear.com/extensions/Calendar/default.php on line 31
the line looks like
list($title, $date, $venue, $url) = $row;
any ideas on how to fix this?
$fp = fopen($Configuration['APPLICATION_PATH'].'/extensions/Gigs/cal.txt', 'rb'); // Reads the text file if(!$fp) return; while ($row = fgetcsv($fp, 1000)) {
$fp = fopen('extensions/Calendar/cal.txt', 'rb'); // Reads the text file
if(!$fp) return;
while ($row = fgetcsv($fp, 1000))
{
"Sadie Hawkins Day Race/Dance", 11/10/07 24:00, "Chicago, IL", " http://www.myspace.com/sadiedayrace "
Lions Club MS Office Class (8-Tuesdays),9/25/07,Springfield High School Room 276,http://www.domain.us/
Lions Club Web Class (3-Thursdays),10/4/07,Springfield High School Room 276,http://www.domain.us/
Lions Club eBay Class (4-Wednesdays),11/7/07,Springfield High School Room 276,http://www.domain.us/