Hello

This is an interesting module, I've been testing it out for the past 2 days and I have a feature request to make:

It would be awesome if you could join your calendar's dates to a date contextual filter, so that depending on the date input in the url (example: my/section/2011-11-29) you would have the current label displayed.

Lets say I have 4 different calendars, and I would want to create a view to display the current state of each of them on a given day, wouldn't that be awesome to be able to do it through an url contextual filter?

-- Notice --

I think that the method to implement such a feature would be by emulating a date field representing every day of the year with their given state

Comments

Marc-Antoine’s picture

Assigned: Unassigned » Marc-Antoine
StatusFileSize
new4.29 KB

Alright, I've been working on the subject and managed to complete the first part of the feature I want.

In the current patch you'll find:

A new field 'state' usable within views, currently only showing a calendar's state for the current day.

A new custom view handler (which is used by the new field), this is where more dev will be needed.

Next I'll work on a way to display the states for a whole week and then perhaps I'll try to consider the date argument given by the url.

If you have any question/suggestion/comment/insult, you are of course invited to participate!

(this is my first custom view handler, if someone finds a better way to do things, I would be delighted)

Marc-Antoine’s picture

StatusFileSize
new4.5 KB

Added my argument to make sure my field is independent.

I'm still thinking about that week render, ill probably aim for a date+calendar approach.

fietserwin’s picture

I will look into your issue as well, but don't expect a reaction soon.

Marc-Antoine’s picture

don't worry, I'm still in the process of upgrading my feature;

Depending on how it turns out, it may as well be an external module, you'll probably judge it best.

Marc-Antoine’s picture

StatusFileSize
new55.93 KB
new832.94 KB
new188.05 KB
new160.45 KB
new74.2 KB
new10.09 KB

So after quite a bit of work, here it is: Calendar support!

= Main feature =

