Skip to content

Commit

Permalink
Merge tractorcow changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Uncle Cheese committed May 15, 2013
2 parents 6935e50 + f8587ce commit 89d6715
Show file tree
Hide file tree
Showing 17 changed files with 103 additions and 410 deletions.
4 changes: 1 addition & 3 deletions code/CachedCalendarBuildTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ class CachedCalendarBuildTask extends BuildTask {

protected $title = "Cache the Event Calendars";


protected $description = 'Generates a given number of years of events and populates a readonly table with all the event information. Useful when using recurring events or multiple calendars.';


public function run($request) {
CachedCalendarTask::create()->process();
}

}
}
25 changes: 4 additions & 21 deletions code/CachedCalendarEntry.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
<?php


class CachedCalendarEntry extends DataObject {



static $db = array (
private static $db = array (
'StartDate' => 'Date',
'StartTime' => 'Time',
'EndDate' => 'Date',
Expand All @@ -18,30 +15,21 @@ class CachedCalendarEntry extends DataObject {
'Title' => 'Varchar(255)',
'Content' => 'HTMLText'
);


static $has_one = array (
private static $has_one = array (
'CachedCalendar' => 'Calendar',
'Calendar' => 'Calendar',
'Event' => 'CalendarEvent'
);



static $default_sort = "StartDate ASC, StartTime ASC";




private static $default_sort = "StartDate ASC, StartTime ASC";

public static function create_from_datetime(CalendarDateTime $dt, Calendar $calendar) {
$cached = CachedCalendarEntry::create();
$cached->hydrate($dt, $calendar);
return $cached;
}



public static function create_from_announcement(CalendarAnnouncement $dt, Calendar $calendar) {
$cached = CachedCalendarEntry::create();
$cached->hydrate($dt, $calendar);
Expand All @@ -50,9 +38,6 @@ public static function create_from_announcement(CalendarAnnouncement $dt, Calend
return $cached;
}




public function OtherDates() {
if($this->Announcement) {
return false;
Expand Down Expand Up @@ -82,6 +67,4 @@ public function hydrate(CalendarDateTime $dt, Calendar $calendar) {
return $this;
}



}
}
3 changes: 1 addition & 2 deletions code/CachedCalendarTask.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php


class CachedCalendarTask extends HourlyTask {

public function process() {
Expand Down Expand Up @@ -55,4 +54,4 @@ public function process() {
}
echo "Done!";
}
}
}
Loading

0 comments on commit 89d6715

Please sign in to comment.