Interesting Look-up Issue

6 posts by 2 authors in: Forums > CMS Builder
Last Post: April 27, 2012   (RSS)

By Perchpole - April 26, 2012


I've been asked to create a large web portal for a local community. Naturally I'm using CMSB as the platform but the nature/structure of the site is forcing me to come up with new and inventive methods to solve some interesting problems!

Here's one...!

The portal will be used to represent about 30 different groups within the community. Each group will have their own Category page on which they will post information about their particular activities along with pictures and contact details.

Each group will also be able to post records in the form of news updates, articles and so on. All of these updates (from all the groups) will be fed into a general "update" list page.

It's all pretty straight forward. The only issue is the way in which the groups will be able to access/update their category pages.

CMSB is not particularly flexible in this department. Unlike normal records, you cannot set different levels of access for categories. The only way around this is to add the details to a separate record and then feed it into its associated category.

So, I have set-up an additional editor/table called "content". Each group will be able to create a content page - containing all their details - which is then fed into their corresponding category page.

So far - so good. The relationship is shown in the illustration (picture1.jpg) attached to this post.

The problem is, when a group creates an ordinary news record, I want to be able to pull in some of the data from the content page. In this particular case, I want to be able to stamp each record with the "icon" that identifies the group who posted it.

I need to get the icon - indicated by the red arrow - from the content page down onto the records.

How?

:0/

Perch
Attachments:

picture1.jpg 58K

Re: [Perchpole] Interesting Look-up Issue

By Jason - April 26, 2012

Hi Perch,

So if I understand this correctly, the record is created by a user, who belongs to a group, and a group has an icon that you want to be able to display. Is that right?

If so, you should be able to access the group record using the createdBy. fields in the record you are outputting.

For example, lets say that your group records are stored in a section called "groups" and in your user accounts, there is a field called "group" which stores the record number of the group that a member belongs to (this is assuming that a user can only belong to 1 group at a time). Once you're outputting that record, you could get the group record like this:

<?php
list($groupRecord, ) = getRecords(array(
'tableName' => 'groups',
'allowSearch' => false,
'limit' => 1,
'where' => "num = '".intval($record['createdBy.group'])."'",
));

$group = @$groupRecord[0];

?>


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Interesting Look-up Issue

By Perchpole - April 27, 2012

Hi, Jason -

Thanks for this. Unfortunately the solution won't work for various reasons, not least because some users will have access to multiple groups.

Perhaps I should try to simplify the issue...

Let's say I have created 10 records - all assigned to the same category.

On "Record 1" I upload a picture.

How do I then pull that picture on to the other 9 records?

:0/

Perch

Re: [Perchpole] Interesting Look-up Issue

By Jason - April 27, 2012

Hi Perch,

In the scenario you're describing would it work to upload a picture to the category? Then, as long as we know what category a record belongs to, you can then access that category record, and get the image.

Does this work?
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Perchpole] Interesting Look-up Issue

By Jason - April 27, 2012

Hi,

Author access to a category is tricky, given the hierarchical structure of a category section.

How are category records being created currently? One approach would be to only give certain users access to the category section at all and have them be responsible to uploading the images.

If you wanted the uploads to be on a "per record" basis, you could do a loop through all the records in a given category, and then stop when you find the first one with an image, using that image in multiple places.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/