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

2

Comments

  • @Wanderer: Hmmm, strange... This setting *does* seem to work in my configuration. I've replaced all instances of "Gig Calendar" with "Events", so the code in my installation now looks like this:

    $Panel->AddList('Events', 90);

    Note the "90" - I've played around with it, so that it now appears where I want it to.
  • The extension does not work with the new extension update-checker in version 1.1.x. Checking the default.php file, I see that the extension there is named differently from the entry in the add-ons site, and that the version in the file (1.0) is also incorrect (in the add-ons repository it states that this - the current - version is 1.1).

    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); } ?>
  • You're an absolute star, thanks icouto! I've updated the php files accordingly.
  • Uploaded version 1.2 of Countdown Calendar.
  • i have installed this extension and enable the calendar from my account page but its not showing.
  • Do you have a future date in the .txt file?

    Once the dates pass, nothing is displayed.

    Posted: Thursday, 22 March 2007 at 10:26AM (AEDT)

  • ok i understand and it works now but i found a bug . this mod conflicts with preview mod. when try to preview it says
    "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
  • See this: Countdown Calendar # 10

    Posted: Thursday, 22 March 2007 at 11:09AM (AEDT)

  • @blizeh: I noticed that I was getting the same error reported by abramelin when previewing a post. I followed the link placed above by Wanderer, and corrected line 26 of default.php. It corrects the problem. To make it easier for you:

    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');
  • I'm getting an "Undefined offset" on line 31 on default.php error when I install the extension.

    Any ideas?
  • You sure you've populated the cal.txt file correctly?
  • blizeHblizeH ✭✭
    Can anyone please recommend me a tutorial to either:
    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 )
  • You cant really edit the text file per se, what you need to do is read it into an array/variable while editing the necessary parts as you go along, then overwrite that variable content back to the file.
  • getting this:

    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?
  • Does the code above this look like?
    $fp = fopen($Configuration['APPLICATION_PATH'].'/extensions/Gigs/cal.txt', 'rb'); // Reads the text file if(!$fp) return; while ($row = fgetcsv($fp, 1000)) {
  • no...

    $fp = fopen('extensions/Calendar/cal.txt', 'rb'); // Reads the text file
    if(!$fp) return;

    while ($row = fgetcsv($fp, 1000))
    {
  • I have an original version but the code is doing the same thing. What does your cal.txt file look like?
  • "Event Title", MM/DD/YY 24:00, "Venue, Location", "http://www.eventurl.com/"

    "Sadie Hawkins Day Race/Dance", 11/10/07 24:00, "Chicago, IL", " http://www.myspace.com/sadiedayrace "
  • Each item should be separated with a comma. There is no need for quotation marks. This is what mine looks like:

    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/
  • THANK YOU!!
This discussion has been closed.