You are here

README.txt in Office Hours 7

Same filename and directory in other branches
  1. 8 README.txt
Office Hours creates a Field, that you can add to any entity (like a location,
a restaurant or a user) to represent "office hours" or "opening hours".

== UPGRADE WARNING ==
You MUST run update.php, when you upgrade from version 1.1 (or lower)
to a -dev version or version 1.2 (when available).

== GENERAL FEATURES ==
The Drupal 7 version now provides the following features: 
- Feeds module support to import data. (See below for details.)

The widget provides:
- default weekly office hours (multi-value, per field instance).
- using 1, 2 or even more 'time blocks' per day (thanks to jonhattan).
- 'allowed hours' restrictions;
- input validation;
- use of either a 24 or 12 hour clock;

The formatter provides o.a.:
- a 'Current status' indicator ('open now'/'closed now');
- options to show all/none/open/current days;
- options to group days (E.g., "Mon-Fri 12:00-22:00");
- customizable element separators to display the 'office hours' any way you want. (See below for details.)

You can configure the formatter as follows:
- Add the field to an entity/node;
- Select the 'Office hours' formatter;
- Set the formatter details at /admin/structure/types/manage/NODE_TYPE/display/VIEW_MODE;
or
- Add the field to a view;
- Select the 'Office hours' formatter;
- Check the formatter settings of the field;

== FORMATTING THE HOURS ==
Using the customizable separators in the formatter settings, you can format the hours any way you want. 
- The formatter is default set up to show a nice table.
- To export the data to a Google Places bulk upload file, you can create a view,
  and set the formatter to generate the following data (for a shop that opens from Monday to Friday): 
    2:10:00:18:00,3:10:00:18:00,4:10:00:18:00,5:10:00:18:00,6:10:00:18:00,7:12:00:20:00

== USING VIEWS - FIELDS ==
Add the Field to any Views display, as you are used to do.
- To show only 1 day per row in a Views display: 
  - add the field to your View,
  - open the MULTIPLE FIELD SETTINGS section,
  - UNcheck the option 'Display all values in the same row',
  - make also sure you display 'all' values. (only valid if you have upgraded from 1.1 version.)

== USING VIEWS - FILTER CRITERIA ==
Only default (out-of-the-box) Views functionality is provided.
- To show only the entities that have a office hours: 
  - add the filter criterion "Content: Office hours (field_office_hours:day)" to your View,
  - set the filter option 'Operator' to 'is not empty',
- To show only the entities that have office hours for e.g., Friday: 
  - add the filter criterion "Content: Office hours (field_office_hours:day)" to your View,
  - set the filter option 'Operator' to 'is equal to',
  - set the filter option 'Value' to '5', or leave 'Value' empty and set 'Expose operator' to YES.
- To show only the entities that are open NOW: 
  This is not possible, yet. 

== USING VIEWS - SORT CRITERIA ==
Only default (out-of-the-box) Views functionality is provided.
- To sort the times per day, add the 'day' sort criterion. 

== USING VIEWS - CREATE A BLOCK PER NODE/ENTITY ==
Suppose you want to show the Office hours on a node page, but NOT on the page itself, 
but rather in a separate block, follow these instructions:
(If you use non-Node Content types/Entities, you'll need to adapt some settings.)
1. First, create a new View for 'Content', and add a Block display;
 - Under FORMAT, set to an Unformatted list of Fields;
 - Under FIELDS, add the office_hours field and other fields you like;
 - Under FILTER CRITERIA, add the relevant Content type(s);
 - Under PAGER, show all items;
 - Now open the ADVANCED section;
 - Under CONTEXTUAL FILTERS, add 'Content: Nid';
 -- Set 'Provide default value' to 'Content ID from URL';
 -- Set 'Specify validation criteria' to the same Content type(s) as under FILTERS;
 -- Set 'Filter value format' according to your wishes;
 -- Set 'Action to take if filter value does not validate' to 'Hide View';
 - Tweak the other settings as you like.

2. Now, configure your new Block under /admin/structure/block/manage/ : 
 - Set the Block title, and the Region settings;
 - Under PAGES, set 'Show block on specific pages' to 'Only the listed pages' and 'node/*';
   You might want to add more pages, if you use other non-node entity types.
 - Tweak the other settings as you like.
 You'll need to tune the block for the following cases: 
 - A user accesses the node page, but 'Access denied';
 - A node is unpublised;

Now, test your node page. You'll see the Office hours in the page AND in the block. That's once too many.

3. So, modify the 'View mode' of your Content type under /admin/structure/types/manage/<MY_CONTENT_TYPE>/display
 - Select MANAGE DISPLAY;
 - Select the View mode. (Perhaps you need to create an extra view mode for other purposes.)
 - Select the Office_hours, and set the Format to 'Hidden';
 - Save the data, end enjoy the result!


== IMPORTING WITH FEEDS MODULE ==
To import data with the Feeds module, the following columns can be used:
- day;
- hours/morehours from;
- hours/morehours to;
- hours/morehours from-to.

The day should be stated in full English name, or a day number where sunday = 0, monday=1, etc.
The hours can be formatted as hh:mm or hh.mm

I suppose Feeds Tamper can help to format the times and/or day to the proper format.

Here's an example file:
nid;weekday;Hours_1;Hours_2
2345;monday;11:00 - 18:01;
2345;tuesday;10:00 - 12:00;13:15-17.45
2383;monday;11:00 - 18:01;
2383;tuesday;10:00 - 12:00;13:15-17.45

File

README.txt
View source
  1. Office Hours creates a Field, that you can add to any entity (like a location,
  2. a restaurant or a user) to represent "office hours" or "opening hours".
  3. == UPGRADE WARNING ==
  4. You MUST run update.php, when you upgrade from version 1.1 (or lower)
  5. to a -dev version or version 1.2 (when available).
  6. == GENERAL FEATURES ==
  7. The Drupal 7 version now provides the following features:
  8. - Feeds module support to import data. (See below for details.)
  9. The widget provides:
  10. - default weekly office hours (multi-value, per field instance).
  11. - using 1, 2 or even more 'time blocks' per day (thanks to jonhattan).
  12. - 'allowed hours' restrictions;
  13. - input validation;
  14. - use of either a 24 or 12 hour clock;
  15. The formatter provides o.a.:
  16. - a 'Current status' indicator ('open now'/'closed now');
  17. - options to show all/none/open/current days;
  18. - options to group days (E.g., "Mon-Fri 12:00-22:00");
  19. - customizable element separators to display the 'office hours' any way you want. (See below for details.)
  20. You can configure the formatter as follows:
  21. - Add the field to an entity/node;
  22. - Select the 'Office hours' formatter;
  23. - Set the formatter details at /admin/structure/types/manage/NODE_TYPE/display/VIEW_MODE;
  24. or
  25. - Add the field to a view;
  26. - Select the 'Office hours' formatter;
  27. - Check the formatter settings of the field;
  28. == FORMATTING THE HOURS ==
  29. Using the customizable separators in the formatter settings, you can format the hours any way you want.
  30. - The formatter is default set up to show a nice table.
  31. - To export the data to a Google Places bulk upload file, you can create a view,
  32. and set the formatter to generate the following data (for a shop that opens from Monday to Friday):
  33. 2:10:00:18:00,3:10:00:18:00,4:10:00:18:00,5:10:00:18:00,6:10:00:18:00,7:12:00:20:00
  34. == USING VIEWS - FIELDS ==
  35. Add the Field to any Views display, as you are used to do.
  36. - To show only 1 day per row in a Views display:
  37. - add the field to your View,
  38. - open the MULTIPLE FIELD SETTINGS section,
  39. - UNcheck the option 'Display all values in the same row',
  40. - make also sure you display 'all' values. (only valid if you have upgraded from 1.1 version.)
  41. == USING VIEWS - FILTER CRITERIA ==
  42. Only default (out-of-the-box) Views functionality is provided.
  43. - To show only the entities that have a office hours:
  44. - add the filter criterion "Content: Office hours (field_office_hours:day)" to your View,
  45. - set the filter option 'Operator' to 'is not empty',
  46. - To show only the entities that have office hours for e.g., Friday:
  47. - add the filter criterion "Content: Office hours (field_office_hours:day)" to your View,
  48. - set the filter option 'Operator' to 'is equal to',
  49. - set the filter option 'Value' to '5', or leave 'Value' empty and set 'Expose operator' to YES.
  50. - To show only the entities that are open NOW:
  51. This is not possible, yet.
  52. == USING VIEWS - SORT CRITERIA ==
  53. Only default (out-of-the-box) Views functionality is provided.
  54. - To sort the times per day, add the 'day' sort criterion.
  55. == USING VIEWS - CREATE A BLOCK PER NODE/ENTITY ==
  56. Suppose you want to show the Office hours on a node page, but NOT on the page itself,
  57. but rather in a separate block, follow these instructions:
  58. (If you use non-Node Content types/Entities, you'll need to adapt some settings.)
  59. 1. First, create a new View for 'Content', and add a Block display;
  60. - Under FORMAT, set to an Unformatted list of Fields;
  61. - Under FIELDS, add the office_hours field and other fields you like;
  62. - Under FILTER CRITERIA, add the relevant Content type(s);
  63. - Under PAGER, show all items;
  64. - Now open the ADVANCED section;
  65. - Under CONTEXTUAL FILTERS, add 'Content: Nid';
  66. -- Set 'Provide default value' to 'Content ID from URL';
  67. -- Set 'Specify validation criteria' to the same Content type(s) as under FILTERS;
  68. -- Set 'Filter value format' according to your wishes;
  69. -- Set 'Action to take if filter value does not validate' to 'Hide View';
  70. - Tweak the other settings as you like.
  71. 2. Now, configure your new Block under /admin/structure/block/manage/ :
  72. - Set the Block title, and the Region settings;
  73. - Under PAGES, set 'Show block on specific pages' to 'Only the listed pages' and 'node/*';
  74. You might want to add more pages, if you use other non-node entity types.
  75. - Tweak the other settings as you like.
  76. You'll need to tune the block for the following cases:
  77. - A user accesses the node page, but 'Access denied';
  78. - A node is unpublised;
  79. Now, test your node page. You'll see the Office hours in the page AND in the block. That's once too many.
  80. 3. So, modify the 'View mode' of your Content type under /admin/structure/types/manage//display
  81. - Select MANAGE DISPLAY;
  82. - Select the View mode. (Perhaps you need to create an extra view mode for other purposes.)
  83. - Select the Office_hours, and set the Format to 'Hidden';
  84. - Save the data, end enjoy the result!
  85. == IMPORTING WITH FEEDS MODULE ==
  86. To import data with the Feeds module, the following columns can be used:
  87. - day;
  88. - hours/morehours from;
  89. - hours/morehours to;
  90. - hours/morehours from-to.
  91. The day should be stated in full English name, or a day number where sunday = 0, monday=1, etc.
  92. The hours can be formatted as hh:mm or hh.mm
  93. I suppose Feeds Tamper can help to format the times and/or day to the proper format.
  94. Here's an example file:
  95. nid;weekday;Hours_1;Hours_2
  96. 2345;monday;11:00 - 18:01;
  97. 2345;tuesday;10:00 - 12:00;13:15-17.45
  98. 2383;monday;11:00 - 18:01;
  99. 2383;tuesday;10:00 - 12:00;13:15-17.45