CodeIgniter Forums
v 1.3.3 grocery CRUD - an automatic Codeigniter CRUD - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: v 1.3.3 grocery CRUD - an automatic Codeigniter CRUD (/showthread.php?tid=40505)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23


v 1.3.3 grocery CRUD - an automatic Codeigniter CRUD - El Forum - 06-14-2012

[eluser]web-johnny[/eluser]
New grocery CRUD version 1.2.3 is now released fully compatible with CI 2.1.1


v 1.3.3 grocery CRUD - an automatic Codeigniter CRUD - El Forum - 06-14-2012

[eluser]Unknown[/eluser]
awesome. Have not used it yet, will try it today. Love the design of the grocerycrud page. Are you a coder with design criteria? scary... lol Great work


v 1.3.3 grocery CRUD - an automatic Codeigniter CRUD - El Forum - 07-05-2012

[eluser]Ashirra[/eluser]
Hello web-johnny

Great work! I write my thesis and use your library as well. It saves me a lot of time and till now I don't have big problems with it, but...

project

I have 28 tables which are linked together. I solved most of the special work with callbacks and it works fine.

problem

I have problems with n_n relations. An example:

client
*id
client_nr
...

client_frontuser
*client_id
*frontuser_id

frontuser
*id
username
...

Link frontuser
../index.php/back/frontuser

In the frontuser table I add a column which contains the following link

../index.php/back/clients/index/94

94 is the id from the frontuser. The aim is to show only clients which belongs to this specific frontuser.

I'm not sure if it's feasible with set_model.

I'm not a native english speaker and perhaps I missed the solution :-)

Cheers
Ashirra








v 1.3.3 grocery CRUD - an automatic Codeigniter CRUD - El Forum - 07-05-2012

[eluser]goFrendiAsgard[/eluser]
Hi,@Ashirra
In my case I have article and comment table.
An article can have more than one comment.

This is my code:
Code:
public function comment($article_id=NULL){
     $crud = new grocery_CRUD();    
     $crud->set_table('blog_comment');
     if(isset($article_id)){
      $crud->where('blog_comment.article_id', $article_id);
     }    
     $output = $crud->render();
    
     $this->view('grocery_CRUD', $output, 'blog_comment');
    }

The most important thing here is you can use $crud->where('your_field', $value);
it works perfectly....


v 1.3.3 grocery CRUD - an automatic Codeigniter CRUD - El Forum - 07-05-2012

[eluser]Ashirra[/eluser]
Hi Asgard

thanks for your reply.

Quote:An article can have more than one comment.

That's an 1:n relation and it works very well in my project too.

But I have problems with n:n relations

frontuser
id / name
1 asgard
2 ashirra

frontuser_client
frontuser / client
1 1
1 2
1 3
2 1
2 2

client
id / name
1 peter
2 phil
3 petra

One solution is to use the pivot directly.

from frontuser
../index.php/back/frontuser
to the pivot
../index.php/back/frontuser_client
to the client (details)
../index.php/back/client

"divide et impera". Because an n:n can be splitted into two 1:n.
but is it the best solution?


v 1.3.3 grocery CRUD - an automatic Codeigniter CRUD - El Forum - 07-05-2012

[eluser]goFrendiAsgard[/eluser]
[quote author="Ashirra" date="1341494710"]
But I have problems with n:n relations

frontuser
id / name
1 asgard
2 ashirra

frontuser_client
frontuser / client
1 1
1 2
1 3
2 1
2 2

client
id / name
1 peter
2 phil
3 petra

One solution is to use the pivot directly.

from frontuser
../index.php/back/frontuser
to the pivot
../index.php/back/frontuser_client
to the client (details)
../index.php/back/client

"divide et impera". Because an n:n can be splitted into two 1:n.
but is it the best solution?[/quote]

Ah, sorry, I think I have misunderstand it :p
Do you mean something like this? http://www.grocerycrud.com/examples/set_a_relation_n_n
I think it is better to have 2 grids, the frontuser and the client. You can then add n_n relation field to the both grids (please see the link).


v 1.3.3 grocery CRUD - an automatic Codeigniter CRUD - El Forum - 07-05-2012

[eluser]Ashirra[/eluser]
Code:
function linkToClients($value,$row){
      return "<a href='".site_url('>id)."'>clients</a>";
}
'.$row - >id)."'

This link invokes directly my client site. So the question was "it's possible with set_model or other solutions, to take the ID fromt the link and start a own query with this value ($row->id).

SQL Code like this
Code:
SELECT * FROM client, client_frontuser
         where client.id = client_frontuser.client_id
         and client_frontuser.frontuser_id = $ID

Now I found a solution.

Instead of taking one step (frontuser -> client). I take two with one step in the middle (frontuser->frontuser_client->client). So it works.

Now, I'm interested if there is a better solution.

thanks asgard for your inputs ;-)

gn8







v 1.3.3 grocery CRUD - an automatic Codeigniter CRUD - El Forum - 08-27-2012

[eluser]web-johnny[/eluser]
Proud to announce the new version 1.3 Smile

The new version 1.3 is out with brand new features

After almost three months of development I am proud to announce you the new version 1.3 with brand new features and not only bug fixes this time. You can download it straight away from http://www.grocerycrud.com/downloads .

For more check the forum topic at grocery CRUD's forum


v 1.3.3 grocery CRUD - an automatic Codeigniter CRUD - El Forum - 09-12-2012

[eluser]C1t1zen[/eluser]
hi
i have a problem i never can use dates with Grocery CRud

the calander neverh showen

please help
so tell me what i need to setup database table and grocery crud to make all work out
for sure i did searched alot in google and in forum of grocery crud but still not working

thank you in advance


v 1.3.3 grocery CRUD - an automatic Codeigniter CRUD - El Forum - 09-12-2012

[eluser]web-johnny[/eluser]
Hello @C1t1zen.

If you have any problem to use dates you can easily use the change_field_type method. So in your case you can simply have:
Code:
$crud->change_field_type('inserted_date', 'date');
If you have any JavaScript problem you have to give a print-screen of your problem.