Skip to content

Commit

Permalink
ENHANCEMENT: Removed dependency on DataObjectManager by using Complex…
Browse files Browse the repository at this point in the history
…TableField if it's not available.
  • Loading branch information
ajshort committed Mar 7, 2011
1 parent 3c5bb99 commit 0854f53
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
11 changes: 4 additions & 7 deletions _config.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
require_once(Director::baseFolder().'/event_calendar/code/sfDateTimeToolkit.class.php');
require_once(Director::baseFolder().'/event_calendar/code/CalendarUI.class.php');

if(!class_exists("DataObjectManager"))
user_error(_t('EventCalendar.DATAOBJECTMANAGER','Event Calendar requires the DataObjectManager module.'),E_USER_ERROR);

LeftAndMain::require_javascript('event_calendar/javascript/calendar_interface.js');
LeftAndMain::require_css('event_calendar/css/calendar_cms.css');

Expand All @@ -27,7 +24,7 @@

/**
* Available date format keys
** Start Date **
%{sWeekDayShort} e.g. Mon
%{sWeekDayFull} e.g. Monday
Expand All @@ -40,7 +37,7 @@
%{sMonFull} e.g. October
%{sYearShort} e.g. 09
%{sYearFull} e.g. 2009
** End Date **
%{eWeekDayShort}
%{eWeekDayFull}
Expand All @@ -54,13 +51,13 @@
%{eYearShort}
%{eYearFull}
*/
*/
global $customDateTemplates;
$customDateTemplates = array(
/*
You can modify the date display by assigning new date templates to any of the following
date scenarios. Use the above date format keys.
'OneDay' => '%{sMonShort}. %{sDayNumShort}, %{sYearFull}'
'SameMonthSameYear' => '%{sMonShort}. %{sDayNumShort} - %{eDayNumShort}, %{eYearFull}'
'DiffMonthSameYear' => '%{sMonShort}. %{sDayNumShort} - %{eMonShort}. %{eDayNumShort}, %{eYearFull}'
Expand Down
3 changes: 2 additions & 1 deletion code/Calendar.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ public function getCMSFields()
$announcements = _t('Calendar.Announcements','Announcements');
$f->addFieldToTab("Root.Content.$announcements", $table);

$table = new DataObjectManager(
$tableClass = class_exists('DataObjectManager') ? 'DataObjectManager' : 'ComplexTableField';
$table = new $tableClass(
$this,
'Feeds',
'ICSFeed',
Expand Down
8 changes: 6 additions & 2 deletions code/CalendarDateTime.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ public function getDateTimeTable($eventID)
$filter = "`CalendarDateTime`.EventID = {$eventID}";
$fields = $this->getPopupFields();
$fields->push(new HiddenField('EventID','',$eventID));
$table = new DataObjectManager($this->getEventObject(), $name, get_class($this), $titles, $fields, $filter);

$tableClass = class_exists('DataObjectManager') ? 'DataObjectManager' : 'ComplexTableField';
$table = new $tableClass($this->getEventObject(), $name, get_class($this), $titles, $fields, $filter);
$table->setAddTitle(_t("CalendarDateTime.ADATE","a Date"));

return $table;
Expand All @@ -179,7 +181,9 @@ public function getDateTimeTable($eventID)
public function getAnnouncementTable($calendarID)
{
$this->extendAnnouncement();
$table = new DataObjectManager(

$tableClass = class_exists('DataObjectManager') ? 'DataObjectManager' : 'ComplexTableField';
$table = new $tableClass(
$this->getEventObject()->Parent(),
'Announcements',
$this->class,
Expand Down

0 comments on commit 0854f53

Please sign in to comment.