diff --git a/composer.json b/composer.json index 8976e14c91cd9e2f833a142b15db9e2b1b593283..8d6b92df70b8ea30d5b847f99c81b98b1921195f 100644 --- a/composer.json +++ b/composer.json @@ -78,7 +78,6 @@ "drupal/block_permissions": "^1.0", "drupal/block_region_permissions": "^1.2", "drupal/bootstrap": "3.5", - "drupal/calendar": "1.x-dev", "drupal/cog": "^1.13", "drupal/config_direct_save": "^1.0", "drupal/config_ignore": "^2.1", diff --git a/composer.lock b/composer.lock index fd83b5f0345b412a2b2e8e77a7349cd2b7dcdfda..967d4acbf77507334f780d6e17e28f710d306c0f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "f6ac7e12456b8b4de7d94199d9b3b021", + "content-hash": "e83a7e78d8322546886a1ca3f3b59552", "packages": [ { "name": "alchemy/zippy", @@ -1784,123 +1784,6 @@ "irc": "irc://irc.freenode.org/drupal-bootstrap" } }, - { - "name": "drupal/calendar", - "version": "dev-1.x", - "source": { - "type": "git", - "url": "https://git.drupal.org/project/calendar", - "reference": "1ef5b86b11bf69641cc6539bcc93f73e7afb8ebf" - }, - "require": { - "drupal/calendar_datetime": "*", - "drupal/core": "*", - "drupal/views_templates": "1.*" - }, - "type": "drupal-module", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - }, - "drupal": { - "version": "8.x-1.x-dev", - "datestamp": "1530790124", - "security-coverage": { - "status": "not-covered", - "message": "Dev releases are not covered by Drupal security advisories." - } - } - }, - "notification-url": "https://packages.drupal.org/8/downloads", - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "KarenS", - "homepage": "https://www.drupal.org/user/45874" - }, - { - "name": "fizk", - "homepage": "https://www.drupal.org/user/473174" - }, - { - "name": "geertvd", - "homepage": "https://www.drupal.org/user/536694" - }, - { - "name": "pjonckiere", - "homepage": "https://www.drupal.org/user/2442998" - }, - { - "name": "tedbow", - "homepage": "https://www.drupal.org/user/240860" - } - ], - "description": "Provides a Views plugin to display views containing dates as Calendars.", - "homepage": "http://drupal.org/project/calendar", - "keywords": [ - "Drupal" - ], - "support": { - "source": "http://cgit.drupalcode.org/calendar", - "issues": "https://www.drupal.org/project/issues/calendar" - }, - "time": "2018-07-05T11:35:40+00:00" - }, - { - "name": "drupal/calendar_datetime", - "version": "dev-1.x", - "require": { - "drupal/calendar": "self.version", - "drupal/core": "~8.0" - }, - "type": "metapackage", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - }, - "drupal": { - "version": "8.x-1.x-dev", - "datestamp": "1515077885", - "security-coverage": { - "status": "not-covered", - "message": "Dev releases are not covered by Drupal security advisories." - } - } - }, - "notification-url": "https://packages.drupal.org/8/downloads", - "license": [ - "GPL-2.0-or-later" - ], - "authors": [ - { - "name": "KarenS", - "homepage": "https://www.drupal.org/user/45874" - }, - { - "name": "fizk", - "homepage": "https://www.drupal.org/user/473174" - }, - { - "name": "geertvd", - "homepage": "https://www.drupal.org/user/536694" - }, - { - "name": "pjonckiere", - "homepage": "https://www.drupal.org/user/2442998" - }, - { - "name": "tedbow", - "homepage": "https://www.drupal.org/user/240860" - } - ], - "description": "Provides a calendar specific date time.", - "homepage": "https://www.drupal.org/project/calendar", - "support": { - "source": "http://cgit.drupalcode.org/calendar" - } - }, { "name": "drupal/cog", "version": "1.13.0", @@ -7134,57 +7017,6 @@ "irc": "irc://irc.freenode.org/drupal-contribute" } }, - { - "name": "drupal/views_templates", - "version": "1.0.0-alpha1", - "source": { - "type": "git", - "url": "https://git.drupal.org/project/views_templates", - "reference": "8.x-1.0-alpha1" - }, - "dist": { - "type": "zip", - "url": "https://ftp.drupal.org/files/projects/views_templates-8.x-1.0-alpha1.zip", - "reference": "8.x-1.0-alpha1", - "shasum": "4559016960917a630f8daaf0ccc7ec6fa9c630eb" - }, - "require": { - "drupal/core": "*" - }, - "type": "drupal-module", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - }, - "drupal": { - "version": "8.x-1.0-alpha1", - "datestamp": "1449691739", - "security-coverage": { - "status": "not-covered", - "message": "Project has not opted into security advisory coverage!" - } - } - }, - "notification-url": "https://packages.drupal.org/8/downloads", - "license": [ - "GPL-2.0-or-later" - ], - "authors": [ - { - "name": "geertvd", - "homepage": "https://www.drupal.org/user/536694" - }, - { - "name": "tedbow", - "homepage": "https://www.drupal.org/user/240860" - } - ], - "description": "Reintroduces dynamic default views.", - "homepage": "https://www.drupal.org/project/views_templates", - "support": { - "source": "http://cgit.drupalcode.org/views_templates" - } - }, { "name": "drupal/webform", "version": "5.0.0-rc12", @@ -11192,7 +11024,6 @@ "aliases": [], "minimum-stability": "dev", "stability-flags": { - "drupal/calendar": 20, "drupal/roleassign": 15, "drupal/simple_block": 10, "drupal/views_bootstrap": 20 diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index b55863b88af762ca52e8c14e7d992c31540b1f78..ff7074cc289fbfdb78585d3d0e59c231a5897728 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1843,126 +1843,6 @@ "irc": "irc://irc.freenode.org/drupal-bootstrap" } }, - { - "name": "drupal/calendar", - "version": "dev-1.x", - "version_normalized": "dev-1.x", - "source": { - "type": "git", - "url": "https://git.drupal.org/project/calendar", - "reference": "1ef5b86b11bf69641cc6539bcc93f73e7afb8ebf" - }, - "require": { - "drupal/calendar_datetime": "*", - "drupal/core": "*", - "drupal/views_templates": "1.*" - }, - "time": "2018-07-05T11:35:40+00:00", - "type": "drupal-module", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - }, - "drupal": { - "version": "8.x-1.x-dev", - "datestamp": "1530790124", - "security-coverage": { - "status": "not-covered", - "message": "Dev releases are not covered by Drupal security advisories." - } - } - }, - "installation-source": "source", - "notification-url": "https://packages.drupal.org/8/downloads", - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "KarenS", - "homepage": "https://www.drupal.org/user/45874" - }, - { - "name": "fizk", - "homepage": "https://www.drupal.org/user/473174" - }, - { - "name": "geertvd", - "homepage": "https://www.drupal.org/user/536694" - }, - { - "name": "pjonckiere", - "homepage": "https://www.drupal.org/user/2442998" - }, - { - "name": "tedbow", - "homepage": "https://www.drupal.org/user/240860" - } - ], - "description": "Provides a Views plugin to display views containing dates as Calendars.", - "homepage": "http://drupal.org/project/calendar", - "keywords": [ - "Drupal" - ], - "support": { - "source": "http://cgit.drupalcode.org/calendar", - "issues": "https://www.drupal.org/project/issues/calendar" - } - }, - { - "name": "drupal/calendar_datetime", - "version": "dev-1.x", - "version_normalized": "dev-1.x", - "require": { - "drupal/calendar": "self.version", - "drupal/core": "~8.0" - }, - "type": "metapackage", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - }, - "drupal": { - "version": "8.x-1.x-dev", - "datestamp": "1515077885", - "security-coverage": { - "status": "not-covered", - "message": "Dev releases are not covered by Drupal security advisories." - } - } - }, - "notification-url": "https://packages.drupal.org/8/downloads", - "license": [ - "GPL-2.0-or-later" - ], - "authors": [ - { - "name": "KarenS", - "homepage": "https://www.drupal.org/user/45874" - }, - { - "name": "fizk", - "homepage": "https://www.drupal.org/user/473174" - }, - { - "name": "geertvd", - "homepage": "https://www.drupal.org/user/536694" - }, - { - "name": "pjonckiere", - "homepage": "https://www.drupal.org/user/2442998" - }, - { - "name": "tedbow", - "homepage": "https://www.drupal.org/user/240860" - } - ], - "description": "Provides a calendar specific date time.", - "homepage": "https://www.drupal.org/project/calendar", - "support": { - "source": "http://cgit.drupalcode.org/calendar" - } - }, { "name": "drupal/cog", "version": "1.13.0", @@ -7360,59 +7240,6 @@ "irc": "irc://irc.freenode.org/drupal-contribute" } }, - { - "name": "drupal/views_templates", - "version": "1.0.0-alpha1", - "version_normalized": "1.0.0.0-alpha1", - "source": { - "type": "git", - "url": "https://git.drupal.org/project/views_templates", - "reference": "8.x-1.0-alpha1" - }, - "dist": { - "type": "zip", - "url": "https://ftp.drupal.org/files/projects/views_templates-8.x-1.0-alpha1.zip", - "reference": "8.x-1.0-alpha1", - "shasum": "4559016960917a630f8daaf0ccc7ec6fa9c630eb" - }, - "require": { - "drupal/core": "*" - }, - "type": "drupal-module", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - }, - "drupal": { - "version": "8.x-1.0-alpha1", - "datestamp": "1449691739", - "security-coverage": { - "status": "not-covered", - "message": "Project has not opted into security advisory coverage!" - } - } - }, - "installation-source": "dist", - "notification-url": "https://packages.drupal.org/8/downloads", - "license": [ - "GPL-2.0-or-later" - ], - "authors": [ - { - "name": "geertvd", - "homepage": "https://www.drupal.org/user/536694" - }, - { - "name": "tedbow", - "homepage": "https://www.drupal.org/user/240860" - } - ], - "description": "Reintroduces dynamic default views.", - "homepage": "https://www.drupal.org/project/views_templates", - "support": { - "source": "http://cgit.drupalcode.org/views_templates" - } - }, { "name": "drupal/webform", "version": "5.0.0-rc12", diff --git a/web/modules/calendar/CHANGELOG.txt b/web/modules/calendar/CHANGELOG.txt deleted file mode 100644 index 2d1ecba7be1026ba345ef640bd6fd6a941138c7b..0000000000000000000000000000000000000000 --- a/web/modules/calendar/CHANGELOG.txt +++ /dev/null @@ -1,379 +0,0 @@ -Calendar Module 7.x -================== - -=================== -Version 7.x-3.x-dev -=================== - -====================== -Version 7.x-3.5 -====================== - -- Issue #1729884 by lund.mikkel: Translations of max items collide with other translations. -- Issue #1734858 by Jaws, pc-wurm: Create localized_options array in calendar_menu_local_tasks_alter() if it does not exist. -- Issue #2008554 by coredumperror: Properly display week numbers in mini calendar view. -- Issue #1471400 by RoSk0, Garrett Albright: Fix illegal offset in template_preprocess_calendar_month(). -- Issue #1792368 by rdela, Day template missing % after $first_column_width - -====================== -Version 7.x-3.4 -====================== - -- Remove calendar_row_node completely. -- Remove Calendar iCal completely. -- Issue #1552212, Week numbers in the month view lost their links. -- Change default tracking behavior to be off. -- Issue #1556180 by hass, Error: Strict warning: Declaration of calendar_plugin_style::options_submit(). -- Issue #1588590, Cannot always unset date link once set. -- Issue #1565994, Remove default caching from calendar. Let people set it up themselves. - -====================== -Version 7.x-3.3 -====================== - -NEW FEATURES: -- An option to add Colorbox settings to the calendar template has been added to admin/config/date/calendar. -- The template has been updated to add the Colorbox settings if the option to use them has been selected and Colorbox is enabled. -- The theming has been altered a bit to make sure that you can display a rendered entity in a Colorbox field. -- A new calendar style option has been added to choose fields to exclude from multi-day rows, so multi-day rows can be set up to display only the Colorbox picker. - -BUGFIXES: - -- Delete all the code used to remove default calendars, no longer needed now that the default calendar has been removed. -- Issue #1543930 by johnv, Fix taxonomy stripe settings so they don't depend on formatter. -- Move session tracking option to be a global option instead of a per-display option. -- Issue #1551112, Make sure items without colors don't show up in the legend. -- Issue #1545240, Don't try to set the date link if there is no link_display set. -- Issue #1291768, Document caching options and add default caching to the templates. -- Issue #1541938, Fix error when displaying the week number. -- Issue #1550836, Fix logic error in overlapping week view that was keeping the overlap classes from getting set. -- Style tweaks, make the day window bigger by not ending it at the bottom of the browser screen. - -====================== -Version 7.x-3.2 -====================== - -Please read the notes for the 3.1 release as well. - -- Issue #1537598, Fix misc errors in day display caused when some items were not getting rendered due to a badly placed 'continue' in the loop. - -====================== -Version 7.x-3.1 -====================== - -DEPRECATED ELEMENTS: - -- The default calendar has been removed. If you have calendars created with the old default calendar you should re-create them using the new template. -- The Calendar iCal module has been hidden so you can't enable it and will be deleted completely in the next release. Use the new Date iCal module instead. -- The Calendar Items row plugin has been removed from the UI and will be deleted completely in the next release. - - -NEW FEATURES: -- The legend block has been reworked to eliminate storing stripes in $GLOBALS, making it cacheable. A new configuration option sets the view that is used for the stipe options. -- Add the headers attribute to multiday calendar tables for html5 compliance and accessibility. -- Issue #1535346, Rework the calendar tab handling to get rid of custom tabs and add in a setting to track the current date. -- Issue #1535346 continuation, rework the current date tracking to use the new date_default_argument_alter hook. - -There have been numerous problems with the way the tabs are working. They revert to the current day when you switch from one display to another. They are not translating correctly. Sometimes the paths are incorrect (i.e. if there are other arguments in the display). Some people don't want the tabs. Other people want additional tabs. - -I am reworking them completely. I was originally trying to control them so we could do 'smart' switching to keep track of the current date as people clicked from one display to another. That wouldn't work with normal tabs, which can only display the default view. But overriding the normal menu items is fraught with problems and I finally figured out a way to keep track of the current date without controlling the tabs. - -So I am getting rid of all the custom tab handling. You can create tabs on the calendar the way you create tabs on any other view -- with the menu setting in the display. That way you can totally control the tabs in your calendar. I am changing the calendar template to add the tabs to it. - -To track the current date as you move around the calendar I am adding a query override in the style handler. Basically it stores the current date in a session as you move around the calendar. When you switch to a new display, it computes the default date for that display based on the last date in your session. So if you go 3 months into the future and then switch to the day view, you will see a day in that month, not the current day. - -Because the session handling may only be desirable on certain calendars I added a setting where you can enable or disable this behavior. It's a setting on the calendar style. You can choose to turn that off, enable it only for authenticated users, or enable it for everyone. - -If you have an existing calendar you can add the menu tabs and turn on the date tracking for each display in your calendar (year, month, day, and week). Or you can delete your calendar and create a new one from a template and it will have all this set up. - - -BUGFIXES: - -- Issue #1397986, Fix Undefined index groupby_times. -- Issue #1466698 by alex.neblett and johnv, Make sure that all available fields appear on the template, even when shared across entity types. -- The group by field option was not working right, fix it. -- The calendar legend block was appearing even if empty. Create the content earlier to keep that from happening. -- Issue #1445228, Make sure calendar_granularity_paths works on a default view that is missing granularity (as from an export). -- Fix the Date/Calendar link to link to the default display instead of the current display. -- Hide more of the deprecated elements and remove the old default view. Will remove the rest in the next release. Waiting a bit to avoid registry errors for people who haven't made the switch. -- Issue #1447176 by johnv, Rework taxonomy stripe logic. -- Issue #1533466, Bad logic in the calendar template sometimes tries to create the wrong type of date field resulting in a broken handler. -- Issue #1491140 by Morten Najbjerg and KarenS, Fix OG stripe options so they work with 7.2 version of OG. -- Issue #1392306 by johnv, Calendar stripe code consistency changes. -- Issue #1460134, Last column in week view isn't quite wide enough. -- Issue #1298546, Get more field style settings to be reflected in the calendar. -- Issue #1221530, Fix row plugin to handle relationships properly, and also use new date_id and date_delta values. -- Issue #1446726, Fix broken remove calendar functionality. -- Adjust the calendar tab paths to allow for the slightly different path used when a display is a default tab. -- Issue #1445228 by dealancer, More notices about displays missing arguments. -- Issue #1485790, Fix undefined index arguments for displays that are missing arguments. -- Stripe logic got goofed up somewhere. -- Make sure calendar_plugin_row doesn't try to render fields that no longer exist, as happens when they've been deleted. -- Make sure calendar_views_templates() doesn't try to create templates for base tables without fields. - -====================== -Version 7.x-3.0 -====================== - -NOTES: - -This update deprecates the Calendar iCal module, which should be replaced with -the new Date iCal module (http://drupal.org/project/date_ical). The Calendar -iCal module will disappear completely in a future release. - -The default calendar view is deprecated in this version. New calendar should be -created using templates, using the 'Add view from template' link at the top -of the Views list. - -If you are having any trouble with older views, it is highly recommended to delete -the old view and start over with the template. It will probably save you a lot -of time in the long run. - - -- Issue #1445228 by Jaza, Calendar granularity path causing PHP notices. -- Issue #1439832 by Dave Reid and HorsePunchKid, Undefined index error 'redirect' when using redirect module. -- Mark Calendar iCal elements as deprecated. -- Update calendar template to use Date iCal instead of Calendar iCal. -- Fix broken url handling in the row plugin. -- We need to add the entity type to the calendar template name because we have duplicate fields on various entities, like timestamp and changed. -- Switch to using entity_lable() and entity_uri() in row handler. -- Issue #1284170 by benjifisher, Lots of cleanup of the iCal export and its template to be sure all day items are exported correctly. -- Issue #1346424, The calendar title got left out of the latest ical template changes. -- Issue #1371730, The Prev/Next text was missing from the year view. -- Paths in the template should use dashes not underscores. -- Issue #1438792 by johnv, Remove unneeded $GLOBALS['calendar_stripe_labels']. -- Cleanup calendar links code -- don't add to session unless populated, abort if date argument is missing. -- We don't want a title in the template. -- Issue #1393086, Make sure that links to the day view work even if the day view is not a calendar view. -- Add DEPRECATED language to default views and make sure calendar plugins only get added to base tables that have entities. -- Additional handling is needed so that revisions are handled correctly in Views. -- Rework the Date Views hooks that queue up the right fields and base tables so they work better across all types of entities. -- Get the file created date working in a calendar to be sure entity handling is right. -- Fix left over reference to calendar_node row plugin and make sure calendar default view now starts out disabled. We want people to start using the templates. -- Clean up new Calendar administration screen and move some more code from Date Tools related to removing the old calendar variables. - -====================== -Version 7.x-3.0-rc1 -====================== - -NOTES: -This release deprecates the old Calendar Items row plugin and replaces it with -a new Calendar Entities row plugin that will work with any entity. - -- Issue #1264596, Make sure week view tests only the all_day value, not whether start date == end date. -- Issue #1399964, Make sure calendar paths all take into account arguments ahead of the calendar arguments when creating links. -- Issue #1253482, Get rid of attempt to keep track of current location when switching between calendar views, each one will go back to default. -- Issue #1415326 by bkline, Fix help link. -- Issue #1436020 by scrypt, Missing space in attributes at Month's day cell. -- Issue #1400322 by Digidog, Remove clear-fix style from css. -- Issue #1433046 by thekevinday, Fix broken continue buried in switch. -- Issue #1392306 by johnv and KarenS, Fix broken taxonomy striping. -- Issue #1264520 by bennettee and jackalope, Items without end date displayed as all day. -- Issue #1411862, Add calendar templates for all date fields. -- Issue #1354560, Add a new plugin that works for all entities, not just nodes and mark the old one as deprecated. -- Follow up to Issue #1302052 by benjifisher, More clean up of ical line endings. - -====================== -Version 7.x-3.0-alpha2 -====================== - -NOTES: -The links at the top of the calendar page have been reworked into tabs. They will not show up -until you clear the caches. Use hook_calendar_links_alter() to alter the links or the titles -or to empty the links array if you don't want to see them. - -- Issue #1302052 by benjifisher, penguin25, and helmo, Fix linespace ending problems in ical files. -- Issue #704068, Avoid undefined variable error by not returning a value we don't even need. -- Issue #1388364, Do some clean up of the handling for taxonomy stripes. -- Issue #1303458. Make sure calendar tabs work right without clean urls. -- Issue #1270538, Fix notice for missing index 'access'. -- Issue #1259870, Reinstate the test for a missing date argument for the pager and add to the message a warning that the problem could be that the default date is missing from the argument. -- Issue #1305938 by kristiaanvandeneynde and KarenS, Make sure the overlapping items work correctly with half hour grouping, and don't allow it for custom time groupings. -- Issue #1259992 by jlyon, slerby, and KarenS, The maximum items processing was not working right. -- Issue #1260380, Some items showing up in wrong time periods because wrong value is used to create the start date bucket. -- Issue #1292148, Make scrolling in day and week view optional. -- Issue #462748, Make sure calendar links can be deleted as well as created. -- Issue #1301734 by Danny_Joris, Do not show any links to disabled displays. -- Issue #1383782 by googletorp, Check if module_exists('taxonomy') before creating taxonomy strip options. -- Issue #1235344 by kenianbei, Make sure items don't overlap if they start and end on the same times. -- Issue #1323280 by mshepherd, Remove time from time headers. -- Issue #1322376 by mshepherd, Remove space between hour and am/pm in day and week views. -- Issue #1230500, The calendar row logic was failing if there was more than one date field in a node due to a bad return value. Also fixed some errors caused by not returning an empty array for missing values. -- Issue #1236610, Allow the calendar style to work with any row plugin that extends the calendar_row_plugin. -- Issue #1265590, The calendar tabs were not showing up for everyone. -- Issue #1312792, Rework language handling for the calendar row plugin. -- Issue #1315328, Default calendar had date arguments in the master, which affected the upcoming view. -- Issue #1268780 by drewkeller, $part_path in calendar_preprocess_date_views_pager() seems to be incorrect when base_path() is '/' -- Issue #1235180 by marleythedog, Fix broken taxonomy stripe handling in calendar row plugin. -- Issue #704068, Add OG stripe option to calendar row plugin. -- Issue #1265590, Fix syntax error in calendar-style-ical.tpl.php. -- Issue #1265616, Rework the calendar display links into tabs and the Add link into an action item, and add hook_calendar_links_alter(). -- Add static to calendar_granularity_path() to speed up processing. -- Issue #1264974 by hdcwebteam, Fix parse error in latest ical. -- Issue #1261478 by stevector and KarenS, Reconfigure the back/next buttons into item lists so Views ajax pager works right. -- Issue #1238568, Add more checks to bail gracefully when a date argument is missing. -- Issue #1254932 by larsdesigns, Invalid CSS Property in calendar_multiday.css -- Issue #1254922 by larsdesigns, calendar_multiday.css is not complient with Drupal Coding Standards -- Issue #1254920 by larsdesigns, calendar.css is not complient with Drupal Coding Standards -- Issue #1254916 by larsdesigns, calendar-overlap.css is not complient with Drupal Coding Standards -- Add update hook to remove old style calendar legend blocks from system. -- Issue #742146, Add option to remove X-WR-CALNAME if VEVENT is not a feed. -- Add option to change method from PUBLISH to REQUEST in VCALENDAR. -- Issue #1087798 by anj, Fix X-WR-CALNAME in VCALENDAR. -- Add new 'is_field' flag to tell when we're working with a Field field. -- Issue #1232258 Fix the option to group items by a field value in the day view. -- The Link back to the calendar on the date node got lost in the latest rework. Add it back. -- The Add+ link got lost when we switched to using a row plugin. Add it back. -- Fix typo in ical path, it should be .ics, not .cal. -- Fix master calendar display, it was missing the contextual filter. - -====================== -Version 7.x-3.0-alpha1 -====================== - -Initial release of 7.3 branch. - -Starting new branch with a total rework of Calendar, using a Views pager plugin for the back/next navigation, -a row plugin to explode the view results into calendar day items, and a style plugin to disply the results in a calendar. - -- Get colorpicker working again with an assist from the Examples module Field example. -- Issue #1227128 The ical feed needs to have a '.ics' extension on it. -- The ical icon was not attaching to block views. -- The row plugin needs to clone the node before altering it, or other views on the same page that use the same node will acquire things like the 'date_id' that the row plugin is setting. -- Issue #1222770 Lighten the color of the date in month 'overflow' days so it is clearer that they are out of scope for the view. -- Issue #1223500 Fix the day link in the year view to point to the day view rather than the year view. -- Add the date sort field to the default view so upcoming events sort correctly. -- Change the default setting for the day view and make sure that the style does not try to create overlap items if it is missing the groupby value (which the default view was doing.) -- Issue #1168672 Temporary workaround for missing date info in calendar style. Still need a smarter fix. -- Issue #1222736 Fix export errors caused when previous export fix of using export plugins got broken by changes in Views. -- Set default day view to use agenda style. -- Add back calendar_remove() function used by Date Tools to remove default calendars. -- Re-arrange the default view so the month is first. -- Fix granularity setting in row so it works right for both field dates and system dates. -- Fix broken ical field options field. -- Fix broken ical icon. -- Adding a calendar-links class to make theming easier. -- Fix broken day overlap theme template. -- Fix some granularity handling, note that all calendar row plugins must provide a date_id value. -- Swap in a light yellow for the peach background color. -- Issue #1207392 Set Set the default value for date_first_day to 0 to conform with the core default value. -- Note that the row plugin will need adjustment if the date is coming in through a relationship. -- Fix broken logic for determining the field name, didn't work right when looking for value2. -- Add a template for the item view, split the row processing out into the basic processing and a separate function for exploding a single item into the multiple values that may be needed in a calendar. -- Issue #1161632 Rework the logic for creating striping based on taxonomy. -- Rename the item class holder and shift responsibility for the item class to the style plugin. -- Add class needed for overlap backgrounds. -- Issue #1220346 Add if module_exists('calendar_ical') to the ical part of the default view. -- Issue #1220376 Code wasn't correctly identifying fields that didn't use delta. -- Get rid of notice about wrong value for content type. -- Remove display extender, we're not going to use that. -- Add a theme for the calendar field display to make it easier to override. -- Add new calendar view that uses all these new handlers and plugins. Anything using the default view will have to be reverted to pick up these changes. -- Make sure that all items have an id, even if not fields. -- Set up the calendar to display field values rather than the node view. -- More tweaks to the calendar display links, we can't use pager links for those or the base argument is structured incorrectly for our pager's attempt to swap new values in. Also found some more references to that needed to be switched to ->curday. -- Get the mini month displaying the links for days with events. -- Add some validation to the style plugin. Prevent the invalid combination of overlapping items and missing groupby times. That creates an endless fatal loop. -- All day rows need to have rendered content in them. -- Make sure that the month names in the year view link to the month, not the year, display. -- Fix the legend block and a wrong name in the ical class. -- Make sure each of the links use the right pager identifier. -- Rework the year view to manage the month titles better. -- Add missing view info in ical theme. -- Add calendar links and style them better. -- Move the stripe options and functions into the row plugin, they are all specific to the content type, so they belong there rather than in the style. -- Clean up mini calendar processing, start to add the stripe handling back in. -- Add in the overlap templates needed for the multiday display. -- More rework of calendar into a row plugin, a style plugin, and a pager plugin. -- Start the process of reworking the main calendar to use row plugins to massage the nodes and style plugins to disply the calendar. - -=================== -Version 7.x-2.x-dev -=================== - -There will probably be no more releases on this branch. We will switch to the 7.3 branch as soon as it is more stable. - -====================== -Version 7.x-2.0-alpha2 -====================== - -- Issue #1188688 by TommyChris, Fix incorrectly-named view object in calendar_plugin_style_ical.inc. -- Issue #1110012 Remove 'parent' items from Views plugins, no longer needed? See if this fixes the issue. -- Issue #1161844 by AntoineSolutions, Use the same switch for Multiday as for the standard calendar when processing year view. -- Issue #1114730 by jomski, PHP 5.3 requires that we initialize the $items array in template_preprocess_calendar(). -- The delta value was not being computed or added correctly. -- Issue #1137538, by westbywest: Fix incorrect value for 'delta' in calendar_plugin_style.inc. - -====================== -Version 7.x-2.0-alpha1 -====================== - -- Issue #1137538 Views renamed 'wildcard' to 'exception'. -- Issue #1135064 by Niremizov and KarenS, Don't try to get ui_name() before handler is initialized to avoid fatal errors when editing settings. -- Add date fields to the calendar view so we can process them normally. -- More cleanup of ical, by ankur and KarenS. -- Issue #1096224 Make sure we don't get notice on views that have no rendered fields. -- Issue #1087528 by thekevinday and KarenS, clean up ical handling. -- A little reorganization to get a shared function out of theme.inc. -- Rework calendar node processing to use ->style_plugin->render_fields() instead of trying to render them individually. Probably still some work to do on this change, but it cleans things up and prevents accidentally tromping on other fields in the view. -- Moved a variable we still need in the navigation, move it back. -- Issue #1130966, re-organize the theme processing so it the day and week views work right in the new Views preview pane. -- Issue #1119752 by cezaryrk, Eliminate Views token handling errors when manually theming calendar items. -- Views renamed 'wildcard' to 'exception'. -- Fix references to the 'date_argument' argument, it now might also be the simple argument as well. -- Fix reference to function that was renamed in Date module. -- Fix another reference to node type. -- Get rid of notices from not trying to force ->type into the calendar. -- Issue #1098916 by arlinsandbulte: Delete master branch -- #1084366 by developer-x - Set the default value for date_first_day to 1 -- Some calendar settings were getting lost in export/clone. -- #1043856 Needed to copy changes made to theme.inc to multiday/theme.inc. -- #582940 by mcpuddin - Nonexistant "First day of week" causes weekday offset in the calendar. -- Fix header layout. -- Fix minor styling issues. -- #998824 - For multiday layout, default to overlapping styles unless otherwise specified -- #1032774 On multiday layout, the week display had a border missing in the all-day row - -====================== -Version 7.x-1.0-dev -====================== - -Abandoned the 7.x-1.x branch. - -Start a new 7.x-2.x branch that will contain a complete re-work of the Views handling. - -The 7.x-2.x branch will totally re-work and simplify the Views filters. These changes may/will -break some views and will require that you check views that use the date filter or -argument to be sure they are still configured correctly. - -There is a new date_filter_handler_simple for an individual date field that simplifies -the Views handling by using most of the core Views field handling but adds in the -possibility to set a default date using options like 'now', along with a choice of a -month/day/year drop-down selector or popup calendar selector. - -The date_filter_handler is an extension of the simple handler that allows you to combine -multiple dates into a single filter so that you can control all of them with the same -filter widget, allowing you to either 'OR' or 'AND' them together. - -The arguments will be rewritten in the same way, with a simple argument handler for -individual dates and another handler that extends that to control multiple dates with -a single argument. - -======================= -Version 7.x-1.0-alpha3 -======================= - -Argh! Fixing the field handling broke the handling for system dates. Try again. - -======================= -Version 7.x-1.0-alpha2 -======================= - -Views made lots of changes to field handling just before the new release, which broke lots of things here. -Adding some work-arounds to get things working again and waiting until the dust settles on how the new core fields will be handled in Views before doing much more with the Views integration. These changes should get things working with latest Views release. - -======================= -Version 7.x-1.0-alpha1 -======================= - -Initial release, probably still buggy. diff --git a/web/modules/calendar/README.md b/web/modules/calendar/README.md deleted file mode 100644 index 20d7d01c3beb991abc584cb4409d5f420cd893bb..0000000000000000000000000000000000000000 --- a/web/modules/calendar/README.md +++ /dev/null @@ -1,55 +0,0 @@ -# Drupal Calendar 8.x - -## Introduction - -The calendar module makes it possible to create calendars with views, based on -date fields on nodes and taxonomy terms. - -## Simple setup - -The easiest way to set up a calendar is by using the "add from template" -functionality provided by the Views Templates module. After enabling the module -and clearing the cache, a link "add from template" should appear on the views -overview page. This should list the different options to create a calendar -based on core fields (created and updated) or any other custom defined date -field. - -## Currently unsupported - -Due to limitations of the core DateTime module, and the lack of a contrib Date -module, some functionality is not available at this point. These include, but -are not limited to: - -- end date support -- repeating date support -- Organic Groups support - -Support for these will be added once they are made available through core -updates, a D8 version of the date module or stand-alone D8 modules. - -## CACHING & PERFORMANCE - -Calendars are very time-consuming to process, so caching is recommended. -You can set up caching options for your calendar in the Advanced section -of the View settings. Even setting a lifetime of 1 hour will provide some -benefits if you can live with a calendar that is 1 hour out of date. -Set the lifetime to the longest value possible. You will need to clear -the caches manually or using custom code if the content of the calendar -changes before the cache lifetime expires. - -The recommended settings for time-based caching are: -// @todo Update for 8.x Views cache settings -- Query results -Cache the query only when not using ajax. Do not cache the query -on any display that uses ajax for its results. - -- Rendered output: -Always try to cache rendered output. Rendering the output is the most -time-consuming part of building a calendar. This is especially -important for the Year view, less important for the Day view. - -As with all caching options, please test to be sure that caching -is working as desired. - -If performance is a problem, or you have a lot of items in the calendar, -you may want to remove the Year view completely. diff --git a/web/modules/calendar/calendar.info.yml b/web/modules/calendar/calendar.info.yml deleted file mode 100644 index 0adf63b2c24596c1e5dfa37e351224f97b7f3255..0000000000000000000000000000000000000000 --- a/web/modules/calendar/calendar.info.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: Calendar -type: module -description: 'Provides a Views plugin to display views containing dates as Calendars.' -dependencies: - - calendar_datetime - - views - - views_templates -package: Date/Time -core: 8.x -configure: 'calendar.admin_form' diff --git a/web/modules/calendar/calendar.libraries.yml b/web/modules/calendar/calendar.libraries.yml deleted file mode 100644 index fc5f265e33368845b95cc8a5e68285a277142d3d..0000000000000000000000000000000000000000 --- a/web/modules/calendar/calendar.libraries.yml +++ /dev/null @@ -1,32 +0,0 @@ -calendar.colorpicker: - version: VERSION - js: - js/calendar_colorpicker.js: {} - dependencies: - - core/jquery.farbtastic - -calendar.overlapjs: - version: 1.x - js: - js/calendar_overlap.js: {} - dependencies: - - core/jquery - -calendar.overlapcss: - version: 1.x - css: - theme: - css/calendar-overlap.css: {} - -calendar.noscroll: - version: VERSION - css: - theme: - css/calendar-overlap-no-scroll.css: {} - -calendar.theme: - version: VERSION - css: - theme: - css/calendar.css: {} - css/calendar_multiday.css: {} diff --git a/web/modules/calendar/calendar.links.menu.yml b/web/modules/calendar/calendar.links.menu.yml deleted file mode 100644 index 0e7ea5517ab8da1053c10cef9cffd9bf238eab56..0000000000000000000000000000000000000000 --- a/web/modules/calendar/calendar.links.menu.yml +++ /dev/null @@ -1,9 +0,0 @@ -calendar.admin_index: - title: 'Calendar' - parent: system.admin_config - route_name: calendar.admin_index - -calendar.admin_form: - title: 'Calendar administration' - parent: calendar.admin_index - route_name: calendar.admin_form diff --git a/web/modules/calendar/calendar.module b/web/modules/calendar/calendar.module deleted file mode 100644 index 3697935f7841075b418ccd07944119fae7db7574..0000000000000000000000000000000000000000 --- a/web/modules/calendar/calendar.module +++ /dev/null @@ -1,262 +0,0 @@ -<?php - -/** - * @file - * This is the Calendar module for calendar filtering and display in views. - */ - -use Drupal\Core\Url; -use Drupal\views\ViewExecutable; -use Drupal\Core\Routing\RouteMatchInterface; -use Drupal\calendar\CalendarHelper; -define('CALENDAR_SHOW_ALL', 0); -define('CALENDAR_HIDE_ALL', -1); -define('CALENDAR_EMPTY_STRIPE', '#ffffff'); - -/** - * Implements hook_page_attachments(). - */ -function calendar_page_attachments(array &$page) { - $page['#attached']['library'][] = 'calendar/calendar.theme'; -} - -/** - * Implements hook_date_default_argument_alter(). - * - * Adjust the default date for a view based on the stored session value. This is - * used for current date tracking. - * - * @todo Is this still necessary? - */ -function calendar_date_default_argument_alter(&$argument, &$value) { - $user = \Drupal::currentUser(); - $style_options = $argument->view->display_handler->get_option('style_options'); - $tracking = \Drupal::config('calendar.settings')->get('calendar_track_date'); - if (!empty($tracking) && ($tracking == 2 || !empty($user->uid))) { - - // If this is a default date, i.e. we are visiting a new calendar display, - // set the default date for the display. See if we already have a session - // date to use. If so, use it. Otherwise the default is the current date. - if (!empty($_SESSION[$argument->view->name]['default_date'])) { - $default_date = $_SESSION[$argument->view->name]['default_date']; - } - else { - $default_date = date_now(); - $_SESSION[$argument->view->name]['default_date'] = $default_date; - } - // Get the current date from the session. - $value = $default_date->format($argument->arg_format); - } -} - -/** - * Implements hook_views_pre_render(). - */ -function calendar_views_pre_render(ViewExecutable $view) { - _calendar_views_track_current_date($view); -} - - - -/** - * Track the current date as the user moves from calendar display to calendar - * display. - * - * @param \Drupal\views\ViewExecutable $view - * - * @return \Drupal\views\Plugin\views\argument\ArgumentPluginBase - */ -function _calendar_views_track_current_date(ViewExecutable $view) { - $user = \Drupal::currentUser(); - - $tracking = \Drupal::config('calendar.settings')->get('calendar_track_date'); - if (!empty($tracking) && ($tracking == 2 || !empty($user->uid))) { - foreach ($view->argument as $id => &$argument) { - - // If this is not a default date, i.e. we have browsed to a new calendar - // period on a display we were already on, store the midpoint of the current - // view as the current date in a session. - if ($argument instanceof \Drupal\calendar\Plugin\views\argument\CalendarDate && empty($argument->is_default)) { - $date_range = $argument->date_handler->arg_range($argument->argument); - $session_date = $date_range[0]; - $days = intval(($date_range[1]->format('U') - $date_range[0]->format('U')) / 3600 / 24 / 2); - date_modify($session_date, "+$days days"); - $_SESSION[$view->name]['default_date'] = $session_date; - } - } - } -} - -/** - * Implementation of hook_help(). - */ -function calendar_help($route_name, RouteMatchInterface $route_match) { - switch ($route_name) { - case 'help.page.calendar': - return '<p>' . t('View complete documentation at <a href=":link">Date and Calendar Documentation</a>.', - [':link' => 'http://drupal.org/node/262062']) . '</p>'; - } -} - -/** - * Implements hook_theme(). - */ -function calendar_theme() { - return [ - 'calendar_mini' => [ - 'variables' => ['view' => NULL, 'options' => [], 'rows' => []], - ], - 'calendar_month_multiple_entity' => [ - 'variables' => ['curday' => NULL, 'count' => NULL, 'view' => NULL, 'ids' => NULL], - ], - 'calendar_datebox' => [ - 'variables' => ['date' => NULL, 'view' => NULL, 'items' => NULL, 'selected' => NULL], - 'file' => 'calendar.theme.inc', - ], - 'calendar_empty_day' => [ - 'variables' => ['curday' => NULL, 'view' => NULL], - ], - 'calendar_month_col' => [ - 'variables' => ['item' => NULL], - ], - 'calendar_month_row' => [ - 'variables' => ['inner' => NULL, 'class' => NULL, 'iehint' => NULL], - ], - 'calendar_day' => [ - 'variables' => ['view' => NULL, 'options' => [], 'rows' => [],], - 'file' => 'calendar.theme.inc', - ], - 'calendar_month' => [ - 'variables' => ['view' => NULL, 'options' => [], 'rows' => []], - 'file' => 'calendar.theme.inc', - ], - 'calendar_stripe_legend' => [ - 'variables' => ['view_and_display_id' => NULL, 'title' => NULL], - ], - 'calendar_item' => [ - 'variables' => ['view' => NULL, 'rendered_fields' => NULL, 'item' => NULL], - 'file' => 'calendar.theme.inc', - ], - 'calendar_week' => [ - 'variables' => ['view' => NULL, 'day_names' => [], 'rows' => [],], - 'file' => 'calendar.theme.inc', - ], - 'calendar_week_overlap' => [ - 'variables' => ['view' => NULL, 'day_names' => [], 'rows' => [],], - 'file' => 'calendar.theme.inc', - ], - 'calendar_day_overlap' => [ - 'variables' => ['view' => NULL, 'options' => [], 'rows' => [],], - 'file' => 'calendar.theme.inc', - ], - 'calendar_year' => [ - 'variables' => ['view' => NULL, 'rows' => [], 'options' => [], 'months' => [], 'mini' => FALSE,], - 'file' => 'calendar.theme.inc', - ], - 'calendar_header' => [ - 'variables' => - [ - 'view' => NULL, - 'options' => [], - 'title' => '', - 'empty' => FALSE, - 'granularity' => NULL, - ], - 'file' => 'calendar.theme.inc', - ], - 'calendar_time_row_heading' => [ - 'variables' => [ - 'start_time' => NULL, - 'next_start_time' => NULL, - 'curday_date' => NULL - ], - ], - 'calendar_pager' => [ - 'variables' => [ - 'parameters' => [], - 'items' => [], - 'exclude' => FALSE, - ], - ], - - ]; -} - -/** - * Default settings array for calendar time grouping. - */ -function calendar_groupby_times($type = '') { - $times = []; - switch ($type) { - case 'hour': - for ($i = 0; $i <= 23; $i++) { - $times[] = \Drupal\Component\Datetime\DateTimePlus::datePad($i) . ':00:00'; - } - break; - case 'half': - for ($i = 0; $i <= 23; $i++) { - $times[] = \Drupal\Component\Datetime\DateTimePlus::datePad($i) . ':00:00'; - $times[] = \Drupal\Component\Datetime\DateTimePlus::datePad($i) . ':30:00'; - } - break; - default: - break; - } - return $times; -} - -/** - * Find the path for the calendar display that has a specific granularity. - * - * @param \Drupal\views\ViewExecutable $view - * The current view. - * @param string $granularity - * The granularity to find. - * - * @return string - * The path for the specific granularity, or an empty string if none was - * found. - * - * @deprecated use \Drupal\calendar\CalendarHelper::getURLForGranularity instead. - */ -function calendar_granularity_path(ViewExecutable &$view, $granularity) { - // @todo Find out what should happen here. - $paths = &drupal_static(__FUNCTION__, []); - $view_name = $view->id(); - if (!array_key_exists($view_name, $paths) || (isset($paths[$view->id()]) && !(array_key_exists($granularity, $paths[$view->id()])))) { - $paths[$view_name][$granularity] = ''; - - foreach ($view->displayHandlers->getConfiguration() as $id => $display) { - // Check for !empty() in case the view is not fully formed or has displays that are marked to be deleted - // @todo handle deleted displays -// if (!empty($display->deleted) || empty($display->display_options['style_plugin']) || (isset($display->display_options['enabled']) && $display->display_options['enabled'] == FALSE)) { -// continue; -// } - - if ($display['display_plugin'] != 'feed' && !empty($display['display_options']['path']) && !empty($display['display_options']['arguments'])) { - - // Set to the default value, reset below if another value is found. - $type = 'month'; - $argument = CalendarHelper::getDateArgumentHandler($view, $id); - - if ($argument->getGranularity() == $granularity) { - $part_path = $display['display_options']['path']; - $parts = explode('/', $part_path); - if (in_array('%', $parts)) { - $url = Url::fromRoute('<current>'); - $current_path = $url->toString(); - $current_parts = explode('/', $current_path); - foreach ($parts as $key => $part) { - if ($part == '%' && !empty($current_parts[$key])) { - $parts[$key] = $current_parts[$key]; - } - } - $part_path = implode('/', $parts); - } - $paths[$view->id()][$granularity] = $part_path; - } - } - } - } - return $paths[$view->id()][$granularity]; -} diff --git a/web/modules/calendar/calendar.permissions.yml b/web/modules/calendar/calendar.permissions.yml deleted file mode 100644 index c9d9bfd905e5ad4e5394ec0f419c2b9faf8999c0..0000000000000000000000000000000000000000 --- a/web/modules/calendar/calendar.permissions.yml +++ /dev/null @@ -1,2 +0,0 @@ -administer calendar settings: - title: 'Administer calendar settings' diff --git a/web/modules/calendar/calendar.routing.yml b/web/modules/calendar/calendar.routing.yml deleted file mode 100644 index 09d1a15a3b857c23173e3e044a591ea0d5a52189..0000000000000000000000000000000000000000 --- a/web/modules/calendar/calendar.routing.yml +++ /dev/null @@ -1,15 +0,0 @@ -calendar.admin_index: - path: '/admin/config/date' - defaults: - _controller: '\Drupal\system\Controller\SystemController::systemAdminMenuBlockPage' - _title: 'Calendar' - requirements: - _permission: 'access administration pages' - -calendar.admin_form: - path: '/admin/config/date/calendar' - defaults: - _form: '\Drupal\calendar\Form\CalendarSettingsForm' - _title: 'Calendar administration' - requirements: - _permission: 'administer calendar settings' diff --git a/web/modules/calendar/calendar.services.yml b/web/modules/calendar/calendar.services.yml deleted file mode 100644 index a65106779bd17d0c54669830ed44995f1432a9a2..0000000000000000000000000000000000000000 --- a/web/modules/calendar/calendar.services.yml +++ /dev/null @@ -1,6 +0,0 @@ -services: - calendar.twig.extension: - class: Drupal\calendar\Template\TwigExtension - arguments: ['@renderer'] - tags: - - { name: twig.extension, priority: 100 } diff --git a/web/modules/calendar/calendar.theme.inc b/web/modules/calendar/calendar.theme.inc deleted file mode 100644 index f00cd8719b002aa96f403c5efc2fc1449ae05763..0000000000000000000000000000000000000000 --- a/web/modules/calendar/calendar.theme.inc +++ /dev/null @@ -1,893 +0,0 @@ -<?php - -/** - * @file - * Theme functions for the Calendar module. - */ -use Drupal\calendar\CalendarHelper; -use Drupal\Component\Datetime\DateTimePlus; -use Drupal\Core\Datetime\Entity\DateFormat; -use Drupal\views\Views; -use Drupal\Core\Link; - -/** - * Display a month view. - */ -function template_preprocess_calendar_month(&$vars) { - $view = $vars['view']; - $rows = $vars['rows']; - if (empty($rows)) { - $rows = []; - $day_names = []; - } - elseif (sizeof($rows) > 1) { - $day_names = array_shift($rows); - } - else { - $day_names = $rows; - $rows = []; - } - - $month_rows = $rows; - foreach ($rows as $weekno => $row) { - // If this row is already rendered, don't do anything. - if (!isset($row['data'])) { - foreach ($row as $day => $data) { - $cell = $data['data']; - - // If this cell is already rendered, like the weekno column, - // move to the next item. - if (!is_array($cell)) { - $month_rows[$weekno][$day]['data'] = $cell; - continue; - } - $data = $cell['datebox']; - if ($cell['empty']) { - $data .= $cell['empty']; - } - else { - $data .= implode($cell['all_day']); - foreach ($cell['items'] as $hour => $item) { - $data .= implode($item); - } - $data .= $cell['link']; - } - if ($view->styleInfo->isMini()) { - $month_rows[$weekno][$day]['data'] = $data; - } - else { - $month_rows[$weekno][$day]['data'] = '<div class="inner">' . $data . '</div>'; - } - } - } - } - - $vars['rows'] = $month_rows; - $vars['day_names'] = $day_names; - - $vars['display_type'] = $view->dateInfo->getGranularity(); - $vars['min_date_formatted'] = $view->dateInfo->getMinDate()->format(DATETIME_DATE_STORAGE_FORMAT); - $vars['max_date_formatted'] = $view->dateInfo->getMaxDate()->format(DATETIME_DATE_STORAGE_FORMAT); -} - -/** - * Display a mini month view. - */ -function template_preprocess_calendar_mini(&$vars) { - // Add in all the $vars added by the main calendar preprocessor. - template_preprocess_calendar_month($vars); - - $view = $vars['view']; - - // Make sure that the calendar title links go to the month view, - // not the year view (if this is embedded in a year display). - $view->override_path = calendar_granularity_path($view, 'month'); - - $view->date_info->show_title = !empty($view->date_info->show_title) ? $view->date_info->show_title : FALSE; - $vars['show_title'] = $view->date_info->show_title; - $vars['view'] = $view; -} - -/** - * Display a year view. - */ -function template_preprocess_calendar_year(&$vars) { - - // Construct a calendar for each month, adjusting the $view passed to the - // theme so it will produce the right results. - $view = clone($vars['view']); - $year = $view->dateInfo->getMinDate()->format('Y'); - $view->styleInfo->setShowWeekNumbers(FALSE); - $rows = $vars['rows']; - $months = []; - foreach ($rows as $month => $month_rows) { - // Set the month name. - $month_format = ($vars['options']['month_name_size'] == 1) ? "M" : "F"; - $vars['options']['month_name'] = t(date($month_format, mktime(0, 0, 0, $month, 10))); - - $view->dateInfo->setMinMonth($month); - $view->dateInfo->setGranularity('month'); - $view->styleInfo->setMini(TRUE); - $view->styleInfo->setShowNavigation(FALSE); - $view->styleInfo->setShowTitle(TRUE); - // TODO implement -// $view->dateInfo->url = date_pager_url($view, NULL, \Drupal\Component\Datetime\DateTimePlus::datePad($year, 4) . '-' . \Drupal\Component\Datetime\DateTimePlus::datePad($month)); - // TODO handle timezone - $view->dateInfo->setMinDate(new DateTime($view->dateInfo->getMinYear() . '-' . DateTimePlus::datePad($month) . '-01 00:00:00', new DateTimeZone('europe/brussels'))); - $maxDate = clone($view->dateInfo->getMinDate()); - $maxDate->modify('+1 month'); - $maxDate->modify('-1 second'); - $view->dateInfo->setMaxDate($maxDate); - $months[$month] = [ - '#theme' => 'calendar_mini', - '#view' => $view, - '#options' => $vars['options'], - '#rows' => $month_rows, - ]; - } - $view->styleInfo->setMini(FALSE); - - $vars['months'] = $months; - $vars['view']->styleInfo->setShowNavigation(TRUE); - $vars['view']->dateInfo->setGranularity('year'); - $vars['mini'] = FALSE; - -} - -/** - * Display a day overlap view. - */ -function template_preprocess_calendar_day_overlap(&$vars) { - template_preprocess_calendar_day($vars); -} - -/** - * Display a day view. - */ -function template_preprocess_calendar_day(&$vars) { - $vars['view']->styleInfo->setShowWeekNumbers(FALSE); - $view = $vars['view']; - $rows = $vars['rows']; - - $item_count = 0; - $by_hour_count = 0; - /** @var \Drupal\calendar\CalendarStyleInfo $styleInfo */ - $styleInfo = $view->styleInfo; - $grouping_field = !empty($styleInfo->getCustomGroupByField()) ? ($styleInfo->getCustomGroupByField()) : NULL; - $display_overlap = !empty($styleInfo->getThemeStyle()) && !empty($styleInfo->getGroupByTimes()); - $vars['scroll_content'] = !empty($styleInfo->getThemeStyle()) && $styleInfo->getThemeStyle() == 1; - - if ($display_overlap) { - $overlapped_items = []; - $vars['#attached']['library'][] = 'calendar/calendar.overlapcss'; - if ((empty($vars['view']->live_preview) || !$vars['view']->live_preview) && !empty($vars['scroll_content'])) { - $vars['#attached']['library'][] = 'calendar/calendar.overlapjs'; - } - if (empty($vars['scroll_content'])) { - $vars['#attached']['library'][] = 'calendar/calendar.noscroll'; - } - } - - // If we're not grouping by time, move all items into the 'all day' array. - if (empty($view->styleInfo->getGroupByTimes())) { - // Items are already grouped into times, so we need to process each time-group. - foreach ($rows['items'] as $time => $items) { - foreach ($items as $item) { - $rows['all_day'][] = $item; - } - } - $rows['items'] = []; - } - - $columns = []; - - // Move all_day items into the right columns and render them. - $grouped_items = []; - foreach ($rows['all_day'] as $item) { - if (!empty($item->rendered_fields[$grouping_field])) { - $column = $item->rendered_fields[$grouping_field]; - if (!in_array($column, $columns)) { - $columns[] = $column; - } - } - else { - $column = 'Items'; - } - - $grouped_items[$column][] = [ - '#theme' => 'calendar_item', - '#view' => $view, - '#rendered_fields' => $item->getRenderedFields(), - '#item' => $item, - ]; - $item_count++; - } - $vars['rows']['all_day'] = $grouped_items; - - // Moved timed items into the right columns and render them. - $start_times = $view->styleInfo->getGroupByTimes(); - $show_empty_times = $view->styleInfo->isShowEmptyTimes(); - $end_start_time = '23:59:59'; - $start_time = array_shift($start_times); - $next_start_time = count($start_times) ? array_shift($start_times) : $end_start_time; - - $grouped_items = []; - foreach ($rows['items'] as &$items) { - /** @var \Drupal\calendar\CalendarEvent $item */ - foreach ($items as &$item) { - $time = date_format($item->getStartDate(), 'H:i:s'); - if (!empty($item->rendered_fields[$grouping_field])) { - $column = $item->rendered_fields[$grouping_field]; - if (!in_array($column, $columns)) { - $columns[] = $column; - } - } - else { - $column = 'Items'; - } - // Find the next time slot and fill it. Populate the skipped - // slots if the option to show empty times was chosen. - while ($time >= $next_start_time && $time < $end_start_time) { - if ((!empty($show_empty_times) || $display_overlap) && !array_key_exists($start_time, $grouped_items)) { - $grouped_items[$start_time]['values'] = []; - } - $start_time = $next_start_time; - $next_start_time = count($start_times) ? array_shift($start_times) : $end_start_time; - } - $grouped_items[$start_time]['values'][$column][] = $item; - if ($display_overlap) { - $time_end = date_format($item->getEndDate(), 'H:i:s'); - $item->time_start = $time; - $item->time_end = $time_end; - _calc_indents($overlapped_items, $time, $time_end, $item); - } - $item_count++; - $by_hour_count++; - } - } - - // Finish out the day's time values if we want to see empty times. - if (!empty($show_empty_times) || $display_overlap) { - while ($start_time < $end_start_time && (!empty($start_time) || $display_overlap)) { - if (empty($start_time)) { - $start_times = $view->date_info->style_groupby_times; - $start_time = array_shift($start_times); - $next_start_time = array_shift($start_times); - } - if (!array_key_exists($start_time, $grouped_items)) { - $grouped_items[$start_time]['values'] = []; - } - $start_time = $next_start_time; - $next_start_time = count($start_times) ? array_shift($start_times) : $end_start_time; - } - } - - // Do the headers last, once we know what the actual values are. - $i = 0; - $start_times = array_keys($grouped_items); - foreach ($start_times as $start_time) { - $next_start_time = array_key_exists($i + 1, $start_times) ? $start_times[$i + 1] : '23:59:59'; - $variables = [ - 'start_time' => $start_time, - 'next_start_time' => $next_start_time, - 'curday_date' => $rows['#date'], - ]; - - $heading = template_preprocess_calendar_time_row_heading($variables); - - $grouped_items[$start_time]['hour'] = $heading['hour']; - $grouped_items[$start_time]['ampm'] = $heading['ampm']; - foreach ($grouped_items[$start_time]['values'] as $column => &$items) { - foreach ($items as $index => &$item) { - $group_time = NULL; - $divisor = NULL; - if ($display_overlap) { - if ($view->styleInfo->getGroupByTimes() == 'half') { - $group_time = 30; - $divisor = 7.5; - } - elseif ($view->styleInfo->getGroupByTimes() == 'hour') { - $group_time = 60; - $divisor = 15; - } - else { - $item->class = ''; - } - if (!empty($group_time) && !empty($divisor)) { - $start_minute = intval(substr($start_time, 3, 2)); - $offset = round((date_format($item->date_start, 'i') - $start_minute) / $divisor); - $duration = round(($item->date_end->format('U') - $item->date_start->format('U')) / 60 / $divisor); - $item->class = 'd_' . $duration . ' o_' . $offset . ' i_' . $item->indent . ' md_' . min($item->max_depth, 5); - } - } - - $grouped_items[$start_time]['values'][$column][$index] = [ - '#theme' => 'calendar_item', - '#view' => $view, - '#rendered_fields' => $item->getRenderedFields(), - '#item' => $item, - ]; - - } - } - $i++; - } - ksort($grouped_items); - $vars['rows']['items'] = $grouped_items; - - if (empty($columns)) { - $columns = ['Items']; - } - $vars['columns'] = $columns; - - $vars['agenda_hour_class'] = 'calendar-agenda-hour'; - $first_column_width = 10; - - if (empty($view->styleInfo->getCustomGroupByTimes())) { - $vars['agenda_hour_class'] .= ' calendar-agenda-no-hours'; - $first_column_width = 1; - } - - $vars['first_column_width'] = $first_column_width; - if (count($columns)) { - $vars['column_width'] = round((100 - $first_column_width)/count($columns)); - } - else { - $vars['column_width'] = (100 - $first_column_width); - } - $vars['item_count'] = $item_count; - $vars['by_hour_count'] = $by_hour_count; - $vars['start_times'] = $view->styleInfo->getGroupByTimes(); -} - -/** - * Display a week overlap view. - */ -function template_preprocess_calendar_week_overlap(&$vars) { - template_preprocess_calendar_week($vars); -} - -/** - * Display a week view. - */ -function template_preprocess_calendar_week(&$vars) { - $vars['view']->styleInfo->setShowWeekNumbers(FALSE); - - $view = $vars['view']; - $rows = $vars['rows']; - $item_count = 0; - $by_hour_count = 0; - $start_time = NULL; - $columns = []; - - if (sizeof($rows) > 1) { - $day_names = array_shift($rows); - } - else { - $day_names = $rows; - $rows = []; - } - - // Moved timed items into the right columns and render them. - $show_empty_times = $view->styleInfo->isShowEmptyTimes(); - $end_start_time = '23:59:59'; - - $grouped_items = []; - - // Pass the multiday buckets. - $vars['all_day'] = $rows['multiday_buckets']; - - // Remove the count for singleday - $vars['multiday_rows'] = max(0, $rows['total_rows'] - 1); - $display_overlap = ($view->styleInfo->getMultiDayTheme() == '1' && !empty($view->styleInfo->getThemeStyle())); - $vars['display_overlap'] = $display_overlap; - $vars['scroll_content'] = !empty($view->styleInfo->getThemeStyle()) && $view->styleInfo->getThemeStyle() == 1; - - // Add optional css - if ($display_overlap) { - - $vars['#attached']['library'][] = 'calendar/calendar.overlapcss'; - if ((empty($vars['view']->live_preview) || !$vars['view']->live_preview) && !empty($vars['scroll_content'])) { - $vars['#attached']['library'][] = 'calendar/calendar.overlapjs'; - } - if (empty($vars['scroll_content'])) { - $vars['#attached']['library'][] = 'calendar/calendar.noscroll'; - } - - $overlapped_items = [[], [], [], [], [], [], []]; - - // Locate the first item - $first_time = '23:59:59'; - $first_time_index = -1; - for ($i = 0; $i < 7; $i++) { - if (count($rows['singleday_buckets'][$i]) > 0) { - $time_slot = reset($rows['singleday_buckets'][$i]); - // TODO item should not be empty at this point, find out why empty days - // get to this point, fix that, and remove this hack - if (isset($time_slot[0]['item'])) { - $time = date_format($time_slot[0]['item']->getStartDate(), 'H:i:s'); - if ($time < $first_time) { - $first_time = $time; - $first_time_index = $i; - } - } - } - } - if ($first_time_index > -1) { - $rows['singleday_buckets'][$first_time_index][$first_time][0]['is_first'] = TRUE; - } - } - - // If we're not grouping by time, move all items into the 'all day' array. - if (empty($view->styleInfo->getGroupByTimes())) { - $add_row = FALSE; - foreach ($vars['all_day'] as $index => &$day ) { - foreach ($rows['singleday_buckets'][$index] as $item) { - foreach ($item as $event) { - $day[] = $event; - $add_row = TRUE; - } - } - } - if ($add_row) { - $vars['multiday_rows']++; - } - } - else { - foreach ($rows['singleday_buckets'] as $wday => $singleday_row) { - $columns[] = $wday; - foreach ($singleday_row as &$row) { - $start_times = $view->styleInfo->getGroupByTimes(); - $start_time = array_shift($start_times); - $next_start_time = count($start_times) ? array_shift($start_times) : $end_start_time; - foreach ($row as &$item) { - // todo find out how empty days should be handled properly - if ($item['entry']['#theme'] === 'calendar_empty_day') { - continue; - } - // todo find out what to do when the item is no event - if (!is_object($item['item'])) { - continue; - } - $time = date_format($item['item']->getStartDate(), 'H:i:s'); - - if ($item['item']->isAllDay()) { - $vars['all_day'][$item['wday']][] = $item; - if ($vars['multiday_rows'] == 0) { - $vars['multiday_rows']++; - } - } - else { - // Find the next time slot and fill it. Populate the skipped - // slots if the option to show empty times was chosen. - while ($time >= $next_start_time && $time < $end_start_time) { - if (($show_empty_times || $display_overlap) && !array_key_exists($start_time, $grouped_items)) { - $grouped_items[$start_time]['values'][$wday] = []; - } - $start_time = $next_start_time; - $next_start_time = count($start_times) ? array_shift($start_times) : $end_start_time; - } - $grouped_items[$start_time]['values'][$wday][] = &$item; - if ($display_overlap) { - $date_end = date_format($item['item']->getEndDate(), 'H:i:s'); - _calc_indents($overlapped_items[$wday], $time, $date_end, $item); - } - $item_count++; - $by_hour_count++; - } - } - } - // Finish out the day's time values if we want to see empty times. - if ($show_empty_times || $display_overlap) { - while ($start_time < $end_start_time && ($start_time != NULL || $display_overlap)) { - if ($start_time == NULL) { - $start_times = $view->styleInfo->getGroupByTimes(); - $start_time = array_shift($start_times); - $next_start_time = array_shift($start_times); - } - if (!array_key_exists($start_time, $grouped_items)) { - $grouped_items[$start_time]['values'][$wday] = []; - } - $start_time = $next_start_time; - $next_start_time = count($start_times) ? array_shift($start_times) : $end_start_time; - } - } - ksort($grouped_items); - } - } - - // Do the headers last, once we know what the actual values are. - $i = 0; - $start_times = array_keys($grouped_items); - foreach ($start_times as $start_time) { - $next_start_time = array_key_exists($i + 1, $start_times) ? $start_times[$i + 1] : '23:59:59'; - $variables = [ - 'start_time' => $start_time, - 'next_start_time' => $next_start_time, - 'curday_date' => (isset($row['data'])) ? $row['data']['date'] : NULL, - ]; - - $heading = template_preprocess_calendar_time_row_heading($variables); - - $grouped_items[$start_time]['hour'] = $heading['hour']; - $grouped_items[$start_time]['ampm'] = $heading['ampm']; - $grouped_items[$start_time]['time'] = $start_time; - if ($display_overlap) { - foreach ($grouped_items[$start_time]['values'] as $wday => &$items) { - foreach ($items as &$item) { - if ($display_overlap) { - $group_time = NULL; - $divisor = NULL; - if ($view->styleInfo->getGroupByTimes() == 'half'){ - $group_time = 30; - $divisor = 7.5; - } - elseif ($view->styleInfo->getGroupByTimes() == 'hour'){ - $group_time = 60; - $divisor = 15; - } - else { - $item['class'] = ''; - } - if (!empty($group_time) && !empty($divisor)) { - $start_minute = intval(substr($start_time, 3, 2)); - $offset = round((date_format($item['item']->date_start, 'i') - $start_minute) / $divisor); - $duration = round(($item['item']->date_end->format('U') - $item['item']->date_start->format('U')) / 60 / $divisor); - $item['class'] = 'd_' . $duration . ' o_' . $offset . ' i_' . $item['indent'] . ' md_' . min($item['max_depth'], 5); - } - } - } - } - } - } - - $vars['items'] = $grouped_items; - - $vars['day_names'] = $day_names; - $vars['columns'] = $columns; - $vars['start_times'] = $start_times; - $vars['first_time'] = !empty($first_time) ? $first_time : ''; - - $header_ids = []; - foreach ($day_names as $key => $value) { - $header_ids[$key] = $value['header_id']; - } - $vars['header_ids'] = $header_ids; - - $vars['agenda_hour_class'] = 'calendar-agenda-hour'; - $first_column_width = 10; - - if (empty($view->styleInfo->getCustomGroupByTimes())) { - $vars['agenda_hour_class'] .= ' calendar-agenda-no-hours'; - $first_column_width = 1; - } - $vars['item_count'] = $item_count; - $vars['by_hour_count'] = $by_hour_count; -} - -/** - * Implementation of hook_preprocess_calendar_item(). - */ -function template_preprocess_calendar_item(&$vars) { - // At the last possible minute we fix the values in rendered_fields so it - // contains the correct rendered content for the type of item and item display. - /** @var \Drupal\calendar\CalendarEvent $item */ - $item = $vars['item']; - - $multiday_hidden = !empty($vars['view']->style_options['multiday_hidden']) ? $vars['view']->style_options['multiday_hidden'] : []; - - if (!empty($item->getRenderedFields()) && empty($item->getIsMultiDay())) { - $vars['rendered_fields'] = [$item->getRenderedFields()]; - } - foreach ($vars['view']->field as $id => $field) { - foreach ($vars['rendered_fields'] as $index => &$render_array) { - - } - if ($field->options['exclude'] || (!empty($item->getIsMultiDay()) && in_array($id, $multiday_hidden))) { - unset($render_array[$field->field]); - } - } - -} - -/** - * Create the calendar date box. - */ -function template_preprocess_calendar_datebox(&$vars) { - $date = $vars['date']; - $view = $vars['view']; - $vars['day'] = intval(substr($date, 8, 2)); -// $force_view_url = !empty($view->dateInfo->block) ? TRUE : FALSE; - - $full_date_arg = str_replace('-', '', $date); - $day_url = CalendarHelper::getURLForGranularity($view, 'day', [$full_date_arg]); -// $vars['url'] = str_replace([$month_path, $year_path], $day_path, date_pager_url($view, NULL, $date, $force_view_url)); - if ($day_url) { - $vars['link'] = Link::fromTextAndUrl($vars['day'],$day_url)->toString(); - } - else { - $vars['link'] = $vars['day']; - } - - - - $vars['granularity'] = $view->dateInfo->getGranularity(); - $vars['mini'] = !empty($view->styleInfo->isMini()); - if ($vars['mini']) { - if (!empty($vars['selected'])) { - $vars['class'] = 'mini-day-on'; - } - else { - $vars['class'] = 'mini-day-off'; - } - } - else { - $vars['class'] = 'day'; - } -} - -/** - * Format an calendar month node for display. - */ -function template_preprocess_calendar_month_multiple_entity(&$vars) { - // @todo Fix when multiday events are supported again. - $view = $vars['view']; - $curday = $vars['curday']; - $count = $vars['count']; - $ids = $vars['ids']; - - // get the year month and date - $parts = explode('-', substr($curday, 0, 10)); - $year = $parts[0]; - $month = intval($parts[1]); - $day = intval($parts[2]); - - // create the link to the day - $month_path = calendar_granularity_path($view, 'month'); - $day_path = calendar_granularity_path($view, 'day'); - $vars['link'] = str_replace($month_path, $day_path, date_pager_url($view, NULL, \Drupal\Component\Datetime\DateTimePlus::datePad($year, 4) . '-' . \Drupal\Component\Datetime\DateTimePlus::datePad($month) . '-' . \Drupal\Component\Datetime\DateTimePlus::datePad($day))); -} - -/** - * Theme function for rendering views fields as a calendar 'item'. - * - * $vars['rendered_fields'] = An array of the rendered display of each field in the View. - * $vars['item'] = The source data for this item. - * $vars['view'] = The view that this item is displayed on. - * - * @TODO We need some options about how to combine rendered fields. - * Fields rendered in multiday containers need to be inline. - */ - -/** - * Format the time row headings in the week and day view. - * - * TODO find out if this should be helper function instead of a preprocessor - */ -function template_preprocess_calendar_time_row_heading($vars) { - $start_time = $vars['start_time']; - $next_start_time = $vars['next_start_time']; - $curday_date = $vars['curday_date']; - static $format_hour, $format_ampm; - if (empty($format_hour)) { - $format = DateFormat::load('short')->getPattern(); - if (substr($start_time, -5) == '00:00' && substr($next_start_time, -5) == '00:00') { - $limit = ['hour']; - } - else { - $limit = ['hour', 'minute']; - } - - $granularities = [ - 'year', - 'month', - 'day', - 'hour', - 'minute', - 'second', - 'timezone', - ]; - $reversedLimit = array_diff($granularities, $limit); - - $format_hour = str_replace(['a', 'A'], '', CalendarHelper::limitFormat($format, $reversedLimit)); - $format_ampm = strstr($format, 'a') ? 'a' : (strstr($format, 'A') ? 'A' : ''); - } - if ($start_time == '00:00:00' && $next_start_time == '23:59:59') { - $hour = t('All times'); - } - elseif ($start_time == '00:00:00') { - $date = date_create($curday_date . ' ' . $next_start_time); - $hour = t('Before @time', ['@time' => date_format($date, $format_hour)]); - } - else { - $date = date_create($curday_date . ' ' . $start_time); - $hour = date_format($date, $format_hour); - } - if (!empty($date)) { - $ampm = date_format($date, $format_ampm); - } - else { - $ampm = ''; - } - return ['hour' => $hour, 'ampm' => $ampm]; -} - -/** - * Format a node stripe legend. - * - * @param $vars array - * An array with variables. - * - * @return string - * The HTML output of the legend. - */ -function template_preprocess_calendar_stripe_legend(&$vars) { - - if (empty($vars) || !$view = $vars['view_and_display_id']) { - return ''; - } - - list($view_name, $display_id) = explode(':', $view); - - $view = Views::getView($view_name); - $view->setDisplay($display_id); - $row_options = $view->display_handler->getOption('row')['options']; - - $legend_type = $row_options['colors']['legend']; - $display_options = $row_options['colors']['calendar_colors_' . $legend_type]; - $options = []; - switch ($legend_type) { - - case 'type': - $options = node_type_get_names(); - break; - - // @todo handle taxonomy legends - case 'taxonomy': - $vocabularies = (array) $row_options['colors']['calendar_colors_vocabulary']; - $term_colors = $row_options['colors']['calendar_colors_taxonomy']; - foreach ($vocabularies as $field_name => $vid) { - $vocab = \Drupal::entityTypeManager()->getStorage("taxonomy_term")->loadTree($vid); - foreach ($vocab as $key => $term) { - $options[$term->tid] = $term->name; - } - } - break; - } - - $headers = [ - ['label' => t('Item')], - ['label' => t('Key')] - ]; - - $rows = []; - foreach ($options as $key => $label) { - $stripe = array_key_exists($key, $display_options) ? $display_options[$key] : CALENDAR_EMPTY_STRIPE; - if ($stripe != CALENDAR_EMPTY_STRIPE) { - $rows[] = [ - 'label' => $label, - 'stripe' => $stripe, - ]; - } - } - - if (!empty($rows)) { - $vars['headers'] = $headers; - $vars['rows'] = $rows; - } -} - -/** - * Indent items based off a nested tree structure of overlapping items. - * - * @param array $overlapped_items - * Tree of overlapped items - * @param date $start - * Start time of the event - * @param date $end - * End tiem of the event - * @param array $item - * The event to add to the tree - * @param int $depth - * Current depth of the tree - * @return rc - * Returns an array with the max depth of the branch and whether an overlap - * occurred. - */ -function _calc_indents(&$overlapped_items, $start, $end, &$item, $depth = 0) { - - // Are there any items at this depth? - if (!empty($overlapped_items)) { - - // Iterate for each item as this depth and see if we overlap - foreach ($overlapped_items as $index => &$entry) { - - // We search depth-first, so if there are children for this item, recurse into - // each child tree looking for an overlap - if (!empty($entry['children'])) { - $rc = _calc_indents($entry['children'], $start, $end, $item, $depth + 1); - - // Was there an overlap in the child tree? - if ($rc['overlap']) { - if (is_object($entry['item'])) { - $entry['item']->indent = _calc_indent($entry['depth'], $rc['max_depth']); - $entry['item']->max_depth = $rc['max_depth']; - } - else { - $entry['item']['indent'] = _calc_indent($entry['depth'], $rc['max_depth']); - $entry['item']['max_depth'] = $rc['max_depth']; - } - - // There was an overlap, pop out of this depth - return $rc; - } - } - // No, child overlap, so check if we overlap this item - if ($start >= $entry['start'] && $start < $entry['end']) { - - // We overlap, create an overlapping entry - $entry['children'][] = ['item' => &$item, 'depth' => $depth + 1, 'start' => $start, 'end' => $end, 'children' => []]; - if (is_object($entry['item'])) { - $max_depth = max($entry['item']->max_depth, $depth + 1); - $entry['item']->indent = _calc_indent($depth, $max_depth); - $entry['item']->max_depth = $max_depth; - } - else { - $max_depth = max($entry['item']['max_depth'], $depth + 1); - $entry['item']['indent'] = _calc_indent($depth, $max_depth); - $entry['item']['max_depth'] = $max_depth; - } - if (is_object($item)) { - $item->indent = _calc_indent($depth + 1, $max_depth); - $item->max_depth = $max_depth; - } - else { - $item['indent'] = _calc_indent($depth + 1, $max_depth); - $item['max_depth'] = $max_depth; - } - - // We overlap, so pop out of this depth - return ['overlap' => TRUE, 'max_depth' => $max_depth]; - } - } - - // If there are items at this depth, but no overlap, then return no overlap and pop - // out of this depth - if ($depth > 0) { - return ['overlap' => FALSE, 'max_depth' => 0]; - } - } - - // No overlap at any depth, reset the array of overlaps - if ($depth == 0) { - reset($overlapped_items); - $overlapped_items[0] = ['item' => &$item, 'depth' => $depth, 'start' => $start, 'end' => $end, 'children' => []]; - } - else { - $overlapped_items[] = ['item' => &$item, 'depth' => $depth, 'start' => $start, 'end' => $end, 'children' => []]; - } - - if (is_object($item)) { - $item->indent = _calc_indent($depth, $depth); - $item->max_depth = $depth; - } - else { - $item['indent'] = _calc_indent($depth, $depth); - $item['max_depth'] = $depth; - } - return ['overlap' => FALSE, 'max_depth' => $depth]; -} - -/** - * Calculates the indent based of the current depth and the depth of this branch - * in the tree. - * - * @param int $cur_depth - * @param int $depth - * @return number - */ -function _calc_indent( $cur_depth, $depth ) { - return round(10 * $cur_depth / ($depth + 1)); -} - -/** @} End of addtogroup themeable */ diff --git a/web/modules/calendar/calendar.views.inc b/web/modules/calendar/calendar.views.inc deleted file mode 100644 index 00bd2c4d713fe459b6b7ca1bdf3d90872daa53fc..0000000000000000000000000000000000000000 --- a/web/modules/calendar/calendar.views.inc +++ /dev/null @@ -1,92 +0,0 @@ -<?php - -/** - * @file - * Provides views data for the calendar module. - */ - -use Drupal\field\FieldStorageConfigInterface; - -/** - * Implements hook_views_data_alter(). - */ -function calendar_views_data_alter(array &$data) { - foreach ($data as $table_name => $table_data) { - foreach ($table_data as $property_name => $properties) { - if (isset($properties['argument']['id']) && $properties['argument']['id'] === 'date') { - $data[$table_name] += _calendar_create_field_arguments($property_name); - } - } - } - $data['views']['calendar_header'] = [ - 'title' => t('Calendar Header'), - 'help' => t('Calendar heading or pager.'), - 'area' => [ - 'id' => 'calendar_header', - ], - ]; - -} - -/** - * Create all the granularity arguments for a a field. - * - * @param $field_id - * @param string $group - * - * @return mixed - */ -function _calendar_create_field_arguments($field_id, $group = '') { - $granularity_args = []; - // All other granularity types are added by core. - $granularity_types = [ - 'year_week' => t('Date in the form of YYYYW'), - ]; - foreach ($granularity_types as $granularity_type => $granularity_label) { - - $granularity_arg = [ - 'title' => t('Calendar @name @granularity', ['@name' => $field_id, '@granularity' => $granularity_type]), - 'help' => t('A calendar contextual filter that handles @label.', ['@label' => $granularity_label]), - 'argument' => [ - 'field' => $field_id, - 'id' => 'date_' . $granularity_type, - ], - ]; - if ($group) { - $granularity_arg['group'] = $group; - } - $granularity_args[$field_id . '_' . $granularity_type] = $granularity_arg; - } - return $granularity_args; -} - -/** - * Implements hook_field_views_data_alter(). - */ -function calendar_field_views_data_alter(array &$data, FieldStorageConfigInterface $field_storage) { - foreach ($data as $table_name => $table_data) { - // Set the 'datetime' filter type. - if (isset($data[$table_name][$field_storage->getName() . '_value']) - && $data[$table_name][$field_storage->getName() . '_value']['filter']['id'] == 'datetime') { - // Create year, month, and day arguments. - $group = $data[$table_name][$field_storage->getName() . '_value']['group']; - $arguments = [ - // Argument type => help text. - 'year_week' => t('Calendar Date in the form of CCYYW.'), - ]; - foreach ($arguments as $argument_type => $help_text) { - $data[$table_name][$field_storage->getName() . '_value_' . $argument_type] = [ - 'title' => 'Calendar ' . $field_storage->getLabel() . ' (' . $argument_type . ')', - 'help' => $help_text, - 'argument' => [ - 'field' => $field_storage->getName() . '_value', - 'id' => 'datetime_' . $argument_type, - 'entity_type' => $field_storage->getTargetEntityTypeId(), - 'field_name' => $field_storage->getName(), - ], - 'group' => $group, - ]; - } - } - } -} diff --git a/web/modules/calendar/calendar_datetime/README.md b/web/modules/calendar/calendar_datetime/README.md deleted file mode 100644 index 1b873bc7c0a7d772b03645a8afe01f61d6c3cedf..0000000000000000000000000000000000000000 --- a/web/modules/calendar/calendar_datetime/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# Drupal Calendar 8.x - Calendar DateTime - -This module simply holds classes and other functions that will be later -added to Drupal core DateTime module(or possibly contrib Date module). Each class -or function should have a reference to the Drupal core issue where it came from. - - Ideally these classes should come directly from RTBC core datetime issues that - will be added in later 8.x point releases(8.1, 8.2, etc). - - Once they have been added to core they can be remove from this module and the -main Calendar module should only have to change "use" statements for classes or - change function calls from "calendar_datetime_*" to "datetime_*" **without other -programming changes**. - -## Current Core Patches - -1. ~~[#2567815] Can't select granularity on date argument. - *Patch*: https://www.drupal.org/files/issues/can_t_select-2567815-13.patch - *Purpose*: Adds extra Views arguments for Date granularity.~~ -2. [#2325899] Error when setting current day as default argument. - *Patch*: https://www.drupal.org/files/issues/views_argument_handlers-2325899-39.patch - *Purpose*: Allow current date to be default argument. - - - diff --git a/web/modules/calendar/calendar_datetime/calendar_datetime.info.yml b/web/modules/calendar/calendar_datetime/calendar_datetime.info.yml deleted file mode 100644 index 874a821ea7e6812c78d111a8fabbb69615c4b905..0000000000000000000000000000000000000000 --- a/web/modules/calendar/calendar_datetime/calendar_datetime.info.yml +++ /dev/null @@ -1,5 +0,0 @@ -name: Calendar Datetime -type: module -description: Provides a calendar specific date time. -core: 8.x -package: Date/Time diff --git a/web/modules/calendar/calendar_datetime/src/Plugin/views/argument_default/Date.php b/web/modules/calendar/calendar_datetime/src/Plugin/views/argument_default/Date.php deleted file mode 100644 index 0ac7bb216f57c36606108e8f4de28d1a8d384ad1..0000000000000000000000000000000000000000 --- a/web/modules/calendar/calendar_datetime/src/Plugin/views/argument_default/Date.php +++ /dev/null @@ -1,105 +0,0 @@ -<?php - -namespace Drupal\calendar_datetime\Plugin\views\argument_default; - -use Drupal\Core\Cache\CacheableDependencyInterface; -use Drupal\Core\Datetime\DateFormatterInterface; -use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\HttpFoundation\Request; - -/** - * The current date argument default handler. - * - * @ingroup views_argument_default_plugins - * - * @ViewsArgumentDefault( - * id = "date", - * title = @Translation("Calendar Current date") - * ) - */ -class Date extends ArgumentDefaultPluginBase implements CacheableDependencyInterface { - - /** - * The date formatter service. - * - * @var \Drupal\Core\Datetime\DateFormatterInterface - */ - protected $dateFormatter; - - /** - * The current Request object. - * - * @var \Symfony\Component\HttpFoundation\Request - */ - protected $request; - - /** - * Constructs a new Date instance. - * - * @param array $configuration - * A configuration array containing information about the plugin instance. - * @param string $plugin_id - * The plugin_id for the plugin instance. - * @param mixed $plugin_definition - * The plugin implementation definition. - * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter - * The date formatter service. - * @param \Symfony\Component\HttpFoundation\Request $request - * The current request. - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, DateFormatterInterface $date_formatter, Request $request) { - parent::__construct($configuration, $plugin_id, $plugin_definition); - - $this->dateFormatter = $date_formatter; - $this->request = $request; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('date.formatter'), - $container->get('request_stack')->getCurrentRequest() - ); - } - - /** - * Return the default argument. - */ - public function getArgument() { - $argument = $this->argument; - - // The Date argument handlers provide their own format strings, otherwise - // use a default. - if ($argument instanceof \Drupal\datetime\Plugin\views\argument\Date) { - /** @var \Drupal\views\Plugin\views\argument\Date $argument */ - $format = $argument->getArgFormat(); - } - else { - $format = 'Y-m-d'; - } - - $request_time = $this->request->server->get('REQUEST_TIME'); - - return $this->dateFormatter->format($request_time, 'custom', $format); - } - - /** - * {@inheritdoc} - */ - public function getCacheContexts() { - return []; - } - - /** - * {@inheritdoc} - */ - public function getCacheMaxAge() { - return 0; - } -} diff --git a/web/modules/calendar/composer.json b/web/modules/calendar/composer.json deleted file mode 100644 index 2519d62183656b4b45b1f81edb5ac21a8dd41ffb..0000000000000000000000000000000000000000 --- a/web/modules/calendar/composer.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "drupal/calendar", - "description": "Provides a Views plugin to display views containing dates as Calendars.", - "type": "drupal-module", - "keywords": ["Drupal"], - "homepage": "http://drupal.org/project/calendar", - "support": { - "issues": "https://www.drupal.org/project/issues/calendar", - "source": "http://cgit.drupalcode.org/calendar" - }, - "require": { - "drupal/views_templates": "1.*" - }, - "license": "GPL-2.0+" -} diff --git a/web/modules/calendar/config/install/calendar.settings.yml b/web/modules/calendar/config/install/calendar.settings.yml deleted file mode 100644 index eaf03f11cbeea06ccb43dbd73847b3b9f0bbcab6..0000000000000000000000000000000000000000 --- a/web/modules/calendar/config/install/calendar.settings.yml +++ /dev/null @@ -1,2 +0,0 @@ -track_date: 0 -add_colorbox: 0 diff --git a/web/modules/calendar/config/schema/calendar.schema.yml b/web/modules/calendar/config/schema/calendar.schema.yml deleted file mode 100644 index 639b13850a366ab4d621d43ccf847d1470b67a65..0000000000000000000000000000000000000000 --- a/web/modules/calendar/config/schema/calendar.schema.yml +++ /dev/null @@ -1,10 +0,0 @@ -# Schema for the configuration files of the Calendar module. - -calendar.settings: - type: mapping - label: 'Calendar settings' - mapping: - track_date: - type: integer - add_colorbox: - type: integer diff --git a/web/modules/calendar/css/calendar-overlap-no-scroll.css b/web/modules/calendar/css/calendar-overlap-no-scroll.css deleted file mode 100644 index a4dffd2fed6c853d06502b8649bb534c4574ac69..0000000000000000000000000000000000000000 --- a/web/modules/calendar/css/calendar-overlap-no-scroll.css +++ /dev/null @@ -1,12 +0,0 @@ - -.calendar-calendar .week-view #multi-day-container, -.calendar-calendar .week-view #single-day-container, -.calendar-calendar .day-view #multi-day-container, -.calendar-calendar .day-view #single-day-container { - overflow-y: hidden; - overflow-x: hidden; -} - .calendar-calendar .week-view #single-day-container, - .calendar-calendar .day-view #single-day-container { - height: auto; -} \ No newline at end of file diff --git a/web/modules/calendar/css/calendar-overlap.css b/web/modules/calendar/css/calendar-overlap.css deleted file mode 100644 index 1ea9919c9d52339519da117318dbabfdf40cee37..0000000000000000000000000000000000000000 --- a/web/modules/calendar/css/calendar-overlap.css +++ /dev/null @@ -1,824 +0,0 @@ -/** - * Overlapping week items - */ -.calendar-calendar tr.holder { - height: 0px; - display: table-row !important; - display: none; -} - -.calendar-calendar .week-view .full div.item-wrapper, -.calendar-calendar .day-view .full div.item-wrapper { - background-color: none; - border: 0px; - float: none; - margin: 0px; - width: 100%; - margin-top: -24px; -} - -.calendar-calendar td .inner div, -.calendar-calendar td .inner div a { - background: none; -} - -.calendar-calendar .week-view .full div.single-day div.weekview, -.calendar-calendar .day-view .full div.single-day div.dayview { - background: #ffc; - width: auto; - padding: 0px 3px; - overflow: hidden; -} - -.calendar-calendar .week-view .full div.single-day div.weekview, -.calendar-calendar .day-view .full div.single-day div.dayview { - border: 1px solid #E39364; -} - -.calendar-calendar .week-view .header-body-divider, -.calendar-calendar .week-view .single-day-footer, -.calendar-calendar .day-view .single-day-footer, -.calendar-calendar .day-view .header-body-divider { - background: #eeeeee; - border-left: 1px solid #CCCCCC; - border-right: 1px solid #CCCCCC; - font-size: 1px; - height: 4px; - line-height: 1px; -} - -.calendar-calendar .week-view #multi-day-container, -.calendar-calendar .week-view #single-day-container, -.calendar-calendar .day-view #multi-day-container, -.calendar-calendar .day-view #single-day-container { - position: relative; - background: #ffffff; - overflow-y: scroll; - overflow-x: hidden; - border-left: 1px solid #CCCCCC; - border-bottom: 1px solid #CCCCCC; -} - -.calendar-calendar .week-view #multi-day-container, -.calendar-calendar .day-view #multi-day-container { - border-top: 1px solid #CCCCCC; -} - -.calendar-calendar .week-view #week-header-container, -.calendar-calendar .day-view #day-header-container { - width: 100%; - background: #ffffff; - border-bottom: 1px solid #CCCCCC; -} - -.calendar-calendar .week-view #multi-day-container, -.calendar-calendar .day-view #multi-day-container { - height: 57px; -} - -.calendar-calendar .week-view #multi-day-container .expand { - height: 100%; -} - -.calendar-calendar .week-view #multi-day-container table, -.calendar-calendar .day-view #multi-day-container table { - height: 100%; -} - -.calendar-calendar .week-view #multi-day-container table td, -.calendar-calendar .day-view #multi-day-container table td { - border-top: 0px; - border-bottom: 0px; - vertical-align: top; - width: 14%; -} - -.calendar-calendar .week-view #multi-day-container table td.calendar-agenda-hour { - border-right: 1px solid #CCCCCC; -} - -.calendar-calendar .week-view #single-day-container, -.calendar-calendar .day-view #single-day-container { - border-top: 1px solid #CCCCCC; - height: 500px; -} - -.calendar-calendar .week-view #single-day-container table td, -.calendar-calendar .day-view #single-day-container table td { - padding: 0px; - border-top: 0px; - border-bottom: 0px; - width: 14%; -} - -.calendar-calendar .week-view td.first, -.calendar-calendar .day-view td.first { - border-left: 0px; -} - -.calendar-calendar .week-view td.first, -.calendar-calendar .day-view td.first { - border-left: 0px; -} - -.calendar-calendar .week-view td.last, -.calendar-calendar .day-view td.last { - border-right: 0px; -} - -.calendar-calendar .week-view #single-day-container div.first, -.calendar-calendar .day-view #single-day-container div.first { - border-top: 0px; -} - -.calendar-calendar .week-view #single-day-container div.last, -.calendar-calendar .day-view #single-day-container div.last { - border-bottom: 0px; -} - -.calendar-calendar .week-view table.full { - table-layout: fixed; - width: 100%; - margin: 0px; -} - -.calendar-calendar .day-view table.full { - table-layout: fixed; - width: 100%; - margin: 0px; -} - -.calendar-calendar td.calendar-agenda-hour .calendar-hour, -.calendar-calendar td.calendar-agenda-hour .calendar-ampm, -.calendar-calendar .week-view .full div.calendar-agenda-hour span, -.calendar-calendar .day-view .full div.calendar-agenda-hour span { - font-size: .8em; - font-weight: normal; - margin-right: 0px; -} - -.calendar-calendar .week-view .full div.calendar-agenda-hour, -.calendar-calendar .day-view .full div.calendar-agenda-hour, -.calendar-calendar .week-view .full div.calendar-agenda-items, -.calendar-calendar .day-view .full div.calendar-agenda-items { - height: 47px; - border-top: 1px solid #cccccc; -} - -.calendar-calendar .week-view .full .calendar-agenda-hour { - width: auto; -} - -.calendar-calendar .week-view .full .calendar-agenda-hour div, -.calendar-calendar .day-view .full .calendar-agenda-hour div { - margin-top: 10px; -} - -.calendar-calendar .day-view #header-container td.calendar-time-holder, -.calendar-calendar .day-view #multi-day-container td.calendar-time-holder, -.calendar-calendar .day-view #single-day-container td.calendar-time-holder { - width: 50px; - padding: 0px; - border: 0px; -} - -.calendar-calendar .day-view #header-container td.calendar-day-holder, -.calendar-calendar .day-view #multi-day-container td.calendar-day-holder, -.calendar-calendar .day-view #single-day-container td.calendar-day-holder { - width:95%; -} - -.calendar-calendar .week-view #header-container td.calendar-time-holder, -.calendar-calendar .week-view #multi-day-container td.calendar-time-holder, -.calendar-calendar .week-view #single-day-container td.calendar-time-holder { - width: 50px; - padding: 0px; - border: 0px; -} - -.calendar-calendar .week-view #header-container td.margin-right { - width: 10px; -} - -.calendar-calendar .week-view .full td.calendar-day-holder { - padding: 0px; - border: 0px; - width: 14%; -} - -.calendar-calendar .day-view .full td.calendar-day-holder { - padding: 0px; - border: 0px; - width: 95%; -} - -.calendar-calendar .week-view .full div.single-day, -.calendar-calendar .day-view .full div.single-day { - padding: 0px; -} - -.calendar-calendar .week-view .full div.single-day .inner, -.calendar-calendar .day-view .full div.single-day .inner { - position: relative; - z-index: 1; -} - -.calendar-calendar .week-view .full td.multi-day { - padding: 1px 2px 0px 2px; -} - -.calendar-calendar .day-view .full td.multi-day div.dayview, -.calendar-calendar .week-view .full td.multi-day div.weekview { - height: 22px !important; -} - -.calendar-calendar .day-view .full td.multi-day .calendar.dayview .contents div, -.calendar-calendar .week-view .full td.multi-day .calendar.weekview .contents div { -} - -.calendar-calendar .week-view .full td.multi-day .inner .weekview .continuation { - height: 22px; - padding-top: 0px; - margin-right: 3px; -} - -.calendar-calendar .week-view .full td.multi-day .inner .weekview .continues, -.calendar-calendar .week-view .full td.multi-day .inner .weekview .cutoff, -.calendar-calendar .day-view .full td.multi-day .inner .dayview .continues, -.calendar-calendar .day-view .full td.multi-day .inner .dayview .cutoff { - height: 22px; - padding-top: 0px; -} - -.calendar-calendar .week-view div.single-day .view-item, -.calendar-calendar .day-view div.single-day .view-item { - position: absolute; - width: 100%; - background: none; - text-align: left; - z-index: 1; -} - -.calendar-calendar .week-view div.single-day .half-hour, -.calendar-calendar .day-view div.single-day .half-hour { - font-size: 1px; - height: 23px; - width: 100%; - position:relative; - z-index: 0; - top: 0px; - border-bottom: 1px dotted #cccccc; -} - -.calendar-calendar .week-view div.single-day .view-item .calendar, -.calendar-calendar .day-view div.single-day .view-item .calendar { - margin: 0px; -} - -.calendar-calendar .week-view div.single-day .view-item .contents, -.calendar-calendar .day-view div.single-day .view-item .contents { - overflow: hidden; -} - -.calendar-calendar div.single-day .o_0 .view-item { - top: 0px; -} - -.calendar-calendar div.single-day .o_1 .view-item { - top: 12px; -} - -.calendar-calendar div.single-day .o_2 .view-item { - top: 24px; -} - -.calendar-calendar div.single-day .o_3 .view-item { - top: 36px; -} - -.calendar-calendar div.single-day .o_4 .view-item { - top: 40px; -} - -.calendar-calendar div.single-day .d_1 .view-item .calendar { - height: 10px; -} - -.calendar-calendar div.single-day .d_2 .view-item .calendar { - height: 22px; -} - -.calendar-calendar div.single-day .d_3 .view-item .calendar { - height: 34px; -} - -.calendar-calendar div.single-day .d_4 .view-item .calendar { - height: 46px; -} - -.calendar-calendar div.single-day .d_5 .view-item .calendar { - height: 58px; -} - -.calendar-calendar div.single-day .d_6 .view-item .calendar { - height: 70px; -} - -.calendar-calendar div.single-day .d_7 .view-item .calendar { - height: 82px; -} - -.calendar-calendar div.single-day .d_8 .view-item .calendar { - height: 94px; -} - -.calendar-calendar div.single-day .d_9 .view-item .calendar { - height: 106px; -} - -.calendar-calendar div.single-day .d_10 .view-item .calendar { - height: 118px; -} - -.calendar-calendar div.single-day .d_11 .view-item .calendar { - height: 130px; -} - -.calendar-calendar div.single-day .d_12 .view-item .calendar { - height: 142px; -} - -.calendar-calendar div.single-day .d_13 .view-item .calendar { - height: 154px; -} - -.calendar-calendar div.single-day .d_14 .view-item .calendar { - height: 166px; -} - -.calendar-calendar div.single-day .d_15 .view-item .calendar { - height: 178px; -} - -.calendar-calendar div.single-day .d_16 .view-item .calendar { - height: 190px; -} - -.calendar-calendar div.single-day .d_17 .view-item .calendar { - height: 202px; -} - -.calendar-calendar div.single-day .d_18 .view-item .calendar { - height: 214px; -} - -.calendar-calendar div.single-day .d_19 .view-item .calendar { - height: 226px; -} - -.calendar-calendar div.single-day .d_20 .view-item .calendar { - height: 238px; -} - -.calendar-calendar div.single-day .d_21 .view-item .calendar { - height: 250px; -} - -.calendar-calendar div.single-day .d_22 .view-item .calendar { - height: 262px; -} - -.calendar-calendar div.single-day .d_23 .view-item .calendar { - height: 274px; -} - -.calendar-calendar div.single-day .d_24 .view-item .calendar { - height: 286px; -} - -.calendar-calendar div.single-day .d_25 .view-item .calendar { - height: 298px; -} - -.calendar-calendar div.single-day .d_26 .view-item .calendar { - height: 310px; -} - -.calendar-calendar div.single-day .d_27 .view-item .calendar { - height: 322px; -} - -.calendar-calendar div.single-day .d_28 .view-item .calendar { - height: 334px; -} - -.calendar-calendar div.single-day .d_29 .view-item .calendar { - height: 346px; -} - -.calendar-calendar div.single-day .d_30 .view-item .calendar { - height: 358px; -} - -.calendar-calendar div.single-day .d_31 .view-item .calendar { - height: 370px; -} - -.calendar-calendar div.single-day .d_32 .view-item .calendar { - height: 382px; -} - -.calendar-calendar div.single-day .d_33 .view-item .calendar { - height: 394px; -} - -.calendar-calendar div.single-day .d_34 .view-item .calendar { - height: 406px; -} - -.calendar-calendar div.single-day .d_35 .view-item .calendar { - height: 418px; -} - -.calendar-calendar div.single-day .d_36 .view-item .calendar { - height: 430px; -} - -.calendar-calendar div.single-day .d_37 .view-item .calendar { - height: 442px; -} - -.calendar-calendar div.single-day .d_38 .view-item .calendar { - height: 454px; -} - -.calendar-calendar div.single-day .d_39 .view-item .calendar { - height: 466px; -} - -.calendar-calendar div.single-day .d_40 .view-item .calendar { - height: 478px; -} - -.calendar-calendar div.single-day .d_41 .view-item .calendar { - height: 490px; -} - -.calendar-calendar div.single-day .d_42 .view-item .calendar { - height: 502px; -} - -.calendar-calendar div.single-day .d_43 .view-item .calendar { - height: 514px; -} - -.calendar-calendar div.single-day .d_44 .view-item .calendar { - height: 526px; -} - -.calendar-calendar div.single-day .d_45 .view-item .calendar { - height: 538px; -} - -.calendar-calendar div.single-day .d_46 .view-item .calendar { - height: 550px; -} - -.calendar-calendar div.single-day .d_47 .view-item .calendar { - height: 562px; -} - -.calendar-calendar div.single-day .d_48 .view-item .calendar { - height: 574px; -} - -.calendar-calendar div.single-day .d_49 .view-item .calendar { - height: 586px; -} - -.calendar-calendar div.single-day .d_50 .view-item .calendar { - height: 598px; -} - -.calendar-calendar div.single-day .d_51 .view-item .calendar { - height: 610px; -} - -.calendar-calendar div.single-day .d_52 .view-item .calendar { - height: 622px; -} - -.calendar-calendar div.single-day .d_53 .view-item .calendar { - height: 634px; -} - -.calendar-calendar div.single-day .d_54 .view-item .calendar { - height: 646px; -} - -.calendar-calendar div.single-day .d_55 .view-item .calendar { - height: 658px; -} - -.calendar-calendar div.single-day .d_56 .view-item .calendar { - height: 670px; -} - -.calendar-calendar div.single-day .d_57 .view-item .calendar { - height: 682px; -} - -.calendar-calendar div.single-day .d_58 .view-item .calendar { - height: 694px; -} - -.calendar-calendar div.single-day .d_59 .view-item .calendar { - height: 706px; -} - -.calendar-calendar div.single-day .d_60 .view-item .calendar { - height: 718px; -} - -.calendar-calendar div.single-day .d_61 .view-item .calendar { - height: 730px; -} - -.calendar-calendar div.single-day .d_62 .view-item .calendar { - height: 742px; -} - -.calendar-calendar div.single-day .d_63 .view-item .calendar { - height: 754px; -} - -.calendar-calendar div.single-day .d_64 .view-item .calendar { - height: 766px; -} - -.calendar-calendar div.single-day .d_65 .view-item .calendar { - height: 778px; -} - -.calendar-calendar div.single-day .d_66 .view-item .calendar { - height: 790px; -} - -.calendar-calendar div.single-day .d_67 .view-item .calendar { - height: 802px; -} - -.calendar-calendar div.single-day .d_68 .view-item .calendar { - height: 814px; -} - -.calendar-calendar div.single-day .d_69 .view-item .calendar { - height: 826px; -} - -.calendar-calendar div.single-day .d_70 .view-item .calendar { - height: 838px; -} - -.calendar-calendar div.single-day .d_71 .view-item .calendar { - height: 850px; -} - -.calendar-calendar div.single-day .d_72 .view-item .calendar { - height: 862px; -} - -.calendar-calendar div.single-day .d_73 .view-item .calendar { - height: 874px; -} - -.calendar-calendar div.single-day .d_74 .view-item .calendar { - height: 886px; -} - -.calendar-calendar div.single-day .d_75 .view-item .calendar { - height: 898px; -} - -.calendar-calendar div.single-day .d_76 .view-item .calendar { - height: 910px; -} - -.calendar-calendar div.single-day .d_77 .view-item .calendar { - height: 922px; -} - -.calendar-calendar div.single-day .d_78 .view-item .calendar { - height: 934px; -} - -.calendar-calendar div.single-day .d_79 .view-item .calendar { - height: 946px; -} - -.calendar-calendar div.single-day .d_80 .view-item .calendar { - height: 958px; -} - -.calendar-calendar div.single-day .d_81 .view-item .calendar { - height: 970px; -} - -.calendar-calendar div.single-day .d_82 .view-item .calendar { - height: 982px; -} - -.calendar-calendar div.single-day .d_83 .view-item .calendar { - height: 994px; -} - -.calendar-calendar div.single-day .d_84 .view-item .calendar { - height: 1006px; -} - -.calendar-calendar div.single-day .d_85 .view-item .calendar { - height: 1018px; -} - -.calendar-calendar div.single-day .d_86 .view-item .calendar { - height: 1030px; -} - -.calendar-calendar div.single-day .d_87 .view-item .calendar { - height: 1042px; -} - -.calendar-calendar div.single-day .d_88 .view-item .calendar { - height: 1054px; -} - -.calendar-calendar div.single-day .d_89 .view-item .calendar { - height: 1066px; -} - -.calendar-calendar div.single-day .d_90 .view-item .calendar { - height: 1078px; -} - -.calendar-calendar div.single-day .d_91 .view-item .calendar { - height: 1090px; -} - -.calendar-calendar div.single-day .d_92 .view-item .calendar { - height: 1102px; -} - -.calendar-calendar div.single-day .d_93 .view-item .calendar { - height: 1114px; -} - -.calendar-calendar div.single-day .d_94 .view-item .calendar { - height: 1128px; -} - -.calendar-calendar div.single-day .d_95 .view-item .calendar { - height: 1140px; -} - -.calendar-calendar div.single-day .d_96 .view-item .calendar { - height: 1152px; -} - -.calendar-calendar .week-view div.single-day .i_0 .view-item .calendar { - margin-left: 0px; - width: 50%; -} - -.calendar-calendar .week-view div.single-day .i_1 .view-item .calendar { - margin-left: 10%; - width: 85%; -} - -.calendar-calendar .week-view div.single-day .i_2 .view-item .calendar { - margin-left: 16%; - width: 79%; -} - -.calendar-calendar .week-view div.single-day .i_3 .view-item .calendar { - margin-left: 21%; - width: 74%; -} - -.calendar-calendar .week-view div.single-day .i_4 .view-item .calendar { - margin-left: 30%; - width: 65%; -} - -.calendar-calendar .week-view div.single-day .i_5 .view-item .calendar { - margin-left: 34%; - width: 61%; -} - -.calendar-calendar .week-view div.single-day .i_6 .view-item .calendar { - margin-left: 42%; - width: 53%; -} - -.calendar-calendar .week-view div.single-day .i_7 .view-item .calendar { - margin-left: 49%; - width: 46%; -} - -.calendar-calendar .week-view div.single-day .i_8 .view-item .calendar { - margin-left: 55%; - width: 40%; -} - -.calendar-calendar .week-view div.single-day .i_9 .view-item .calendar { - margin-left: 65%; - width: 30%; -} - -.calendar-calendar .week-view div.single-day .i_0.md_0 .view-item .calendar { - width: 95% !important; - width: auto; -} - -.calendar-calendar .week-view div.single-day .i_0.md_1 .view-item .calendar { - width: 60% !important; - width: auto; -} - -.calendar-calendar .day-view div.single-day .i_0 .view-item .calendar { - margin-left: 2px; - width: 25% !important; - width: 97%; -} - -.calendar-calendar .day-view div.single-day .i_1 .view-item .calendar { - margin-left: 10%; - width: 89%; -} - -.calendar-calendar .day-view div.single-day .i_2 .view-item .calendar { - margin-left: 20%; - width: 79%; -} - -.calendar-calendar .day-view div.single-day .i_3 .view-item .calendar { - margin-left: 30%; - width: 69%; -} - -.calendar-calendar .day-view div.single-day .i_4 .view-item .calendar { - margin-left: 40%; - width: 59%; -} - -.calendar-calendar .day-view div.single-day .i_5 .view-item .calendar { - margin-left: 50%; - width: 49%; -} - -.calendar-calendar .day-view div.single-day .i_6 .view-item .calendar { - margin-left: 60%; - width: 39%; -} - -.calendar-calendar .day-view div.single-day .i_7 .view-item .calendar { - margin-left: 70%; - width: 29%; -} - -.calendar-calendar .day-view div.single-day .i_8 .view-item .calendar { - margin-left: 75%; - width: 24%; -} - -.calendar-calendar .day-view div.single-day .i_9 .view-item .calendar { - margin-left: 80%; - width: 19%; -} - -.calendar-calendar .day-view div.single-day .i_0.md_0 .view-item .calendar { - width: 98% !important; - width: auto; -} - -.calendar-calendar .day-view div.single-day .i_0.md_1 .view-item .calendar { - width: 60% !important; - width: auto; -} - -.calendar-calendar .day-view div.single-day .i_0.md_2 .view-item .calendar { - width: 40% !important; - width: auto; -} - -.calendar-calendar .day-view div.single-day .i_0.md_3 .view-item .calendar { - width: 30% !important; - width: auto; -} - -.single-day-footer .grippie, -.header-body-divider .grippie { - overflow: hidden; - background: #eee url("/misc/grippie.png") no-repeat center 2px; - cursor: s-resize; - height: 3px; -} diff --git a/web/modules/calendar/css/calendar.css b/web/modules/calendar/css/calendar.css deleted file mode 100644 index 10785424f70a04337500020dc448cf208feaf32b..0000000000000000000000000000000000000000 --- a/web/modules/calendar/css/calendar.css +++ /dev/null @@ -1,405 +0,0 @@ -/** - * Calendar calendar table styles. - */ -.calendar-calendar tr.odd, .calendar-calendar tr.even { - background-color: #fff; -} -.calendar-calendar table { - border-collapse: collapse; - border-spacing: 0; - margin: 0 auto; - padding: 0; - width: 100%; /* Setting at 100% causes problem in Internet Explorer. */ - clear: both; -} -.calendar-calendar .month-view table { - border: none; - padding: 0; - margin: 0; - width: 100%; - clear: both; -} - -/** - * IE needs a little help to get the side by side tables to the right size. - */ -.calendar-calendar .year-view td { - width: 32%; - padding: 1px; - border: none; -} - -.calendar-calendar .year-view td table td { - width: 13%; - padding: 0; -} - -.calendar-calendar tr { - padding: 0; - margin: 0; - background-color: white; -} -.calendar-calendar th { - color: #fff; - background-color: #ccc; - text-align: center; - margin: 0; -} -.calendar-calendar th a { - font-weight: bold; - color: #fff; - background-color: #ccc; -} -.calendar-calendar td { - width: 12%; /* 14% is about 1/7 of total table width */ - min-width: 12%; - border: 1px solid #ccc; - color: #777; - text-align: right; - vertical-align: top; - margin: 0; - padding: 0; -} - -/** - * Simplify the mini calendar by removing borders. - */ -.calendar-calendar .mini { - border: none; - } - -/** - * Format for the week number in the first cell. - */ -.calendar-calendar td.week { - width: 1%; - min-width: 1%; - } -.calendar-calendar .week { - clear: both; - font-style: normal; - color: #555; - font-size: 0.8em; -} -.calendar-calendar .week a { - font-weight: normal; -} - -/** - * IE6 does not support min-height, using Min-Height fast hack from - * http://www.dustindiaz.com/min-height-fast-hack . - */ -.calendar-calendar .inner { - min-height: 5em; - height: auto !important; - height: 5em; - padding: 0; - margin: 0; -} -.calendar-calendar .inner div { - padding: 0; - margin: 0; -} -/** - * Make sure paragraphs buried in calendar cells use padding, not margins, for - * separation so the background color doesn't come through. - */ -.calendar-calendar .inner p { - padding: 0 0 .8em 0; - margin: 0; -} -.calendar-calendar td a { - font-weight: bold; - text-decoration: none; -} -.calendar-calendar td a:hover { - text-decoration: underline; -} -.calendar-calendar td.year, -.calendar-calendar td.month { - text-align: center; -} - -/** - * Format days of the week header cells. - */ -.calendar-calendar th.days { - color: #ccc; - background-color: #224; - text-align: center; - padding: 1px; - margin: 0; - } - -/** - * Floating day number div. - */ -.calendar-calendar div.day { - float: right; - text-align: center; - padding: 0.125em 0.25em 0 0.25em; - margin: 0; - background-color: #f3f3f3; - border: 1px solid gray; - border-width: 0 0 1px 1px; - clear:both; - width:1.5em; -} - -/** - * Individual node container. - */ -.calendar-calendar div.calendar { - background-color: #fff; - border: solid 1px #ddd; - text-align: left; - margin:0 .25em .25em 0; - width: 96%; - float: right; /* needed to keep IE from hiding the floating day number */ - clear: both; -} -/** - * No floating of day view content because there is no floating day number. - */ -.calendar-calendar .day-view div.calendar { - float: none; - width: 98%; - margin: 1% 1% 0 1%; -} - -.calendar-calendar div.title { - font-size: .8em; - text-align: center; -} - -.calendar-calendar div.title a { - color: #000; -} -.calendar-calendar div.title a:hover { - color: #c00; -} -.calendar-calendar .content { - clear: both; - padding: 3px; - padding-left: 5px; -} -.calendar div.form-item { - white-space: normal; -} - -table td.mini, -table th.mini, -table.mini td.week { - padding: 0 1px 0 0; - margin: 0; -} -table td.mini a { - font-weight: normal; -} -.calendar-calendar .mini-day-off { - padding: 0px; -} -.calendar-calendar .mini-day-on { - padding: 0px; -} -table .mini-day-on a { - text-decoration: underline; -} -.calendar-calendar .mini .title { - font-size: .8em; -} -.mini .calendar-calendar .week { - font-size: .7em; -} -.mini-row { - width: 100%; - border: none; -} -.mini{ - width: 32%; - vertical-align: top; -} - -/** - * Formatting for the legend stripe and block. - */ -.calendar-calendar .stripe { - height: 5px; - width: auto; - font-size: 1px !important; - line-height: 1px !important; -} -.calendar-calendar .day-view .stripe { - width: 100%; -} -table.calendar-legend { - background-color: #ccc; - width: 100%; - margin: 0; - padding: 0; -} -table.calendar-legend tr.odd .stripe, -table.calendar-legend tr.even .stripe { - height: 12px !important; - font-size: 9px !important; - line-height: 10px !important; -} -.calendar-legend td { - text-align: left; -} - -.calendar-empty { - font-size: 1px; - line-height: 1px; -} - -/** - * Formatting for the full day view. - */ -.calendar-calendar td.calendar-agenda-hour { - font-family: serif; - text-align: right; - border: none; - border-top: 1px #333 dotted; - padding-top: .25em; - width: 1%; -} -.calendar-calendar td.calendar-agenda-no-hours { - min-width: 1%; -} -.calendar-calendar td.calendar-agenda-hour .calendar-hour { - font-size: 1.2em; - font-weight: bold; -} -.calendar-calendar td.calendar-agenda-hour .calendar-ampm { - font-size: 1em; -} -.calendar-calendar td.calendar-agenda-items { - border: 1px #333 dotted; - text-align: left; -} -.calendar-calendar td.calendar-agenda-items div.calendar { - width: auto; - padding: .25em; - margin: 0; -} -.calendar-calendar div.calendar div.inner .calendar-agenda-empty { - width: 100%; - text-align: center; - vertical-align: middle; - padding: 1em 0; - background-color: #fff; -} - -/** - * The popup date selector for jumping to a new date. - */ -.calendar-date-select form { - text-align: right; - float: right; - width: 25%; -} -.calendar-date-select div, -.calendar-date-select input, -.calendar-date-select label { - text-align: right; - padding: 0; - margin: 0; - float: right; - clear: both; -} -.calendar-date-select .description { - float: right; -} -.calendar-label { - font-weight: bold; - display: block; - clear: both; -} - -.calendar-calendar div.date-nav { - background-color: #ccc; - color: #777; - width: auto; - border: 1px solid #ccc; -} -.calendar-calendar div.date-nav a, -.calendar-calendar div.date-nav h3 { - color: #777; -} -.calendar-calendar th.days { - background-color: #eee; - color: #777; - font-weight: bold; - border: 1px solid #ccc; -} -.calendar-calendar td.empty { - background: #ccc; - border-color: #ccc; -} -.calendar-calendar table.mini td.empty { - background: #fff; - border-color: #fff; -} -.calendar-calendar td div.day { - border: 1px solid #ccc; - border-top: none; - border-right: none; - margin-bottom: 2px; -} -.calendar-calendar td .inner div, -.calendar-calendar td .inner div a { - background: #eee; -} - -/** - * Set small font size for all items in calendar div, themes can override this. - * Use x-small instead of em to avoid multiplying effect in nested items. - */ -.calendar-calendar div.calendar { - border: none; - font-size: x-small; -} -.calendar-calendar td .inner div.calendar div, -.calendar-calendar td .inner div.calendar div a { - border: none; - background: #ffc; - padding: 0 2px; -} -.calendar-calendar td .inner div.calendar div.calendar-more, -.calendar-calendar td .inner div.calendar div.calendar-more a { - color: #444; - background: #fff; - text-align: right; -} -.calendar-calendar td .inner .view-field, -.calendar-calendar td .inner .view-field a { - color: #444; - font-weight: normal; -} - -.calendar-calendar td span.date-display-single, -.calendar-calendar td span.date-display-start, -.calendar-calendar td span.date-display-end, -.calendar-calendar td span.date-display-separator { - font-weight: bold; -} -.calendar-calendar td .inner div.day a { - color: #4b85ac; -} -.calendar-calendar tr td.today, -.calendar-calendar tr.odd td.today, -.calendar-calendar tr.even td.today { - background-color: #C3D6E4; -} -.calendar-calendar td .inner div.calendar div div.view-data-node-data-field-date-field-date-value { - border-bottom: 1px solid #ccc; -} - -/** - * The following are not used by default but are available for themes. - */ -.calendar-calendar td.past {} -.calendar-calendar td.future {} -.calendar-calendar td.has-events {} -.calendar-calendar td.has-no-events {} diff --git a/web/modules/calendar/css/calendar_multiday.css b/web/modules/calendar/css/calendar_multiday.css deleted file mode 100644 index 53efbd8a9e43619f1e244159715ff275a71b8017..0000000000000000000000000000000000000000 --- a/web/modules/calendar/css/calendar_multiday.css +++ /dev/null @@ -1,878 +0,0 @@ -/** - * Calendar calendar table styles. - */ -.calendar-calendar tr.odd, .calendar-calendar tr.even { - background-color: #fff; -} -.calendar-calendar table { - border-collapse: collapse; - border-spacing: 0; - margin: 0 auto; - padding: 0; - width: 100%; /* Setting at 100% causes problem in Internet Explorer. */ -} -.calendar-calendar .month-view table { - border: none; - padding: 0; - margin: 0; - width: 100%; -} - -/** - * IE needs a little help to get the side by side tables to the right size - */ -.calendar-calendar .year-view td { - width: 32%; - padding: 1px; - border: none; -} - -.calendar-calendar .year-view td table td { - width: 13%; - padding: 0; -} - -.calendar-calendar tr { - padding: 0; - margin: 0; - background-color: white; -} -.calendar-calendar th { - text-align: center; - margin: 0; -} -.calendar-calendar th a { - font-weight: bold; -} -.calendar-calendar td { - width: 14%; - border: 1px solid #ccc; - color: #777; - text-align: right; - vertical-align: top; - margin: 0; - padding: 0; -} - -/** - * Simplify the mini calendar by removing borders. - */ -.calendar-calendar .mini { - border: none; -} - -/** - * Format for the week number in the first cell. - */ -.calendar-calendar td.week { - width: 1%; - min-width: 1%; - } -.calendar-calendar .week { - clear: both; - font-style: normal; - color: #555; - font-size: 0.8em; -} - -/** - * IE6 does not support min-height, using Min-Height fast hack from - * http://www.dustindiaz.com/min-height-fast-hack . - */ -.calendar-calendar .inner { - height: auto !important; - height: 5em; - padding: 0; - margin: 0; -} -.calendar-calendar .inner div { - padding: 0; - margin: 0; -} -/** - * Make sure paragraphs buried in calendar cells use padding, not margins, for - * separation so the background color doesn't come through. - */ -.calendar-calendar .inner p { - padding: 0 0 .8em 0; - margin: 0; -} -.calendar-calendar td a { - font-weight: bold; - text-decoration: none; -} -.calendar-calendar td a:hover { - text-decoration: underline; -} -.calendar-calendar td.year, -.calendar-calendar td.month { - text-align: center; -} - -/** - * Format days of the week header cells. - */ -.calendar-calendar th.days { - color: #ccc; - background-color: #224; - text-align: center; - padding: 1px; - margin: 0; - } - -/** - * Floating day number div. - */ -.calendar-calendar div.day { - float: right; - text-align: center; - padding: 0.125em 0.25em 0 0.25em; - margin: 0; - background-color: #f3f3f3; - border: 1px solid gray; - border-width: 0 0 1px 1px; - clear: both; - width: 1.5em; -} - -/** - * Individual node container. - */ -.calendar-calendar div.calendar { - background-color: #fff; - border: solid 1px #ddd; - text-align: left; - margin: 0 .25em .25em 0; - width: 96%; - float: right; /* needed to keep IE from hiding the floating day number */ - clear: both; -} -/** - * No floating of day view content because there is no floating day number. - */ -.calendar-calendar .day-view div.calendar { - float: none; - width: 98%; - margin: 1% 1% 0 1%; -} - -.calendar-calendar div.title { - font-size:.8em; - text-align: center; -} - -.calendar-calendar div.title a { - color: #000; -} -.calendar-calendar div.title a:hover { - color: #c00; -} -.calendar-calendar .content { - clear: both; - padding: 3px; - padding-left: 5px; -} -.calendar div.form-item { - white-space: normal; -} - -table td.mini, -table th.mini, -table.mini td.week { - padding: 0 1px 0 0; - margin: 0; - } -table td.mini a { - font-weight: normal; -} -.calendar-calendar .mini-day-off { - padding: 0px; -} -.calendar-calendar .mini-day-on { - padding: 0px; -} -table .mini-day-on a { - text-decoration: underline; -} -.calendar-calendar .mini .title { - font-size: .8em; -} -.mini .calendar-calendar .week { - font-size: .7em; -} -.mini-row { - width: 100%; - border: none; -} -.mini{ - width: 32%; - vertical-align: top; -} - -/** - * Formatting for the legend stripe and block. - */ -.calendar-calendar .stripe { - height: 5px; - width: auto; - font-size:1px !important; - line-height:1px !important; -} -.calendar-calendar .day-view .stripe { - width: 100%; -} -table.calendar-legend { - background-color: #ccc; - width: 100%; - margin: 0; - padding: 0; -} -table.calendar-legend tr.odd .stripe, -table.calendar-legend tr.even .stripe { - height: 12px !important; - font-size: 9px !important; - line-height: 10px !important; -} -.calendar-legend td { - text-align: left; - padding-left: 5px; -} - -.calendar-empty { - font-size: 1px; - line-height: 1px; -} - -/** - * Formatting for the full day view. - */ -.calendar-calendar td.calendar-agenda-hour { - text-align: right; - border: none; - border-top: 1px solid #CCCCCC; - padding-top: .25em; - width: 1%; -} -.calendar-calendar td.calendar-agenda-no-hours { - min-width: 1%; -} -.calendar-calendar td.calendar-agenda-hour .calendar-hour { - font-size: 1.2em; - font-weight: bold; -} -.calendar-calendar td.calendar-agenda-hour .calendar-ampm { - font-size: 1em; -} -.calendar-calendar td.calendar-agenda-items { - border: 1px solid #CCCCCC; - text-align: left; -} -.calendar-calendar td.calendar-agenda-items div.calendar { - width: auto; - padding: .25em; - margin: 0; -} -.calendar-calendar div.calendar div.inner .calendar-agenda-empty { - width: 100%; - text-align: center; - vertical-align: middle; - padding: 1em 0; - background-color: #fff; -} - -/** - * The popup date selector for jumping to a new date. - */ -.calendar-date-select form { - text-align: right; - float: right; - width: 25%; -} -.calendar-date-select div, -.calendar-date-select input, -.calendar-date-select label { - text-align: right; - padding: 0; - margin: 0; - float: right; - clear: both; -} -.calendar-date-select .description { - float: right; -} -.calendar-label { - font-weight: bold; - display: block; - clear: both; -} - -.calendar-calendar div.date-nav { - background-color: #ccc; - color: #777; - padding: 0.2em; - width: auto; - border: 1px solid #ccc; -} -.calendar-calendar div.date-nav a, -.calendar-calendar div.date-nav h3 { - color: #777; - text-decoration: none; -} -.calendar-calendar th.days { - background-color: #eee; - color: #777; - font-weight: bold; - border: 1px solid #ccc; -} -.calendar-calendar td.empty { - background: #ccc; - border-color: #ccc; - color: #cc9; -} -.calendar-calendar table.mini td.empty { - background: #fff; - border-color: #fff; -} -.calendar-calendar td div.day { - border: 1px solid #ccc; - border-top: none; - border-right: none; - margin-bottom: 2px; -} -.calendar-calendar td .inner div, -.calendar-calendar td .inner div a { - background: #eee; -} - -/** - * Set small font size for all items in calendar div, themes can override this. - * Use x-small instead of em to avoid multiplying effect in nested items. - */ -.calendar-calendar div.calendar { - border: none; - font-size: x-small; -} -.calendar-calendar td .inner div.calendar div, -.calendar-calendar td .inner div.calendar div a { - border: none; - background: #ffc; - padding: 0; -} -.calendar-calendar td .inner div.calendar div.calendar-more, -.calendar-calendar td .inner div.calendar div.calendar-more a { - color: #444; - background: #fff; - text-align: right; -} -.calendar-calendar td .inner .view-field, -.calendar-calendar td .inner .view-field a { - color: #444; - font-weight: normal; -} - -.calendar-calendar td span.date-display-single, -.calendar-calendar td span.date-display-start, -.calendar-calendar td span.date-display-end, -.calendar-calendar td span.date-display-separator { - font-weight: bold; -} -.calendar-calendar td .inner div.day a { - color: #4b85ac; -} -.calendar-calendar tr td.today, -.calendar-calendar tr.odd td.today, -.calendar-calendar tr.even td.today { - background-color: #C3D6E4; -} -.calendar-calendar td .inner div.calendar div div.view-data-node-data-field-date-field-date-value { -} - -/** - * The following are not used by default but are available for themes. - */ -.calendar-calendar td.past {} -.calendar-calendar td.future {} -.calendar-calendar td.has-events {} -.calendar-calendar td.has-no-events {} - -/** - * Multi day styles. - */ -.calendar-calendar tbody { - border-top: none; -} - -.calendar-calendar .month-view .full .inner, -.calendar-calendar .week-view .full .multi-day .inner { - height: auto; - min-height: auto; -} -.calendar-calendar .week-view .full .calendar-agenda-hour, -.calendar-calendar .month-view .full .single-day .inner .view-item { - float: left; - width: 100%; -} - -.calendar-calendar .week-view .full .calendar-agenda-hour, -.calendar-calendar .day-view .full .calendar-agenda-hour { - padding-right: 2px; -} - -.calendar-calendar .week-view .full .calendar-agenda-hour { - width: 6%; - min-width: 0px; -} - -.calendar-calendar .week-view .full .days { - width: 13%; -} - -.calendar-calendar .month-view .full div.calendar, -.calendar-calendar .week-view .full div.calendar, -.calendar-calendar .day-view div.calendar { - width: auto; -} - -.calendar-calendar .month-view .full tr.date-box, -.calendar-calendar .month-view .full tr.date-box td, -.calendar-calendar .month-view .full tr.multi-day, -.calendar-calendar .month-view .full tr.multi-day td { - height: 19px; - max-height: 19px; -} - -.calendar-calendar .month-view .full tr.single-day .no-entry, -.calendar-calendar .month-view .full tr.single-day .no-entry .inner { - height: 44px !important; - line-height: 44px; -} - -.calendar-calendar .month-view .full tr.single-day .noentry-multi-day, -.calendar-calendar .month-view .full tr.single-day .noentry-multi-day .inner { - height: 22px !important; - line-height: 22px; -} - -.calendar-calendar .month-view .full td, -.calendar-calendar .week-view .full td, -.calendar-calendar .day-view td { - vertical-align: top; - padding: 1px 2px 0 2px -} - -.calendar-calendar .month-view .full td.date-box { - height: 1%; - border-bottom: 0px; - padding-bottom: 2px; -} - -.calendar-calendar .month-view .full .week { - font-size: inherit; -} - -.calendar-calendar .month-view .full .week a, -.calendar-calendar .week-view .full .week a { - color: #4b85ac; -} - -.calendar-calendar .month-view .full td .inner div.day, -.calendar-calendar .month-view .full td .inner div.day a { - border: none; - background: none; - margin-bottom: 0px; -} - -.calendar-calendar .month-view .full td.date-box .inner, -.calendar-calendar .week-view .full td.date-box .inner { - min-height: inherit; -} - -.calendar-calendar .month-view .full td.multi-day, -.calendar-calendar .week-view .full td.multi-day { - border-top: 0px; - border-bottom: 0px; -} - -.calendar-calendar .week-view .full .first td.multi-day { - border-top: 1px solid #CCCCCC; -} - -.calendar-calendar .month-view .full td.single-day { - border-top: 0px; -} - -.calendar-calendar .month-view .full td.multi-day .inner, -.calendar-calendar .week-view .full td.multi-day .inner, -.calendar-calendar .day-view .full td.multi-day .inner { - min-height: inherit; - width: auto; - position: relative; -} - -.calendar-calendar .month-view .full td.multi-day.no-entry { - min-height: 0px; -} - -.calendar-calendar .month-view .full td.single-day .calendar-empty, -.calendar-calendar .month-view .full td.single-day.empty, -.calendar-calendar .month-view .full td.date-box.empty { - background: #F4F4F4; -} - -.calendar-calendar .month-view .full td.single-day .inner div, -.calendar-calendar .month-view .full td.single-day .inner div a , -.calendar-calendar .month-view .full td.multi-day .inner div, -.calendar-calendar .month-view .full td.multi-day .inner div a , -.calendar-calendar .month-view .full td .inner div.calendar.monthview div, -.calendar-calendar .month-view .full td .inner div.calendar.monthview div a, -.calendar-calendar .week-view .full td.single-day .inner div, -.calendar-calendar .week-view .full td.single-day .inner div a , -.calendar-calendar .week-view .full td.multi-day .inner div, -.calendar-calendar .week-view .full td.multi-day .inner div a , -.calendar-calendar .week-view .full td .inner div.calendar.weekview div, -.calendar-calendar .week-view .full td .inner div.calendar.weekview div a, -.calendar-calendar .day-view .full td .inner div.view-item, -.calendar-calendar .day-view .full td .inner div.calendar div, -.calendar-calendar .day-view .full td .inner div.calendar div a { - background: none; -} - -.calendar-calendar .day-view .full td .inner div.calendar div, -.calendar-calendar .day-view .full td .inner div.calendar div a { - margin: 0px 3px; -} - -.calendar-calendar .day-view .full td .inner div.calendar div.stripe { - margin: 0px; -} - -.calendar-calendar .month-view .full tr td.today, -.calendar-calendar .month-view .full tr.odd td.today, -.calendar-calendar .month-view .full tr.even td.today { - background: none; - border-left: 2px solid #7C7F12; - border-right: 2px solid #7C7F12; -} - -.calendar-calendar .month-view .full td.date-box.today { - border-width: 2px 2px 0px 2px; - border-style: solid; - border-color: #7C7F12; -} - -.calendar-calendar .month-view .full tr td.single-day.today { - border-bottom: 2px solid #7C7F12; -} - -.calendar-calendar .month-view .full tr td.multi-day.starts-today { - border-left: 2px solid #7C7F12; -} - -.calendar-calendar .month-view .full tr td.multi-day.ends-today { - border-right: 2px solid #7C7F12; -} - -.calendar-calendar .month-view .full tr td.multi-day, -.calendar-calendar .month-view .full tr td.single-day { - border-top: 0px; -} - -.calendar-calendar .month-view .full tr td.multi-day, -.calendar-calendar .month-view .full tr td.date-box { - border-bottom: 0px; -} - -.calendar-calendar .month-view .full .inner .monthview, -.calendar-calendar .week-view .full .inner .weekview, -.calendar-calendar .day-view .full .inner .dayview { - -moz-border-radius: 5px; - border-radius: 5px; - width: auto; - float: none; - display: block; - margin: .25em auto; - position: relative; -} - -.calendar-calendar .month-view .full td.single-day div.monthview, -.calendar-calendar .week-view .full td.single-day div.weekview, -.calendar-calendar .day-view .full td.single-day div.dayview { - background: #ffc; - width: auto; - padding: 0px 3px; - overflow: hidden; -} - -.calendar-calendar .month-view .full td.single-day .calendar-more div.monthview { - background: none; -} - -.calendar-calendar .day-view td div.dayview { - padding: 0px; -} - -.calendar-calendar .month-view .full td.multi-day div.monthview, -.calendar-calendar .week-view .full td.multi-day div.weekview, -.calendar-calendar .day-view .full td.multi-day div.dayview { - background: #74a5d7; - height: 1.9em; - overflow: hidden; - margin: 0px auto; - color: #ffffff; - position: relative; -} - -.calendar-calendar .week-view .full td.multi-day div.weekview { - height: 3.5em; -} - -.calendar-calendar .month-view .full td.multi-day .inner .view-field, -.calendar-calendar .month-view .full td.multi-day .inner .view-field a, -.calendar-calendar .week-view .full td.multi-day .inner .view-field, -.calendar-calendar .week-view .full td.multi-day .inner .view-field a, -.calendar-calendar .day-view .full td.multi-day .inner .view-field, -.calendar-calendar .day-view .full td.multi-day .inner .view-field a { - color: #ffffff; -} - -.calendar-calendar .full td.multi-day .calendar .view-field, -.calendar-calendar .full td.single-day .calendar .view-field { -} - -.calendar-calendar .day-view .full td.multi-day div.dayview, -.calendar-calendar .week-view .full td.multi-day div.weekview { - margin-bottom: 2px; -} - -.calendar-calendar .month-view .full td.multi-day .calendar.monthview .view-field { - white-space: nowrap; - float: left; - margin-right: 3px; -} - -.calendar-calendar .week-view .full td.multi-day .calendar.weekview .view-field { - white-space: nowrap; - display: inline; - margin-right: 3px; -} - -.calendar-calendar .day-view .full td.multi-day .calendar.weekview .view-field { - display: block; -} - -.calendar-calendar .month-view .full td.multi-day .calendar.monthview .contents, -.calendar-calendar .week-view .full td.multi-day .calendar.weekview .contents { - position: absolute; - width: 3000px; - left: 5px; -} - -.calendar-calendar .day-view td .stripe, -.calendar-calendar .month-view .full td .stripe, -.calendar-calendar .week-view .full td .stripe { - -moz-border-radius: 5px 5px 0px 0px; - border-radius: 5px 5px 0px 0px; - left: 0px; - top: 0px; - width: 100%; - height: 3px; - z-index: 2; -} - -.calendar-calendar .full td.single-day .continuation, -.calendar-calendar .full td.single-day .continues, -.calendar-calendar .full td.single-day .cutoff { - display: none; -} - -.calendar-calendar .month-view .full td.multi-day .inner .monthview .continuation, -.calendar-calendar .week-view .full td.multi-day .inner .weekview .continuation { - float:left; - margin-right: 3px; - height: 1.9em; -} - -.calendar-calendar .week-view .full td.multi-day .inner .weekview .continuation { - height: 2.75em; - padding-top: 0.75em; - margin-right: 8px; -} - -.calendar-calendar .month-view .full td.multi-day .inner .monthview .continues, -.calendar-calendar .month-view .full td.multi-day .inner .monthview .cutoff, -.calendar-calendar .week-view .full td.multi-day .inner .weekview .continues, -.calendar-calendar .week-view .full td.multi-day .inner .weekview .cutoff { - position: absolute; - right: 0px !important; - right: -1px; - width: 10px; - text-align: left; - background: #74a5d7; - -moz-border-radius: 0px 5px 5px 0px; - border-radius: 0px 5px 5px 0px; - height: 1.9em; - padding-left: 6px; - z-index: 1; -} - -.calendar-calendar .week-view .full td.multi-day .inner .weekview .continues, -.calendar-calendar .week-view .full td.multi-day .inner .weekview .cutoff { - height: 2.75em; - padding-top: 0.75em; -} - -.calendar-calendar .month-view .full td.multi-day .inner .monthview .cutoff, -.calendar-calendar .week-view .full td.multi-day .inner .weekview .cutoff { - width: 8px; - padding-left: 0px; -} - -.calendar-calendar .week-view .full td.multi-day { - padding: 2px; -} - -.calendar-calendar .week-view td.single-day div.calendar { - width: 100%; - padding-left: 0px; - padding-right: 0px; -} - -.calendar-calendar .week-view .full tr.last td.multi-day { - border-bottom:1px solid #CCCCCC; -} - -/** - * Restyle Header. - */ -.view .date-nav-wrapper .clear-block { - margin-bottom: 10px; -} - -.view .date-nav-wrapper { - position: relative; - margin-top: 5px; - width: 100%; -} - -.view .date-nav-wrapper .date-nav { - background-color: transparent; - border: 0px; - height: 30px; - height: auto; - min-height: 30px; - position: relative; - margin-bottom: 10px; -} - -.view .date-nav-wrapper .date-prev a, -.view .date-nav-wrapper .date-next a { - text-decoration: none; - color: inherit; - font-size: 12px; -} - -.view .date-nav-wrapper.date-nav a:hover { - text-decoration: underline; -} - -.view .date-nav-wrapper .date-prev { - -moz-border-radius: 5px 0 0 5px; - border-radius: 5px 0 0 5px; - background: none repeat scroll 0 0 #dfdfdf; - float: none; - padding: 5px 0; - position: absolute; - right: 60px; - left: auto; - text-align: right; - top: 0px; - width: auto; - z-index: 1; - font-size: 12px; -} - -.block-views .view .date-nav-wrapper .date-prev { - left: 0; - right: auto; -} - -.view .date-nav-wrapper .date-prev a { - margin-left: 10px; - font-weight: bold; -} - -.view .date-nav-wrapper .date-heading { - position: relative; - width: 100%; - top: 0px; - text-align: center; - z-index: 0; -} - -.view .date-nav-wrapper .date-heading h3 { - line-height: 30px; - font-size: 1.7em; -} - -.view .date-nav-wrapper .date-next { - -moz-border-radius: 0px 5px 5px 0px; - border-radius: 0px 5px 5px 0px; - background: none repeat scroll 0 0 #dfdfdf; - float: none; - padding: 5px 0; - position: absolute; - right: 0px; - text-align: right; - top: 0px; - width: auto; - z-index: 1; - font-size: 12px; -} - -.view .date-nav-wrapper .date-next a { - margin-right: 10px; - font-weight: bold; -} - -.attachment .calendar-calendar { - margin-top: 20px; - clear: both; -} - -.calendar-calendar th a, -.attachment .calendar-calendar th { - background-color: transparent; - border: 0px; -} - -.attachment .calendar-calendar th.calendar-agenda-hour { - color: #777777; - font-weight: bold; - text-align: right; -} - -.view-calendar .feed-icon { - margin-top: 5px; -} - -.view table.mini .date-prev, -.view table.mini .date-next { - background: none; -} - -.date-nav div.date-prev, -.date-nav div.date-next, -.date-nav { - width:auto; -} - -ul.calendar-links, -.region-content ul.calendar-links { - margin:0; - padding:0; -} - -.year-view div.month-view div.date-nav { - background-color: #DFDFDF; - min-height: 20px; -} diff --git a/web/modules/calendar/js/calendar_colorpicker.js b/web/modules/calendar/js/calendar_colorpicker.js deleted file mode 100644 index 44715289b09b34808b1d3265d3be3914cf914d18..0000000000000000000000000000000000000000 --- a/web/modules/calendar/js/calendar_colorpicker.js +++ /dev/null @@ -1,22 +0,0 @@ -(function ($) { - 'use strict'; - - /* - * Bind the colorpicker event to the form element - */ - Drupal.behaviors.calendar_colorpicker = { - attach: function (context) { - $('.edit-calendar-colorpicker').on('focus', function () { - var edit_field = this; - var picker = $(this).closest('div').parent().find('.calendar-colorpicker'); - - // Hide all color pickers except this one. - $('.calendar-colorpicker').hide(); - $(picker).show(); - $.farbtastic(picker, function (color) { - edit_field.value = color; - }).setColor(edit_field.value); - }); - } - }; -})(jQuery); diff --git a/web/modules/calendar/js/calendar_overlap.js b/web/modules/calendar/js/calendar_overlap.js deleted file mode 100644 index fb43a5525c33947ac5ff948cc346e099c9700801..0000000000000000000000000000000000000000 --- a/web/modules/calendar/js/calendar_overlap.js +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Create the splitter, set the viewport size, and set the position of the scrollbar to the first item. - */ -(function ($) { - 'use strict'; - - Drupal.behaviors.calendarSetScroll = { - attach: function (context) { - $('#single-day-container').css('visibility', 'hidden'); - - // Make multi-day resizable - stolen/borrowed from textarea.js - $('.header-body-divider:not(.header-body-divider-processed)').each(function () { - var divider = $(this).addClass('header-body-divider-processed'); - var start_y = divider.offset().top; - - // Add the grippie icon - $(this).prepend('<div class="grippie"></div>').mousedown(startDrag); - - function startDrag(e) { - start_y = divider.offset().top; - $(document).mousemove(performDrag).mouseup(endDrag); - return false; - } - - function performDrag(e) { - var offset = e.pageY - start_y; - var mwc = $('#multi-day-container'); - var sdc = $('#single-day-container'); - var mwc_height = mwc.height(); - var sdc_height = sdc.height(); - var max_height = mwc_height + sdc_height; - mwc.height(Math.min(max_height, Math.max(0, mwc_height + offset))); - sdc.height(Math.min(max_height, Math.max(0, sdc_height - offset))); - start_y = divider.offset().top; - return false; - } - - function endDrag(e) { - $(document).unbind('mousemove', performDrag).unbind('mouseup', endDrag); - } - }); - - $('.single-day-footer:not(.single-day-footer-processed)').each(function () { - var divider = $(this).addClass('single-day-footer-processed'); - var start_y = divider.offset().top; - - // Add the grippie icon - $(this).prepend('<div class="grippie"></div>').mousedown(startDrag); - - function startDrag(e) { - start_y = divider.offset().top; - $(document).mousemove(performDrag).mouseup(endDrag); - return false; - } - - function performDrag(e) { - var offset = e.pageY - start_y; - var sdc = $('#single-day-container'); - sdc.height(Math.max(0, sdc.height() + offset)); - start_y = divider.offset().top; - return false; - } - - function endDrag(e) { - $(document).unbind('mousemove', performDrag).unbind('mouseup', endDrag); - } - }); - - calendar_resizeViewport(); - calendar_scrollToFirst(); - - $('#single-day-container').css('visibility', 'visible'); - - // Scroll the viewport to the first item - function calendar_scrollToFirst() { - if ($('div.first_item').length > 0) { - var y = $('div.first_item').offset().top - $('#single-day-container').offset().top; - $('#single-day-container').scrollTop(y); - } - } - - // Size the single day view - function calendar_resizeViewport() { - // Size of the browser window - var viewportHeight = window.innerHeight ? window.innerHeight : $(window).height(); - var top = $('#single-day-container').offset().top; - - // Give it a 20 pixel margin at the bottom - $('#single-day-container').height(viewportHeight - top - 20); - } - } - }; -})(jQuery); diff --git a/web/modules/calendar/src/CalendarDateInfo.php b/web/modules/calendar/src/CalendarDateInfo.php deleted file mode 100644 index 2f8ed9304681b4cf59fce7eaaf0b80db1039e01b..0000000000000000000000000000000000000000 --- a/web/modules/calendar/src/CalendarDateInfo.php +++ /dev/null @@ -1,375 +0,0 @@ -<?php - -namespace Drupal\calendar; - -/** - * Defines a calendar date info object. - */ -class CalendarDateInfo { - - /** - * The calendar type. - * - * @var string - * The type of calendar. - */ - protected $calendarType; - - /** - * The date argument. - * - * @var \Drupal\calendar_datetime\Plugin\views\argument\Date $dateArgument - * The date argument. - */ - protected $dateArgument; - - /** - * The position of the date argument among the other view arguments. - * - * @var int dateArgumentPosition - * The date argument position. - */ - protected $dateArgumentPosition; - - /** - * The timezone information for this calendar. - * - * @var \DateTimeZone - * The timezone object. - */ - protected $timezone; - - /** - * The granularity of this calendar. - * - * @var string - * The granularity of this calendar (e.g. 'day', 'week'). - */ - protected $granularity; - - /** - * The range of this calendar. - * - * @var string - * The range of this calendar (e.g. '-3:+3'). - */ - protected $range; - - // @TODO Find a better way to hold all "minimum x" information - - /** - * The minimum date of this calendar. - * - * @var \DateTime - * The minimum date of this calendar. - */ - protected $minDate; - - /** - * The minimum year of this calendar. - * - * @var string - * The minimum year of this calendar. - */ - protected $minYear; - - /** - * The minimum month of this calendar. - * - * @var string - * The minimum month of this calendar. - */ - protected $minMonth; - - /** - * The minimum day of this calendar. - * - * @var string - * The minimum day of this calendar. - */ - protected $minDay; - - /** - * The minimum week number of this calendar. - * - * @var int - * The minimum week number of this calendar. - */ - protected $minWeek; - - /** - * The maximum date of this calendar. - * - * @var \DateTime - * The maximum date. - */ - protected $maxDate; - - /** - * @TODO explain what this variable does. - * - * @var boolean - * The forbid value. - */ - protected $forbid; - - /** - * Getter for the calendar type. - * - * @return string - * The calendar type. - */ - public function getCalendarType() { - return $this->calendarType; - } - - /** - * Setter for the calendar type. - * - * @param string $calendarType - * The calendar type. - */ - public function setCalendarType($calendarType) { - $this->calendarType = $calendarType; - } - - /** - * Getter for the date argument. - * - * @return \Drupal\calendar_datetime\Plugin\views\argument\Date - * The date argument. - */ - public function getDateArgument() { - return $this->dateArgument; - } - - /** - * Setter for the date argument. - * - * @param \Drupal\calendar_datetime\Plugin\views\argument\Date $dateArgument - * The date argument. - */ - public function setDateArgument($dateArgument) { - $this->dateArgument = $dateArgument; - } - - /** - * Getter for the date argument position. - * - * @return int - * The date argument position. - */ - public function getDateArgumentPosition() { - return $this->dateArgumentPosition; - } - - /** - * Setter for the date argument position. - * - * @param int $dateArgumentPosition - * The date argument position. - */ - public function setDateArgumentPosition($dateArgumentPosition) { - $this->dateArgumentPosition = $dateArgumentPosition; - } - - /** - * Getter for the timezone variable. - * - * @return \DateTimeZone - * The timezone variable. - */ - public function getTimezone() { - return $this->timezone; - } - - /** - * Setter for the timezone variable. - * - * @param \DateTimeZone $timezone - * The timezone variable. - */ - public function setTimezone($timezone) { - $this->timezone = $timezone; - } - - /** - * Getter for the calendar granularity. - * - * @return string - * The calendar granularity. - */ - public function getGranularity() { - return $this->granularity; - } - - /** - * Setter for the granularity. - * - * @param string $granularity - * The calendar granularity. - */ - public function setGranularity($granularity) { - $this->granularity = $granularity; - } - - /** - * Getter for the range. - * - * @return string - * The calendar range. - */ - public function getRange() { - return $this->range; - } - - /** - * Setter for the range. - * - * @param string $range - * The calendar range. - */ - public function setRange($range) { - $this->range = $range; - } - - /** - * Getter for the minimum date. - * - * @return \DateTime - * The minimum date. - */ - public function getMinDate() { - return $this->minDate; - } - - /** - * Setter for the minimum date. - * - * @param \DateTime $minDate - * The minimum date. - */ - public function setMinDate($minDate) { - $this->minDate = $minDate; - } - - /** - * Getter for the minimum year. - * - * @return string - * The minimum year. - */ - public function getMinYear() { - return $this->minYear; - } - - /** - * Setter for the minimum year. - * - * @param string $minYear - * The minimum year. - */ - public function setMinYear($minYear) { - $this->minYear = $minYear; - } - - /** - * Getter for the minimum month. - * - * @return string - * The minimum month. - */ - public function getMinMonth() { - return $this->minMonth; - } - - /** - * Setter for the minimum month. - * - * @param string $minMonth - * The minimum month. - */ - public function setMinMonth($minMonth) { - $this->minMonth = $minMonth; - } - - /** - * Getter for the minimum day. - * - * @return string - * The minimum day. - */ - public function getMinDay() { - return $this->minDay; - } - - /** - * Setter for the minimum day. - * - * @param string $minDay - * The minimum day. - */ - public function setMinDay($minDay) { - $this->minDay = $minDay; - } - - /** - * Getter for the minimum week number. - * - * @return int - * The minimum week number. - */ - public function getMinWeek() { - return $this->minWeek; - } - - /** - * Setter for the minimum week number. - * - * @param int $minWeek - * The minimum week number. - */ - public function setMinWeek($minWeek) { - $this->minWeek = $minWeek; - } - - /** - * Getter for the maximum date. - * - * @return \DateTime - * The maximum date. - */ - public function getMaxDate() { - return $this->maxDate; - } - - /** - * Setter for the maximum date. - * - * @param \DateTime $maxDate - * The maximum date. - */ - public function setMaxDate($maxDate) { - $this->maxDate = $maxDate; - } - - /** - * Getter for the forbid value of this calendar. - * - * @return boolean - * The forbid value. - */ - public function isForbid() { - return $this->forbid; - } - - /** - * Setter for the forbid value of this calendar. - * - * @param boolean $forbid - * The forbid value. - */ - public function setForbid($forbid) { - $this->forbid = $forbid; - } -} diff --git a/web/modules/calendar/src/CalendarEvent.php b/web/modules/calendar/src/CalendarEvent.php deleted file mode 100644 index 634696d4c85c284af54a1ece5ab2a061d353815e..0000000000000000000000000000000000000000 --- a/web/modules/calendar/src/CalendarEvent.php +++ /dev/null @@ -1,345 +0,0 @@ -<?php - -namespace Drupal\calendar; - -use Drupal\Core\Entity\ContentEntityInterface; - -/** - * Defines a calendar event object. - */ -class CalendarEvent { - - /** - * @var \DateTime $startDate - * The start date of the event. - */ - protected $startDate; - - /** - * @var \DateTime $endDate - * The end date of the event. - */ - protected $endDate; - - /** - * @var string $granularity - * The granularity of this event (e.g. "day", "second"). - */ - protected $granularity; - - /** - * @var boolean - * Defines whether or not this event's duration is all day. - */ - protected $allDay; - - /** - * @var \DateTimeZone $timezone - * The timezone of the event. - */ - protected $timezone; - - - /** - * @var array - * An array of the fields to render. - */ - protected $renderedFields; - - /** - * @var array $stripeLabels - * The array of labels to be used for this stripe option. - */ - protected $stripeLabels; - - /** - * @var string $stripeHexes - * The hex code array of the color to be used. - */ - protected $stripeHexes; - - /** - * @var bool $isMultiDay - * Whether this event covers multiple days. - */ - protected $isMultiDay; - - /** @var ContentEntityInterface */ - protected $entity; - - /** - * CalendarEvent constructor. - */ - public function __construct(ContentEntityInterface $entity) { - $this->entity = $entity; - } - - /** - * Getter for the entity id. - * - * @return int mixed - * The entity id. - */ - public function getEntityId() { - return $this->entity->id(); - } - - /** - * Getter for the entity type id. - * - * @todo Remove for getType - * - * @return string - * The entity type id. - */ - public function getEntityTypeId() { - return $this->entity->getEntityTypeId(); - } - - /** - * @return ContentEntityInterface - */ - public function getEntity() { - return $this->entity; - } - - /** - * Getter for the type. - * - * @return string - * The type of the entity. - */ - public function getType() { - return $this->entity->getEntityTypeId(); - } - - public function getBundle() { - return $this->entity->bundle(); - } - - - /** - * Getter for the start date. - * - * @return \DateTime - * The start date. - */ - public function getStartDate() { - return $this->startDate; - } - - /** - * Setter for the start date. - * - * @param \DateTime $startDate - * The start date. - */ - public function setStartDate($startDate) { - $this->startDate = $startDate; - } - - /** - * Getter for the end date. - * - * @return \DateTime - * The end date. - */ - public function getEndDate() { - return $this->endDate; - } - - /** - * Setter for the end date. - * - * @param \DateTime $endDate - * The end date. - */ - public function setEndDate($endDate) { - $this->endDate = $endDate; - } - - /** - * Getter for the event granularity. - * - * @return string - * The event granularity. - */ - public function getGranularity() { - return $this->granularity; - } - - /** - * Setter for the event granularity. - * - * @param string $granularity - * The event granularity. - */ - public function setGranularity($granularity) { - $this->granularity = $granularity; - } - - /** - * Getter for the all day property. - * - * @return boolean - * TRUE if the event is all day, FALSE otherwise. - */ - public function isAllDay() { - return $this->allDay; - } - - /** - * Setter for the all day property. - * - * @param boolean $allDay - * TRUE if the event is all day, FALSE otherwise. - */ - public function setAllDay($allDay) { - $this->allDay = $allDay; - } - - /** - * Getter for the timezone property. - * - * @return \DateTimeZone - * The timezone of this event. - */ - public function getTimezone() { - return $this->timezone; - } - - /** - * Setter for the timezone property. - * - * @param \DateTimeZone $timezone - * The timezone of this event. - */ - public function setTimezone($timezone) { - $this->timezone = $timezone; - } - - /** - * The title getter. - * - * @return string - * The title of the event. - */ - public function getTitle() { - return $this->entity->label(); - } - - /** - * Getter for the url. - * - * @return string - * The public url to this event. - */ - public function getUrl() { - return $this->getUrl(); - } - - - /** - * Getter for the rendered fields array. - * - * @return array - * The rendered fields array. - */ - public function getRenderedFields() { - return $this->renderedFields; - } - - /** - * Setter for the rendered fields array. - * - * @param array $renderedFields - * The rendered fields array. - */ - public function setRenderedFields($renderedFields) { - $this->renderedFields = $renderedFields; - } - - /** - * Getter for the stripe label array. - * - * If no array is defined, this initializes the variable to an empty array. - * - * @return array - * The stripe labels. - */ - public function getStripeLabels() { - if (!isset($this->stripeLabels)) { - $this->stripeLabels = []; - } - return $this->stripeLabels; - } - - /** - * Setter for the stripe label array. - * - * @param string $stripeLabels - * The stripe labels. - */ - public function setStripeLabels($stripeLabels) { - $this->stripeLabels = $stripeLabels; - } - - /** - * Getter for the stripe hex code array. - * - * If no array is defined, this initializes the variable to an empty array. - * - * @return array - * The stripe hex code array. - */ - public function getStripeHexes() { - if (!isset($this->stripeHexes)) { - $this->stripeHexes = []; - } - return $this->stripeHexes; - } - - /** - * The setter for the stripe hex code array. - * - * @param string $stripeHexes - * The stripe hex code array. - */ - public function setStripeHexes($stripeHexes) { - $this->stripeHexes = $stripeHexes; - } - - /** - * Add a single strip hex. - * - * @param $stripeHex - */ - public function addStripeHex($stripeHex) { - $this->stripeHexes[] = $stripeHex; - } - - /** - * Add a single strip label. - * - * @param $stripeHex - */ - public function addStripeLabel($stripeLabel) { - $this->stripeLabels[] = $stripeLabel; - } - - /** - * The getter which indicates whether an event covers multiple days. - * - * @return boolean - */ - public function getIsMultiDay() { - return $this->isMultiDay; - } - - /** - * The setter to indicate whether an event covers multiple days. - */ - public function setIsMultiDay($isMultiDay) { - $this->isMultiDay = $isMultiDay; - } -} diff --git a/web/modules/calendar/src/CalendarHelper.php b/web/modules/calendar/src/CalendarHelper.php deleted file mode 100644 index a8e208fa742f57e01dfec4ac679964dc1a247eeb..0000000000000000000000000000000000000000 --- a/web/modules/calendar/src/CalendarHelper.php +++ /dev/null @@ -1,934 +0,0 @@ -<?php - -namespace Drupal\calendar; - -use Datetime; -use DateTimeZone; -use Drupal\Core\Datetime\DateHelper; -use Drupal\Core\Routing\RouteProvider; -use Drupal\Core\Url; -use Drupal\views\Plugin\views\argument\ArgumentPluginBase; -use Drupal\views\Plugin\views\filter\Broken; -use Drupal\views\ViewExecutable; -use Drupal\views\Views; -use Drupal\Component\Utility\Unicode; -use Drupal\views\Plugin\views\argument\Date as ViewsDateArg; - -/** - * Defines Gregorian Calendar date values. - */ -class CalendarHelper extends DateHelper { - - /** - * Formats the weekday information into a table header format. - * - * @return array - * An array with weekday table header data. - */ - public static function weekHeader($view) { - $nameSize = $view->styleInfo->getNameSize(); - $len = isset($nameSize) ? $view->styleInfo->getNameSize() : (!empty($view->styleInfo->isMini()) ? 1 : 3); - $with_week = !empty($view->styleInfo->isShowWeekNumbers()); - - // create week header - $untranslated_days = self::untranslatedDays(); - $full_translated_days = self::weekDaysOrdered(self::weekDays(TRUE)); - if ($len == 99) { - $translated_days = $full_translated_days; - } - else { - $translated_days = self::weekDaysOrdered(self::weekDaysAbbr(TRUE)); - } - if ($with_week) { - $row[] = ['header' => TRUE, 'class' => 'days week', 'data' => '', 'header_id' => 'Week']; - } - foreach ($untranslated_days as $delta => $day) { - $label = $len < 3 ? Unicode::substr($translated_days[$delta], 0 , $len) : $translated_days[$delta]; - $row[] = ['header' => TRUE, 'class' => "days " . $day, 'data' => $label, 'header_id' => $full_translated_days[$delta]]; - } - return $row; - } - - - /** - * An array of untranslated day name abbreviations. - * - * The abbreviations are forced to lowercase and ordered appropriately for the - * site setting for the first day of week. - * - * @return array - * The untranslated day abbreviation is used in css classes. - */ - public static function untranslatedDays() { - $untranslated_days = self::weekDaysOrdered(DateHelper::weekDaysUntranslated()); - foreach ($untranslated_days as $delta => $day) { - $untranslated_days[$delta] = strtolower(substr($day, 0, 3)); - } - return $untranslated_days; - } - - /** - * Return a list of all calendar views. - * - * @return array - * A list of all calendar views. - */ - public static function listCalendarViews() { - $calendar_views = []; - $views = Views::getEnabledViews(); - foreach ($views as $view) { - $ve = $view->getExecutable(); - $ve->initDisplay(); - foreach ($ve->displayHandlers->getConfiguration() as $display_id => $display) { - if ($display_id != 'default' && $types = $ve->getStyle()->getPluginId() == 'calendar') { - $index = $ve->id() . ':' . $display_id; - $calendar_views[$index] = ucfirst($ve->id()) . ' ' . strtolower($display['display_title']) . ' [' . $ve->id() . ':' . $display['id'] . ']'; - } - } - } - return $calendar_views; - } - - /** - * Computes difference between two days using a given measure. - * - * @param DateTime $start_date - * The start date. - * @param DateTime $stop_date - * The stop date. - * @param string $measure - * (optional) A granularity date part. Defaults to 'seconds'. - * @param boolean $absolute - * (optional) Indicate whether the absolute value of the difference should - * be returned or if the sign should be retained. Defaults to TRUE. - * - * @return int - * The difference between the 2 dates in the given measure. - */ - public static function difference(DateTime $start_date, DateTime $stop_date, $measure = 'seconds', $absolute = TRUE) { - // Create cloned objects or original dates will be impacted by the - // date_modify() operations done in this code. - $date1 = clone($start_date); - $date2 = clone($stop_date); - if (is_object($date1) && is_object($date2)) { - $diff = $date2->format('U') - $date1->format('U'); - if ($diff == 0) { - return 0; - } - elseif ($diff < 0 && $absolute) { - // Make sure $date1 is the smaller date. - $temp = $date2; - $date2 = $date1; - $date1 = $temp; - $diff = $date2->format('U') - $date1->format('U'); - } - $year_diff = intval($date2->format('Y') - $date1->format('Y')); - switch ($measure) { - // The easy cases first. - case 'seconds': - return $diff; - - case 'minutes': - return $diff / 60; - - case 'hours': - return $diff / 3600; - - case 'years': - return $year_diff; - - case 'months': - $format = 'n'; - $item1 = $date1->format($format); - $item2 = $date2->format($format); - if ($year_diff == 0) { - return intval($item2 - $item1); - } - elseif ($year_diff < 0) { - $item_diff = 0 - $item1; - $item_diff -= intval((abs($year_diff) - 1) * 12); - return $item_diff - (12 - $item2); - } - else { - $item_diff = 12 - $item1; - $item_diff += intval(($year_diff - 1) * 12); - return $item_diff + $item2; - } - break; - - case 'days': - $format = 'z'; - $item1 = $date1->format($format); - $item2 = $date2->format($format); - if ($year_diff == 0) { - return intval($item2 - $item1); - } - elseif ($year_diff < 0) { - $item_diff = 0 - $item1; - for ($i = 1; $i < abs($year_diff); $i++) { - $date1->modify('-1 year'); - // @TODO self::daysInYear() throws a warning when used with a - // \DateTime object. See https://www.drupal.org/node/2596043 -// $item_diff -= self::daysInYear($date1); - $item_diff -= 365; - } -// return $item_diff - (self::daysInYear($date2) - $item2); - return $item_diff - (365 - $item2); - } - else { - // @TODO self::daysInYear() throws a warning when used with a - // \DateTime object. See https://www.drupal.org/node/2596043 -// $item_diff = self::daysInYear($date1) - $item1; - $item_diff = 365 - $item1; - for ($i = 1; $i < $year_diff; $i++) { - $date1->modify('+1 year'); -// $item_diff += self::daysInYear($date1); - $item_diff += 365; - } - return $item_diff + $item2; - } - break; - - case 'weeks': - $week_diff = $date2->format('W') - $date1->format('W'); - $year_diff = $date2->format('o') - $date1->format('o'); - - $sign = ($year_diff < 0) ? -1 : 1; - - for ($i = 1; $i <= abs($year_diff); $i++) { - $date1->modify((($sign > 0) ? '+': '-').'1 year'); - $week_diff += (self::isoWeeksInYear($date1) * $sign); - } - return $week_diff; - } - } - return NULL; - } - - /** - * Identifies the number of ISO weeks in a year for a date. - * - * December 28 is always in the last ISO week of the year. - * - * @param mixed $date - * (optional) The current date object, or a date string. Defaults to NULL. - * - * @return integer - * The number of ISO weeks in a year. - */ - public static function isoWeeksInYear($date = NULL) { - if (empty($date)) { - $date = new DateTime(); - } - elseif (!is_object($date)) { - $date = new DateTime($date); - } - - if (is_object($date)) { - date_date_set($date, $date->format('Y'), 12, 28); - return $date->format('W'); - } - return NULL; - } - - /** - * Checks if an event covers all day. - * - * @param string $start - * The start date. - * @param string $end - * The end date. - * @param string $granularity - * Granularity to be used during the calculation, defaults to "second". - * @param int $increment - * An integer value to increment the values. Defaults to 1. - * - * @return bool - */ - public static function dateIsAllDay($start, $end, $granularity = 'second', $increment = 1) { - if (empty($start) || empty($end)) { - return FALSE; - } - elseif (!in_array($granularity, ['hour', 'minute', 'second'])) { - return FALSE; - } - - preg_match('/([0-9]{4}-[0-9]{2}-[0-9]{2}) (([0-9]{2}):([0-9]{2}):([0-9]{2}))/', $start, $matches); - $count = count($matches); - $date1 = $count > 1 ? $matches[1] : ''; - $time1 = $count > 2 ? $matches[2] : ''; - $hour1 = $count > 3 ? intval($matches[3]) : 0; - $min1 = $count > 4 ? intval($matches[4]) : 0; - $sec1 = $count > 5 ? intval($matches[5]) : 0; - preg_match('/([0-9]{4}-[0-9]{2}-[0-9]{2}) (([0-9]{2}):([0-9]{2}):([0-9]{2}))/', $end, $matches); - $count = count($matches); - $date2 = $count > 1 ? $matches[1] : ''; - $time2 = $count > 2 ? $matches[2] : ''; - $hour2 = $count > 3 ? intval($matches[3]) : 0; - $min2 = $count > 4 ? intval($matches[4]) : 0; - $sec2 = $count > 5 ? intval($matches[5]) : 0; - if (empty($date1) || empty($date2)) { - return FALSE; - } - if (empty($time1) || empty($time2)) { - return FALSE; - } - - $tmp = self::seconds('s', TRUE, $increment); - $max_seconds = intval(array_pop($tmp)); - $tmp = self::minutes('i', TRUE, $increment); - $max_minutes = intval(array_pop($tmp)); - - // See if minutes and seconds are the maximum allowed for an increment or - // the maximum possible (59), or 0. - switch ($granularity) { - case 'second': - $min_match = $time1 == '00:00:00' - || ($hour1 == 0 && $min1 == 0 && $sec1 == 0); - $max_match = $time2 == '00:00:00' - || ($hour2 == 23 && in_array($min2, [$max_minutes, 59]) && in_array($sec2, [$max_seconds, 59])) - || ($hour1 == 0 && $hour2 == 0 && $min1 == 0 && $min2 == 0 && $sec1 == 0 && $sec2 == 0); - break; - case 'minute': - $min_match = $time1 == '00:00:00' - || ($hour1 == 0 && $min1 == 0); - $max_match = $time2 == '00:00:00' - || ($hour2 == 23 && in_array($min2, [$max_minutes, 59])) - || ($hour1 == 0 && $hour2 == 0 && $min1 == 0 && $min2 == 0); - break; - case 'hour': - $min_match = $time1 == '00:00:00' - || ($hour1 == 0); - $max_match = $time2 == '00:00:00' - || ($hour2 == 23) - || ($hour1 == 0 && $hour2 == 0); - break; - default: - $min_match = TRUE; - $max_match = FALSE; - } - - if ($min_match && $max_match) { - return TRUE; - } - - return FALSE; - } - - /** - * Calendar display types. - */ - public static function displayTypes() { - return ['year' => t('Year'), 'month' => t('Month'), 'day' => t('Day'), 'week' => t('Week')]; - } - - /** - * The calendar week number for a date. - * - * PHP week functions return the ISO week, not the calendar week. - * - * @param string $date - * A date string in the format Y-m-d. - * - * @return int - * The calendar week number. - */ - public static function dateWeek($date) { - $date = substr($date, 0, 10); - $parts = explode('-', $date); - - $timezone = new DateTimeZone('UTC'); - $date = new DateTime($date . ' 12:00:00', $timezone); - - $year_date = new DateTime($parts[0] . '-01-01 12:00:00', $timezone); - $week = intval($date->format('W')); - $year_week = intval(date_format($year_date, 'W')); - $date_year = intval($date->format('o')); - - // Remove the leap week if it's present. - if ($date_year > intval($parts[0])) { - $last_date = clone($date); - date_modify($last_date, '-7 days'); - $week = date_format($last_date, 'W') + 1; - } - elseif ($date_year < intval($parts[0])) { - $week = 0; - } - - if ($year_week != 1) { - $week++; - } - - // Convert to ISO-8601 day number, to match weeks calculated above. - $iso_first_day = 0; - - // If it's before the starting day, it's the previous week. - if (intval($date->format('N')) < $iso_first_day) { - $week--; - } - - // If the year starts before, it's an extra week at the beginning. - if (intval(date_format($year_date, 'N')) < $iso_first_day) { - $week++; - } - - return $week; - } - - /** - * Helper for identifying Date API fields for views. - * - * This is a ported version of date_views_fields() in date_views module in - * D7. - * - * @param string $base - * @return array - */ - public static function dateViewFields($base = 'node') { - - // Make sure $base is never empty. - if (empty($base)) { - $base = 'node'; - } - - $cid = 'date_views_fields_' . $base; -// cache_clear_all($cid, 'cache_views'); - - // We use fields that provide filter handlers as our universe of possible - // fields of interest. - $all_fields = self::viewsFetchFields($base, 'filter'); - - // Iterate over all the fields that Views knows about. - $fields = []; - foreach ((array) $all_fields as $alias => $value) { - // Set up some default values. - $granularity = ['year', 'month', 'day', 'hour', 'minute', 'second']; - $tz_handling = 'site'; - $related_fields = []; - $timezone_field = ''; - $offset_field = ''; - $rrule_field = ''; - $delta_field = ''; -// $sql_type = DATE_UNIX; - $sql_type = DATETIME_DATETIME_STORAGE_FORMAT; - $type = ''; - - $name = $alias; - $tmp = explode('.', $name); - $field_name = $tmp[1]; - $table_name = $tmp[0]; - - // Unset the date filter to avoid ugly recursion and broken values. - if ($field_name == 'date_filter') { - continue; - } - - $fromto = [$name, $name]; - - - // If we don't have a filter handler, we don't need to do anything more. - $filterHandler = Views::handlerManager('filter'); - $handler = $filterHandler->getHandler(['table' => $table_name, 'field' => $field_name,]); - if ($handler instanceof Broken) { - continue; - } - -// $handler = views_get_handler($table_name, $field_name, 'filter'); - $pluginDefinition = $handler->getPluginDefinition(); - - // We don't care about anything but date handlers. - if ($pluginDefinition['class'] != 'Drupal\views\Plugin\views\filter\Date' - && !is_subclass_of($pluginDefinition['class'], 'Drupal\views\Plugin\views\filter\Date')) { - continue; - } - $is_field = FALSE; - - // For Field module fields, get the date type. - $custom = []; - if ($field_name || isset($handler->definition['field_name'])) { -// $field = FieldConfig::loadByName($field_name); -// $field = field_info_field($handler->definition['field_name']); - $is_field = TRUE; -// switch ($field['type']) { - switch ($handler->getBaseId()) { - case 'date': - $sql_type = DATETIME_DATETIME_STORAGE_FORMAT; -// $sql_type = DATE_ISO; - break; - - case 'datestamp': - break; - - case 'datetime': -// $sql_type = DATE_DATETIME; - $sql_type = DATETIME_DATETIME_STORAGE_FORMAT; - break; - - default: - // If this is not a date field, nothing more to do. - continue; - } - -// $revision = in_array($base, array('node_revision')) ? FIELD_LOAD_REVISION : FIELD_LOAD_CURRENT; - // @todo find database info -// $db_info = date_api_database_info($field, $revision); - $name = $table_name . "." . $field_name; - $grans = ['year', 'month', 'day', 'hour', 'minute', 'second']; - $granularity = !empty($field['granularity']) ? $field['granularity'] : $grans; - -// $fromto = [ -// $table_name . '.' . $db_info['columns'][$table_name]['value'], -// $table_name . '.' . (!empty($field['settings']['todate']) ? $db_info['columns'][$table_name]['value2'] : $db_info['columns'][$table_name]['value']), -// ]; - -// if (isset($field['settings']['tz_handling'])) { -// $tz_handling = $field['settings']['tz_handling']; -// $db_info = date_api_database_info($field, $revision); -// if ($tz_handling == 'date') { -// $offset_field = $table_name . '.' . $db_info['columns'][$table_name]['offset']; -// } -// $related_fields = [ -// $table_name . '.' . $db_info['columns'][$table_name]['value'], -// ]; -// if (isset($db_info['columns'][$table_name]['value2'])) { -// $related_fields = array_merge($related_fields, [$table_name . '.' . $db_info['columns'][$table_name]['value2']]); -// } -// if (isset($db_info['columns'][$table_name]['timezone'])) { -// $related_fields = array_merge($related_fields, [$table_name . '.' . $db_info['columns'][$table_name]['timezone']]); -// $timezone_field = $table_name . '.' . $db_info['columns'][$table_name]['timezone']; -// } -// if (isset($db_info['columns'][$table_name]['rrule'])) { -// $related_fields = array_merge($related_fields, [$table_name . '.' . $db_info['columns'][$table_name]['rrule']]); -// $rrule_field = $table_name . '.' . $db_info['columns'][$table_name]['rrule']; -// } -// } - // Get the delta value into the query. -// if ($field['cardinality'] != 1) { -// array_push($related_fields, "$table_name.delta"); -// $delta_field = $table_name . '_delta'; -// } - } - - // Allow custom modules to provide date fields. - else { -// foreach (module_implements('date_views_fields') as $module) { -// $function = $module . '_date_views_fields'; -// if ($custom = $function("$table_name.$field_name")) { -// $type = 'custom'; -// break; -// } -// } - } - // Don't do anything if this is not a date field we can handle. - if (!empty($type) || empty($custom)) { - $alias = str_replace('.', '_', $alias); - $fields['name'][$name] = [ - 'is_field' => $is_field, - 'sql_type' => $sql_type, -// 'label' => $val['group'] . ': ' . $val['title'], - 'granularity' => $granularity, - 'fullname' => $name, - 'table_name' => $table_name, - 'field_name' => $field_name, - 'query_name' => $alias, - 'fromto' => $fromto, - 'tz_handling' => $tz_handling, - 'offset_field' => $offset_field, - 'timezone_field' => $timezone_field, - 'rrule_field' => $rrule_field, - 'related_fields' => $related_fields, - 'delta_field' => $delta_field, - ]; - - // Allow the custom fields to over-write values. - if (!empty($custom)) { - foreach ($custom as $key => $field_value) { - $fields['name'][$name][$key] = $field_value; - } - } - $fields['name'][$name]['real_field_name'] = $field_name; - $fields['alias'][$alias] = $fields['name'][$name]; - } - } -// cache_set($cid, $fields, 'cache_views'); - return $fields; - } - - /** - * Fetch a list of all fields available for a given base type. - * - * This is a ported version of views_fetch_fields() in date_views module in - * D7. - * - * @param $base - * @param $type - * @param bool|FALSE $grouping - * @return array - */ - private static function viewsFetchFields($base, $type, $grouping = FALSE) { - static $fields = []; - if (empty($fields)) { - $data = Views::viewsData()->get(); - $start = microtime(TRUE); - // This constructs this ginormous multi dimensional array to - // collect the important data about fields. In the end, - // the structure looks a bit like this (using nid as an example) - // $strings['nid']['filter']['title'] = 'string'. - // - // This is constructed this way because the above referenced strings - // can appear in different places in the actual data structure so that - // the data doesn't have to be repeated a lot. This essentially lets - // each field have a cheap kind of inheritance. - - foreach ($data as $table => $table_data) { - $bases = []; - $strings = []; - $skip_bases = []; - foreach ($table_data as $field => $info) { - // Collect table data from this table - if ($field == 'table') { - // calculate what tables this table can join to. - if (!empty($info['join'])) { - $bases = array_keys($info['join']); - } - // And it obviously joins to itself. - $bases[] = $table; - continue; - } - foreach (['field', 'sort', 'filter', 'argument', 'relationship', 'area'] as $key) { - if (!empty($info[$key])) { - if ($grouping && !empty($info[$key]['no group by'])) { - continue; - } - if (!empty($info[$key]['skip base'])) { - foreach ((array) $info[$key]['skip base'] as $base_name) { - $skip_bases[$field][$key][$base_name] = TRUE; - } - } - elseif (!empty($info['skip base'])) { - foreach ((array) $info['skip base'] as $base_name) { - $skip_bases[$field][$key][$base_name] = TRUE; - } - } - // Don't show old fields. The real field will be added right. - if (isset($info[$key]['moved to'])) { - continue; - } - foreach (['title', 'group', 'help', 'base', 'aliases'] as $string) { - // First, try the lowest possible level - if (!empty($info[$key][$string])) { - $strings[$field][$key][$string] = $info[$key][$string]; - } - // Then try the field level - elseif (!empty($info[$string])) { - $strings[$field][$key][$string] = $info[$string]; - } - // Finally, try the table level - elseif (!empty($table_data['table'][$string])) { - $strings[$field][$key][$string] = $table_data['table'][$string]; - } - else { - if ($string != 'base' && $string != 'base') { - $strings[$field][$key][$string] = t("Error: missing @component", ['@component' => $string]); - } - } - } - } - } - } - foreach ($bases as $base_name) { - foreach ($strings as $field => $field_strings) { - foreach ($field_strings as $type_name => $type_strings) { - if (empty($skip_bases[$field][$type_name][$base_name])) { - $fields[$base_name][$type_name]["$table.$field"] = $type_strings; - } - } - } - } - } -// vsm('Views UI data build time: ' . (views_microtime() - $start) * 1000 . ' ms'); - } - - // If we have an array of base tables available, go through them - // all and add them together. Duplicate keys will be lost and that's - // Just Fine. - if (is_array($base)) { - $strings = []; - foreach ($base as $base_table) { - if (isset($fields[$base_table][$type])) { - $strings += $fields[$base_table][$type]; - } - } - uasort($strings, '_views_sort_types'); - return $strings; - } - - // @todo find out if this hack is right -// if (isset($fields[$base][$type])) { -// uasort($fields[$base][$type], '_views_sort_types'); -// return $fields[$base][$type]; -// } - $all_fields = []; - foreach ($fields as $key => $field) { - if ($base == substr($key, 0, 4)) { - if (isset($fields[$key][$type])) { -// uasort($fields[$key][$type], '_views_sort_types'); - $all_fields = array_merge($all_fields, $fields[$key][$type]); - } - } - } - return $all_fields; -// return []; - } - - /** - * Argument can be used as calendar argument. - * - * @param \Drupal\views\Plugin\views\argument\ArgumentPluginBase $arg - * - * @return bool - */ - public static function isCalendarArgument(ArgumentPluginBase $arg) { - return $arg instanceof ViewsDateArg; - } - - /** - * Helper function to find the first date argument handler for this view. - * - * @param \Drupal\views\ViewExecutable $view - * @param null $display_id - * - * @return \Drupal\calendar\DateArgumentWrapper|FALSE - * Returns the Date handler if one is found, or FALSE otherwise. - */ - public static function getDateArgumentHandler(ViewExecutable $view, $display_id = NULL) { - $all_arguments = []; - if ($display_id) { - // If we aren't dealing with current display we have to load the argument handlers. - /** @var \Drupal\views\Plugin\ViewsHandlerManager $argument_manager */ - $argument_manager = \Drupal::getContainer()->get('plugin.manager.views.argument'); - - $argument_configs = $view->getHandlers('argument', $display_id); - foreach ($argument_configs as $argument_config) { - $all_arguments[] = $argument_manager->getHandler($argument_config); - } - } - else { - // $view->argument actually contains an array of current arguments. - $all_arguments = $view->argument; - } - if ($all_arguments) { - $current_position = 0; - /** - * @var $name - * @var \Drupal\views\Plugin\views\argument\ArgumentPluginBase $handler - */ - foreach ($all_arguments as $name => $handler) { - if (static::isCalendarArgument($handler)) { - $wrapper = new DateArgumentWrapper($handler); - $wrapper->setPosition($current_position); - return $wrapper; - } - $current_position++; - } - } - return FALSE; - } - - /** - * Limits a date format to include only elements from a given granularity array. - * - * Example: - * DateGranularity::limitFormat('F j, Y - H:i', ['year', 'month', 'day']); - * returns 'F j, Y' - * - * @param string $format - * A date format string. - * @param array $array - * An array of allowed date parts, all others will be removed. - * - * @return string - * The format string with all other elements removed. - */ - public static function limitFormat($format, $array) { - // If punctuation has been escaped, remove the escaping. Done using strtr() - // because it is easier than getting the escape character extracted using - // preg_replace(). - $replace = [ - '\-' => '-', - '\:' => ':', - "\'" => "'", - '\. ' => ' . ', - '\,' => ',', - ]; - $format = strtr($format, $replace); - - $format = str_replace('\T', ' ', $format); - $format = str_replace('T', ' ', $format); - - $regex = []; - // Create regular expressions to remove selected values from string. - // Use (?<!\\\\) to keep escaped letters from being removed. - foreach ($array as $element) { - switch ($element) { - case 'year': - $regex[] = '([\-/\.,:]?\s?(?<!\\\\)[Yy])'; - break; - case 'day': - $regex[] = '([\-/\.,:]?\s?(?<!\\\\)[l|D|d|dS|j|jS|N|w|W|z]{1,2})'; - break; - case 'month': - $regex[] = '([\-/\.,:]?\s?(?<!\\\\)[FMmn])'; - break; - case 'hour': - $regex[] = '([\-/\.,:]?\s?(?<!\\\\)[HhGg])'; - break; - case 'minute': - $regex[] = '([\-/\.,:]?\s?(?<!\\\\)[i])'; - break; - case 'second': - $regex[] = '([\-/\.,:]?\s?(?<!\\\\)[s])'; - break; - case 'timezone': - $regex[] = '([\-/\.,:]?\s?(?<!\\\\)[TOZPe])'; - break; - - } - } - // Remove empty parentheses, brackets, pipes. - $regex[] = '(\(\))'; - $regex[] = '(\[\])'; - $regex[] = '(\|\|)'; - - // Remove selected values from string. - $format = trim(preg_replace($regex, [], $format)); - // Remove orphaned punctuation at the beginning of the string. - $format = preg_replace('`^([\-/\.,:\'])`', '', $format); - // Remove orphaned punctuation at the end of the string. - $format = preg_replace('([\-/,:\']$)', '', $format); - $format = preg_replace('(\\$)', '', $format); - - // Trim any whitespace from the result. - $format = trim($format); - - // After removing the non-desired parts of the format, test if the only things - // left are escaped, non-date, characters. If so, return nothing. - // Using S instead of w to pick up non-ASCII characters. - $test = trim(preg_replace('(\\\\\S{1,3})', '', $format)); - if (empty($test)) { - $format = ''; - } - - return $format; - } - - /** - * Get the display that handles a given granularity. - * - * @param \Drupal\views\ViewExecutable $view - * @param $granularity - * - * @return mixed - */ - static function getDisplayForGranularity(ViewExecutable $view, $granularity) { - $displays = &drupal_static(__FUNCTION__, []); - $view_name = $view->id(); - if (!array_key_exists($view_name, $displays) || (isset($displays[$view->id()]) && !(array_key_exists($granularity, $displays[$view->id()])))) { - $displays[$view_name][$granularity] = NULL; - - foreach ($view->displayHandlers->getConfiguration() as $id => $display) { - $loaded_display = $view->displayHandlers->get($id); - if (!$loaded_display || !$view->displayHandlers->get($id)->isEnabled()) { - continue; - } - - if ($display['display_plugin'] != 'feed' && !empty($display['display_options']['path']) && !empty($display['display_options']['arguments'])) { - - // Set to the default value, reset below if another value is found. - $argument = static::getDateArgumentHandler($view, $id); - - if ($argument->getGranularity() == $granularity) { - - $displays[$view->id()][$granularity] = $display['id']; - } - } - } - } - return $displays[$view->id()][$granularity]; - } - - /** - * Get the Url object that will link to the view for the given granularity and arguments. - * - * @todo Allow a View to link to other Views by itself for a certain granularity. - * - * @param \Drupal\views\ViewExecutable $view - * @param $granularity - * @param $arguments - * - * @return \Drupal\Core\Url|null - */ - static function getURLForGranularity(ViewExecutable $view, $granularity, $arguments) { - $granularity_links = $view->getStyle()->options['granularity_links']; - if ($granularity_links[$granularity]) { - /** @var RouteProvider $router */ - $router = \Drupal::getContainer()->get('router.route_provider'); - $route_name = $granularity_links[$granularity]; - // Check if route exists. $router->getRoutesByName will throw error if no match. - $routes =$router->getRoutesByNames([$route_name]); - if ($routes) { - return Url::fromRoute($route_name, static::getViewRouteParameters($arguments)); - } - } - if ($display_id = static::getDisplayForGranularity($view, $granularity)) { - // @todo Handle arguments in different positions - // @todo Handle query string parameters. - return static::getViewsURL($view, $display_id, $arguments); - } - - return NULL; - } - - /** - * Get the Url object to link to a View display with given arguments. - * - * @param \Drupal\views\ViewExecutable $view - * @param $display_id - * @param array $args - * - * @return \Drupal\Core\Url - */ - static function getViewsURL(ViewExecutable $view, $display_id, $args = []) { - $route_parameters = static::getViewRouteParameters($args); - $route_name = static::getDisplayRouteName($view->id(), $display_id); - return Url::fromRoute($route_name, $route_parameters); - } - - /** - * Get Route name for a display - * - * Not sure where is documented but the route names are made in \Drupal\views\EventSubscriber\RouteSubscriber - * @param $view_id - * @param $display_id - * - * @return string - */ - static function getDisplayRouteName($view_id, $display_id) { - return 'view.' . $view_id . '.' . $display_id; - } - - /** - * @param $args - * - * @return array - */ - static function getViewRouteParameters($args) { - $route_parameters = []; - $arg_position = 0; - foreach ($args as $arg) { - $route_parameters['arg_' . $arg_position] = $arg; - $arg_position++; - } - return $route_parameters; - } -} diff --git a/web/modules/calendar/src/CalendarStyleInfo.php b/web/modules/calendar/src/CalendarStyleInfo.php deleted file mode 100644 index fadfe91d8082792e65ce3b4fe6632c7f8b807831..0000000000000000000000000000000000000000 --- a/web/modules/calendar/src/CalendarStyleInfo.php +++ /dev/null @@ -1,428 +0,0 @@ -<?php - -namespace Drupal\calendar; - -/** - * Defines a calendar style info object. - */ -class CalendarStyleInfo { - - /** - * Defines whether or not to show this calendar in a popup. - * - * @var boolean - * TRUE to show the calendar in a popup, FALSE otherwise. - */ - protected $calendarPopup; - - /** - * Defines whether or not this is a mini calendar. - * - * @var boolean - * TRUE if the calendar is shown in mini, FALSE otherwise. - */ - protected $mini; - - /** - * The size of the month name. - * - * @var int - * The size of the month name. - */ - protected $monthNameSize; - - /** - * The size of the calendar name. - * - * @var int - * The size of the calendar name. - */ - protected $nameSize; - - /** - * Defines whether or not to display the title. - * - * @var boolean - * TRUE to display the title, FALSE otherwise. - */ - protected $showTitle; - - /** - * Defines whether or not to display the navigation. - * - * @var boolean - * TRUE to display the navigation, FALSE otherwise. - */ - protected $showNavigation; - - /** - * Defines whether or not to display the week numbers. - * - * @var boolean - * TRUE to display the week numbers, FAlSE otherwise. - */ - protected $showWeekNumbers; - - /** - * Defines whether or not to display empty times. - * - * @var boolean - */ - protected $showEmptyTimes; - - /** - * Defines the way of grouping items. - * - * @var string - * The way of grouping items (e.g. 'hour', 'half'). - */ - protected $groupByTimes; - - /** - * Defines a custom way of grouping by times. - * - * @var string - * The grouping by times. - */ - protected $customGroupByTimes; - - /** - * Defines a custom group by field. - * - * @var string - * A field to group items by. - */ - protected $customGroupByField; - - /** - * The maximum amount of items to show. - * - * @var int - * The maximum amount. - */ - protected $maxItems; - - /** - * Defines what the maximum items style is. - * - * @var string - * The maximum items style (e.g. 'hide'). - */ - protected $maxItemsStyle; - - /** - * Defines what the theme style is. - * - * @var int - * The index number of the theme style. - */ - protected $themeStyle; - - /** - * Defines what the multi day theme is. - * - * @var int - * The index number of the multiday theme. - */ - protected $multiDayTheme; - - /** - * Getter for the calendar popup variable. - * - * @return boolean - * TRUE to show the calendar in a popup, FALSE otherwise. - */ - public function isCalendarPopup() { - return $this->calendarPopup; - } - - /** - * Setter for the calendar popup variable. - * - * @param boolean $calendarPopup - * TRUE to show the calendar in a popup, FALSE otherwise. - */ - public function setCalendarPopup($calendarPopup) { - $this->calendarPopup = $calendarPopup; - } - - /** - * Getter for the mini format variable. - * - * @return boolean - * TRUE if the calendar is shown in mini, FALSE otherwise. - */ - public function isMini() { - return $this->mini; - } - - /** - * Setter for the mini format variable. - * - * @param boolean $mini - * TRUE if the calendar is shown in mini, FALSE otherwise. - */ - public function setMini($mini) { - $this->mini = $mini; - } - - /** - * Getter for the month name size. - * - * @return int - * The month name size. - */ - public function getMonthNameSize() { - return $this->monthNameSize; - } - - /** - * Setter for the month name size. - * - * @param int $nameSize - * The month name size. - */ - public function setMonthNameSize($nameSize) { - $this->monthNameSize = $nameSize; - } - - /** - * Getter for the name size. - * - * @return int - * The name size. - */ - public function getNameSize() { - return $this->nameSize; - } - - /** - * Setter for the name size. - * - * @param int $nameSize - * The name size. - */ - public function setNameSize($nameSize) { - $this->nameSize = $nameSize; - } - - /** - * Getter for the show title variable. - * - * @return boolean - * TRUE to display the title, FALSE otherwise. - */ - public function isShowTitle() { - return $this->showTitle; - } - - /** - * Setter for the show title variable. - * - * @param boolean $showTitle - * TRUE to display the title, FALSE otherwise. - */ - public function setShowTitle($showTitle) { - $this->showTitle = $showTitle; - } - - /** - * Getter for the show navigation variable. - * - * @return boolean - * TRUE to show the navigation, FALSE otherwise. - */ - public function isShowNavigation() { - return $this->showNavigation; - } - - /** - * Setter for the show navigation variable. - * - * @param boolean $showNavigation - * TRUE to show the navigation, FALSE otherwise. - */ - public function setShowNavigation($showNavigation) { - $this->showNavigation = $showNavigation; - } - - /** - * Getter for the show week numbers variable. - * - * @return boolean - * TRUE to display the week numbers, FAlSE otherwise. - */ - public function isShowWeekNumbers() { - return $this->showWeekNumbers; - } - - /** - * Setter for the show week numbers variable. - * - * @param boolean $showWeekNumbers - * TRUE to display the week numbers, FAlSE otherwise. - */ - public function setShowWeekNumbers($showWeekNumbers) { - $this->showWeekNumbers = $showWeekNumbers; - } - - /** - * Getter for the show empty times variable. - * - * @return boolean - * TRUE to show empty times, FALSE otherwise. - */ - public function isShowEmptyTimes() { - return $this->showEmptyTimes; - } - - /** - * Setter for the show empty times variable. - * - * @param boolean $showEmptyTimes - * TRUE to show empty times, FALSE otherwise. - */ - public function setShowEmptyTimes($showEmptyTimes) { - $this->showEmptyTimes = $showEmptyTimes; - } - - /** - * Getter for the group by times property. - * - * @return string - * The group by time property. - */ - public function getGroupByTimes() { - return $this->groupByTimes; - } - - /** - * Setter for the group by times property. - * - * @param string $groupByTimes - * The group by time property. - */ - public function setGroupByTimes($groupByTimes) { - $this->groupByTimes = $groupByTimes; - } - - /** - * Getter for the custom group by times variable. - * - * @return string - * The custom grouping by times. - */ - public function getCustomGroupByTimes() { - return $this->customGroupByTimes; - } - - /** - * Setter for the custom group by times variable. - * - * @param string $customGroupByTimes - * The custom grouping by times. - */ - public function setCustomGroupByTimes($customGroupByTimes) { - $this->customGroupByTimes = $customGroupByTimes; - } - - /** - * Getter for the custom group by field variable. - * - * @return string - * The custom group by field. - */ - public function getCustomGroupByField() { - return $this->customGroupByField; - } - - /** - * Setter for the custom group by field variable. - * - * @param string $customGroupByField - * The custom group field. - */ - public function setCustomGroupByField($customGroupByField) { - $this->customGroupByField = $customGroupByField; - } - - /** - * Getter for the max items variable. - * - * @return int - * The maximum amount of items to show. - */ - public function getMaxItems() { - return $this->maxItems; - } - - /** - * Setter for the max items variable. - * - * @param int $maxItems - * The maximum amount of items to show. - */ - public function setMaxItems($maxItems) { - $this->maxItems = $maxItems; - } - - /** - * Getter for the max items style. - * - * @return string - * The maximum items style. - */ - public function getMaxItemsStyle() { - return $this->maxItemsStyle; - } - - /** - * Setter for the maximum items style. - * - * @param string $maxItemsStyle - * The maximum items style. - */ - public function setMaxItemsStyle($maxItemsStyle) { - $this->maxItemsStyle = $maxItemsStyle; - } - - /** - * Getter for the multiday theme. - * - * @return int - * The index number of the multiday theme. - */ - public function getMultiDayTheme() { - return $this->multiDayTheme; - } - - /** - * Setter for the multi day theme variable. - * - * @param int $multiDayTheme - * The index number of the multiday theme. - */ - public function setMultiDayTheme($multiDayTheme) { - $this->multiDayTheme = $multiDayTheme; - } - - /** - * Getter for the theme style variable. - * - * @return int - * The index number of the theme style. - */ - public function getThemeStyle() { - return $this->themeStyle; - } - - /** - * Setter for the theme style variable. - * - * @param int $themeStyle - * The index number of the theme style. - */ - public function setThemeStyle($themeStyle) { - $this->themeStyle = $themeStyle; - } -} diff --git a/web/modules/calendar/src/CalendarViewsTrait.php b/web/modules/calendar/src/CalendarViewsTrait.php deleted file mode 100644 index ab506dd6b99c4b7726614f75cb29e76fa109abee..0000000000000000000000000000000000000000 --- a/web/modules/calendar/src/CalendarViewsTrait.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php - -namespace Drupal\calendar; - -use Drupal\Core\Entity\EntityFieldManagerInterface; -use Drupal\views\Views; - -trait CalendarViewsTrait { - - - protected function getTableEntityType($table) { - static $recursion = 0; - if ($table = Views::viewsData()->get($table)) { - if (!empty($table['table']['entity type'])) { - // Reset recursion when we found a value. - $recursion = 0; - return $table['table']['entity type']; - } - elseif (!empty($table['table']['join']) && count($table['table']['join']) == 1) { - if (empty($recursion)) { - $join_table = array_pop(array_keys($table['table']['join'])); - $recursion++; - return $this->getTableEntityType($join_table); - } - } - } - return NULL; - } - - /** - * Determine if this field is Entity Reference field that references a taxonomy term. - * - * @todo Change to a more generic is Content Entity Reference. - * - * @param $field_info - * @param \Drupal\Core\Entity\EntityFieldManagerInterface $field_manager - */ - protected function isTermReferenceField($field_info, EntityFieldManagerInterface $field_manager) { - if (!empty($field_info['type']) && $field_info['type'] == 'entity_reference_label') { - if ($entity_type = $this->getTableEntityType($field_info['table'])) { - $field_definitions = $field_manager->getFieldStorageDefinitions($entity_type); - $field_definition = $field_definitions[$field_info['field']]; - $target_type = $field_definition->getSetting('target_type'); - return $target_type == 'taxonomy_term'; - } - } - return FALSE; - } - -} diff --git a/web/modules/calendar/src/DateArgumentWrapper.php b/web/modules/calendar/src/DateArgumentWrapper.php deleted file mode 100644 index dc13a0498b0296b171cd00fd3339e640506a9973..0000000000000000000000000000000000000000 --- a/web/modules/calendar/src/DateArgumentWrapper.php +++ /dev/null @@ -1,221 +0,0 @@ -<?php - -namespace Drupal\calendar; - - -use Drupal\views\Plugin\views\argument\Date; - -class DateArgumentWrapper { - - /** - * @var \Drupal\views\Plugin\views\argument\Date - */ - protected $dateArg; - - /** - * @var \DateTime - */ - protected $min_date; - - /** - * @var \DateTime - */ - protected $max_date; - - /** - * @var int - */ - protected $position; - - /** - * @return int - */ - public function getPosition() { - return $this->position; - } - - /** - * @param int $position - */ - public function setPosition($position) { - $this->position = $position; - } - - /** - * @return Date - */ - public function getDateArg() { - return $this->dateArg; - } - - /** - * DateArgumentWrapper constructor. - */ - public function __construct(Date $dateArg) { - $this->dateArg = $dateArg; - } - - /** - * Get the argument date format for the handler. - * - * \Drupal\views\Plugin\views\argument\Date has no getter for - * protected argFormat member. - * - * @return string - */ - public function getArgFormat() { - $class = get_class($this->dateArg); - if (stripos($class, 'YearMonthDate') !== FALSE) { - return 'Ym'; - } - if (stripos($class, 'FullDate') !== FALSE) { - return 'Ymd'; - } - if (stripos($class, 'YearDate') !== FALSE) { - return 'Y'; - } - if (stripos($class, 'YearWeekDate') !== FALSE) { - return 'YW'; - } - } - - public function createDateTime() { - if ($value = $this->dateArg->getValue()) { - if (!$this->validateValue()) { - return FALSE; - } - return $this->createFromFormat($value); - } - return NULL; - } - - protected function createFromFormat($value) { - $format = $this->getArgFormat(); - if ($format == 'YW') { - $date = new \DateTime(); - $year = (int)substr($value, 0, 4); - $month = (int)substr($value, 4, 2); - $date->setISODate($year, $month); - } - else { - // Adds a ! character to the format so that the date is reset instead of - // using the current day info, which can lead to issues for months with - // 31 days. - $format = '!' . $this->getArgFormat(); - $date = \DateTime::createFromFormat($format, $value); - } - return $date; - } - - public function format($format) { - if ($date = $this->createDateTime()) { - return $date->format($format); - } - return NULL; - } - - public function getGranularity() { - $plugin_id = $this->dateArg->getPluginId(); - $plugin_granularity = str_replace('datetime_', '', $plugin_id); - $plugin_granularity = str_replace('date_', '', $plugin_granularity); - switch ($plugin_granularity) { - case 'year_month': - return 'month'; - break; - // Views and Datetime module don't use same suffix :(. - case 'full_date': - case 'fulldate': - return 'day'; - break; - case 'year': - return 'year'; - break; - case 'year_week'; - return 'week'; - break; - } - } - - /** - * @return \DateTime - */ - public function getMinDate() { - if(!$this->min_date) { - $date = $this->createDateTime(); - $granularity = $this->getGranularity(); - if ($granularity == 'month') { - $date->modify("first day of this month"); - } - elseif ($granularity == 'week') { - $date->modify('this week'); - } - elseif ($granularity == 'year') { - $date->modify("first day of January"); - } - $date->setTime(0,0,0); - $this->min_date = $date; - } - return $this->min_date; - } - - /** - * @return \DateTime - */ - public function getMaxDate() { - if(!$this->max_date) { - $date = $this->createDateTime(); - $granularity = $this->getGranularity(); - if ($granularity == 'month') { - $date->modify("last day of this month"); - } - elseif ($granularity == 'week') { - $date->modify('this week +6 days'); - } - elseif ($granularity == 'year') { - $date->modify("last day of December"); - } - $date->setTime(23,59,59); - $this->max_date = $date; - } - return $this->max_date; - } - - /** - * Check if a string value is valid for this format. - * - * \DateTime::createFromFormat will not throw an error but try to make a date - * \DateTime::getLastErrors() is also not reliable. - * - * @param string $value - * - * @return bool - */ - public function validateValue() - { - $value = $this->dateArg->getValue(); - if (empty($value)) { - return FALSE; - } - if ($this->getArgFormat() == 'YW') { - $info = $this->getYearWeek($value); - // Find the max week for a year. Some years start a 53rd week. - $max_week = gmdate("W", strtotime("28 December {$info['year']}")); - return $info['week'] >= 1 && $info['week'] <= $max_week; - - } - else { - $created_date = $this->createFromFormat($value); - return $created_date && $created_date->format($this->getArgFormat()) == $value; - } - - } - - protected function getYearWeek($value) { - if (is_numeric($value) && strlen($value) == 6) { - $return['year'] = (int)substr($value, 0, 4); - $return['week'] = (int)substr($value, 4, 2); - return $return; - } - return FALSE; - } -} diff --git a/web/modules/calendar/src/Form/CalendarSettingsForm.php b/web/modules/calendar/src/Form/CalendarSettingsForm.php deleted file mode 100644 index 43795859cfadc00cb22fc70f7059c1c72b2d60e0..0000000000000000000000000000000000000000 --- a/web/modules/calendar/src/Form/CalendarSettingsForm.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php - -namespace Drupal\calendar\Form; - -use Drupal\Core\Form\ConfigFormBase; -use Drupal\Core\Form\FormStateInterface; - -/** - * Defines the admin configuration form for the calendar module. - */ -class CalendarSettingsForm extends ConfigFormBase { - - /** - * {@inheritdoc} - */ - protected function getEditableConfigNames() { - return [ - 'calendar.settings', - ]; - } - - /** - * {@inheritdoc} - */ - public function getFormId() { - return 'calendar_admin_form'; - } - - /** - * {@inheritdoc} - */ - public function buildForm(array $form, FormStateInterface $form_state) { - $form = parent::buildForm($form, $form_state); - - $calendar_config = $this->config('calendar.settings'); - - $form['calendar_settings'] = [ - '#type' => 'details', - '#title' => $this->t('Calendar Administration'), - '#open' => TRUE, - ]; - - $form['calendar_settings']['track_date'] = [ - '#type' => 'radios', - '#title' => $this->t('Track current date in session'), - '#default_value' => $calendar_config->get('track_date'), - '#options' => [ - 0 => $this->t("Never"), - 1 => $this->t('For authenticated users'), - 2 => $this->t('For all users'), - ], - '#description' => $this->t("Store session information about the user's current date as they move back and forth through the calendar. Without this setting users will revert to the current day each time they choose a new calendar period (year, month, week, or day). With this option set they will move to a day that conforms to the time period they were viewing before they switched. Requires session tracking which is not ordinarily enabled for anonymous users."), - ]; - - $form['calendar_settings']['add_colorbox'] = [ - '#type' => 'radios', - '#title' => $this->t('Add Colorbox settings to Node calendar templates'), - '#default_value' => $calendar_config->get('add_colorbox'), - '#options' => [ - 0 => $this->t('No'), - 1 => $this->t('Yes'), - ], - '#description' => $this->t('To try the Colorbox settings, choose the option to add Colorbox settings to the calendar templates. Install and enable the Colorbox module, following the instructions on the Colorbox project page, then create a new calendar from a template using any date field in the Node base table. The calendar will be set up to display the calendar items in a Colorbox.'), - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - parent::submitForm($form, $form_state); - - $this->config('calendar.settings') - ->set('track_date', $form_state->getValue('track_date')) - ->set('add_colorbox', $form_state->getValue('add_colorbox')) - ->save(); - - } - -} diff --git a/web/modules/calendar/src/Plugin/Block/CalendarLegend.php b/web/modules/calendar/src/Plugin/Block/CalendarLegend.php deleted file mode 100644 index a398682b32d267e6a57fc2407b3a78f82f213974..0000000000000000000000000000000000000000 --- a/web/modules/calendar/src/Plugin/Block/CalendarLegend.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php - -namespace Drupal\calendar\Plugin\Block; - -use Drupal\calendar\CalendarHelper; -use Drupal\Core\Block\BlockBase; -use Drupal\Core\Block\BlockPluginInterface; -use Drupal\Core\Form\FormStateInterface; - -/** - * Provides a "Calendar legend" block. - * @Block( - * id = "calendar_legend_block", - * admin_label = @Translation("Calendar legend"), - * ) - */ -class CalendarLegend extends BlockBase implements BlockPluginInterface { - - /** - * {@inheritdoc} - */ - public function blockForm($form, FormStateInterface $form_state) { - $options = CalendarHelper::listCalendarViews(); - - $config = $this->getConfiguration(); - $form['calendar_legend_view'] = [ - '#type' => 'select', - '#title' => $this->t('Legend View'), - '#description' => $this->t('Choose the view display that contains the settings for the stripes that should be displayed in a legend in this block. Note that if you change the stripe values in that view you will need to clear the cache to pick up the new values in this block.'), - '#default_value' => isset($config['calendar_legend_view_settings_view']) ? $config['calendar_legend_view_settings_view'] : '', - '#options' => $options, - ]; - - return $form; - } - - /** - * {@inheritdoc} - */ - public function blockSubmit($form, FormStateInterface $form_state) { - $this->setConfigurationValue('calendar_legend_view_settings_view', $form_state->getValue('calendar_legend_view')); - drupal_set_message($this->t('The view for the calendar legend has been set.')); - } - - /** - * {@inheritdoc} - */ - public function build() { - $config = $this->getConfiguration(); - $view_and_display_id = $config['calendar_legend_view_settings_view']; - - // @todo don't return anything if no legend is needed - - $block = [ - '#theme' => 'calendar_stripe_legend', - '#view_and_display_id' => $view_and_display_id, - '#title' => $this->t('Calendar Legend'), - ]; - - return $block; - } -} diff --git a/web/modules/calendar/src/Plugin/Derivative/ViewsFieldTemplate.php b/web/modules/calendar/src/Plugin/Derivative/ViewsFieldTemplate.php deleted file mode 100644 index 40a38d9f2be6851e6f6183c8d8449a15c09119bf..0000000000000000000000000000000000000000 --- a/web/modules/calendar/src/Plugin/Derivative/ViewsFieldTemplate.php +++ /dev/null @@ -1,258 +0,0 @@ -<?php - -namespace Drupal\calendar\Plugin\Derivative; - - -use Drupal\Core\Entity\EntityFieldManagerInterface; -use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface; -use Drupal\views\ViewsData; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Derivative class to find all field and properties for calendar View Builders. - */ -class ViewsFieldTemplate implements ContainerDeriverInterface { - - /** - * List of derivative definitions. - * - * @var array - */ - protected $derivatives = []; - - /** - * The base plugin ID. - * - * @var string - */ - protected $basePluginId; - - /** - * The entity manager. - * - * @var \Drupal\Core\Entity\EntityTypeManagerInterface - */ - protected $entityManager; - - /** - * The views data service. - * - * @var \Drupal\views\ViewsData - */ - protected $viewsData; - - /** - * @var \Drupal\Core\Entity\EntityFieldManagerInterface - */ - protected $field_manager; - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, $base_plugin_id) { - return new static ( - $base_plugin_id, - $container->get('entity_type.manager'), - $container->get('views.views_data'), - $container->get('entity_field.manager') - ); - - } - - /** - * Constructs a ViewsBlock object. - * - * @param string $base_plugin_id - * The base plugin ID. - * @param \Drupal\Core\Entity\EntityTypeManagerInterface $manager - * @param ViewsData $views_data - * The entity storage to load views. - * @param \Drupal\Core\Entity\EntityFieldManagerInterface $field_manager - */ - public function __construct($base_plugin_id, EntityTypeManagerInterface $manager, ViewsData $views_data, EntityFieldManagerInterface $field_manager) { - $this->basePluginId = $base_plugin_id; - $this->entityManager = $manager; - $this->viewsData = $views_data; - $this->field_manager = $field_manager; - } - - - /** - * {@inheritdoc} - */ - public function getDerivativeDefinition($derivative_id, $base_plugin_definition) { - if (!empty($this->derivatives) && !empty($this->derivatives[$derivative_id])) { - return $this->derivatives[$derivative_id]; - } - $this->getDerivativeDefinitions($base_plugin_definition); - return $this->derivatives[$derivative_id]; - } - - /** - * {@inheritdoc} - */ - public function getDerivativeDefinitions($base_plugin_definition) { - /** - * @var \Drupal\Core\Entity\EntityTypeInterface $entity_type - */ - foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) { - // Just add support for entity types which have a views integration. - if (($base_table = $entity_type->getBaseTable()) && $this->viewsData->get($base_table) && $this->entityManager->hasHandler($entity_type_id, 'view_builder')) { - $entity_views_tables = [$base_table => $this->viewsData->get($base_table)]; - if ($data_table = $entity_type->getDataTable()) { - $entity_views_tables[$data_table] = $this->viewsData->get($data_table); - } - foreach ($entity_views_tables as $table_id => $entity_views_table) { - foreach ($entity_views_table as $key => $field_info) { - if ($this->isDateField($field_info)) { - $derivative = [ - 'replacements' => [ - 'entity_label' => $entity_type->getLabel(), - 'entity_type' => $entity_type_id, - 'field_id' => $field_info['entity field'], - 'base_table' => $table_id, - 'base_field' => $this->getTableBaseField($entity_views_table), - 'default_field_id' => $this->getTableDefaultField($entity_views_table, $entity_type_id), - 'field_label' => $field_info['title'], - ], - 'view_template_id' => 'calendar_base_field', - ]; - $this->setDerivative($derivative, $base_plugin_definition); - } - } - } - // @todo Loop through all fields attached to this entity type. - // The have different base tables that are joined to this table. - $this->setConfigurableFieldsDerivatives($entity_type, $base_plugin_definition); - } - - } - return $this->derivatives; - } - - /** - * Set all derivatives for an entity type. - * - * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type - * @param array $base_plugin_definition - */ - protected function setConfigurableFieldsDerivatives(EntityTypeInterface $entity_type, array $base_plugin_definition) { - /** @var \Drupal\Core\Field\FieldStorageDefinitionInterface $field_storage */ - $field_storages = $this->field_manager->getFieldStorageDefinitions($entity_type->id()); - - foreach ($field_storages as $field_id => $field_storage) { - if ($field_storage->getType() == 'datetime') { - $entity_type_id = $entity_type->id(); - // Find better way to get table name. - $field_table = $entity_type_id . '__' . $field_id; - $field_table_data = $this->viewsData->get($field_table); - - if (isset($field_table_data[$field_id])) { - $derivative = []; - $field_info = $field_table_data[$field_id]; - $derivative['field_id'] = $field_id; - $join_tables = array_keys($field_table_data['table']['join']); - // @todo Will there ever be more than 1 tables here? - $join_table = array_pop($join_tables); - $join_table_data = $this->viewsData->get($join_table); - $derivative = [ - 'replacements' => [ - 'field_id' => $field_id, - 'entity_type' => $entity_type_id, - 'entity_label' => $entity_type->getLabel(), - 'field_label' => $field_info['title'], - 'base_table' => $join_table, - 'field_table' => $field_table, - 'default_field_id' => $this->getTableDefaultField($join_table_data, $entity_type_id), - 'base_field' => $this->getTableBaseField($join_table_data), - ], - 'view_template_id' => 'calendar_config_field', - ]; - $this->setDerivative($derivative, $base_plugin_definition); - //$this->setDerivative($field_info, $entity_type, $field_table_data, $base_plugin_definition); - } - - } - - - } - } - - /** - * Determine if a field is an date field. - * @param array $field_info - * Field array form ViewsData. - * - * @return bool - */ - protected function isDateField($field_info) { - if (!empty($field_info['field']['id']) && $field_info['field']['id'] == 'field') { - if (!empty($field_info['argument']['id']) && $field_info['argument']['id'] == 'date') { - return TRUE; - } - } - return FALSE; - } - - protected function setDerivative(array $derivative, array $base_plugin_definition) { - - $info = $derivative['replacements']; - - $derivative_id = $info['entity_type'] . '__' . $info['field_id']; - // Move some replacements values to root of derivative also. - $derivative['entity_type'] = $info['entity_type']; - $derivative['field_id'] = $info['field_id']; - // Create base path - if ($derivative['entity_type'] == 'node') { - $base_path = 'calendar-' .$derivative['field_id']; - } - else { - $base_path = "calendar-{$derivative['entity_type']}-{$derivative['field_id']}"; - } - $derivative['replacements']['base_path'] = $base_path; - $derivative['id'] = $base_plugin_definition['id'] . ':' . $derivative_id; - $derivative += $base_plugin_definition; - - $this->derivatives[$derivative_id] = $derivative; - } - - - /** - * Return the default field from a View table array. - * - * @param array $table_data - * - * @return null|string - */ - private function getTableDefaultField(array $table_data, $entity_type_id = NULL) { - $default_field_id = NULL; - if (!empty($table_data['table']['base']['defaults']['field'])) { - $default_field_id = $table_data['table']['base']['defaults']['field']; - } - if (empty($default_field_id) && $entity_type_id) { - // @todo Why doesn't user have a default field? Is there another way to get it? - if ($entity_type_id == 'user') { - $default_field_id = 'name'; - } - } - return $default_field_id; - } - - /** - * Return the base field from a View tabel array. - * - * @param array $table_data - * - * @return null|string - */ - private function getTableBaseField(array $table_data) { - if (!empty($table_data['table']['base']['field'])) { - return $table_data['table']['base']['field']; - } - return NULL; - } - - -} diff --git a/web/modules/calendar/src/Plugin/ViewsTemplateBuilder/ViewsFieldTemplate.php b/web/modules/calendar/src/Plugin/ViewsTemplateBuilder/ViewsFieldTemplate.php deleted file mode 100644 index 43b4585bb6e71bf4f6aa70715e79bbbbb5eee2f5..0000000000000000000000000000000000000000 --- a/web/modules/calendar/src/Plugin/ViewsTemplateBuilder/ViewsFieldTemplate.php +++ /dev/null @@ -1,92 +0,0 @@ -<?php - -namespace Drupal\calendar\Plugin\ViewsTemplateBuilder; - - -use Drupal\Core\Entity\EntityFieldManagerInterface; -use Drupal\Core\Form\FormStateInterface; -use Drupal\views_templates\Plugin\ViewsDuplicateBuilderBase; -use Drupal\views_templates\ViewsTemplateLoaderInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Views Template for all calendar fields. - * - * @ViewsBuilder( - * id = "calendar_field", - * module = "calendar", - * deriver = "Drupal\calendar\Plugin\Derivative\ViewsFieldTemplate" - * ) - */ -class ViewsFieldTemplate extends ViewsDuplicateBuilderBase { - - /** - * @var \Drupal\Core\Entity\EntityFieldManagerInterface - */ - protected $field_manager; - - /** - * {@inheritdoc} - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, ViewsTemplateLoaderInterface $loader, EntityFieldManagerInterface $manager) { - parent::__construct($configuration, $plugin_id, $plugin_definition, $loader); - $this->field_manager = $manager; - - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('views_templates.loader'), - $container->get('entity_field.manager') - ); - } - - /** - * {@inheritdoc} - */ - protected function getReplacements($options = NULL) { - $replacements = parent::getReplacements($options); - if (isset($options['base_path'])) { - $replacements['__BASE_PATH'] = $options['base_path']; - } - return $replacements; - } - - /** - * {@inheritdoc} - */ - protected function alterViewTemplateAfterCreation(array &$view_template, $options = NULL) { - parent::alterViewTemplateAfterCreation($view_template, $options); - $field_defs = $this->field_manager->getBaseFieldDefinitions($this->getDefinitionValue('entity_type')); - if (empty($field_defs['status'])) { - // If entity doesn't have a base field status remove it from View filter. - unset($view_template['display']['default']['display_options']['filters']['status']); - } - $this->field_manager->getFieldDefinitions($this->getDefinitionValue('entity_type'), 'event'); - $this->field_manager->getFieldStorageDefinitions('node'); - } - - public function buildConfigurationForm($form, FormStateInterface $form_state) { - $config_form = parent::buildConfigurationForm($form, $form_state); - $replacements = $this->getDefinitionValue('replacements'); - if (isset($replacements['base_path'])) { - $config_form['base_path'] = [ - '#type' => 'textfield', - '#title' => $this->t('Base View Path'), - '#description' => $this->t('This view will be displayed by visiting this path on your site.'), - '#default_value' => $replacements['base_path'], - '#required' => TRUE, - // @todo add Validation for path element. From Views? - ]; - } - return $config_form; - } - - -} diff --git a/web/modules/calendar/src/Plugin/views/area/CalendarHeader.php b/web/modules/calendar/src/Plugin/views/area/CalendarHeader.php deleted file mode 100644 index 273fa9de2029a382e34dc81fbae100ebdcef3a95..0000000000000000000000000000000000000000 --- a/web/modules/calendar/src/Plugin/views/area/CalendarHeader.php +++ /dev/null @@ -1,96 +0,0 @@ -<?php - -namespace Drupal\calendar\Plugin\views\area; - -use Drupal\calendar\CalendarHelper; -use Drupal\Core\Form\FormStateInterface; -use Drupal\views\Plugin\views\area\TokenizeAreaPluginBase; - -/** - * Views area Calendar Header area. - * - * @ingroup views_area_handlers - * - * @ViewsArea("calendar_header") - */ -class CalendarHeader extends TokenizeAreaPluginBase { - - /** - * {@inheritdoc} - */ - protected function defineOptions() { - $options = parent::defineOptions(); - // Override defaults to from parent. - $options['tokenize']['default'] = TRUE; - $options['empty']['default'] = TRUE; - // Provide our own defaults. - $options['content'] = ['default' => '']; - $options['pager_embed'] = ['default' => FALSE]; - return $options; - } - - /** - * {@inheritdoc} - */ - public function buildOptionsForm(&$form, FormStateInterface $form_state) { - parent::buildOptionsForm($form, $form_state); - - $form['content'] = [ - '#title' => $this->t('Heading'), - '#type' => 'textfield', - '#default_value' => $this->options['content'], - ]; - $form['pager_embed'] = [ - '#title' => $this->t('Use Pager'), - '#type' => 'checkbox', - '#default_value' => $this->options['pager_embed'], - ]; - - } - - /** - * {@inheritdoc} - */ - public function render($empty = FALSE) { - if (!$empty || !empty($this->options['empty'])) { - - $argument = CalendarHelper::getDateArgumentHandler($this->view); - - $render = []; - $header_text = $this->renderTextField($this->options['content']); - - if (!$this->options['pager_embed']) { - $render = [ - '#theme' => 'calendar_header', - '#title' => $header_text, - '#empty' => $empty, - '#granularity' => $argument->getGranularity(), - ]; - } - else { - if ($this->view->display_handler->renderPager()) { - $exposed_input = isset($this->view->exposed_raw_input) ? $this->view->exposed_raw_input : NULL; - $render = $this->view->renderPager($exposed_input); - // Override the exclude option of the pager. - $render['#exclude'] = FALSE; - $render['#items']['current'] = $header_text; - } - } - return $render; - - } - - return []; - } - - /** - * Render a text area with \Drupal\Component\Utility\Xss::filterAdmin(). - */ - public function renderTextField($value) { - if ($value) { - return $this->sanitizeValue($this->tokenizeValue($value), 'xss_admin'); - } - return ''; - } - -} diff --git a/web/modules/calendar/src/Plugin/views/argument/DatetimeYearWeekDate.php b/web/modules/calendar/src/Plugin/views/argument/DatetimeYearWeekDate.php deleted file mode 100644 index 5437fb5781fe32cd69df5729164e007964d0fd24..0000000000000000000000000000000000000000 --- a/web/modules/calendar/src/Plugin/views/argument/DatetimeYearWeekDate.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -namespace Drupal\calendar\Plugin\views\argument; - -use Drupal\datetime\Plugin\views\argument\Date; - -/** - * Argument handler for a day. - * - * @ViewsArgument("datetime_year_week") - */ -class DatetimeYearWeekDate extends Date { - - /** - * {@inheritdoc} - */ - protected $argFormat = 'YW'; - -} diff --git a/web/modules/calendar/src/Plugin/views/argument/TimeStampYearWeekDate.php b/web/modules/calendar/src/Plugin/views/argument/TimeStampYearWeekDate.php deleted file mode 100644 index 8608eba67511692805e914803fa8e0b530632cf3..0000000000000000000000000000000000000000 --- a/web/modules/calendar/src/Plugin/views/argument/TimeStampYearWeekDate.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php - -namespace Drupal\calendar\Plugin\views\argument; - -use Drupal\views\Plugin\views\argument\Date; - -/** - * Argument handler for a day. - * - * @ViewsArgument("date_year_week") - */ -class TimeStampYearWeekDate extends Date { - - /** - * {@inheritdoc} - */ - protected $argFormat = 'YW'; - -} diff --git a/web/modules/calendar/src/Plugin/views/argument_validator/CalendarValidator.php b/web/modules/calendar/src/Plugin/views/argument_validator/CalendarValidator.php deleted file mode 100644 index 99896a3e1c2c6f2d780492420ac30e8f946b56c8..0000000000000000000000000000000000000000 --- a/web/modules/calendar/src/Plugin/views/argument_validator/CalendarValidator.php +++ /dev/null @@ -1,138 +0,0 @@ -<?php - -namespace Drupal\calendar\Plugin\views\argument_validator; - -use Drupal\calendar\DateArgumentWrapper; -use Drupal\Core\Datetime\DateFormatterInterface; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Plugin\Context\ContextDefinition; -use Drupal\views\Plugin\views\argument\ArgumentPluginBase; -use Drupal\views\Plugin\views\argument\Date; -use Drupal\views\Plugin\views\argument_validator\ArgumentValidatorPluginBase; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Defines a argument validator plugin for Date arguments used in Calendar. - * - * @ViewsArgumentValidator( - * id = "calendar", - * title = @Translation("Calendar Date Format"), - * ) - */ -class CalendarValidator extends ArgumentValidatorPluginBase { - - /** - * @var DateArgumentWrapper - */ - protected $argument_wrapper; - - /** - * The dateformatter service. - */ - protected $dateFormatter; - - /** - * {@inheritdoc} - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, DateFormatterInterface $dateFormatter) { - parent::__construct($configuration, $plugin_id, $plugin_definition); - - $this->dateFormatter = $dateFormatter; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static($configuration, $plugin_id, $plugin_definition, $container->get('date.formatter')); - } - - /** - * {@inheritdoc} - */ - public function validateArgument($arg) { - if (isset($this->argument_wrapper) && $this->argument_wrapper->validateValue($arg)) { - $date = $this->argument_wrapper->createDateTime(); - $time = strtotime($date->format($this->options['replacement_format'])); - - // Override title for substitutions - // @see \Drupal\views\Plugin\views\argument\ArgumentPluginBase::getTitle - $this->argument->validated_title = $this->dateFormatter->format($time, 'custom', $this->options['replacement_format']); - return TRUE; - } - return FALSE; - } - - /** - * {@inheritdoc} - */ - public function setArgument(ArgumentPluginBase $argument) { - parent::setArgument($argument); - if ($argument instanceof Date) { - $this->argument_wrapper = new DateArgumentWrapper($argument); - } - } - - /** - * {@inheritdoc} - */ - protected function defineOptions() { - $options = parent::defineOptions(); - $options['replacement_format'] = ['default' => '']; - return $options; - } - - /** - * Get default format value for the options form. - * - * @return string - */ - protected function getDefaultReplacementFormat() { - - switch ($this->argument_wrapper->getGranularity()) { - case 'month': - return 'F Y'; - case 'year': - return 'Y'; - case 'week': - return 'F j, Y'; - case 'day': - return 'l, F j, Y'; - default: - // @todo Load format used for medium here - return 'F j, Y'; - } - } - - /** - * {@inheritdoc} - */ - public function buildOptionsForm(&$form, FormStateInterface $form_state) { - parent::buildOptionsForm($form, $form_state); - if (!isset($this->argument_wrapper)) { - return; - } - // We can't set default in defineOptions because argument is not set yet. - if ($this->options['replacement_format']) { - $default = $this->options['replacement_format']; - } - else { - $default = $this->getDefaultReplacementFormat(); - } - $form['replacement_format'] = [ - '#type' => 'textfield', - '#title' => $this->t('Replacement date pattern'), - '#default_value' => $default, - // @todo Better description and link - '#description' => $this->t('Provide a date pattern to be used when replace this arguments as a title.'), - ]; - } - - /** - * {@inheritdoc}} - */ - public function getContextDefinition() { - return new ContextDefinition('string', $this->argument->adminLabel(), FALSE); - } - -} diff --git a/web/modules/calendar/src/Plugin/views/pager/CalendarPager.php b/web/modules/calendar/src/Plugin/views/pager/CalendarPager.php deleted file mode 100644 index 95526e57c1ef11a59914d142a311aa6903b6215d..0000000000000000000000000000000000000000 --- a/web/modules/calendar/src/Plugin/views/pager/CalendarPager.php +++ /dev/null @@ -1,133 +0,0 @@ -<?php - -namespace Drupal\calendar\Plugin\views\pager; - - -use Drupal\calendar\CalendarHelper; -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Url; -use Drupal\views\Plugin\views\display\DisplayPluginBase; -use Drupal\views\Plugin\views\pager\PagerPluginBase; -use Drupal\views\ViewExecutable; - -/** - * The plugin to handle calendar pager. - * - * @ingroup views_pager_plugins - * - * @ViewsPager( - * id = "calendar", - * title = @Translation("Calendar Pager"), - * short_title = @Translation("Calendar"), - * help = @Translation("Calendar Pager"), - * theme = "calendar_pager", - * register_theme = FALSE - * ) - */ -class CalendarPager extends PagerPluginBase { - - const NEXT = '+'; - const PREVIOUS = '-'; - /** - * @var \Drupal\calendar\DateArgumentWrapper; - */ - protected $argument; - - /** - * {@inheritdoc} - */ - public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { - parent::init($view, $display, $options); - $this->argument = CalendarHelper::getDateArgumentHandler($this->view); - $this->setItemsPerPage(0); - } - - /** - * {@inheritdoc} - */ - public function render($input) { - if (!$this->argument->validateValue()) { - return []; - } - $items['previous'] = [ - 'url' => $this->getPagerURL(self::PREVIOUS, $input), - ]; - $items['next'] = [ - 'url' => $this->getPagerURL(self::NEXT, $input), - ]; - return [ - '#theme' => $this->themeFunctions(), - '#items' => $items, - '#exclude' => $this->options['exclude_display'], - ]; - } - - /** - * Get the date argument value for the pager link. - * - * @param $mode - * Either '-' or '+' to determine which direction. - * - * @return string - */ - protected function getPagerArgValue($mode) { - $datetime = $this->argument->createDateTime(); - $datetime->modify($mode . '1 ' . $this->argument->getGranularity()); - return $datetime->format($this->argument->getArgFormat()); - } - - /** - * Get the href value for the pager link. - * - * @param $mode - * Either '-' or '+' to determine which direction. - * @param array $input - * Any extra GET parameters that should be retained, such as exposed - * input. - * - * @return string - */ - protected function getPagerURL($mode, $input) { - $value = $this->getPagerArgValue($mode); - $current_position = 0; - $arg_vals = []; - /** - * @var \Drupal\views\Plugin\views\argument\ArgumentPluginBase $handler - */ - foreach ($this->view->argument as $name => $handler) { - if ($current_position != $this->argument->getPosition()) { - $arg_vals["arg_$current_position"] = $handler->getValue(); - } - else { - $arg_vals["arg_$current_position"] = $value; - } - $current_position++; - } - - return $this->view->getUrl($arg_vals, $this->view->current_display); - } - - /** - * {@inheritdoc} - */ - public function buildOptionsForm(&$form, FormStateInterface $form_state) { - parent::buildOptionsForm($form, $form_state); - $form['exclude_display'] = [ - '#type' => 'checkbox', - '#title' => $this->t('Exclude from Display'), - '#default_value' => $this->options['exclude_display'], - '#description' => $this->t('Use this option if you only want to display the pager in Calendar Header area.'), - ]; - } - - /** - * {@inheritdoc} - */ - protected function defineOptions() { - $options = parent::defineOptions(); - $options['exclude_display'] = ['default' => FALSE]; - - return $options; - } - -} diff --git a/web/modules/calendar/src/Plugin/views/row/Calendar.php b/web/modules/calendar/src/Plugin/views/row/Calendar.php deleted file mode 100644 index a78fe613d2c284d23000e952561c6965b571bed6..0000000000000000000000000000000000000000 --- a/web/modules/calendar/src/Plugin/views/row/Calendar.php +++ /dev/null @@ -1,703 +0,0 @@ -<?php - -namespace Drupal\calendar\Plugin\views\row; - -use Drupal\calendar\CalendarEvent; -use Drupal\calendar\CalendarHelper; -use Drupal\calendar\CalendarViewsTrait; -use Drupal\Core\Entity\EntityFieldManagerInterface; -use Drupal\Core\Field\BaseFieldDefinition; -use Drupal\datetime\Plugin\Field\FieldType\DateTimeItem; -use Drupal\taxonomy\Entity\Term; -use Drupal\views\Plugin\views\argument\Date; -use Drupal\Core\Datetime\DateFormatter; -use Drupal\Core\Form\FormStateInterface; -use Drupal\views\Plugin\views\display\DisplayPluginBase; -use Drupal\views\Plugin\views\row\RowPluginBase; -use Drupal\views\ViewExecutable; -use Drupal\views\Views; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Plugin which creates a view on the resulting object and formats it as a - * Calendar entity. - * - * @ViewsRow( - * id = "calendar_row", - * title = @Translation("Calendar entities"), - * help = @Translation("Display the content as calendar entities."), - * theme = "views_view_row_calendar", - * register_theme = FALSE, - * ) - */ -class Calendar extends RowPluginBase { - - use CalendarViewsTrait; - - /** - * @var \Drupal\Core\Datetime\DateFormatter $dateFormatter - * The date formatter service. - */ - protected $dateFormatter; - - /** - * @var $entityType - * The entity type being handled in the preRender() function. - */ - protected $entityType; - - /** - * @var $entities - * The entities loaded in the preRender() function. - */ - protected $entities = []; - - /** - * @var $dateFields - * todo document. - */ - protected $dateFields = []; - - /** - * @var \Drupal\views\Plugin\views\argument\Formula - */ - protected $dateArgument; - - /** - * @var \Drupal\Core\Entity\EntityFieldManagerInterface - */ - protected $fieldManager; - - /** - * {@inheritdoc} - */ - public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { - parent::init($view, $display, $options); - - // TODO needed? -// $this->base_table = $view->base_table; -// $this->baseField = $view->base_field; - } - - /** - * Constructs a Calendar row plugin object. - * - * @param array $configuration - * A configuration array containing information about the plugin instance. - * @param string $plugin_id - * The plugin_id for the plugin instance. - * @param mixed $plugin_definition - * The plugin implementation definition. - * @param \Drupal\Core\Datetime\DateFormatter $date_formatter - * The date formatter service. - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, DateFormatter $date_formatter, EntityFieldManagerInterface $field_manager) { - parent::__construct($configuration, $plugin_id, $plugin_definition); - - $this->dateFormatter = $date_formatter; - $this->fieldManager = $field_manager; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('date.formatter'), - $container->get('entity_field.manager') - ); - } - - /** - * {@inheritdoc} - */ - protected function defineOptions() { - $options = parent::defineOptions(); - $options['date_fields'] = ['default' => []]; - $options['colors'] = [ - 'contains' => [ - 'legend' => ['default' => ''], - 'calendar_colors_type' => ['default' => []], - 'taxonomy_field' => ['default' => ''], - 'calendar_colors_vocabulary' => ['default' => []], - 'calendar_colors_taxonomy' => ['default' => []], - 'calendar_colors_group' => ['default' => []], - ] - ]; - return $options; - } - - /** - * {@inheritdoc} - */ - public function buildOptionsForm(&$form, FormStateInterface $form_state) { - parent::buildOptionsForm($form, $form_state); - - $form['markup'] = [ - '#markup' => $this->t("The calendar row plugin will format view results as calendar items. Make sure this display has a 'Calendar' format and uses a 'Date' contextual filter, or this plugin will not work correctly."), - ]; - - - $form['colors'] = [ - '#type' => 'fieldset', - '#title' => $this->t('Legend Colors'), - '#description' => $this->t('Set a hex color value (like #ffffff) to use in the calendar legend for each content type. Items with empty values will have no stripe in the calendar and will not be added to the legend.'), - ]; - - - $options = []; - // @todo Allow strip options for any bundes of any entity type - if ($this->view->getBaseTables()['node_field_data']) { - $options['type'] = $this->t('Based on Content Type'); - } - if (\Drupal::moduleHandler()->moduleExists('taxonomy')) { - $options['taxonomy'] = $this->t('Based on Taxonomy'); - } - - // If no option is available, stop here. - if (empty($options)) { - return; - } - - $form['colors']['legend'] = [ - '#title' => $this->t('Stripes'), - '#description' => $this->t('Add stripes to calendar items.'), - '#type' => 'select', - '#options' => $options, - '#empty_value' => (string) $this->t('None'), - '#default_value' => $this->options['colors']['legend'], - ]; - - if ($this->view->getBaseTables()['node_field_data']) { - $colors = $this->options['colors']['calendar_colors_type']; - $type_names = node_type_get_names(); - foreach ($type_names as $key => $name) { - $form['colors']['calendar_colors_type'][$key] = [ - '#title' => $name, - '#default_value' => isset($colors[$key]) ? $colors[$key] : CALENDAR_EMPTY_STRIPE, - '#dependency' => ['edit-row-options-colors-legend' => ['type']], - '#type' => 'textfield', - '#size' => 7, - '#maxlength' => 7, - '#element_validate' => [[$this, 'validateHexColor']], - '#prefix' => '<div class="calendar-colorpicker-wrapper">', - '#suffix' => '<div class="calendar-colorpicker"></div></div>', - '#attributes' => ['class' => ['edit-calendar-colorpicker']], - '#attached' => [ - // Add Farbtastic color picker and the js to trigger it. - 'library' => [ - 'calendar/calendar.colorpicker', - ], - ], - ] + $this->visibleOnLegendState('type'); - } - } - - - - if (\Drupal::moduleHandler()->moduleExists('taxonomy')) { - // Get the display's field names of taxonomy fields. - $vocabulary_field_options = []; - $fields = $this->displayHandler->getOption('fields'); - foreach ($fields as $name => $field_info) { - // Select the proper field type. - if ($this->isTermReferenceField($field_info, $this->fieldManager)) { - $vocabulary_field_options[$name] = $field_info['label'] ?: $name; - } - } - if (empty($vocabulary_field_options)) { - return; - } - $form['colors']['taxonomy_field'] = [ - '#title' => t('Term field'), - '#type' => !empty($vocabulary_field_options) ? 'select' : 'hidden', - '#default_value' => $this->options['colors']['taxonomy_field'], - '#empty_value' => (string) $this->t('None'), - '#description' => $this->t("Select the taxonomy term field to use when setting stripe colors. This works best for vocabularies with only a limited number of possible terms."), - '#options' => $vocabulary_field_options, - // @todo Is this in the form api? - '#dependency' => ['edit-row-options-colors-legend' => ['taxonomy']], - ] + $this->visibleOnLegendState('taxonomy'); - - if (empty($vocabulary_field_options)) { - $form['colors']['taxonomy_field']['#options'] = ['' => '']; - $form['colors']['taxonomy_field']['#suffix'] = $this->t('You must add a term field to this view to use taxonomy stripe values. This works best for vocabularies with only a limited number of possible terms.'); - } - - // Get the Vocabulary names. - $vocab_vids = []; - - foreach ($vocabulary_field_options as $field_name => $label) { - // @todo Provide storage manager via Dependency Injection - $field_config = \Drupal::entityTypeManager()->getStorage('field_config')->loadByProperties(['field_name' => $field_name]); - - // @TODO refactor - reset($field_config); - $key = key($field_config); - - $data = \Drupal::config('field.field.' . $field_config[$key]->getOriginalId())->getRawData(); - - if ($target_bundles = $data['settings']['handler_settings']['target_bundles']) { - // Fields must target bundles set. - reset($target_bundles); - $vocab_vids[$field_name] = key($target_bundles); - } - } - - if (empty($vocab_vids)) { - return; - } - - $this->options['colors']['calendar_colors_vocabulary'] = $vocab_vids; - - $form['colors']['calendar_colors_vocabulary'] = [ - '#title' => t('Vocabulary Legend Types'), - '#type' => 'value', - '#value' => $vocab_vids, - ] + $this->visibleOnLegendState('taxonomy'); - - // Get the Vocabulary term id's and map to colors. - // @todo Add labels for each Vocabulary. - $term_colors = $this->options['colors']['calendar_colors_taxonomy']; - foreach ($vocab_vids as $field_name => $vid) { - $vocab = \Drupal::entityTypeManager()->getStorage("taxonomy_term")->loadTree($vid); - foreach ($vocab as $key => $term) { - $form['colors']['calendar_colors_taxonomy'][$term->tid] = [ - '#title' => $this->t($term->name), - '#default_value' => isset($term_colors[$term->tid]) ? $term_colors[$term->tid] : CALENDAR_EMPTY_STRIPE, - '#access' => !empty($vocabulary_field_options), - '#dependency_count' => 2, - '#dependency' => [ - 'edit-row-options-colors-legend' => ['taxonomy'], - 'edit-row-options-colors-taxonomy-field' => [$field_name], - ], - '#type' => 'textfield', - '#size' => 7, - '#maxlength' => 7, - '#element_validate' => [[$this, 'validateHexColor']], - '#prefix' => '<div class="calendar-colorpicker-wrapper">', - '#suffix' => '<div class="calendar-colorpicker"></div></div>', - '#attributes' => ['class' => ['edit-calendar-colorpicker']], - '#attached' => [ - // Add Farbtastic color picker and the js to trigger it. - 'library' => [ - 'calendar/calendar.colorpicker', - ], - ], - ] + $this->visibleOnLegendState('taxonomy'); - } - } - - } - - - - } - - /** - * Check to make sure the user has entered a valid 6 digit hex color. - */ - public function validateHexColor($element, FormStateInterface $form_state) { - if (!$element['#required'] && empty($element['#value'])) { - return; - } - if (!preg_match('/^#(?:(?:[a-f\d]{3}){1,2})$/i', $element['#value'])) { - $form_state->setError($element, $this->t("'@color' is not a valid hex color", ['@color' => $element['#value']])); - } - else { - $form_state->setValueForElement($element, $element['#value']); - } - } - - /** - * {@inheritdoc} - */ - public function preRender($result) { - - // Preload each entity used in this view from the cache. This provides all - // the entity values relatively cheaply, and we don't need to do it - // repeatedly for the same entity if there are multiple results for one - // entity. - $ids = []; - /** @var $row \Drupal\views\ResultRow */ - foreach ($result as $row) { - // Use the entity id as the key so we don't create more than one value per - // entity. - $entity = $row->_entity; - - // Node revisions need special loading. - if (isset($this->view->getBaseTables()['node_revision'])) { - $this->entities[$entity->id()] = \Drupal::entityTypeManager()->getStorage('node')->loadRevision($entity->id()); - } - else { - $ids[$entity->id()] = $entity->id(); - } - } - - $base_tables = $this->view->getBaseTables(); - $base_table = key($base_tables); - $table_data = Views::viewsData()->get($base_table); - $this->entityType = $table_data['table']['entity type']; - - if (!empty($ids)) { - $this->entities = \Drupal::entityTypeManager()->getStorage($this->entityType)->loadMultiple($ids); - } - - // Identify the date argument and fields that apply to this view. Preload - // the Date Views field info for each field, keyed by the field name, so we - // know how to retrieve field values from the cached node. - // @todo don't hardcode $date_fields, use viewsData() or viewsDataHelper() - -// $data = date_views_fields($this->view->base_table); -// $data = $data['name']; - - $data = CalendarHelper::dateViewFields($this->entityType); - -// $data['name'] = 'node_field_data.created_year'; - $date_fields = []; - /** @var $handler \Drupal\views\Plugin\views\argument\Formula */ - foreach ($this->view->getDisplay()->getHandlers('argument') as $handler) { - if ($handler instanceof Date) { - // Strip "_calendar" from the field name. - $fieldName = $handler->realField; - if (!empty($data['alias'][$handler->table . '_' . $fieldName])) { - $date_fields[$fieldName] = $data['alias'][$handler->table . '_' . $fieldName]; - $this->dateFields = $date_fields; - } - $this->dateArgument = $handler; - - } - } -// -// // Get the language for this view. -// $this->language = $this->display->handler->get_option('field_language'); -// $substitutions = views_views_query_substitutions($this->view); -// if (array_key_exists($this->language, $substitutions)) { -// $this->language = $substitutions[$this->language]; -// } - } - - /** - * {@inheritdoc} - */ - public function render($row) { - /** @var \Drupal\calendar\CalendarDateInfo $dateInfo */ - $dateInfo = $this->dateArgument->view->dateInfo; - $id = $row->_entity->id(); - - if (!is_numeric($id)) { - return []; - } - - // There could be more than one date field in a view so iterate through all - // of them to find the right values for this view result. - foreach ($this->dateFields as $field_name => $info) { - - // Clone this entity so we can change it's values without altering other - // occurrences of this entity on the same page, for example in an - // "Upcoming" block. - /** @var \Drupal\Core\Entity\ContentEntityBase $entity */ - $entity = clone($this->entities[$id]); - - if (empty($entity)) { - return []; - } - - // @todo clean up -// $table_name = $info['table_name']; - $delta_field = $info['delta_field']; -// $tz_handling = $info['tz_handling']; -// $tz_field = $info['timezone_field']; -// $rrule_field = $info['rrule_field']; -// $is_field = $info['is_field']; - - $event = new CalendarEvent($entity); - - // Retrieve the field value(s) that matched our query from the cached node. - // Find the date and set it to the right timezone. - $entity->date_id = []; - $item_start_date = NULL; - $item_end_date = NULL; - $granularity = 'second'; - $increment = 1; - - // @todo implement timezone support - if ($info['is_field']) { - // Should CalendarHelper::dateViewFields() be returning this already? - $entity_field_name = str_replace('_value', '', $field_name); - $field_definition = $entity->getFieldDefinition($entity_field_name); - - if ($field_definition instanceof BaseFieldDefinition) { - $storage_format = 'U'; - } - else { - $datetime_type = $field_definition->getSetting('datetime_type'); - if ($datetime_type === DateTimeItem::DATETIME_TYPE_DATE) { - $storage_format = DATETIME_DATE_STORAGE_FORMAT; - } - else { - $storage_format = DATETIME_DATETIME_STORAGE_FORMAT; - } - } - $item_start_date = $item_end_date = \DateTime::createFromFormat($storage_format, $row->{$info['query_name']}); - -// $db_tz = date_get_timezone_db($tz_handling, isset($item->$tz_field) ? $item->$tz_field : timezone_name_get($dateInfo->getTimezone())); -// $to_zone = date_get_timezone($tz_handling, isset($item->$tz_field)) ? $item->$tz_field : timezone_name_get($dateInfo->getTimezone()); - - - - // @todo don't hardcode -// $granularity = date_granularity_precision($cck_field['settings']['granularity']); - $granularity = 'week'; -// $increment = $instance['widget']['settings']['increment']; - } - elseif ($entity->get($field_name)) { - $item = $entity->get($field_name)->getValue(); - // @todo handle timezones -// $db_tz = date_get_timezone_db($tz_handling, isset($item->$tz_field) ? $item->$tz_field : timezone_name_get($dateInfo->getTimezone())); -// $to_zone = date_get_timezone($tz_handling, isset($item->$tz_field) ? $item->$tz_field : timezone_name_get($dateInfo->getTimezone())); -// $item_start_date = new dateObject($item, $db_tz); - $item_start_date = new \DateTime(); - $item_start_date->setTimestamp($item[0]['value']); - $item_end_date = $item_start_date; - $entity->date_id = ['calendar.' . $id . '.' . $field_name . '.0']; - } - - // If we don't have a date value, go no further. - if (empty($item_start_date)) { - continue; - } - - // Set the item date to the proper display timezone; - // @todo handle timezones -// $item_start_date->setTimezone(new dateTimezone($to_zone)); -// $item_end_date->setTimezone(new dateTimezone($to_zone)); - - $event->setStartDate($item_start_date); - $event->setEndDate($item_end_date); - $event->setTimezone(new \DateTimeZone(timezone_name_get($dateInfo->getTimezone()))); - $event->setGranularity($granularity); - - // @todo remove while properties get transfered to the new object -// $event_container = new stdClass(); -// $event_container->db_tz = $db_tz; -// $event_container->to_zone = $to_zone; -// $event_container->increment = $increment; -// $event_container->field = $is_field ? $item : NULL; -// $event_container->row = $row; -// $event_container->entity = $entity; - - // All calendar row plugins should provide a date_id that the theme can use. - // @todo implement -// $event_container->date_id = $entity->date_id[0]; - - // We are working with an array of partially rendered items - // as we process the calendar, so we can group and organize them. - // At the end of our processing we'll need to swap in the fully formatted - // display of the row. We save it here and switch it in - // template_preprocess_calendar_item(). - // @FIXME -// theme() has been renamed to _theme() and should NEVER be called directly. -// Calling _theme() directly can alter the expected output and potentially -// introduce security issues (see https://www.drupal.org/node/2195739). You -// should use renderable arrays instead. -// -// -// @see https://www.drupal.org/node/2195739 -// $event->rendered = theme($this->theme_functions(), -// [ -// 'view' => $this->view, -// 'options' => $this->options, -// 'row' => $row, -// 'field_alias' => isset($this->field_alias) ? $this->field_alias : '', -// ]); - - /** @var \Drupal\calendar\CalendarEvent[] $events */ - $events = $this->explode_values($event); - foreach ($events as $event) { - switch ($this->options['colors']['legend']) { - case 'type': - if ($event->getEntityTypeId() == 'node') { - $this->nodeTypeStripe($event); - } - - break; - case 'taxonomy': - $this->calendarTaxonomyStripe($event); - break; - } - $rows[] = $event; - } - } - - return $rows; - } - - /** - * @todo rename and document - * - * @param \Drupal\calendar\CalendarEvent $event - * @return array - */ - function explode_values($event) { - $rows = []; - - $dateInfo = $this->dateArgument->view->dateInfo; -// $item_start_date = $event->date_start; -// $item_end_date = $event->date_end; -// $to_zone = $event->to_zone; -// $db_tz = $event->db_tz; -// $granularity = $event->granularity; -// $increment = $event->increment; - - // Now that we have an 'entity' for each view result, we need to remove - // anything outside the view date range, and possibly create additional - // nodes so that we have a 'node' for each day that this item occupies in - // this view. - // @TODO make this work with the CalendarDateInfo object -// $now = max($dateInfo->min_zone_string, $this->dateFormatter->format($event->getStartDate()->getTimestamp(), 'Y-m-d')); -// $to = min($dateInfo->max_zone_string, $this->dateFormatter->format($event->getEndDate()->getTimestamp(), 'Y-m-d')); - $now = $event->getStartDate()->format('Y-m-d'); - $to = $event->getEndDate()->format('Y-m-d'); - $next = new \DateTime(); - $next->setTimestamp($event->getStartDate()->getTimestamp()); - - if (timezone_name_get($this->dateArgument->view->dateInfo->getTimezone()) != $event->getTimezone()->getName()) { - // Make $start and $end (derived from $node) use the timezone $to_zone, - // just as the original dates do. - $next->setTimezone($event->getTimezone()); - } - - if (empty($to) || $now > $to) { - $to = $now; - } - - // $now and $next are midnight (in display timezone) on the first day where node will occur. - // $to is midnight on the last day where node will occur. - // All three were limited by the min-max date range of the view. - $position = 0; - while (!empty($now) && $now <= $to) { - /** @var $entity \Drupal\calendar\CalendarEvent */ - $entity = clone($event); - - // Get start and end of current day. - $start = $this->dateFormatter->format($next->getTimestamp(), 'custom', 'Y-m-d H:i:s'); - $next->setTimestamp(strtotime(' +1 day -1 second', $next->getTimestamp())); - $end = $this->dateFormatter->format($next->getTimestamp(), 'custom', 'Y-m-d H:i:s'); - - // Get start and end of item, formatted the same way. - $item_start = $this->dateFormatter->format($event->getStartDate()->getTimestamp(), 'custom', 'Y-m-d H:i:s'); - $item_end = $this->dateFormatter->format($event->getEndDate()->getTimestamp(), 'custom', 'Y-m-d H:i:s'); - - // Get intersection of current day and the node value's duration (as - // strings in $to_zone timezone). - $start_string = $item_start < $start ? $start : $item_start; - $entity->setStartDate(new \DateTime($start_string)); - $end_string = !empty($item_end) ? ($item_end > $end ? $end : $item_end) : NULL; - $entity->setEndDate(new \DateTime($end_string)); - - // @TODO don't hardcode granularity and increment - $granularity = 'hour'; - $increment = 1; - $entity->setAllDay(CalendarHelper::dateIsAllDay($entity->getStartDate()->format('Y-m-d H:i:s'), $entity->getEndDate()->format('Y-m-d H:i:s'), $granularity, $increment)); - - $calendar_start = new \DateTime(); - $calendar_start->setTimestamp($entity->getStartDate()->getTimestamp()); - -// unset($entity->calendar_fields); - if (isset($entity) && (empty($calendar_start))) { - // if no date for the node and no date in the item - // there is no way to display it on the calendar - unset($entity); - } - else { -// $entity->date_id .= '.' . $position; - $rows[] = $entity; - unset($entity); - } - - $next->setTimestamp(strtotime('+1 second', $next->getTimestamp())); - $now = $this->dateFormatter->format($next->getTimestamp(), 'Y-m-d'); - $position++; - } - return $rows; - } - - /** - * Create a stripe base on node type. - * - * @param \Drupal\calendar\CalendarEvent $event - * The event result object. - */ - function nodeTypeStripe(&$event) { - $colors = isset($this->options['colors']['calendar_colors_type']) ? $this->options['colors']['calendar_colors_type'] : []; - if (empty($colors)) { - return; - } - - $type_names = node_type_get_names(); - $bundle = $event->getBundle(); - $label = ''; - $stripeHex = ''; - if (array_key_exists($bundle, $type_names) || $colors[$bundle] == CALENDAR_EMPTY_STRIPE) { - $label = $type_names[$bundle]; - } - if (array_key_exists($bundle, $colors)) { - $stripeHex = $colors[$bundle]; - } - - $event->addStripeLabel($label); - $event->addStripeHex($stripeHex); - } - - /** - * Create a stripe based on a taxonomy term. - * - * @param CalendarEvent $event - */ - function calendarTaxonomyStripe(&$event) { - $colors = isset($this->options['colors']['calendar_colors_taxonomy']) ? $this->options['colors']['calendar_colors_taxonomy'] : []; - if (empty($colors)) { - return; - } - - $entity = $event->getEntity(); - $term_field_name = $this->options['colors']['taxonomy_field']; - if ($entity->hasField($term_field_name) && $terms_for_entity = $entity->get($term_field_name)) { - /** @var EntityReferenceFieldItemListInterface $item */ - foreach ($terms_for_entity as $item) { - $tid = $item->getValue()['target_id']; - $term = Term::load($tid); - - if (!array_key_exists($tid, $colors) || $colors[$tid] == CALENDAR_EMPTY_STRIPE) { - continue; - } - $event->addStripeLabel($term->name->value); - $event->addStripeHex($colors[$tid]); - } - } - - return; - } - - /** - * Get form options for hiding elements based on legend type. - * @param $mode - * - * @return array - */ - protected function visibleOnLegendState($mode) { - return [ - '#states' => [ - 'visible' => [ - ':input[name="row_options[colors][legend]"]' => ['value' => $mode], - ], - ], - ]; - } - - -} diff --git a/web/modules/calendar/src/Plugin/views/style/Calendar.php b/web/modules/calendar/src/Plugin/views/style/Calendar.php deleted file mode 100644 index eb656e45697d8e963616d96e450d53005d335ff7..0000000000000000000000000000000000000000 --- a/web/modules/calendar/src/Plugin/views/style/Calendar.php +++ /dev/null @@ -1,1350 +0,0 @@ -<?php - -namespace Drupal\calendar\Plugin\views\style; - -use Drupal\calendar\CalendarDateInfo; -use Drupal\calendar\CalendarHelper; -use Drupal\calendar\CalendarStyleInfo; -use Drupal\views\Entity\View; -use Drupal\Core\Datetime\DateFormatter; -use Drupal\calendar\Plugin\views\row\Calendar as CalendarRow; -use Drupal\Core\Form\FormStateInterface; -use Drupal\views\Plugin\views\display\DisplayPluginBase; -use Drupal\views\Plugin\views\style\StylePluginBase; -use Drupal\views\ViewExecutable; -use Drupal\views\Views; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Views style plugin for the Calendar module. - * - * @ingroup views_style_plugins - * - * @ViewsStyle( - * id = "calendar", - * title = @Translation("Calendar"), - * help = @Translation("Present view results as a Calendar."), - * theme = "calendar_style", - * display_types = {"normal"}, - * even_empty = TRUE - * ) - */ -class Calendar extends StylePluginBase { - - /** - * Does the style plugin for itself support to add fields to it's output. - * - * @var bool - */ - protected $usesFields = TRUE; - - /** - * Does the style plugin allows to use style plugins. - * - * @var bool - */ - protected $usesRowPlugin = TRUE; - - /** - * Does the style plugin support grouping of rows. - * - * @var bool - */ - protected $usesGrouping = FALSE; - - /** - * The date formatter service. - * - * @var \Drupal\Core\Datetime\DateFormatter - */ - protected $dateFormatter; - - /** - * The date info for this calendar. - * - * @var \Drupal\calendar\CalendarDateInfo dateInfo - * The calendar date info object. - */ - protected $dateInfo; - - /** - * The style info for this calendar. - * - * @var \Drupal\calendar\CalendarStyleInfo styleInfo - * The calendar style info object. - */ - protected $styleInfo; - - /** - * The calendar items contains the keys for the start date and the start time - * of the event. - * - * Example: - * @code - * $items = [ - * "2015-10-20" => [ - * "00:00:00" => [ - * 0 => Drupal\calendar\CalendarEvent, - * ], - * ], - * "2015-10-21" => [ - * "00:00:00" => [ - * 0 => Drupal\calendar\CalendarEvent, - * ], - * ], - * ]; - * @endcode - * - * @var array - */ - protected $items; - - /** - * $the current day date object. - * - * @var \DateTime - */ - protected $currentDay; - - /** - * Overrides \Drupal\views\Plugin\views\style\StylePluginBase::init(). - * - * The style info is set through the parent function, but we also initialize - * the date info object here. - */ - public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) { - parent::init($view, $display, $options); - if (empty($view->dateInfo)) { - // @todo This used to say $this->dateInfo. Make sure that what we do here - // is right. - $this->view->dateInfo = new CalendarDateInfo(); - $this->view->styleInfo = new CalendarStyleInfo(); - } - $this->dateInfo = &$this->view->dateInfo; - $this->styleInfo = &$this->view->styleInfo; - } - - /** - * Constructs a Calendar object. - * - * @param array $configuration - * A configuration array containing information about the plugin instance. - * @param string $plugin_id - * The plugin_id for the plugin instance. - * @param mixed $plugin_definition - * The plugin implementation definition. - * @param \Drupal\Core\Datetime\DateFormatter $date_formatter - * The date formatter service. - */ - public function __construct(array $configuration, $plugin_id, $plugin_definition, DateFormatter $date_formatter) { - parent::__construct($configuration, $plugin_id, $plugin_definition); - $this->definition = $plugin_definition + $configuration; - $this->dateFormatter = $date_formatter; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static($configuration, $plugin_id, $plugin_definition, $container->get('date.formatter')); - } - - /** - * {@inheritdoc} - */ - public function evenEmpty() { - return TRUE; - } - - /** - * {@inheritdoc} - */ - protected function defineOptions() { - $options = parent::defineOptions(); - - $options['calendar_type'] = ['default' => 'month']; - $options['name_size'] = ['default' => 3]; - $options['month_name_size'] = ['default' => 99]; - $options['mini'] = ['default' => 0]; - $options['with_weekno'] = ['default' => 0]; - $options['multiday_theme'] = ['default' => 1]; - $options['theme_style'] = ['default' => 1]; - $options['max_items'] = ['default' => 0]; - $options['max_items_behavior'] = ['default' => 'more']; - $options['groupby_times'] = ['default' => 'hour']; - $options['groupby_times_custom'] = ['default' => '']; - $options['groupby_field'] = ['default' => '']; - $options['multiday_hidden'] = ['default' => []]; - $options['granularity_links'] = [ - 'default' => [ - 'day' => '', - 'week' => '', - ], - ]; - - return $options; - } - - /** - * {@inheritdoc} - */ - public function buildOptionsForm(&$form, FormStateInterface $form_state) { - parent::buildOptionsForm($form, $form_state); - - $form['calendar_type'] = [ - '#title' => $this->t('Calendar type'), - '#type' => 'select', - '#description' => $this->t('Select the calendar time period for this display.'), - '#default_value' => $this->options['calendar_type'], - '#options' => CalendarHelper::displayTypes(), - ]; - $form['mini'] = [ - '#title' => $this->t('Display as mini calendar'), - '#default_value' => $this->options['mini'], - '#type' => 'radios', - '#options' => [ - 0 => $this->t('No'), - 1 => $this->t('Yes'), - ], - '#description' => $this->t('Display the mini style calendar, with no item details. Suitable for a calendar displayed in a block.'), - '#dependency' => ['edit-style-options-calendar-type' => ['month']], - '#states' => [ - 'visible' => [ - ':input[name="style_options[calendar_type]"]' => ['value' => 'month'], - ], - ], - ]; - $form['month_name_size'] = [ - '#title' => $this->t('Calendar month names'), - '#default_value' => $this->options['month_name_size'], - '#type' => 'radios', - '#options' => [ - 1 => $this->t('Abbreviated name'), - 99 => $this->t('Full name'), - ], - '#description' => $this->t('The way month names should be displayed in a year calendar.'), - '#states' => [ - 'visible' => [ - ':input[name="style_options[calendar_type]"]' => ['value' => 'year'], - ], - ], - ]; - $form['name_size'] = [ - '#title' => $this->t('Calendar day of week names'), - '#default_value' => $this->options['name_size'], - '#type' => 'radios', - '#options' => [ - 1 => $this->t('First letter of name'), - 2 => $this->t('First two letters of name'), - 3 => $this->t('Abbreviated name'), - 99 => $this->t('Full name'), - ], - '#description' => $this->t('The way day of week names should be displayed in a calendar.'), - '#states' => [ - 'visible' => [ - ':input[name="style_options[calendar_type]"]' => [ - ['value' => 'year'], - ['value' => 'month'], - ['value' => 'week'], - ], - ], - ], - ]; - $form['with_weekno'] = [ - '#title' => $this->t('Show week numbers'), - '#default_value' => $this->options['with_weekno'], - '#type' => 'radios', - '#options' => [ - 0 => $this->t('No'), - 1 => $this->t('Yes'), - ], - '#description' => $this->t('Whether or not to show week numbers in the left column of calendar weeks and months.'), - '#states' => [ - 'visible' => [ - ':input[name="style_options[calendar_type]"]' => ['value' => 'month'], - ], - ], - ]; - $form['max_items'] = [ - '#title' => $this->t('Maximum items'), - '#type' => 'select', - '#options' => [ - 0 => $this->t('Unlimited'), - 1 => $this->formatPlural(1, '1 item', '@count items'), - 3 => $this->formatPlural(3, '1 item', '@count items'), - 5 => $this->formatPlural(5, '1 item', '@count items'), - 10 => $this->formatPlural(10, '1 item', '@count items'), - ], - '#default_value' => $this->options['calendar_type'] != 'day' ? $this->options['max_items'] : 0, - '#description' => $this->t('Maximum number of items to show in calendar cells, used to keep the calendar from expanding to a huge size when there are lots of items in one day.'), - '#states' => [ - 'visible' => [ - ':input[name="style_options[calendar_type]"]' => ['value' => 'month'], - ], - ], - ]; - $form['max_items_behavior'] = [ - '#title' => $this->t('Too many items'), - '#type' => 'select', - '#options' => [ - 'more' => $this->t("Show maximum, add 'more' link"), - 'hide' => $this->t('Hide all, add link to day'), - ], - '#default_value' => $this->options['calendar_type'] != 'day' ? $this->options['max_items_behavior'] : 'more', - '#description' => $this->t('Behavior when there are more than the above number of items in a single day. When there more items than this limit, a link to the day view will be displayed.'), - '#states' => [ - 'visible' => [ - ':input[name="style_options[calendar_type]"]' => ['value' => 'month'], - ], - ], - ]; - $form['groupby_times'] = [ - '#title' => $this->t('Time grouping'), - '#type' => 'select', - '#default_value' => $this->options['groupby_times'], - '#description' => $this->t("Group items together into time periods based on their start time."), - '#options' => [ - '' => $this->t('None'), - 'hour' => $this->t('Hour'), - 'half' => $this->t('Half hour'), - 'custom' => $this->t('Custom'), - ], - '#states' => [ - 'visible' => [ - ':input[name="style_options[calendar_type]"]' => [ - ['value' => 'day'], - ['value' => 'week'], - ], - ], - ], - ]; - $form['groupby_times_custom'] = [ - '#title' => $this->t('Custom time grouping'), - '#type' => 'textarea', - '#default_value' => $this->options['groupby_times_custom'], - '#description' => $this->t("When choosing the 'custom' Time grouping option above, create custom time period groupings as a comma-separated list of 24-hour times in the format HH:MM:SS, like '00:00:00,08:00:00,18:00:00'. Be sure to start with '00:00:00'. All items after the last time will go in the final group."), - '#states' => [ - 'visible' => [ - ':input[name="style_options[groupby_times]"]' => ['value' => 'custom'], - ], - ], - ]; - $form['theme_style'] = [ - '#title' => $this->t('Overlapping time style'), - '#default_value' => $this->options['theme_style'], - '#type' => 'select', - '#options' => [ - 0 => $this->t('Do not display overlapping items'), - 1 => $this->t('Display overlapping items, with scrolling'), - 2 => $this->t('Display overlapping items, no scrolling'), - ], - '#description' => $this->t('Select whether calendar items are displayed as overlapping items. Use scrolling to shrink the window and focus on the selected items, or omit scrolling to display the whole day. This only works if hour or half hour time grouping is chosen!'), - '#states' => [ - 'visible' => [ - ':input[name="style_options[calendar_type]"]' => [ - ['value' => 'day'], - ['value' => 'week'], - ], - ], - ], - ]; - - // Create a list of fields that are available for grouping. - $field_options = []; - $fields = $this->view->display_handler->getOption('fields'); - foreach ($fields as $field_name => $field) { - $field_options[$field_name] = $field['field']; - } - $form['groupby_field'] = [ - '#title' => $this->t('Field grouping'), - '#type' => 'select', - '#default_value' => $this->options['groupby_field'], - '#description' => $this->t("Optionally group items into columns by a field value, for instance select the content type to show items for each content type in their own column, or use a location field to organize items into columns by location. NOTE! This is incompatible with the overlapping style option."), - '#options' => ['' => ''] + $field_options, - '#states' => [ - 'visible' => [ - ':input[name="style_options[calendar_type]"]' => ['value' => 'day'], - ], - ], - ]; - $form['multiday_theme'] = [ - '#title' => $this->t('Multi-day style'), - '#default_value' => $this->options['multiday_theme'], - '#type' => 'select', - '#options' => [ - 0 => $this->t('Display multi-day item as a single column'), - 1 => $this->t('Display multi-day item as a multiple column row') - ], - '#description' => $this->t('If selected, items which span multiple days will displayed as a multi-column row. If not selected, items will be displayed as an individual column.'), - '#states' => [ - 'visible' => [ - ':input[name="style_options[calendar_type]"]' => [ - ['value' => 'month'], - ['value' => 'week'], - ], - ], - ], - ]; - $form['multiday_hidden'] = [ - '#title' => $this->t('Fields to hide in Multi-day rows'), - '#default_value' => $this->options['multiday_hidden'], - '#type' => 'checkboxes', - '#options' => $field_options, - '#description' => $this->t('Choose fields to hide when displayed in multi-day rows. Usually you only want to see the title or Colorbox selector in multi-day rows and would hide all other fields.'), - '#states' => [ - 'visible' => [ - ':input[name="style_options[calendar_type]"]' => [ - ['value' => 'month'], - ['value' => 'week'], - ['value' => 'day'], - ], - ], - ], - ]; - - // Allow custom Day and Week links - $form['granularity_links'] = ['#tree' => TRUE]; - $form['granularity_links']['day'] = [ - '#title' => $this->t('Day link displays'), - '#type' => 'select', - '#default_value' => $this->options['granularity_links']['day'], - '#description' => $this->t("Optionally select a View display to use for Day links."), - '#options' => ['' => $this->t('Default display')] + $this->viewOptionsForGranularity('day'), - ]; - $form['granularity_links']['week'] = [ - '#title' => $this->t('Week link displays'), - '#type' => 'select', - '#default_value' => $this->options['granularity_links']['week'], - '#description' => $this->t("Optionally select a View display to use for Week links."), - '#options' => ['' => $this->t('Default display')] + $this->viewOptionsForGranularity('week'), - ]; - } - - /** - * {@inheritdoc} - */ - public function validateOptionsForm(&$form, FormStateInterface $form_state) { - $groupby_times = $form_state->getValue(['style_options', 'groupby_times']); - if ($groupby_times == 'custom' && $form_state->isValueEmpty(['style_options', 'groupby_times_custom'])) { - $form_state->setErrorByName('groupby_times_custom', $this->t('Custom groupby times cannot be empty.')); - } - if ((!$form_state->isValueEmpty(['style_options', 'theme_style']) && empty($groupby_times)) || !in_array($groupby_times, ['hour', 'half'])) { - $form_state->setErrorByName('theme_style', $this->t('Overlapping items only work with hour or half hour groupby times.')); - } - if (!$form_state->isValueEmpty(['style_options', 'theme_style']) && !$form_state->isValueEmpty(['style_options', 'group_by_field'])) { - $form_state->setErrorByName('theme_style', $this->t('ou cannot use overlapping items and also try to group by a field value.')); - } - if ($groupby_times != 'custom') { - $form_state->setValue(['style_options', 'groupby_times_custom'], NULL); - } - } - - /** - * {@inheritdoc} - */ - public function submitOptionsForm(&$form, FormStateInterface $form_state) { - $multiday_hidden = $form_state->getValue(['style_options', 'multiday_hidden']); - $form_state->setValue(['style_options', 'multiday_hidden'], array_filter($multiday_hidden)); - parent::submitOptionsForm($form, $form_state); - } - - /** - * Checks if this view uses the calendar row plugin. - * - * @return boolean - * True if it does, false if it doesn't. - */ - protected function hasCalendarRowPlugin() { - return $this->view->rowPlugin instanceof CalendarRow; - } - - /** - * {@inheritdoc} - */ - public function render() { - // @todo Move to $this->validate() - if (empty($this->view->rowPlugin) || !$this->hasCalendarRowPlugin()) { - debug('\Drupal\calendar\Plugin\views\style\CalendarStyle: The calendar row plugin is required when using the calendar style, but it is missing.'); - return; - } - if (!$argument = CalendarHelper::getDateArgumentHandler($this->view)) { - debug('\Drupal\calendar\Plugin\views\style\CalendarStyle: A calendar date argument is required when using the calendar style, to add a date argument in a view, please go to Advanced > Contextual Filters on the views configuration panel.'); - return; - } - - if (!$argument->validateValue()) { - if (!$argument->getDateArg()->getValue()) { - $msg = 'No calendar date argument value was provided.'; - } - else { - $msg = t('The value <strong>@value</strong> is not a valid date argument for @granularity', - [ - '@value' => $argument->getDateArg()->getValue(), - '@granularity' => $argument->getGranularity(), - ] - ); - } - drupal_set_message($msg, 'error'); - return; - } - - - // Add information from the date argument to the view. - $this->dateInfo->setGranularity($argument->getGranularity()); - $this->dateInfo->setCalendarType($this->options['calendar_type']); - $this->dateInfo->setDateArgument($argument->getDateArg()); - $this->dateInfo->setMinYear($argument->getMinDate()->format('Y')); - $this->dateInfo->setMinMonth($argument->getMinDate()->format('n')); - $this->dateInfo->setMinDay($argument->getMinDate()->format('j')); - // @todo We shouldn't use DATETIME_DATE_STORAGE_FORMAT. - $this->dateInfo->setMinWeek(CalendarHelper::dateWeek(date_format($argument->getMinDate(), DATETIME_DATE_STORAGE_FORMAT))); - //$this->dateInfo->setRange($argument->options['calendar']['date_range']); - $this->dateInfo->setMinDate($argument->getMinDate()); - $this->dateInfo->setMaxDate($argument->getMaxDate()); - // @todo implement limit -// $this->dateInfo->limit = $argument->limit; - // @todo What if the display doesn't have a route? - //$this->dateInfo->url = $this->view->getUrl(); - $this->dateInfo->setForbid(isset($argument->getDateArg()->forbid) ? $argument->getDateArg()->forbid : FALSE); - - // Add calendar style information to the view. - $this->styleInfo->setCalendarPopup($this->displayHandler->getOption('calendar_popup')); - $this->styleInfo->setMonthNameSize($this->options['month_name_size']); - $this->styleInfo->setNameSize($this->options['name_size']); - $this->styleInfo->setMini($this->options['mini']); - $this->styleInfo->setShowWeekNumbers($this->options['with_weekno']); - $this->styleInfo->setMultiDayTheme($this->options['multiday_theme']); - $this->styleInfo->setThemeStyle($this->options['theme_style']); - $this->styleInfo->setMaxItems($this->options['max_items']); - $this->styleInfo->setMaxItemsStyle($this->options['max_items_behavior']); - if (!empty($this->options['groupby_times_custom'])) { - $this->styleInfo->setGroupByTimes(explode(',', $this->options['groupby_times_custom'])); - } - else { - $this->styleInfo->setGroupByTimes(calendar_groupby_times($this->options['groupby_times'])); - } - $this->styleInfo->setCustomGroupByField($this->options['groupby_field']); - - // TODO make this an option setting. - $this->styleInfo->setShowEmptyTimes(!empty($this->options['groupby_times_custom']) ? TRUE : FALSE); - - // Set up parameters for the current view that can be used by the row plugin. - $display_timezone = date_timezone_get($this->dateInfo->getMinDate()); - $this->dateInfo->setTimezone($display_timezone); - - // @TODO min and max date timezone info shouldn't be stored separately. - $date = clone($this->dateInfo->getMinDate()); - date_timezone_set($date, $display_timezone); -// $this->dateInfo->min_zone_string = date_format($date, DATETIME_DATE_STORAGE_FORMAT); - - $date = clone($this->dateInfo->getMaxDate()); - date_timezone_set($date, $display_timezone); -// $this->dateInfo->max_zone_string = date_format($date, DATETIME_DATE_STORAGE_FORMAT); - - // Let views render fields the way it thinks they should look before we - // start massaging them. - $this->renderFields($this->view->result); - - // Invoke the row plugin to massage each result row into calendar items. - // Gather the row items into an array grouped by date and time. - $items = []; - foreach ($this->view->result as $row_index => $row) { - $this->view->row_index = $row_index; - $events = $this->view->rowPlugin->render($row); - // @todo Check what comes out here. - /** @var \Drupal\calendar\CalendarEvent $event_info */ - foreach ($events as $event_info) { -// $event->granularity = $this->dateInfo->granularity; - $item_start = $event_info->getStartDate()->format('Y-m-d'); - $item_end = $event_info->getEndDate()->format('Y-m-d'); - $time_start = $event_info->getStartDate()->format('H:i:s'); - $event_info->setRenderedFields($this->rendered_fields[$row_index]); - $items[$item_start][$time_start][] = $event_info; - } - } - - ksort($items); - - $rows = []; - $this->currentDay = clone($this->dateInfo->getMinDate()); - $this->items = $items; - - // Retrieve the results array using a the right method for the granularity of the display. - switch ($this->options['calendar_type']) { - case 'year': - $rows = []; - $this->styleInfo->setMini(TRUE); - for ($i = 1; $i <= 12; $i++) { - $rows[$i] = $this->calendarBuildMiniMonth(); - } - $this->styleInfo->setMini(FALSE); - break; - case 'month': - $rows = !empty($this->styleInfo->isMini()) ? $this->calendarBuildMiniMonth() : $this->calendarBuildMonth(); - break; - case 'day': - $rows = $this->calendarBuildDay(); - break; - case 'week': - $rows = $this->calendarBuildWeek(); - // Merge the day names in as the first row. - $rows = array_merge([CalendarHelper::weekHeader($this->view)], $rows); - break; - } - - // Send the sorted rows to the right theme for this type of calendar. - $this->definition['theme'] = 'calendar_' . $this->options['calendar_type']; - - // Adjust the theme to match the currently selected default. - // Only the month view needs the special 'mini' class, - // which is used to retrieve a different, more compact, theme. - if ($this->options['calendar_type'] == 'month' && !empty($this->styleInfo->isMini())) { - $this->definition['theme'] = 'calendar_mini'; - } - // If the overlap option was selected, choose the overlap version of the theme. - elseif (in_array($this->options['calendar_type'], ['week', 'day']) && !empty($this->options['multiday_theme']) && !empty($this->options['theme_style'])) { - $this->definition['theme'] .= '_overlap'; - } - - $output = [ - '#theme' => $this->themeFunctions(), - '#view' => $this->view, - '#options' => $this->options, - '#rows' => $rows, - ]; - - unset($this->view->row_index); - return $output; - } - - /** - * Build one month. - */ - public function calendarBuildMonth() { - $week_days = CalendarHelper::weekDays(TRUE); - $week_days = CalendarHelper::weekDaysOrdered($week_days); - //$month = date_format($this->curday, 'n'); - $current_day_date = $this->currentDay->format(DATETIME_DATE_STORAGE_FORMAT); - $today = new \DateTime(); - $today = $today->format(DATETIME_DATE_STORAGE_FORMAT); - $day = $this->currentDay->format('j'); - $this->currentDay->modify('-' . strval($day - 1) . ' days'); - $rows = []; - do { - $init_day = clone($this->currentDay); - $month = $this->currentDay->format('n'); - $week = CalendarHelper::dateWeek($current_day_date); - $first_day = \Drupal::config('system.date')->get('first_day'); - list($multiday_buckets, $singleday_buckets, $total_rows) = array_values($this->calendarBuildWeek(TRUE)); - - $output = []; - $final_day = clone($this->currentDay); - - $iehint = 0; - $max_multirow_count = 0; - $max_singlerow_count = 0; - - for ($i = 0; $i < intval($total_rows + 1); $i++) { - $inner = []; - - // If we're displaying the week number, add it as the first cell in the - // week. - if ($i == 0 && !empty($this->styleInfo->isShowWeekNumbers()) && !in_array($this->dateInfo->getGranularity(), ['day', 'week'])) { - $url = CalendarHelper::getURLForGranularity($this->view, 'week', [$this->dateInfo->getMinYear() . $week]); - if (!empty($url)) { - $week_number = [ - '#type' => 'link', - '#url' => $url, - '#title' => $week, - ]; - } - else { - // Do not link week numbers, if week views are disabled. - $week_number = $week; - } - $item = [ - 'entry' => $week_number, - 'colspan' => 1, - 'rowspan' => $total_rows + 1, - 'id' => $this->view->id() . '-weekno-' . $current_day_date, - 'class' => 'week', - ]; - $inner[] = [ - '#theme' => 'calendar_month_col', - '#item' => $item - ]; - } - - $this->currentDay = clone($init_day); - - // Move backwards to the first day of the week. - $day_week_day = $this->currentDay->format('w'); - $this->currentDay->modify('-' . ((7 + $day_week_day - $first_day) % 7) . ' days'); - - for ($week_day = 0; $week_day < 7; $week_day++) { - - $current_day_date = $this->currentDay->format(DATETIME_DATE_STORAGE_FORMAT); - $item = NULL; - $in_month = !($current_day_date < $this->dateInfo->getMinDate()->format(DATETIME_DATE_STORAGE_FORMAT) || $current_day_date > $this->dateInfo->getMaxDate()->format(DATETIME_DATE_STORAGE_FORMAT) || $this->currentDay->format('n') != $month); - - // Add the datebox. - if ($i == 0) { - $item = [ - 'entry' => [ - '#theme' => 'calendar_datebox', - '#date' => $current_day_date, - '#view' => $this->view, - '#items' => $this->items, - '#selected' => ($in_month) ? (bool) (count($multiday_buckets[$week_day]) + count($singleday_buckets[$week_day])) : FALSE, - ], - 'colspan' => 1, - 'rowspan' => 1, - 'class' => 'date-box', - 'date' => $current_day_date, - 'id' => $this->view->id() . '-' . $current_day_date . '-date-box', - 'header_id' => $week_days[$week_day], - 'day_of_month' => $this->currentDay->format('j'), - ]; - $item['class'] .= ($current_day_date == $today && $in_month ? ' today' : '') . - ($current_day_date < $today ? ' past' : '') . - ($current_day_date > $today ? ' future' : ''); - - if (count($singleday_buckets[$week_day]) == 0) { - if ($max_multirow_count == 0 ) { - $item['class'] .= ' no-entry'; - } - } - } - else { - $index = $i - 1; - $multi_count = count($multiday_buckets[$week_day]); - - // Process multiday buckets first. - if ($index < $multi_count) { - // If this item is filled with either a blank or an entry. - if ($multiday_buckets[$week_day][$index]['filled']) { - - // Add item and add class. - $item = $multiday_buckets[$week_day][$index]; - $item['class'] = 'multi-day'; - $item['date'] = $current_day_date; - - // Check wheter this is an entry. - if (!$multiday_buckets[$week_day][$index]['avail']) { - - // If the item either starts or ends on today,then add tags so - // we can style the borders. - if ($current_day_date == $today && $in_month) { - $item['class'] .= ' starts-today'; - } - - // Calculate on which day of this week this item ends on. - $end_day = clone($this->currentDay); - $span = $item['colspan'] - 1; - $end_day->modify('+' . $span . ' day'); - $end_day_date = $end_day->format(DATETIME_DATE_STORAGE_FORMAT); - - // If it ends today, add class. - if ($end_day_date == $today && $in_month) { - $item['class'] .= ' ends-today'; - } - } - } - - // If this is an actual entry, add classes regarding the state of - // the item. - if ($multiday_buckets[$week_day][$index]['avail']) { - $item['class'] .= ' ' . $week_day . ' ' . $index . ' no-entry '; - $item['class'] .= ($current_day_date == $today && $in_month ? ' today' : '') . - ($current_day_date < $today ? ' past' : '') . - ($current_day_date > $today ? ' future' : ''); - } - } - elseif ($index == $multi_count) { - $single_day_count = 0; - $single_days = ''; - // If it's empty, add class. - if (count($singleday_buckets[$week_day]) == 0) { - if ($max_multirow_count == 0 ) { - $class = ($multi_count > 0 ) ? 'single-day no-entry noentry-multi-day' : 'single-day no-entry'; - } - else { - $class = 'single-day'; - } - } - else { - $single_days = []; - foreach ($singleday_buckets[$week_day] as $day) { - foreach ($day as $event) { - $single_day_count++; - if (isset($event['more_link'])) { - // @todo more logic - } - else { - $single_days[] = $event['entry']; - } - //$single_days .= (isset($event['more_link'])) ? '<div class="calendar-more">' . $event['entry'] . '</div>' : $event['entry']; - } - } - $class = 'single-day'; - } - - $rowspan = $total_rows - $index; - $item = [ - 'entry' => $single_days, - 'colspan' => 1, - 'rowspan' => $rowspan, - 'class' => $class, - 'date' => $current_day_date, - 'id' => $this->view->id() . '-' . $current_day_date . '-' . $index, - 'header_id' => $week_days[$week_day], - 'day_of_month' => $this->currentDay->format('j'), - ]; - - // Hack for ie to help it properly space single day rows. - // todo do we still need this? - if ($rowspan > 1 && $in_month && $single_day_count > 0) { - $max_multirow_count = max($max_multirow_count, $single_day_count); - } - else { - $max_singlerow_count = max($max_singlerow_count, $single_day_count); - } - - // If the single row is bigger than the multi-row, then null out - // ieheight - I'm estimating that a single row is twice the size - // of multi-row. This is really the best that can be done with ie. - if ($max_singlerow_count >= $max_multirow_count || $max_multirow_count <= $multi_count / 2 ) { - $iehint = 0; - } - elseif ($rowspan > 1 && $in_month && $single_day_count > 0) { - // Calculate how many rows we need to adjust. - $iehint = max($iehint, $rowspan - 1); - } - - // Set the class. - $item['class'] .= ($current_day_date == $today && $in_month ? ' today' : '') . - ($current_day_date < $today ? ' past' : '') . - ($current_day_date > $today ? ' future' : ''); - } - } - - // If there isn't an item, then add empty class. - if ($item != NULL) { - if (!$in_month) { - $item['class'] .= ' empty'; - } - // Style this entry - it will be a <td>. - $inner[] = [ - '#theme' => 'calendar_month_col', - '#item' => $item - ]; - } - $this->currentDay->modify('+1 day'); - } - - if ($i == 0) { - $output[] = [ - '#theme' => 'calendar_month_row', - '#inner' => $inner, - '#class' => 'date-box', - '#iehint' => $iehint, - ]; - } - elseif ($i == $total_rows) { - $output[] = [ - '#theme' => 'calendar_month_row', - '#inner' => $inner, - '#class' => 'single-day', - '#iehint' => $iehint, - ]; - $iehint = 0; - $max_singlerow_count = 0; - $max_multirow_count = 0; - } - else { - // Style all the columns into a row. - $output[] = [ - '#theme' => 'calendar_month_row', - '#inner' => $inner, - '#class' => 'multi-day', - '#iehint' => 0, - ]; - } - } - $this->currentDay = $final_day; - - // Add the row into the row array. - $rows[] = ['data' => $output]; - - $current_day_date = $this->currentDay->format(DATETIME_DATE_STORAGE_FORMAT); - $current_day_month = $this->currentDay->format('n'); - } while ($current_day_month == $month && $current_day_date <= $this->dateInfo->getMaxDate()->format(DATETIME_DATE_STORAGE_FORMAT)); - // Merge the day names in as the first row. - $rows = array_merge([CalendarHelper::weekHeader($this->view)], $rows); - return $rows; - } - - /** - * Build one mini month. - */ - public function calendarBuildMiniMonth() { - $month = $this->currentDay->format('n'); - $day = $this->currentDay->format('j'); - $this->currentDay->modify('-' . strval($day - 1) . ' days'); - $rows = []; - - do { - $rows = array_merge($rows, $this->calendarBuildMiniWeek()); - $current_day_date = $this->currentDay->format(DATETIME_DATE_STORAGE_FORMAT); - $current_day_month = $this->currentDay->format('n'); - } while ($current_day_month == $month && $current_day_date <= $this->dateInfo->getMaxDate()->format(DATETIME_DATE_STORAGE_FORMAT)); - - // Merge the day names in as the first row. - $rows = array_merge([CalendarHelper::weekHeader($this->view)], $rows); - return $rows; - } - - - /** - * Build one week row. - * - * @param boolean $check_month - * TRUE to check the rest of the month, FALSE otherwise. - * - * @return array - * An assosiative array containing the multiday buckets, the singleday - * buckets and the total row count. - */ - public function calendarBuildWeek($check_month = FALSE) { - $current_day_date = $this->currentDay->format(DATETIME_DATE_STORAGE_FORMAT); - $month = $this->currentDay->format('n'); - $first_day = \Drupal::config('system.date')->get('first_day'); - - // Set up buckets. - $total_rows = 0; - $multiday_buckets = [[], [], [], [], [], [], []]; - $singleday_buckets = [[], [], [], [], [], [], []]; - - // Move backwards to the first day of the week. - $day_week_day = $this->currentDay->format('w'); - $this->currentDay->modify('-' . ((7 + $day_week_day - $first_day) % 7) . ' days'); - - for ($i = 0; $i < 7; $i++) { - if ($check_month && ($current_day_date < $this->dateInfo->getMinDate()->format(DATETIME_DATE_STORAGE_FORMAT) || $current_day_date > $this->dateInfo->getMaxDate()->format(DATETIME_DATE_STORAGE_FORMAT)|| $this->currentDay->format('n') != $month)) { - $singleday_buckets[$i][][] = [ - 'entry' => [ - '#theme' => 'calendar_empty_day', - '#curday' => $current_day_date, - '#view' => $this->view, - ], - 'item' => NULL, - ]; - } - else { - $this->calendarBuildWeekDay($i, $multiday_buckets, $singleday_buckets); - } - $total_rows = max(count($multiday_buckets[$i]) + 1, $total_rows); - $this->currentDay->modify('+1 day'); - $current_day_date = $this->currentDay->format(DATETIME_DATE_STORAGE_FORMAT); - } - - return [ - 'multiday_buckets' => $multiday_buckets, - 'singleday_buckets' => $singleday_buckets, - 'total_rows' => $total_rows, - ]; - } - - /** - * Build one mini week row. - * - * @param boolean $check_month - * TRUE to check the rest of the month, FALSE otherwise. - * - * @return array - * An array of rows with render info. - */ - public function calendarBuildMiniWeek($check_month = FALSE) { - $current_day_date = $this->currentDay->format(DATETIME_DATE_STORAGE_FORMAT); - $weekdays = CalendarHelper::untranslatedDays(); - $today = $this->dateFormatter->format(REQUEST_TIME, 'custom', DATETIME_DATE_STORAGE_FORMAT); - $month = $this->currentDay->format('n'); - $week = CalendarHelper::dateWeek($current_day_date); - - $first_day = \Drupal::config('system.date')->get('first_day'); - // Move backwards to the first day of the week. - $day_week_day = $this->currentDay->format('w'); - $this->currentDay->modify('-' . ((7 + $day_week_day - $first_day) % 7) . ' days'); - - $current_day_date = $this->currentDay->format(DATETIME_DATE_STORAGE_FORMAT); - - if (!empty($this->styleInfo->isShowWeekNumbers())) { - $url = CalendarHelper::getURLForGranularity($this->view, 'week', $this->dateInfo->getMinYear() . $week); - if (!empty($url)) { - $week_number = [ - '#type' => 'link', - '#url' => $url, - '#title' => $week, - ]; - } - else { - // Do not link week numbers, if Week views are disabled. - $week_number = $week; - } - $rows[$week][] = [ - 'data' => $week_number, - 'class' => 'mini week', - 'id' => $this->view->id() . '-weekno-' . $current_day_date, - ]; - } - - for ($i = 0; $i < 7; $i++) { - $current_day_date = $this->currentDay->format(DATETIME_DATE_STORAGE_FORMAT); - $class = strtolower($weekdays[$i] . ' mini'); - if ($check_month && ($current_day_date < $this->dateInfo->getMinDate()->format(DATETIME_DATE_STORAGE_FORMAT) || $current_day_date > $this->dateInfo->getMaxDate()->format(DATETIME_DATE_STORAGE_FORMAT) || $this->currentDay->format('n') != $month)) { - $class .= ' empty'; - - $content = [ - 'date' => '', - 'datebox' => '', - 'empty' => [ - '#theme' => 'calendar_empty_day', - '#curday' => $current_day_date, - '#view' => $this->view, - ], - 'link' => '', - 'all_day' => [], - 'items' => [], - ]; - } - else { - $content = $this->calendarBuildDay(); - $class .= ($current_day_date == $today ? ' today' : '') . - ($current_day_date < $today ? ' past' : '') . - ($current_day_date > $today ? ' future' : '') . - (empty($this->items[$current_day_date]) ? ' has-no-events' : ' has-events'); - } - $rows[$week][] = [ - 'data' => $content, - 'class' => $class, - 'id' => $this->view->id() . '-' . $current_day_date, - ]; - $this->currentDay->modify('+1 day'); - } - return $rows; - } - - /** - * Fill in the selected day info into the event buckets. - * - * @param int $wday - * The index of the day to fill in the event info for. - * @param array $multiday_buckets - * The buckets holding multiday event info for a week. - * @param array $singleday_buckets - * The buckets holding singleday event info for a week. - */ - public function calendarBuildWeekDay($wday, &$multiday_buckets, &$singleday_buckets) { - $current_day_date = $this->currentDay->format(DATETIME_DATE_STORAGE_FORMAT); - - $max_events = $this->dateInfo->getCalendarType() == 'month' && !empty($this->styleInfo->getMaxItems()) ? $this->styleInfo->getMaxItems() : 0; - $hide = !empty($this->styleInfo->getMaxItemsStyle()) ? ($this->styleInfo->getMaxItemsStyle() == 'hide') : FALSE; - $multiday_theme = !empty($this->styleInfo->getMultiDayTheme()) && $this->styleInfo->getMultiDayTheme() == '1'; - $current_count = 0; - $total_count = 0; - $ids = []; - - // If we are hiding, count before processing further. - if ($max_events != CALENDAR_SHOW_ALL) { - foreach ($this->items as $date => $day) { - if ($date == $current_day_date) { - foreach ($day as $time => $hour) { - foreach ($hour as $key => $item) { - $total_count++; - $ids[] = $item->date_id; - } - } - } - } - } - - // If we haven't already exceeded the max or we'll showing all, then process - // the items. - if ($max_events == CALENDAR_SHOW_ALL || !$hide || $total_count < $max_events) { - // Count currently filled items. - foreach ($multiday_buckets[$wday] as $bucket) { - if (!$bucket['avail']) { - $current_count++; - } - } - foreach ($this->items as $date => $day) { - if ($date == $current_day_date) { - ksort($day); - foreach ($day as $time => $hour) { - /** @var \Drupal\calendar\CalendarEvent $item */ - foreach ($hour as $key => $item) { - $all_day = $item->isAllDay(); - - // Parse out date part. - $start_ydate = $this->dateFormatter->format($item->getStartDate()->getTimestamp(), 'custom', 'Y-m-d'); - $end_ydate = $this->dateFormatter->format($item->getEndDate()->getTimestamp(), 'custom', 'Y-m-d'); - $cur_ydate = $this->dateFormatter->format($this->currentDay->getTimestamp(), 'custom', 'Y-m-d'); - - $is_multi_day = ($start_ydate < $cur_ydate || $end_ydate > $cur_ydate); - - // Check if the event spans over multiple days. - if ($multiday_theme && ($is_multi_day || $all_day)) { - - // Remove multiday items from the total count. We can't hide - // them or they will break. - $total_count--; - - // If this the first day of the week, or is the start date of - // the multi-day event, then record this item, otherwise skip - // over. - $day_no = $this->currentDay->format('d'); - if ($wday == 0 || $start_ydate == $cur_ydate || ($this->dateInfo->getGranularity() == 'month' && $day_no == 1) || ($all_day && !$is_multi_day)) { - // Calculate the colspan for this event. - - // If the last day of this event exceeds the end of the - // current month or week, truncate the remaining days. - $diff = CalendarHelper::difference($this->currentDay, $this->dateInfo->getMaxDate(), 'days'); - $remaining_days = ($this->dateInfo->getGranularity() == 'month') ? min(6 - $wday, $diff) : $diff - 1; - // The bucket_cnt defines the colspan. colspan = bucket_cnt + 1 - $days = CalendarHelper::difference($this->currentDay, $item->getEndDate(), 'days'); - $bucket_cnt = max(0, min($days, $remaining_days)); - - // See if there is an available slot to add an event. This will allow - // an event to precede a row filled up by a previous day event - $bucket_index = count($multiday_buckets[$wday]); - for ($i = 0; $i < $bucket_index; $i++) { - if ($multiday_buckets[$wday][$i]['avail']) { - $bucket_index = $i; - break; - } - } - - // Add continuation attributes - $item->continuation = $item->getStartDate() < $this->currentDay; - $item->continues = $days > $bucket_cnt; - $item->is_multi_day = TRUE; - - // Assign the item to the available bucket - $multiday_buckets[$wday][$bucket_index] = [ - 'colspan' => $bucket_cnt + 1, - 'rowspan' => 1, - 'filled' => TRUE, - 'avail' => FALSE, - 'all_day' => $all_day, - 'item' => $item, - 'wday' => $wday, - 'entry' => [ - '#theme' => 'calendar_item', - '#view' => $this->view, - '#rendered_fields' => $item->getRenderedFields(), - '#item' => $item, - ], - ]; - - // Block out empty buckets for the next days in this event for - // this week - for ($i = 0; $i < $bucket_cnt; $i++) { - $bucket = &$multiday_buckets[$i + $wday + 1]; - $bucket_row_count = count($bucket); - $row_diff = $bucket_index - $bucket_row_count; - - // Fill up the preceding buckets - these are available for - // future events - for ( $j = 0; $j < $row_diff; $j++) { - $bucket[($bucket_row_count + $j) ] = [ - 'entry' => ' ', - 'colspan' => 1, - 'rowspan' => 1, - 'filled' => TRUE, - 'avail' => TRUE, - 'wday' => $wday, - 'item' => NULL - ]; - } - $bucket[$bucket_index] = [ - 'filled' => FALSE, - 'avail' => FALSE - ]; - } - } - } - elseif ($max_events == CALENDAR_SHOW_ALL || $current_count < $max_events) { - $current_count++; - // Assign to single day bucket - $singleday_buckets[$wday][$time][] = [ - 'entry' => [ - '#theme' => 'calendar_item', - '#view' => $this->view, - '#rendered_fields' => $item->getRenderedFields(), - '#item' => $item, - ], - 'item' => $item, - 'colspan' => 1, - 'rowspan' => 1, - 'filled' => TRUE, - 'avail' => FALSE, - 'wday' => $wday, - ]; - } - - } - } - } - } - } - - // Add a more link if necessary - if ($max_events != CALENDAR_SHOW_ALL && $total_count > 0 && $current_count < $total_count) { - if (!empty($entry)) { - $singleday_buckets[$wday][][] = [ - 'entry' => [ - '#theme' => 'calendar_' . $this->dateInfo->getCalendarType() . '_multiple_entity', - '#curday' => $current_day_date, - '#count' => $total_count, - '#view' => $this->view, - '#ids' => $ids, - ], - 'more_link' => TRUE, - 'item' => NULL - ]; - } - } - } - - /** - * Build the datebox information for the current day. - * - * @todo expand documentation - * If a day has no events, the empty day theme info is added to the return - * array. - * - * @return array - * An array with information on the current day for use in a datebox. - */ - public function calendarBuildDay() { - $current_day_date = $this->currentDay->format(DATETIME_DATE_STORAGE_FORMAT); - $selected = FALSE; - $max_events = !empty($this->styleInfo->getMaxItems()) ? $this->styleInfo->getMaxItems() : 0; - $ids = []; - $inner = []; - $all_day = []; - $empty = ''; - $link = ''; - $count = 0; - foreach ($this->items as $date => $day) { - if ($date == $current_day_date) { - $count = 0; - $selected = TRUE; - ksort($day); - foreach ($day as $time => $hour) { - /** @var $item \Drupal\calendar\CalendarEvent */ - foreach ($hour as $key => $item) { - $count++; - $ids[$item->getType()] = $item; - if (empty($this->styleInfo->isMini()) && ($max_events == CALENDAR_SHOW_ALL || $count <= $max_events || ($count > 0 && $max_events == CALENDAR_HIDE_ALL))) { - if ($item->isAllDay()) { - $item->setIsMultiDay(TRUE); - $all_day[] = $item; - } - else { - $this->dateFormatter->format($item->getStartDate()->getTimestamp(), 'custom', 'H:i:s'); - $inner[$key][] = $item; - } - } - } - } - } - } - ksort($inner); - - if (empty($inner) && empty($all_day)) { - $empty = [ - '#theme' => 'calendar_empty_day', - '#curday' => $current_day_date, - '#view' => $this->view, - ]; - } - // We have hidden events on this day, use the theme('calendar_multiple_') to show a link. - if ($max_events != CALENDAR_SHOW_ALL && $count > 0 && $count > $max_events && $this->dateInfo->getCalendarType() != 'day' && !$this->styleInfo->isMini()) { - if ($this->styleInfo->getMaxItemsStyle() == 'hide' || $max_events == CALENDAR_HIDE_ALL) { - $all_day = []; - $inner = []; - } - $link = [ - '#theme' => 'calendar_' . $this->dateInfo->getCalendarType() . '_multiple_entity', - '#curday' => $current_day_date, - '#count' => $count, - '#view' => $this->view, - '#ids' => $ids, - ]; - } - - $content = [ - '#date' => $current_day_date, - 'datebox' => [ - '#theme' => 'calendar_datebox', - '#date' => $current_day_date, - '#view' => $this->view, - '#items' => $this->items, - '#selected' => $selected, - ], - '#empty' => $empty, - '#link' => $link, - 'all_day' => $all_day, - 'items' => $inner, - ]; - return $content; - } - - /** - * {@inheritdoc} - */ - public function validate() { - $errors = parent::validate(); - $display_id = $this->displayHandler->display['id']; - if ($display_id == 'default') { - // @todo Update default display in templates to validate. - return $errors; - } - // @todo Validate row plugin - $argument = CalendarHelper::getDateArgumentHandler($this->view, $display_id); - if (empty($argument)) { - $errors[] = $this->t('\Drupal\calendar\Plugin\views\style\CalendarStyle: A calendar date argument is required when using the calendar style, to add a date argument in a view, please go to Advanced > Contextual Filters on the views configuration panel.'); - } - return $errors; - - } - - /** - * Get select options for Views displays that support Calendar with set granularity. - * - * @param $granularity - * - * @return array - */ - protected function viewOptionsForGranularity($granularity) { - $options = []; - $view_displays = Views::getApplicableViews('uses_route'); - foreach ($view_displays as $view_display) { - list($view_id, $display_id) = $view_display; - - $view = View::load($view_id); - $view_exec = $view->getExecutable(); - if ($argument = CalendarHelper::getDateArgumentHandler($view_exec, $display_id)) { - if ($argument->getGranularity() == $granularity) { - $route_name = CalendarHelper::getDisplayRouteName($view_id, $display_id); - $options[$route_name] = $view->label() . ' : ' . $view_exec->displayHandlers->get($display_id)->display['display_title']; - } - } - - } - return $options; - } - - -} diff --git a/web/modules/calendar/src/Template/TwigExtension.php b/web/modules/calendar/src/Template/TwigExtension.php deleted file mode 100644 index 88aac7e1babf4b2fae84996e94ee2741e0a30a22..0000000000000000000000000000000000000000 --- a/web/modules/calendar/src/Template/TwigExtension.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php - -namespace Drupal\calendar\Template; - -/** - * A class providing Calendar Twig extensions. - */ -class TwigExtension extends \Twig_Extension { - - /** - * {@inheritdoc} - */ - public function getName() { - return 'calendar'; - } - - /** - * {@inheritdoc} - */ - public function getFilters() { - return [ - new \Twig_SimpleFilter('calendar_stripe', [$this, 'getCalendarStripe'], ['is_safe' => ['html']]), - ]; - } - - /** - * Adds a striped background to the passed event. - * - * @param \Drupal\calendar\CalendarEvent $event - * - * @return string - * A HTML output string. - */ - public function getCalendarStripe($event) { - if (empty($event->getStripeHexes()) || (!count($event->getStripeHexes()))) { - return; - } - $output = ''; - foreach ($event->getStripeLabels() as $k => $stripe_label) { - if (!empty($event->getStripeHexes()[$k]) && !empty($stripe_label)) { - $output .= '<div style="background-color:' . $event->getStripeHexes()[$k] . ';color:' . $event->getStripeHexes()[$k] . '" class="stripe" title="Key: ' . $event->getStripeLabels()[$k] . '"> </div>' . "\n"; - } - } - return $output; - } -} \ No newline at end of file diff --git a/web/modules/calendar/templates/calendar-datebox.html.twig b/web/modules/calendar/templates/calendar-datebox.html.twig deleted file mode 100644 index 17d92f0e77f0a28c030671f0761780adbb8d7617..0000000000000000000000000000000000000000 --- a/web/modules/calendar/templates/calendar-datebox.html.twig +++ /dev/null @@ -1,27 +0,0 @@ -{# -/** - * @file - * Template to display the date box in a calendar. - * - * Available variables: - * - view: The view. - * - granularity: The type of calendar this box is in -- year, month, day, or week. - * - mini: Whether or not this is a mini calendar. - * - class: The class for this box -- mini-on, mini-off, or day. - * - day: The day of the month. - * - date: The current date, in the form YYYY-MM-DD. - * - link: A formatted link to the calendar day view for this day. - * - url: The url to the calendar day view for this day. - * - selected: Whether or not this day has any items. - * - items: An array of items for this day. - * - * @ingroup themeable - */ -#} -<div class="{{ granularity }} {{ class }}"> - {% if selected is not empty %} - {{ link }} - {% else %} - {{ day }} - {% endif %} -</div> diff --git a/web/modules/calendar/templates/calendar-day-overlap.html.twig b/web/modules/calendar/templates/calendar-day-overlap.html.twig deleted file mode 100644 index cda564eaed9ae850c6e8561ae9bf7cf02f60ca6c..0000000000000000000000000000000000000000 --- a/web/modules/calendar/templates/calendar-day-overlap.html.twig +++ /dev/null @@ -1,126 +0,0 @@ -{# -/** - * @file - * Template to display a view as a calendar day, grouped by time with overlapping items - * - * @see template_preprocess_calendar_day. - * - * rows: The rendered data for this day. - * rows['date'] - the date for this day, formatted as YYYY-MM-DD. - * rows['datebox'] - the formatted datebox for this day. - * rows['empty'] - empty text for this day, if no items were found. - * rows['all_day'] - an array of formatted all day items. - * rows['items'] - an array of timed items for the day. - * rows['items'][time_period]['hour'] - the formatted hour for a time period. - * rows['items'][time_period]['ampm'] - the formatted ampm value, if any for a time period. - * rows['items'][time_period][$column]['values'] - An array of formatted - * items for a time period and field column. - * - * view: The view. - * columns: an array of column names. - * min_date_formatted: The minimum date for this calendar in the format YYYY-MM-DD HH:MM:SS. - * max_date_formatted: The maximum date for this calendar in the format YYYY-MM-DD HH:MM:SS. - * - * The width of the columns is dynamically set using <col></col> - * based on the number of columns presented. The values passed in will - * work to set the 'hour' column to 10% and split the remaining columns - * evenly over the remaining 90% of the table. - * - * @ingroup themeable - */ -#} -<div class="calendar-calendar"><div class="day-view"> -{# // Multi-day and all day events are not supported because Dates don't have end values -<div id="multi-day-container"> - <table class="full"> - <tbody> - <tr class="holder"> - <td class="calendar-time-holder"></td> - <td class="calendar-day-holder"></td> - </tr> - <tr> - <td class="{{ agenda_hour_class }} first"> - <span class="calendar-hour">{% trans %}All day{% endtrans %}</span> - </td> - <td class="calendar-agenda-items multi-day last"> - {% for column in columns %} - <div class="calendar"> - <div class="inner"> - {% if rows['all_day'] is not empty and rows['all_day'][column] is not empty %} - {{ rows['all_day'][column] }} - {% else %} - - {% endif %} - </div> - </div> - {% endfor %} - </td> - </tr> - </tbody> - </table> -</div> - -<div class="header-body-divider"> </div> -#} -<div id="single-day-container"> - <table class="full"> - <tbody> - <tr class="holder"> - <td class="calendar-time-holder"></td> - <td class="calendar-day-holder"></td> - </tr> - <tr> - <td class="first"> - {% set is_first = true %} - {% for time_cnt, hour in rows['items'] %} - {% if time_cnt == 0 %} - {% set class = 'first' %} - {% elseif time_cnt == start_times|length - 1 %} - {% set class = 'last' %} - {% else %} - {% set class = '' %} - {% endif %} - <div class="{{ class }} calendar-agenda-hour"> - <span class="calendar-hour">{{ hour.hour }}</span><span class="calendar-ampm">{{ hour.ampm }}</span> - </div> - {% endfor %} - </td> - <td class="last"> - {% for time_cnt, hour in rows['items'] %} - {% if time_cnt == 0 %} - {% set class = 'first' %} - {% elseif time_cnt == start_times|length - 1 %} - {% set class = 'last' %} - {% else %} - {% set class = '' %} - {% endif %} - - {% for column in columns %} - <div class="{{ class }} calendar-agenda-items single-day"> - <div class="half-hour"> </div> - {% if is_first and hour['values'][column] %} - <div class="calendar item-wrapper first_item"> - {% set is_first = true %} - {% else %} - <div class="calendar item-wrapper"> - {% endif %} - <div class="inner"> - {% if hour['values'] is not empty and hour['values'][column] is not empty %} - {% for item in hour['values'][column] %} - {{ item }} - {% endfor %} - {% else %} - - {% endif %} - </div> - </div> - </div> - {% endfor %} - {% endfor %} - </td> - </tr> - </tbody> - </table> -</div> -<div class="single-day-footer"> </div> -</div></div> diff --git a/web/modules/calendar/templates/calendar-day.html.twig b/web/modules/calendar/templates/calendar-day.html.twig deleted file mode 100644 index 051c5c407fc8e42a64d17e1f9dd1f095ce6d0aef..0000000000000000000000000000000000000000 --- a/web/modules/calendar/templates/calendar-day.html.twig +++ /dev/null @@ -1,96 +0,0 @@ -{# -/** - * @file - * Template to display a view as a calendar day, grouped by time - * and optionally organized into columns by a field value. - * - * @see template_preprocess_calendar_day. - * - * - rows: The rendered data for this day. - * - rows['date'] - the date for this day, formatted as YYYY-MM-DD. - * - rows['datebox'] - the formatted datebox for this day. - * - rows['empty'] - empty text for this day, if no items were found. - * - rows['all_day'] - an array of formatted all day items. - * - rows['items'] - an array of timed items for the day. - * - rows['items'][$time_period]['hour'] - the formatted hour for a time period. - * - rows['items'][$time_period]['ampm'] - the formatted ampm value, if any for a time period. - * - rows['items'][$time_period][$column]['values'] - An array of formatted - * items for a time period and field column. - * - * - view: The view. - * - columns: an array of column names. - * - min_date_formatted: The minimum date for this calendar in the format YYYY-MM-DD HH:MM:SS. - * - max_date_formatted: The maximum date for this calendar in the format YYYY-MM-DD HH:MM:SS. - * - * The width of the columns is dynamically set using <col></col> - * based on the number of columns presented. The values passed in will - * work to set the 'hour' column to 10% and split the remaining columns - * evenly over the remaining 90% of the table. - */ -#} -<div class="calendar-calendar"><div class="day-view"> -<table class="full"> - <col width="{{ first_column_width }}%"></col> - <thead> - {% for column in columns %} - <col width="{{ column_width }}%"></col> - {% endfor %} - <tr> - <th class="calendar-dayview-hour"> - {% if by_hour_count > 0 %} - {% trans %}Time{% endtrans %} - {% endif %} - </th> - {% for column in columns %} - <th class="calendar-agenda-items">{{ column }}</th> - {% endfor %} - </tr> - </thead> - <tbody> - {# // All day and multi-day events not support in core DateTime module in Drupal 8 - <tr> - <td class="{{ agenda_hour_class }}"> - <span class="calendar-hour"> - {% if by_hour_count > 0 %} - {% trans %}All day{% endtrans %} - {% endif %} - </span> - </td> - {% for column in columns %} - <td class="calendar-agenda-items multi-day"> - <div class="calendar"> - <div class="inner"> - {% if rows['all_day'][column] is not empty %} - {{ rows['all_day'][column] }} - {% else %} - - {% endif %} - </div> - </div> - </td> - {% endfor %} - </tr> - #} - {% for hour in rows['items'] %} - <tr> - <td class="calendar-agenda-hour"> - <span class="calendar-hour">{{ hour.hour }}</span><span class="calendar-ampm">{{ hour.ampm }}></span> - </td> - {% for column in columns %} - <td class="calendar-agenda-items single-day"> - <div class="calendar"> - <div class="inner"> - {% if hour['values'][column] is not empty %} - {{ hour['values'][column] }} - {% else %} - - {% endif %} - </div> - </div> - </td> - {% endfor %} - </tr> - {% endfor %} - </tbody> -</table> -</div></div> diff --git a/web/modules/calendar/templates/calendar-empty-day.html.twig b/web/modules/calendar/templates/calendar-empty-day.html.twig deleted file mode 100644 index 0c7e5f2752ff5cf3f7785eff108f81746e6fa65b..0000000000000000000000000000000000000000 --- a/web/modules/calendar/templates/calendar-empty-day.html.twig +++ /dev/null @@ -1,17 +0,0 @@ -{# -/** - * @file - * Format an empty day on a calendar. - * - * Available variables: - * - curday: The current day to display. - * - view: The view. - * - * @ingroup themeable - */ -#} -{% if view.dateInfo.calendarType != 'day' %} - <div class="calendar-empty"> </div> -{% else %} - <div class="calendar-dayview-empty">{% trans %}Empty day{% endtrans %}</div> -{% endif %} diff --git a/web/modules/calendar/templates/calendar-header.html.twig b/web/modules/calendar/templates/calendar-header.html.twig deleted file mode 100644 index 3247178714fbc2f7379aae124e5acd1e3d86a01b..0000000000000000000000000000000000000000 --- a/web/modules/calendar/templates/calendar-header.html.twig +++ /dev/null @@ -1,15 +0,0 @@ -{#/** -* @file -* Template to display a calendar header. -* Be default called by CalendarHeader area. -* -* Available variables: -* - title: Header Title. -* - empty: Whether there are any results. -* - granularity: whether this is week, day, month or year display. -* -* @ingroup themeable -*/ -#} -{# @todo Finish Header if this the way to go. #} -<h3>{{ title }}</h3> diff --git a/web/modules/calendar/templates/calendar-item.html.twig b/web/modules/calendar/templates/calendar-item.html.twig deleted file mode 100644 index ff8574cbc0193d3b86f9cd1aa08cb0cbe757ae49..0000000000000000000000000000000000000000 --- a/web/modules/calendar/templates/calendar-item.html.twig +++ /dev/null @@ -1,58 +0,0 @@ -{# -/** - * @file - * Template to display view fields as a calendar item. - * - * - item - * A result object for this calendar item. Note this is - * not a complete entity. It will contain various - * values as added by the row plugin, which may depend - * on the entity type. - * - * - rendered_fields - * An array of the rendered html for the fields in the item, - * as generated by Views. This does not include excluded - * fields and should take into account any special processing - * added in the field settings. - * - * Calendar info for this individual calendar item is in local time -- - * the user timezone where configurable timezones are allowed and set, - * otherwise the site timezone. If this item has extends over more than - * one day, it has been broken apart into separate items for each calendar - * date and calendar_start will be no earlier than the start of - * the current day and calendar_end will be no later than the end - * of the current day. - * - * - calendar_start - A formatted datetime start date for this item. - * i.e. '2008-05-12 05:26:15'. - * - calendar_end - A formatted datetime end date for this item, - * the same as the start date except for fields that have from/to - * fields defined, like Date module dates. - * - calendar_start_date - a PHP date object for the start time. - * - calendar_end_date - a PHP date object for the end time. - * - * @see template_preprocess_calendar_item. - */ -#} -<div class="{{ item.class|default('item') }}"> - <div class="view-item"> - <div class="calendar {{ item.granularity }}view"> - {{ item | calendar_stripe }} - <div class="{{ item.date_id }} contents"> - {% for field in rendered_fields %} - {% if (index + 1) == 0 and item.continuation %} - <div class="continuation">«</div> - {% endif %} - {% for field_html in field %} - {{ field_html }} - {% endfor %} - {% endfor %} - </div> - {% if item.continues %} - <div class="continues">»</div> - {% else %} - <div class="cutoff"> </div> - {% endif %} - </div> - </div> -</div> diff --git a/web/modules/calendar/templates/calendar-mini.html.twig b/web/modules/calendar/templates/calendar-mini.html.twig deleted file mode 100644 index c0b6d17ae9492712b75fb36cabbf0f4dce6e561c..0000000000000000000000000000000000000000 --- a/web/modules/calendar/templates/calendar-mini.html.twig +++ /dev/null @@ -1,52 +0,0 @@ -{# -/** - * @file - * Template to display a view as a mini calendar month. - * - * Available variables: - * - day_names: An array of the day of week names for the table header. - * - rows: An array of data for each day of the week. - * - view: The view. - * - min_date_formatted: The minimum date for this calendar in the format YYYY-MM-DD HH:MM:SS. - * - max_date_formatted: The maximum date for this calendar in the format YYYY-MM-DD HH:MM:SS. - * - * @see template_preprocess_calendar_mini() - * - * @ingroup themeable - */ -#} -<div class="calendar-calendar"> - <div class="month-view"> - {% if options.month_name %} - <div class="date-nav-wrapper clear-block"> - <div class="date-nav"> - <div class="date-heading"> - {{ options.month_name }} - </div> - </div> - </div> - {% endif %} - <table class="mini"> - <thead> - <tr> - {% for day_names in cell %} - <th class="{{ cell.class }}"> - { cell.data }} - </th> - {% endfor %} - </tr> - </thead> - <tbody> - {% for row in rows %} - <tr> - {% for cell in row %} - <td id="{{ cell.id }}" class="{{ cell.class }}"> - {{ cell.data }} - </td> - {% endfor %} - </tr> - {% endfor %} - </tbody> - </table> - </div> -</div> diff --git a/web/modules/calendar/templates/calendar-month-col.html.twig b/web/modules/calendar/templates/calendar-month-col.html.twig deleted file mode 100644 index aacc02fee5c8b05ea4e7591a219a620cf7ece14f..0000000000000000000000000000000000000000 --- a/web/modules/calendar/templates/calendar-month-col.html.twig +++ /dev/null @@ -1,24 +0,0 @@ -{# -/** - * @file - * Template to display a column. - * - * Available variables: - * - item: The item to render within a td element. - * - * @ingroup themeable - */ -#} - -<td - id="{{ item.id }}" - date-date="{{ item.date }}" - data-day-of-month="{{ item.day_of_month }}" - headers="{{ item.header_id }}" - class="{{ item.class }}" - colspan="{{ item.colspan }}" - rowspan="{{ item.rowspan }}"> - <div class="inner"> - {{ item.entry }} - </div> -</td> diff --git a/web/modules/calendar/templates/calendar-month-multiple-entity.html.twig b/web/modules/calendar/templates/calendar-month-multiple-entity.html.twig deleted file mode 100644 index d27d9b5ce263699f72d73d0ed683c2540c4adcec..0000000000000000000000000000000000000000 --- a/web/modules/calendar/templates/calendar-month-multiple-entity.html.twig +++ /dev/null @@ -1,37 +0,0 @@ -{# -/** - * @file - * Template to display a summary of the days items as a calendar month entity. - * - * Available variables: - * - * @see template_preprocess_calendar_month_multiple_entity. - * - * @ingroup themeable - */ -#} -1 -<div class="view-item view-item-{{ view.name }}>"> - <div class="calendar monthview" id="{{ curday }}"> - {% for id in ids %} - {% if view.styleInfo.maxItemsStyle is not 'more' %} - - <!-- theme('calendar_stripe_stripe', $id); ?>--> - {% endif %} - {% endfor %} - <div class="view-item"> - {% if view.styleInfo.maxItemsStyle is not 'more' %} - <div class="multiple-events"> - <!--<?php // @FIXME -// l() expects a Url object, created from a route name or external URI. -// print l(t('Click to see all @count events', ['@count' => $count]), $link) -?>-->multiple-events - </div> - </div> - {% else %} - <!--<div class="calendar-more"><?php // @FIXME -// l() expects a Url object, created from a route name or external URI. -// print l(t('more'), $link) -?></div>-->calendar-more - {% endif %} - </div> -</div> diff --git a/web/modules/calendar/templates/calendar-month-row.html.twig b/web/modules/calendar/templates/calendar-month-row.html.twig deleted file mode 100644 index f7eeccd7216361a8baba2756a6e474390bd5391d..0000000000000000000000000000000000000000 --- a/web/modules/calendar/templates/calendar-month-row.html.twig +++ /dev/null @@ -1,16 +0,0 @@ -{# -/** - * @file - * Template to display a row - * - * Available variables: - * - inner: The rendered string of the row's contents. - * - class - * - iehint - * - * @ingroup themeable - */ -#} -<tr class="{{ class }}" iehint="{{ iehint }}"> - {{ inner }} -</tr> diff --git a/web/modules/calendar/templates/calendar-month.html.twig b/web/modules/calendar/templates/calendar-month.html.twig deleted file mode 100644 index 0a4813bc5e3a4c4a2e74c2a4f19a75e2f82c5d45..0000000000000000000000000000000000000000 --- a/web/modules/calendar/templates/calendar-month.html.twig +++ /dev/null @@ -1,55 +0,0 @@ -{# -/** - * @file - * Template to display a view as a calendar month. - * - * Available variables: - * - day_names: An array of the day of week names for the table header. - * - rows: An array of data for each day of the week. - * - view: The view. - * - calendar_links: Array of formatted links to other calendar displays - year, month, week, day. - * - display_type: year, month, day, or week. - * - block: Whether or not this calendar is in a block. - * - min_date_formatted: The minimum date for this calendar in the format YYYY-MM-DD HH:MM:SS. - * - max_date_formatted: The maximum date for this calendar in the format YYYY-MM-DD HH:MM:SS. - * - date_id: a css id that is unique for this date, it is in the form: calendar-nid-field_name-delta - * - * @ingroup themeable - */ -#} -<div class="calendar-calendar"><div class="month-view"> -<table class="full"> - <thead> - <tr> - {% for cell in day_names %} - <th class="{{ cell.class }}" id="{{ cell.header_id }}"> - {{ cell.data }} - </th> - {% endfor %} - </tr> - </thead> - <tbody> - {% for row in rows %} - {{ row.data }} - {% endfor %} - </tbody> -</table> -</div></div> -<!-- -todo decide what we will do with this. -<script> -try { - // ie hack to make the single day row expand to available space - if ($.browser.msie ) { - var multiday_height = $('tr.multi-day')[0].clientHeight; // Height of a multi-day row - $('tr[iehint]').each(function(index) { - var iehint = this.getAttribute('iehint'); - // Add height of the multi day rows to the single day row - seems that 80% height works best - var height = this.clientHeight + (multiday_height * .8 * iehint); - this.style.height = height + 'px'; - }); - } -}catch(e){ - // swallow -} -</script>--> \ No newline at end of file diff --git a/web/modules/calendar/templates/calendar-pager.html.twig b/web/modules/calendar/templates/calendar-pager.html.twig deleted file mode 100644 index 40ea70aa3df4ad47e5c6ecf0aae444ade67f6732..0000000000000000000000000000000000000000 --- a/web/modules/calendar/templates/calendar-pager.html.twig +++ /dev/null @@ -1,38 +0,0 @@ -{# -/** - * @file - * Default theme implementation for a calendar pager. - * - * Available variables: - * - items: List of pager items. - * - * @ingroup themeable - */ -#} -{% if (items.previous or items.next) and not exclude %} - <nav class="pager" role="navigation" aria-labelledby="pagination-heading"> - <h4 class="visually-hidden">{{ 'Pagination'|t }}</h4> - <ul class="js-pager__items"> - {% if items.previous %} - <li class="pager__item pager__item--previous"> - <a href="{{ items.previous.url }}" title="{{ 'Go to previous page'|t }}" rel="prev"{{ items.previous.attributes|without('href', 'title', 'rel') }}> - <span aria-hidden="true">{{ items.previous.text|default('‹‹'|t) }}</span> - <span>{{ 'Previous'|t }}</span> - </a> - </li> - {% endif %} - {% if items.current %} - <li class="pager__item pager__item--current">{{ items.current }}</li> - {% endif %} - {% if items.next %} - <li class="pager__item pager__item--next"> - <a href="{{ items.next.url }}" title="{{ 'Go to next page'|t }}" rel="next"{{ items.next.attributes|without('href', 'title', 'rel') }}> - <span>{{ 'Next'|t }}</span> - <span aria-hidden="true">{{ items.next.text|default('››'|t) }}</span> - </a> - </li> - {% endif %} - </ul> - </nav> -{% endif %} - diff --git a/web/modules/calendar/templates/calendar-stripe-legend.html.twig b/web/modules/calendar/templates/calendar-stripe-legend.html.twig deleted file mode 100644 index 97a469ab9be8474262b2d62cc7129be9e26e0e50..0000000000000000000000000000000000000000 --- a/web/modules/calendar/templates/calendar-stripe-legend.html.twig +++ /dev/null @@ -1,35 +0,0 @@ -{# -/** - * @file - * Template to display a stripe legend for a calendar view. - * - * Available variables: - * - headers: the header labels - * - rows: an associative array holding all rows, each row defines: - * - label: the label of the entity of the current row - * - stripe: the hex code of the color - * - * @see template_preprocess_calendar_stripe_legend() - * - * @ingroup themeable - */ -#} -<div class="calendar calendar-legend"> - <table> - <thead> - <tr> - {% for header in headers %} - <td class="calendar-legend">{{ header.label }}</td> - {% endfor %} - </tr> - </thead> - <tbody> - {% for row in rows %} - <tr> - <td>{{ row.label }}</td> - <td><div style="background-color:{{ row.stripe }};color:{{ row.stripe }};" class="calendar-legend" title="Key: {{ row.label }}">{{ row.stripe }} </div></td> - </tr> - {% endfor %} - </tbody> - </table> -</div> diff --git a/web/modules/calendar/templates/calendar-week-overlap.html.twig b/web/modules/calendar/templates/calendar-week-overlap.html.twig deleted file mode 100644 index cb7926b4ce57f5bbf9ececcce26307267a2329dd..0000000000000000000000000000000000000000 --- a/web/modules/calendar/templates/calendar-week-overlap.html.twig +++ /dev/null @@ -1,184 +0,0 @@ -<?php -/** - * @file - * Template to display a view as a calendar week with overlapping items - * - * @see template_preprocess_calendar_week. - * - * $day_names: An array of the day of week names for the table header. - * $rows: The rendered data for this week. - * - * For each day of the week, you have: - * $rows['date'] - the date for this day, formatted as YYYY-MM-DD. - * $rows['datebox'] - the formatted datebox for this day. - * $rows['empty'] - empty text for this day, if no items were found. - * $rows['all_day'] - an array of formatted all day items. - * $rows['items'] - an array of timed items for the day. - * $rows['items'][$time_period]['hour'] - the formatted hour for a time period. - * $rows['items'][$time_period]['ampm'] - the formatted ampm value, if any for a time period. - * $rows['items'][$time_period]['values'] - An array of formatted items for a time period. - * - * $view: The view. - * $min_date_formatted: The minimum date for this calendar in the format YYYY-MM-DD HH:MM:SS. - * $max_date_formatted: The maximum date for this calendar in the format YYYY-MM-DD HH:MM:SS. - * - */ -?> -<div class="calendar-calendar"><div class="week-view"> - <div id="header-container"> - <table class="full"> - <tbody> - <tr class="holder"><td class="calendar-time-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder margin-right"></td></tr> - <tr> - <th class="calendar-agenda-hour"> </th> - {% for cell in day_names %} - <th class="{{ cell.class }}" id="{{ cell.header_id }}"> - {{ cell.data }} - </th> - {% endfor %} - <th class="calendar-day-holder margin-right"></th> - </tr> - </tbody> - </table> - </div> - {# Multi-day and all day events are not supported because dates don't have end values yes - <div id="multi-day-container"> - <table class="full"> - <tbody> - <tr class="holder"><td class="calendar-time-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td></tr> - {% for i in 0..multiday_rows %} - {% set row_class = 'all-day' %} - {% set row_class_extra = '' %} - {% if loop.first %}{% set row_class_extra = 'first' %}{% endif %} - {% if loop.last %}{% set row_class_extra = 'last' %}{% endif %} - - <tr class="{{ row_class }} {{ row_class_extra }}"> - {% if loop.index0 == 0 and (by_hour_count > 0 or start_times is not empty) %} - <td class="{{ agenda_hour_class }}" rowspan="{{ multiday_rows }}"> - <span class="calendar-hour">{% trans with {'context': 'datetime'} %}All day{% endtrans %}</span> - </td> - {% endif %} - - {% for j in 0..7 %} - {% set cell = all_day[j][i] %} - {% if cell is not empty and cell.filled and cell['wday'] == j %} - {% for position in colpos..cell['wday'] %} - {% set col_class = "calendar-agenda-items multi-day"%} - {% set col_class_extra = '' %} - {% if loop.first %}{% set col_class_extra = 'first' %}{% endif %} - {% if loop.last %}{% set col_class_extra = 'last' %}{% endif %} - - <td class="{{ col_class }} {{ col_class_extra }}"><div class="inner"> </div></td> - {% endfor %} - - <td colspan="{{ cell['colspan'] }}" class="{{ col_class }}"> - <div class="inner"> - {{ cell.entry }} - </div> - </td> - {% set colpos = colpos + cell['colspan'] %} - {% endif %} - {% endfor %} - - {% for k in colpos..7 %} - {% set col_class = "calendar-agenda-items multi-day no-entry" %} - {% set col_class_extra = '' %} - {% if loop.first %}{% set col_class_extra = 'first' %}{% endif %} - {% if loop.last %}{% set col_class_extra = 'last' %}{% endif %} - <td class="{{ col_class }} {{ col_class_extra }}"><div class="inner"> </div></td> - {% endfor %} - </tr> - {% endfor %} - - {% if multiday_rows == 0 %} - <tr> - <td class="{{ agenda_hour_class }}"> - <span class="calendar-hour">{% trans with {'context': 'datetime'} %}All day{% endtrans %}</span> - </td> - {% for j in 0..7 %} - {% set col_class = "calendar-agenda-items multi-day no-entry" %} - {% set col_class_extra = '' %} - {% if loop.first %}{% set col_class_extra = 'first' %}{% endif %} - {% if loop.last %}{% set col_class_extra = 'last' %}{% endif %} - <td class="{{ col_class }} {{ col_class_extra }}"><div class="inner"> </div></td> - {% endfor %} - </tr> - {% endif %} - - <tr class="expand"> - <td class="{{ agenda_hour_class }}"> - <span class="calendar-hour"> </span> - </td> - - {% for j in 0..7 %} - {% set col_class = "calendar-agenda-items multi-day no-entry" %} - {% set col_class_extra = '' %} - {% if loop.first %}{% set col_class_extra = 'first' %}{% endif %} - {% if loop.last %}{% set col_class_extra = 'last' %}{% endif %} - <td class="{{ col_class }} {{ col_class_extra }}"><div class="inner"> </div></td> - {% endfor %} - <td class="{{ col_class }}"><div class="inner"> </div></td> - </tr> - </thead> - </table> - </div> - <div class="header-body-divider"> </div> - #} - <div id="single-day-container"> - <table class="full"> - <tbody> - <tr class="holder"><td class="calendar-time-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td><td class="calendar-day-holder"></td></tr> - <tr> - {% for i in 0..7 %} - {% if loop.first %} - <td class="first"> - {% elseif loop.index0 == 7 %} - <td class="last" headers="{{ header_ids[loop.index0 - 1] }}"> - {% else %} - <td headers="{{ header_ids[loop.index0 - 1] }}"> - {% endif %} - - {% for time_cnt, start_time in start_times %} - {% if time_cnt == 0 %} - {% set class = 'first' %} - {% elseif time_cnt == start_times|length - 1 %} - {% set class = 'last' %} - {% else %} - {% set class = '' %} - {% endif %} - - {% if loop.parent.loop.first %} - {% set time = items[start_time] %} - <div class="{{ class }} calendar-agenda-hour"> - <span class="calendar-hour">{{ time.hour }}</span><span class="calendar-ampm">{{ time.ampm }}</span> - </div> - {% else %} - <div class="{{ class }} calendar-agenda-items single-day"> - <div class="half-hour"> </div> - <div class="calendar item-wrapper"> - <div class="inner"> - {#{% if items[start_time]['values'] is not empty %}{{ dump(items[start_time]['values']) }}{% endif %}#} - {% if items[start_time]['values'][loop.parent.loop.index0 - 1] %} - {% for item in items[start_time]['values'][loop.parent.loop.index0 - 1] %} - {% if item['is_first'] %} - <div class="item {{ item.class }} first_item"> - {% else %} - <div class="item {{ item.class }}"> - {% endif %} - {{ item.entry }} - </div> - {% endfor %} - {% endif %} - </div> - </div> - </div> - {% endif %} - {% endfor %} - </td> - {% endfor %} - </tr> - </tbody> - </table> - </div> - <div class="single-day-footer"> </div> -</div></div> diff --git a/web/modules/calendar/templates/calendar-week.html.twig b/web/modules/calendar/templates/calendar-week.html.twig deleted file mode 100644 index 569a010209af0d681fe58bca9e5fc63146c4a83f..0000000000000000000000000000000000000000 --- a/web/modules/calendar/templates/calendar-week.html.twig +++ /dev/null @@ -1,112 +0,0 @@ -{# -/** - * @file - * Template to display a view as a calendar week. - * - * Available variables: - * - day_names: An array of the day of week names for the table header. - * - rows: The rendered data for this week. - * - * For each day of the week, you have: - * - rows['date'] - the date for this day, formatted as YYYY-MM-DD. - * - rows['datebox'] - the formatted datebox for this day. - * - rows['empty'] - empty text for this day, if no items were found. - * - rows['all_day'] - an array of formatted all day items. - * - rows['items'] - an array of timed items for the day. - * - rows['items'][$time_period]['hour'] - the formatted hour for a time period. - * - rows['items'][$time_period]['ampm'] - the formatted ampm value, if any for a time period. - * - rows['items'][$time_period]['values'] - An array of formatted items for a time period. - * - * @see template_preprocess_calendar_week() - * - * @ingroup themeable - */ -#} -<div class="calendar-calendar"><div class="week-view"> -<table class="full"> - <thead> - <tr> - {% if by_hour_content > 0 or start_times is not empty %} - <th class="calendar-agenda-hour">{% trans %}Time{% endtrans %}</th> - {% endif %} - {% for cell in day_names %} - <th class="{{ cell.class }}" id="{{ cell.header_id }}"> - {{ cell.data }} - </th> - {% endfor %} - </tr> - </thead> - <tbody> - {% for i in 0..multiday_rows %} - {% set row_class = 'all-day' %} - {% if loop.first %}{% set row_class_extra = 'first' %}{% endif %} - {% if loop.last %}{% set row_class_extra = 'last' %}{% endif %} - - <tr class="{{ row_class }} {{ row_class_extra }}"> - {% if loop.index == 0 and (by_hour_count > 0 or start_times is not empty) %} - <td class="{{ agenda_hour_class }}" rowspan="{{ multiday_rows }}"> - <span class="calendar-hour">{% trans with {'context': 'datetime'} %}All day{% endtrans %}</span> - </td> - {% endif %} - - {% set colpos = 0 %} - {% for j in 0..6 %} - {% set cell = all_day[j][i] %} - {% if cell is not empty and cell.filled and cell['wday'] == j %} - {% for k in colpos..cell['wday'] %} - <td class="multi-day no-entry"><div class="inner"> </div></td> - {% endfor %} - <td colspan="{{ cell['colspan'] }}" class="multi-day"> - <div class="inner"> - {{ cell.entry }} - </div> - </td> - {% set colpos = cell['wday'] + cell['colspan'] + 1 %} - {% endif %} - {% endfor %} - - {% for j in colpos..6 %} - <td class="multi-day no-entry"><div class="inner"> </div></td> - {% endfor %} - </tr> - {% endfor %} - {% for time in items %} - <tr class="not-all-day"> - <td class="calendar-agenda-hour"> - <span class="calendar-hour">{{ time.hour }}</span><span class="calendar-ampm">{{ time.ampm }}</span> - </td> - {% set current_position = 0 %} - {% for column in columns %} - {% set column_position = time.values.column[0] ? time.values.column[0].wday : loop.index %} - {% for i in column_position %} - <td class="calendar-agenda-items single-day"> - <div class="calendar"> - <div class="inner"> </div> - </div> - </td> - {% endfor %} - {% set current_position = column_position + 1 %} - <td class="calendar-agenda-items single-day" headers="{{ header_ids[loop.index - 1] }}"> - <div class="calendar"> - <div class="inner"> - {% for item in time.values[column] %} - {{ item.entry }} - {% endfor %} - </div> - </div> - </td> - {% endfor %} - {% if current_position < 7 %} - {% for i in current_position..6 %} - <td class="calendar-agenda-items single-day"> - <div class="calendar"> - <div class="inner"> </div> - </div> - </td> - {% endfor %} - {% endif %} - </tr> - {% endfor %} - </tbody> -</table> -</div></div> diff --git a/web/modules/calendar/templates/calendar-year.html.twig b/web/modules/calendar/templates/calendar-year.html.twig deleted file mode 100644 index 8c79fe4387d7f327d2d29ae1df6c9364d98f5a9e..0000000000000000000000000000000000000000 --- a/web/modules/calendar/templates/calendar-year.html.twig +++ /dev/null @@ -1,25 +0,0 @@ -{# -/** - * @file - * Template to display a view as a calendar year. - * - * @see template_preprocess_calendar_year. - * - * $view: The view. - * $months: An array with a formatted month calendar for each month of the year. - * $min_date_formatted: The minimum date for this calendar in the format YYYY-MM-DD HH:MM:SS. - * $max_date_formatted: The maximum date for this calendar in the format YYYY-MM-DD HH:MM:SS. - * - */ -#} - -<div class="calendar-calendar"><div class="year-view"> -<table {% if mini %} class="mini"{% endif %}> - <tbody> - <tr><td>{{ months[1] }}</td><td>{{ months[2] }}</td><td>{{ months[3] }}</td></tr> - <tr><td>{{ months[4] }}</td><td>{{ months[5] }}</td><td>{{ months[6] }}</td></tr> - <tr><td>{{ months[7] }}</td><td>{{ months[8] }}</td><td>{{ months[9] }}</td></tr> - <tr><td>{{ months[10] }}</td><td>{{ months[11] }}</td><td>{{ months[12] }}</td></tr> - </tbody> -</table> -</div></div> \ No newline at end of file diff --git a/web/modules/calendar/views_templates/calendar_base_field.yml b/web/modules/calendar/views_templates/calendar_base_field.yml deleted file mode 100644 index 40a45a0a0d4d612dbe9afdc35f7846ceda3a12d5..0000000000000000000000000000000000000000 --- a/web/modules/calendar/views_templates/calendar_base_field.yml +++ /dev/null @@ -1,661 +0,0 @@ -langcode: en -status: true -id: calendar_field -label: '__ENTITY_LABEL __FIELD_LABEL Calendar' -module: views -description: 'A calendar view of the ''__FIELD_LABEL'' field in the ''__ENTITY_LABEL'' base table' -tag: '' -base_table: __BASE_TABLE -base_field: __BASE_FIELD -core: 8.x -display: - default: - display_plugin: default - id: default - display_title: Master - position: 0 - display_options: - access: - type: perm - options: - perm: 'access content' - cache: - type: tag - options: { } - query: - type: views_query - options: - disable_sql_rewrite: false - distinct: false - replica: false - query_comment: '' - query_tags: { } - exposed_form: - type: basic - options: - submit_button: Apply - reset_button: false - reset_button_label: Reset - exposed_sorts_label: 'Sort by' - expose_sort_order: true - sort_asc_label: Asc - sort_desc_label: Desc - pager: - type: calendar - options: - pager_placement: top - style: - type: calendar - options: - calendar_type: month - mini: '0' - name_size: '3' - with_weekno: '0' - max_items: '0' - max_items_behavior: more - groupby_times: hour - groupby_times_custom: null - theme_style: '1' - groupby_field: '' - multiday_theme: '1' - multiday_hidden: { } - row: - type: calendar_row - options: - colors: - legend: type - calendar_colors_type: - article: '#ffffff' - page: '#ffffff' - taxonomy_field: '' - calendar_colors_vocabulary: { } - fields: - __FIELD_ID: - id: __FIELD_ID - table: __BASE_TABLE - field: __FIELD_ID - entity_type: __ENTITY_TYPE - entity_field: __FIELD_ID - label: '' - alter: - alter_text: false - make_link: false - absolute: false - trim: false - word_boundary: false - ellipsis: false - strip_tags: false - html: false - hide_empty: false - empty_zero: false - settings: - link_to_entity: true - plugin_id: field - relationship: none - group_type: group - admin_label: '' - exclude: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: true - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_alter_empty: true - click_sort_column: value - type: string - group_column: value - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - __DEFAULT_FIELD_ID: - id: __DEFAULT_FIELD_ID - table: __BASE_TABLE - field: __DEFAULT_FIELD_ID - relationship: none - group_type: group - admin_label: '' - label: '' - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: value - group_column: value - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - entity_type: __ENTITY_TYPE - entity_field: __DEFAULT_FIELD_ID - plugin_id: field - filters: - status: - value: true - table: __BASE_TABLE - field: status - plugin_id: boolean - entity_type: __ENTITY_TYPE - entity_field: status - id: status - expose: - operator: '' - group: 1 - sorts: - __FIELD_ID: - id: __FIELD_ID - table: __BASE_TABLE - field: __FIELD_ID - relationship: none - group_type: group - admin_label: '' - order: ASC - exposed: false - expose: - label: '' - granularity: second - entity_type: __ENTITY_TYPE - entity_field: __FIELD_ID - plugin_id: date - header: { } - footer: { } - empty: { } - relationships: { } - arguments: { } - display_extenders: { } - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - - 'user.node_grants:view' - - user.permissions - tags: { } - page_month: - display_plugin: page - id: page_month - display_title: Month - position: 1 - display_options: - display_extenders: { } - path: __BASE_PATH/month - display_description: '' - menu: - type: tab - title: Month - description: '' - expanded: false - parent: '' - weight: 0 - context: '0' - menu_name: main - tab_options: - type: normal - title: Calendar - description: '' - weight: 0 - header: - calendar_header_1: - id: calendar_header_1 - table: views - field: calendar_header - relationship: none - group_type: group - admin_label: '' - empty: true - tokenize: 1 - content: '{{ arguments.__FIELD_ID_year_month }}' - pager_embed: 0 - plugin_id: calendar_header - calendar_header: - id: calendar_header - table: views - field: calendar_header - relationship: none - group_type: group - admin_label: 'Calendar Pager' - empty: true - tokenize: 1 - content: '' - pager_embed: 1 - plugin_id: calendar_header - arguments: - __FIELD_ID_year_month: - id: __FIELD_ID_year_month - table: __BASE_TABLE - field: __FIELD_ID_year_month - relationship: none - group_type: group - admin_label: '' - default_action: default - exception: - value: all - title_enable: false - title: All - title_enable: false - title: '' - default_argument_type: date - default_argument_options: { } - default_argument_skip_url: false - summary_options: - base_path: '' - count: true - items_per_page: 25 - override: false - summary: - sort_order: asc - number_of_records: 0 - format: default_summary - specify_validation: true - validate: - type: calendar - fail: 'not found' - validate_options: - replacement_format: 'F Y' - entity_type: __ENTITY_TYPE - plugin_id: date_year_month - defaults: - arguments: false - header: false - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - - 'user.node_grants:view' - - user.permissions - tags: { } - page_week: - display_plugin: page - id: page_week - display_title: Week - position: 2 - display_options: - display_extenders: { } - display_description: '' - style: - type: calendar - options: - calendar_type: week - mini: '0' - name_size: '3' - with_weekno: '0' - max_items: '0' - max_items_behavior: more - groupby_times: hour - groupby_times_custom: null - theme_style: '1' - groupby_field: '' - multiday_theme: '1' - multiday_hidden: { } - defaults: - style: false - row: false - arguments: false - header: false - row: - type: calendar_row - options: - colors: - legend: type - calendar_colors_type: - article: '#ffffff' - page: '#ffffff' - taxonomy_field: '' - calendar_colors_vocabulary: { } - path: __BASE_PATH/week - menu: - type: tab - title: Week - description: '' - expanded: false - parent: '' - weight: 0 - context: '0' - menu_name: main - header: - calendar_header_1: - id: calendar_header_1 - table: views - field: calendar_header - relationship: none - group_type: group - admin_label: '' - empty: true - tokenize: 1 - content: 'Week of {{ arguments.__FIELD_ID_year_week }}' - pager_embed: 0 - plugin_id: calendar_header - calendar_header: - id: calendar_header - table: views - field: calendar_header - relationship: none - group_type: group - admin_label: 'Calendar Pager' - empty: true - tokenize: 1 - content: '' - pager_embed: 1 - plugin_id: calendar_header - arguments: - __FIELD_ID_year_week: - id: __FIELD_ID_year_week - table: __BASE_TABLE - field: __FIELD_ID_year_week - relationship: none - group_type: group - admin_label: '' - default_action: default - exception: - value: all - title_enable: false - title: All - title_enable: false - title: '' - default_argument_type: date - default_argument_options: { } - default_argument_skip_url: false - summary_options: - base_path: '' - count: true - items_per_page: 25 - override: false - summary: - sort_order: asc - number_of_records: 0 - format: default_summary - specify_validation: true - validate: - type: calendar - fail: 'not found' - validate_options: - replacement_format: 'F j, Y' - entity_type: __ENTITY_TYPE - plugin_id: date_year_week - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - - 'user.node_grants:view' - - user.permissions - tags: { } - page_day: - display_plugin: page - id: page_day - display_title: Day - position: 3 - display_options: - display_extenders: { } - display_description: '' - style: - type: calendar - options: - calendar_type: day - mini: '0' - name_size: '3' - with_weekno: '0' - max_items: '0' - max_items_behavior: more - groupby_times: hour - groupby_times_custom: null - theme_style: '1' - groupby_field: '' - multiday_theme: '1' - multiday_hidden: { } - defaults: - style: false - row: false - arguments: false - header: false - row: - type: calendar_row - options: - colors: - legend: type - calendar_colors_type: - article: '#ffffff' - page: '#ffffff' - taxonomy_field: '' - calendar_colors_vocabulary: { } - path: __BASE_PATH/day - menu: - type: tab - title: Day - description: '' - expanded: false - parent: '' - weight: 0 - context: '0' - menu_name: main - header: - calendar_header_1: - id: calendar_header_1 - table: views - field: calendar_header - relationship: none - group_type: group - admin_label: '' - empty: true - tokenize: 1 - content: '{{ arguments.__FIELD_ID__fulldate }}' - pager_embed: 0 - plugin_id: calendar_header - calendar_header: - id: calendar_header - table: views - field: calendar_header - relationship: none - group_type: group - admin_label: 'Calendar Pager' - empty: true - tokenize: 1 - content: '' - pager_embed: 1 - plugin_id: calendar_header - arguments: - __FIELD_ID__fulldate: - id: __FIELD_ID_fulldate - table: __BASE_TABLE - field: __FIELD_ID_fulldate - relationship: none - group_type: group - admin_label: '' - default_action: default - exception: - value: all - title_enable: false - title: All - title_enable: false - title: '' - default_argument_type: date - default_argument_options: { } - default_argument_skip_url: false - summary_options: - base_path: '' - count: true - items_per_page: 25 - override: false - summary: - sort_order: asc - number_of_records: 0 - format: default_summary - specify_validation: true - validate: - type: calendar - fail: 'not found' - validate_options: - replacement_format: 'l, F j, Y' - entity_type: __ENTITY_TYPE - plugin_id: date_fulldate - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - - 'user.node_grants:view' - - user.permissions - tags: { } - page_year: - display_plugin: page - id: page_year - display_title: Year - position: 4 - display_options: - display_extenders: { } - display_description: '' - style: - type: calendar - options: - calendar_type: year - mini: '0' - name_size: '3' - with_weekno: '0' - max_items: '0' - max_items_behavior: more - groupby_times: hour - groupby_times_custom: null - theme_style: '1' - groupby_field: '' - multiday_theme: '1' - multiday_hidden: { } - defaults: - style: false - row: false - arguments: false - header: false - row: - type: calendar_row - options: - colors: - legend: type - calendar_colors_type: - article: '#ffffff' - page: '#ffffff' - taxonomy_field: '' - calendar_colors_vocabulary: { } - header: - calendar_header_1: - id: calendar_header_1 - table: views - field: calendar_header - relationship: none - group_type: group - admin_label: '' - empty: true - tokenize: 1 - content: '{{ arguments.__FIELD_ID_year }}' - pager_embed: 0 - plugin_id: calendar_header - calendar_header: - id: calendar_header - table: views - field: calendar_header - relationship: none - group_type: group - admin_label: 'Calendar Pager' - empty: true - tokenize: 1 - content: '' - pager_embed: 1 - plugin_id: calendar_header - arguments: - __FIELD_ID_year: - id: __FIELD_ID_year - table: __BASE_TABLE - field: __FIELD_ID_year - relationship: none - group_type: group - admin_label: '' - default_action: default - exception: - value: all - title_enable: false - title: All - title_enable: false - title: '' - default_argument_type: date - default_argument_options: { } - default_argument_skip_url: false - summary_options: - base_path: '' - count: true - items_per_page: 25 - override: false - summary: - sort_order: asc - number_of_records: 0 - format: default_summary - specify_validation: true - validate: - type: calendar - fail: 'not found' - validate_options: - replacement_format: 'Y' - entity_type: __ENTITY_TYPE - plugin_id: date_year - path: __BASE_PATH/year - menu: - type: tab - title: Year - description: '' - expanded: false - parent: '' - weight: 0 - context: '0' - menu_name: main diff --git a/web/modules/calendar/views_templates/calendar_config_field.yml b/web/modules/calendar/views_templates/calendar_config_field.yml deleted file mode 100644 index 5d773170098cad0f5c002176e97314a5f7a502a5..0000000000000000000000000000000000000000 --- a/web/modules/calendar/views_templates/calendar_config_field.yml +++ /dev/null @@ -1,686 +0,0 @@ -langcode: en -status: true -id: content___FIELD_ID_on_calendar -label: '__ENTITY_LABEL Field __FIELD_LABEL on Calendar' -module: views -description: 'A calendar view of the ''__FIELD_LABEL'' field in the ''__ENTITY_LABEL'' base table' -tag: '' -base_table: __BASE_TABLE -base_field: __BASE_FIELD -core: 8.x -display: - default: - display_plugin: default - id: default - display_title: Master - position: 0 - display_options: - access: - type: perm - options: - perm: 'access content' - cache: - type: tag - options: { } - query: - type: views_query - options: - disable_sql_rewrite: false - distinct: false - replica: false - query_comment: '' - query_tags: { } - exposed_form: - type: basic - options: - submit_button: Apply - reset_button: false - reset_button_label: Reset - exposed_sorts_label: 'Sort by' - expose_sort_order: true - sort_asc_label: Asc - sort_desc_label: Desc - pager: - type: calendar - options: - pager_placement: top - style: - type: calendar - options: - calendar_type: month - mini: '0' - name_size: '3' - with_weekno: '0' - max_items: '0' - max_items_behavior: more - groupby_times: hour - groupby_times_custom: null - theme_style: '1' - groupby_field: '' - multiday_theme: '1' - multiday_hidden: { } - row: - type: calendar_row - options: - colors: - legend: type - calendar_colors_type: - article: '#ffffff' - page: '#ffffff' - taxonomy_field: '' - calendar_colors_vocabulary: { } - fields: - __DEFAULT_FIELD_ID: - id: __DEFAULT_FIELD_ID - table: __BASE_TABLE - field: __DEFAULT_FIELD_ID - relationship: none - group_type: group - admin_label: '' - label: '' - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: value - group_column: value - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - entity_type: __ENTITY_TYPE - entity_field: created - plugin_id: field - __FIELD_ID: - id: __FIELD_ID - table: __FIELD_TABLE - field: __FIELD_ID - relationship: none - group_type: group - admin_label: '' - label: '' - exclude: false - alter: - alter_text: false - text: '' - make_link: false - path: '' - absolute: false - external: false - replace_spaces: false - path_case: none - trim_whitespace: false - alt: '' - rel: '' - link_class: '' - prefix: '' - suffix: '' - target: '' - nl2br: false - max_length: 0 - word_boundary: true - ellipsis: true - more_link: false - more_link_text: '' - more_link_path: '' - strip_tags: false - trim: false - preserve_tags: '' - html: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: false - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_empty: false - empty_zero: false - hide_alter_empty: true - click_sort_column: value - type: datetime_default - settings: - timezone_override: '' - format_type: medium - group_column: value - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - plugin_id: field - filters: - status: - value: true - table: __BASE_TABLE - field: status - plugin_id: boolean - entity_type: __ENTITY_TYPE - entity_field: status - id: status - expose: - operator: '' - group: 1 - sorts: - __FIELD_ID_value: - id: __FIELD_ID_value - table: __FIELD_TABLE - field: __FIELD_ID_value - relationship: none - group_type: group - admin_label: '' - order: ASC - exposed: false - expose: - label: '' - granularity: second - plugin_id: datetime - header: { } - footer: { } - empty: { } - relationships: { } - arguments: { } - display_extenders: { } - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - - 'user.node_grants:view' - - user.permissions - tags: - - 'config:field.storage.__ENTITY_TYPE.__FIELD_ID' - page_month: - display_plugin: page - id: page_month - display_title: Month - position: 1 - display_options: - display_extenders: { } - path: __BASE_PATH/month - display_description: '' - menu: - type: tab - title: Month - description: '' - expanded: false - parent: '' - weight: 0 - context: '0' - menu_name: main - tab_options: - type: normal - title: Calendar - description: '' - weight: 0 - arguments: - __FIELD_ID_value_year_month: - id: __FIELD_ID_value_year_month - table: __FIELD_TABLE - field: __FIELD_ID_value_year_month - relationship: none - group_type: group - admin_label: '' - default_action: default - exception: - value: all - title_enable: false - title: All - title_enable: false - title: '' - default_argument_type: date - default_argument_options: { } - default_argument_skip_url: false - summary_options: - base_path: '' - count: true - items_per_page: 25 - override: false - summary: - sort_order: asc - number_of_records: 0 - format: default_summary - specify_validation: true - validate: - type: calendar - fail: 'not found' - validate_options: - replacement_format: 'F Y' - plugin_id: datetime_year_month - header: - calendar_header: - id: calendar_header - table: views - field: calendar_header - relationship: none - group_type: group - admin_label: '' - empty: true - tokenize: 1 - content: '{{ arguments.__FIELD_ID_value_year_month }}' - pager_embed: 0 - plugin_id: calendar_header - calendar_header_1: - id: calendar_header_1 - table: views - field: calendar_header - relationship: none - group_type: group - admin_label: 'Calendar Pager' - empty: true - tokenize: 1 - content: '' - pager_embed: 1 - plugin_id: calendar_header - defaults: - arguments: false - header: false - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - - 'user.node_grants:view' - - user.permissions - tags: - - 'config:field.storage.__ENTITY_TYPE.__FIELD_ID' - page_week: - display_plugin: page - id: page_week - display_title: Week - position: 2 - display_options: - display_extenders: { } - display_description: '' - style: - type: calendar - options: - calendar_type: week - mini: '0' - name_size: '3' - with_weekno: '0' - max_items: '0' - max_items_behavior: more - groupby_times: hour - groupby_times_custom: null - theme_style: '1' - groupby_field: '' - multiday_theme: '1' - multiday_hidden: { } - defaults: - style: false - row: false - arguments: false - header: false - row: - type: calendar_row - options: - colors: - legend: type - calendar_colors_type: - article: '#ffffff' - page: '#ffffff' - taxonomy_field: '' - calendar_colors_vocabulary: { } - path: __BASE_PATH/week - menu: - type: tab - title: Week - description: '' - expanded: false - parent: '' - weight: 0 - context: '0' - menu_name: main - arguments: - __FIELD_ID_value_year_week: - id: __FIELD_ID_value_year_week - table: __FIELD_TABLE - field: __FIELD_ID_value_year_week - relationship: none - group_type: group - admin_label: '' - default_action: default - exception: - value: all - title_enable: false - title: All - title_enable: false - title: '' - default_argument_type: date - default_argument_options: { } - default_argument_skip_url: false - summary_options: - base_path: '' - count: true - items_per_page: 25 - override: false - summary: - sort_order: asc - number_of_records: 0 - format: default_summary - specify_validation: true - validate: - type: calendar - fail: 'not found' - validate_options: - replacement_format: 'F j, Y' - plugin_id: datetime_year_week - header: - calendar_header: - id: calendar_header - table: views - field: calendar_header - relationship: none - group_type: group - admin_label: '' - empty: true - tokenize: 1 - content: 'Week of {{ arguments.__FIELD_ID_value_year_week }}' - pager_embed: 0 - plugin_id: calendar_header - calendar_header_1: - id: calendar_header_1 - table: views - field: calendar_header - relationship: none - group_type: group - admin_label: 'Calendar Pager' - empty: true - tokenize: 1 - content: '' - pager_embed: 1 - plugin_id: calendar_header - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - - 'user.node_grants:view' - - user.permissions - tags: - - 'config:field.storage.__ENTITY_TYPE.__FIELD_ID' - page_day: - display_plugin: page - id: page_day - display_title: Day - position: 3 - display_options: - display_extenders: { } - display_description: '' - style: - type: calendar - options: - calendar_type: day - mini: '0' - name_size: '3' - with_weekno: '0' - max_items: '0' - max_items_behavior: more - groupby_times: hour - groupby_times_custom: null - theme_style: '1' - groupby_field: '' - multiday_theme: '1' - multiday_hidden: { } - defaults: - style: false - row: false - arguments: false - header: false - row: - type: calendar_row - options: - colors: - legend: type - calendar_colors_type: - article: '#ffffff' - page: '#ffffff' - taxonomy_field: '' - calendar_colors_vocabulary: { } - path: __BASE_PATH/day - menu: - type: tab - title: Day - description: '' - expanded: false - parent: '' - weight: 0 - context: '0' - menu_name: main - arguments: - __FIELD_ID_value_full_date: - id: __FIELD_ID_value_full_date - table: __FIELD_TABLE - field: __FIELD_ID_value_full_date - relationship: none - group_type: group - admin_label: '' - default_action: default - exception: - value: all - title_enable: false - title: All - title_enable: false - title: '' - default_argument_type: date - default_argument_options: { } - default_argument_skip_url: false - summary_options: - base_path: '' - count: true - items_per_page: 25 - override: false - summary: - sort_order: asc - number_of_records: 0 - format: default_summary - specify_validation: true - validate: - type: calendar - fail: 'not found' - validate_options: - replacement_format: 'l, F j, Y' - plugin_id: datetime_full_date - header: - calendar_header: - id: calendar_header - table: views - field: calendar_header - relationship: none - group_type: group - admin_label: '' - empty: true - tokenize: 1 - content: '{{ arguments.__FIELD_ID_value_full_date }}' - pager_embed: 0 - plugin_id: calendar_header - calendar_header_1: - id: calendar_header_1 - table: views - field: calendar_header - relationship: none - group_type: group - admin_label: 'Calendar Pager' - empty: true - tokenize: 1 - content: '' - pager_embed: 1 - plugin_id: calendar_header - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - - 'user.node_grants:view' - - user.permissions - tags: - - 'config:field.storage.__ENTITY_TYPE.__FIELD_ID' - page_year: - display_plugin: page - id: page_year - display_title: Year - position: 4 - display_options: - display_extenders: { } - display_description: '' - style: - type: calendar - options: - calendar_type: year - mini: '0' - name_size: '3' - with_weekno: '0' - max_items: '0' - max_items_behavior: more - groupby_times: hour - groupby_times_custom: null - theme_style: '1' - groupby_field: '' - multiday_theme: '1' - multiday_hidden: { } - defaults: - style: false - row: false - arguments: false - header: false - row: - type: calendar_row - options: - colors: - legend: type - calendar_colors_type: - article: '#ffffff' - page: '#ffffff' - taxonomy_field: '' - calendar_colors_vocabulary: { } - arguments: - __FIELD_ID_value_year: - id: __FIELD_ID_value_year - table: __FIELD_TABLE - field: __FIELD_ID_value_year - relationship: none - group_type: group - admin_label: '' - default_action: default - exception: - value: all - title_enable: false - title: All - title_enable: false - title: '' - default_argument_type: date - default_argument_options: { } - default_argument_skip_url: false - summary_options: - base_path: '' - count: true - items_per_page: 25 - override: false - summary: - sort_order: asc - number_of_records: 0 - format: default_summary - specify_validation: true - validate: - type: calendar - fail: 'not found' - validate_options: - replacement_format: 'Y' - plugin_id: datetime_year - header: - calendar_header: - id: calendar_header - table: views - field: calendar_header - relationship: none - group_type: group - admin_label: '' - empty: true - tokenize: 1 - content: '{{ arguments.__FIELD_ID_value_year }}' - pager_embed: 0 - plugin_id: calendar_header - calendar_header_1: - id: calendar_header_1 - table: views - field: calendar_header - relationship: none - group_type: group - admin_label: 'Calendar Pager' - empty: true - tokenize: 1 - content: '' - pager_embed: 1 - plugin_id: calendar_header - path: __BASE_PATH/year - menu: - type: tab - title: Year - description: '' - expanded: false - parent: '' - weight: 0 - context: '0' - menu_name: main - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url - - 'user.node_grants:view' - - user.permissions - tags: - - 'config:field.storage.__ENTITY_TYPE.__FIELD_ID' diff --git a/web/modules/views_templates/LICENSE.txt b/web/modules/views_templates/LICENSE.txt deleted file mode 100644 index d159169d1050894d3ea3b98e1c965c4058208fe1..0000000000000000000000000000000000000000 --- a/web/modules/views_templates/LICENSE.txt +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/web/modules/views_templates/README.md b/web/modules/views_templates/README.md deleted file mode 100644 index 3ffa38a25d39a90ea910aa2fef107d21817ccffc..0000000000000000000000000000000000000000 --- a/web/modules/views_templates/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Views Template 8.x - -## Use - -This module is intended to be used by other modules to offer Views templates. -Modules can implement ViewsTemplateBuilder plugins to provide Views templates - -## Plugin in base classes - -### ViewsBuilderBase -Extend this class to make View template pragmatically - -### ViewsDuplicateBuilderBase -Extend this class to make a View Template from a *.yml Views Template file. - -Views Templates should put in the 'views_templates' in the root directory of the module. - diff --git a/web/modules/views_templates/src/Annotation/ViewsBuilder.php b/web/modules/views_templates/src/Annotation/ViewsBuilder.php deleted file mode 100644 index 0a9f5af57c93079c01908a706038cb32f0b836d2..0000000000000000000000000000000000000000 --- a/web/modules/views_templates/src/Annotation/ViewsBuilder.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php -/** - * @file - * Contains \Drupal\views_templates\Annotation\ViewsBuilder. - */ - - -namespace Drupal\views_templates\Annotation; - - -use Drupal\Component\Annotation\Plugin; - -/** - * Defines a ViewsBuilder annotation object. - * - * @todo For some reason this not getting picked up by the manager. - * - * @Annotation - */ -class ViewsBuilder extends Plugin { - - /** - * The plugin ID. - * - * @var string - */ - public $id; - - /** - * Description for list page - * - * @var string - * - * @ingroup plugin_translatable - */ - public $description = ''; - - /** - * The administrative label of the View Builder. - * - * @var \Drupal\Core\Annotation\Translation - * - * @ingroup plugin_translatable - */ - public $admin_label = ''; - - /** - * Class used to retrieve derivative definitions of the Views Builder. - * - * @var string - */ - public $derivative = ''; - - /** - * Base table of View. - * - * @var string - */ - public $base_table; - - /** - * The module that provides the template. - * - * @var string - */ - public $module; - - /** - * Keys and values to replaced in the Views Template. - * - * @var array - */ - public $replace_values; - - /** - * Id of Views template. - * - * @var string - */ - public $view_template_id; - -} diff --git a/web/modules/views_templates/src/Controller/ViewsBuilderController.php b/web/modules/views_templates/src/Controller/ViewsBuilderController.php deleted file mode 100644 index f60d0f129f5dab1424d27d854d797a1c1de7201f..0000000000000000000000000000000000000000 --- a/web/modules/views_templates/src/Controller/ViewsBuilderController.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php -/** - * @file - * Contains \Drupal\views_templates\Controller\ViewsBuilderController. - */ - - -namespace Drupal\views_templates\Controller; - - -use Drupal\Component\Plugin\PluginManagerInterface; -use Drupal\Core\Controller\ControllerBase; -use Drupal\Core\Url; -use Symfony\Component\DependencyInjection\ContainerInterface; - -class ViewsBuilderController extends ControllerBase { - - /** - * @var \Drupal\Component\Plugin\PluginManagerInterface - */ - protected $builder_manager; - - /** - * Constructs a new \Drupal\views_templates\Controller\ViewsBuilderController - * object. - * - * @param \Drupal\Component\Plugin\PluginManagerInterface - * The Views Builder Plugin Interface. - */ - public function __construct(PluginManagerInterface $builder_manager) { - $this->builder_manager = $builder_manager; - } - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container) { - return new static( - $container->get('plugin.manager.views_templates.builder') - ); - } - - /** - * Create template list table. - * - * @return array - * Render array of template list. - */ - public function templateList() { - $table = array( - '#type' => 'table', - '#header' => array( - $this->t('Name'), - $this->t('Description'), - $this->t('Add'), - ), - '#empty' => $this->t('There are no available Views Templates'), - ); - - /** @var \Drupal\views_templates\Plugin\ViewsBuilderPluginInterface $definition */ - foreach ($this->builder_manager->getDefinitions() as $definition) { - - /** @var \Drupal\views_templates\Plugin\ViewsBuilderPluginInterface $builder */ - $builder = $this->builder_manager->createInstance($definition['id']); - if ($builder->templateExists()) { - $plugin_id = $builder->getPluginId(); - $row = [ - 'name' => ['#plain_text' => $builder->getAdminLabel()], - 'description' => ['#plain_text' => $builder->getDescription()], - 'add' => [ - '#type' => 'link', - '#title' => t('Add'), - '#url' => Url::fromRoute('views_templates.create_from_template', - [ - 'view_template' => $plugin_id, - ] - ), - ], - ]; - $table[$plugin_id] = $row; - } - } - - return $table; - } -} diff --git a/web/modules/views_templates/src/Plugin/ViewsBuilderBase.php b/web/modules/views_templates/src/Plugin/ViewsBuilderBase.php deleted file mode 100644 index b748f60a928ffecc71ac8c8c077b5759646fdcd1..0000000000000000000000000000000000000000 --- a/web/modules/views_templates/src/Plugin/ViewsBuilderBase.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php - -/** - * @file - * Contains - * \Drupal\views_templates\Plugin\ViewsTemplateBuilder\ViewsBuilderBase. - */ - -namespace Drupal\views_templates\Plugin; - -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Plugin\PluginBase; -use Drupal\views\Entity\View; - -/** - * Base builder for View Templates - * - * This class get Views information for Plugin definition. - * Extending classes can use derivatives to make many plugins. - */ -abstract class ViewsBuilderBase extends PluginBase implements ViewsBuilderPluginInterface { - /** - * {@inheritdoc} - */ - public function getBaseTable() { - return $this->getDefinitionValue('base_table'); - } - - /** - * {@inheritdoc} - */ - public function getAdminLabel() { - return $this->getDefinitionValue('admin_label'); - } - - /** - * {@inheritdoc} - */ - public function getDescription() { - return $this->getDefinitionValue('description'); - } - - /** - * {@inheritdoc} - */ - public function getDefinitionValue($key) { - $def = $this->getPluginDefinition(); - if (isset($def[$key])) { - return $def[$key]; - } - return NULL; - } - - /** - * {@inheritdoc} - */ - public function createView($options = NULL) { - - $view_values = [ - 'id' => $options['id'], - 'label' => $options['label'], - 'description' => $options['description'], - 'base_table' => $this->getBaseTable(), - ]; - return View::create($view_values); - } - - /** - * {@inheritdoc} - */ - public function buildConfigurationForm($form, FormStateInterface $form_state) { - return []; - } - - /** - * {@inheritdoc} - */ - public function templateExists() { - return TRUE; - } - - -} diff --git a/web/modules/views_templates/src/Plugin/ViewsBuilderPluginInterface.php b/web/modules/views_templates/src/Plugin/ViewsBuilderPluginInterface.php deleted file mode 100644 index 21a91cd94bc8c7ef1659471a570b1e287b02f25d..0000000000000000000000000000000000000000 --- a/web/modules/views_templates/src/Plugin/ViewsBuilderPluginInterface.php +++ /dev/null @@ -1,76 +0,0 @@ -<?php -/** - * @file - * Contains \Drupal\views_templates\Plugin\ViewsBuilderPluginInterface. - */ - - -namespace Drupal\views_templates\Plugin; - - -use Drupal\Component\Plugin\PluginInspectionInterface; -use Drupal\Core\Form\FormStateInterface; - -/** - * Creates a common interface for Views Builder classes. - */ -interface ViewsBuilderPluginInterface extends PluginInspectionInterface { - - /** - * Returns base table id. - * - * @return string - */ - public function getBaseTable(); - - /** - * Get template description. - * - * @return string - */ - public function getDescription(); - - - /** - * Get template admin label. - * - * @return string - */ - public function getAdminLabel(); - - /** - * Get a value from the plugin definition. - * - * @param $key - * - * @return mixed - */ - public function getDefinitionValue($key); - - /** - * Create a View. Don't save it. - * - * @param null $options - * - * @return \Drupal\views\ViewEntityInterface - */ - public function createView($options = NULL); - - /** - * Return form elements of extra configuration when adding View from template. - * - * @param $form - * @param \Drupal\Core\Form\FormStateInterface $form_state - * - * @return mixed - */ - public function buildConfigurationForm($form, FormStateInterface $form_state); - - /** - * Determine if a template exists. - * - * @return boolean - */ - public function templateExists(); - -} diff --git a/web/modules/views_templates/src/Plugin/ViewsBuilderPluginManager.php b/web/modules/views_templates/src/Plugin/ViewsBuilderPluginManager.php deleted file mode 100644 index ef2b9f0ddfa2bf8ba353b4ea5beee067200c297e..0000000000000000000000000000000000000000 --- a/web/modules/views_templates/src/Plugin/ViewsBuilderPluginManager.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -/** - * @file - * Contains \Drupal\views_templates\Plugin\ViewsBuilderPluginManager. - */ - -namespace Drupal\views_templates\Plugin; - -use Drupal\Core\Cache\CacheBackendInterface; -use Drupal\Core\Extension\ModuleHandlerInterface; -use Drupal\Core\Plugin\DefaultPluginManager; - -/** - * Class ViewsTemplateBuilderPluginManager. - * - * @package Drupal\views_templates\Plugin - */ -class ViewsBuilderPluginManager extends DefaultPluginManager { - - /** - * Constructs an ViewsTemplateBuilderPluginManager object. - * - * @param \Traversable $namespaces - * An object that implements \Traversable which contains the root paths - * keyed by the corresponding namespace to look for plugin implementations. - * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend - * Cache backend instance to use. - * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler - * The module handler to invoke the alter hook with. - */ - public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) { - parent::__construct('Plugin/ViewsTemplateBuilder', $namespaces, $module_handler, 'Drupal\views_templates\Plugin\ViewsBuilderPluginInterface', 'Drupal\views_templates\Annotation\ViewsBuilder'); - $this->alterInfo('views_template_builder_info'); - $this->setCacheBackend($cache_backend, 'views_template_builder'); - } - -} diff --git a/web/modules/views_templates/src/Plugin/ViewsDuplicateBuilderBase.php b/web/modules/views_templates/src/Plugin/ViewsDuplicateBuilderBase.php deleted file mode 100644 index 72bce5b9904e756c2d315023b5960846ad27fc4d..0000000000000000000000000000000000000000 --- a/web/modules/views_templates/src/Plugin/ViewsDuplicateBuilderBase.php +++ /dev/null @@ -1,214 +0,0 @@ -<?php -/** - * @file - * Contains \Drupal\views_templates\Plugin\ViewsDuplicateBuilder. - */ - - -namespace Drupal\views_templates\Plugin; - - -use Drupal\Core\Form\FormStateInterface; -use Drupal\Core\Plugin\ContainerFactoryPluginInterface; -use Drupal\views\Entity\View; -use Drupal\views_templates\ViewsTemplateLoaderInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; - -abstract class ViewsDuplicateBuilderBase extends ViewsBuilderBase implements ViewsDuplicateBuilderPluginInterface, ContainerFactoryPluginInterface { - - /** @var \Drupal\views_templates\ViewsTemplateLoaderInterface $template_loader */ - protected $template_loader; - - protected $loaded_template; - - public function __construct(array $configuration, $plugin_id, $plugin_definition, ViewsTemplateLoaderInterface $loader) { - parent::__construct($configuration, $plugin_id, $plugin_definition); - $this->template_loader = $loader; - - } - - - /** - * {@inheritdoc} - */ - public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) { - return new static( - $configuration, - $plugin_id, - $plugin_definition, - $container->get('views_templates.loader') - ); - } - - /** - * {@inheritdoc} - */ - public function createView($options = NULL) { - if ($view_template = $this->loadTemplate($options)) { - $view_template['id'] = $options['id']; - $view_template['label'] = $options['label']; - $view_template['description'] = $options['description']; - return View::create($view_template); - } - return NULL; - - } - - - /** - * {@inheritdoc} - */ - public function getViewTemplateId() { - return $this->getDefinitionValue('view_template_id'); - } - - /** - * {@inheritdoc} - */ - public function buildConfigurationForm($form, FormStateInterface $form_state) { - return []; - } - - /** - * {@inheritdoc} - */ - public function getAdminLabel() { - return $this->loadViewsTemplateValue('label'); - } - - /** - * {@inheritdoc} - */ - public function getDescription() { - return $this->loadViewsTemplateValue('description'); - } - - /** - * Return value from template. - * - * @param $key - * - * @param null $options - * - * @return mixed|null - */ - protected function loadViewsTemplateValue($key, $options = NULL) { - $view_template = $this->loadTemplate($options); - if (isset($view_template[$key])) { - return $view_template[$key]; - } - return NULL; - } - - /** - * Load template from service. - * - * @param $options - * - * @return object - */ - protected function loadTemplate($options) { - if (empty($this->loaded_template)) { - try { - $template = $this->template_loader->load($this); - } catch (FileNotFoundException $e) { - watchdog_exception('views_templates', $e, $e->getMessage()); - return NULL; - } - - $this->alterViewTemplateAfterCreation($template, $options); - $this->loaded_template = $template; - } - - return $this->loaded_template; - } - - /** - * After View Template has been created the Builder should alter it some how. - * - * @param array $view_template - * - * @param array $options - * Options for altering - */ - protected function alterViewTemplateAfterCreation(array &$view_template, $options = NULL) { - if ($replacements = $this->getReplacements($options)) { - $this->replaceTemplateKeyAndValues($view_template, $replacements, $options); - } - } - - /** - * Get the replaces array from the plugin definition. - * - * The keys will be converted to work with yml files. - * - * @param $options - * - * @return array - */ - protected function getReplacements($options) { - if ($replacements = $this->getDefinitionValue('replacements')) { - $converted_replacements = []; - foreach ($replacements as $key => $value) { - $new_key = '__' . strtoupper($key); - $converted_replacements[$new_key] = $value; - } - return $converted_replacements; - } - return []; - } - - /** - * Recursively replace keys and values in template elements. - * - * For example of builder and yml template: - * - * @see Drupal\views_templates_builder_test\Plugin\ViewsTemplateBuilder - * - * @param array $template_elements - * Array of elements from a View Template array - * @param array $replace_values - * The values in that should be replaced in the template. - * The keys in this array can be keys OR values template array. - * This allows replacing both keys and values in the template. - * @param null $options - */ - protected function replaceTemplateKeyAndValues(array &$template_elements, array $replace_values, $options = NULL) { - foreach ($template_elements as $key => &$value) { - if (is_array($value)) { - $this->replaceTemplateKeyAndValues($value, $replace_values, $options); - } - foreach ($replace_values as $replace_key => $replace_value) { - if (!is_array($value)) { - if (is_string($value)) { - if (stripos($value, $replace_key) !== FALSE) { - $value = str_replace($replace_key, $replace_value, $value); - } - } - elseif ($replace_key === $value) { - $value = $replace_value; - } - } - if (stripos($key, $replace_key) !== FALSE) { - $new_key = str_replace($replace_key, $replace_value, $key); - // NULL is used in replace value to remove keys from template. - if ($replace_value !== NULL) { - $template_elements[$new_key] = $value; - } - unset($template_elements[$key]); - } - } - } - } - - /** - * Check if template exists - * - * @return bool - */ - public function templateExists() { - return $this->loadTemplate([]) ? TRUE : FALSE; - } - -} diff --git a/web/modules/views_templates/src/Plugin/ViewsDuplicateBuilderPluginInterface.php b/web/modules/views_templates/src/Plugin/ViewsDuplicateBuilderPluginInterface.php deleted file mode 100644 index e395b648e08dcb7e9c95df97eeea4b571521da9e..0000000000000000000000000000000000000000 --- a/web/modules/views_templates/src/Plugin/ViewsDuplicateBuilderPluginInterface.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php -/** - * @file - * Contains \Drupal\views_templates\Plugin\ViewsDuplicateBuilderPluginInterface. - */ - - -namespace Drupal\views_templates\Plugin; - -/** - * Creates a common interface for Builders that use a View Template entity for - * a starting point. - * - * This allows Views to be exported to CMI and then manually changed to Views - * Templates by changing the - */ -interface ViewsDuplicateBuilderPluginInterface extends ViewsBuilderPluginInterface { - - /** - * Return the View Template id to be used by this Plugin. - * - * @return string - */ - public function getViewTemplateId(); - -} diff --git a/web/modules/views_templates/src/ViewTemplateForm.php b/web/modules/views_templates/src/ViewTemplateForm.php deleted file mode 100644 index da727b194ded9a71035556d3ee14675a0ad10cc7..0000000000000000000000000000000000000000 --- a/web/modules/views_templates/src/ViewTemplateForm.php +++ /dev/null @@ -1,112 +0,0 @@ -<?php -/** - * @file - * Contains \Drupal\views_templates\ViewTemplateForm. - */ - -namespace Drupal\views_templates; - -use Drupal\Component\Plugin\PluginManagerInterface; -use Drupal\Core\Form\FormBase; -use Drupal\Core\Form\FormStateInterface; -use Drupal\views_templates\Plugin\ViewsBuilderPluginInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; - -/** - * Form controller for the view template entity add forms. - */ -class ViewTemplateForm extends FormBase { - - /** - * @var \Drupal\Component\Plugin\PluginManagerInterface - */ - protected $builder_manager; - - /** - * Constructs a new \Drupal\views_templates\Controller\ViewsBuilderController - * object. - * - * @param \Drupal\Component\Plugin\PluginManagerInterface - * The Views Builder Plugin Interface. - */ - public function __construct(PluginManagerInterface $builder_manager) { - $this->builder_manager = $builder_manager; - } - - public static function create(ContainerInterface $container) { - return new static( - $container->get('plugin.manager.views_templates.builder') - ); - } - - /** - * {@inheritdoc} - */ - public function submitForm(array &$form, FormStateInterface $form_state) { - $builder = $this->createBuilder($form_state->getValue('builder_id')); - $values = $form_state->cleanValues()->getValues(); - $view = $builder->createView($values); - $view->save(); - - // Redirect the user to the view admin form. - $form_state->setRedirectUrl($view->toUrl('edit-form')); - } - - public function buildForm(array $form, FormStateInterface $form_state, $view_template = NULL) { - $builder = $this->createBuilder($view_template); - $form['#title'] = $this->t('Duplicate of @label', array('@label' => $builder->getAdminLabel())); - - $form['label'] = array( - '#type' => 'textfield', - '#title' => $this->t('View name'), - '#required' => TRUE, - '#size' => 32, - '#maxlength' => 255, - '#default_value' => $builder->getAdminLabel(), - ); - $form['id'] = array( - '#type' => 'machine_name', - '#maxlength' => 128, - '#machine_name' => array( - 'exists' => '\Drupal\views\Views::getView', - 'source' => array('label'), - ), - '#default_value' => '', - '#description' => $this->t('A unique machine-readable name for this View. It must only contain lowercase letters, numbers, and underscores.'), - ); - - $form['description'] = [ - '#type' => 'textfield', - '#title' => $this->t('Description'), - '#default_value' => $builder->getDescription(), - ]; - $form['builder_id'] = [ - '#type' => 'value', - '#value' => $builder->getPluginId(), - ]; - - $form += $builder->buildConfigurationForm($form, $form_state); - - $form['submit'] = [ - '#type' => 'submit', - '#value' => $this->t('Create View'), - ]; - - return $form; - } - - public function getFormId() { - return 'views_templates_add'; - } - - /** - * @param $plugin_id - * - * @return ViewsBuilderPluginInterface; - */ - public function createBuilder($plugin_id) { - return $this->builder_manager->createInstance($plugin_id); - } - - -} diff --git a/web/modules/views_templates/src/ViewsTemplateLoader.php b/web/modules/views_templates/src/ViewsTemplateLoader.php deleted file mode 100644 index 3f2818aa1d17166b7cf50684bf2543dcc9d0e378..0000000000000000000000000000000000000000 --- a/web/modules/views_templates/src/ViewsTemplateLoader.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -/** - * @file - * Contains \Drupal\views_templates\ViewsTemplateLoader. - */ - -namespace Drupal\views_templates; - -use Drupal\Component\Serialization\Yaml; -use Drupal\views_templates\Plugin\ViewsDuplicateBuilderPluginInterface; -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; - - -/** - * Service class to load templates from the file system. - * - * - */ -class ViewsTemplateLoader implements ViewsTemplateLoaderInterface { - - /** - * {@inheritdoc} - */ - public function load(ViewsDuplicateBuilderPluginInterface $builder) { - $templates = &drupal_static(__FUNCTION__, array()); - - $template_id = $builder->getViewTemplateId(); - if (!isset($templates[$template_id])) { - $dir = drupal_get_path('module', $builder->getDefinitionValue('provider')) . '/views_templates'; - if (is_dir($dir)) { - - $file_path = $dir . '/' . $builder->getViewTemplateId() . '.yml'; - if (is_file($file_path)) { - $templates[$template_id] = Yaml::decode(file_get_contents($file_path)); - } - else { - throw new FileNotFoundException($file_path); - } - } - } - return $templates[$template_id]; - } - -} diff --git a/web/modules/views_templates/src/ViewsTemplateLoaderInterface.php b/web/modules/views_templates/src/ViewsTemplateLoaderInterface.php deleted file mode 100644 index 3a773a99b884ad0544b92104dadc60965199af0c..0000000000000000000000000000000000000000 --- a/web/modules/views_templates/src/ViewsTemplateLoaderInterface.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php - -/** - * @file - * Contains \Drupal\views_templates\ViewsTemplateLoaderInterface. - */ - -namespace Drupal\views_templates; - -use Drupal\views_templates\Plugin\ViewsDuplicateBuilderPluginInterface; - -/** - * Provide interface for loading Views Templates for a builder. - */ -interface ViewsTemplateLoaderInterface { - - /** - * Load template array values from file system for builder plugin. - * - * @param \Drupal\views_templates\Plugin\ViewsDuplicateBuilderPluginInterface $builder - * - * @throws \Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException - * If template does not exist. - * - * @return array - */ - public function load(ViewsDuplicateBuilderPluginInterface $builder); - -} diff --git a/web/modules/views_templates/tests/modules/views_templates_builder_test/src/Plugin/ViewsTemplateBuilder/NodeViewBuilder.php b/web/modules/views_templates/tests/modules/views_templates_builder_test/src/Plugin/ViewsTemplateBuilder/NodeViewBuilder.php deleted file mode 100644 index b80fac0dea4e62f37fb2511c6f13b452f78deca1..0000000000000000000000000000000000000000 --- a/web/modules/views_templates/tests/modules/views_templates_builder_test/src/Plugin/ViewsTemplateBuilder/NodeViewBuilder.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php -/** - * @file - * Contains \Drupal\views_templates_builder_test\NodeViewBuilder. - */ - - -namespace Drupal\views_templates_builder_test\Plugin\ViewsTemplateBuilder; - -use Drupal\views_templates\Plugin\ViewsBuilderBase; - - -/** - * Test comment - * - * @todo Switch to our own annotation in ViewsBuilderPluginManager - * - * @ViewsBuilder( - * id = "node_builder", - * admin_label = "Node View", - * description = "A Test Node View", - * base_table = "node_field_data", - * ) - */ -class NodeViewBuilder extends ViewsBuilderBase { - public function createView($options = NULL) { - $view = parent::createView($options); - - - $display_options = $view->getDisplay('default'); - $display_options['fields']['title']['id'] = 'title'; - $display_options['fields']['title']['table'] = 'node_field_data'; - $display_options['fields']['title']['field'] = 'title'; - $display_options['fields']['title']['entity_type'] = 'node'; - $display_options['fields']['title']['entity_field'] = 'title'; - $display_options['fields']['title']['label'] = ''; - $display_options['fields']['title']['alter']['alter_text'] = 0; - $display_options['fields']['title']['alter']['make_link'] = 0; - $display_options['fields']['title']['alter']['absolute'] = 0; - $display_options['fields']['title']['alter']['trim'] = 0; - $display_options['fields']['title']['alter']['word_boundary'] = 0; - $display_options['fields']['title']['alter']['ellipsis'] = 0; - $display_options['fields']['title']['alter']['strip_tags'] = 0; - $display_options['fields']['title']['alter']['html'] = 0; - $display_options['fields']['title']['hide_empty'] = 0; - $display_options['fields']['title']['empty_zero'] = 0; - $display_options['fields']['title']['settings']['link_to_entity'] = 1; - $display_options['fields']['title']['plugin_id'] = 'field'; - - // $executable = $view->getExecutable(); - - // Display: Master - //$default_display = $executable->newDisplay('default', 'Master', 'default'); - $view->addDisplay('page'); - - - /* - foreach ($display_options['default'] as $option => $value) { - $master->setOption($option, $value); - } - */ - - // $executable->save(); - return $view; - - } - - -} diff --git a/web/modules/views_templates/tests/modules/views_templates_builder_test/src/Plugin/ViewsTemplateBuilder/ViewDuplicatorTest.php b/web/modules/views_templates/tests/modules/views_templates_builder_test/src/Plugin/ViewsTemplateBuilder/ViewDuplicatorTest.php deleted file mode 100644 index e70457c976169aab80c49adc81d6bb5ad8429b8b..0000000000000000000000000000000000000000 --- a/web/modules/views_templates/tests/modules/views_templates_builder_test/src/Plugin/ViewsTemplateBuilder/ViewDuplicatorTest.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php -/** - * @file - * Contains - * \Drupal\views_templates_builder_test\Plugin\ViewsTemplateBuilder\ViewDuplicatorTest. - */ - - -namespace Drupal\views_templates_builder_test\Plugin\ViewsTemplateBuilder; - - -use Drupal\Core\Form\FormStateInterface; -use Drupal\views_templates\Plugin\ViewsDuplicateBuilderBase; - -/** - * @ViewsBuilder( - * id = "view_duplicator_test", - * view_template_id = "simple_view", - * module = "views_templates_builder_test", - * replace_values = { - * "__TITLE" = "Title Changed", - * "__TITLE_ID" = "title" - * } - * ) - */ -class ViewDuplicatorTest extends ViewsDuplicateBuilderBase { - - /** - * {@inheritdoc} - */ - public function alterViewTemplateAfterCreation(array &$view_template, $options = NULL) { - parent::alterViewTemplateAfterCreation($view_template, $options); - // Make a simple change. This one goes to 11! - $view_template['display']['default']['display_options']['pager']['options']['items_per_page'] = $options['pager_count']; - } - - /** - * {@inheritdoc} - */ - public function buildConfigurationForm($form, FormStateInterface $form_state) { - $config_form['pager_count'] = [ - '#type' => 'textfield', - '#title' => $this->t('Pager Count'), - '#default_value' => '10', - ]; - return $config_form; - } - - -} diff --git a/web/modules/views_templates/tests/modules/views_templates_builder_test/views_templates/simple_view.yml b/web/modules/views_templates/tests/modules/views_templates_builder_test/views_templates/simple_view.yml deleted file mode 100644 index 41bcc6eb21e28668ced4adf1e13aa6a3f46e1e81..0000000000000000000000000000000000000000 --- a/web/modules/views_templates/tests/modules/views_templates_builder_test/views_templates/simple_view.yml +++ /dev/null @@ -1,171 +0,0 @@ -langcode: en -status: true -dependencies: - module: - - node - - user -id: simplest_view -label: '__TITLE' -module: views -description: 'This is a simple View' -tag: '' -base_table: node_field_data -base_field: nid -core: 8.x -display: - default: - display_plugin: default - id: default - display_title: Master - position: 0 - display_options: - access: - type: perm - options: - perm: 'access content' - cache: - type: tag - options: { } - query: - type: views_query - options: - disable_sql_rewrite: false - distinct: false - replica: false - query_comment: '' - query_tags: { } - exposed_form: - type: basic - options: - submit_button: Apply - reset_button: false - reset_button_label: Reset - exposed_sorts_label: 'Sort by' - expose_sort_order: true - sort_asc_label: Asc - sort_desc_label: Desc - pager: - type: full - options: - items_per_page: 10 - offset: 0 - id: 0 - total_pages: null - expose: - items_per_page: false - items_per_page_label: 'Items per page' - items_per_page_options: '5, 10, 25, 50' - items_per_page_options_all: false - items_per_page_options_all_label: '- All -' - offset: false - offset_label: Offset - tags: - previous: '‹ Previous' - next: 'Next ›' - first: '« First' - last: 'Last »' - quantity: 9 - style: - type: default - options: - grouping: { } - row_class: '' - default_row_class: true - uses_fields: false - row: - type: fields - options: - inline: { } - separator: '' - hide_empty: false - default_field_elements: true - fields: - __FIELD_ID: - id: __FIELD_ID - table: node_field_data - field: title - entity_type: node - entity_field: title - label: '' - alter: - alter_text: false - make_link: false - absolute: false - trim: false - word_boundary: false - ellipsis: false - strip_tags: false - html: false - hide_empty: false - empty_zero: false - settings: - link_to_entity: true - plugin_id: field - relationship: none - group_type: group - admin_label: '' - exclude: false - element_type: '' - element_class: '' - element_label_type: '' - element_label_class: '' - element_label_colon: true - element_wrapper_type: '' - element_wrapper_class: '' - element_default_classes: true - empty: '' - hide_alter_empty: true - click_sort_column: value - type: string - group_column: value - group_columns: { } - group_rows: true - delta_limit: 0 - delta_offset: 0 - delta_reversed: false - delta_first_last: false - multi_type: separator - separator: ', ' - field_api_classes: false - filters: - status: - value: true - table: node_field_data - field: status - plugin_id: boolean - entity_type: node - entity_field: status - id: status - expose: - operator: '' - group: 1 - sorts: - created: - id: created - table: node_field_data - field: created - order: DESC - entity_type: node - entity_field: created - plugin_id: date - relationship: none - group_type: group - admin_label: '' - exposed: false - expose: - label: '' - granularity: second - header: { } - footer: { } - empty: { } - relationships: { } - arguments: { } - cache_metadata: - max-age: -1 - contexts: - - 'languages:language_content' - - 'languages:language_interface' - - url.query_args - - 'user.node_grants:view' - - user.permissions - tags: { } diff --git a/web/modules/views_templates/tests/modules/views_templates_builder_test/views_templates_builder_test.info.yml b/web/modules/views_templates/tests/modules/views_templates_builder_test/views_templates_builder_test.info.yml deleted file mode 100644 index 782df9428256876eb20b84b7caa2df07b6567949..0000000000000000000000000000000000000000 --- a/web/modules/views_templates/tests/modules/views_templates_builder_test/views_templates_builder_test.info.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: -type: module -description: Views Template Test Builder Plugin -# core: 8.x -package: Testing -dependencies: - - views_templates - -# Information added by Drupal.org packaging script on 2015-12-09 -version: '8.x-1.0-alpha1' -core: '8.x' -project: 'views_templates' -datestamp: 1449691740 diff --git a/web/modules/views_templates/views_templates.info.yml b/web/modules/views_templates/views_templates.info.yml deleted file mode 100644 index 911140a7ae12bb49eee55fffef5c9ef005a6a460..0000000000000000000000000000000000000000 --- a/web/modules/views_templates/views_templates.info.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Views templates -type: module -description: 'Reintroduces dynamic default views.' -dependencies: - - views -package: Views -# core: 8.x -# version: VERSION - -# Information added by Drupal.org packaging script on 2015-12-09 -version: '8.x-1.0-alpha1' -core: '8.x' -project: 'views_templates' -datestamp: 1449691740 diff --git a/web/modules/views_templates/views_templates.links.action.yml b/web/modules/views_templates/views_templates.links.action.yml deleted file mode 100644 index 5bb9d96ac859ba19a4c9b97f91bed17f93bb58e5..0000000000000000000000000000000000000000 --- a/web/modules/views_templates/views_templates.links.action.yml +++ /dev/null @@ -1,6 +0,0 @@ -views_add_template_local_action: - route_name: views_templates.list - title: 'Add view from template' - weight: 100 - appears_on: - - entity.view.collection diff --git a/web/modules/views_templates/views_templates.routing.yml b/web/modules/views_templates/views_templates.routing.yml deleted file mode 100644 index a804b27c1ca9635836f0612d2c0ce12b44b5418b..0000000000000000000000000000000000000000 --- a/web/modules/views_templates/views_templates.routing.yml +++ /dev/null @@ -1,17 +0,0 @@ -views_templates.create_from_template: - path: '/admin/structure/views/template/{view_template}/add' - defaults: - _form: '\Drupal\views_templates\ViewTemplateForm' - _title: 'Create from View template' - requirements: - _permission: 'administer views' - -views_templates.list: - path: '/admin/structure/views/template/list' - defaults: - _controller: '\Drupal\views_templates\Controller\ViewsBuilderController::templateList' - _title: 'Add view from template' - requirements: - _permission: 'administer views' - - diff --git a/web/modules/views_templates/views_templates.services.yml b/web/modules/views_templates/views_templates.services.yml deleted file mode 100644 index 7a82df3a3217fab3b3f3d56cf513d651f4d461cc..0000000000000000000000000000000000000000 --- a/web/modules/views_templates/views_templates.services.yml +++ /dev/null @@ -1,9 +0,0 @@ -services: - plugin.manager.views_templates.builder: - class: Drupal\views_templates\Plugin\ViewsBuilderPluginManager - parent: default_plugin_manager - - views_templates.loader: - class: Drupal\views_templates\ViewsTemplateLoader - arguments: [] -