One field for each one category - SOLVED -

More
12 years 9 months ago #16997 by ggppdk
I think,
you can achieve what you want by using FlexiAccess User Groups, and customizing your templates to display different output depending on the FlexiAccess User Group.

I see from another post of yours that you have FlexiAccess?

I am not sure yet how.

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
12 years 9 months ago #17001 by aloisio
Yes, I use flexiaccess.
You believe that the article submission form that you have seen can be operated using flexiaccess groups.
Is that what you're telling me?
Can you give me some more suggestions.
I can see no relationship between having user groups and the relationship between categories and fields "select" for example.

Please Log in or Create an account to join the conversation.

More
12 years 9 months ago #17002 by ggppdk
I meant to use FlexiAccess Groups for controlling the output. That is what you said you want, people to see different things depending on what they are.

First create the groups in FlexiAccess with appropriate name and assign users to the groups.

Be careful with the FlexiAccess Group names to be lower case, we will use them below

I have not tested this code but it should work.
Put this in your template file e.g.
mytemplate/category_items.php
used by the category view to display the table of items.
Code:
// 1. Get the Flexi Groups of the user $db =& JFactory::getDBO(); $user =& JFactory::getUser(); $user_grpIDs = explode(',', trim($user->gmid)); if ($user_grpIDs[0]=='') $user_grpIDs = array(); // 2. Get the Flexi Groups IDs when given their name $grpnamearr = array('teacherss','students','parents'); $grpnamelist = "'" . implode("','", $grpnamearr) . "'"; $query = "SELECT name,id FROM #__flexiaccess_groups WHERE name IN (".$grpnamelist.")"; $db->setQuery($query); $arr = $db->loadResultArray(); foreach ($arr as $grpinfo) { $grpIDbyname[$grpinfo['name']] = $grpinfo['id']; } // 3. Find out what group (or groups) the user belongs to foreach ($grpnamearr as $grpname) { $grpID = $grpIDbyname[ $grpinfo[$grpname] ]; $isA[$grpname] = in_array( $grpID, $user_grpIDs); }
Then replace the lines that produce table header:
Code:
<?php foreach ($columns as $name => $label) : ?> <th id="field_<?php echo $name; ?>" scope="col"><?php echo $label; ?></th> <?php endforeach; ?>
with:
Code:
<?php foreach ($columns as $name => $label) : ?> <?php $output_field = false; if ($field->name=='sel_field_forcat_a' || $field->name=='sel_field_forcat_b' || ...) { if ($isA['teachers'] || $isA['students'] ...) $output_field = true; } if ($field->name=='sel_field_forcat_g' || $field->name=='sel_field_forcat_k' || ...) { if ($isA['parents'] || $isA['teachers'] ...) $output_field = true; } ?> <?php if ($output_field) : ?> <th id="field_<?php echo $name; ?>" scope="col"><?php echo $label; ?></th> <?php endif; ?> <?php endforeach; ?>
and the lines that produce the rows:
Code:
<!-- BOF fields --> <?php foreach ($columns as $name => $label) : ?> <td><?php echo isset($item->positions['table']->{$name}->display) ? $item->positions['table']->{$name}->display : ''; ?></td> <?php endforeach; ?> <!-- EOF fields -->
with:
Code:
<!-- BOF fields --> <?php foreach ($columns as $name => $label) : ?> <?php $output_field = false; if ($field->name=='sel_field_forcat_a' || $field->name=='sel_field_forcat_b' || ...) { if ($isA['teachers'] || $isA['students'] ...) $output_field = true; } if ($field->name=='sel_field_forcat_g' || $field->name=='sel_field_forcat_k' || ...) { if ($isA['parents'] || $isA['teachers'] ...) $output_field = true; } ?> <?php if ($output_field) : ?> <td><?php echo isset($item->positions['table']->{$name}->display) ? $item->positions['table']->{$name}->display : ''; ?></td> <?php endif; ?> <?php endforeach; ?> <!-- EOF fields -->

For other view e.g. item view, you use the same first part of this code,
but for the second part of this code you need to go the appropriate template position 'mypos' e.g. find the statement:
Code:
<?php foreach ($this->item->positions['mypos'] as $field) : ?>
and place the code inside ...

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
12 years 9 months ago #17003 by aloisio
Thank you, very much.
I will prove all you sent me and told me.

Please Log in or Create an account to join the conversation.

More
12 years 9 months ago #17025 by aloisio
The file "category_items.php" that I've found in
"components/com_flexicontent/templates/MyTemplate/" not contains the lines you refer.
Code:
<?php foreach ($columns as $name => $label) : ?> <th id="field_<?php echo $name; ?>" scope="col"> <?php echo $label; ?> </th> <?php endforeach; ?>
What is the complete route of the file?
Thanks

Please Log in or Create an account to join the conversation.

More
12 years 9 months ago #17028 by ggppdk
Hello,

These lines are present in v1.5.4 and v1.5. 'default' template at:

'components/com_flexicontent/templates/default/category_items.php'

are you using the 'blog' template ???

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.309 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline