Creating view with node reference - drupal

I am using drupal 6. please give me idea about how should i create view with below requirements,
There will be list of awards (gold , silver etc)
There will be list of companies who won one of the above award (comp1->gold, comp2->gold, comp3->silver etc)
I need to display list of awards first and when user clicks on any award he will be redirected to page having list of companies who won that award.
I created two content types for Awards and Companies and award_id is used as node reference in Company content type. Please guide further.I am using drupal 6. Thanks.

Fist task (just a simple list of awards is easy - just create a view that displays nodes in "awards" type, order as you want, limit as you want...
Get also node id filed, if it's not available at start, since you gonna need it.
For the second task - create a new view, that will list companies and under arguments add that award id. Then, you should pass award id to page as extra parameter:
/awords/3
Where 3 is award id.
Sorry, Drupal 6 is pretty old and I didn't use it lately, but that's the basic idea.

Related

calling of one taxonomy from another taxonomy, so both of them have used in the same content type

Can we call one taxonomy term from another as a parent and child relation for example I need to click on product category and that show me product series page and when I click on product each series that will lead me to actual product detail means node, so I have two taxonomies category and series I am about to click on category to carry me to series page and then to click on series page to carry me to product detail page on the concern series”
no codebase problem
i am expecting that these two taxonomies may be used as i have mentioned in the question summary but, i can't do it so i hope some help in resolving this issue
Let's look at this answer, I hope it will help you.
Taxonomy terms from the same vocabulary filtered and referenced on multiple content types
To do this you’ll need to have the Entity Reference module installed. So get that out of the way quickly with drush dl entity reference -y and drush en entityreference -y if you haven't already.
First up, we need the taxonomy set up.
Let's demonstrate with the help of an image.
You’ll notice that these terms could be more or less grouped into two categories: Transport and Sleeping. One term (couchette) kinda fits both criteria and is there to exemplify the reason for not using 2 different vocabularies to handle the issue. Now we need to technically make the distinction between these terms as well and since they are entities, we can use a field for that.
So we can now go ahead and add a new field to this vocabulary of the type List (text) with whatever widget you’d like (and let’s call the field Type). You should make the allowed number of values unlimited and put the following in the allowed values list:
Edit each term and select the appropriate type. As expected, for the term couchette, you should select both options.
Now that we have our taxonomy squared away, it’s time to create a View that will handle the filtering of these terms. Because if we now add the Tags taxonomy term reference field to our content types in the normal fashion (as it is already present in the Article content type) we’ll be able to select all the terms in the vocabulary for all the content types. And that's not what we want now.
So create a drupal 7/8 View that shows taxonomy terms of the Tags vocabulary - let’s call it Tags Filter. Add 2 displays of the type Entity Reference and a filter of the field we added to our terms earlier. So for instance the first display can show the terms which have Sleeping selected and the other one can show terms which have Transport. Save the View and you can close it.
Now finally we can edit our content types and add to each a new field of the type Entity Reference with a select list widget. For the target type select Taxonomy term and under Entity Selection choose the following: for Mode, go with Views: filter by entity reference view and then select the View in question - one of the two displays which we created earlier. In the picture below, I named one of the displays

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 add additional field to drupal organic group 'User and Group' relation?

Im using Drupal Organic group module and I want to create a group and need to assign users (filter by perticular role) to that group. I have done that part easily but the problem is that, I need to add aditional note on per each group user relation.
Lets say there is a group called "School Prefects" and need to add users to that group whos role is student. In here I need to put a small description for each relation.
Please help me to figure this out.
Thanks in advance.
I will probably deal with the same problem soon.
I think a possible workaround is to use the relation module and
the rules module. You could set up a rule to create a relation
each time a user is assigned to a group, or something like that.
Relations made by the relation module are fieldable. But it would be
maybe better to add a field to the og user-group relation directly.
Update: now that I tackled the issue, I have a different solution. We don't need to add new relations, the og_membership shipped standard with og is all that we need. This is how I did it.
I created a new membership type from admin/config/group/group-membership. It's a fildable entity so I added the required fields: in your case it will be "description".
Then I changed the used membership type per user, I did it in admin/config/people/accounts/fields/og_user_node (I needed to change the field "group membership" in user account).
So, now when you (or a group administrator) go to "manage group page" (clicking the group tab in group node), where you can add new people or manage members, either way you can edit your custom field "description" on each membership users-group.
Besides, you can clone the "og members" view adding the field "description", so in people panel in the group homepage we see name + description.
I my use-case I had to see (per group member): name, role, start date, end date. E.g. John Doe, president, from 1997 to 2003.

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.

Drupal 6: creating location list manually or dynamically via cms

I'm starting my first Drupal project, pretty excited :) I have a question;
the project is a hotel directory site. at sidebar I have locations list (London, Manchester, Liverpool, etc..) and filter the hotels related on location click.
So, how should I create these cities? Should I put them manually and give links manually depending on location id? or is there any better way to create this location list and linking filtering dynamically (via cms, or custom module, etc...)
Appreciate advices!!!!
This would be a good example of when to use the core (part of the base Drupal software) Taxonomy module. With Taxonomy you can set up one or more lists of terms that describe some or all of your nodes. For example, you can have a list of locations, a list of amenities (pool, sauna, golf course, etc.), and a list of price ranges (low, medium, high).
For each hotel you can select a location from the locations list, one or more amenities, and a price range. Then you can select all of the hotels that match one of the lists, using a neat feature of Taxonomy where it will return a list of those nodes.
The lists of terms are called "Vocabularies", and you'll want to create a vocabulary for each list. Go to Administer -> Taxonomy -> Add Vocabulary. Give it a name, like "Location" a description if you'd like, and choose the content types that it should be allowed to be associated with. (In your case, the hotels should probably be a custom content type that is different from the Page and Story types, but for trying this out, just pick Page for now.) There are several checkboxes at the bottom to decide on: Don't check Tags or Multiple Select, as these allow free tagging by users (images users making up city names) and also allow a node to have multiple locations. Do check the Required checkbox, as each hotel should have one.
Click Save and then click Add Terms on the vocabulary list page, and add a few locations. Then create a few hotel nodes (Pages for now) and you'll see that there is a new section in the Create Content page that is a dropdown selector that contains the locations. Choose one for each hotel, and add a few hotels in the locations that you just created.
To select the hotels for a given location, you will need to know the path associated with each term. Go back to the Taxonomy admin page and choose List Terms for the Location vocabulary. On the Terms in Location page you can get the list of hotels for a location by clicking on a location's name. The resulting page's path (e.g. example.com/taxonomy/term/2) would be what you'd use in your menu for that location. Each location will have its own term number that would be at the end of the path.
This is the simplest way to use the Taxonomy module, but it works really well with other modules like Views. Using Views you can control the format of the list of hotels for each location.
For more information, see the Taxonomy documentation and especially this sub-page called About Taxonomy.

Resources