Welcome, Guest
Username: Password: Remember me

TOPIC: Foreign tables and filter to user logged in

Foreign tables and filter to user logged in 12 Sep 2012 18:28 #3543

Hello

First a big compliment to the programmers of these Componentcreator.

But i've a little problem i don't understand really and so is it strong to solve

First: on the frontend Collections i want automaticly set a filter on the created by user to the User whitch is logged on. So that he only can see his own created tablelines. Is this possible to set in the Designer.

Second: i've a Tables like Projects , UserProjects, and UserProjectWorktimes

Projekts ist a list of projects edited by the admin (Backend)
In UserProjects the frontenduser can select projekts he want work for
In UserProjectWorktime he should enter his worktime for Projecs from UserProjects
The UserProjects has a defined relation to Projects (forign Table)
and the UserProjectWorktimes to UserProject
In the ItemViewFormular of the UserProjectWorktimes the Project->name isn't a combobox I expected. Ist a simpel Field labeld UserProjects->ID.
In the designer it's a combobox labled with UserProject. For creating i pull the UserProjects->Projects->name from the Fieldlist to the formular.

I hope my english isn't to bad to understand.
best regards from germany
René
Last Edit: 03 Oct 2012 13:42 by admin.
The administrator has disabled public write access.

Re: Forign tables and filter to user logged in 12 Sep 2012 20:46 #3551

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
Forms are limited to the first level of datas.

I answered about that fea time ago. It is a simple question of logice and it cannot be sort it out because it is a non sense.

In your case, you can do it only if UserProjects and Projects are considerated as 1:1.
Means that UsersProjects is an extension of the Projects table.

Cook do not handle this fucntionality now. But you get a good start if you pre-build your requirements before.

Create 2 Layouts that you will merge afterwards.
When you save, you get 2 forms in one, and you will must split the datas to save the correct informations in the correct tables, using the correct ID value for the two linked items.

It is not a big deal, but it starts to be complex.

1:1, N1, and N:N are not so easy to realize.

In future, Cook will really rock on that !!
Coding is now a piece of cake
The administrator has disabled public write access.

Re: Forign tables and filter to user logged in 12 Sep 2012 20:50 #3552

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
And for your first question :

Use the publish wizard, and unpublish the items. so these items can still be visible by the author if you define correct ACL's
Coding is now a piece of cake
The administrator has disabled public write access.

Re: Forign tables and filter to user logged in 13 Sep 2012 11:45 #3571

It isn't a 1:1 between Project and UserProject. It is a 1:N because 1 Project has N User.
Also not every user work on the same projects.

I think i sove it otherwise, by setting the forign from userProjectTimes direct to Projects and filtering the list of the possible projects with project_id in (select project_id from userProjects where user_id = aktual user) in the code.

Because I readed the thema filterin user->id several times, i think it would be nice to have a non visible filter on the collectionpages automaticly set on the actual juser(user->id) so all frontend users only can edit/see/delete there own lines. also it is not clear for me how the Publish wizzard can help me.

one question more: is it posible (without editing the code) to set a link from the lines in the userProjects collection View directly to the userProjectTimes collection View so that the list is filtered by the clicked project.
Maybe also from the userProject ItemView.

best regards
René
The administrator has disabled public write access.

Re: Forign tables and filter to user logged in 13 Sep 2012 14:55 #3577

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
Because the authoring features you are telling are availables ONLY is published is setted.

I explain :
If you use only the authoring, it is not said that the contents are privates. The items are linked to the Creator, (and the editor when edited) only this.

When you define a publish field, it means 'public' in front end.

So once the publish is setted to false, you still can authorize in ACL the permission to pass the unpublished state, if the user is the author.

So the contents are not published (not public)
If some items are setted to publish, they become availables for other users.

If you complete with accesslevel wizard, you can also define a published state for particular group (sharing possibilities to your group)
Coding is now a piece of cake
The administrator has disabled public write access.

Re: Forign tables and filter to user logged in 14 Sep 2012 03:29 #3586

OK I try it out.
The administrator has disabled public write access.
Time to create page: 0.117 seconds

Get Started