From 2bc5a4cc767b582b8a5cc5de5667c3687ec236a0 Mon Sep 17 00:00:00 2001 From: emkael Date: Fri, 13 May 2016 16:16:40 +0200 Subject: * calendar grid display control --- app/php/controls/CalendarGrid.php | 59 ++++++++++++++++++++++++++++++++ app/php/controls/CalendarGrid.tpl | 28 +++++++++++++++ app/php/controls/styles/CalendarGrid.css | 16 +++++++++ 3 files changed, 103 insertions(+) create mode 100644 app/php/controls/CalendarGrid.php create mode 100644 app/php/controls/CalendarGrid.tpl create mode 100644 app/php/controls/styles/CalendarGrid.css (limited to 'app') diff --git a/app/php/controls/CalendarGrid.php b/app/php/controls/CalendarGrid.php new file mode 100644 index 0000000..4ebfacd --- /dev/null +++ b/app/php/controls/CalendarGrid.php @@ -0,0 +1,59 @@ +setControlState('Month', $month); + } + + public function getMonth() { + return $this->getControlState('Month'); + } + + public function setYear($year) { + $this->setControlState('Year', $year); + } + + public function getYear() { + return $this->getControlState('Year'); + } + + public function setUserToDisplay(DbUser $user) { + $this->setControlState('User', $user); + } + + public function getUserToDisplay() { + return $this->getControlState('User'); + } + + private function _getGrid() { + return $this->getFacade()->getCalendarListForUser( + $this->UserToDisplay, + $this->Month, + $this->Year + ); + } + + public function onPreRender($param) { + parent::onPreRender($param); + $this->Weeks->DataSource = $this->_getGrid()->Weeks; + $this->Weeks->dataBind(); + } + + public function weekDataBind($sender, $param) { + $param->Item->Days->DataSource = $param->Item->Data; + $param->Item->Days->dataBind(); + } + + public function dayDataBind($sender, $param) { + $param->Item->Events->DataSource = $param->Item->Data->Events; + $param->Item->Events->dataBind(); + } + +} + +?> diff --git a/app/php/controls/CalendarGrid.tpl b/app/php/controls/CalendarGrid.tpl new file mode 100644 index 0000000..2b3ada8 --- /dev/null +++ b/app/php/controls/CalendarGrid.tpl @@ -0,0 +1,28 @@ + + +
+ + +
+ <%# $this->Data->Date %> + + + + + + gridEvent <%# $this->Parent->Parent->Data->Date == $this->Data->DateFrom ? 'beginDate' : '' %> <%# $this->Parent->Parent->Data->Date == $this->Data->DateTo ? 'endDate' : '' %> + <%# $this->Data->Name %> + + + +
 
+
+
+
+
+
+
+
+
+
+
diff --git a/app/php/controls/styles/CalendarGrid.css b/app/php/controls/styles/CalendarGrid.css new file mode 100644 index 0000000..4710993 --- /dev/null +++ b/app/php/controls/styles/CalendarGrid.css @@ -0,0 +1,16 @@ +div.gridWeek { + clear: both; + display: flex; + flex-flow: row nowrap; +} +div.gridDay { + width: 14%; + 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.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 } -- cgit v1.2.3