Needs work
Project:
Community Media TV Schedules
Version:
7.x-2.1-alpha1
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
2 Jun 2014 at 15:02 UTC
Updated:
26 Sep 2014 at 20:38 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
bagelche commentedThis would be very helpful as our channels are also listed out of numerical order.
Comment #2
avguy commentedI tried everything I could think of to sort the channels in the table header and I'm not having any luck. Has there been any more progress on adding a feature to allow that sort?
Comment #3
kreynen commentedI don't think it's possible to order the grouping field in a calendar view like this. Instead, the columns need to be reordered in http://cgit.drupalcode.org/cm_tv_schedules/tree/templates/calendar-day.t...
Right at the beginning to the template, after the end of the comments...
You can add...
The rest of the template can be left the same. That function parses the term id out of the link, but I'm not really sure why the terms are linked in the first place. Even on http://retn.org/schedules/day, the channel links go to pages like http://retn.org/channel/retn-16-south that only displays the taxonomy term's title. Because taxonomies are fieldable, these pages group be used to display a description of the channel and the linked term might make sense... but I think the link should be removed completely.
If the link is removed, the term object would need to be loaded using taxonomy_get_term_by_name isn't of parsing the link for the tid. For that, you'd add this after the comments and before the HTML div class="calendar-calendar starts...
I'm sure there is some combination of this that would work regardless of whether the field_airing_channel is linked or not. I didn't submit this as a patch because the code that's needed depends on the field_airing_channel settings. Including the linked or unlinked version would return errors for the other configuration option. Because this can be implemented at the theme level, it also easy to modify without hacking the module's template file. If you copy the calendar-day.tpl.php file into the template directory of your own theme, you can add this code to the template there. That way when the cm_tv_schedules module is updated, it doesn't overwrite your changes.
Hope this helps.
Comment #4
avguy commentedI applied the first code snippet in Comment 3 to the calendar template where directed. I got this:
Notice: Undefined offset: 1 in include() (line 37 of /srv/bindings/cc60c9bd2f374ed4bb1cdca128c516af/code/sites/all/modules/cm_tv_schedules/templates/calendar-day.tpl.php).
Notice: Trying to get property of non-object in include() (line 40 of /srv/bindings/cc60c9bd2f374ed4bb1cdca128c516af/code/sites/all/modules/cm_tv_schedules/templates/calendar-day.tpl.php).
Comment #5
avguy commented@kreynen's solution in 3 worked when I added the second snippet and set the view to format the Channel as just plain text.
Comment #6
avguy commentedHere's a patch updating the views formatter and adding the second code snippet from 3.
Comment #7
bagelche commented@kreynen implemented snippet #2 for us and now the channels are in the correct order on http://amherstmedia.org/schedules.
Comment #8
emilyf commentedMost of this snippet works and the second approach is ideal - removing the channel links makes sense. However, this snippet has an issue in that if more than 1 term in the channel taxonomy have not been manually ordered, it will only output one column with the default weight of 0. So let's say you had 5 channels, and you had dragged 3 around on the administration area to order them how you want, but the other two you left alone. Or, more likely, if you have 2 channels that you order manually, then later you add two more channels and they show up correctly on the channel taxonomy administration page so you don't reorder them, they retain the weight of 0. With this snippet, it will only output one of the 2 with the weight of 0.
This could lead to some end user confusion and banging of heads against the wall when people aren't seeing all their channels. I'm sure there is a pretty simple way to rewrite this snippet to account for multiple zero weights, but I won't have time to test that out tonight and this is overdue for a release. If anyone wants to take a stab at that, please feel free and upon more complete testing will roll it into next release.