diff options
author | emkael <emkael@tlen.pl> | 2016-06-16 02:38:11 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-06-16 11:50:22 +0200 |
commit | 1f38c2ebd86df1ff47aabe4b39c3c213c9d848c3 (patch) | |
tree | fb0773148d5bc0a5705957193caf8db64dbfd82c /app/frontend | |
parent | 85b8b9977957f7da7ce4011f0ea10dfef1ad492a (diff) |
* optional grouped/normal display in calendar grid
Diffstat (limited to 'app/frontend')
-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> |