Jump to content


basque

Member Since 28 Mar 2014
Offline Last Active Mar 31 2014 05:28 PM
-----

Topics I've Started

Take values from other table

28 March 2014 - 03:36 PM

First of all hi too everybody :)
 
Well i'm new with codeigniter and Grocery CRUD and i have a question about changing the edit form. 
 
I have this database: 
 
Person
idPerson (PK)
Name
idPlace  (FK)
 
Place
idPlance (PK)
place_name
idSchool  (FK)
idfloor  (FK)
 
floor_school
idSchool (PK) (FK)
idfloor (PK)  (FK)
order
image
 
floor
idfloor  (PK)
floor name
 
school
idschool  (PK)
idName
 
Explanation of DB: A person can have one place. A Place must be from some school and some school floor (this relation about floor and school is in the table floor_school)
 
Well the thing is that i want to show the list of all persons and allow the user to assign them a place or not. 
 
To reach that i make 
 
$crud = new grocery_CRUD();
$crud->set_table('person');
$crud->set_relation('idplace', 'place', '{place_name} - {idSchool}');
 
The thing is that it will be ideal to show the place name and instead of showing the school id show the actual school name from the table school. 
 
I now that this is a join from person -> place -> floor_school -> school but i think its not possible to relate those tables.
 
Someone can give me a hint to do this? 
 
Other option will be to call a different view when you click the add and edit button, is that possible? I mean when i click those buttons show the user a form created by me. I don't know if with jquery i could make the trick...