Hi all.
Sorry if its a noob question, but I cant find it anywhere...
So...

I have this two tables:

Users:
id - int
username - varchar
password - varchar
created - datetime

Projects:
id - int
name - varchar
created - datetime

and this HABTM table:

User_Projects:
id - int
user_id - int
project_id - int

My system is already getting all realted data...
If a user wants to know what projects he can work, I will retrieve his data
automagically with cake...
ok...
but the user can chose in what project he will work today..
so, i need to show all projects and let user chose one or more to work..

I am showing the users projects and all the projects, so he can chose...
but in my list appears all projects, even if the user is already working on
it...

what i need to do is to get only the projects that are not selected
already.. only the projects the user is NOT working at the moment...

So.. i have something like this:


User ID: 1
Username: Morfer

Projects in progress:

id       name
1       Project 1
5       Project 5
8       Project 8


Projects you can work:
id       name
1       Project 1
2       Project 2
3       Project 3
4       Project 4
5       Project 5
6       Project 6
7       Project 7
8       Project 8
9       Project 9
10       Project 10


And i need to show this:

User ID: 1
Username: Morfer

Projects in progress:

id       name
1       Project 1
5       Project 5
8       Project 8


Projects you can work:
id       name
2       Project 2
3       Project 3
4       Project 4
6       Project 6
7       Project 7
9       Project 9
10       Project 10


In my controller, im getting the data:

               // Get users data and related projects
$user = $this->User->read(null, $id);
$this->set('user', $user);

               // Get projects data
$projects = $this->Project->find("all");
$this->set('projects', $projects);




Can anyone help me?

Thanks
--
Renato de Freitas Freire
[email protected]

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to