food-menu problem in drupal - drupal

I am trying to create a food menu for a boarding school. The idea is to let the students view what they have on menu for the whole day. That is, breakfast, lunch and dinner. This menu would be prepopulated weekly by a user.
My problem are as follows:
1) How do i use view module to just display items for one day?
2) Do i need like a date field, and calender module?

I would recommend using the Date module.
Add a date field to your 'boardingschoolmenu' content type.
Then in views you would add the fields you want visible (breakfast, lunch, dinner, etc)
Add a filter on content type 'boardingschoolmenu'
Add an argument for the date field. In the settings of the argument, under "Action to take if argument is not present", select: Provide default argument followed by: Current date (or can use php code if you want another date).

Related

Showing count of content based on the select list values Drupal 7

I have a requirement in which I need to show some content along with its count based on values in a select list. I wanted to display the allocated,released and resigned resources of a particular department in a selected date range. Using views, date range and department fields are created as exposed filters.
Created a content type for creating resources. The Resources content type is having action as a select list with values allocated,released,resigned. Department is another select list and date field is also added.
Please help me with an answer if views module is not enough. Provide some other solutions also. I'm using Drupal 7.
I figured out how to show node count in views. In my view I’ve some exposed filters and passed my select list cck field as contextual filter. If no result available I made the view to display summary as row count. In the template file, I’m planning to do some calculations for showing the resources count in and out of the project. Please correct me if there is anything wrong in this approach.

how to limit view to just show each type one time?

I have a content type what is news, the news has a field type that is List (text) to keep different types of news. for example I have Health, Sport, Economic and etc.
So now I am going to create a block and have each of these type in that as a hyperlink.
I can do it and I created a new view block but each news_type may showing more than one time according to published content.
How to set the view (for block) to just show news_types and show them just one time?
You can achieve this by following the steps given below:
Enable aggregation under Advanced Accordion of the view
Add Nid field & set aggregation type as Count Distinct
Exclude Nid field from display
Add news type field & set Aggregation type as Group results together, in Group Column select Value option from dropdown
Remove Publishing Date from sort criteria
Please check attached screenshot for reference
You can check this question for more information, and maybe help you.

Drupal 7 custom module/field for adding a task per hour

I am fairly new to Drupal and I am trying to create a simple content type where people can add their schedule for today.. for example from 2PM tot 4PM that person has to go to the gym.. So 2 dropdowns, 1 for every hour (2PM&4PM) and adding a textfield to that for "going to the gym" and the possibility to add more tasks.. (multiple values per day)
Any advice? Maybe a module or creating a custom field? Thx in advance.. :)
If you want to create a content type "daily schedule" and attach multiple events to it (like 14:00 Gym, 16:00 Beer with friends), I would propose Field collection. It would allow you to group time field (either simple numerical field or Time field with text field.
Hope that helped!
I will suggest you to go with contributed module intended to handle this kind of requirement. As per my understanding, you want to make functionlity for user to create their TODO list & there is a module which can do it easily for you - myTinyTodo.
Otherwise above answer is also good option to use field_collection.
I would suggest content type + date module + calendar module.
install & enable Date Module. You will be able to add a date field to content type
Add new content type "Task"
Add 2 date fields "start" (2PM) and "end" (4PM) to your content type.
Users will be able to add as many tasks as they want.
And finally, you can use Calendar module to preview task's list.

Submitting form custom module

I have a question regarding drupal 6 forms.
I have 4 tables:
location[locationid, name];
package[packageid, name],
person[personid, name, locationid, address, etc...]
pickup[pickupid, personid, packageid, locationid, _pickup_day_,...].
I've made forms and form_submit for the three tables: location, package, person (simple CRUD as usual).
Now, I want to make a form to submit data into the "pickup" table. The twist is, the only
data the user needs to input is the "pickup_day" field, which can be 1 or 0 (monday or tuesday).
So I imagine when I go to the pickups url, I'll see a list of output fields:
firstname | lastname | location | pickup day | package type
first1 last1 church1 select box (monday/tuesday) select box (type1/type2/type3)
first2 last2 church1 select box (monday/tuesday) select box (type1/type2/type3)
first3 last3 church1 select box (monday/tuesday) select box (type1/type2/type3)
[submit button]
When its submitted, the data goes into "pickup" table.
I'm trying to figure how to render the select boxes while outputting person's information.
(Just an aside, would it be possible to have a search before seeing the form...for example I search for
location to be church1, then I'll see all the users at that location in a form as above)
All help is very much appreciated...even pointing to a module that does something similar to this is fine...
I just need to get some hints on how people have approached this. Much thanks!
End goal:
So, basically, I have a number of people in my database. Each person is assigned a location where they can go and pickup food. I want to record each pickup for each week for each person. So I have a pickups table to do that. So I'm trying to make a single form (pickups), where I can go to and update who picked up what...on what day (Monday or Tuesday). But so in this form, I need to show all the people registered for a particular location. So lets say a person is registered for a church called Church 1...I want to search for the Church 1 location, then all the people who are registered for that location comes up row by row. Then I can select which day each person picked up food and what type of food they picked up...and click submit. Then I'll run a query against my database to add this information.
The big deal I guess is that instead of making a form for each person (for each row), I just make one form and when the form is submitted everyone will be added to the "pickup" table with the appropriate day and item they picked up.
I would suggest you look at the form API's built-in AHAH support. You can find more information here: http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html/6#ahah. Assuming I understand your question correctly, this is a fairly typical ajax/ahah form situation; an element in your form triggers the creation of new form elements.
For example, you can create a select box of locations. Once a location is selected (#ahah['event'] => 'change'), you can make a callback to a menu location (#ahah['path'] => path/to/callback) which can generate the new form elements to add, in this case select boxes for the persons and/or packages associated with that location.
You could also do something similar using search instead of a select element.

Month navigation sidebar in blog section?

I have a blog section in a drupal website, built with Views. I want to add a sidebar with month navigation (as in each mont is listed with the number of posts, etc). How can I do this, preferably with Views?
Drupal views can create views which allow you to select and list or summarise lists of nodes by various fields including the date related fields. You can do this by adding an argument, and then setting how the view behaves when no argument is supplied.
Are you looking for something along the following lines?
March 2010 (3)
February 2010 (12)
January 2010 (7)
... etc.
Create a view called Monthly Summary, and add an "argument" 'Node: Created year + month'.
Then use the options on the argument to select the 'action to take if argument is not present'. Select 'Summary, sorted descending' to create list with most recent month at top.
Watch out for sorting issues - this choice of how you sort the monthly summary in the argument settings will override the usual views sort order. This caught me out for a while.
Have you tried the Date/Calendar modules? Some more details about the Calendar module (from its project page):
This module will display any Views date field in calendar formats, including CCK date fields, node created or updated dates, etc. Switch between year, month, and day views. Back and next navigation is provided for all views. Lots of the Calendar functionality comes from the Date module, so any time you update the Calendar module you should be sure you also update to the latest version of the Date module at the same time.
See also Date iCal, a project that contains code and features needed to either import or export dates using iCal feeds. The functionality that used to be in the Calendar iCal module has been moved into that module.

Resources