diff options
Diffstat (limited to 'app/frontend/controls')
-rw-r--r-- | app/frontend/controls/CalendarGrid.php | 14 | ||||
-rw-r--r-- | app/frontend/controls/CalendarGrid.tpl | 20 |
2 files changed, 20 insertions, 14 deletions
diff --git a/app/frontend/controls/CalendarGrid.php b/app/frontend/controls/CalendarGrid.php index 4ebfacd..b168379 100644 --- a/app/frontend/controls/CalendarGrid.php +++ b/app/frontend/controls/CalendarGrid.php @@ -54,6 +54,20 @@ class CalendarGrid extends FacadeTemplateControl { $param->Item->Events->dataBind(); } + public function eventCreate($sender, $param) { + if (preg_match('/Item$/', $param->Item->ItemType)) { + $renderer = 'Dummy'; + if ($param->Item->Data) { + $renderer = $param->Item->Data->getRendererClass(); + } + $eventTemplate = Prado::createComponent( + 'Application.controls.grid.' . $renderer . 'GridElement' + ); + $eventTemplate->setData($param->Item->Data); + $param->Item->addParsedObject($eventTemplate); + } + } + } ?> diff --git a/app/frontend/controls/CalendarGrid.tpl b/app/frontend/controls/CalendarGrid.tpl index 2b3ada8..37ee81a 100644 --- a/app/frontend/controls/CalendarGrid.tpl +++ b/app/frontend/controls/CalendarGrid.tpl @@ -1,23 +1,15 @@ -<com:TRepeater ID="Weeks" OnItemDataBound="weekDataBind"> +<com:TRepeater ID="Weeks" + OnItemDataBound="weekDataBind"> <prop:ItemTemplate> <div class="gridWeek"> - <com:TRepeater ID="Days" OnItemDataBound="SourceTemplateControl.dayDataBind"> + <com:TRepeater ID="Days" + OnItemDataBound="SourceTemplateControl.dayDataBind"> <prop:ItemTemplate> <div class="gridDay"> <%# $this->Data->Date %> - <com:TRepeater ID="Events"> + <com:TRepeater ID="Events" + OnItemCreated="SourceTemplateControl.eventCreate"> <prop:ItemTemplate> - <com:TConditional Condition="$this->Data"> - <prop:TrueTemplate> - <com:THtmlElement TagName="div"> - <prop:CssClass>gridEvent <%# $this->Parent->Parent->Data->Date == $this->Data->DateFrom ? 'beginDate' : '' %> <%# $this->Parent->Parent->Data->Date == $this->Data->DateTo ? 'endDate' : '' %></prop:CssClass> - <%# $this->Data->Name %> - </com:THtmlElement> - </prop:TrueTemplate> - <prop:FalseTemplate> - <div class="gridItem"> </div> - </prop:FalseTemplate> - </com:TConditional> </prop:ItemTemplate> </com:TRepeater> </div> |