summaryrefslogtreecommitdiff
path: root/app/frontend/controls/grid
diff options
context:
space:
mode:
Diffstat (limited to 'app/frontend/controls/grid')
-rw-r--r--app/frontend/controls/grid/DummyGridElement.php9
-rw-r--r--app/frontend/controls/grid/DummyGridElement.tpl1
-rw-r--r--app/frontend/controls/grid/EventGridElement.php9
-rw-r--r--app/frontend/controls/grid/EventGridElement.tpl5
-rw-r--r--app/frontend/controls/grid/GridElement.php17
-rw-r--r--app/frontend/controls/grid/GroupGridElement.php23
-rw-r--r--app/frontend/controls/grid/GroupGridElement.tpl16
7 files changed, 80 insertions, 0 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">&nbsp;</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>