One field for each one category - SOLVED -

More
14 years 7 months ago #16989 by ggppdk
Hello,
Then you could create one template per category.
Will it not that cover your needs?

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 review. Thanks!

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

More
14 years 7 months ago #16994 by aloisio
The site is to a school, where several teachers put data from their students.
Students and parents should have access to see the information of the teachers.
What I mean is that there is an intersection of data.
Any student should be able to see the data sent over him by different teachers
For this reason I do not think it works by several templates.
There are 4 different types of information and for this I have created four templates: Evaluations, events, training materials, communications.

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

More
14 years 7 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 review. Thanks!

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

More
14 years 7 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
14 years 7 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 review. Thanks!

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

More
14 years 7 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
14 years 7 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
14 years 7 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 review. Thanks!

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

More
14 years 7 months ago #17039 by aloisio
I use flexicontent 1.5.4
I am using 4 new templates, copies of the template default.
One template for each type of information.
The teachers send 4 diferents types of information for his students.
This 4 diferent types must not appear together.
I have put each type of information in a different template.
If I make copies of the default template, this lines should appear...

I have found the lines!

Thanks

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

More
14 years 7 months ago #17046 by aloisio
Before anything else, thanks for your interest.
I'd like to clarify what you call the "views".
The system contains a form to send data
(flexicontent-"item submission form").
And an item to view data (flexicontent-category).
In this system there are two views.
Is this correct?

All users are registered in "flexiaccess" as "individual group."
You think there's any reason to create new groups such as teachers, students?

I did not understand the last part when you say:
"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"
The problem I have is related to the information in one of four templates that I created, the template "academic."
The fields for the teacher to send data and the data that students will see are all in this template.

Trying to understand this last comment:
The system uses the same template in two different ways, or at two different times: in sending data and the data view.
Is this correct?

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

Moderators: vistamediajoomlacornerggppdk
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
Save