2 new custom field (present within Views' interface):

dates - This custom field main purpose is to duplicate your view's results for as many times as you have dates entries. This is really useful when used with our new state custom field.

state - This custom field displays the state of the day it is associated with (must be used with the above field if you want actual results).

= Use case =

Now that we can divide our results amongst every possible day of our calendar, other modules can take part of the display process, such as Calendar;
e.g. I have 5 country houses to rent I want to show in a calendar at once, I can create a view of my content type, I can style my results to be displayed as I wish, I can add an exposed filter to let my visitors select the number of possible guests and what not!

= Modules used =

To reproduce this use case, you should use:

Calendar 7.x-3.x-dev (patched)
Date 7.x-2.x-dev (patched)
Views 7.x-3.1+55-dev
Availability Calendar 7.x-3.x-dev (patched)

= Patches to use =

Since the Date and Calendar modules aren't 'yet' made to support custom fields, I had to make the patches to enable this (it could take some time for the devs to react to them though, so a little help to bring these posts to their attention would be appreciated).

Date's patch
http://drupal.org/node/1485794#comment-5761206

Calendar's patch
http://drupal.org/node/1485956

= Notes =

For a tutorial on how to make this work, look a the attached screenshots, it will hopefully help you! I also recommend looking at the Calendar's module page: http://drupal.org/project/calendar

* important *
I made sure that this patch wouldn't screw anything up with this module's current functionalities, but some changes would be great to make the most out of this feature:

Save everyday's state - Since I can only retrieve existing dates, every 'default' dates aren't detected by this feature, so it would be awesome to rewrite the save function a bit to enable every state to be saved (even the default ones!)

Marc-Antoine’s picture

StatusFileSize
new171.5 KB

I had both my screens on the 4th screenshot, my bad, here's a clean version:

fietserwin’s picture

Status: Active » Needs review

I'm going to review it, but please be patient. The first impression looks interesting though.

KLicheR’s picture

Version: 7.x-3.1 » 7.x-3.x-dev
StatusFileSize
new10.19 KB

I've updated the patch for the latest dev version (7.x-3.2+21-dev).

Marc-Antoine’s picture

StatusFileSize
new10.19 KB

Made a little improvement (used the t() function on the states so that the output is now translated)

Tony Sharpe’s picture

Is this feature now available as standard in availability calendar 7.x-4.x?

fietserwin’s picture

Version: 7.x-3.x-dev » 7.x-4.x-dev

No, not yet, and I am afraid it won't make it into the 7.x-4.0 release. It might make it into 7.x-4.1 though.

marcus178’s picture

Just trying to getting this working but not having much luck

I have applied the patches to Date and Calendar, but wasn't sure what to do about views as there have been several releases since the dev version you mentioned using.

Also I don't want to go back to an older version of availablity_calenders so had to manually patch it as the patch didn't work on the latest version.

I'm not getting any errors but the status field isn't available in views. Any suggestions?

fietserwin’s picture

Status: Needs review » Needs work

I will look into this, but will first solve your other issue (bug 1899608) and add some paid for features. But please give it another try yourself, especially when you can code. If possible, try to solve it without being dependent on patches from other modules.

Marc-Antoine’s picture

I don,t know if those patches are still required or if Date and Calendar had some changes since I wrote those patches.

Here's an example of this concept in the website it was made for though : http://espacepourlavie.ca/horaire
(pretty proud of this one :D)

Unfortunately I don't have time to rewrite / update those patches, I do hope some ppl will get this to work though!

fietserwin’s picture

Might the problem be solved by making the calendar an entity on its own? This would increase discoverability and handling by other modules like date and calendar. The field part will then change into a kind of a reference field.

Not sure though if and what other problems this will give when thinking of things like access, editing within the entity edit form of the referring entity, will it gets its own page, etc.?

Marc-Antoine’s picture

yeah I thought about that in the early stages of my patches, but it would require quite alot of cooperation from this module's author, as it's going to change alot of intern logic / code.

Still think it's the proper way to do it though.

fietserwin’s picture

Well, now that I have a clearer picture of what this is all about and that we seem to have a possible way of solving it without being dependent of other modules, we can focus on solving it the entity way. You will have my cooperation but unfortunately I do not have much time to spent on it. So it might take a while, unless someone is willing to sponsor it (in part).

marcus178’s picture

Entities definitely seems the way forward.

In regards to the patch, I have found that it's because it's an entity that has the availability calendar not a node, and in views you don't get the content option when selecting custom entity fields.

In fact when using a custom entity I only get the option the select the availability calendar, all the other options such as created and updated are not available. Not really sure if it's a problem with this modules or my custom entities, but I've looked and other modules that provide custom entities and the content option isn't available on them either.

fietserwin’s picture

Version: 7.x-4.x-dev » 7.x-5.x-dev
Status: Needs work » Needs review

@Marc-Antoine, @marcus178: May I ask you to test and review the new 7.x-5.x-dev release? It should contain enough entity and views support to be able to do what you wanted to do. Look at the git commits to see a diff with the current stable version. That should make it easier to see what has been added, moved or changed.

Please post all your remarks, suggestions, improvements, patches in this issue.

This new, still experimental, branch is a start of entity integration. It actually only describes the availability_calendar_calendar table to entity, it describes the availability_calendar field to entity, and it describes the other tables (availability_calendar_availability and availability_calendar_state) to Views, including any relationships between these. This should allow you to create Views that can retrieve any piece of information you want, as well as filter and sort on any property you want.

There are no data model changes, so your data should be save and you should be able to downgrade. But still I would advice you to test on a separate install. Please also read the README.txt and, even more important, CHANGELOG.txt that come with this install before starting your testing.

Thanks in advance

PS: can you let me know if you are able to do any testing (in the near future), so I am not waiting in vain.

marcus178’s picture

Ok thank you, when I get a moment I will have a look at this.

  • fietserwin committed df9e2ba on 7.x-5.x
    [#1355834]: Using a contextual filter to get the state of the current...
fietserwin’s picture

Issue summary: View changes
Status: Needs review » Fixed

Assuming it works ...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.