diff options
Diffstat (limited to 'app/frontend/controls')
-rw-r--r-- | app/frontend/controls/grid/DummyGridElement.php | 9 | ||||
-rw-r--r-- | app/frontend/controls/grid/DummyGridElement.tpl | 1 | ||||
-rw-r--r-- | app/frontend/controls/grid/EventGridElement.php | 9 | ||||
-rw-r--r-- | app/frontend/controls/grid/EventGridElement.tpl | 5 | ||||
-rw-r--r-- | app/frontend/controls/grid/GridElement.php | 17 | ||||
-rw-r--r-- | app/frontend/controls/grid/GroupGridElement.php | 23 | ||||
-rw-r--r-- | app/frontend/controls/grid/GroupGridElement.tpl | 16 | ||||
-rw-r--r-- | app/frontend/controls/styles/CalendarGrid.css | 26 |
8 files changed, 104 insertions, 2 deletions
diff --git a/app/frontend/controls/grid/DummyGridElement.php b/app/frontend/controls/grid/DummyGridElement.php new file mode 100644 index 0000000..8223bb2 --- /dev/null +++ b/app/frontend/controls/grid/DummyGridElement.php @@ -0,0 +1,9 @@ +<?php + +Prado::using('Application.controls.grid.GridElement'); + +class DummyGridElement extends GridElement { + +} + +?> diff --git a/app/frontend/controls/grid/DummyGridElement.tpl b/app/frontend/controls/grid/DummyGridElement.tpl new file mode 100644 index 0000000..add41d9 --- /dev/null +++ b/app/frontend/controls/grid/DummyGridElement.tpl @@ -0,0 +1 @@ +<div class="gridItem"> </div> diff --git a/app/frontend/controls/grid/EventGridElement.php b/app/frontend/controls/grid/EventGridElement.php new file mode 100644 index 0000000..28eaefa --- /dev/null +++ b/app/frontend/controls/grid/EventGridElement.php @@ -0,0 +1,9 @@ +<?php + +Prado::using('Application.controls.grid.GridElement'); + +class EventGridElement extends GridElement { + +} + +?> diff --git a/app/frontend/controls/grid/EventGridElement.tpl b/app/frontend/controls/grid/EventGridElement.tpl new file mode 100644 index 0000000..dca642a --- /dev/null +++ b/app/frontend/controls/grid/EventGridElement.tpl @@ -0,0 +1,5 @@ +<com:THtmlElement ID="Event" + TagName="div" + CssClass="gridEvent"> + <%= $this->Data->Name %> +</com:THtmlElement> diff --git a/app/frontend/controls/grid/GridElement.php b/app/frontend/controls/grid/GridElement.php new file mode 100644 index 0000000..3628d4b --- /dev/null +++ b/app/frontend/controls/grid/GridElement.php @@ -0,0 +1,17 @@ +<?php + +Prado::using('Application.components.TemplateControl'); + +class GridElement extends TemplateControl { + + public function setData($data) { + $this->setControlState('Data', $data); + } + + public function getData() { + return $this->getControlState('Data'); + } + +} + +?> diff --git a/app/frontend/controls/grid/GroupGridElement.php b/app/frontend/controls/grid/GroupGridElement.php new file mode 100644 index 0000000..dc92239 --- /dev/null +++ b/app/frontend/controls/grid/GroupGridElement.php @@ -0,0 +1,23 @@ +<?php + +Prado::using('Application.controls.grid.GridElement'); + +class GroupGridElement extends GridElement { + + public function onPreRender($param) { + parent::onPreRender($param); + $this->GroupEvents->setDataSource($this->Data->Events); + $this->GroupEvents->dataBind(); + } + + public function stripPrefix(string $string) { + return preg_replace( + '#^' . preg_quote($this->Data->Header) . '\s*#', + '', + $string + ); + } + +} + +?> diff --git a/app/frontend/controls/grid/GroupGridElement.tpl b/app/frontend/controls/grid/GroupGridElement.tpl new file mode 100644 index 0000000..af07655 --- /dev/null +++ b/app/frontend/controls/grid/GroupGridElement.tpl @@ -0,0 +1,16 @@ +<com:THtmlElement ID="Group" + TagName="div" + CssClass="gridGroup"> + <%= $this->Data->Header %> + (<%= count($this->Data->Events) %>) + <div class="gridGroupElements"> + <com:TRepeater ID="GroupEvents"> + <prop:ItemTemplate> + <div class="event"> + <%# $this->SourceTemplateControl->stripPrefix($this->Data->Name) %> + (<%# $this->Data->DateString %>) + </div> + </prop:ItemTemplate> + </com:TRepeater> + </div> +</com:THtmlElement> diff --git a/app/frontend/controls/styles/CalendarGrid.css b/app/frontend/controls/styles/CalendarGrid.css index 4710993..0656200 100644 --- a/app/frontend/controls/styles/CalendarGrid.css +++ b/app/frontend/controls/styles/CalendarGrid.css @@ -8,9 +8,31 @@ div.gridDay { min-height: 8em; flex: 1 1 auto; } -div.gridEvent, div.gridItem { height: 1.5em; padding: 0.3em 0.5em; margin: 0.1em 0; } -div.gridEvent { overflow: hidden; white-space: nowrap; background: #ddd } +div.gridEvent, +div.gridItem, +div.gridGroup { + height: 1.5em; + padding: 0.3em 0.5em; + margin: 0.1em 0; +} +div.gridGroup, +div.gridEvent { + overflow: hidden; + white-space: nowrap; + background: #ddd; +} div.gridEvent.beginDate { border-top-left-radius: 1.5em; border-bottom-left-radius: 1.5em } div.gridEvent.endDate { border-top-right-radius: 1.5em; border-bottom-right-radius: 1.5em } + +div.gridGroupElements { + position: absolute; + width: 13%; + background: #eee; + white-space: normal; + display: none; + cursor: auto; +} +div.gridGroup { cursor: pointer } +div.gridGroup:hover div.gridGroupElements { display: block; } |