Skip to content

Commit

Permalink
add event in modal
Browse files Browse the repository at this point in the history
  • Loading branch information
Praesidiarius committed Mar 17, 2020
1 parent d6d0d19 commit 11bf81a
Show file tree
Hide file tree
Showing 7 changed files with 362 additions and 176 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "onePlace Event Module",
"type": "oneplace-module",
"license": "BSD-3-Clause",
"version": "1.0.3",
"version": "1.0.4",
"keywords": [
"laminas",
"mvc",
Expand Down
26 changes: 13 additions & 13 deletions data/data_shop.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
-- Event Base Form Fields
--

INSERT INTO `core_form_field` (`Field_ID`, `type`, `label`, `fieldkey`, `tab`, `form`, `class`, `url_view`, `url_list`, `tag_key`, `show_widget_left`, `allow_clear`, `readonly`, `tbl_cached_name`, `tbl_class`, `tbl_permission`) VALUES
(NULL, 'datetime', 'start Date', 'date_start', 'event-base', 'event-single', 'col-md-2', '/event/view/##ID##', '', '', 0, 1, 0, '', '', ''),
(NULL, 'datetime', 'end Date', 'date_end', 'event-base', 'event-single', 'col-md-2', '/event/view/##ID##', '', '', 0, 1, 0, '', '', ''),
(NULL, 'boolselect', 'is daily Event', 'is_daily_event_idfs', 'event-base', 'event-single', 'col-md-2', '', '', 0, 1, 0, '', '', ''),
(NULL, 'text', 'Excerpt', 'excerpt', 'event-base', 'event-single', 'col-md-3', '/event/view/##ID##', '', '', 0, 1, 0, '', '', ''),
(NULL, 'textarea', 'Description', 'description', 'event-base', 'event-single', 'col-md-12', '', '', '', 0, 1, 0, '', '', ''),
(NULL, 'select', 'Calendar', 'calendar_idfs', 'event-base', 'event-single', 'col-md-3', '', '/event/api/listcalendars/0', '', 0, 1, 0, 'calendar-single', 'OnePlace\\Event\\Model\\CalendarTable', 'add-OnePlace\\Calendar\\Controller\\CalendarController'),
(NULL, 'boolselect', 'show on website', 'web_show_idfs', 'event-base', 'event-single', 'col-md-2', '', '', 0, 1, 0, '', '', ''),
(NULL, 'boolselect', 'web spotlight', 'web_spotlight_idfs', 'event-base', 'event-single', 'col-md-2', '', '', 0, 1, 0, '', '', ''),
(NULL, 'featuredimage', 'Featured Image', 'featured_image', 'event-base', 'event-single', 'col-md-3', '', '', '', 0, 1, 0, '', '', ''),
(NULL, 'gallery', 'Gallery', 'gallery', 'event-gallery', 'event-single', 'col-md-12', '', '', '', 0, 1, 0, '', '', ''),
(NULL, 'partial', 'Gallery Sort', 'webgallery', 'event-gallerysort', 'event-single', 'col-md-12', '', '', '', 0, 1, 0, '', '', ''),
(NULL, 'multiselect', 'Categories', 'category', 'event-base', 'event-single', 'col-md-2', '', '/tag/api/list/event-single/category', 'category', 0, 1, 0, 'entitytag-single', 'OnePlace\\Tag\\Model\\EntityTagTable','add-OnePlace\\Event\\Controller\\CategoryController');
INSERT INTO `core_form_field` (`Field_ID`, `type`, `label`, `default_value`, `fieldkey`, `tab`, `form`, `class`, `url_view`, `url_list`, `tag_key`, `show_widget_left`, `allow_clear`, `readonly`, `tbl_cached_name`, `tbl_class`, `tbl_permission`) VALUES
(NULL, 'datetime', 'start Date', '', 'date_start', 'event-base', 'event-single', 'col-md-2', '/event/view/##ID##', '', '', 0, 1, 0, '', '', ''),
(NULL, 'datetime', 'end Date', '', 'date_end', 'event-base', 'event-single', 'col-md-2', '/event/view/##ID##', '', '', 0, 1, 0, '', '', ''),
(NULL, 'boolselect', 'is daily Event', '', 'is_daily_event_idfs', 'event-base', 'event-single', 'col-md-2', '', '', 0, 1, 0, '', '', ''),
(NULL, 'text', 'Excerpt', '', 'excerpt', 'event-base', 'event-single', 'col-md-3', '/event/view/##ID##', '', '', 0, 1, 0, '', '', ''),
(NULL, 'textarea', 'Description', '', 'description', 'event-base', 'event-single', 'col-md-12', '', '', '', 0, 1, 0, '', '', ''),
(NULL, 'select', 'Calendar', '##first##', 'calendar_idfs', 'event-base', 'event-single', 'col-md-3', '', '/event/api/listcalendars/0', '', 0, 1, 0, 'calendar-single', 'OnePlace\\Event\\Model\\CalendarTable', 'add-OnePlace\\Calendar\\Controller\\CalendarController'),
(NULL, 'boolselect', 'show on website', '', 'web_show_idfs', 'event-base', 'event-single', 'col-md-2', '', '', 0, 1, 0, '', '', ''),
(NULL, 'boolselect', 'web spotlight', '', 'web_spotlight_idfs', 'event-base', 'event-single', 'col-md-2', '', '', 0, 1, 0, '', '', ''),
(NULL, 'featuredimage', 'Featured Image', '', 'featured_image', 'event-base', 'event-single', 'col-md-3', '', '', '', 0, 1, 0, '', '', ''),
(NULL, 'gallery', 'Gallery', '', 'gallery', 'event-gallery', 'event-single', 'col-md-12', '', '', '', 0, 1, 0, '', '', ''),
(NULL, 'partial', 'Gallery Sort', '', 'webgallery', 'event-gallerysort', 'event-single', 'col-md-12', '', '', '', 0, 1, 0, '', '', ''),
(NULL, 'multiselect', 'Categories', '', 'category', 'event-base', 'event-single', 'col-md-2', '', '/tag/api/list/event-single/category', 'category', 0, 1, 0, 'entitytag-single', 'OnePlace\\Tag\\Model\\EntityTagTable','add-OnePlace\\Event\\Controller\\CategoryController');

--
-- quick search result display
Expand Down
24 changes: 12 additions & 12 deletions data/data_simple.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
-- Event Base Form Fields
--

INSERT INTO `core_form_field` (`Field_ID`, `type`, `label`, `fieldkey`, `tab`, `form`, `class`, `url_view`, `url_list`, `show_widget_left`, `allow_clear`, `readonly`, `tbl_cached_name`, `tbl_class`, `tbl_permission`) VALUES
(NULL, 'datetime', 'start Date', 'date_start', 'event-base', 'event-single', 'col-md-2', '', '', 0, 1, 0, '', '', ''),
(NULL, 'datetime', 'end Date', 'date_end', 'event-base', 'event-single', 'col-md-2', '', '', 0, 1, 0, '', '', ''),
(NULL, 'boolselect', 'is daily Event', 'is_daily_event_idfs', 'event-base', 'event-single', 'col-md-2', '', '', 0, 1, 0, '', '', ''),
(NULL, 'text', 'Excerpt', 'excerpt', 'event-base', 'event-single', 'col-md-3', '/event/view/##ID##', '', 0, 1, 0, '', '', ''),
(NULL, 'textarea', 'Description', 'description', 'event-base', 'event-single', 'col-md-12', '', '', 0, 1, 0, '', '', ''),
(NULL, 'select', 'Root Event', 'root_event_idfs', 'event-base', 'event-single', 'col-md-3', '', '/event/api/list/0', 0, 1, 0, 'event-single', 'OnePlace\\Event\\Model\\EventTable', 'add-OnePlace\\Event\\Controller\\EventController'),
(NULL, 'select', 'Calendar', 'calendar_idfs', 'event-base', 'event-single', 'col-md-3', '', '/event/api/listcalendars/0', 0, 1, 0, 'calendar-single', 'OnePlace\\Event\\Model\\CalendarTable', 'add-OnePlace\\Calendar\\Controller\\CalendarController'),
(NULL, 'boolselect', 'show on website', 'web_show_idfs', 'event-base', 'event-single', 'col-md-2', '', '', 0, 1, 0, '', '', ''),
(NULL, 'boolselect', 'web spotlight', 'web_spotlight_idfs', 'event-base', 'event-single', 'col-md-2', '', '', 0, 1, 0, '', '', ''),
(NULL, 'boolselect', 'confirm', 'event_confirm_idfs', 'event-base', 'event-single', 'col-md-2', '', '', 0, 1, 0, '', '', ''),
(NULL, 'featuredimage', 'Featured Image', 'featured_image', 'event-base', 'event-single', 'col-md-3', '', '', '0', '1', '0', '', '', '');
INSERT INTO `core_form_field` (`Field_ID`, `type`, `label`, `default_value`, `fieldkey`, `tab`, `form`, `class`, `url_view`, `url_list`, `show_widget_left`, `allow_clear`, `readonly`, `tbl_cached_name`, `tbl_class`, `tbl_permission`) VALUES
(NULL, 'datetime', 'start Date', '', 'date_start', 'event-base', 'event-single', 'col-md-2', '', '', 0, 1, 0, '', '', ''),
(NULL, 'datetime', 'end Date', '', 'date_end', 'event-base', 'event-single', 'col-md-2', '', '', 0, 1, 0, '', '', ''),
(NULL, 'boolselect', 'is daily Event', '', 'is_daily_event_idfs', 'event-base', 'event-single', 'col-md-2', '', '', 0, 1, 0, '', '', ''),
(NULL, 'text', 'Excerpt', '', 'excerpt', 'event-base', 'event-single', 'col-md-3', '/event/view/##ID##', '', 0, 1, 0, '', '', ''),
(NULL, 'textarea', 'Description', '', 'description', 'event-base', 'event-single', 'col-md-12', '', '', 0, 1, 0, '', '', ''),
(NULL, 'select', 'Root Event', '', 'root_event_idfs', 'event-base', 'event-single', 'col-md-3', '', '/event/api/list/0', 0, 1, 0, 'event-single', 'OnePlace\\Event\\Model\\EventTable', 'add-OnePlace\\Event\\Controller\\EventController'),
(NULL, 'select', 'Calendar', '##first##', 'calendar_idfs', 'event-base', 'event-single', 'col-md-3', '', '/event/api/listcalendars/0', 0, 1, 0, 'calendar-single', 'OnePlace\\Event\\Model\\CalendarTable', 'add-OnePlace\\Calendar\\Controller\\CalendarController'),
(NULL, 'boolselect', 'show on website', '', 'web_show_idfs', 'event-base', 'event-single', 'col-md-2', '', '', 0, 1, 0, '', '', ''),
(NULL, 'boolselect', 'web spotlight', '', 'web_spotlight_idfs', 'event-base', 'event-single', 'col-md-2', '', '', 0, 1, 0, '', '', ''),
(NULL, 'boolselect', 'confirm', '', 'event_confirm_idfs', 'event-base', 'event-single', 'col-md-2', '', '', 0, 1, 0, '', '', ''),
(NULL, 'featuredimage', 'Featured Image','', 'featured_image', 'event-base', 'event-single', 'col-md-3', '', '', '0', '1', '0', '', '', '');

--
-- quick search result display
Expand Down
28 changes: 22 additions & 6 deletions src/Controller/EventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ public function addAction() {
* event-add-before-save (before save)
* event-add-after-save (after save)
*/
return $this->generateAddView('event');

if(isset($_REQUEST[$this->sSingleForm.'_ismodal'])) {
return $this->generateAddView('event', $this->sSingleForm, 'event-calendar', 'index', 0, [], 'Event saved successfully');
} else {
return $this->generateAddView('event');
}
}

/**
Expand Down Expand Up @@ -135,16 +140,27 @@ public function modalAction() {
$this->layout('layout/modal');

$iEventID = $this->params()->fromRoute('id', '0');
$oEvent = $this->oTableGateway->getSingle($iEventID);
$oCalendar = $this->oCalendarTbl->getSingle($oEvent->calendar_idfs);

$this->layout()->aModalButtons = [];
$this->layout()->oItem = $oEvent;
$oEvent = false;
$oEventTpl = false;
$sDateSelected = '';
if($iEventID != 0) {
$oEvent = $this->oTableGateway->getSingle($iEventID);
$oCalendar = $this->oCalendarTbl->getSingle($oEvent->calendar_idfs);

$this->layout()->aModalButtons = [];
$this->layout()->oItem = $oEvent;
} else {
$sDateSelected = $_REQUEST['date'];
$oCalendar = $this->oCalendarTbl->getSingle('first');
$oEventTpl = $this->oTableGateway->generateNew();
}

return new ViewModel([
'oEvent' => $oEvent,
'oCalendar' => $oCalendar,
'sFormName' => $this->sSingleForm,
'oEventTpl' => $oEventTpl,
'sDateSelected' => $sDateSelected,
]);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Module {
*
* @since 1.0.0
*/
const VERSION = '1.0.3';
const VERSION = '1.0.4';

/**
* Load module config file
Expand Down
2 changes: 1 addition & 1 deletion view/one-place/event/calendar/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},
dateClick: function(info) {
var sDateSelected = info.dateStr;
$.get('/event/add/0-default',{mode:'modal',goto:'general',date:sDateSelected},function(retModal) {
$.get('/event/modal/0',{mode:'modal',goto:'general',date:sDateSelected},function(retModal) {
$('#exampleModalCenter').html(retModal);
$('#exampleModalCenter').modal('toggle');
});
Expand Down
Loading

0 comments on commit 11bf81a

Please sign in to comment.