first import
This commit is contained in:
273
sites/all/modules/calendar/CHANGELOG.txt
Normal file
273
sites/all/modules/calendar/CHANGELOG.txt
Normal file
@@ -0,0 +1,273 @@
|
||||
Calendar Module 7.x
|
||||
==================
|
||||
|
||||
===================
|
||||
Version 7.x-3.x-dev
|
||||
===================
|
||||
|
||||
======================
|
||||
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.
|
339
sites/all/modules/calendar/LICENSE.txt
Normal file
339
sites/all/modules/calendar/LICENSE.txt
Normal file
@@ -0,0 +1,339 @@
|
||||
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.
|
48
sites/all/modules/calendar/README.txt
Normal file
48
sites/all/modules/calendar/README.txt
Normal file
@@ -0,0 +1,48 @@
|
||||
Creates calendar displays of Views results.
|
||||
|
||||
Create a new calendar by enabling or cloning the default calendar,
|
||||
changing the date argument to use the correct date field(s), and setting
|
||||
up the year, month, day, week, and block views with the desired styles
|
||||
and fields.
|
||||
|
||||
If the Calendar iCal module is enabled, an iCal feed can be
|
||||
attached to the view.
|
||||
|
||||
For a quick and easy start, install the Date Tools module, then use
|
||||
the Date Tools Wizard to create a content type with a date field
|
||||
and a calendar that displays that field, all in a single step!
|
||||
|
||||
|
||||
|
||||
NOTES WHEN SWITCHING FROM 7.2 to 7.3
|
||||
|
||||
The views created in the 7.2 version of Calendar won't work in 7.3
|
||||
because all the handlers have changed. If you are using the default
|
||||
view, you will need to revert it to pick up the changes.
|
||||
|
||||
If you have calendars that were created by the Date Tools module, they are
|
||||
default views. Go to each one and revert them so they pick up the new code.
|
||||
|
||||
If you are using custom (non-default) views it will probably be easier to
|
||||
delete them and just start over than to try to find all the places where the
|
||||
plugins and handlers need to be altered. Start with the new default
|
||||
calendar (after reverting it so any previous changes have been
|
||||
removed). Then clone it and make the following changes:
|
||||
|
||||
- In the 'Fields' section, remove the node updated date and add your calendar date.
|
||||
- Click on each display (Year, Month, Day, Week, Block) and edit the contextual
|
||||
filter for the display. Uncheck the node updated date in the list of date fields
|
||||
and check instead the date you want to use in the calendar.
|
||||
- Click on the Upcoming display and edit the filter. Uncheck the node updated date
|
||||
and check instead the date you want to use in the calendar.
|
||||
- If you have the iCal module enabled, click on the iCal display. Edit the
|
||||
Row plugin settings and select the date field you want to use in the iCal feed.
|
||||
|
||||
After you have made these changes, go to the Views Tools tab and clear the Views
|
||||
caches. Also go to admin/config/regional/settings, make sure the right
|
||||
first day of the week is selected, and resubmit that page even if you
|
||||
don't make any changes. That step is to fix a bug that might have set that date
|
||||
to the wrong value.
|
||||
|
||||
After that your new views should work correctly and you can try out the
|
||||
new settings to make whatever additional changes you like.
|
26
sites/all/modules/calendar/calendar.info
Normal file
26
sites/all/modules/calendar/calendar.info
Normal file
@@ -0,0 +1,26 @@
|
||||
name = Calendar
|
||||
description = Views plugin to display views containing dates as Calendars.
|
||||
dependencies[] = views
|
||||
dependencies[] = date_api
|
||||
dependencies[] = date_views
|
||||
package = Date/Time
|
||||
core = 7.x
|
||||
stylesheets[all][] = css/calendar_multiday.css
|
||||
|
||||
files[] = calendar.install
|
||||
files[] = calendar.module
|
||||
files[] = includes/calendar.views.inc
|
||||
files[] = includes/calendar_plugin_style.inc
|
||||
files[] = includes/calendar_plugin_row_node.inc
|
||||
files[] = includes/calendar_plugin_row.inc
|
||||
files[] = includes/calendar.views_template.inc
|
||||
files[] = theme/theme.inc
|
||||
files[] = theme/calendar-style.tpl.php
|
||||
files[] = theme/calendar-row-node.tpl.php
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-02-24
|
||||
version = "7.x-3.0"
|
||||
core = "7.x"
|
||||
project = "calendar"
|
||||
datestamp = "1330089637"
|
||||
|
18
sites/all/modules/calendar/calendar.install
Normal file
18
sites/all/modules/calendar/calendar.install
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Install, update and uninstall functions for the calendar module.
|
||||
*
|
||||
*/
|
||||
|
||||
function calendar_update_last_removed() {
|
||||
return 6002;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove D6-style calendar legend block from block table.
|
||||
*/
|
||||
function calendar_update_7000() {
|
||||
// Remove the former Calendar legend block, if any.
|
||||
db_query("DELETE FROM {block} WHERE module = 'calendar' AND delta = '0'");
|
||||
}
|
569
sites/all/modules/calendar/calendar.module
Normal file
569
sites/all/modules/calendar/calendar.module
Normal file
@@ -0,0 +1,569 @@
|
||||
<?php
|
||||
define('CALENDAR_SHOW_ALL', 0);
|
||||
define('CALENDAR_HIDE_ALL', -1);
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Adds calendar filtering and displays to Views.
|
||||
*/
|
||||
/**
|
||||
* Implements hook_menu().
|
||||
*/
|
||||
function calendar_menu() {
|
||||
$items = array();
|
||||
$items['admin/config/date/calendar'] = array(
|
||||
'title' => 'Calendar',
|
||||
'description' => 'Calendar administration.',
|
||||
'page callback' => 'calendar_admin',
|
||||
'access callback' => 'user_access',
|
||||
'access arguments' => array('administer site configuration'),
|
||||
);
|
||||
$items['admin/config/date/calendar/remove'] = array(
|
||||
'title' => 'Remove calendar',
|
||||
'access arguments' => array('administer views'),
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('calendar_remove_form', 4),
|
||||
'type' => MENU_CALLBACK,
|
||||
);
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* General Calendar administration.
|
||||
*/
|
||||
function calendar_admin() {
|
||||
|
||||
$content = '<h2>Calendar Administration</h2>';
|
||||
$content .= t('This is the future home for calendar administration tasks.');
|
||||
|
||||
$calendar_options = variable_get('calendar_default_view_options', array());
|
||||
|
||||
if (!empty($calendar_options)) {
|
||||
$content .= t('<h2>Deleting Calendars</h2>Calendars that were created using older versions of the !date_wizard cannot be deleted in the Views listing. You can delete them using the links below. The newer version of the Date Wizard creates views from templates that can be deleted normally.', array('!date_wizard' => l(t('Date wizard'), 'admin/config/date/tools/date_wizard')));
|
||||
|
||||
$calendars = array();
|
||||
$node_types = node_type_get_names();
|
||||
foreach ($calendar_options as $key => $option) {
|
||||
$bundle = str_replace(array('calendar_', 'cal_'), '', $key);
|
||||
if (array_key_exists($bundle, $node_types)) {
|
||||
$type = $node_types[$bundle];
|
||||
$calendars[] = array(
|
||||
l($type, 'admin/structure/types/manage/' . $bundle . '/fields'),
|
||||
l($key, 'admin/structure/views/edit/' . $key),
|
||||
t('The calendar %view is a default calendar created for the content type %bundle. ', array('%view' => $key, '%bundle' => $type)),
|
||||
l(t('remove !view', array('!view' => $key)), 'admin/structure/date/remove/' . $key),
|
||||
);
|
||||
}
|
||||
else {
|
||||
// Do some cleanup while we're here if we have default calendars
|
||||
// for non-existent content types.
|
||||
calendar_remove($bundle);
|
||||
}
|
||||
}
|
||||
if (!empty($calendars)) {
|
||||
$header = array(t('Content Type'), t('Calendar'), t('Description'), t('Operations'));
|
||||
$content .= theme('table', array('header' => $header, 'rows' => $calendars));
|
||||
}
|
||||
|
||||
}
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Form constructor for the date field removal form.
|
||||
*
|
||||
* Path: admin/config/date/tools/remove
|
||||
*
|
||||
* @see date_tools_remove_form_submit()
|
||||
*/
|
||||
function calendar_remove_form($form, &$form_state, $view_name) {
|
||||
$form = array();
|
||||
$form['view_name'] = array(
|
||||
'#type' => 'value',
|
||||
'#value' => $view_name,
|
||||
);
|
||||
$output = confirm_form($form,
|
||||
t('Are you sure you want to remove the view %view?', array('%view' => $view_name)),
|
||||
'admin/config/date/calendar',
|
||||
t('This action cannot be undone.'),
|
||||
t('Remove'), t('Cancel')
|
||||
);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Form submission handler for date_tools_remove_form().
|
||||
*/
|
||||
function calendar_remove_form_submit($form, &$form_state) {
|
||||
$form_values = $form_state['values'];
|
||||
$view_name = $form_values['view_name'];
|
||||
if ($view_name && $form_values['confirm']) {
|
||||
calendar_remove($view_name);
|
||||
drupal_set_message(t('Removed calendar %calendar.', array('%calendar' => $view_name)));
|
||||
}
|
||||
$form_state['redirect'] = 'admin/config/date';
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_preprocess_date_views_pager().
|
||||
*
|
||||
* Creates a calendar_links array which is stored in the session and used
|
||||
* in calendar_menu_local_tasks_alter() to display the links as action items and dynamic tabs.
|
||||
* The links can be altered or deleted using hook_calendar_links_alter().
|
||||
*
|
||||
*/
|
||||
function calendar_preprocess_date_views_pager(&$vars) {
|
||||
$view = $vars['plugin']->view;
|
||||
|
||||
// If no one has added date information, nothing to do here.
|
||||
if (empty($view->date_info) || empty($view->argument)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$options = $view->style_options;
|
||||
$pager_format = $view->date_info->date_pager_format;
|
||||
|
||||
// If we're not on a view with a path (a page), no links are needed.
|
||||
$current_path = !empty($view->display_handler->options['path']) ? $view->display_handler->options['path'] : '';
|
||||
if (empty($current_path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Find all the displays in this view that use the calendar style and have a path and create links to each.
|
||||
$calendar_links[$current_path] = array();
|
||||
$base = array('attributes' => array('rel' => 'nofollow'));
|
||||
foreach ($view->display as $id => $display) {
|
||||
// Check for !empty() in case the view is not fully formed or has displays that are marked to be deleted.
|
||||
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'])) {
|
||||
//$path = $display->display_options['path'];
|
||||
$title = $display->display_title;
|
||||
foreach ($display->display_options['arguments'] as $name => $argument) {
|
||||
if (!empty($argument['granularity'])) {
|
||||
$type = $argument['granularity'];
|
||||
}
|
||||
}
|
||||
|
||||
//$type = !empty($display->display_options['style_options']['calendar_type']) ? $display->display_options['style_options']['calendar_type'] : '';
|
||||
$path = calendar_granularity_path($view, $type);
|
||||
$calendar_links[$current_path]['tabs'][$type] = array('title' => $title, 'path' => $path);
|
||||
$calendar_links[$current_path]['types'][] = $type;
|
||||
}
|
||||
}
|
||||
|
||||
// If an 'Add new ... link is provided, add it here.
|
||||
if (!empty($view->date_info->calendar_date_link) && !empty($view->date_info->url)
|
||||
&& (user_access("administer nodes") || user_access('create ' . $view->date_info->calendar_date_link . ' content'))) {
|
||||
$name = node_type_get_name($view->date_info->calendar_date_link);
|
||||
$href = 'node/add/' . str_replace('_', '-', $view->date_info->calendar_date_link);
|
||||
$calendar_links[$current_path]['actions'][] = array('title' => t('Add @name', array('@name' => $name)), 'path' => $href);
|
||||
}
|
||||
|
||||
// Pass this through drupal_alter() so it can be adjusted in custom code or in the theme.
|
||||
drupal_alter('calendar_links', $calendar_links);
|
||||
|
||||
// Add the value to the session so it can be used to create the tabs.
|
||||
if (!empty($calendar_links[$current_path])) {
|
||||
$_SESSION['calendar_links'][$current_path] = $calendar_links[$current_path];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_menu_local_tasks_alter().
|
||||
*
|
||||
* Takes the calendar links created in calendar_preprocess_date_views_pager()
|
||||
* and reconfigures them as action items and tabs. The links can be altered
|
||||
* before they are displayed using hook_calendar_links_alter().
|
||||
*
|
||||
* We do this with an alter rather than in hook_menu() because the
|
||||
* specific path we want to go to will vary depending on the page we
|
||||
* are looking at at the time.
|
||||
*/
|
||||
function calendar_menu_local_tasks_alter(&$data, $router_item, $root_path) {
|
||||
if (!empty($_SESSION['calendar_links']) && array_key_exists($root_path, $_SESSION['calendar_links'])) {
|
||||
$calendar_data = $_SESSION['calendar_links'][$root_path];
|
||||
if (!empty($calendar_data['actions'])) {
|
||||
foreach ($calendar_data['actions'] as $action) {
|
||||
$item = menu_get_item($action['path']);
|
||||
$item['title'] = $action['title'];
|
||||
// The add new content page would redirect to the new event
|
||||
// if we did not override that here. This way they will
|
||||
// redirect back to the calendar.
|
||||
$item['localized_options'] += array('query' => array());
|
||||
$item['localized_options']['query'] += drupal_get_destination();
|
||||
if (array_key_exists('access', $item) && $item['access']) {
|
||||
$data['actions']['output'][] = array(
|
||||
'#theme' => 'menu_local_action',
|
||||
'#link' => $item,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($calendar_data['tabs'])) {
|
||||
$delta = !empty($data['tabs'][0]['count']) ? $data['tabs'][0]['count'] - 1 : 0;
|
||||
foreach ($calendar_data['tabs'] as $tab) {
|
||||
$clean_path = str_replace('?q=', '', $tab['path']);
|
||||
$item = menu_get_item($clean_path);
|
||||
if (!empty($item)) {
|
||||
$item['title'] = $tab['title'];
|
||||
// If we have moved off the default page for the calendar, the
|
||||
// links to the other views will have been adjusted to keep information
|
||||
// about the right year/month/week/day to go to.
|
||||
$item['href'] = $clean_path;
|
||||
if (array_key_exists('access', $item) && $item['access']) {
|
||||
$data['tabs'][0]['output'][$delta] = array(
|
||||
'#theme' => 'menu_local_task',
|
||||
'#link' => $item,
|
||||
);
|
||||
$path_parts = explode('/', $root_path);
|
||||
if (in_array('%', $path_parts)) {
|
||||
$clean_parts = explode('/', $clean_path);
|
||||
$count = count($clean_parts);
|
||||
$match = TRUE;
|
||||
foreach ($path_parts as $key => $part) {
|
||||
if (empty($clean_parts[$key])) {
|
||||
$match = FALSE;
|
||||
}
|
||||
elseif ($part != '%' && $part != $clean_parts[$key]) {
|
||||
$match = FALSE;
|
||||
}
|
||||
}
|
||||
if ($match) {
|
||||
$data['tabs'][0]['output'][$delta]['#active'] = TRUE;
|
||||
}
|
||||
}
|
||||
elseif (strpos($clean_path, $root_path) === 0) {
|
||||
$data['tabs'][0]['output'][$delta]['#active'] = TRUE;
|
||||
}
|
||||
$delta++;
|
||||
}
|
||||
}
|
||||
$data['tabs'][0]['count'] = $delta + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_views_api().
|
||||
*/
|
||||
function calendar_views_api() {
|
||||
return array(
|
||||
'api' => 3.0,
|
||||
'path' => drupal_get_path('module', 'calendar') . '/includes',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calendar display types.
|
||||
*/
|
||||
function calendar_display_types() {
|
||||
return array('year' => t('Year'), 'month' => t('Month'), 'day' => t('Day'), 'week' => t('Week'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_help().
|
||||
*/
|
||||
function calendar_help($section, $arg) {
|
||||
switch ($section) {
|
||||
case 'admin/help#calendar':
|
||||
return t("<p>View complete documentation at !link.</p>", array('!link' => l(t('Date and Calendar Documentation'), 'http://drupal.org/node/262062')));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_theme().
|
||||
*/
|
||||
function calendar_theme() {
|
||||
$module_path = drupal_get_path('module', 'calendar');
|
||||
|
||||
$base = array(
|
||||
'file' => 'theme.inc',
|
||||
'path' => "$module_path/theme",
|
||||
);
|
||||
return array(
|
||||
'calendar_item' => $base + array(
|
||||
'template' => 'calendar-item',
|
||||
'variables' => array('view' => NULL, 'rendered_fields' => NULL, 'item' => NULL),
|
||||
),
|
||||
'calendar_datebox' => $base + array(
|
||||
'template' => 'calendar-datebox',
|
||||
'variables' => array(
|
||||
'date' => NULL, 'view' => NULL, 'items' => NULL, 'selected' => NULL),
|
||||
),
|
||||
'calendar_empty_day' => $base + array(
|
||||
'variables' => array('curday' => NULL, 'view' => NULL),
|
||||
),
|
||||
'calendar_stripe_legend' => $base + array(
|
||||
'variables' => array('stripe_labels' => NULL),
|
||||
),
|
||||
'calendar_stripe_stripe' => $base + array(
|
||||
'variables' => array('node' => NULL),
|
||||
),
|
||||
'calendar_time_row_heading' => $base + array(
|
||||
'variables' => array('start_time' => NULL, 'next_start_time' => NULL, 'curday_date' => NULL),
|
||||
),
|
||||
'calendar_month_col' => $base + array(
|
||||
'template' => 'calendar-month-col',
|
||||
'variables' => array('item' => NULL),
|
||||
),
|
||||
'calendar_month_row' => $base + array(
|
||||
'template' => 'calendar-month-row',
|
||||
'variables' => array('inner' => NULL, 'class' => NULL, 'iehint' => NULL),
|
||||
),
|
||||
'calendar_month_multiple_entity' => $base + array(
|
||||
'template' => 'calendar-month-multiple-entity',
|
||||
'variables' => array('
|
||||
curday' => NULL, 'count' => NULL, 'view' => NULL, 'ids' => NULL),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_node_view().
|
||||
*
|
||||
* Add link to calendar to nodes, formerly hook_link().
|
||||
* Controlled by value of 'calendar_date_link' in the view.
|
||||
*/
|
||||
function calendar_node_view($node, $view_mode, $langcode) {
|
||||
$path = variable_get('calendar_date_link_' . $node->type);
|
||||
if (!empty($path)) {
|
||||
$links['calendar_link'] = array(
|
||||
'title' => t('Calendar'),
|
||||
'href' => $path,
|
||||
'attributes' => array('title' => t('View the calendar.')),
|
||||
);
|
||||
$node->content['links']['calendar'] = array(
|
||||
'#theme' => 'links__node__caledar',
|
||||
'#links' => $links,
|
||||
'#attributes' => array('class' => array('links', 'inline')),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to link an entity type to a calendar.
|
||||
*
|
||||
* @param $entity_type - the type of entity.
|
||||
* @param $bundle - the entity bundle name.
|
||||
* @param $path - the calendar path to use for this bundle.
|
||||
*/
|
||||
function calendar_set_link($entity_type, $bundle, $path) {
|
||||
switch ($entity_type) {
|
||||
case 'node':
|
||||
variable_set('calendar_date_link_' . $bundle, $path);
|
||||
break;
|
||||
default:
|
||||
variable_set('calendar_date_link_' . $entity_type . '_' . $bundle, $path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to clear previously-set links to calendars.
|
||||
*
|
||||
* @param $bundle, Clear all links for this bundle. If NULL, clear all links.
|
||||
*/
|
||||
function calendar_clear_link_bundle($bundle = NULL) {
|
||||
if (empty($bundle)) {
|
||||
$result = db_select('variable', 'v')
|
||||
->fields('v', 'name')
|
||||
->condition('name', 'calendar_date_link_%', 'LIKE')
|
||||
->execute()->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
else {
|
||||
$result = db_select('variable', 'v')
|
||||
->fields('v', 'name')
|
||||
->condition('name', 'calendar_date_link_' . $bundle)
|
||||
->execute()->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
// Iterate over all the values and delete them.
|
||||
foreach ($result as $row) {
|
||||
variable_del($row['name']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to clear previously-set links to calendars.
|
||||
*
|
||||
* @param $path, Clear all links to this path. If NULL, clear all links.
|
||||
*/
|
||||
function calendar_clear_link_path($path = NULL) {
|
||||
$result = db_select('variable', 'v')
|
||||
->fields('v', array('name', 'value'))
|
||||
->condition('name', 'calendar_date_link_%', 'LIKE')
|
||||
->execute()->fetchAll(PDO::FETCH_ASSOC);
|
||||
// Iterate over all the values and delete them.
|
||||
foreach ($result as $row) {
|
||||
if (empty($path) || unserialize($row['value']) == $path) {
|
||||
variable_del($row['name']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the weekday information into table header format
|
||||
*
|
||||
* @ingroup event_support
|
||||
* @return array with weekday table header data
|
||||
*/
|
||||
function calendar_week_header($view) {
|
||||
$len = isset($view->date_info->style_name_size) ? $view->date_info->style_name_size : (!empty($view->date_info->mini) ? 1 : 3);
|
||||
$with_week = !empty($view->date_info->style_with_weekno);
|
||||
|
||||
// create week header
|
||||
$untranslated_days = calendar_untranslated_days();
|
||||
if ($len == 99) {
|
||||
$translated_days = date_week_days_ordered(date_week_days(TRUE));
|
||||
}
|
||||
else {
|
||||
$translated_days = date_week_days_ordered(date_week_days_abbr(TRUE));
|
||||
}
|
||||
if ($with_week) {
|
||||
$row[] = array('header' => TRUE, 'class' => "days week", 'data' => ' ');
|
||||
}
|
||||
foreach ($untranslated_days as $delta => $day) {
|
||||
$label = $len < 3 ? drupal_substr($translated_days[$delta], 0 , $len) : $translated_days[$delta];
|
||||
$row[] = array('header' => TRUE, 'class' => "days " . $day, 'data' => $label);
|
||||
}
|
||||
return $row;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of untranslated day name abbreviations, forced to lowercase
|
||||
* and ordered appropriately for the site setting for the first day of week.
|
||||
*
|
||||
* The untranslated day abbreviation is used in css classes.
|
||||
*/
|
||||
function calendar_untranslated_days() {
|
||||
$untranslated_days = date_week_days_ordered(date_week_days_untranslated());
|
||||
foreach ($untranslated_days as $delta => $day) {
|
||||
$untranslated_days[$delta] = strtolower(substr($day, 0, 3));
|
||||
}
|
||||
return $untranslated_days;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default settings array for calendar time grouping.
|
||||
*/
|
||||
function calendar_groupby_times($type = '') {
|
||||
$times = array();
|
||||
switch ($type) {
|
||||
case 'hour':
|
||||
for ($i = 0; $i <= 23; $i++) {
|
||||
$times[] = date_pad($i) . ':00:00';
|
||||
}
|
||||
break;
|
||||
case 'half':
|
||||
for ($i = 0; $i <= 23; $i++) {
|
||||
$times[] = date_pad($i) . ':00:00';
|
||||
$times[] = date_pad($i) . ':30:00';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return $times;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_block_info()
|
||||
*/
|
||||
function calendar_block_info() {
|
||||
$blocks['calendar_legend'] = array(
|
||||
'info' => t('Calendar Legend'),
|
||||
'cache' => DRUPAL_NO_CACHE,
|
||||
);
|
||||
return $blocks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_block_view().
|
||||
*/
|
||||
function calendar_block_view($delta = '') {
|
||||
switch ($delta) {
|
||||
case 'calendar_legend':
|
||||
$block['subject'] = t('Calendar Legend');
|
||||
$block['content'] = array(
|
||||
'#theme' => 'calendar_stripe_legend',
|
||||
);
|
||||
return $block;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the path for the calendar display that has a specific granularity.
|
||||
*/
|
||||
function calendar_granularity_path(&$view, $granularity) {
|
||||
$paths = &drupal_static(__FUNCTION__, array());
|
||||
if (!array_key_exists($view->name, $paths) || !(array_key_exists($granularity, $paths[$view->name]))) {
|
||||
$paths[$view->name][$granularity] = '';
|
||||
foreach ($view->display as $id => $display) {
|
||||
// Check for !empty() in case the view is not fully formed or has displays that are marked to be deleted
|
||||
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'])) {
|
||||
foreach ($display->display_options['arguments'] as $name => $argument) {
|
||||
if (!empty($argument['granularity'])) {
|
||||
$type = $argument['granularity'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($type == $granularity) {
|
||||
$part_path = $display->display_options['path'];
|
||||
$parts = explode('/', $part_path);
|
||||
if (in_array('%', $parts)) {
|
||||
$current_path = parse_url($_GET['q']);
|
||||
$current_parts = explode('/', $current_path['path']);
|
||||
foreach ($parts as $key => $part) {
|
||||
if ($part == '%' && !empty($current_parts[$key])) {
|
||||
$parts[$key] = $current_parts[$key];
|
||||
}
|
||||
}
|
||||
$part_path = implode('/', $parts);
|
||||
}
|
||||
$paths[$view->name][$granularity] = $part_path;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $paths[$view->name][$granularity];
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to remove a default calendar from the system.
|
||||
*/
|
||||
function calendar_remove($view_name) {
|
||||
// Remove any variable that creates a default view with this name.
|
||||
$calendar_options = variable_get('calendar_default_view_options', array());
|
||||
if (array_key_exists($view_name, $calendar_options)) {
|
||||
unset($calendar_options[$view_name]);
|
||||
}
|
||||
variable_set('calendar_default_view_options', $calendar_options);
|
||||
// Delete it from the database, if stored there.
|
||||
if ($view = views_get_view($view_name)) {
|
||||
$view->delete();
|
||||
}
|
||||
views_invalidate_cache();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to make sure the user has entered a valid 6 digit hex color.
|
||||
*/
|
||||
function calendar_validate_hex_color($element, &$form_state) {
|
||||
if (!$element['#required'] && empty($element['#value'])) {
|
||||
return;
|
||||
}
|
||||
if (!preg_match('/^#(?:(?:[a-f\d]{3}){1,2})$/i', $element['#value'])) {
|
||||
form_error($element, t("'@color' is not a valid hex color", array('@color' => $element['#value'])));
|
||||
}
|
||||
else {
|
||||
form_set_value($element, $element['#value'], $form_state);
|
||||
}
|
||||
}
|
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* $event['uid'] - a unique id for the event (usually the url).
|
||||
* $event['summary'] - the name of the event.
|
||||
* $event['start'] - the formatted start date of the event.
|
||||
* $event['end'] - the formatted end date of the event.
|
||||
* $event['all_day'] - whether the item is an all day event.
|
||||
* $event['rrule'] - the RRULE of the event, if any.
|
||||
* $event['timezone'] - the formatted timezone name of the event, if any.
|
||||
* $event['url'] - the url for the event.
|
||||
* $event['location'] - the name of the event location.
|
||||
* $event['description'] - a description of the event.
|
||||
*
|
||||
* Note that there are empty spaces after RRULE, URL, LOCATION, etc
|
||||
* that are needed to make sure we get the required line break.
|
||||
*
|
||||
* If you are editing this file, remember that all output lines generated by it
|
||||
* must end with DOS-style \r\n line endings, and not Unix-style \n, in order to
|
||||
* be compliant with the iCal spec (see http://tools.ietf.org/html/rfc5545#section-3.1)
|
||||
*/
|
||||
$date = date_now('UTC');
|
||||
$current_date = !empty($event['current_date']) ? $event['current_date'] : $date->format(DATE_FORMAT_ICAL);
|
||||
print "BEGIN:VEVENT\r\n";
|
||||
print "UID:" . $event['uid'] . "\r\n";
|
||||
print "SUMMARY:" . $event['summary'] . "\r\n";
|
||||
print "DTSTAMP:" . $current_date . "Z\r\n";
|
||||
if ($event['all_day']):
|
||||
print "DTSTART;VALUE=DATE:" . $event['start'] . "\r\n";
|
||||
else:
|
||||
print "DTSTART:" . $event['start'] . "Z\r\n";
|
||||
endif;
|
||||
if (!empty($event['end'])):
|
||||
if (!empty($event['all_day'])):
|
||||
print "DTEND;VALUE=DATE:" . $event['end'] . "\r\n";
|
||||
else:
|
||||
print "DTEND:" . $event['end'] . "Z\r\n";
|
||||
endif;
|
||||
endif;
|
||||
if (!empty($event['rrule'])) {
|
||||
print $event['rrule'] . "\r\n";
|
||||
}
|
||||
if (!empty($event['url'])) {
|
||||
print "URL;VALUE=URI:" . $event['url'] . "\r\n";
|
||||
}
|
||||
if (!empty($event['location'])) {
|
||||
print "LOCATION:" . $event['location'] . "\r\n";
|
||||
}
|
||||
if (!empty($event['description'])) {
|
||||
print "DESCRIPTION:" . $event['description'] . "\r\n";
|
||||
}
|
||||
print "END:VEVENT\r\n";
|
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* $title
|
||||
* The name of the calendar.
|
||||
*
|
||||
* If you are editing this file, remember that all output lines generated by it
|
||||
* must end with DOS-style \r\n line endings, and not Unix-style \n, in order to
|
||||
* be compliant with the iCal spec (see http://tools.ietf.org/html/rfc5545#section-3.1)
|
||||
*/
|
||||
if (empty($method)) {
|
||||
$method = 'PUBLISH';
|
||||
}
|
||||
print "BEGIN:VCALENDAR\r\n";
|
||||
print "VERSION:2.0\r\n";
|
||||
print "METHOD:$method\r\n";
|
||||
if (!empty($title)) {
|
||||
print "X-WR-CALNAME;VALUE=TEXT:$title\r\n";
|
||||
}
|
||||
print "PRODID:-//Drupal iCal API//EN\r\n";
|
||||
// Note that $rows already has the right line endings and needs no more.
|
||||
print "$rows";
|
||||
print "END:VCALENDAR\r\n";
|
22
sites/all/modules/calendar/calendar_ical/calendar_ical.info
Normal file
22
sites/all/modules/calendar/calendar_ical/calendar_ical.info
Normal file
@@ -0,0 +1,22 @@
|
||||
name = Calendar iCal DEPRECATED!
|
||||
description = DEPRECATED, Use Date iCal instead.
|
||||
dependencies[] = views
|
||||
dependencies[] = date_api
|
||||
dependencies[] = date_views
|
||||
dependencies[] = calendar
|
||||
package = Date/Time
|
||||
core = 7.x
|
||||
files[] = calendar_ical.install
|
||||
files[] = calendar_ical.module
|
||||
files[] = calendar_plugin_style_ical.inc
|
||||
files[] = calendar_plugin_row_ical_node.inc
|
||||
files[] = calendar-style-ical.tpl.php
|
||||
files[] = calendar-row-ical-node.tpl.php
|
||||
files[] = theme.inc
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-02-24
|
||||
version = "7.x-3.0"
|
||||
core = "7.x"
|
||||
project = "calendar"
|
||||
datestamp = "1330089637"
|
||||
|
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Install, update and uninstall functions for the calendar_ical module.
|
||||
*
|
||||
*/
|
||||
|
||||
function calendar_ical_update_last_removed() {
|
||||
return 6000;
|
||||
}
|
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Implementation of hook_views_api().
|
||||
*
|
||||
* This one is used as the base to reduce errors when updating.
|
||||
*/
|
||||
function calendar_ical_views_api() {
|
||||
return array(
|
||||
'api' => 2,
|
||||
'path' => drupal_get_path('module', 'calendar_ical'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Adds ical functionality to Calendar.
|
||||
*/
|
||||
function calendar_ical_theme() {
|
||||
return array(
|
||||
'calendar_ical_icon' => array(
|
||||
'variables' => array('url'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
function theme_calendar_ical_icon($vars) {
|
||||
$url = $vars['url'];
|
||||
$variables = array(
|
||||
'path' => drupal_get_path('module', 'date_api') . '/images/ical16x16.gif',
|
||||
'title' => t('Add to calendar'), t('Add to calendar'),
|
||||
);
|
||||
if ($image = theme('image', $variables)) {
|
||||
return '<div style="text-align:right"><a href="' . check_url($url) . '" class="ical-icon" title="ical">' . $image . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_entity_info_alter().
|
||||
*
|
||||
* Add an 'iCal' view mode for nodes, similar to RSS view mode.
|
||||
*/
|
||||
function calendar_ical_entity_info_alter(&$info) {
|
||||
$info['node']['view modes'] += array(
|
||||
'ical' => array(
|
||||
'label' => t('iCal'),
|
||||
'custom settings' => FALSE,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_views_plugins
|
||||
*/
|
||||
function calendar_ical_views_plugins() {
|
||||
$module_path = drupal_get_path('module', 'calendar_ical');
|
||||
module_load_include('inc', 'calendar_ical', 'theme.inc');
|
||||
|
||||
$data = array(
|
||||
'module' => 'calendar_ical', // This just tells our themes are elsewhere.
|
||||
'style' => array(
|
||||
'ical' => array(
|
||||
'title' => t('DEPRECATED iCal Feed'),
|
||||
'help' => t('Generates an iCal VCALENDAR feed from a view.'),
|
||||
'handler' => 'calendar_plugin_style_ical',
|
||||
'path' => "$module_path",
|
||||
'theme' => 'calendar_style_ical',
|
||||
'theme file' => 'theme.inc',
|
||||
'theme path' => "$module_path",
|
||||
'uses fields' => TRUE,
|
||||
'uses grouping' => FALSE,
|
||||
'uses row plugin' => TRUE,
|
||||
'uses options' => TRUE,
|
||||
'type' => 'feed',
|
||||
'even empty' => TRUE,
|
||||
),
|
||||
),
|
||||
'row' => array(
|
||||
'ical_node' => array(
|
||||
'title' => t('DEPRECATED iCal Fields'),
|
||||
'help' => t('Display each node as an iCal VEVENT item.'),
|
||||
'handler' => 'calendar_plugin_row_ical_node',
|
||||
'path' => "$module_path",
|
||||
'theme' => 'calendar_row_ical_node',
|
||||
'theme file' => 'theme.inc',
|
||||
'theme path' => "$module_path",
|
||||
'base' => array('node'), // only works with 'node' as base.
|
||||
'uses options' => TRUE,
|
||||
'uses fields' => FALSE,
|
||||
'type' => 'feed',
|
||||
),
|
||||
),
|
||||
);
|
||||
return $data;
|
||||
}
|
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Contains the iCal row style plugin.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Plugin which creates a view on the resulting object
|
||||
* and formats it as an iCal VEVENT.
|
||||
*/
|
||||
class calendar_plugin_row_ical_node extends views_plugin_row {
|
||||
|
||||
// Basic properties that let the row style follow relationships.
|
||||
var $base_table = 'node';
|
||||
var $base_field = 'nid';
|
||||
|
||||
// Stores the nodes loaded with pre_render.
|
||||
var $nodes = array();
|
||||
|
||||
function option_definition() {
|
||||
$options = parent::option_definition();
|
||||
$options['date_field'] = array('default' => array());
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a form for setting options.
|
||||
*/
|
||||
function options_form(&$form, &$form_state) {
|
||||
parent::options_form($form, $form_state);
|
||||
$data = date_views_fields('node');
|
||||
$options = array();
|
||||
foreach ($data['name'] as $item => $value) {
|
||||
// We only want to see one value for each field, skip '_value2', and other columns.
|
||||
if ($item == $value['fromto'][0]) {
|
||||
$options[$item] = $value['label'];
|
||||
}
|
||||
}
|
||||
$form['date_field'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Date field'),
|
||||
'#options' => $options,
|
||||
'#default_value' => $this->options['date_field'],
|
||||
'#description' => t('Please identify the node field to use as the iCal date for each item in this view. Add a Date Filter or a Date Argument to the view to limit results to content in a specified date range.'),
|
||||
'#required' => TRUE,
|
||||
'#prefix' => t("The node title will be used as the 'summary' and the node view will be used as the 'description' for the iCal event. To control the description, hide or show fields for the iCal view mode on the 'Display Fields' screen. Keep in mind that any html in the node view will be stripped out in the feed, to comply with the iCal standards."),
|
||||
);
|
||||
}
|
||||
|
||||
function pre_render($values) {
|
||||
$nids = array();
|
||||
foreach ($values as $row) {
|
||||
$nids[] = $row->{$this->field_alias};
|
||||
}
|
||||
if (!empty($nids)) {
|
||||
$this->nodes = node_load_multiple($nids);
|
||||
}
|
||||
}
|
||||
|
||||
function render($row) {
|
||||
global $base_url;
|
||||
$nid = $row->{$this->field_alias};
|
||||
if (!is_numeric($nid)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Load the specified node:
|
||||
$node = $this->nodes[$nid];
|
||||
if (empty($node)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$data = date_views_fields('node');
|
||||
$info = $data['name'][$this->options['date_field']];
|
||||
$field_name = str_replace(array('_value', '_value2'), '', $info['real_field_name']);
|
||||
$table_name = $info['table_name'];
|
||||
$delta_field = $info['delta_field'];
|
||||
$is_field = $info['is_field'];
|
||||
|
||||
// Identify the field value that matched our query.
|
||||
$item = $node->$field_name;
|
||||
$node->date_id = array();
|
||||
$start = NULL;
|
||||
$end = NULL;
|
||||
if ($is_field) {
|
||||
$lang = $node->language;
|
||||
$delta = isset($row->$delta_field) ? $row->$delta_field : 0;
|
||||
$item = array_key_exists($lang, $item) ? $item[$lang][$delta] : $item['und'][$delta];
|
||||
$node->date_id[] = 'calendar.' . $node->nid . '.' . $field_name . '.' . $delta;
|
||||
|
||||
if (!empty($item['value'])) {
|
||||
$start = new dateObject($item['value'], $item['timezone_db']);
|
||||
if (array_key_exists('value2', $item)) {
|
||||
$end = new dateObject($item['value2'], $item['timezone_db']);
|
||||
}
|
||||
else {
|
||||
$end = clone $start;
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif (!$is_field && !empty($item)) {
|
||||
$start = new dateObject($item, $item['timezone_db']);
|
||||
$end = new dateObject($item, $item['timezone_db']);
|
||||
}
|
||||
|
||||
// Set the item date to the proper display timezone;
|
||||
$start->setTimezone(new dateTimezone($item['timezone']));
|
||||
$end->setTimezone(new dateTimezone($item['timezone']));
|
||||
|
||||
$start_formatted = $start->format(DATE_FORMAT_DATETIME);
|
||||
$end_formatted = $end->format(DATE_FORMAT_DATETIME);
|
||||
|
||||
$all_day = date_is_all_day($start_formatted, $end_formatted, date_granularity_precision($info['granularity']));
|
||||
|
||||
// According to RFC 2445 (clarified in RFC 5545) the DTEND value is
|
||||
// non-inclusive. When it is a DATE rather than a DATETIME, this means
|
||||
// that we should add one day to its value.
|
||||
if ($all_day) {
|
||||
$end->modify("+1 day");
|
||||
}
|
||||
|
||||
// If we don't have an iCal date value, go no further.
|
||||
if (empty($start)) {
|
||||
return;
|
||||
}
|
||||
|
||||
module_load_include('inc', 'date_api', 'date_api_ical');
|
||||
$item_text = '';
|
||||
|
||||
// Create the rendered display using the display settings from the 'iCal' view mode.
|
||||
node_build_content($node, 'ical');
|
||||
|
||||
if (!empty($node->content)) {
|
||||
// We render node contents and force links to be last.
|
||||
$links = drupal_render($node->content['links']);
|
||||
$item_text .= drupal_render($node->content) . $links;
|
||||
}
|
||||
|
||||
$event = array();
|
||||
$event['summary'] = date_ical_escape_text($node->title);
|
||||
$event['all_day'] = $all_day;
|
||||
$event['start'] = $start->format($all_day ? DATE_FORMAT_ICAL_DATE : DATE_FORMAT_ICAL);
|
||||
$event['end'] = $end->format($all_day ? DATE_FORMAT_ICAL_DATE : DATE_FORMAT_ICAL);
|
||||
$event['description'] = date_ical_escape_text($item_text);
|
||||
$event['url'] = url("node/$node->nid", array('absolute' => TRUE));
|
||||
$event['uid'] = !empty($node->date_id) ? $node->date_id[0] : $event['url'];
|
||||
$event['rrule'] = $is_field && array_key_exists('rrule', $item) ? $item['rrule'] : '';
|
||||
|
||||
return theme($this->theme_functions(),
|
||||
array(
|
||||
'view' => $this->view,
|
||||
'options' => $this->options,
|
||||
'event' => $event
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Views style plugin for the Calendar iCal module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Default style plugin to render an iCal feed.
|
||||
*/
|
||||
class calendar_plugin_style_ical extends views_plugin_style_rss {
|
||||
|
||||
function attach_to($display_id, $path, $title) {
|
||||
$display = $this->view->display[$display_id]->handler;
|
||||
$url_options = array();
|
||||
$input = $this->view->get_exposed_input();
|
||||
if ($input) {
|
||||
$url_options['query'] = $input;
|
||||
}
|
||||
$url_options['absolute'] = TRUE;
|
||||
$url = url($this->view->get_url(NULL, $path), $url_options);
|
||||
if (empty($this->preview)) {
|
||||
$this->view->feed_icon = theme('calendar_ical_icon', array('url' => $url, 'title' => $title));
|
||||
drupal_add_html_head_link(array(
|
||||
'rel' => 'alternate',
|
||||
'type' => 'application/calendar',
|
||||
'title' => $title,
|
||||
'href' => $url
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
function options_form(&$form, &$form_state) {
|
||||
parent::options_form($form, $form_state);
|
||||
// Override the text in the RSS description field.
|
||||
$form['description'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('iCal description'),
|
||||
'#default_value' => $this->options['description'],
|
||||
'#description' => t('This will appear in the iCal feed itself.'),
|
||||
);
|
||||
}
|
||||
|
||||
function render() {
|
||||
if (empty($this->row_plugin)) {
|
||||
debug('views_plugin_style_default: Missing row plugin');
|
||||
return;
|
||||
}
|
||||
$rows = '';
|
||||
foreach ($this->view->result as $row_index => $row) {
|
||||
$this->view->row_index = $row_index;
|
||||
$rows .= $this->row_plugin->render($row);
|
||||
}
|
||||
|
||||
$output = theme($this->theme_functions(),
|
||||
array(
|
||||
'view' => $this->view,
|
||||
'options' => $this->options,
|
||||
'rows' => $rows
|
||||
));
|
||||
unset($this->view->row_index);
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
43
sites/all/modules/calendar/calendar_ical/theme.inc
Normal file
43
sites/all/modules/calendar/calendar_ical/theme.inc
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Theme files for Calendar iCal.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Preprocess an iCal feed
|
||||
*/
|
||||
function template_preprocess_calendar_style_ical(&$vars) {
|
||||
global $base_url;
|
||||
global $language;
|
||||
$view = $vars['view'];
|
||||
$view_title = $view->get_title();
|
||||
|
||||
$title = variable_get('site_name', 'Drupal');
|
||||
if ($slogan = variable_get('site_slogan', '')) {
|
||||
$title .= ' - ' . $slogan;
|
||||
}
|
||||
$title .= !empty($view_title) ? ': ' . $view_title : '';
|
||||
|
||||
$vars['title'] = check_plain($title);
|
||||
|
||||
// During live preview we don't want to output the header since the contents
|
||||
// of the feed are being displayed inside a normal HTML page.
|
||||
if (empty($vars['view']->live_preview)) {
|
||||
|
||||
// Keep devel module from appending queries to ical export.
|
||||
$GLOBALS['devel_shutdown'] = FALSE;
|
||||
drupal_add_http_header('Content-Type', 'application/calendar; charset=utf-8');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Default theme function for all iCal rows.
|
||||
*/
|
||||
function template_preprocess_calendar_row_ical_node(&$vars) {
|
||||
$view = &$vars['view'];
|
||||
$options = &$vars['options'];
|
||||
$item = &$vars['row'];
|
||||
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
|
||||
.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;
|
||||
}
|
825
sites/all/modules/calendar/css/calendar-overlap.css
Normal file
825
sites/all/modules/calendar/css/calendar-overlap.css
Normal file
@@ -0,0 +1,825 @@
|
||||
/**
|
||||
* 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 {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
404
sites/all/modules/calendar/css/calendar.css
Normal file
404
sites/all/modules/calendar/css/calendar.css
Normal file
@@ -0,0 +1,404 @@
|
||||
/**
|
||||
* 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 {}
|
879
sites/all/modules/calendar/css/calendar_multiday.css
Normal file
879
sites/all/modules/calendar/css/calendar_multiday.css
Normal file
@@ -0,0 +1,879 @@
|
||||
/**
|
||||
* 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: 14%;
|
||||
}
|
||||
|
||||
.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;
|
||||
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;
|
||||
}
|
||||
|
||||
.date-nav {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
74
sites/all/modules/calendar/includes/calendar.views.inc
Normal file
74
sites/all/modules/calendar/includes/calendar.views.inc
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Creates calendar displays of Views results.
|
||||
*/
|
||||
/**
|
||||
* Implementation of hook_views_plugins
|
||||
*/
|
||||
function calendar_views_plugins() {
|
||||
$views_path = drupal_get_path('module', 'views');
|
||||
$module_path = drupal_get_path('module', 'calendar');
|
||||
$theme_path = $module_path;
|
||||
module_load_include('inc', 'calendar', 'theme/theme');
|
||||
|
||||
// Limit these plugins to base tables that represent entities.
|
||||
$base = array_keys(date_views_base_tables());
|
||||
|
||||
$data = array(
|
||||
'module' => 'calendar', // This just tells our themes are elsewhere.
|
||||
|
||||
'style' => array(
|
||||
'calendar_style' => array(
|
||||
'title' => t('Calendar'),
|
||||
'help' => t('Present view results as a Calendar.'),
|
||||
'handler' => 'calendar_plugin_style',
|
||||
'path' => "$module_path/includes",
|
||||
'theme' => 'calendar_style',
|
||||
'theme file' => 'theme.inc',
|
||||
'theme path' => "$module_path/theme",
|
||||
'additional themes' => array(
|
||||
'calendar_mini' => 'style',
|
||||
'calendar_day' => 'style',
|
||||
'calendar_week' => 'style',
|
||||
'calendar_month' => 'style',
|
||||
'calendar_year' => 'style',
|
||||
'calendar_day_overlap' => 'style',
|
||||
'calendar_week_overlap' => 'style',
|
||||
),
|
||||
'uses fields' => TRUE,
|
||||
'uses grouping' => FALSE,
|
||||
'uses row plugin' => TRUE,
|
||||
'uses options' => TRUE,
|
||||
'type' => 'normal',
|
||||
'even empty' => TRUE,
|
||||
'base' => $base,
|
||||
),
|
||||
),
|
||||
'row' => array(
|
||||
'calendar_node' => array(
|
||||
'title' => t('Calendar Items (DEPRECATED, switch to Calendar Entities)'),
|
||||
'help' => t('Displays each selected node as a Calendar item.'),
|
||||
'handler' => 'calendar_plugin_row_node',
|
||||
'path' => "$module_path/includes",
|
||||
'base' => array('node'), // only works with 'node' as base.
|
||||
'uses options' => TRUE,
|
||||
'uses fields' => TRUE,
|
||||
'type' => 'normal',
|
||||
),
|
||||
'calendar_entity' => array(
|
||||
'title' => t('Calendar Entities'),
|
||||
'help' => t('Displays each selected entity as a Calendar item.'),
|
||||
'handler' => 'calendar_plugin_row',
|
||||
'path' => "$module_path/includes",
|
||||
'base' => $base,
|
||||
'uses options' => TRUE,
|
||||
'uses fields' => TRUE,
|
||||
'type' => 'normal',
|
||||
),
|
||||
),
|
||||
);
|
||||
return $data;
|
||||
}
|
558
sites/all/modules/calendar/includes/calendar.views_default.inc
Normal file
558
sites/all/modules/calendar/includes/calendar.views_default.inc
Normal file
@@ -0,0 +1,558 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Default views for the Calendar module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Set up so it can be used as an API to create default calendars for
|
||||
* specific date fields.
|
||||
*
|
||||
* Use variable_set() to establish criteria for default calendars.
|
||||
* Set the variable in custom modules or in settings.
|
||||
*
|
||||
* Example: Add a new default calendar to custom
|
||||
* calendars that are already configured:
|
||||
*
|
||||
* $options = variable_get('calendar_default_view_options', array());
|
||||
* $option = array(
|
||||
* 'name' => 'example_event',
|
||||
* 'description' => 'An example event calendar for the date field.',
|
||||
* 'path' => 'example_event',
|
||||
* 'types' => array('example_content_type'),
|
||||
* 'date_fields' => array('field_example_date'),
|
||||
* );
|
||||
* $options[] = $option;
|
||||
* variable_set('calendar_default_view_options', $options);
|
||||
*
|
||||
*/
|
||||
function calendar_views_default_views() {
|
||||
$views = array();
|
||||
|
||||
// Construct the default view with default options.
|
||||
$view = calendar_views_construct();
|
||||
$views[$view->name] = $view;
|
||||
|
||||
// Then see if there are any custom calendars to be created
|
||||
// using variable_get().
|
||||
$calendar_options = variable_get('calendar_default_view_options', array());
|
||||
foreach ((array) $calendar_options as $calendar_option) {
|
||||
$view = calendar_views_construct($calendar_option);
|
||||
$views[$view->name] = $view;
|
||||
}
|
||||
return $views;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Construct a default calendar to match specified options.
|
||||
* Views calls it without options, so the basic
|
||||
* default view will use the default values.
|
||||
*
|
||||
* @param $options: an optional array of options to
|
||||
* create default calendars.
|
||||
*
|
||||
* Possible options include:
|
||||
* @param string $name:
|
||||
* The view name, if empty, defaults to 'calendar'.
|
||||
* @param string $description:
|
||||
* The view description, if empty, defaults to generic description.
|
||||
* @param string $path:
|
||||
* The view url, if empty, defaults to 'calendar'.
|
||||
* @param array $types:
|
||||
* Array of content types to limit the calendar to those types.
|
||||
* If empty, defaults to no type filter.
|
||||
* @param array $date_fields:
|
||||
* Date fields used to filter the calendar.
|
||||
* If empty, defaults to array('changed') for node.changed.
|
||||
* @param array $display_fields:
|
||||
* Fields to display in the calendar.
|
||||
* If empty, defaults to title and date fields.
|
||||
*
|
||||
* @return the default calendar array.
|
||||
*/
|
||||
function calendar_views_construct($options = NULL) {
|
||||
$name = NULL;
|
||||
$description = NULL;
|
||||
$path = NULL;
|
||||
$types = NULL;
|
||||
$date_fields = NULL;
|
||||
|
||||
if (empty($options)) {
|
||||
$disabled = TRUE;
|
||||
}
|
||||
else {
|
||||
$disabled = FALSE;
|
||||
extract($options);
|
||||
}
|
||||
if (empty($name)) {
|
||||
$name = 'calendar';
|
||||
}
|
||||
if (empty($description)) {
|
||||
$description = 'A multi-dimensional calendar view with back/next navigation.';
|
||||
}
|
||||
if (empty($path)) {
|
||||
$path = 'calendar';
|
||||
}
|
||||
if (empty($types)) {
|
||||
$types = array();
|
||||
}
|
||||
if (empty($date_fields)) {
|
||||
$date_fields = array('changed');
|
||||
}
|
||||
$colors = array();
|
||||
$date_link_type = '';
|
||||
foreach ($types as $type => $label) {
|
||||
$colors[0][$type] = '#ffffff';
|
||||
$date_link_type = $type;
|
||||
variable_set('calendar_date_link_' . $type, $path . '/month');
|
||||
}
|
||||
|
||||
$type = '';
|
||||
if (!empty($types) && is_array($types) && count($types) > 0 ) {
|
||||
$types = array_keys($types);
|
||||
$type = $types[0];
|
||||
}
|
||||
|
||||
// Can handle core node timestamp fields or Field date fields.
|
||||
|
||||
$aliases = array();
|
||||
foreach ($date_fields as $field_name) {
|
||||
if (substr($field_name, 0, 6) == 'field_') {
|
||||
$table = 'field_data_' . $field_name;
|
||||
$alias = $table . '.' . $field_name . '_value';
|
||||
$cck_field = TRUE;
|
||||
}
|
||||
else {
|
||||
$table = 'node';
|
||||
$alias = $table . '.' . $field_name;
|
||||
$cck_field = FALSE;
|
||||
}
|
||||
$aliases[] = $alias;
|
||||
}
|
||||
|
||||
$view = new view;
|
||||
$view->name = $name;
|
||||
$view->description = t("DEPRECATED: Create new calendars using 'add view from template'.") . ' ' . $description;
|
||||
$view->tag = 'Calendar';
|
||||
$view->base_table = 'node';
|
||||
$view->human_name = ucfirst($name) . ' ' . t("(DEPRECATED)");
|
||||
$view->core = 7;
|
||||
$view->api_version = '3.0-alpha1';
|
||||
$view->disabled = $name == 'calendar' ? TRUE : FALSE; /* Edit this to true to make a default view disabled initially */
|
||||
|
||||
/* Display: Master */
|
||||
$handler = $view->new_display('default', 'Master', 'default');
|
||||
$handler->display->display_options['title'] = $name;
|
||||
$handler->display->display_options['link_display'] = 'page_1';
|
||||
$handler->display->display_options['access']['type'] = 'perm';
|
||||
$handler->display->display_options['cache']['type'] = 'none';
|
||||
$handler->display->display_options['query']['type'] = 'views_query';
|
||||
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
|
||||
$handler->display->display_options['exposed_form']['type'] = 'basic';
|
||||
$handler->display->display_options['pager']['type'] = 'date_views_pager';
|
||||
$handler->display->display_options['pager']['options']['date_id'] = 'month';
|
||||
$handler->display->display_options['pager']['options']['pager_position'] = 'top';
|
||||
$handler->display->display_options['style_plugin'] = 'calendar_style';
|
||||
$handler->display->display_options['style_options']['name_size'] = '3';
|
||||
$handler->display->display_options['style_options']['with_weekno'] = '0';
|
||||
$handler->display->display_options['style_options']['multiday_theme'] = '1';
|
||||
$handler->display->display_options['style_options']['theme_style'] = '1';
|
||||
$handler->display->display_options['style_options']['max_items'] = '0';
|
||||
$handler->display->display_options['row_plugin'] = 'calendar_entity';
|
||||
/* Field: Content: Title */
|
||||
$handler->display->display_options['fields']['title']['id'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['table'] = 'node';
|
||||
$handler->display->display_options['fields']['title']['field'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['label'] = '';
|
||||
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
|
||||
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
|
||||
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
|
||||
$handler->display->display_options['fields']['title']['alter']['external'] = 0;
|
||||
$handler->display->display_options['fields']['title']['alter']['replace_spaces'] = 0;
|
||||
$handler->display->display_options['fields']['title']['alter']['trim_whitespace'] = 0;
|
||||
$handler->display->display_options['fields']['title']['alter']['nl2br'] = 0;
|
||||
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
|
||||
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 0;
|
||||
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
|
||||
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
|
||||
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
|
||||
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
|
||||
$handler->display->display_options['fields']['title']['element_default_classes'] = 1;
|
||||
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
|
||||
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
|
||||
$handler->display->display_options['fields']['title']['hide_alter_empty'] = 0;
|
||||
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
|
||||
/* Field: Content: Datex */
|
||||
|
||||
foreach ($date_fields as $field_name) {
|
||||
if (substr($field_name, 0, 6) == 'field_') {
|
||||
$table = 'field_data_' . $field_name;
|
||||
$cck_field = TRUE;
|
||||
}
|
||||
else {
|
||||
$table = 'node';
|
||||
$cck_field = FALSE;
|
||||
}
|
||||
|
||||
$handler->display->display_options['fields'][$field_name]['id'] = $field_name;
|
||||
$handler->display->display_options['fields'][$field_name]['table'] = $table;
|
||||
$handler->display->display_options['fields'][$field_name]['field'] = $field_name;
|
||||
$handler->display->display_options['fields'][$field_name]['label'] = '';
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['alter_text'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['make_link'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['absolute'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['external'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['replace_spaces'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['trim_whitespace'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['nl2br'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['word_boundary'] = 1;
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['ellipsis'] = 1;
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['strip_tags'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['trim'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['html'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['element_label_colon'] = FALSE;
|
||||
$handler->display->display_options['fields'][$field_name]['element_default_classes'] = 1;
|
||||
$handler->display->display_options['fields'][$field_name]['hide_empty'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['empty_zero'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['hide_alter_empty'] = 0;
|
||||
|
||||
if ($cck_field) {
|
||||
$handler->display->display_options['fields'][$field_name]['settings'] = array(
|
||||
'format_type' => 'short',
|
||||
'fromto' => 'both',
|
||||
'multiple_number' => '',
|
||||
'multiple_from' => '',
|
||||
'multiple_to' => '',
|
||||
'show_repeat_rule' => '',
|
||||
);
|
||||
$handler->display->display_options['fields'][$field_name]['group_rows'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['delta_offset'] = '0';
|
||||
$handler->display->display_options['fields'][$field_name]['delta_reversed'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['field_api_classes'] = 0;
|
||||
|
||||
/* Sort criterion */
|
||||
$handler->display->display_options['sorts'][$field_name . '_value']['id'] = $field_name . '_value';
|
||||
$handler->display->display_options['sorts'][$field_name . '_value']['table'] = $table;
|
||||
$handler->display->display_options['sorts'][$field_name . '_value']['field'] = $field_name . '_value';
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
/* Sort criterion */
|
||||
$handler->display->display_options['sorts'][$field_name]['id'] = $field_name;
|
||||
$handler->display->display_options['sorts'][$field_name]['table'] = $table;
|
||||
$handler->display->display_options['sorts'][$field_name]['field'] = $field_name;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Filter criterion: Content: Published */
|
||||
$handler->display->display_options['filters']['status']['id'] = 'status';
|
||||
$handler->display->display_options['filters']['status']['table'] = 'node';
|
||||
$handler->display->display_options['filters']['status']['field'] = 'status';
|
||||
$handler->display->display_options['filters']['status']['value'] = 1;
|
||||
$handler->display->display_options['filters']['status']['group'] = 0;
|
||||
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
|
||||
|
||||
/* Display: Month */
|
||||
$handler = $view->new_display('page', 'Month', 'page_1');
|
||||
$handler->display->display_options['defaults']['pager'] = FALSE;
|
||||
$handler->display->display_options['pager']['type'] = 'date_views_pager';
|
||||
$handler->display->display_options['pager']['options']['date_id'] = 'month';
|
||||
$handler->display->display_options['pager']['options']['pager_position'] = 'top';
|
||||
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
|
||||
$handler->display->display_options['style_plugin'] = 'calendar_style';
|
||||
$handler->display->display_options['style_options']['calendar_type'] = 'month';
|
||||
$handler->display->display_options['style_options']['name_size'] = '3';
|
||||
$handler->display->display_options['style_options']['mini'] = '0';
|
||||
$handler->display->display_options['style_options']['with_weekno'] = '0';
|
||||
$handler->display->display_options['style_options']['multiday_theme'] = '1';
|
||||
$handler->display->display_options['style_options']['theme_style'] = '1';
|
||||
$handler->display->display_options['style_options']['max_items'] = '0';
|
||||
$handler->display->display_options['defaults']['style_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
|
||||
$handler->display->display_options['row_plugin'] = 'calendar_entity';
|
||||
$handler->display->display_options['row_options']['calendar_date_link'] = $type;
|
||||
$handler->display->display_options['row_options']['colors']['legend'] = 'type';
|
||||
$handler->display->display_options['row_options']['colors']['calendar_colors_type'] = array();
|
||||
$handler->display->display_options['row_options']['colors']['calendar_colors_vocabulary'] = array();
|
||||
$handler->display->display_options['defaults']['row_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['arguments'] = FALSE;
|
||||
/* Contextual filter: Date: Date (node) */
|
||||
$handler->display->display_options['arguments']['date_argument']['id'] = 'date_argument';
|
||||
$handler->display->display_options['arguments']['date_argument']['table'] = 'node';
|
||||
$handler->display->display_options['arguments']['date_argument']['field'] = 'date_argument';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_action'] = 'default';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_argument_type'] = 'date';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_argument_skip_url'] = 0;
|
||||
$handler->display->display_options['arguments']['date_argument']['summary']['format'] = 'default_summary';
|
||||
$handler->display->display_options['arguments']['date_argument']['year_range'] = '-3:+3';
|
||||
$handler->display->display_options['arguments']['date_argument']['granularity'] = 'month';
|
||||
$handler->display->display_options['arguments']['date_argument']['add_delta'] = 'yes';
|
||||
$handler->display->display_options['arguments']['date_argument']['date_fields'] = drupal_map_assoc($aliases);
|
||||
$handler->display->display_options['arguments']['date_argument']['date_method'] = 'OR';
|
||||
$handler->display->display_options['arguments']['date_argument']['date_group'] = 'date';
|
||||
$handler->display->display_options['path'] = $path . '/month';
|
||||
$handler->display->display_options['menu']['title'] = 'Month';
|
||||
$handler->display->display_options['menu']['weight'] = '0';
|
||||
$handler->display->display_options['tab_options']['type'] = 'normal';
|
||||
$handler->display->display_options['tab_options']['title'] = 'Month';
|
||||
$handler->display->display_options['tab_options']['weight'] = '0';
|
||||
|
||||
/* Display: Week */
|
||||
$handler = $view->new_display('page', 'Week', 'page_2');
|
||||
$handler->display->display_options['defaults']['pager'] = FALSE;
|
||||
$handler->display->display_options['pager']['type'] = 'date_views_pager';
|
||||
$handler->display->display_options['pager']['options']['date_id'] = 'week';
|
||||
$handler->display->display_options['pager']['options']['pager_position'] = 'top';
|
||||
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
|
||||
$handler->display->display_options['style_plugin'] = 'calendar_style';
|
||||
$handler->display->display_options['style_options']['calendar_type'] = 'week';
|
||||
$handler->display->display_options['style_options']['name_size'] = '3';
|
||||
$handler->display->display_options['style_options']['mini'] = '0';
|
||||
$handler->display->display_options['style_options']['with_weekno'] = '0';
|
||||
$handler->display->display_options['style_options']['multiday_theme'] = '1';
|
||||
$handler->display->display_options['style_options']['groupby_times'] = 'hour';
|
||||
$handler->display->display_options['style_options']['theme_style'] = '1';
|
||||
$handler->display->display_options['style_options']['max_items'] = '0';
|
||||
$handler->display->display_options['defaults']['style_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
|
||||
$handler->display->display_options['row_plugin'] = 'calendar_entity';
|
||||
$handler->display->display_options['defaults']['row_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['arguments'] = FALSE;
|
||||
/* Contextual filter: Date: Date (node) */
|
||||
$handler->display->display_options['arguments']['date_argument']['id'] = 'date_argument';
|
||||
$handler->display->display_options['arguments']['date_argument']['table'] = 'node';
|
||||
$handler->display->display_options['arguments']['date_argument']['field'] = 'date_argument';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_action'] = 'default';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_argument_type'] = 'date';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_argument_skip_url'] = 0;
|
||||
$handler->display->display_options['arguments']['date_argument']['summary']['format'] = 'default_summary';
|
||||
$handler->display->display_options['arguments']['date_argument']['year_range'] = '-3:+3';
|
||||
$handler->display->display_options['arguments']['date_argument']['granularity'] = 'week';
|
||||
$handler->display->display_options['arguments']['date_argument']['add_delta'] = 'yes';
|
||||
$handler->display->display_options['arguments']['date_argument']['date_fields'] = drupal_map_assoc($aliases);
|
||||
$handler->display->display_options['arguments']['date_argument']['date_method'] = 'OR';
|
||||
$handler->display->display_options['arguments']['date_argument']['date_group'] = 'date';
|
||||
$handler->display->display_options['path'] = $path . '/week';
|
||||
$handler->display->display_options['menu']['title'] = 'Week';
|
||||
$handler->display->display_options['menu']['weight'] = '2';
|
||||
|
||||
/* Display: Day */
|
||||
$handler = $view->new_display('page', 'Day', 'page_3');
|
||||
$handler->display->display_options['defaults']['pager'] = FALSE;
|
||||
$handler->display->display_options['pager']['type'] = 'date_views_pager';
|
||||
$handler->display->display_options['pager']['options']['date_id'] = 'day';
|
||||
$handler->display->display_options['pager']['options']['pager_position'] = 'top';
|
||||
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
|
||||
$handler->display->display_options['style_plugin'] = 'calendar_style';
|
||||
$handler->display->display_options['style_options']['calendar_type'] = 'day';
|
||||
$handler->display->display_options['style_options']['name_size'] = '3';
|
||||
$handler->display->display_options['style_options']['mini'] = '0';
|
||||
$handler->display->display_options['style_options']['with_weekno'] = '0';
|
||||
$handler->display->display_options['style_options']['multiday_theme'] = '1';
|
||||
$handler->display->display_options['style_options']['theme_style'] = '1';
|
||||
$handler->display->display_options['style_options']['max_items'] = '0';
|
||||
$handler->display->display_options['style_options']['groupby_times'] = 'hour';
|
||||
$handler->display->display_options['defaults']['style_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
|
||||
$handler->display->display_options['row_plugin'] = 'calendar_entity';
|
||||
$handler->display->display_options['defaults']['row_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['arguments'] = FALSE;
|
||||
/* Contextual filter: Date: Date (node) */
|
||||
$handler->display->display_options['arguments']['date_argument']['id'] = 'date_argument';
|
||||
$handler->display->display_options['arguments']['date_argument']['table'] = 'node';
|
||||
$handler->display->display_options['arguments']['date_argument']['field'] = 'date_argument';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_action'] = 'default';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_argument_type'] = 'date';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_argument_skip_url'] = 0;
|
||||
$handler->display->display_options['arguments']['date_argument']['summary']['format'] = 'default_summary';
|
||||
$handler->display->display_options['arguments']['date_argument']['year_range'] = '-3:+3';
|
||||
$handler->display->display_options['arguments']['date_argument']['granularity'] = 'day';
|
||||
$handler->display->display_options['arguments']['date_argument']['add_delta'] = '';
|
||||
$handler->display->display_options['arguments']['date_argument']['date_fields'] = drupal_map_assoc($aliases);
|
||||
$handler->display->display_options['arguments']['date_argument']['date_method'] = 'OR';
|
||||
$handler->display->display_options['arguments']['date_argument']['date_group'] = 'date';
|
||||
$handler->display->display_options['path'] = $path . '/day';
|
||||
$handler->display->display_options['menu']['title'] = 'Day';
|
||||
$handler->display->display_options['menu']['weight'] = '3';
|
||||
|
||||
/* Display: Year */
|
||||
$handler = $view->new_display('page', 'Year', 'page');
|
||||
$handler->display->display_options['defaults']['pager'] = FALSE;
|
||||
$handler->display->display_options['pager']['type'] = 'date_views_pager';
|
||||
$handler->display->display_options['pager']['options']['date_id'] = 'year';
|
||||
$handler->display->display_options['pager']['options']['pager_position'] = 'top';
|
||||
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
|
||||
$handler->display->display_options['style_plugin'] = 'calendar_style';
|
||||
$handler->display->display_options['style_options']['calendar_type'] = 'year';
|
||||
$handler->display->display_options['style_options']['name_size'] = '1';
|
||||
$handler->display->display_options['style_options']['mini'] = '0';
|
||||
$handler->display->display_options['style_options']['with_weekno'] = '0';
|
||||
$handler->display->display_options['style_options']['multiday_theme'] = '1';
|
||||
$handler->display->display_options['style_options']['theme_style'] = '1';
|
||||
$handler->display->display_options['style_options']['max_items'] = '0';
|
||||
$handler->display->display_options['defaults']['style_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
|
||||
$handler->display->display_options['row_plugin'] = 'calendar_entity';
|
||||
$handler->display->display_options['defaults']['row_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['arguments'] = FALSE;
|
||||
/* Contextual filter: Date: Date (node) */
|
||||
$handler->display->display_options['arguments']['date_argument']['id'] = 'date_argument';
|
||||
$handler->display->display_options['arguments']['date_argument']['table'] = 'node';
|
||||
$handler->display->display_options['arguments']['date_argument']['field'] = 'date_argument';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_action'] = 'default';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_argument_type'] = 'date';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_argument_skip_url'] = 0;
|
||||
$handler->display->display_options['arguments']['date_argument']['summary']['format'] = 'default_summary';
|
||||
$handler->display->display_options['arguments']['date_argument']['year_range'] = '-3:+3';
|
||||
$handler->display->display_options['arguments']['date_argument']['granularity'] = 'year';
|
||||
$handler->display->display_options['arguments']['date_argument']['add_delta'] = 'yes';
|
||||
$handler->display->display_options['arguments']['date_argument']['date_fields'] = drupal_map_assoc($aliases);
|
||||
$handler->display->display_options['arguments']['date_argument']['date_method'] = 'OR';
|
||||
$handler->display->display_options['arguments']['date_argument']['date_group'] = 'date';
|
||||
$handler->display->display_options['path'] = $path . '/year';
|
||||
$handler->display->display_options['menu']['title'] = 'Year';
|
||||
$handler->display->display_options['menu']['weight'] = '4';
|
||||
|
||||
/* Display: Block */
|
||||
$handler = $view->new_display('block', 'Block', 'block_1');
|
||||
$handler->display->display_options['defaults']['pager'] = FALSE;
|
||||
$handler->display->display_options['pager']['type'] = 'date_views_pager';
|
||||
$handler->display->display_options['pager']['options']['date_id'] = 'mini';
|
||||
$handler->display->display_options['pager']['options']['pager_position'] = 'top';
|
||||
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
|
||||
$handler->display->display_options['style_plugin'] = 'calendar_style';
|
||||
$handler->display->display_options['style_options']['calendar_type'] = 'month';
|
||||
$handler->display->display_options['style_options']['name_size'] = '1';
|
||||
$handler->display->display_options['style_options']['mini'] = '1';
|
||||
$handler->display->display_options['style_options']['with_weekno'] = '0';
|
||||
$handler->display->display_options['style_options']['multiday_theme'] = '1';
|
||||
$handler->display->display_options['style_options']['theme_style'] = '1';
|
||||
$handler->display->display_options['style_options']['max_items'] = '0';
|
||||
$handler->display->display_options['defaults']['style_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
|
||||
$handler->display->display_options['row_plugin'] = 'calendar_entity';
|
||||
$handler->display->display_options['defaults']['row_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['arguments'] = FALSE;
|
||||
/* Contextual filter: Date: Date (node) */
|
||||
$handler->display->display_options['arguments']['date_argument']['id'] = 'date_argument';
|
||||
$handler->display->display_options['arguments']['date_argument']['table'] = 'node';
|
||||
$handler->display->display_options['arguments']['date_argument']['field'] = 'date_argument';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_action'] = 'default';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_argument_type'] = 'date';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_argument_skip_url'] = 0;
|
||||
$handler->display->display_options['arguments']['date_argument']['summary']['format'] = 'default_summary';
|
||||
$handler->display->display_options['arguments']['date_argument']['year_range'] = '-3:+3';
|
||||
$handler->display->display_options['arguments']['date_argument']['granularity'] = 'month';
|
||||
$handler->display->display_options['arguments']['date_argument']['add_delta'] = 'yes';
|
||||
$handler->display->display_options['arguments']['date_argument']['date_fields'] = drupal_map_assoc($aliases);
|
||||
$handler->display->display_options['arguments']['date_argument']['date_method'] = 'OR';
|
||||
$handler->display->display_options['arguments']['date_argument']['date_group'] = 'date';
|
||||
|
||||
if (module_exists('date_ical')) {
|
||||
|
||||
/* Display: iCal */
|
||||
$handler = $view->new_display('feed', 'iCal', 'feed_1');
|
||||
$handler->display->display_options['pager']['type'] = 'some';
|
||||
$handler->display->display_options['style_plugin'] = 'date_ical';
|
||||
$handler->display->display_options['row_plugin'] = 'date_ical';
|
||||
$handler->display->display_options['row_options']['date_field'] = $aliases[0];
|
||||
$handler->display->display_options['defaults']['filters'] = FALSE;
|
||||
/* Filter criterion: Content: Published */
|
||||
$handler->display->display_options['filters']['status']['id'] = 'status';
|
||||
$handler->display->display_options['filters']['status']['table'] = 'node';
|
||||
$handler->display->display_options['filters']['status']['field'] = 'status';
|
||||
$handler->display->display_options['filters']['status']['value'] = 1;
|
||||
$handler->display->display_options['filters']['status']['group'] = 0;
|
||||
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
|
||||
/* Filter criterion: Date: Date (node) */
|
||||
$handler->display->display_options['filters']['date_filter']['id'] = 'date_filter';
|
||||
$handler->display->display_options['filters']['date_filter']['table'] = 'node';
|
||||
$handler->display->display_options['filters']['date_filter']['field'] = 'date_filter';
|
||||
$handler->display->display_options['filters']['date_filter']['operator'] = '>=';
|
||||
$handler->display->display_options['filters']['date_filter']['granularity'] = 'day';
|
||||
$handler->display->display_options['filters']['date_filter']['form_type'] = 'date_select';
|
||||
$handler->display->display_options['filters']['date_filter']['default_date'] = 'now';
|
||||
$handler->display->display_options['filters']['date_filter']['default_to_date'] = '';
|
||||
$handler->display->display_options['filters']['date_filter']['year_range'] = '-3:+3';
|
||||
$handler->display->display_options['filters']['date_filter']['add_delta'] = 'yes';
|
||||
$handler->display->display_options['filters']['date_filter']['date_fields'] = drupal_map_assoc($aliases);
|
||||
$handler->display->display_options['filters']['date_filter']['date_method'] = 'OR';
|
||||
$handler->display->display_options['filters']['date_filter']['date_group'] = 'date';
|
||||
$handler->display->display_options['path'] = $path . '/ical/%/calendar.ics';
|
||||
$handler->display->display_options['displays'] = array(
|
||||
'page' => 'page',
|
||||
'page_1' => 'page_1',
|
||||
'page_2' => 'page_2',
|
||||
'page_3' => 'page_3',
|
||||
'block_1' => 'block_1',
|
||||
'default' => 0,
|
||||
);
|
||||
|
||||
} // End if module_exists()
|
||||
|
||||
/* Display: Upcoming */
|
||||
$handler = $view->new_display('block', 'Upcoming', 'block_2');
|
||||
$handler->display->display_options['display_description'] = 'Upcoming events block';
|
||||
$handler->display->display_options['defaults']['pager'] = FALSE;
|
||||
$handler->display->display_options['pager']['type'] = 'some';
|
||||
$handler->display->display_options['pager']['options']['items_per_page'] = '5';
|
||||
$handler->display->display_options['pager']['options']['offset'] = '0';
|
||||
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
|
||||
$handler->display->display_options['style_plugin'] = 'list';
|
||||
$handler->display->display_options['defaults']['style_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
|
||||
$handler->display->display_options['row_plugin'] = 'fields';
|
||||
$handler->display->display_options['row_options']['links'] = 1;
|
||||
$handler->display->display_options['row_options']['comments'] = 0;
|
||||
$handler->display->display_options['defaults']['row_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['filters'] = FALSE;
|
||||
/* Filter criterion: Content: Published */
|
||||
$handler->display->display_options['filters']['status']['id'] = 'status';
|
||||
$handler->display->display_options['filters']['status']['table'] = 'node';
|
||||
$handler->display->display_options['filters']['status']['field'] = 'status';
|
||||
$handler->display->display_options['filters']['status']['value'] = 1;
|
||||
$handler->display->display_options['filters']['status']['group'] = 0;
|
||||
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
|
||||
/* Filter criterion: Date: Date (node) */
|
||||
$handler->display->display_options['filters']['date_filter']['id'] = 'date_filter';
|
||||
$handler->display->display_options['filters']['date_filter']['table'] = 'node';
|
||||
$handler->display->display_options['filters']['date_filter']['field'] = 'date_filter';
|
||||
$handler->display->display_options['filters']['date_filter']['operator'] = '>=';
|
||||
$handler->display->display_options['filters']['date_filter']['granularity'] = 'day';
|
||||
$handler->display->display_options['filters']['date_filter']['form_type'] = 'date_select';
|
||||
$handler->display->display_options['filters']['date_filter']['default_date'] = 'now';
|
||||
$handler->display->display_options['filters']['date_filter']['default_to_date'] = '';
|
||||
$handler->display->display_options['filters']['date_filter']['year_range'] = '-3:+3';
|
||||
$handler->display->display_options['filters']['date_filter']['add_delta'] = 'yes';
|
||||
$handler->display->display_options['filters']['date_filter']['date_fields'] = drupal_map_assoc($aliases);
|
||||
$handler->display->display_options['filters']['date_filter']['date_method'] = 'OR';
|
||||
$handler->display->display_options['filters']['date_filter']['date_group'] = 'date';
|
||||
$translatables[$name] = array(
|
||||
t('Master'),
|
||||
t($name),
|
||||
t('more'),
|
||||
t('Apply'),
|
||||
t('Reset'),
|
||||
t('Sort by'),
|
||||
t('Asc'),
|
||||
t('Desc'),
|
||||
t('Year'),
|
||||
t('All'),
|
||||
t('Month'),
|
||||
t('Week'),
|
||||
t('Day'),
|
||||
t('Block'),
|
||||
t('iCal'),
|
||||
t('Upcoming'),
|
||||
t('Upcoming events block'),
|
||||
);
|
||||
|
||||
|
||||
return $view;
|
||||
|
||||
}
|
614
sites/all/modules/calendar/includes/calendar.views_template.inc
Normal file
614
sites/all/modules/calendar/includes/calendar.views_template.inc
Normal file
@@ -0,0 +1,614 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* View templates for the Calendar module.
|
||||
*
|
||||
* Create calendar templates for every date field in the system.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_views_templates().
|
||||
*
|
||||
*/
|
||||
function calendar_views_templates() {
|
||||
|
||||
$views = array();
|
||||
|
||||
// Map the base tables to entity types.
|
||||
$entity_info = entity_get_info();
|
||||
$base_tables = date_views_base_tables();
|
||||
|
||||
// Find all the date fields we know about.
|
||||
|
||||
$processed = array();
|
||||
|
||||
foreach ($entity_info as $entity_type => $info) {
|
||||
if (!$info['fieldable']) {
|
||||
continue;
|
||||
}
|
||||
$items = field_info_instances($entity_type);
|
||||
$views_fields = date_views_fields($info['base table']);
|
||||
foreach ($views_fields['name'] as $name => $data) {
|
||||
|
||||
// For each of the Field date fields, we need to find the bundle and entities this field is used on.
|
||||
if ($data['is_field']) {
|
||||
foreach ($items as $bundle => $widgets) {
|
||||
foreach ($widgets as $field_name => $widget) {
|
||||
$field = field_info_field($field_name);
|
||||
|
||||
// See if this is a date field. Since fields might be shared
|
||||
// across bundles, make sure we haven't already processed this field.
|
||||
$alias = 'field_data_' . $field_name . '.' . $field_name . '_value';
|
||||
if ($alias == $name && !in_array($alias, $processed)) {
|
||||
$base_table = $base_tables[$entity_type];
|
||||
$calendar_option = array(
|
||||
'name' => 'calendar_' . $field_name,
|
||||
'description' => t("A calendar view of the '@field_name' field in the '@base_table' base table.", array('@base_table' => $base_table, '@field_name' => $field_name)),
|
||||
'path' => 'calendar-' . str_replace('_', '-', $field_name),
|
||||
'base_table' => $base_table,
|
||||
'field_name' => $field_name,
|
||||
);
|
||||
$view = calendar_views_template_construct($calendar_option);
|
||||
$views[$view->name] = $view;
|
||||
$processed[] = $alias;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// For other date fields, we infer the entity type from the base table.
|
||||
else {
|
||||
$parts = explode('.', $name);
|
||||
$base_table = $parts[0];
|
||||
$field_name = $parts[1];
|
||||
$calendar_option = array(
|
||||
'name' => 'calendar_' . $entity_type . '_' . $field_name,
|
||||
'description' => t("A calendar view of the '@field_name' field in the '@base_table' base table.", array('@base_table' => $base_table, '@field_name' => $field_name)),
|
||||
'path' => 'calendar-' . str_replace('_', '-', $field_name),
|
||||
'base_table' => $base_table,
|
||||
'field_name' => $field_name,
|
||||
);
|
||||
$view = calendar_views_template_construct($calendar_option);
|
||||
$views[$view->name] = $view;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $views;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to construct a calendar template from an array of values.
|
||||
*
|
||||
* @param $options:
|
||||
* An array of options to create calendar templates.
|
||||
*
|
||||
* Possible options include:
|
||||
* @param string $base_table:
|
||||
* The base table for the view.
|
||||
* @param string $name:
|
||||
* The view name.
|
||||
* @param string $description:
|
||||
* The view description.
|
||||
* @param string $path:
|
||||
* The view url, if empty, defaults to 'calendar'.
|
||||
* @param string $bundle:
|
||||
* The bundle for this calendar.
|
||||
* @param string $field_name:
|
||||
* Date field used to filter the calendar.
|
||||
*
|
||||
* @return the default template array.
|
||||
*/
|
||||
function calendar_views_template_construct($options = NULL) {
|
||||
|
||||
$name = $options['name'];
|
||||
$description = $options['description'];
|
||||
$path = $options['path'];
|
||||
$base_table = $options['base_table'];
|
||||
$field_name = $options['field_name'];
|
||||
|
||||
$colors = array();
|
||||
|
||||
if (substr($field_name, 0, 6) == 'field_') {
|
||||
$table = 'field_data_' . $field_name;
|
||||
$alias = $table . '.' . $field_name . '_value';
|
||||
$is_field = TRUE;
|
||||
}
|
||||
else {
|
||||
$table = $base_table;
|
||||
$alias = $table . '.' . $field_name;
|
||||
$is_field = FALSE;
|
||||
}
|
||||
$aliases = array($alias => $alias);
|
||||
|
||||
$view = new view;
|
||||
$view->name = $name;
|
||||
$view->description = $description;
|
||||
$view->tag = 'Calendar';
|
||||
$view->base_table = $base_table;
|
||||
$view->human_name = t("Calendar");
|
||||
$view->core = 7;
|
||||
$view->api_version = '3.0';
|
||||
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
|
||||
|
||||
/* Display: Master */
|
||||
|
||||
$handler = $view->new_display('default', 'Master', 'default');
|
||||
$handler->display->display_options['title'] = '';
|
||||
$handler->display->display_options['link_display'] = 'page_1';
|
||||
$handler->display->display_options['access']['type'] = 'perm';
|
||||
$handler->display->display_options['cache']['type'] = 'none';
|
||||
$handler->display->display_options['query']['type'] = 'views_query';
|
||||
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
|
||||
$handler->display->display_options['exposed_form']['type'] = 'basic';
|
||||
$handler->display->display_options['pager']['type'] = 'date_views_pager';
|
||||
$handler->display->display_options['pager']['options']['date_id'] = 'month';
|
||||
$handler->display->display_options['pager']['options']['pager_position'] = 'top';
|
||||
$handler->display->display_options['style_plugin'] = 'calendar_style';
|
||||
$handler->display->display_options['style_options']['name_size'] = '3';
|
||||
$handler->display->display_options['style_options']['with_weekno'] = '0';
|
||||
$handler->display->display_options['style_options']['multiday_theme'] = '1';
|
||||
$handler->display->display_options['style_options']['theme_style'] = '1';
|
||||
$handler->display->display_options['style_options']['max_items'] = '0';
|
||||
$handler->display->display_options['row_plugin'] = 'calendar_entity';
|
||||
|
||||
/* Field: Title */
|
||||
|
||||
switch ($base_table) {
|
||||
|
||||
case 'node':
|
||||
case 'node_revision':
|
||||
$handler->display->display_options['fields']['title']['id'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['table'] = $base_table;
|
||||
$handler->display->display_options['fields']['title']['field'] = 'title';
|
||||
$handler->display->display_options['fields']['title']['label'] = '';
|
||||
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
|
||||
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
|
||||
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
|
||||
$handler->display->display_options['fields']['title']['alter']['external'] = 0;
|
||||
$handler->display->display_options['fields']['title']['alter']['replace_spaces'] = 0;
|
||||
$handler->display->display_options['fields']['title']['alter']['trim_whitespace'] = 0;
|
||||
$handler->display->display_options['fields']['title']['alter']['nl2br'] = 0;
|
||||
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
|
||||
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 0;
|
||||
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
|
||||
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
|
||||
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
|
||||
$handler->display->display_options['fields']['title']['element_label_colon'] = FALSE;
|
||||
$handler->display->display_options['fields']['title']['element_default_classes'] = 1;
|
||||
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
|
||||
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
|
||||
$handler->display->display_options['fields']['title']['hide_alter_empty'] = 0;
|
||||
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
|
||||
break;
|
||||
|
||||
case 'users':
|
||||
$handler->display->display_options['fields']['name']['id'] = 'name';
|
||||
$handler->display->display_options['fields']['name']['table'] = 'users';
|
||||
$handler->display->display_options['fields']['name']['field'] = 'name';
|
||||
$handler->display->display_options['fields']['name']['label'] = '';
|
||||
$handler->display->display_options['fields']['name']['alter']['alter_text'] = 0;
|
||||
$handler->display->display_options['fields']['name']['alter']['make_link'] = 0;
|
||||
$handler->display->display_options['fields']['name']['alter']['absolute'] = 0;
|
||||
$handler->display->display_options['fields']['name']['alter']['word_boundary'] = 0;
|
||||
$handler->display->display_options['fields']['name']['alter']['ellipsis'] = 0;
|
||||
$handler->display->display_options['fields']['name']['alter']['strip_tags'] = 0;
|
||||
$handler->display->display_options['fields']['name']['alter']['trim'] = 0;
|
||||
$handler->display->display_options['fields']['name']['alter']['html'] = 0;
|
||||
$handler->display->display_options['fields']['name']['hide_empty'] = 0;
|
||||
$handler->display->display_options['fields']['name']['empty_zero'] = 0;
|
||||
$handler->display->display_options['fields']['name']['link_to_user'] = 1;
|
||||
$handler->display->display_options['fields']['name']['overwrite_anonymous'] = 0;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
/* Date Field */
|
||||
|
||||
$handler->display->display_options['fields'][$field_name]['id'] = $field_name;
|
||||
$handler->display->display_options['fields'][$field_name]['table'] = $table;
|
||||
$handler->display->display_options['fields'][$field_name]['field'] = $field_name;
|
||||
$handler->display->display_options['fields'][$field_name]['label'] = '';
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['alter_text'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['make_link'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['absolute'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['external'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['replace_spaces'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['trim_whitespace'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['nl2br'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['word_boundary'] = 1;
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['ellipsis'] = 1;
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['strip_tags'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['trim'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['alter']['html'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['element_label_colon'] = FALSE;
|
||||
$handler->display->display_options['fields'][$field_name]['element_default_classes'] = 1;
|
||||
$handler->display->display_options['fields'][$field_name]['hide_empty'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['empty_zero'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['hide_alter_empty'] = 0;
|
||||
|
||||
if ($is_field) {
|
||||
$handler->display->display_options['fields'][$field_name]['settings'] = array(
|
||||
'format_type' => 'short',
|
||||
'fromto' => 'both',
|
||||
'multiple_number' => '',
|
||||
'multiple_from' => '',
|
||||
'multiple_to' => '',
|
||||
'show_repeat_rule' => '',
|
||||
);
|
||||
$handler->display->display_options['fields'][$field_name]['group_rows'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['delta_offset'] = '0';
|
||||
$handler->display->display_options['fields'][$field_name]['delta_reversed'] = 0;
|
||||
$handler->display->display_options['fields'][$field_name]['field_api_classes'] = 0;
|
||||
|
||||
/* Sort criterion */
|
||||
$handler->display->display_options['sorts'][$field_name . '_value']['id'] = $field_name . '_value';
|
||||
$handler->display->display_options['sorts'][$field_name . '_value']['table'] = $table;
|
||||
$handler->display->display_options['sorts'][$field_name . '_value']['field'] = $field_name . '_value';
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
/* Sort criterion */
|
||||
$handler->display->display_options['sorts'][$field_name]['id'] = $field_name;
|
||||
$handler->display->display_options['sorts'][$field_name]['table'] = $table;
|
||||
$handler->display->display_options['sorts'][$field_name]['field'] = $field_name;
|
||||
|
||||
}
|
||||
|
||||
/* Filter criterion: Content: Published */
|
||||
|
||||
switch ($base_table) {
|
||||
|
||||
case 'node':
|
||||
|
||||
$handler->display->display_options['filters']['status']['id'] = 'status';
|
||||
$handler->display->display_options['filters']['status']['table'] = $base_table;
|
||||
$handler->display->display_options['filters']['status']['field'] = 'status';
|
||||
$handler->display->display_options['filters']['status']['value'] = 1;
|
||||
$handler->display->display_options['filters']['status']['group'] = 0;
|
||||
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Display: Month */
|
||||
|
||||
$handler = $view->new_display('page', 'Month', 'page_1');
|
||||
$handler->display->display_options['defaults']['pager'] = FALSE;
|
||||
$handler->display->display_options['pager']['type'] = 'date_views_pager';
|
||||
$handler->display->display_options['pager']['options']['date_id'] = 'month';
|
||||
$handler->display->display_options['pager']['options']['pager_position'] = 'top';
|
||||
$handler->display->display_options['pager']['options']['link_format'] = 'clean';
|
||||
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
|
||||
$handler->display->display_options['style_plugin'] = 'calendar_style';
|
||||
$handler->display->display_options['style_options']['calendar_type'] = 'month';
|
||||
$handler->display->display_options['style_options']['name_size'] = '3';
|
||||
$handler->display->display_options['style_options']['mini'] = '0';
|
||||
$handler->display->display_options['style_options']['with_weekno'] = '0';
|
||||
$handler->display->display_options['style_options']['multiday_theme'] = '1';
|
||||
$handler->display->display_options['style_options']['theme_style'] = '1';
|
||||
$handler->display->display_options['style_options']['max_items'] = '0';
|
||||
$handler->display->display_options['defaults']['style_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
|
||||
$handler->display->display_options['row_plugin'] = 'calendar_entity';
|
||||
$handler->display->display_options['row_options']['calendar_date_link'] = '';
|
||||
$handler->display->display_options['row_options']['colors']['legend'] = 'type';
|
||||
$handler->display->display_options['row_options']['colors']['calendar_colors_type'] = array();
|
||||
$handler->display->display_options['row_options']['colors']['calendar_colors_vocabulary'] = array();
|
||||
$handler->display->display_options['defaults']['row_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['arguments'] = FALSE;
|
||||
|
||||
/* Contextual filter: Date */
|
||||
|
||||
$handler->display->display_options['arguments']['date_argument']['id'] = 'date_argument';
|
||||
$handler->display->display_options['arguments']['date_argument']['table'] = $base_table;
|
||||
$handler->display->display_options['arguments']['date_argument']['field'] = 'date_argument';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_action'] = 'default';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_argument_type'] = 'date';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_argument_skip_url'] = 0;
|
||||
$handler->display->display_options['arguments']['date_argument']['summary']['format'] = 'default_summary';
|
||||
$handler->display->display_options['arguments']['date_argument']['year_range'] = '-3:+3';
|
||||
$handler->display->display_options['arguments']['date_argument']['granularity'] = 'month';
|
||||
$handler->display->display_options['arguments']['date_argument']['add_delta'] = 'yes';
|
||||
$handler->display->display_options['arguments']['date_argument']['date_fields'] = $aliases;
|
||||
$handler->display->display_options['arguments']['date_argument']['date_method'] = 'OR';
|
||||
$handler->display->display_options['arguments']['date_argument']['date_group'] = 'date';
|
||||
$handler->display->display_options['path'] = $path . '/month';
|
||||
$handler->display->display_options['menu']['title'] = 'Month';
|
||||
$handler->display->display_options['menu']['weight'] = '0';
|
||||
$handler->display->display_options['tab_options']['type'] = 'normal';
|
||||
$handler->display->display_options['tab_options']['title'] = 'Month';
|
||||
$handler->display->display_options['tab_options']['weight'] = '0';
|
||||
|
||||
/* Display: Week */
|
||||
|
||||
$handler = $view->new_display('page', 'Week', 'page_2');
|
||||
$handler->display->display_options['defaults']['pager'] = FALSE;
|
||||
$handler->display->display_options['pager']['type'] = 'date_views_pager';
|
||||
$handler->display->display_options['pager']['options']['date_id'] = 'week';
|
||||
$handler->display->display_options['pager']['options']['pager_position'] = 'top';
|
||||
$handler->display->display_options['pager']['options']['link_format'] = 'clean';
|
||||
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
|
||||
$handler->display->display_options['style_plugin'] = 'calendar_style';
|
||||
$handler->display->display_options['style_options']['calendar_type'] = 'week';
|
||||
$handler->display->display_options['style_options']['name_size'] = '3';
|
||||
$handler->display->display_options['style_options']['mini'] = '0';
|
||||
$handler->display->display_options['style_options']['with_weekno'] = '0';
|
||||
$handler->display->display_options['style_options']['multiday_theme'] = '1';
|
||||
$handler->display->display_options['style_options']['groupby_times'] = 'hour';
|
||||
$handler->display->display_options['style_options']['theme_style'] = '1';
|
||||
$handler->display->display_options['style_options']['max_items'] = '0';
|
||||
$handler->display->display_options['defaults']['style_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
|
||||
$handler->display->display_options['row_plugin'] = 'calendar_entity';
|
||||
$handler->display->display_options['defaults']['row_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['arguments'] = FALSE;
|
||||
|
||||
/* Contextual filter: Date */
|
||||
|
||||
$handler->display->display_options['arguments']['date_argument']['id'] = 'date_argument';
|
||||
$handler->display->display_options['arguments']['date_argument']['table'] = $base_table;
|
||||
$handler->display->display_options['arguments']['date_argument']['field'] = 'date_argument';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_action'] = 'default';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_argument_type'] = 'date';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_argument_skip_url'] = 0;
|
||||
$handler->display->display_options['arguments']['date_argument']['summary']['format'] = 'default_summary';
|
||||
$handler->display->display_options['arguments']['date_argument']['year_range'] = '-3:+3';
|
||||
$handler->display->display_options['arguments']['date_argument']['granularity'] = 'week';
|
||||
$handler->display->display_options['arguments']['date_argument']['add_delta'] = 'yes';
|
||||
$handler->display->display_options['arguments']['date_argument']['date_fields'] = $aliases;
|
||||
$handler->display->display_options['arguments']['date_argument']['date_method'] = 'OR';
|
||||
$handler->display->display_options['arguments']['date_argument']['date_group'] = 'date';
|
||||
$handler->display->display_options['path'] = $path . '/week';
|
||||
$handler->display->display_options['menu']['title'] = 'Week';
|
||||
$handler->display->display_options['menu']['weight'] = '2';
|
||||
|
||||
/* Display: Day */
|
||||
|
||||
$handler = $view->new_display('page', 'Day', 'page_3');
|
||||
$handler->display->display_options['defaults']['pager'] = FALSE;
|
||||
$handler->display->display_options['pager']['type'] = 'date_views_pager';
|
||||
$handler->display->display_options['pager']['options']['date_id'] = 'day';
|
||||
$handler->display->display_options['pager']['options']['pager_position'] = 'top';
|
||||
$handler->display->display_options['pager']['options']['link_format'] = 'clean';
|
||||
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
|
||||
$handler->display->display_options['style_plugin'] = 'calendar_style';
|
||||
$handler->display->display_options['style_options']['calendar_type'] = 'day';
|
||||
$handler->display->display_options['style_options']['name_size'] = '3';
|
||||
$handler->display->display_options['style_options']['mini'] = '0';
|
||||
$handler->display->display_options['style_options']['with_weekno'] = '0';
|
||||
$handler->display->display_options['style_options']['multiday_theme'] = '1';
|
||||
$handler->display->display_options['style_options']['theme_style'] = '1';
|
||||
$handler->display->display_options['style_options']['max_items'] = '0';
|
||||
$handler->display->display_options['style_options']['groupby_times'] = 'hour';
|
||||
$handler->display->display_options['defaults']['style_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
|
||||
$handler->display->display_options['row_plugin'] = 'calendar_entity';
|
||||
$handler->display->display_options['defaults']['row_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['arguments'] = FALSE;
|
||||
|
||||
/* Contextual filter: Date */
|
||||
|
||||
$handler->display->display_options['arguments']['date_argument']['id'] = 'date_argument';
|
||||
$handler->display->display_options['arguments']['date_argument']['table'] = $base_table;
|
||||
$handler->display->display_options['arguments']['date_argument']['field'] = 'date_argument';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_action'] = 'default';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_argument_type'] = 'date';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_argument_skip_url'] = 0;
|
||||
$handler->display->display_options['arguments']['date_argument']['summary']['format'] = 'default_summary';
|
||||
$handler->display->display_options['arguments']['date_argument']['year_range'] = '-3:+3';
|
||||
$handler->display->display_options['arguments']['date_argument']['granularity'] = 'day';
|
||||
$handler->display->display_options['arguments']['date_argument']['add_delta'] = '';
|
||||
$handler->display->display_options['arguments']['date_argument']['date_fields'] = $aliases;
|
||||
$handler->display->display_options['arguments']['date_argument']['date_method'] = 'OR';
|
||||
$handler->display->display_options['arguments']['date_argument']['date_group'] = 'date';
|
||||
$handler->display->display_options['path'] = $path . '/day';
|
||||
$handler->display->display_options['menu']['title'] = 'Day';
|
||||
$handler->display->display_options['menu']['weight'] = '3';
|
||||
|
||||
/* Display: Year */
|
||||
|
||||
$handler = $view->new_display('page', 'Year', 'page');
|
||||
$handler->display->display_options['defaults']['pager'] = FALSE;
|
||||
$handler->display->display_options['pager']['type'] = 'date_views_pager';
|
||||
$handler->display->display_options['pager']['options']['date_id'] = 'year';
|
||||
$handler->display->display_options['pager']['options']['pager_position'] = 'top';
|
||||
$handler->display->display_options['pager']['options']['link_format'] = 'clean';
|
||||
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
|
||||
$handler->display->display_options['style_plugin'] = 'calendar_style';
|
||||
$handler->display->display_options['style_options']['calendar_type'] = 'year';
|
||||
$handler->display->display_options['style_options']['name_size'] = '1';
|
||||
$handler->display->display_options['style_options']['mini'] = '0';
|
||||
$handler->display->display_options['style_options']['with_weekno'] = '0';
|
||||
$handler->display->display_options['style_options']['multiday_theme'] = '1';
|
||||
$handler->display->display_options['style_options']['theme_style'] = '1';
|
||||
$handler->display->display_options['style_options']['max_items'] = '0';
|
||||
$handler->display->display_options['defaults']['style_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
|
||||
$handler->display->display_options['row_plugin'] = 'calendar_entity';
|
||||
$handler->display->display_options['defaults']['row_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['arguments'] = FALSE;
|
||||
|
||||
/* Contextual filter: Date */
|
||||
|
||||
$handler->display->display_options['arguments']['date_argument']['id'] = 'date_argument';
|
||||
$handler->display->display_options['arguments']['date_argument']['table'] = $base_table;
|
||||
$handler->display->display_options['arguments']['date_argument']['field'] = 'date_argument';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_action'] = 'default';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_argument_type'] = 'date';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_argument_skip_url'] = 0;
|
||||
$handler->display->display_options['arguments']['date_argument']['summary']['format'] = 'default_summary';
|
||||
$handler->display->display_options['arguments']['date_argument']['year_range'] = '-3:+3';
|
||||
$handler->display->display_options['arguments']['date_argument']['granularity'] = 'year';
|
||||
$handler->display->display_options['arguments']['date_argument']['add_delta'] = 'yes';
|
||||
$handler->display->display_options['arguments']['date_argument']['date_fields'] = $aliases;
|
||||
$handler->display->display_options['arguments']['date_argument']['date_method'] = 'OR';
|
||||
$handler->display->display_options['arguments']['date_argument']['date_group'] = 'date';
|
||||
$handler->display->display_options['path'] = $path . '/year';
|
||||
$handler->display->display_options['menu']['title'] = 'Year';
|
||||
$handler->display->display_options['menu']['weight'] = '4';
|
||||
|
||||
/* Display: Block */
|
||||
|
||||
$handler = $view->new_display('block', 'Block', 'block_1');
|
||||
$handler->display->display_options['defaults']['pager'] = FALSE;
|
||||
$handler->display->display_options['pager']['type'] = 'date_views_pager';
|
||||
$handler->display->display_options['pager']['options']['date_id'] = 'mini';
|
||||
$handler->display->display_options['pager']['options']['pager_position'] = 'top';
|
||||
$handler->display->display_options['pager']['options']['link_format'] = 'clean';
|
||||
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
|
||||
$handler->display->display_options['style_plugin'] = 'calendar_style';
|
||||
$handler->display->display_options['style_options']['calendar_type'] = 'month';
|
||||
$handler->display->display_options['style_options']['name_size'] = '1';
|
||||
$handler->display->display_options['style_options']['mini'] = '1';
|
||||
$handler->display->display_options['style_options']['with_weekno'] = '0';
|
||||
$handler->display->display_options['style_options']['multiday_theme'] = '1';
|
||||
$handler->display->display_options['style_options']['theme_style'] = '1';
|
||||
$handler->display->display_options['style_options']['max_items'] = '0';
|
||||
$handler->display->display_options['defaults']['style_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
|
||||
$handler->display->display_options['row_plugin'] = 'calendar_entity';
|
||||
$handler->display->display_options['defaults']['row_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['arguments'] = FALSE;
|
||||
|
||||
/* Contextual filter: Date */
|
||||
|
||||
$handler->display->display_options['arguments']['date_argument']['id'] = 'date_argument';
|
||||
$handler->display->display_options['arguments']['date_argument']['table'] = $base_table;
|
||||
$handler->display->display_options['arguments']['date_argument']['field'] = 'date_argument';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_action'] = 'default';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_argument_type'] = 'date';
|
||||
$handler->display->display_options['arguments']['date_argument']['default_argument_skip_url'] = 0;
|
||||
$handler->display->display_options['arguments']['date_argument']['summary']['format'] = 'default_summary';
|
||||
$handler->display->display_options['arguments']['date_argument']['year_range'] = '-3:+3';
|
||||
$handler->display->display_options['arguments']['date_argument']['granularity'] = 'month';
|
||||
$handler->display->display_options['arguments']['date_argument']['add_delta'] = 'yes';
|
||||
$handler->display->display_options['arguments']['date_argument']['date_fields'] = $aliases;
|
||||
$handler->display->display_options['arguments']['date_argument']['date_method'] = 'OR';
|
||||
$handler->display->display_options['arguments']['date_argument']['date_group'] = 'date';
|
||||
|
||||
if (module_exists('date_ical')) {
|
||||
|
||||
/* Display: iCal */
|
||||
|
||||
$handler = $view->new_display('feed', 'iCal', 'feed_1');
|
||||
$handler->display->display_options['pager']['type'] = 'some';
|
||||
$handler->display->display_options['style_plugin'] = 'date_ical';
|
||||
$handler->display->display_options['row_plugin'] = 'date_ical';
|
||||
$handler->display->display_options['row_options']['date_field'] = $alias;
|
||||
$handler->display->display_options['defaults']['filters'] = FALSE;
|
||||
|
||||
/* Filter criterion: Content: Published */
|
||||
|
||||
switch ($base_table) {
|
||||
|
||||
case 'node':
|
||||
$handler->display->display_options['filters']['status']['id'] = 'status';
|
||||
$handler->display->display_options['filters']['status']['table'] = $base_table;
|
||||
$handler->display->display_options['filters']['status']['field'] = 'status';
|
||||
$handler->display->display_options['filters']['status']['value'] = 1;
|
||||
$handler->display->display_options['filters']['status']['group'] = 0;
|
||||
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Filter criterion: Date */
|
||||
|
||||
$handler->display->display_options['filters']['date_filter']['id'] = 'date_filter';
|
||||
$handler->display->display_options['filters']['date_filter']['table'] = $base_table;
|
||||
$handler->display->display_options['filters']['date_filter']['field'] = 'date_filter';
|
||||
$handler->display->display_options['filters']['date_filter']['operator'] = '>=';
|
||||
$handler->display->display_options['filters']['date_filter']['granularity'] = 'day';
|
||||
$handler->display->display_options['filters']['date_filter']['form_type'] = 'date_select';
|
||||
$handler->display->display_options['filters']['date_filter']['default_date'] = 'now';
|
||||
$handler->display->display_options['filters']['date_filter']['default_to_date'] = '';
|
||||
$handler->display->display_options['filters']['date_filter']['year_range'] = '-3:+3';
|
||||
$handler->display->display_options['filters']['date_filter']['add_delta'] = 'yes';
|
||||
$handler->display->display_options['filters']['date_filter']['date_fields'] = $aliases;
|
||||
$handler->display->display_options['filters']['date_filter']['date_method'] = 'OR';
|
||||
$handler->display->display_options['filters']['date_filter']['date_group'] = 'date';
|
||||
$handler->display->display_options['path'] = $path . '/ical/%/calendar.ics';
|
||||
$handler->display->display_options['displays'] = array(
|
||||
'page' => 'page',
|
||||
'page_1' => 'page_1',
|
||||
'page_2' => 'page_2',
|
||||
'page_3' => 'page_3',
|
||||
'block_1' => 'block_1',
|
||||
'default' => 0,
|
||||
);
|
||||
|
||||
} // End if module_exists()
|
||||
|
||||
/* Display: Upcoming */
|
||||
|
||||
$handler = $view->new_display('block', 'Upcoming', 'block_2');
|
||||
$handler->display->display_options['display_description'] = 'Upcoming events block';
|
||||
$handler->display->display_options['defaults']['pager'] = FALSE;
|
||||
$handler->display->display_options['pager']['type'] = 'some';
|
||||
$handler->display->display_options['pager']['options']['items_per_page'] = '5';
|
||||
$handler->display->display_options['pager']['options']['offset'] = '0';
|
||||
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
|
||||
$handler->display->display_options['style_plugin'] = 'list';
|
||||
$handler->display->display_options['defaults']['style_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
|
||||
$handler->display->display_options['row_plugin'] = 'fields';
|
||||
$handler->display->display_options['row_options']['links'] = 1;
|
||||
$handler->display->display_options['row_options']['comments'] = 0;
|
||||
$handler->display->display_options['defaults']['row_options'] = FALSE;
|
||||
$handler->display->display_options['defaults']['filters'] = FALSE;
|
||||
|
||||
/* Filter criterion: Content: Published */
|
||||
|
||||
switch ($base_table) {
|
||||
|
||||
case 'node':
|
||||
|
||||
$handler->display->display_options['filters']['status']['id'] = 'status';
|
||||
$handler->display->display_options['filters']['status']['table'] = $base_table;
|
||||
$handler->display->display_options['filters']['status']['field'] = 'status';
|
||||
$handler->display->display_options['filters']['status']['value'] = 1;
|
||||
$handler->display->display_options['filters']['status']['group'] = 0;
|
||||
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Filter criterion: Date */
|
||||
|
||||
$handler->display->display_options['filters']['date_filter']['id'] = 'date_filter';
|
||||
$handler->display->display_options['filters']['date_filter']['table'] = $base_table;
|
||||
$handler->display->display_options['filters']['date_filter']['field'] = 'date_filter';
|
||||
$handler->display->display_options['filters']['date_filter']['operator'] = '>=';
|
||||
$handler->display->display_options['filters']['date_filter']['granularity'] = 'day';
|
||||
$handler->display->display_options['filters']['date_filter']['form_type'] = 'date_select';
|
||||
$handler->display->display_options['filters']['date_filter']['default_date'] = 'now';
|
||||
$handler->display->display_options['filters']['date_filter']['default_to_date'] = '';
|
||||
$handler->display->display_options['filters']['date_filter']['year_range'] = '-3:+3';
|
||||
$handler->display->display_options['filters']['date_filter']['add_delta'] = 'yes';
|
||||
$handler->display->display_options['filters']['date_filter']['date_fields'] = $aliases;
|
||||
$handler->display->display_options['filters']['date_filter']['date_method'] = 'OR';
|
||||
$handler->display->display_options['filters']['date_filter']['date_group'] = 'date';
|
||||
|
||||
$translatables[$name] = array(
|
||||
t('Master'),
|
||||
t($name),
|
||||
t('more'),
|
||||
t('Apply'),
|
||||
t('Reset'),
|
||||
t('Sort by'),
|
||||
t('Asc'),
|
||||
t('Desc'),
|
||||
t('Year'),
|
||||
t('All'),
|
||||
t('Month'),
|
||||
t('Week'),
|
||||
t('Day'),
|
||||
t('Block'),
|
||||
t('iCal'),
|
||||
t('Upcoming'),
|
||||
t('Upcoming events block'),
|
||||
);
|
||||
|
||||
|
||||
return $view;
|
||||
|
||||
}
|
631
sites/all/modules/calendar/includes/calendar_plugin_row.inc
Normal file
631
sites/all/modules/calendar/includes/calendar_plugin_row.inc
Normal file
@@ -0,0 +1,631 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Contains the Calendar row style plugin.
|
||||
*
|
||||
* This plugin takes the view results, finds the date value for each,
|
||||
* then compares that date to the date range for the current view.
|
||||
* Items that started before or ended after the current date range
|
||||
* are shortened to the current range. Items that extend over more
|
||||
* than one day are cloned to create a calendar item for each day.
|
||||
* The resulting array of results (which may have a different number
|
||||
* of items than the original view result) are then passed back
|
||||
* to the style plugin so they can be displayed in a calendar.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Plugin which creates a view on the resulting object
|
||||
* and formats it as a Calendar node.
|
||||
*/
|
||||
class calendar_plugin_row extends views_plugin_row {
|
||||
|
||||
// Stores the entities loaded with pre_render.
|
||||
var $entities = array();
|
||||
|
||||
function init(&$view, &$display, $options = NULL) {
|
||||
parent::init($view, $display, $options);
|
||||
$this->base_table = $view->base_table;
|
||||
$this->base_field = $view->base_field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to find the date argument handler for this view.
|
||||
*/
|
||||
function date_argument_handler() {
|
||||
foreach ($this->view->argument as $name => $handler) {
|
||||
if (date_views_handler_is_date($handler, 'argument')) {
|
||||
return $handler;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function option_definition() {
|
||||
$options = parent::option_definition();
|
||||
$options['date_fields'] = array('default' => array());
|
||||
$options['calendar_date_link'] = array('default' => '');
|
||||
$options['colors'] = array(
|
||||
'contains' => array(
|
||||
'legend' => array('default' => ''),
|
||||
'calendar_colors_type' => array('default' => array()),
|
||||
'taxonomy_field' => array('default' => ''),
|
||||
'calendar_colors_vocabulary' => array('default' => array()),
|
||||
'calendar_colors_taxonomy' => array('default' => array()),
|
||||
'calendar_colors_group' => array('default' => array()),
|
||||
));
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a form for setting options.
|
||||
*/
|
||||
function options_form(&$form, &$form_state) {
|
||||
parent::options_form($form, $form_state);
|
||||
|
||||
$form['markup']['#markup'] = 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['calendar_date_link'] = array(
|
||||
'#title' => t('Add new date link'),
|
||||
'#type' => 'select',
|
||||
'#default_value' => $this->options['calendar_date_link'],
|
||||
'#options' => array('' => t('No link')) + node_type_get_names(),
|
||||
'#description' => t('Display a link to add a new date of the specified content type. Displayed only to users with appropriate permissions.'),
|
||||
);
|
||||
$form['colors'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Legend Colors'),
|
||||
'#description' => 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 = array(
|
||||
'' => t('None')
|
||||
);
|
||||
if ($this->view->base_table == 'node') {
|
||||
$options['type'] = t('Based on Content Type');
|
||||
}
|
||||
if (module_exists('taxonomy')) {
|
||||
$options['taxonomy'] = t('Based on Taxonomy');
|
||||
}
|
||||
if (module_exists('og')) {
|
||||
$options['group'] = t('Based on Organic Group');
|
||||
}
|
||||
// If none of the options but the None option is available, stop here.
|
||||
if (count($options) == 1) {
|
||||
return;
|
||||
}
|
||||
$form['colors']['legend'] = array(
|
||||
'#title' => t('Stripes'),
|
||||
'#description' => t('Add stripes to calendar items.'),
|
||||
'#type' => 'select',
|
||||
'#options' => $options,
|
||||
'#default_value' => $this->options['colors']['legend'],
|
||||
);
|
||||
if ($this->view->base_table == 'node') {
|
||||
$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] = array(
|
||||
'#title' => check_plain($name),
|
||||
'#type' => 'textfield',
|
||||
'#default_value' => isset($colors[$key]) ? $colors[$key] : '#ffffff',
|
||||
'#size' => 7,
|
||||
'#maxlength' => 7,
|
||||
'#element_validate' => array('calendar_validate_hex_color'),
|
||||
'#dependency' => array('edit-row-options-colors-legend' => array('type')),
|
||||
'#prefix' => '<div class="calendar-colorpicker-wrapper">',
|
||||
'#suffix' => '<div class="calendar-colorpicker"></div></div>',
|
||||
'#attributes' => array('class' => array('edit-calendar-colorpicker')),
|
||||
'#attached' => array(
|
||||
// Add Farbtastic color picker.
|
||||
'library' => array(
|
||||
array('system', 'farbtastic'),
|
||||
),
|
||||
// Add javascript to trigger the colorpicker.
|
||||
'js' => array(drupal_get_path('module', 'calendar') . '/js/calendar_colorpicker.js'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
if (module_exists('taxonomy')) {
|
||||
$vocab_field_options = array();
|
||||
$fields = $this->display->handler->get_option('fields');
|
||||
foreach ($fields as $name => $field) {
|
||||
if (!empty($field['type']) && $field['type'] == 'taxonomy_term_reference_link') {
|
||||
$vocab_field_options[$field['field']] = $field['field'];
|
||||
}
|
||||
}
|
||||
$form['colors']['taxonomy_field'] = array(
|
||||
'#title' => t('Term field'),
|
||||
'#type' => !empty($vocab_field_options) ? 'select' : 'hidden',
|
||||
'#default_value' => $this->options['colors']['taxonomy_field'],
|
||||
'#description' => 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' => $vocab_field_options,
|
||||
'#dependency' => array('edit-row-options-colors-legend' => array('taxonomy')),
|
||||
);
|
||||
if (empty($vocab_field_options)) {
|
||||
$form['colors']['taxonomy_field']['#options'] = array('' => '');
|
||||
$form['colors']['taxonomy_field']['#suffix'] = 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.');
|
||||
}
|
||||
$taxonomy_field = field_info_field($this->options['colors']['taxonomy_field']);
|
||||
$vocab_names[] = array();
|
||||
foreach ((array) $taxonomy_field['settings']['allowed_values'] as $delta => $options) {
|
||||
$vocab_names[] = $options['vocabulary'];
|
||||
}
|
||||
$taxonomies = taxonomy_get_vocabularies();
|
||||
foreach ($taxonomies as $vid => $vocab) {
|
||||
if (in_array($vocab->machine_name, $vocab_names)) {
|
||||
$this->options['colors']['calendar_colors_vocabulary'][] = $vid;
|
||||
}
|
||||
}
|
||||
$form['colors']['calendar_colors_vocabulary'] = array(
|
||||
'#title' => t('Vocabulary Legend Types'),
|
||||
'#type' => 'value',
|
||||
'#value' => $this->options['colors']['calendar_colors_vocabulary'],
|
||||
);
|
||||
|
||||
$vocabularies = (array) $this->options['colors']['calendar_colors_vocabulary'];
|
||||
$term_colors = $this->options['colors']['calendar_colors_taxonomy'];
|
||||
foreach ($vocabularies as $vid) {
|
||||
$vocab = taxonomy_get_tree($vid);
|
||||
foreach ($vocab as $tid => $term) {
|
||||
$form['colors']['calendar_colors_taxonomy'][$term->tid] = array(
|
||||
'#title' => check_plain(t($term->name)),
|
||||
'#type' => 'textfield',
|
||||
'#default_value' => isset($term_colors[$term->tid]) ? $term_colors[$term->tid] : '#ffffff',
|
||||
'#size' => 7,
|
||||
'#maxlength' => 7,
|
||||
'#access' => !empty($vocab_field_options),
|
||||
'#dependency' => array('edit-row-options-colors-legend' => array('taxonomy')),
|
||||
'#element_validate' => array('calendar_validate_hex_color'),
|
||||
'#prefix' => '<div class="calendar-colorpicker-wrapper">',
|
||||
'#suffix' => '<div class="calendar-colorpicker"></div></div>',
|
||||
'#attributes' => array('class' => array('edit-calendar-colorpicker')),
|
||||
'#attached' => array(
|
||||
// Add Farbtastic color picker.
|
||||
'library' => array(
|
||||
array('system', 'farbtastic'),
|
||||
),
|
||||
// Add javascript to trigger the colorpicker.
|
||||
'js' => array(drupal_get_path('module', 'calendar') . '/js/calendar_colorpicker.js'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (module_exists('og')) {
|
||||
$colors_group = $this->options['colors']['calendar_colors_group'];
|
||||
$groups = og_get_all_group();
|
||||
foreach ($groups as $gid) {
|
||||
$form['colors']['calendar_colors_group'][$gid] = array(
|
||||
'#title' => check_plain(t(og_label($gid))),
|
||||
'#type' => 'textfield',
|
||||
'#default_value' => isset($colors_group[$gid]) ? $colors_group[$gid] : '#ffffff',
|
||||
'#dependency' => array('edit-row-options-colors-legend' => array('group')),
|
||||
'#element_validate' => array('calendar_validate_hex_color'),
|
||||
'#prefix' => '<div class="calendar-colorpicker-wrapper">',
|
||||
'#suffix' => '<div class="calendar-colorpicker"></div></div>',
|
||||
'#attributes' => array('class' => array('edit-calendar-colorpicker')),
|
||||
'#attached' => array(
|
||||
// Add Farbtastic color picker.
|
||||
'library' => array(
|
||||
array('system', 'farbtastic'),
|
||||
),
|
||||
// Add javascript to trigger the colorpicker.
|
||||
'js' => array(drupal_get_path('module', 'calendar') . '/js/calendar_colorpicker.js'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function options_submit(&$form, &$form_state) {
|
||||
parent::options_submit($form, $form_state);
|
||||
|
||||
if ($this->view->base_table == 'node') {
|
||||
$path = $this->view->display_handler->get_option('path');
|
||||
calendar_clear_link_path($path);
|
||||
if (!empty($form_state['values']['row_options']['calendar_date_link'])) {
|
||||
$node_type = $form_state['values']['row_options']['calendar_date_link'];
|
||||
calendar_set_link('node', $node_type, $path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function pre_render($values) {
|
||||
|
||||
// @TODO When the date is coming in through a relationship, the nid
|
||||
// of the view is not the right node to use, then we need the related node.
|
||||
// Need to sort out how that should be handled.
|
||||
|
||||
// Preload each entity used in this view from the cache.
|
||||
// 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 = array();
|
||||
foreach ($values as $row) {
|
||||
// Use the $id as the key so we don't create more than one value per entity.
|
||||
$id = $row->{$this->field_alias};
|
||||
|
||||
// Node revisions need special loading.
|
||||
if ($this->view->base_table == 'node_revision') {
|
||||
$this->entities[$id] = node_load(NULL, $id);
|
||||
}
|
||||
// For other entities we just create an array of ids to pass
|
||||
// to entity_load().
|
||||
else {
|
||||
$ids[$id] = $id;
|
||||
}
|
||||
}
|
||||
|
||||
$base_tables = date_views_base_tables();
|
||||
$this->entity_type = $base_tables[$this->view->base_table];
|
||||
if (!empty($ids)) {
|
||||
$this->entities = entity_load($this->entity_type, $ids);
|
||||
}
|
||||
|
||||
// Let the style know if a link to create a new date is required.
|
||||
$this->view->date_info->calendar_date_link = $this->options['calendar_date_link'];
|
||||
|
||||
// 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.
|
||||
$data = date_views_fields($this->view->base_table);
|
||||
$data = $data['name'];
|
||||
$date_fields = array();
|
||||
foreach ($this->view->argument as $handler) {
|
||||
if (date_views_handler_is_date($handler, 'argument')) {
|
||||
// If this is the complex Date argument, the date fields are stored in the handler options,
|
||||
// otherwise we are using the simple date field argument handler.
|
||||
if ($handler->definition['handler'] != 'date_views_argument_handler') {
|
||||
$alias = $handler->table_alias . '.' . $handler->field;
|
||||
$info = $data[$alias];
|
||||
$field_name = str_replace(array('_value2', '_value'), '', $info['real_field_name']);
|
||||
$date_fields[$field_name] = $info;
|
||||
}
|
||||
else {
|
||||
foreach ($handler->options['date_fields'] as $alias) {
|
||||
$info = $data[$alias];
|
||||
$field_name = str_replace(array('_value2', '_value'), '', $info['real_field_name']);
|
||||
|
||||
// This is ugly and hacky but I can't figure out any generic way to
|
||||
// recognize that the node module is going to give some the revision timestamp
|
||||
// a different field name on the entity than the actual column name in the database.
|
||||
if ($this->view->base_table == 'node_revision' && $field_name == 'timestamp') {
|
||||
$field_name = 'revision_timestamp';
|
||||
}
|
||||
|
||||
$date_fields[$field_name] = $info;
|
||||
}
|
||||
}
|
||||
$this->date_argument = $handler;
|
||||
$this->date_fields = $date_fields;
|
||||
}
|
||||
}
|
||||
|
||||
// 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];
|
||||
}
|
||||
}
|
||||
|
||||
function render($row) {
|
||||
global $base_url;
|
||||
$rows = array();
|
||||
$date_info = $this->date_argument->view->date_info;
|
||||
$id = $row->{$this->field_alias};
|
||||
if (!is_numeric($id)) {
|
||||
return $rows;
|
||||
}
|
||||
|
||||
// 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->date_fields as $field_name => $info) {
|
||||
|
||||
// Load the specified node:
|
||||
// We have to clone this or nodes on other views on this page,
|
||||
// like an Upcoming block on the same page as a calendar view,
|
||||
// will end up acquiring the values we set here.
|
||||
$entity = clone($this->entities[$id]);
|
||||
if (empty($entity)) {
|
||||
return $rows;
|
||||
}
|
||||
|
||||
$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'];
|
||||
|
||||
$info = entity_get_info($this->entity_type);
|
||||
$this->id_field = $info['entity keys']['id'];
|
||||
$this->id = $entity->{$this->id_field};
|
||||
$this->type = !empty($info['entity keys']['bundle']) ? $info['entity keys']['bundle'] : $this->entity_type;
|
||||
$this->title = entity_label($this->entity_type, $entity);
|
||||
$uri = entity_uri($this->entity_type, $entity);
|
||||
$uri['options']['absolute'] = TRUE;
|
||||
$this->url = url($uri['path'], $uri['options']);
|
||||
|
||||
// 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 = array();
|
||||
$item_start_date = NULL;
|
||||
$item_end_date = NULL;
|
||||
$granularity = 'second';
|
||||
$increment = 1;
|
||||
if ($is_field) {
|
||||
|
||||
$delta = isset($row->$delta_field) ? $row->$delta_field : 0;
|
||||
$items = field_get_items($this->view->base_table, $entity, $field_name, $this->language);
|
||||
$item = $items[$delta];
|
||||
$db_tz = date_get_timezone_db($tz_handling, isset($item->$tz_field) ? $item->$tz_field : $date_info->display_timezone_name);
|
||||
$to_zone = date_get_timezone($tz_handling, isset($item->$tz_field) ? $item->$tz_field : $date_info->display_timezone_name);
|
||||
|
||||
// Set the date_id for the node, used to identify which field value to display for
|
||||
// fields that have multiple values. The theme expects it to be an array.
|
||||
$entity->date_id = array('calendar.' . $id . '.' . $field_name . '.' . $delta);
|
||||
|
||||
if (!empty($item['value'])) {
|
||||
$item_start_date = new dateObject($item['value'], $db_tz);
|
||||
$item_end_date = array_key_exists('value2', $item) ? new dateObject($item['value2'], $db_tz) : $item_start_date;
|
||||
}
|
||||
|
||||
$cck_field = field_info_field($field_name);
|
||||
$instance = field_info_instance($this->view->base_table, $field_name, $entity->type);
|
||||
$granularity = date_granularity_precision($cck_field['settings']['granularity']);
|
||||
$increment = $instance['widget']['settings']['increment'];
|
||||
|
||||
}
|
||||
elseif (!empty($entity->$field_name)) {
|
||||
$item = $entity->$field_name;
|
||||
$db_tz = date_get_timezone_db($tz_handling, isset($item->$tz_field) ? $item->$tz_field : $date_info->display_timezone_name);
|
||||
$to_zone = date_get_timezone($tz_handling, isset($item->$tz_field) ? $item->$tz_field : $date_info->display_timezone_name);
|
||||
$item_start_date = new dateObject($item, $db_tz);
|
||||
$item_end_date = $item_start_date;
|
||||
$entity->date_id = array('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;
|
||||
$item_start_date->setTimezone(new dateTimezone($to_zone));
|
||||
$item_end_date->setTimezone(new dateTimezone($to_zone));
|
||||
|
||||
$event = new stdClass();
|
||||
$event->id = $this->id;
|
||||
$event->title = $this->title;
|
||||
$event->type = $this->type;
|
||||
$event->date_start = $item_start_date;
|
||||
$event->date_end = $item_end_date;
|
||||
$event->db_tz = $db_tz;
|
||||
$event->to_zone = $to_zone;
|
||||
$event->granularity = $granularity;
|
||||
$event->increment = $increment;
|
||||
$event->field = $is_field ? $item : NULL;
|
||||
$event->url = $this->url;
|
||||
$event->row = $row;
|
||||
$event->entity = $entity;
|
||||
|
||||
// All calendar row plugins should provide a date_id that the theme can use.
|
||||
$event->date_id = $entity->date_id[0];
|
||||
|
||||
$entities = $this->explode_values($event);
|
||||
foreach ($entities as $entity) {
|
||||
switch ($this->options['colors']['legend']) {
|
||||
case 'type':
|
||||
$this->calendar_node_type_stripe($entity);
|
||||
break;
|
||||
case 'taxonomy':
|
||||
$this->calendar_taxonomy_stripe($entity);
|
||||
break;
|
||||
case 'group':
|
||||
$this->calendar_group_stripe($entity);
|
||||
break;
|
||||
}
|
||||
$rows[] = $entity;
|
||||
}
|
||||
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
function explode_values($event) {
|
||||
$rows = array();
|
||||
|
||||
$date_info = $this->date_argument->view->date_info;
|
||||
$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.
|
||||
$now = max($date_info->min_zone_string, $item_start_date->format(DATE_FORMAT_DATE));
|
||||
$to = min($date_info->max_zone_string, $item_end_date->format(DATE_FORMAT_DATE));
|
||||
$next = new DateObject($now . ' 00:00:00', $date_info->display_timezone);
|
||||
if ($date_info->display_timezone_name != $to_zone) {
|
||||
// Make $start and $end (derived from $node) use the timezone $to_zone, just as the original dates do.
|
||||
date_timezone_set($next, timezone_open($to_zone));
|
||||
}
|
||||
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.
|
||||
$pos = 0;
|
||||
while (!empty($now) && $now <= $to) {
|
||||
$entity = clone($event);
|
||||
|
||||
// Get start and end of current day.
|
||||
$start = $next->format(DATE_FORMAT_DATETIME);
|
||||
date_modify($next, '+1 day');
|
||||
date_modify($next, '-1 second');
|
||||
$end = $next->format(DATE_FORMAT_DATETIME);
|
||||
|
||||
// Get start and end of item, formatted the same way.
|
||||
$item_start = $item_start_date->format(DATE_FORMAT_DATETIME);
|
||||
$item_end = $item_end_date->format(DATE_FORMAT_DATETIME);
|
||||
|
||||
// Get intersection of current day and the node value's duration (as strings in $to_zone timezone).
|
||||
$entity->calendar_start = $item_start < $start ? $start : $item_start;
|
||||
$entity->calendar_end = !empty($item_end) ? ($item_end > $end ? $end : $item_end) : $node->calendar_start;
|
||||
|
||||
// Make date objects
|
||||
$entity->calendar_start_date = date_create($entity->calendar_start, timezone_open($to_zone));
|
||||
$entity->calendar_end_date = date_create($entity->calendar_end, timezone_open($to_zone));
|
||||
|
||||
// Change string timezones into
|
||||
// calendar_start and calendar_end are UTC dates as formatted strings
|
||||
$entity->calendar_start = date_format($entity->calendar_start_date, DATE_FORMAT_DATETIME);
|
||||
$entity->calendar_end = date_format($entity->calendar_end_date, DATE_FORMAT_DATETIME);
|
||||
$entity->calendar_all_day = date_is_all_day($entity->calendar_start, $entity->calendar_end, $granularity, $increment);
|
||||
|
||||
unset($entity->calendar_fields);
|
||||
if (isset($entity) && (empty($entity->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 .= '.' . $pos;
|
||||
|
||||
$rows[] = $entity;
|
||||
unset($entity);
|
||||
}
|
||||
date_modify($next, '+1 second');
|
||||
$now = date_format($next, DATE_FORMAT_DATE);
|
||||
$pos++;
|
||||
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a stripe base on node type.
|
||||
*/
|
||||
function calendar_node_type_stripe(&$entity) {
|
||||
$colors = isset($this->options['colors']['calendar_colors_type']) ? $this->options['colors']['calendar_colors_type'] : array();
|
||||
if (empty($colors)) {
|
||||
return;
|
||||
}
|
||||
if (empty($entity->type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$type_names = node_type_get_names();
|
||||
$type = $entity->type;
|
||||
$label = '';
|
||||
$stripe = '';
|
||||
if (!(isset($entity->stripe))) {
|
||||
$entity->stripe = array();
|
||||
$entity->stripe_label = array();
|
||||
}
|
||||
if (array_key_exists($type, $type_names)) {
|
||||
$label = $type_names[$type];
|
||||
}
|
||||
if (array_key_exists($type, $colors)) {
|
||||
$stripe = $colors[$type];
|
||||
}
|
||||
|
||||
$entity->stripe[] = $stripe;
|
||||
$entity->stripe_label[] = $label;
|
||||
return $stripe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a stripe based on a taxonomy term.
|
||||
*/
|
||||
|
||||
function calendar_taxonomy_stripe(&$entity) {
|
||||
$term_colors = isset($this->options['colors']['calendar_colors_taxonomy']) ? $this->options['colors']['calendar_colors_taxonomy'] : array();
|
||||
if (empty($term_colors)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$terms = array();
|
||||
if ($this->options['colors']['legend'] == 'taxonomy') {
|
||||
$term_field_name = $this->options['colors']['taxonomy_field'];
|
||||
|
||||
if ($term_field = field_get_items($this->view->base_table, $entity->entity, $term_field_name)) {
|
||||
foreach ($term_field as $delta => $items) {
|
||||
foreach ($items as $item) {
|
||||
$terms[] = $item['tid'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($terms)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(isset($entity->stripe))) {
|
||||
$entity->stripe = array();
|
||||
$entity->stripe_label = array();
|
||||
}
|
||||
if (count($terms)) {
|
||||
foreach ($terms as $tid) {
|
||||
$term_for_entity = taxonomy_term_load($tid);
|
||||
if (!array_key_exists($term_for_entity->tid, $term_colors)) {
|
||||
continue;
|
||||
}
|
||||
$stripe = $term_colors[$term_for_entity->tid];
|
||||
$stripe_label = $term_for_entity->name;
|
||||
$entity->stripe[] = $stripe;
|
||||
$entity->stripe_label[] = $stripe_label;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$entity->stripe[] = '';
|
||||
$entity->stripe_label[] = '';
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a stripe based on group.
|
||||
*/
|
||||
function calendar_group_stripe(&$entity) {
|
||||
$colors_group = isset($this->options['colors']['calendar_colors_group']) ? $this->options['colors']['calendar_colors_group'] : array();
|
||||
|
||||
if (empty($colors_group)) {
|
||||
return;
|
||||
}
|
||||
if (!function_exists('og_get_entity_groups')) {
|
||||
return;
|
||||
}
|
||||
$groups_for_entity = og_get_entity_groups($this->view->base_table, $entity);
|
||||
if (!(isset($entity->stripe))) {
|
||||
$entity->stripe = array();
|
||||
$entity->stripe_label = array();
|
||||
}
|
||||
if (count($groups_for_entity)) {
|
||||
foreach ($groups_for_entity as $gid => $group_name) {
|
||||
if (!array_key_exists($gid, $colors_group)) {
|
||||
continue;
|
||||
}
|
||||
$stripe = $colors_group[$gid];
|
||||
$stripe_label = $group_name;
|
||||
$entity->stripe[] = $stripe;
|
||||
$entity->stripe_label[] = $stripe_label;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$entity->stripe[] = '';
|
||||
$entity->stripe_label[] = '';
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
586
sites/all/modules/calendar/includes/calendar_plugin_row_node.inc
Normal file
586
sites/all/modules/calendar/includes/calendar_plugin_row_node.inc
Normal file
@@ -0,0 +1,586 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Contains the Calendar row style plugin.
|
||||
*
|
||||
* This plugin takes the view results, finds the date value for each,
|
||||
* then compares that date to the date range for the current view.
|
||||
* Items that started before or ended after the current date range
|
||||
* are shortened to the current range. Items that extend over more
|
||||
* than one day are cloned to create a calendar item for each day.
|
||||
* The resulting array of results (which may have a different number
|
||||
* of items than the original view result) are then passed back
|
||||
* to the style plugin so they can be displayed in a calendar.
|
||||
*
|
||||
* Row plugins are specific to entity types. To create a row plugin
|
||||
* for other types of entities, this class can be extended or copied,
|
||||
* adjusting the parts that are specific to nodes.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Plugin which creates a view on the resulting object
|
||||
* and formats it as a Calendar node.
|
||||
*/
|
||||
class calendar_plugin_row_node extends views_plugin_row {
|
||||
|
||||
// Basic properties that let the row style follow relationships.
|
||||
var $base_table = 'node';
|
||||
var $base_field = 'nid';
|
||||
|
||||
// Stores the nodes loaded with pre_render.
|
||||
var $nodes = array();
|
||||
|
||||
/**
|
||||
* Helper function to find the date argument handler for this view.
|
||||
*/
|
||||
function date_argument_handler() {
|
||||
foreach ($this->view->argument as $name => $handler) {
|
||||
if (date_views_handler_is_date($handler, 'argument')) {
|
||||
return $handler;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function option_definition() {
|
||||
$options = parent::option_definition();
|
||||
$options['date_fields'] = array('default' => array());
|
||||
$options['calendar_date_link'] = array('default' => '');
|
||||
$options['colors'] = array(
|
||||
'contains' => array(
|
||||
'legend' => array('default' => ''),
|
||||
'calendar_colors_type' => array('default' => array()),
|
||||
'taxonomy_field' => array('default' => ''),
|
||||
'calendar_colors_vocabulary' => array('default' => array()),
|
||||
'calendar_colors_taxonomy' => array('default' => array()),
|
||||
'calendar_colors_group' => array('default' => array()),
|
||||
));
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a form for setting options.
|
||||
*/
|
||||
function options_form(&$form, &$form_state) {
|
||||
parent::options_form($form, $form_state);
|
||||
|
||||
$form['markup']['#markup'] = 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['calendar_date_link'] = array(
|
||||
'#title' => t('Add new date link'),
|
||||
'#type' => 'select',
|
||||
'#default_value' => $this->options['calendar_date_link'],
|
||||
'#options' => array('' => t('No link')) + node_type_get_names(),
|
||||
'#description' => t('Display a link to add a new date of the specified content type. Displayed only to users with appropriate permissions.'),
|
||||
);
|
||||
$form['colors'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Legend Colors'),
|
||||
'#description' => 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.'),
|
||||
);
|
||||
$form['colors']['legend'] = array(
|
||||
'#title' => t('Stripes'),
|
||||
'#description' => t('Add stripes to calendar items.'),
|
||||
'#type' => 'select',
|
||||
'#options' => array('' => t('None'), 'type' => t('Based on Content Type'), 'taxonomy' => t('Based on Taxonomy'), 'group' => t('Based on Organic Group')),
|
||||
'#default_value' => $this->options['colors']['legend'],
|
||||
);
|
||||
if (!module_exists('og')) {
|
||||
unset($form['colors']['legend']['#options']['group']);
|
||||
}
|
||||
$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] = array(
|
||||
'#title' => check_plain($name),
|
||||
'#type' => 'textfield',
|
||||
'#default_value' => isset($colors[$key]) ? $colors[$key] : '#ffffff',
|
||||
'#size' => 7,
|
||||
'#maxlength' => 7,
|
||||
'#element_validate' => array('calendar_validate_hex_color'),
|
||||
'#dependency' => array('edit-row-options-colors-legend' => array('type')),
|
||||
'#prefix' => '<div class="calendar-colorpicker-wrapper">',
|
||||
'#suffix' => '<div class="calendar-colorpicker"></div></div>',
|
||||
'#attributes' => array('class' => array('edit-calendar-colorpicker')),
|
||||
'#attached' => array(
|
||||
// Add Farbtastic color picker.
|
||||
'library' => array(
|
||||
array('system', 'farbtastic'),
|
||||
),
|
||||
// Add javascript to trigger the colorpicker.
|
||||
'js' => array(drupal_get_path('module', 'calendar') . '/js/calendar_colorpicker.js'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (module_exists('taxonomy')) {
|
||||
$vocab_field_options = array();
|
||||
$fields = $this->display->handler->get_option('fields');
|
||||
foreach ($fields as $name => $field) {
|
||||
if (!empty($field['type']) && $field['type'] == 'taxonomy_term_reference_link') {
|
||||
$vocab_field_options[$field['field']] = $field['field'];
|
||||
}
|
||||
}
|
||||
$form['colors']['taxonomy_field'] = array(
|
||||
'#title' => t('Term field'),
|
||||
'#type' => !empty($vocab_field_options) ? 'select' : 'hidden',
|
||||
'#default_value' => $this->options['colors']['taxonomy_field'],
|
||||
'#description' => 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' => $vocab_field_options,
|
||||
'#dependency' => array('edit-row-options-colors-legend' => array('taxonomy')),
|
||||
);
|
||||
if (empty($vocab_field_options)) {
|
||||
$form['colors']['taxonomy_field']['#options'] = array('' => '');
|
||||
$form['colors']['taxonomy_field']['#suffix'] = 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.');
|
||||
}
|
||||
$taxonomy_field = field_info_field($this->options['colors']['taxonomy_field']);
|
||||
$vocab_names[] = array();
|
||||
foreach ((array) $taxonomy_field['settings']['allowed_values'] as $delta => $options) {
|
||||
$vocab_names[] = $options['vocabulary'];
|
||||
}
|
||||
$taxonomies = taxonomy_get_vocabularies();
|
||||
foreach ($taxonomies as $vid => $vocab) {
|
||||
if (in_array($vocab->name, $vocab_names)) {
|
||||
$this->options['colors']['calendar_colors_vocabulary'][] = $vid;
|
||||
}
|
||||
}
|
||||
$form['colors']['calendar_colors_vocabulary'] = array(
|
||||
'#title' => t('Vocabulary Legend Types'),
|
||||
'#type' => 'value',
|
||||
'#value' => $this->options['colors']['calendar_colors_vocabulary'],
|
||||
);
|
||||
|
||||
$vocabularies = (array) $this->options['colors']['calendar_colors_vocabulary'];
|
||||
$term_colors = $this->options['colors']['calendar_colors_taxonomy'];
|
||||
foreach ($vocabularies as $vid) {
|
||||
$vocab = taxonomy_get_tree($vid);
|
||||
foreach ($vocab as $tid => $term) {
|
||||
$form['colors']['calendar_colors_taxonomy'][$term->tid] = array(
|
||||
'#title' => check_plain(t($term->name)),
|
||||
'#type' => 'textfield',
|
||||
'#default_value' => isset($term_colors[$term->tid]) ? $term_colors[$term->tid] : '#ffffff',
|
||||
'#size' => 7,
|
||||
'#maxlength' => 7,
|
||||
'#access' => !empty($vocab_field_options),
|
||||
'#dependency' => array('edit-row-options-colors-legend' => array('taxonomy')),
|
||||
'#element_validate' => array('calendar_validate_hex_color'),
|
||||
'#prefix' => '<div class="calendar-colorpicker-wrapper">',
|
||||
'#suffix' => '<div class="calendar-colorpicker"></div></div>',
|
||||
'#attributes' => array('class' => array('edit-calendar-colorpicker')),
|
||||
'#attached' => array(
|
||||
// Add Farbtastic color picker.
|
||||
'library' => array(
|
||||
array('system', 'farbtastic'),
|
||||
),
|
||||
// Add javascript to trigger the colorpicker.
|
||||
'js' => array(drupal_get_path('module', 'calendar') . '/js/calendar_colorpicker.js'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (module_exists('og')) {
|
||||
$colors_group = $this->options['colors']['calendar_colors_group'];
|
||||
$groups = og_get_all_group();
|
||||
foreach ($groups as $gid) {
|
||||
$form['colors']['calendar_colors_group'][$gid] = array(
|
||||
'#title' => check_plain(t(og_label($gid))),
|
||||
'#type' => 'textfield',
|
||||
'#default_value' => isset($colors_group[$gid]) ? $colors_group[$gid] : '#ffffff',
|
||||
'#dependency' => array('edit-row-options-colors-legend' => array('group')),
|
||||
'#element_validate' => array('calendar_validate_hex_color'),
|
||||
'#prefix' => '<div class="calendar-colorpicker-wrapper">',
|
||||
'#suffix' => '<div class="calendar-colorpicker"></div></div>',
|
||||
'#attributes' => array('class' => array('edit-calendar-colorpicker')),
|
||||
'#attached' => array(
|
||||
// Add Farbtastic color picker.
|
||||
'library' => array(
|
||||
array('system', 'farbtastic'),
|
||||
),
|
||||
// Add javascript to trigger the colorpicker.
|
||||
'js' => array(drupal_get_path('module', 'calendar') . '/js/calendar_colorpicker.js'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function options_submit(&$form, &$form_state) {
|
||||
parent::options_submit($form, $form_state);
|
||||
$path = $this->view->display_handler->get_option('path');
|
||||
calendar_clear_link_path($path);
|
||||
if (!empty($form_state['values']['row_options']['calendar_date_link'])) {
|
||||
$node_type = $form_state['values']['row_options']['calendar_date_link'];
|
||||
calendar_set_link('node', $node_type, $path);
|
||||
}
|
||||
}
|
||||
|
||||
function pre_render($values) {
|
||||
// @TODO When the date is coming in through a relationship, the nid
|
||||
// of the view is not the right node to use, then we need the related node.
|
||||
// Need to sort out how that should be handled.
|
||||
|
||||
// Preload each node used in this view from the cache.
|
||||
// Provides all the node values relatively cheaply, and we don't
|
||||
// need to do it repeatedly for the same node if there are
|
||||
// multiple results for one node.
|
||||
$nids = array();
|
||||
foreach ($values as $row) {
|
||||
// Use the $nid as the key so we don't create more than one value per node.
|
||||
$nid = $row->{$this->field_alias};
|
||||
$nids[$nid] = $nid;
|
||||
}
|
||||
if (!empty($nids)) {
|
||||
$this->nodes = node_load_multiple($nids);
|
||||
}
|
||||
// Let the style know if a link to create a new date is required.
|
||||
$this->view->date_info->calendar_date_link = $this->options['calendar_date_link'];
|
||||
|
||||
// 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.
|
||||
$data = date_views_fields('node');
|
||||
$data = $data['name'];
|
||||
$date_fields = array();
|
||||
foreach ($this->view->argument as $handler) {
|
||||
if (date_views_handler_is_date($handler, 'argument')) {
|
||||
// If this is the complex Date argument, the date fields are stored in the handler options,
|
||||
// otherwise we are using the simple date field argument handler.
|
||||
if ($handler->definition['handler'] != 'date_views_argument_handler') {
|
||||
$alias = $handler->table_alias . '.' . $handler->field;
|
||||
$info = $data[$alias];
|
||||
$field_name = str_replace(array('_value2', '_value'), '', $info['real_field_name']);
|
||||
$date_fields[$field_name] = $info;
|
||||
}
|
||||
else {
|
||||
foreach ($handler->options['date_fields'] as $alias) {
|
||||
$info = $data[$alias];
|
||||
$field_name = str_replace(array('_value2', '_value'), '', $info['real_field_name']);
|
||||
$date_fields[$field_name] = $info;
|
||||
}
|
||||
}
|
||||
$this->date_argument = $handler;
|
||||
$this->date_fields = $date_fields;
|
||||
}
|
||||
}
|
||||
|
||||
// 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];
|
||||
}
|
||||
}
|
||||
|
||||
function render($row) {
|
||||
global $base_url;
|
||||
$rows = array();
|
||||
$date_info = $this->date_argument->view->date_info;
|
||||
$nid = $row->{$this->field_alias};
|
||||
if (!is_numeric($nid)) {
|
||||
return $rows;
|
||||
}
|
||||
|
||||
// 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->date_fields as $field_name => $info) {
|
||||
|
||||
// Load the specified node:
|
||||
// We have to clone this or nodes on other views on this page,
|
||||
// like an Upcoming block on the same page as a calendar view,
|
||||
// will end up acquiring the values we set here.
|
||||
$node = clone($this->nodes[$nid]);
|
||||
if (empty($node)) {
|
||||
return $rows;
|
||||
}
|
||||
|
||||
$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'];
|
||||
|
||||
// Retrieve the field value that matched our query from the cached node.
|
||||
// Find the date and set it to the right timezone.
|
||||
|
||||
$node->date_id = array();
|
||||
$item_start_date = NULL;
|
||||
$item_end_date = NULL;
|
||||
$granularity = 'second';
|
||||
$increment = 1;
|
||||
|
||||
if ($is_field) {
|
||||
|
||||
$delta = isset($row->$delta_field) ? $row->$delta_field : 0;
|
||||
$items = field_get_items('node', $node, $field_name, $this->language);
|
||||
$item = $items[$delta];
|
||||
$db_tz = date_get_timezone_db($tz_handling, isset($item->$tz_field) ? $item->$tz_field : $date_info->display_timezone_name);
|
||||
$to_zone = date_get_timezone($tz_handling, isset($item->$tz_field) ? $item->$tz_field : $date_info->display_timezone_name);
|
||||
|
||||
// Set the date_id for the node, used to identify which field value to display for
|
||||
// fields that have multiple values. The theme expects it to be an array.
|
||||
$node->date_id = array('calendar.' . $node->nid . '.' . $field_name . '.' . $delta);
|
||||
|
||||
if (!empty($item['value'])) {
|
||||
$item_start_date = new dateObject($item['value'], $db_tz);
|
||||
$item_end_date = array_key_exists('value2', $item) ? new dateObject($item['value2'], $db_tz) : $item_start_date;
|
||||
}
|
||||
|
||||
$cck_field = field_info_field($field_name);
|
||||
$instance = field_info_instance($this->view->base_table, $field_name, $node->type);
|
||||
$granularity = date_granularity_precision($cck_field['settings']['granularity']);
|
||||
$increment = $instance['widget']['settings']['increment'];
|
||||
|
||||
}
|
||||
elseif (!empty($node->$field_name)) {
|
||||
$item = $node->$field_name;
|
||||
$db_tz = date_get_timezone_db($tz_handling, isset($item->$tz_field) ? $item->$tz_field : $date_info->display_timezone_name);
|
||||
$to_zone = date_get_timezone($tz_handling, isset($item->$tz_field) ? $item->$tz_field : $date_info->display_timezone_name);
|
||||
$item_start_date = new dateObject($item, $db_tz);
|
||||
$item_end_date = $item_start_date;
|
||||
$node->date_id = array('calendar.' . $node->nid . '.' . $field_name . '.0');
|
||||
}
|
||||
|
||||
// If we don't have date value, go no further.
|
||||
if (empty($item_start_date)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Set the item date to the proper display timezone;
|
||||
$item_start_date->setTimezone(new dateTimezone($to_zone));
|
||||
$item_end_date->setTimezone(new dateTimezone($to_zone));
|
||||
|
||||
$event = new stdClass();
|
||||
$event->nid = $node->nid;
|
||||
$event->title = $node->title;
|
||||
$event->type = $node->type;
|
||||
$event->date_start = $item_start_date;
|
||||
$event->date_end = $item_end_date;
|
||||
$event->db_tz = $db_tz;
|
||||
$event->to_zone = $to_zone;
|
||||
$event->granularity = $granularity;
|
||||
$event->increment = $increment;
|
||||
$event->field = $is_field ? $item : NULL;
|
||||
$event->row = $row;
|
||||
$event->node = $node;
|
||||
|
||||
// All calendar row plugins should provide a date_id that the theme can use.
|
||||
$event->date_id = $node->date_id[0];
|
||||
|
||||
$nodes = $this->explode_values($event);
|
||||
foreach ($nodes as $node) {
|
||||
switch ($this->options['colors']['legend']) {
|
||||
case 'type':
|
||||
$this->calendar_node_type_stripe($node);
|
||||
break;
|
||||
case 'taxonomy':
|
||||
$this->calendar_node_taxonomy_stripe($node);
|
||||
break;
|
||||
case 'group':
|
||||
$this->calendar_node_group_stripe($node);
|
||||
break;
|
||||
}
|
||||
$rows[] = $node;
|
||||
}
|
||||
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
function explode_values($event) {
|
||||
$rows = array();
|
||||
|
||||
$date_info = $this->date_argument->view->date_info;
|
||||
$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 a 'node' 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.
|
||||
$now = max($date_info->min_zone_string, $item_start_date->format(DATE_FORMAT_DATE));
|
||||
$to = min($date_info->max_zone_string, $item_end_date->format(DATE_FORMAT_DATE));
|
||||
$next = new DateObject($now . ' 00:00:00', $date_info->display_timezone);
|
||||
if ($date_info->display_timezone_name != $to_zone) {
|
||||
// Make $start and $end (derived from $node) use the timezone $to_zone, just as the original dates do.
|
||||
date_timezone_set($next, timezone_open($to_zone));
|
||||
}
|
||||
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.
|
||||
$pos = 0;
|
||||
while (!empty($now) && $now <= $to) {
|
||||
$node = clone($event);
|
||||
$node->url = url('node/' . $node->nid, array('absolute' => TRUE));
|
||||
|
||||
// Get start and end of current day.
|
||||
$start = $next->format(DATE_FORMAT_DATETIME);
|
||||
date_modify($next, '+1 day');
|
||||
date_modify($next, '-1 second');
|
||||
$end = $next->format(DATE_FORMAT_DATETIME);
|
||||
|
||||
// Get start and end of item, formatted the same way.
|
||||
$item_start = $item_start_date->format(DATE_FORMAT_DATETIME);
|
||||
$item_end = $item_end_date->format(DATE_FORMAT_DATETIME);
|
||||
|
||||
// Get intersection of current day and the node value's duration (as strings in $to_zone timezone).
|
||||
$node->calendar_start = $item_start < $start ? $start : $item_start;
|
||||
$node->calendar_end = !empty($item_end) ? ($item_end > $end ? $end : $item_end) : $node->calendar_start;
|
||||
|
||||
// Make date objects
|
||||
$node->calendar_start_date = date_create($node->calendar_start, timezone_open($to_zone));
|
||||
$node->calendar_end_date = date_create($node->calendar_end, timezone_open($to_zone));
|
||||
|
||||
// Change string timezones into
|
||||
// calendar_start and calendar_end are UTC dates as formatted strings
|
||||
$node->calendar_start = date_format($node->calendar_start_date, DATE_FORMAT_DATETIME);
|
||||
$node->calendar_end = date_format($node->calendar_end_date, DATE_FORMAT_DATETIME);
|
||||
$node->calendar_all_day = date_is_all_day($node->calendar_start, $node->calendar_end, $granularity, $increment);
|
||||
|
||||
unset($node->calendar_fields);
|
||||
if (isset($node) && (empty($node->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($node);
|
||||
}
|
||||
else {
|
||||
$node->date_id .= '.' . $pos;
|
||||
|
||||
$rows[] = $node;
|
||||
unset($node);
|
||||
}
|
||||
date_modify($next, '+1 second');
|
||||
$now = date_format($next, DATE_FORMAT_DATE);
|
||||
$pos++;
|
||||
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a stripe base on node type.
|
||||
*/
|
||||
function calendar_node_type_stripe(&$node) {
|
||||
$colors = isset($this->options['colors']['calendar_colors_type']) ? $this->options['colors']['calendar_colors_type'] : array();
|
||||
if (empty($colors)) {
|
||||
return;
|
||||
}
|
||||
if (empty($node->type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$type_names = node_type_get_names();
|
||||
$type = $node->type;
|
||||
if (!(isset($node->stripe))) {
|
||||
$node->stripe = array();
|
||||
$node->stripe_label = array();
|
||||
}
|
||||
if (array_key_exists($type, $type_names)) {
|
||||
$label = $type_names[$type];
|
||||
}
|
||||
if (array_key_exists($type, $colors)) {
|
||||
$stripe = $colors[$type];
|
||||
}
|
||||
else {
|
||||
$stripe = '';
|
||||
}
|
||||
|
||||
$node->stripe[] = $stripe;
|
||||
$node->stripe_label[] = $label;
|
||||
return $stripe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a stripe based on a taxonomy term.
|
||||
*/
|
||||
|
||||
function calendar_node_taxonomy_stripe(&$event) {
|
||||
$term_colors = isset($this->options['colors']['calendar_colors_taxonomy']) ? $this->options['colors']['calendar_colors_taxonomy'] : array();
|
||||
if (empty($term_colors)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$node = $event->node;
|
||||
$terms = array();
|
||||
if ($this->options['colors']['legend'] == 'taxonomy') {
|
||||
$term_field_name = $this->options['colors']['taxonomy_field'];
|
||||
if ($term_field = field_get_items('node', $node, $term_field_name)) {
|
||||
foreach ($term_field as $delta => $items) {
|
||||
foreach ($items as $item) {
|
||||
$terms[] = $item['tid'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($terms)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(isset($event->stripe))) {
|
||||
$event->stripe = array();
|
||||
$event->stripe_label = array();
|
||||
}
|
||||
if (count($terms)) {
|
||||
foreach ($terms as $tid) {
|
||||
$term_for_node = taxonomy_term_load($tid);
|
||||
if (!array_key_exists($term_for_node->tid, $term_colors)) {
|
||||
continue;
|
||||
}
|
||||
$stripe = $term_colors[$term_for_node->tid];
|
||||
$stripe_label = $term_for_node->name;
|
||||
$event->stripe[] = $stripe;
|
||||
$event->stripe_label[] = $stripe_label;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$event->stripe[] = '';
|
||||
$event->stripe_label[] = '';
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a stripe based on group.
|
||||
*/
|
||||
function calendar_node_group_stripe(&$node) {
|
||||
$colors_group = isset($this->options['colors']['calendar_colors_group']) ? $this->options['colors']['calendar_colors_group'] : array();
|
||||
|
||||
if (empty($colors_group)) {
|
||||
return;
|
||||
}
|
||||
if (!function_exists('og_get_entity_groups')) {
|
||||
return;
|
||||
}
|
||||
$groups_for_node = og_get_entity_groups('node', $node);
|
||||
if (!(isset($node->stripe))) {
|
||||
$node->stripe = array();
|
||||
$node->stripe_label = array();
|
||||
}
|
||||
if (count($groups_for_node)) {
|
||||
foreach ($groups_for_node as $gid => $group_name) {
|
||||
if (!array_key_exists($gid, $colors_group)) {
|
||||
continue;
|
||||
}
|
||||
$stripe = $colors_group[$gid];
|
||||
$stripe_label = $group_name;
|
||||
$node->stripe[] = $stripe;
|
||||
$node->stripe_label[] = $stripe_label;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$node->stripe[] = '';
|
||||
$node->stripe_label[] = '';
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
948
sites/all/modules/calendar/includes/calendar_plugin_style.inc
Normal file
948
sites/all/modules/calendar/includes/calendar_plugin_style.inc
Normal file
@@ -0,0 +1,948 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Views style plugin for the Calendar module.
|
||||
*
|
||||
* The style plugin is responsible for setting global values needed by
|
||||
* the row plugin. It then gathers up an array of view results (as restructured
|
||||
* by the row plugin) and organizes them into year/month/day/time
|
||||
* arrays that the theme can use to display the results in a calendar.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Default style plugin to render an iCal feed.
|
||||
*/
|
||||
class calendar_plugin_style extends views_plugin_style {
|
||||
|
||||
var $date_info;
|
||||
var $items;
|
||||
var $curday;
|
||||
|
||||
function init(&$view, &$display, $options = NULL) {
|
||||
parent::init($view, $display, $options);
|
||||
if (empty($view->date_info)) {
|
||||
$this->date_info = new stdClass();
|
||||
}
|
||||
$this->date_info = &$this->view->date_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add custom option definitions.
|
||||
*/
|
||||
function option_definition() {
|
||||
$options = parent::option_definition();
|
||||
$options['calendar_type'] = array('default' => 'month');
|
||||
$options['name_size'] = array('default' => 3);
|
||||
$options['mini'] = array('default' => 0);
|
||||
$options['with_weekno'] = array('default' => 0);
|
||||
$options['multiday_theme'] = array('default' => 1);
|
||||
$options['theme_style'] = array('default' => 1);
|
||||
$options['max_items'] = array('default' => 0);
|
||||
$options['max_items_behavior'] = array('default' => 'more');
|
||||
$options['groupby_times'] = array('default' => 'hour');
|
||||
$options['groupby_times_custom'] = array('default' => '');
|
||||
$options['groupby_field'] = array('default' => '');
|
||||
return $options;
|
||||
}
|
||||
|
||||
function options_form(&$form, &$form_state) {
|
||||
parent::options_form($form, $form_state);
|
||||
$form['calendar_type'] = array(
|
||||
'#title' => t('Calendar type'),
|
||||
'#type' => 'select',
|
||||
'#description' => t('Select the calendar time period for this display.'),
|
||||
'#default_value' => $this->options['calendar_type'],
|
||||
'#options' => calendar_display_types(),
|
||||
);
|
||||
$form['mini'] = array(
|
||||
'#title' => t('Display as mini calendar'),
|
||||
'#default_value' => $this->options['mini'],
|
||||
'#type' => 'radios',
|
||||
'#options' => array(0 => t('No'), 1 => t('Yes')),
|
||||
'#description' => t('Display the mini style calendar, with no item details. Suitable for a calendar displayed in a block.'),
|
||||
'#dependency' => array('edit-style-options-calendar-type' => array('month')),
|
||||
);
|
||||
$form['name_size'] = array(
|
||||
'#title' => t('Calendar day of week names'),
|
||||
'#default_value' => $this->options['name_size'],
|
||||
'#type' => 'radios',
|
||||
'#options' => array(1 => t('First letter of name'), 2 => t('First two letters of name'), 3 => t('Abbreviated name'), 99 => t('Full name')),
|
||||
'#description' => t('The way day of week names should be displayed in a calendar.'),
|
||||
'#dependency' => array('edit-style-options-calendar-type' => array('month', 'week', 'year')),
|
||||
);
|
||||
$form['with_weekno'] = array(
|
||||
'#title' => t('Show week numbers'),
|
||||
'#default_value' => $this->options['with_weekno'],
|
||||
'#type' => 'radios',
|
||||
'#options' => array(0 => t('No'), 1 => t('Yes')),
|
||||
'#description' => t('Whether or not to show week numbers in the left column of calendar weeks and months.'),
|
||||
'#dependency' => array('edit-style-options-calendar-type' => array('month')),
|
||||
);
|
||||
$form['max_items'] = array(
|
||||
'#title' => t('Maximum items'),
|
||||
'#type' => 'select',
|
||||
'#options' => array(0 => t('Unlimited'), 1 => t('1 item'), 3 => t('3 items'), 5 => t('5 items'), 10 => t('10 items')),
|
||||
'#default_value' => $this->options['calendar_type'] != 'day' ? $this->options['max_items'] : 0,
|
||||
'#description' => 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.'),
|
||||
'#dependency' => array('edit-style-options-calendar-type' => array('month')),
|
||||
);
|
||||
$form['max_items_behavior'] = array(
|
||||
'#title' => t('Too many items'),
|
||||
'#type' => 'select',
|
||||
'#options' => array('more' => t("Show maximum, add 'more' link"), 'hide' => t('Hide all, add link to day')),
|
||||
'#default_value' => $this->options['calendar_type'] != 'day' ? $this->options['max_items_behavior'] : 'more',
|
||||
'#description' => 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.'),
|
||||
'#dependency' => array('edit-style-options-calendar-type' => array('month')),
|
||||
);
|
||||
$form['groupby_times'] = array(
|
||||
'#title' => t('Time grouping'),
|
||||
'#type' => 'select',
|
||||
'#default_value' => $this->options['groupby_times'],
|
||||
'#description' => t("Group items together into time periods based on their start time."),
|
||||
'#options' => array('' => t('None'), 'hour' => t('Hour'), 'half' => t('Half hour'), 'custom' => t('Custom')),
|
||||
'#dependency' => array('edit-style-options-calendar-type' => array('day', 'week')),
|
||||
);
|
||||
$form['groupby_times_custom'] = array(
|
||||
'#title' => t('Custom time grouping'),
|
||||
'#type' => 'textarea',
|
||||
'#default_value' => $this->options['groupby_times_custom'],
|
||||
'#description' => 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."),
|
||||
'#dependency' => array('edit-style-options-groupby-times' => array('custom')),
|
||||
);
|
||||
$form['theme_style'] = array(
|
||||
'#title' => t('Overlapping time style'),
|
||||
'#default_value' => $this->options['theme_style'],
|
||||
'#type' => 'select',
|
||||
'#options' => array(0 => t('Do not display overlapping items'), 1 => t('Display overlapping items, with scrolling'), 2 => t('Display overlapping items, no scrolling')),
|
||||
'#description' => 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!'),
|
||||
'#dependency' => array('edit-style-options-calendar-type' => array('day', 'week')),
|
||||
);
|
||||
|
||||
// Create a list of fields that are available for grouping,
|
||||
$field_options = array();
|
||||
$i = 1;
|
||||
$fields = $this->display->handler->get_option('fields');
|
||||
foreach ($fields as $field_name => $field) {
|
||||
$field_options[$i] = $field['field'];
|
||||
$i++;
|
||||
}
|
||||
$form['groupby_field'] = array(
|
||||
'#title' => t('Field grouping'),
|
||||
'#type' => 'select',
|
||||
'#default_value' => $this->options['groupby_field'],
|
||||
'#description' => 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' => array('' => '') + $field_options,
|
||||
'#dependency' => array('edit-style-options-calendar-type' => array('day')),
|
||||
);
|
||||
$form['multiday_theme'] = array(
|
||||
'#title' => t('Multi-day style'),
|
||||
'#default_value' => $this->options['multiday_theme'],
|
||||
'#type' => 'select',
|
||||
'#options' => array(0 => t('Display multi-day item as a single column'), 1 => t('Display multi-day item as a multiple column row')),
|
||||
'#description' => 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.'),
|
||||
'#dependency' => array('edit-style-options-calendar-type' => array('month', 'week')),
|
||||
);
|
||||
}
|
||||
|
||||
function options_validate(&$form, &$form_state) {
|
||||
$values = $form_state['values']['style_options'];
|
||||
if ($values['groupby_times'] == 'custom' && empty($values['groupby_times_custom'])) {
|
||||
form_set_error('style_options][groupby_times_custom', t('Custom groupby times cannot be empty.'));
|
||||
}
|
||||
if (!empty($values['theme_style']) && (empty($values['groupby_times']) || !in_array($values['groupby_times'], array('hour', 'half')))) {
|
||||
form_set_error('style_options][theme_style', t('Overlapping items only work with hour or half hour groupby times.'));
|
||||
}
|
||||
if (!empty($values['theme_style']) && !empty($values['groupby_field'])) {
|
||||
form_set_error('style_options][theme_style', t('You cannot use overlapping items and also try to group by a field value.'));
|
||||
}
|
||||
if ($values['groupby_times'] != 'custom') {
|
||||
form_set_value($form['groupby_times_custom'], NULL, $form_state);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to find the date argument handler for this view.
|
||||
*/
|
||||
function date_argument_handler() {
|
||||
$i = 0;
|
||||
foreach ($this->view->argument as $name => $handler) {
|
||||
if (date_views_handler_is_date($handler, 'argument')) {
|
||||
$this->date_info->date_arg_pos = $i;
|
||||
return $handler;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inspect argument and view information to see which calendar
|
||||
* period we should show. The argument tells us what to use
|
||||
* if there is no value, the view args tell us what to use
|
||||
* if there are values.
|
||||
*/
|
||||
function granularity() {
|
||||
|
||||
if (!$handler = $this->date_argument_handler()) {
|
||||
return 'month';
|
||||
}
|
||||
$default_granularity = !empty($handler) && !empty($handler->granularity) ? $handler->granularity : 'month';
|
||||
$wildcard = !empty($handler) ? $handler->options['exception']['value'] : '';
|
||||
$argument = $handler->argument;
|
||||
|
||||
// TODO Anything else we need to do for 'all' arguments?
|
||||
if ($argument == $wildcard) {
|
||||
$this->view_granularity = $default_granularity;
|
||||
}
|
||||
elseif (!empty($argument)) {
|
||||
module_load_include('inc', 'date_api', 'date_api_sql');
|
||||
|
||||
$date_handler = new date_sql_handler();
|
||||
$this->view_granularity = $date_handler->arg_granularity($argument);
|
||||
}
|
||||
else {
|
||||
$this->view_granularity = $default_granularity;
|
||||
}
|
||||
return $this->view_granularity;
|
||||
}
|
||||
|
||||
function has_calendar_row_plugin() {
|
||||
return $this->row_plugin instanceof calendar_plugin_row || $this->row_plugin instanceof calendar_plugin_row_node;
|
||||
}
|
||||
|
||||
function render() {
|
||||
if (empty($this->row_plugin) || !$this->has_calendar_row_plugin()) {
|
||||
debug('calendar_plugin_style: The calendar row plugin is required when using the calendar style, but it is missing.');
|
||||
return;
|
||||
}
|
||||
if (!$argument = $this->date_argument_handler()) {
|
||||
debug('calendar_plugin_style: A date argument is required when using the calendar style, but it is missing or is not using the default date.');
|
||||
return;
|
||||
}
|
||||
|
||||
// There are date arguments that have not been added by Date Views.
|
||||
// They will be missing the information we would need to render the field.
|
||||
if (empty($argument->min_date)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add information from the date argument to the view.
|
||||
$this->date_info->granularity = $this->granularity();
|
||||
$this->date_info->calendar_type = $this->options['calendar_type'];
|
||||
$this->date_info->date_arg = $argument->argument;
|
||||
$this->date_info->year = date_format($argument->min_date, 'Y');
|
||||
$this->date_info->month = date_format($argument->min_date, 'n');;
|
||||
$this->date_info->day = date_format($argument->min_date, 'j');
|
||||
$this->date_info->week = date_week(date_format($argument->min_date, DATE_FORMAT_DATE));
|
||||
$this->date_info->date_range = $argument->date_range;
|
||||
$this->date_info->min_date = $argument->min_date;
|
||||
$this->date_info->max_date = $argument->max_date;
|
||||
$this->date_info->limit = $argument->limit;
|
||||
$this->date_info->url = $this->view->get_url();
|
||||
$this->date_info->min_date_date = date_format($this->date_info->min_date, DATE_FORMAT_DATE);
|
||||
$this->date_info->max_date_date = date_format($this->date_info->max_date, DATE_FORMAT_DATE);
|
||||
$this->date_info->forbid = isset($argument->forbid) ? $argument->forbid : FALSE;
|
||||
|
||||
// Add calendar style information to the view.
|
||||
$this->date_info->calendar_popup = $this->display->handler->get_option('calendar_popup');
|
||||
$this->date_info->style_name_size = $this->options['name_size'];
|
||||
$this->date_info->mini = $this->options['mini'];
|
||||
$this->date_info->style_with_weekno = $this->options['with_weekno'];
|
||||
$this->date_info->style_multiday_theme = $this->options['multiday_theme'];
|
||||
$this->date_info->style_theme_style = $this->options['theme_style'];
|
||||
$this->date_info->style_max_items = $this->options['max_items'];
|
||||
$this->date_info->style_max_items_behavior = $this->options['max_items_behavior'];
|
||||
if (!empty($this->options['groupby_times_custom'])) {
|
||||
$this->date_info->style_groupby_times = explode(',', $this->options['groupby_times_custom']);
|
||||
}
|
||||
else {
|
||||
$this->date_info->style_groupby_times = calendar_groupby_times($this->options['groupby_times']);
|
||||
}
|
||||
$this->date_info->style_groupby_field = $this->options['groupby_field'];
|
||||
|
||||
// TODO make this an option setting.
|
||||
$this->date_info->style_show_empty_times = !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->date_info->min_date);
|
||||
$this->date_info->display_timezone = $display_timezone;
|
||||
$this->date_info->display_timezone_name = timezone_name_get($display_timezone);
|
||||
$date = clone($this->date_info->min_date);
|
||||
date_timezone_set($date, $display_timezone);
|
||||
$this->date_info->min_zone_string = date_format($date, DATE_FORMAT_DATE);
|
||||
$date = clone($this->date_info->max_date);
|
||||
date_timezone_set($date, $display_timezone);
|
||||
$this->date_info->max_zone_string = date_format($date, DATE_FORMAT_DATE);
|
||||
|
||||
// Identify the fields that need to be displayed on each item.
|
||||
$keys = array();
|
||||
foreach ($this->view->field as $key => $handler) {
|
||||
if (empty($handler->options['exclude'])) {
|
||||
$keys[] = $key;
|
||||
}
|
||||
}
|
||||
|
||||
// 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 = array();
|
||||
foreach ($this->view->result as $row_index => $row) {
|
||||
$this->view->row_index = $row_index;
|
||||
foreach ($this->row_plugin->render($row) as $item) {
|
||||
$item->granularity = $this->date_info->granularity;
|
||||
$rendered_fields = array();
|
||||
$item_start = date_format($item->calendar_start_date, DATE_FORMAT_DATE);
|
||||
$item_end = date_format($item->calendar_end_date, DATE_FORMAT_DATE);
|
||||
$time_start = date_format($item->calendar_start_date, 'H:i:s');
|
||||
foreach ($keys as $field) {
|
||||
$rendered_fields[] = $this->get_field($row_index, $field);
|
||||
}
|
||||
$item->rendered_fields = $rendered_fields;
|
||||
$items[$item_start][$time_start][] = $item;
|
||||
$this->view->row_index++;
|
||||
}
|
||||
}
|
||||
|
||||
ksort($items);
|
||||
|
||||
$rows = array();
|
||||
$this->curday = clone($this->date_info->min_date);
|
||||
$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 = array();
|
||||
$this->view->date_info->mini = TRUE;
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$rows[$i] = $this->calendar_build_mini_month();
|
||||
}
|
||||
$this->view->date_info->mini = FALSE;
|
||||
break;
|
||||
case 'month':
|
||||
$rows = !empty($this->date_info->mini) ? $this->calendar_build_mini_month() : $this->calendar_build_month();
|
||||
break;
|
||||
case 'day':
|
||||
$rows = $this->calendar_build_day();
|
||||
break;
|
||||
case 'week':
|
||||
$rows = $this->calendar_build_week();
|
||||
// Merge the day names in as the first row.
|
||||
$rows = array_merge(array(calendar_week_header($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->view->date_info->mini)) {
|
||||
$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'], array('week', 'day')) && !empty($this->options['multiday_theme']) && !empty($this->options['theme_style'])) {
|
||||
$this->definition['theme'] .= '_overlap';
|
||||
}
|
||||
|
||||
$output = theme($this->theme_functions(),
|
||||
array(
|
||||
'view' => $this->view,
|
||||
'options' => $this->options,
|
||||
'rows' => $rows
|
||||
));
|
||||
unset($this->view->row_index);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build one month.
|
||||
*/
|
||||
function calendar_build_month() {
|
||||
$month = date_format($this->curday, 'n');
|
||||
$curday_date = date_format($this->curday, DATE_FORMAT_DATE);
|
||||
$weekdays = calendar_untranslated_days($this->items, $this->view);
|
||||
date_modify($this->curday, '-' . strval(date_format($this->curday, 'j')-1) . ' days');
|
||||
$rows = array();
|
||||
do {
|
||||
$init_day = clone($this->curday);
|
||||
$today = date_format(date_now(date_default_timezone()), DATE_FORMAT_DATE);
|
||||
$month = date_format($this->curday, 'n');
|
||||
$week = date_week($curday_date);
|
||||
$first_day = variable_get('date_first_day', 0);
|
||||
$week_rows = $this->calendar_build_week(TRUE);
|
||||
$multiday_buckets = $week_rows['multiday_buckets'];
|
||||
$singleday_buckets = $week_rows['singleday_buckets'];
|
||||
$total_rows = $week_rows['total_rows'];
|
||||
|
||||
// Theme each row
|
||||
$output = "";
|
||||
$final_day = clone($this->curday);
|
||||
|
||||
$iehint = 0;
|
||||
$max_multirow_cnt = 0;
|
||||
$max_singlerow_cnt = 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->date_info->style_with_weekno) && !in_array($this->date_info->granularity, array('day', 'week'))) {
|
||||
$url = $this->view->get_path() . '/' . $this->date_info->year . '-W' . $week;
|
||||
if (!empty($this->date_info->display_types['week'])) {
|
||||
$weekno = l($week, $url, array('query' => !empty($this->date_info->append) ? $this->date_info->append : ''));
|
||||
}
|
||||
else {
|
||||
// Do not link week numbers, if Week views are disabled.
|
||||
$weekno = $week;
|
||||
}
|
||||
$item = array(
|
||||
'entry' => $weekno,
|
||||
'colspan' => 1,
|
||||
'rowspan' => $total_rows + 1,
|
||||
'id' => $this->view->name . '-weekno-' . $curday_date,
|
||||
'class' => 'week'
|
||||
);
|
||||
$inner .= theme('calendar_month_col', array('item' => $item));
|
||||
}
|
||||
|
||||
$this->curday = clone($init_day);
|
||||
|
||||
// move backwards to the first day of the week
|
||||
$day_wday = date_format($this->curday, 'w');
|
||||
date_modify($this->curday, '-' . strval((7 + $day_wday - $first_day) % 7) . ' days');
|
||||
|
||||
for ( $wday = 0; $wday < 7; $wday++) {
|
||||
|
||||
$curday_date = date_format($this->curday, DATE_FORMAT_DATE);
|
||||
$class = strtolower($weekdays[$wday]);
|
||||
$item = NULL;
|
||||
$in_month = !($curday_date < $this->date_info->min_date_date || $curday_date > $this->date_info->max_date_date || date_format($this->curday, 'n') != $month);
|
||||
|
||||
// Add the datebox
|
||||
if ($i == 0) {
|
||||
$variables = array(
|
||||
'date' => $curday_date,
|
||||
'view' => $this->view,
|
||||
'items' => $this->items,
|
||||
'selected' => $in_month ? count($multiday_buckets[$wday]) + count($singleday_buckets[$wday]) : FALSE,
|
||||
);
|
||||
$item = array(
|
||||
'entry' => theme('calendar_datebox', $variables),
|
||||
'colspan' => 1,
|
||||
'rowspan' => 1,
|
||||
'class' => 'date-box',
|
||||
'date' => $curday_date,
|
||||
'id' => $this->view->name . '-' . $curday_date . '-date-box'
|
||||
);
|
||||
$item['class'] .= ($curday_date == $today && $in_month ? ' today' : '') .
|
||||
($curday_date < $today ? ' past' : '') .
|
||||
($curday_date > $today ? ' future' : '');
|
||||
}
|
||||
else {
|
||||
$index = $i - 1;
|
||||
$multi_count = count($multiday_buckets[$wday]);
|
||||
|
||||
// Process multiday buckets first. If there is a multiday-bucket item in this row...
|
||||
if ($index < $multi_count) {
|
||||
// If this item is filled with either a blank or an entry...
|
||||
if ($multiday_buckets[$wday][$index]['filled']) {
|
||||
|
||||
// Add item and add class
|
||||
$item = $multiday_buckets[$wday][$index];
|
||||
$item['class'] = 'multi-day';
|
||||
$item['date'] = $curday_date;
|
||||
|
||||
// Is this an entry?
|
||||
if (!$multiday_buckets[$wday][$index]['avail']) {
|
||||
|
||||
// If the item either starts or ends on today,
|
||||
// then add tags so we can style the borders
|
||||
if ($curday_date == $today && $in_month) {
|
||||
$item['class'] .= ' starts-today';
|
||||
}
|
||||
|
||||
// Calculate on which day of this week this item ends on..
|
||||
$end_day = clone($this->curday);
|
||||
$span = $item['colspan'] - 1;
|
||||
date_modify($end_day, '+' . $span . ' day');
|
||||
$endday_date = date_format($end_day, DATE_FORMAT_DATE);
|
||||
|
||||
// If it ends today, add class
|
||||
if ($endday_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[$wday][$index]['avail']) {
|
||||
$item['class'] .= ' ' . $wday . ' ' . $index . ' no-entry ' . ($curday_date == $today && $in_month ? ' today' : '') .
|
||||
($curday_date < $today ? ' past' : '') .
|
||||
($curday_date > $today ? ' future' : '');
|
||||
}
|
||||
|
||||
// Else, process the single day bucket - we only do this once per day
|
||||
}
|
||||
elseif ($index == $multi_count) {
|
||||
$single_day_cnt = 0;
|
||||
// If it's empty, add class
|
||||
if (count($singleday_buckets[$wday]) == 0) {
|
||||
$single_days = " ";
|
||||
if ($max_multirow_cnt == 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[$wday] as $day) {
|
||||
foreach ($day as $event) {
|
||||
$single_day_cnt++;
|
||||
$single_days .= (isset($event['more_link'])) ? '<div class="calendar-more">' . $event['entry'] . '</div>' : $event['entry'];
|
||||
}
|
||||
}
|
||||
$class = 'single-day';
|
||||
}
|
||||
|
||||
$rowspan = $total_rows - $index;
|
||||
// Add item...
|
||||
$item = array(
|
||||
'entry' => $single_days,
|
||||
'colspan' => 1,
|
||||
'rowspan' => $rowspan,
|
||||
'class' => $class,
|
||||
'date' => $curday_date,
|
||||
'id' => $this->view->name . '-' . $curday_date . '-' . $index
|
||||
);
|
||||
|
||||
// Hack for ie to help it properly space single day rows
|
||||
if ($rowspan > 1 && $in_month && $single_day_cnt > 0) {
|
||||
$max_multirow_cnt = max($max_multirow_cnt, $single_day_cnt);
|
||||
}
|
||||
else {
|
||||
$max_singlerow_cnt = max($max_singlerow_cnt, $single_day_cnt);
|
||||
}
|
||||
|
||||
// If the singlerow 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_cnt >= $max_multirow_cnt || $max_multirow_cnt <= $multi_count / 2 ) {
|
||||
$iehint = 0;
|
||||
}
|
||||
elseif ($rowspan > 1 && $in_month && $single_day_cnt > 0) {
|
||||
$iehint = max($iehint, $rowspan - 1); // How many rows to adjust for?
|
||||
}
|
||||
|
||||
// Set the class
|
||||
$item['class'] .= ($curday_date == $today && $in_month ? ' today' : '') .
|
||||
($curday_date < $today ? ' past' : '') .
|
||||
($curday_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', array('item' => $item));
|
||||
}
|
||||
|
||||
date_modify($this->curday, '+1 day');
|
||||
}
|
||||
|
||||
if ($i == 0) {
|
||||
$output .= theme('calendar_month_row', array(
|
||||
'inner' => $inner,
|
||||
'class' => 'date-box',
|
||||
'iehint' => $iehint,
|
||||
));
|
||||
}
|
||||
elseif ($i == $total_rows) {
|
||||
$output .= theme('calendar_month_row', array(
|
||||
'inner' => $inner,
|
||||
'class' => 'single-day',
|
||||
'iehint' => $iehint,
|
||||
));
|
||||
$iehint = 0;
|
||||
$max_singlerow_cnt = 0;
|
||||
$max_multirow_cnt = 0;
|
||||
}
|
||||
else {
|
||||
// Style all the columns into a row
|
||||
$output .= theme('calendar_month_row', array(
|
||||
'inner' => $inner,
|
||||
'class' => 'multi-day',
|
||||
'iehint' => 0,
|
||||
));
|
||||
}
|
||||
|
||||
} // End foreach
|
||||
|
||||
$this->curday = $final_day;
|
||||
|
||||
// Add the row into the row array....
|
||||
$rows[] = array('data' => $output);
|
||||
|
||||
$curday_date = date_format($this->curday, DATE_FORMAT_DATE);
|
||||
$curday_month = date_format($this->curday, 'n');
|
||||
} while ($curday_month == $month && $curday_date <= $this->date_info->max_date_date);
|
||||
// Merge the day names in as the first row.
|
||||
$rows = array_merge(array(calendar_week_header($this->view)), $rows);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build one week row.
|
||||
*/
|
||||
function calendar_build_week($check_month = FALSE) {
|
||||
$curday_date = date_format($this->curday, DATE_FORMAT_DATE);
|
||||
$weekdays = calendar_untranslated_days($this->items, $this->view);
|
||||
$month = date_format($this->curday, 'n');
|
||||
$first_day = variable_get('date_first_day', 0);
|
||||
|
||||
// Set up buckets
|
||||
$total_rows = 0;
|
||||
$multiday_buckets = array( array(), array(), array(), array(), array(), array(), array());
|
||||
$singleday_buckets = array( array(), array(), array(), array(), array(), array(), array());
|
||||
|
||||
// move backwards to the first day of the week
|
||||
$day_wday = date_format($this->curday, 'w');
|
||||
date_modify($this->curday, '-' . strval((7 + $day_wday - $first_day) % 7) . ' days');
|
||||
$curday_date = date_format($this->curday, DATE_FORMAT_DATE);
|
||||
|
||||
for ($i = 0; $i < 7; $i++) {
|
||||
if ($check_month && ($curday_date < $this->date_info->min_date_date || $curday_date > $this->date_info->max_date_date || date_format($this->curday, 'n') != $month)) {
|
||||
$class = strtolower($weekdays[$i]) . ' empty';
|
||||
$singleday_buckets[$i][][] = array(
|
||||
'entry' => theme('calendar_empty_day', array(
|
||||
'curday' => $curday_date,
|
||||
'view' => $this->view,
|
||||
)),
|
||||
'item' => NULL
|
||||
);
|
||||
}
|
||||
else {
|
||||
$this->calendar_build_week_day($i, $multiday_buckets, $singleday_buckets);
|
||||
}
|
||||
$total_rows = max(count($multiday_buckets[$i]) + 1, $total_rows);
|
||||
date_modify($this->curday, '+1 day');
|
||||
$curday_date = date_format($this->curday, DATE_FORMAT_DATE);
|
||||
}
|
||||
|
||||
$rows = array(
|
||||
'multiday_buckets' => $multiday_buckets,
|
||||
'singleday_buckets' => $singleday_buckets,
|
||||
'total_rows' => $total_rows);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the contents of a single day for the $rows results.
|
||||
*/
|
||||
function calendar_build_week_day($wday, &$multiday_buckets, &$singleday_buckets) {
|
||||
$curday_date = date_format($this->curday, DATE_FORMAT_DATE);
|
||||
$max_events = $this->date_info->calendar_type == 'month' && !empty($this->date_info->style_max_items) ? $this->date_info->style_max_items : 0;
|
||||
$hide = !empty($this->date_info->style_max_items_behavior) ? ($this->date_info->style_max_items_behavior == 'hide') : FALSE;
|
||||
$multiday_theme = !empty($this->date_info->style_multiday_theme) && $this->date_info->style_multiday_theme == '1';
|
||||
$first_day = variable_get('date_first_day', 0);
|
||||
$cur_cnt = 0;
|
||||
$total_cnt = 0;
|
||||
$ids = array();
|
||||
|
||||
// If we are hiding, count before processing further
|
||||
if ($max_events != CALENDAR_SHOW_ALL) {
|
||||
foreach ($this->items as $date => $day) {
|
||||
if ($date == $curday_date) {
|
||||
foreach ($day as $time => $hour) {
|
||||
foreach ($hour as $key => $item) {
|
||||
$total_cnt++;
|
||||
$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_cnt < $max_events) {
|
||||
// Count currently filled items
|
||||
foreach ($multiday_buckets[$wday] as $bucket) {
|
||||
if (!$bucket['avail']) {
|
||||
$cur_cnt++;
|
||||
}
|
||||
}
|
||||
foreach ($this->items as $date => $day) {
|
||||
if ($date == $curday_date) {
|
||||
ksort($day);
|
||||
foreach ($day as $time => $hour) {
|
||||
foreach ($hour as $key => $item) {
|
||||
$all_day = $item->calendar_all_day;
|
||||
|
||||
// Parse out date part
|
||||
$start_ydate = date_format($item->date_start, DATE_FORMAT_DATE);
|
||||
$end_ydate = date_format($item->date_end, DATE_FORMAT_DATE);
|
||||
$cur_ydate = date_format($this->curday, DATE_FORMAT_DATE);
|
||||
|
||||
$is_multi_day = ($start_ydate < $cur_ydate || $end_ydate > $cur_ydate);
|
||||
|
||||
// Does this event span multi-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_cnt--;
|
||||
|
||||
// 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 = date_format($this->curday, 'd');
|
||||
if ($wday == 0 || $start_ydate == $cur_ydate || ($this->date_info->granularity == '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 = $this->curday->difference($this->date_info->max_date, 'days');
|
||||
$remaining_days = ($this->date_info->granularity == 'month') ? min(6 - $wday, $diff) : $diff - 1;
|
||||
// The bucket_cnt defines the colspan. colspan = bucket_cnt + 1
|
||||
$days = $this->curday->difference($item->date_end, '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
|
||||
$avail = FALSE;
|
||||
$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->date_start < $this->curday);
|
||||
$item->continues = ( $days > $bucket_cnt );
|
||||
|
||||
// Assign the item to the available bucket
|
||||
$multiday_buckets[$wday][$bucket_index] = array(
|
||||
'colspan' => $bucket_cnt + 1,
|
||||
'rowspan' => 1,
|
||||
'filled' => TRUE,
|
||||
'avail' => FALSE,
|
||||
'all_day' => $all_day,
|
||||
'item' => $item,
|
||||
'wday' => $wday,
|
||||
'entry' => theme('calendar_item', array('view' => $this->view, 'rendered_fields' => $item->rendered_fields, '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) ] = array(
|
||||
'entry' => ' ',
|
||||
'colspan' => 1,
|
||||
'rowspan' => 1,
|
||||
'filled' => TRUE,
|
||||
'avail' => TRUE,
|
||||
'wday' => $wday,
|
||||
'item' => NULL
|
||||
);
|
||||
}
|
||||
$bucket[$bucket_index] = array(
|
||||
'filled' => FALSE,
|
||||
'avail' => FALSE
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($max_events == CALENDAR_SHOW_ALL || $cur_cnt < $max_events) {
|
||||
$cur_cnt++;
|
||||
// Assign to single day bucket
|
||||
$singleday_buckets[$wday][$time][] = array(
|
||||
'entry' => theme('calendar_item', array('view' => $this->view, 'rendered_fields' => $item->rendered_fields, '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_cnt > 0 && $cur_cnt < $total_cnt) {
|
||||
$entry = theme('calendar_' . $this->date_info->calendar_type . '_multiple_entity', array(
|
||||
'curday' => $curday_date,
|
||||
'count' => $total_cnt,
|
||||
'view' => $this->view,
|
||||
'ids' => $ids,
|
||||
));
|
||||
if (!empty($entry)) {
|
||||
$singleday_buckets[$wday][][] = array(
|
||||
'entry' => $entry,
|
||||
'more_link' => TRUE,
|
||||
'item' => NULL
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the contents of a single day for the $rows results.
|
||||
*/
|
||||
function calendar_build_day() {
|
||||
$curday_date = date_format($this->curday, DATE_FORMAT_DATE);
|
||||
$selected = FALSE;
|
||||
$max_events = !empty($this->date_info->style_max_items) ? $this->date_info->style_max_items : 0;
|
||||
$ids = array();
|
||||
$inner = array();
|
||||
$all_day = array();
|
||||
$empty = '';
|
||||
$link = '';
|
||||
$count = 0;
|
||||
foreach ($this->items as $date => $day) {
|
||||
if ($date == $curday_date) {
|
||||
$count = 0;
|
||||
$selected = TRUE;
|
||||
ksort($day);
|
||||
foreach ($day as $time => $hour) {
|
||||
foreach ($hour as $key => $item) {
|
||||
$count++;
|
||||
if (isset($item->type)) {
|
||||
$ids[$item->type] = $item;
|
||||
}
|
||||
if (empty($this->date_info->mini) && ($max_events == CALENDAR_SHOW_ALL || $count <= $max_events || ($count > 0 && $max_events == CALENDAR_HIDE_ALL))) {
|
||||
if ($item->calendar_all_day) {
|
||||
$all_day[] = $item;
|
||||
}
|
||||
else {
|
||||
$key = date_format($item->calendar_start_date, 'H:i:s');
|
||||
$inner[$key][] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ksort($inner);
|
||||
|
||||
if (empty($inner) && empty($all_day)) {
|
||||
$empty = theme('calendar_empty_day', array('curday' => $curday_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->date_info->calendar_type != 'day' && !$this->date_info->mini) {
|
||||
if ($this->date_info->style_max_items_behavior == 'hide' || $max_events == CALENDAR_HIDE_ALL) {
|
||||
$all_day = array();
|
||||
$inner = array();
|
||||
}
|
||||
$link = theme('calendar_' . $this->date_info->calendar_type . '_multiple_node', array(
|
||||
'curday' => $curday_date,
|
||||
'count' => $count,
|
||||
'view' => $this->view,
|
||||
'ids' => $ids,
|
||||
));
|
||||
}
|
||||
|
||||
$content = array(
|
||||
'date' => $curday_date,
|
||||
'datebox' => theme('calendar_datebox', array(
|
||||
'date' => $curday_date,
|
||||
'view' => $this->view,
|
||||
'items' => $this->items,
|
||||
'selected' => $selected,
|
||||
)),
|
||||
'empty' => $empty,
|
||||
'link' => $link,
|
||||
'all_day' => $all_day,
|
||||
'items' => $inner,
|
||||
);
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build one mini month.
|
||||
*/
|
||||
function calendar_build_mini_month() {
|
||||
$month = date_format($this->curday, 'n');
|
||||
date_modify($this->curday, '-' . strval(date_format($this->curday, 'j')-1) . ' days');
|
||||
$rows = array();
|
||||
do {
|
||||
$rows = array_merge($rows, $this->calendar_build_mini_week());
|
||||
$curday_date = date_format($this->curday, DATE_FORMAT_DATE);
|
||||
$curday_month = date_format($this->curday, 'n');
|
||||
} while ($curday_month == $month && $curday_date <= $this->date_info->max_date_date);
|
||||
// Merge the day names in as the first row.
|
||||
$rows = array_merge(array(calendar_week_header($this->view)), $rows);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build one week row.
|
||||
*/
|
||||
function calendar_build_mini_week($check_month = TRUE) {
|
||||
$curday_date = date_format($this->curday, DATE_FORMAT_DATE);
|
||||
$weekdays = calendar_untranslated_days($this->items, $this->view);
|
||||
$today = date_format(date_now(date_default_timezone()), DATE_FORMAT_DATE);
|
||||
$month = date_format($this->curday, 'n');
|
||||
$week = date_week($curday_date);
|
||||
$first_day = variable_get('date_first_day', 0);
|
||||
// move backwards to the first day of the week
|
||||
$day_wday = date_format($this->curday, 'w');
|
||||
date_modify($this->curday, '-' . strval((7 + $day_wday - $first_day) % 7) . ' days');
|
||||
$curday_date = date_format($this->curday, DATE_FORMAT_DATE);
|
||||
|
||||
for ($i = 0; $i < 7; $i++) {
|
||||
$curday_date = date_format($this->curday, DATE_FORMAT_DATE);
|
||||
$class = strtolower($weekdays[$i] . ' mini');
|
||||
if ($check_month && ($curday_date < $this->date_info->min_date_date || $curday_date > $this->date_info->max_date_date || date_format($this->curday, 'n') != $month)) {
|
||||
$class .= ' empty';
|
||||
$variables = array(
|
||||
'curday' => $curday_date,
|
||||
'view' => $this->view,
|
||||
);
|
||||
|
||||
$content = array(
|
||||
'date' => '',
|
||||
'datebox' => '',
|
||||
'empty' => theme('calendar_empty_day', $variables),
|
||||
'link' => '',
|
||||
'all_day' => array(),
|
||||
'items' => array(),
|
||||
);
|
||||
}
|
||||
else {
|
||||
$content = $this->calendar_build_day();
|
||||
$class .= ($curday_date == $today ? ' today' : '') .
|
||||
($curday_date < $today ? ' past' : '') .
|
||||
($curday_date > $today ? ' future' : '') .
|
||||
(empty($this->items[$curday_date]) ? ' has-no-events' : ' has-events');
|
||||
}
|
||||
$rows[$week][] = array(
|
||||
'data' => $content,
|
||||
'class' => $class,
|
||||
'id' => $this->view->name . '-' . $curday_date,
|
||||
);
|
||||
date_modify($this->curday, '+1 day');
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
}
|
27
sites/all/modules/calendar/js/calendar_colorpicker.js
Normal file
27
sites/all/modules/calendar/js/calendar_colorpicker.js
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Implementation of hook_elements.
|
||||
*
|
||||
* Much of the colorpicker code was adapted from the Colorpicker module.
|
||||
* That module has no stable release yet nor any D6 branch.
|
||||
*/
|
||||
/*
|
||||
* Bind the colorpicker event to the form element
|
||||
*/
|
||||
(function ($) {
|
||||
Drupal.behaviors.field_example_colorpicker = {
|
||||
attach: function(context) {
|
||||
$(".edit-calendar-colorpicker").live("focus", function(event) {
|
||||
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);
|
||||
|
87
sites/all/modules/calendar/js/calendar_overlap.js
Normal file
87
sites/all/modules/calendar/js/calendar_overlap.js
Normal file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Create the splitter, set the viewport size, and set the position of the scrollbar to the first item.
|
||||
*/
|
||||
(function($){
|
||||
Drupal.behaviors.calendarSetScroll = {
|
||||
attach: function(context) {
|
||||
// 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);
|
||||
}
|
||||
});
|
||||
|
||||
// Size the window
|
||||
calendar_resizeViewport($);
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
||||
|
||||
// Scroll the viewport to the first item
|
||||
function calendar_scrollToFirst($) {
|
||||
if ($('div.first_item').size() > 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);
|
||||
}
|
18
sites/all/modules/calendar/theme/calendar-datebox.tpl.php
Normal file
18
sites/all/modules/calendar/theme/calendar-datebox.tpl.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Template to display the date box in a calendar.
|
||||
*
|
||||
* - $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.
|
||||
*/
|
||||
?>
|
||||
<div class="<?php print $granularity ?> <?php print $class; ?>"> <?php print !empty($selected) ? $link : $day; ?> </div>
|
137
sites/all/modules/calendar/theme/calendar-day-overlap.tpl.php
Normal file
137
sites/all/modules/calendar/theme/calendar-day-overlap.tpl.php
Normal file
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
/**
|
||||
* @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.
|
||||
*/
|
||||
//dsm('Display: '. $display_type .': '. $min_date_formatted .' to '. $max_date_formatted);
|
||||
?>
|
||||
<div class="calendar-calendar"><div class="day-view">
|
||||
<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="<?php print $agenda_hour_class ?> first">
|
||||
<span class="calendar-hour"><?php print t('All day', array(), array('context' => 'datetime')) ?></span>
|
||||
</td>
|
||||
<td class="calendar-agenda-items multi-day last">
|
||||
<?php foreach ($columns as $column): ?>
|
||||
<div class="calendar">
|
||||
<div class="inner">
|
||||
<?php print isset($rows['all_day'][$column]) ? implode($rows['all_day'][$column]) : ' ';?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="header-body-divider"> </div>
|
||||
<div id="single-day-container">
|
||||
<?php if (!empty($scroll_content)) : ?>
|
||||
<script>
|
||||
try {
|
||||
// Hide container while it renders... Degrade w/o javascript support
|
||||
jQuery('#single-day-container').css('visibility','hidden');
|
||||
}catch(e){
|
||||
// swallow
|
||||
}
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
<table class="full">
|
||||
<tbody>
|
||||
<tr class="holder">
|
||||
<td class="calendar-time-holder"></td>
|
||||
<td class="calendar-day-holder"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="first">
|
||||
<?php $is_first = TRUE; ?>
|
||||
<?php foreach ($rows['items'] as $time_cnt => $hour): ?>
|
||||
<?php
|
||||
if ($time_cnt == 0) {
|
||||
$class = 'first ';
|
||||
}
|
||||
elseif ($time_cnt == count($start_times) - 1) {
|
||||
$class = 'last ';
|
||||
}
|
||||
else {
|
||||
$class = '';
|
||||
} ?>
|
||||
<div class="<?php print $class?>calendar-agenda-hour">
|
||||
<span class="calendar-hour"><?php print $hour['hour']; ?></span><span class="calendar-ampm"><?php print $hour['ampm']; ?></span>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</td>
|
||||
<td class="last">
|
||||
<?php foreach ($rows['items'] as $time_cnt => $hour): ?>
|
||||
<?php
|
||||
if ($time_cnt == 0) {
|
||||
$class = 'first ';
|
||||
}
|
||||
elseif ($time_cnt == count($start_times) - 1) {
|
||||
$class = 'last ';
|
||||
}
|
||||
else {
|
||||
$class = '';
|
||||
} ?>
|
||||
<div class="<?php print $class?>calendar-agenda-items single-day">
|
||||
<div class="half-hour"> </div>
|
||||
<?php if ($is_first && isset($hour['values'][$column])) :?>
|
||||
<div class="calendar item-wrapper first_item">
|
||||
<?php $is_first = FALSE; ?>
|
||||
<?php else : ?>
|
||||
<div class="calendar item-wrapper">
|
||||
<?php endif; ?>
|
||||
<div class="inner">
|
||||
<?php print isset($hour['values'][$column]) ? implode($hour['values'][$column]) : ' '; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="single-day-footer"> </div>
|
||||
</div></div>
|
||||
<?php if (!empty($scroll_content)) : ?>
|
||||
<script>
|
||||
try {
|
||||
// Size and position the viewport inline so there are no delays
|
||||
calendar_resizeViewport(jQuery);
|
||||
calendar_scrollToFirst(jQuery);
|
||||
jQuery('#single-day-container').css('visibility','visible');
|
||||
}catch(e){
|
||||
// swallow
|
||||
}
|
||||
</script>
|
||||
<?php endif; ?>
|
79
sites/all/modules/calendar/theme/calendar-day.tpl.php
Normal file
79
sites/all/modules/calendar/theme/calendar-day.tpl.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
* @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.
|
||||
*/
|
||||
//dsm('Display: '. $display_type .': '. $min_date_formatted .' to '. $max_date_formatted);
|
||||
?>
|
||||
<div class="calendar-calendar"><div class="day-view">
|
||||
<table class="full">
|
||||
<col width="<?php print $first_column_width?>"></col>
|
||||
<thead>
|
||||
<?php foreach ($columns as $column): ?>
|
||||
<col width="<?php print $column_width; ?>%"></col>
|
||||
<?php endforeach; ?>
|
||||
<tr>
|
||||
<th class="calendar-dayview-hour"><?php print $by_hour_count > 0 ? t('Time') : ''; ?></th>
|
||||
<?php foreach ($columns as $column): ?>
|
||||
<th class="calendar-agenda-items"><?php print $column; ?></th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="<?php print $agenda_hour_class ?>">
|
||||
<span class="calendar-hour"><?php print $by_hour_count > 0 ? t('All day', array(), array('context' => 'datetime')) : ''; ?></span>
|
||||
</td>
|
||||
<?php foreach ($columns as $column): ?>
|
||||
<td class="calendar-agenda-items multi-day">
|
||||
<div class="calendar">
|
||||
<div class="inner">
|
||||
<?php print isset($rows['all_day'][$column]) ? implode($rows['all_day'][$column]) : ' ';?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php foreach ($rows['items'] as $hour): ?>
|
||||
<tr>
|
||||
<td class="calendar-agenda-hour">
|
||||
<span class="calendar-hour"><?php print $hour['hour']; ?></span><span class="calendar-ampm"><?php print $hour['ampm']; ?></span>
|
||||
</td>
|
||||
<?php foreach ($columns as $column): ?>
|
||||
<td class="calendar-agenda-items single-day">
|
||||
<div class="calendar">
|
||||
<div class="inner">
|
||||
<?php print isset($hour['values'][$column]) ? implode($hour['values'][$column]) : ' '; ?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div></div>
|
62
sites/all/modules/calendar/theme/calendar-item.tpl.php
Normal file
62
sites/all/modules/calendar/theme/calendar-item.tpl.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* @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.
|
||||
*
|
||||
* You can use PHP date functions on the date object to display date
|
||||
* information in other ways, like:
|
||||
*
|
||||
* print date_format($calendar_start_date, 'l, j F Y - g:ia');
|
||||
*
|
||||
* @see template_preprocess_calendar_item.
|
||||
*/
|
||||
$index = 0;
|
||||
?>
|
||||
<div class="<?php print !empty($item->class) ? $item->class : 'item'; ?>">
|
||||
<div class="view-item view-item-<?php print $view->name ?>">
|
||||
<div class="calendar <?php print $item->granularity; ?>view">
|
||||
<?php print theme('calendar_stripe_stripe', array('item' => $item)); ?>
|
||||
<div class="<?php print $item->date_id ?> contents">
|
||||
<?php foreach ($rendered_fields as $field): ?>
|
||||
<?php if ($index++ == 0 && (isset($item->continuation) && $item->continuation)) : ?>
|
||||
<div class="continuation">«</div>
|
||||
<?php endif;?>
|
||||
<?php print $field; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php if (isset($item->continues) && $item->continues) : ?>
|
||||
<div class="continues">»</div>
|
||||
<?php else : ?>
|
||||
<div class="cutoff"> </div>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
57
sites/all/modules/calendar/theme/calendar-mini.tpl.php
Normal file
57
sites/all/modules/calendar/theme/calendar-mini.tpl.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Template to display a view as a mini calendar month.
|
||||
*
|
||||
* @see template_preprocess_calendar_mini.
|
||||
*
|
||||
* $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.
|
||||
*
|
||||
* $show_title: If the title should be displayed. Normally false since the title is incorporated
|
||||
* into the navigation, but sometimes needed, like in the year view of mini calendars.
|
||||
*
|
||||
*/
|
||||
//dsm('Display: '. $display_type .': '. $min_date_formatted .' to '. $max_date_formatted);dsm($day_names);
|
||||
$params = array(
|
||||
'view' => $view,
|
||||
'granularity' => 'month',
|
||||
'link' => FALSE,
|
||||
);
|
||||
?>
|
||||
<div class="calendar-calendar"><div class="month-view">
|
||||
<?php if ($show_title): ?>
|
||||
<div class="date-nav-wrapper clear-block">
|
||||
<div class="date-nav">
|
||||
<div class="date-heading">
|
||||
<?php print theme('date_nav_title', $params) ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<table class="mini">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php foreach ($day_names as $cell): ?>
|
||||
<th class="<?php print $cell['class']; ?>">
|
||||
<?php print $cell['data']; ?>
|
||||
</th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ((array) $rows as $row): ?>
|
||||
<tr>
|
||||
<?php foreach ($row as $cell): ?>
|
||||
<td id="<?php print $cell['id']; ?>" class="<?php print $cell['class']; ?>">
|
||||
<?php print $cell['data']; ?>
|
||||
</td>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div></div>
|
15
sites/all/modules/calendar/theme/calendar-month-col.tpl.php
Normal file
15
sites/all/modules/calendar/theme/calendar-month-col.tpl.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Template to display a column
|
||||
*
|
||||
* - $item: The item to render within a td element.
|
||||
*/
|
||||
$id = (isset($item['id'])) ? 'id="' . $item['id'] . '" ' : '';
|
||||
$date = (isset($item['date'])) ? ' date="' . $item['date'] . '" ' : '';
|
||||
?>
|
||||
<td <?php print $id?>class="<?php print $item['class'] ?>" colspan="<?php print $item['colspan'] ?>" rowspan="<?php print $item['rowspan'] ?>"<?php print $date ?>>
|
||||
<div class="inner">
|
||||
<?php print $item['entry'] ?>
|
||||
</div>
|
||||
</td>
|
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Template to display a summary of the days items as a calendar month entity.
|
||||
*
|
||||
*
|
||||
* @see template_preprocess_calendar_month_multiple_entity.
|
||||
*/
|
||||
?>
|
||||
<div class="view-item view-item-<?php print $view->name ?>">
|
||||
<div class="calendar monthview" id="<?php print $curday ?>">
|
||||
<?php foreach ($ids as $id): ?>
|
||||
<?php if ($view->date_info->style_max_items_behavior != 'more'): ?>
|
||||
<?php //print theme('calendar_stripe_stripe', $id); ?>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<div class="view-item <?php //print views_css_safe('view-item-'. $view->name) ?>">
|
||||
<?php if ($view->date_info->style_max_items_behavior != 'more'): ?>
|
||||
<div class="multiple-events">
|
||||
<?php print l(t('Click to see all @count events', array('@count' => $count)), $link) ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="calendar-more"><?php print l(t('more'), $link) ?>»</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
17
sites/all/modules/calendar/theme/calendar-month-row.tpl.php
Normal file
17
sites/all/modules/calendar/theme/calendar-month-row.tpl.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Template to display a row
|
||||
*
|
||||
* - $inner: The rendered string of the row's contents.
|
||||
*/
|
||||
$attrs = ($class) ? 'class="' . $class . '"': '';
|
||||
$attrs .= ($iehint > 0) ? ' iehint="' . $iehint . '"' : '';
|
||||
?>
|
||||
<?php if ($attrs != ''):?>
|
||||
<tr <?php print $attrs?>>
|
||||
<?php else:?>
|
||||
<tr>
|
||||
<?php endif;?>
|
||||
<?php print $inner ?>
|
||||
</tr>
|
56
sites/all/modules/calendar/theme/calendar-month.tpl.php
Normal file
56
sites/all/modules/calendar/theme/calendar-month.tpl.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Template to display a view as a calendar month.
|
||||
*
|
||||
* @see template_preprocess_calendar_month.
|
||||
*
|
||||
* $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
|
||||
*
|
||||
*/
|
||||
//dsm('Display: '. $display_type .': '. $min_date_formatted .' to '. $max_date_formatted);
|
||||
?>
|
||||
<div class="calendar-calendar"><div class="month-view">
|
||||
<table class="full">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php foreach ($day_names as $cell): ?>
|
||||
<th class="<?php print $cell['class']; ?>">
|
||||
<?php print $cell['data']; ?>
|
||||
</th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach ((array) $rows as $row) {
|
||||
print $row['data'];
|
||||
} ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div></div>
|
||||
<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>
|
45
sites/all/modules/calendar/theme/calendar-row-node.tpl.php
Normal file
45
sites/all/modules/calendar/theme/calendar-row-node.tpl.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Template to display a view item as a calendar month node.
|
||||
*
|
||||
* $node
|
||||
* A node object for this calendar item. Note this is
|
||||
* not a complete node object, but it will have $node->nid
|
||||
* that you can use to load the full object, and
|
||||
* $node->type to tell the content type of the node.
|
||||
*
|
||||
* $fields
|
||||
* An array of information for every field selected in the 'Fields'
|
||||
* section of this view, formatted as requested in the View setup.
|
||||
*
|
||||
* 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 nodes 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.
|
||||
*
|
||||
* You can use PHP date functions on the date object to display date
|
||||
* information in other ways, like:
|
||||
*
|
||||
* print date_format($calendar_start_date, 'l, j F Y - g:ia');
|
||||
*
|
||||
* @see template_preprocess_calendar_row_node.
|
||||
*/
|
||||
?>
|
||||
<div class="view-item view-item-<?php print $view->name ?>">
|
||||
<div class="<?php print $item->class; ?>">
|
||||
<?php print theme('calendar_stripe_stripe', array('node' => $item)); ?>
|
||||
<?php print $item->body; ?>
|
||||
</div>
|
||||
</div>
|
1
sites/all/modules/calendar/theme/calendar-style.tpl.php
Normal file
1
sites/all/modules/calendar/theme/calendar-style.tpl.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php ?>
|
235
sites/all/modules/calendar/theme/calendar-week-overlap.tpl.php
Normal file
235
sites/all/modules/calendar/theme/calendar-week-overlap.tpl.php
Normal file
@@ -0,0 +1,235 @@
|
||||
<?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.
|
||||
*
|
||||
*/
|
||||
//dsm('Display: '. $display_type .': '. $min_date_formatted .' to '. $max_date_formatted);
|
||||
?>
|
||||
|
||||
<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>
|
||||
<?php foreach ($day_names as $cell): ?>
|
||||
<th class="<?php print $cell['class']; ?>">
|
||||
<?php print $cell['data']; ?>
|
||||
</th>
|
||||
<?php endforeach; ?>
|
||||
<th class="calendar-day-holder margin-right"></th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<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>
|
||||
<?php for ($i = 0; $i < $multiday_rows; $i++): ?>
|
||||
<?php
|
||||
$colpos = 0;
|
||||
$rowclass = "all-day";
|
||||
if ($i == 0) {
|
||||
$rowclass .= " first";
|
||||
}
|
||||
if ($i == $multiday_rows - 1) {
|
||||
$rowclass .= " last";
|
||||
}
|
||||
?>
|
||||
<tr class="<?php print $rowclass?>">
|
||||
<?php if($i == 0 && ($by_hour_count > 0 || !empty($start_times))) :?>
|
||||
<td class="<?php print $agenda_hour_class ?>" rowspan="<?php print $multiday_rows?>">
|
||||
<span class="calendar-hour"><?php print t('All day', array(), array('context' => 'datetime'))?></span>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<?php for($j = 0; $j < 7; $j++): ?>
|
||||
<?php $cell = (empty($all_day[$j][$i])) ? NULL : $all_day[$j][$i]; ?>
|
||||
<?php if($cell != NULL && $cell['filled'] && $cell['wday'] == $j): ?>
|
||||
<?php for($colpos; $colpos < $cell['wday']; $colpos++) : ?>
|
||||
<?php
|
||||
$colclass = "calendar-agenda-items multi-day";
|
||||
if ($colpos == 0) {
|
||||
$colclass .= " first";
|
||||
}
|
||||
if ($colpos == 6) {
|
||||
$colclass .= " last";
|
||||
}
|
||||
?>
|
||||
<td class="<?php print $colclass?>"><div class="inner"> </div></td>
|
||||
<?php endfor;?>
|
||||
<?php
|
||||
$colclass = "calendar-agenda-items multi-day";
|
||||
if ($colpos == 0) {
|
||||
$colclass .= " first";
|
||||
}
|
||||
if ($colpos == 6) {
|
||||
$colclass .= " last";
|
||||
}
|
||||
?>
|
||||
<td colspan="<?php print $cell['colspan']?>" class="<?php print $colclass?>">
|
||||
<div class="inner">
|
||||
<?php print $cell['entry']?>
|
||||
</div>
|
||||
</td>
|
||||
<?php $colpos += $cell['colspan']; ?>
|
||||
<?php endif; ?>
|
||||
<?php endfor; ?>
|
||||
<?php while($colpos < 7) : ?>
|
||||
<?php
|
||||
$colclass = "calendar-agenda-items multi-day no-entry";
|
||||
if ($colpos == 0) {
|
||||
$colclass .= " first";
|
||||
}
|
||||
if ($colpos == 6) {
|
||||
$colclass .= " last";
|
||||
}
|
||||
?>
|
||||
<td class="<?php print $colclass?>"><div class="inner"> </div></td>
|
||||
<?php $colpos++; ?>
|
||||
<?php endwhile;?>
|
||||
</tr>
|
||||
<?php endfor; ?>
|
||||
<?php if ($multiday_rows == 0) :?>
|
||||
<tr>
|
||||
<td class="<?php print $agenda_hour_class ?>">
|
||||
<span class="calendar-hour"><?php print t('All day', array(), array('context' => 'datetime'))?></span>
|
||||
</td>
|
||||
<?php for($j = 0; $j < 7; $j++): ?>
|
||||
<?php
|
||||
$colclass = "calendar-agenda-items multi-day no-entry";
|
||||
if ($j == 0) {
|
||||
$colclass .= " first";
|
||||
}
|
||||
if ($j == 6) {
|
||||
$colclass .= " last";
|
||||
}
|
||||
?>
|
||||
<td class="<?php print $colclass?>"><div class="inner"> </div></td>
|
||||
<?php endfor; ?>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<tr class="expand">
|
||||
<td class="<?php print $agenda_hour_class ?>">
|
||||
<span class="calendar-hour"> </span>
|
||||
</td>
|
||||
<?php for($j = 0; $j < 7; $j++): ?>
|
||||
<?php
|
||||
$colclass = "calendar-agenda-items multi-day no-entry";
|
||||
if ($j == 0) {
|
||||
$colclass .= " first";
|
||||
}
|
||||
if ($j == 6) {
|
||||
$colclass .= " last";
|
||||
}
|
||||
?>
|
||||
<td class="<?php print $colclass?>"><div class="inner"> </div></td>
|
||||
<?php endfor; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
</div>
|
||||
<div class="header-body-divider"> </div>
|
||||
<div id="single-day-container">
|
||||
<?php if (!empty($scroll_content)) : ?>
|
||||
<script>
|
||||
try {
|
||||
// Hide container while it renders... Degrade w/o javascript support
|
||||
jQuery('#single-day-container').css('visibility','hidden');
|
||||
}catch(e){
|
||||
// swallow
|
||||
}
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
<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>
|
||||
<?php for ($index = 0; $index < 8; $index++): ?>
|
||||
<?php if ($index == 0 ): ?>
|
||||
<td class="first">
|
||||
<?php elseif ($index == 7 ) : ?>
|
||||
<td class="last">
|
||||
<?php else : ?>
|
||||
<td>
|
||||
<?php endif; ?>
|
||||
<?php foreach ($start_times as $time_cnt => $start_time): ?>
|
||||
<?php
|
||||
if ($time_cnt == 0) {
|
||||
$class = 'first ';
|
||||
}
|
||||
elseif ($time_cnt == count($start_times) - 1) {
|
||||
$class = 'last ';
|
||||
}
|
||||
else {
|
||||
$class = '';
|
||||
} ?>
|
||||
<?php if( $index == 0 ): ?>
|
||||
<?php $time = $items[$start_time];?>
|
||||
<div class="<?php print $class?>calendar-agenda-hour">
|
||||
<span class="calendar-hour"><?php print $time['hour']; ?></span><span class="calendar-ampm"><?php print $time['ampm']; ?></span>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="<?php print $class?>calendar-agenda-items single-day">
|
||||
<div class="half-hour"> </div>
|
||||
<div class="calendar item-wrapper">
|
||||
<div class="inner">
|
||||
<?php if(!empty($items[$start_time]['values'][$index - 1])) :?>
|
||||
<?php foreach($items[$start_time]['values'][$index - 1] as $item) :?>
|
||||
<?php if (isset($item['is_first']) && $item['is_first']) :?>
|
||||
<div class="item <?php print $item['class']?> first_item">
|
||||
<?php else : ?>
|
||||
<div class="item <?php print $item['class']?>">
|
||||
<?php endif; ?>
|
||||
<?php print $item['entry'] ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endforeach;?>
|
||||
</td>
|
||||
<?php endfor;?>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="single-day-footer"> </div>
|
||||
</div></div>
|
||||
<?php if (!empty($scroll_content)) : ?>
|
||||
<script>
|
||||
try {
|
||||
// Size and position the viewport inline so there are no delays
|
||||
calendar_resizeViewport(jQuery);
|
||||
calendar_scrollToFirst(jQuery);
|
||||
|
||||
// Show it now that it is complete and positioned
|
||||
jQuery('#single-day-container').css('visibility','visible');
|
||||
}catch(e){
|
||||
// swallow
|
||||
}
|
||||
</script>
|
||||
<?php endif; ?>
|
122
sites/all/modules/calendar/theme/calendar-week.tpl.php
Normal file
122
sites/all/modules/calendar/theme/calendar-week.tpl.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Template to display a view as a calendar week.
|
||||
*
|
||||
* @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.
|
||||
*
|
||||
*/
|
||||
//dsm('Display: '. $display_type .': '. $min_date_formatted .' to '. $max_date_formatted);
|
||||
//dsm($rows);
|
||||
//dsm($items);
|
||||
$index = 0;
|
||||
?>
|
||||
|
||||
<div class="calendar-calendar"><div class="week-view">
|
||||
<table class="full">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php if($by_hour_count > 0 || !empty($start_times)) :?>
|
||||
<th class="calendar-agenda-hour"><?php print t('Time')?></th>
|
||||
<?php endif;?>
|
||||
<?php foreach ($day_names as $cell): ?>
|
||||
<th class="<?php print $cell['class']; ?>">
|
||||
<?php print $cell['data']; ?>
|
||||
</th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php for ($i = 0; $i < $multiday_rows; $i++): ?>
|
||||
<?php
|
||||
$colpos = 0;
|
||||
$rowclass = "all-day";
|
||||
if( $i == 0) {
|
||||
$rowclass .= " first";
|
||||
}
|
||||
if( $i == $multiday_rows - 1) {
|
||||
$rowclass .= " last";
|
||||
}
|
||||
?>
|
||||
<tr class="<?php print $rowclass?>">
|
||||
<?php if($i == 0 && ($by_hour_count > 0 || !empty($start_times))) :?>
|
||||
<td class="<?php print $agenda_hour_class ?>" rowspan="<?php print $multiday_rows?>">
|
||||
<span class="calendar-hour"><?php print t('All day', array(), array('context' => 'datetime'))?></span>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<?php for($j = 0; $j < 6; $j++): ?>
|
||||
<?php $cell = (empty($all_day[$j][$i])) ? NULL : $all_day[$j][$i]; ?>
|
||||
<?php if($cell != NULL && $cell['filled'] && $cell['wday'] == $j): ?>
|
||||
<?php for($k = $colpos; $k < $cell['wday']; $k++) : ?>
|
||||
<td class="multi-day no-entry"><div class="inner"> </div></td>
|
||||
<?php endfor;?>
|
||||
<td colspan="<?php print $cell['colspan']?>" class="multi-day">
|
||||
<div class="inner">
|
||||
<?php print $cell['entry']?>
|
||||
</div>
|
||||
</td>
|
||||
<?php $colpos = $cell['wday'] + $cell['colspan']; ?>
|
||||
<?php endif; ?>
|
||||
<?php endfor; ?>
|
||||
<?php for($j = $colpos; $j < 7; $j++) : ?>
|
||||
<td class="multi-day no-entry"><div class="inner"> </div></td>
|
||||
<?php endfor;?>
|
||||
</tr>
|
||||
<?php endfor; ?>
|
||||
<?php foreach ($items as $time): ?>
|
||||
<tr class="not-all-day">
|
||||
<td class="calendar-agenda-hour">
|
||||
<span class="calendar-hour"><?php print $time['hour']; ?></span><span class="calendar-ampm"><?php print $time['ampm']; ?></span>
|
||||
</td>
|
||||
<?php $curpos = 0; ?>
|
||||
<?php foreach ($columns as $index => $column): ?>
|
||||
<?php $colpos = (isset($time['values'][$column][0])) ? $time['values'][$column][0]['wday'] : $index; ?>
|
||||
<?php for ($i = $curpos; $i < $colpos; $i++): ?>
|
||||
<td class="calendar-agenda-items single-day">
|
||||
<div class="calendar">
|
||||
<div class="inner"> </div>
|
||||
</div>
|
||||
</td>
|
||||
<?php endfor; ?>
|
||||
<?php $curpos = $colpos + 1;?>
|
||||
<td class="calendar-agenda-items single-day">
|
||||
<div class="calendar">
|
||||
<div class="inner">
|
||||
<?php if(!empty($time['values'][$column])) :?>
|
||||
<?php foreach($time['values'][$column] as $item) :?>
|
||||
<?php print $item['entry'] ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<?php endforeach; ?>
|
||||
<?php for ($i = $curpos; $i < 7; $i++): ?>
|
||||
<td class="calendar-agenda-items single-day">
|
||||
<div class="calendar">
|
||||
<div class="inner"> </div>
|
||||
</div>
|
||||
</td>
|
||||
<?php endfor; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div></div>
|
26
sites/all/modules/calendar/theme/calendar-year.tpl.php
Normal file
26
sites/all/modules/calendar/theme/calendar-year.tpl.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* @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.
|
||||
*
|
||||
*/
|
||||
//dsm('Display: '. $display_type .': '. $min_date_formatted .' to '. $max_date_formatted);
|
||||
?>
|
||||
|
||||
<div class="calendar-calendar"><div class="year-view">
|
||||
<table <?php if ($mini): ?> class="mini"<?php endif; ?>>
|
||||
<tbody>
|
||||
<tr><td><?php print $months[1] ?></td><td><?php print $months[2] ?></td><td><?php print $months[3] ?></td></tr>
|
||||
<tr><td><?php print $months[4] ?></td><td><?php print $months[5] ?></td><td><?php print $months[6] ?></td></tr>
|
||||
<tr><td><?php print $months[7] ?></td><td><?php print $months[8] ?></td><td><?php print $months[9] ?></td></tr>
|
||||
<tr><td><?php print $months[10] ?></td><td><?php print $months[11] ?></td><td><?php print $months[12] ?></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div></div>
|
796
sites/all/modules/calendar/theme/theme.inc
Normal file
796
sites/all/modules/calendar/theme/theme.inc
Normal file
@@ -0,0 +1,796 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Theme functions for the Calendar module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Preprocess an RSS feed
|
||||
*/
|
||||
function template_preprocess_calendar_style(&$vars) {
|
||||
global $base_url;
|
||||
global $language;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a month view.
|
||||
*/
|
||||
function template_preprocess_calendar_month(&$vars) {
|
||||
$view = $vars['view'];
|
||||
$rows = $vars['rows'];
|
||||
if (empty($rows)) {
|
||||
$rows = array();
|
||||
$day_names = array();
|
||||
}
|
||||
elseif (sizeof($rows) > 1) {
|
||||
$day_names = array_shift($rows);
|
||||
}
|
||||
else {
|
||||
$day_names = $rows;
|
||||
$rows = array();
|
||||
}
|
||||
|
||||
$month_rows = $rows;
|
||||
foreach ($rows as $weekno => $row) {
|
||||
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->date_info->mini) {
|
||||
$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->date_info->granularity;
|
||||
$vars['min_date_formatted'] = date_format($view->date_info->min_date, DATE_FORMAT_DATETIME);
|
||||
$vars['max_date_formatted'] = date_format($view->date_info->max_date, DATE_FORMAT_DATETIME);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 = date_format($view->date_info->min_date, 'Y');
|
||||
$view->date_info->style_with_weekno = FALSE;
|
||||
$rows = $vars['rows'];
|
||||
$months = array();
|
||||
foreach ($rows as $month => $month_rows) {
|
||||
$view->date_info->month = $month;
|
||||
$view->date_info->granularity = 'month';
|
||||
$view->date_info->mini = TRUE;
|
||||
$view->date_info->hide_nav = TRUE;
|
||||
$view->date_info->show_title = TRUE;
|
||||
$view->date_info->url = date_pager_url($view, NULL, date_pad($year, 4) . '-' . date_pad($month));
|
||||
$view->date_info->min_date = new DateObject($view->date_info->year . '-' . date_pad($month) . '-01 00:00:00', date_default_timezone());
|
||||
$view->date_info->max_date = clone($view->date_info->min_date);
|
||||
date_modify($view->date_info->max_date, '+1 month');
|
||||
date_modify($view->date_info->max_date, '-1 second');
|
||||
$variables = array(
|
||||
'view' => $view,
|
||||
'options' => $vars['options'],
|
||||
'rows' => $month_rows,
|
||||
);
|
||||
$months[$month] = theme('calendar_mini', $variables);
|
||||
}
|
||||
$view->date_info->mini = FALSE;
|
||||
|
||||
$vars['months'] = $months;
|
||||
$vars['view']->date_info->hide_nav = FALSE;
|
||||
$vars['view']->date_info->granularity = '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']->style_with_weekno = FALSE;
|
||||
$view = $vars['view'];
|
||||
$rows = $vars['rows'];
|
||||
|
||||
$item_count = 0;
|
||||
$by_hour_count = 0;
|
||||
$grouping_field = !empty($view->date_info->style_groupby_field) ? ($view->date_info->style_groupby_field - 1) : NULL;
|
||||
$display_overlap = !empty($view->date_info->style_theme_style) && !empty($view->date_info->style_groupby_times);
|
||||
$vars['scroll_content'] = !empty($view->date_info->style_theme_style) && $view->date_info->style_theme_style == 1;
|
||||
|
||||
// Add optional css
|
||||
if ($display_overlap) {
|
||||
$overlapped_items = array();
|
||||
drupal_add_css(drupal_get_path('module', 'calendar') . '/css/calendar-overlap.css');
|
||||
if (empty($view->live_preview) && !empty($vars['scroll_content'])) {
|
||||
drupal_add_js(drupal_get_path('module', 'calendar') . '/js/calendar_overlap.js');
|
||||
}
|
||||
if (empty($vars['scroll_content'])) {
|
||||
drupal_add_css(drupal_get_path('module', 'calendar') . '/css/calendar-overlap-no-scroll.css');
|
||||
}
|
||||
}
|
||||
|
||||
// If we're not grouping by time, move all items into the 'all day' array.
|
||||
if (empty($view->date_info->style_groupby_times)) {
|
||||
// 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'] = array();
|
||||
}
|
||||
|
||||
$columns = array();
|
||||
|
||||
// Move all_day items into the right columns and render them.
|
||||
$grouped_items = array();
|
||||
foreach ($rows['all_day'] as $item) {
|
||||
if (!empty($item->rendered_fields[$grouping_field])) {
|
||||
$column = $item->rendered_fields[$grouping_field];
|
||||
unset($item->rendered_fields[$grouping_field]); // Remove the grouping field from the results.
|
||||
if (!in_array($column, $columns)) {
|
||||
$columns[] = $column;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$column = t('Items');
|
||||
}
|
||||
$grouped_items[$column][] = theme('calendar_item', array('view' => $view, 'rendered_fields' => $item->rendered_fields, 'item' => $item));
|
||||
$item_count++;
|
||||
}
|
||||
$vars['rows']['all_day'] = $grouped_items;
|
||||
|
||||
// Moved timed items into the right columns and render them.
|
||||
$start_times = $view->date_info->style_groupby_times;
|
||||
$show_empty_times = $view->date_info->style_show_empty_times;
|
||||
$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 = array();
|
||||
foreach ($rows['items'] as &$items) {
|
||||
foreach ($items as &$item) {
|
||||
$time = date_format($item->calendar_start_date, 'H:i:s');
|
||||
if (!empty($item->rendered_fields[$grouping_field])) {
|
||||
$column = $item->rendered_fields[$grouping_field];
|
||||
unset($item->rendered_fields[$grouping_field]); // Remove the grouping field from the results.
|
||||
if (!in_array($column, $columns)) {
|
||||
$columns[] = $column;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$column = t('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'] = array();
|
||||
}
|
||||
$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->calendar_end_date, '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'] = array();
|
||||
}
|
||||
$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 = array(
|
||||
'start_time' => $start_time,
|
||||
'next_start_time' => $next_start_time,
|
||||
'curday_date' => $rows['date'],
|
||||
);
|
||||
$heading = theme('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) {
|
||||
if ($display_overlap) {
|
||||
if ($view->style_options['groupby_times'] == 'half'){
|
||||
$group_time = 30;
|
||||
$divisor = 7.5;
|
||||
}
|
||||
else if ($view->style_options['groupby_times'] == 'hour'){
|
||||
$group_time = 60;
|
||||
$divisor = 15;
|
||||
} else {
|
||||
$item->class = '';
|
||||
continue;
|
||||
}
|
||||
$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', array('view' => $view, 'rendered_fields' => $item->rendered_fields, 'item' => $item));
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
ksort($grouped_items);
|
||||
$vars['rows']['items'] = $grouped_items;
|
||||
|
||||
if (empty($columns)) {
|
||||
$columns = array(t('Items'));
|
||||
}
|
||||
$vars['columns'] = $columns;
|
||||
|
||||
$vars['agenda_hour_class'] = 'calendar-agenda-hour';
|
||||
$first_column_width = 10;
|
||||
|
||||
if (empty($view->date_info->style_groupby_times)) {
|
||||
$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->date_info->style_groupby_times;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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']->style_with_weekno = FALSE;
|
||||
|
||||
$view = $vars['view'];
|
||||
$rows = $vars['rows'];
|
||||
$item_count = 0;
|
||||
$by_hour_count = 0;
|
||||
$start_time = NULL;
|
||||
$columns = array();
|
||||
|
||||
if (sizeof($rows) > 1) {
|
||||
$day_names = array_shift($rows);
|
||||
}
|
||||
else {
|
||||
$day_names = $rows;
|
||||
$rows = array();
|
||||
}
|
||||
|
||||
// Moved timed items into the right columns and render them.
|
||||
$show_empty_times = $view->date_info->style_show_empty_times;
|
||||
$end_start_time = '23:59:59';
|
||||
|
||||
$grouped_items = array();
|
||||
|
||||
// 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->date_info->style_multiday_theme == '1' && !empty($view->date_info->style_theme_style));
|
||||
$vars['display_overlap'] = $display_overlap;
|
||||
$vars['scroll_content'] = !empty($view->date_info->style_theme_style) && $view->date_info->style_theme_style == 1;
|
||||
|
||||
// Add optional css
|
||||
if ($display_overlap) {
|
||||
drupal_add_css(drupal_get_path('module', 'calendar') . '/css/calendar-overlap.css');
|
||||
if (empty($view->live_preview) && !empty($vars['scroll_content'])) {
|
||||
drupal_add_js(drupal_get_path('module', 'calendar') . '/js/calendar_overlap.js');
|
||||
}
|
||||
if (empty($vars['scroll_content'])) {
|
||||
drupal_add_css(drupal_get_path('module', 'calendar') . '/css/calendar-overlap-no-scroll.css');
|
||||
}
|
||||
$overlapped_items = array( array(), array(), array(), array(), array(), array(), array());
|
||||
|
||||
// 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]);
|
||||
$time = date_format($time_slot[0]['item']->date_start, '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->date_info->style_groupby_times)) {
|
||||
$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->date_info->style_groupby_times;
|
||||
$start_time = array_shift($start_times);
|
||||
$next_start_time = count($start_times) ? array_shift($start_times) : $end_start_time;
|
||||
foreach ($row as &$item) {
|
||||
$time = date_format($item['item']->date_start, 'H:i:s');
|
||||
if ($item['item']->calendar_all_day) {
|
||||
$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] = array();
|
||||
}
|
||||
$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']->date_end, '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->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'][$wday] = array();
|
||||
}
|
||||
$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 = array(
|
||||
'start_time' => $start_time,
|
||||
'next_start_time' => $next_start_time,
|
||||
'curday_date' => (isset($row['data'])) ? $row['data']['date'] : NULL,
|
||||
);
|
||||
$heading = theme('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) {
|
||||
if ($view->style_options['groupby_times'] == 'half'){
|
||||
$group_time = 30;
|
||||
$divisor = 7.5;
|
||||
}
|
||||
else if ($view->style_options['groupby_times'] == 'hour'){
|
||||
$group_time = 60;
|
||||
$divisor = 15;
|
||||
} else {
|
||||
$item['class'] = '';
|
||||
continue;
|
||||
}
|
||||
$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'] = $view->date_info->style_groupby_times;
|
||||
$vars['first_time'] = !empty($first_time) ? $first_time : '';
|
||||
|
||||
$vars['agenda_hour_class'] = 'calendar-agenda-hour';
|
||||
$first_column_width = 10;
|
||||
|
||||
if (empty($view->date_info->style_groupby_times)) {
|
||||
$vars['agenda_hour_class'] .= ' calendar-agenda-no-hours';
|
||||
$first_column_width = 1;
|
||||
}
|
||||
$vars['item_count'] = $item_count;
|
||||
$vars['by_hour_count'] = $by_hour_count;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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->date_info->block) ? TRUE : FALSE;
|
||||
$month_path = calendar_granularity_path($view, 'month');
|
||||
$year_path = calendar_granularity_path($view, 'year');
|
||||
$day_path = calendar_granularity_path($view, 'day');
|
||||
$vars['url'] = str_replace(array($month_path, $year_path), $day_path, date_pager_url($view, NULL, $date, $force_view_url));
|
||||
$vars['link'] = !empty($day_path) ? l($vars['day'], $vars['url']) : $vars['day'];
|
||||
$vars['granularity'] = $view->date_info->granularity;
|
||||
$vars['mini'] = !empty($view->date_info->mini);
|
||||
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) {
|
||||
$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, date_pad($year, 4) . '-' . date_pad($month) . '-' . date_pad($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.
|
||||
*/
|
||||
function theme_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 = variable_get('date_format_short', 'm/d/Y - H:i');
|
||||
if (substr($start_time, -5) == '00:00' && substr($next_start_time, -5) == '00:00') {
|
||||
$limit = array('hour');
|
||||
}
|
||||
else {
|
||||
$limit = array('hour', 'minute');
|
||||
}
|
||||
$format_hour = str_replace(array('a', 'A'), '', date_limit_format($format, $limit));
|
||||
$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', array('@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 array('hour' => $hour, 'ampm' => $ampm);
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a node stripe legend
|
||||
*/
|
||||
function theme_calendar_stripe_legend() {
|
||||
if (empty($GLOBALS['calendar_stripes'])) {
|
||||
return '';
|
||||
}
|
||||
$header = array(
|
||||
array('class' => 'calendar-legend', 'data' => t('Item')),
|
||||
array('class' => 'calendar-legend', 'data' => t('Key'))
|
||||
);
|
||||
$rows = array();
|
||||
$output = '';
|
||||
foreach ((array) $GLOBALS['calendar_stripes'] as $label => $stripe) {
|
||||
if ($stripe) {
|
||||
$rows[] = array($label, '<div style="background-color:' . $stripe . ';color:' . $stripe . '" class="stripe" title="Key: ' . $label . '"> </div>');
|
||||
}
|
||||
}
|
||||
if (!empty($rows)) {
|
||||
$variables = array(
|
||||
'header' => $header,
|
||||
'rows' => $rows,
|
||||
'attributes' => array('class' => array('mini', 'calendar-legend')),
|
||||
);
|
||||
$output .= theme('table', $variables);
|
||||
$output = '<div class="calendar legend">' . $output . '</div>';
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format item stripes
|
||||
*/
|
||||
function theme_calendar_stripe_stripe($vars) {
|
||||
$item = $vars['item'];
|
||||
if (empty($item->stripe) || (!count($item->stripe))) {
|
||||
return;
|
||||
}
|
||||
$output = '';
|
||||
if (is_array($item->stripe_label)) {
|
||||
foreach ($item->stripe_label as $k => $stripe_label) {
|
||||
if (!empty($item->stripe[$k]) && !empty($stripe_label)) {
|
||||
$GLOBALS['calendar_stripes'][$stripe_label] = $item->stripe[$k];
|
||||
$output .= '<div style="background-color:' . $item->stripe[$k] . ';color:' . $item->stripe[$k] . '" class="stripe" title="Key: ' . $item->stripe_label[$k] . '"> </div>' . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format an empty day on a calendar
|
||||
*
|
||||
* @param day
|
||||
* The day to display.
|
||||
*/
|
||||
function theme_calendar_empty_day($vars) {
|
||||
$curday = $vars['curday'];
|
||||
$view = $vars['view'];
|
||||
|
||||
if ($view->date_info->calendar_type != 'day') {
|
||||
return '<div class="calendar-empty"> </div>' . "\n";
|
||||
}
|
||||
else {
|
||||
return '<div class="calendar-dayview-empty">' . t('Empty day') . '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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'][] = array('item' => &$item, 'depth' => $depth + 1, 'start' => $start, 'end' => $end, 'children' => array());
|
||||
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 array('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 array('overlap' => FALSE, 'max_depth' => 0);
|
||||
}
|
||||
}
|
||||
|
||||
// No overlap at any depth, reset the array of overlaps
|
||||
if ($depth == 0) {
|
||||
reset($overlapped_items);
|
||||
$overlapped_items[0] = array('item' => &$item, 'depth' => $depth, 'start' => $start, 'end' => $end, 'children' => array());
|
||||
}
|
||||
else {
|
||||
$overlapped_items[] = array('item' => &$item, 'depth' => $depth, 'start' => $start, 'end' => $end, 'children' => array());
|
||||
}
|
||||
|
||||
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 array('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 */
|
Reference in New Issue
Block a user