This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » development » Miscellaneous » How to apply this design in Symfony : suggestions please !!!
icon5.gif  How to apply this design in Symfony : suggestions please !!! [message #72644] Tue, 17 February 2009 06:28 Go to next message
vikram8jp  is currently offline vikram8jp
Messages: 5
Registered: February 2009
Location: Tokyo
Junior Member
Hello all,

I am using Symfony 1.2.4 with Doctrine plugin to create a web application. On one of the page I have to have three lists, each displaying some sort of personal information. Here, have a look at this layout....

index.php/fa/1037/0/

As you can see the list follow the same presentation scheme and have some information which is displayed in all of them.

Hence I made use of components (as in sfComponents) in Symfony. I created a components.class.php that holds the doctrine query for generating this list and a partial _display.php that contains the html.

The layout of this page is dependent on privileges assigned to user. So if the user is not admin, edit info box will not appear.

Now my controller is actions.class.php and my template is showSuccess.php. In this template I have to include the component two or three times, depending on user login and every time displaying different information. I am confused as to where to place what in the application.

Can somebody start by giving some suggestions?

Thanks and Regards
Vikram

Re: How to apply this design in Symfony : suggestions please !!! [message #72646 is a reply to message #72644 ] Tue, 17 February 2009 08:01 Go to previous messageGo to next message
vikram8jp  is currently offline vikram8jp
Messages: 5
Registered: February 2009
Location: Tokyo
Junior Member
Does my question seem too vague? or is the description very haphazard? I can give some details if I have some suggestions coming in.... please. I need help regarding this..

[Updated on: Tue, 17 February 2009 08:01]


Thanks and Regards
Vikram
Re: How to apply this design in Symfony : suggestions please !!! [message #72667 is a reply to message #72644 ] Tue, 17 February 2009 11:05 Go to previous messageGo to next message
halfer  is currently offline halfer
Messages: 9535
Registered: January 2006
Location: West Midlands, UK
Faithful Member
Don't chase after two hours - these fora are not that busy! Chase after a day or two if required.

If you are doing this from scratch, rather than using generators, the solution is probably quite simple. In your template, check the credentials your user has, and if they have the right ones, render the extra table column. Don't forget to do the same check in the 'edit' action too, to prevent cheeky non-admin users working out the right URL for a table row.


Remember Palestine
Re: How to apply this design in Symfony : suggestions please !!! [message #72781 is a reply to message #72667 ] Wed, 18 February 2009 01:05 Go to previous messageGo to next message
vikram8jp  is currently offline vikram8jp
Messages: 5
Registered: February 2009
Location: Tokyo
Junior Member
Hello halfer,

Quote:

In your template, check the credentials your user has, and if they have the right ones, render the extra table column.


You said I should do this checking in my template. But that would mean placing too much of ugly php code in presentation layer. Won't that be burdening the view designers with the task of doing PHP coding. This is where I get confused a lot of times. What to put in which layer?

[Updated on: Wed, 18 February 2009 01:05]


Thanks and Regards
Vikram
Re: How to apply this design in Symfony : suggestions please !!! [message #72797 is a reply to message #72644 ] Wed, 18 February 2009 09:51 Go to previous message
wissl  is currently offline wissl
Messages: 447
Registered: March 2008
Location: Germany
Faithful Member
You could do the checkin in the action though, and just set a variable that is checked in the view then, if you feel better about it. But you sort of will have to put any logic there, I believe:

actions.class:

public function executeSomething()
{
  $this->show_additional_column = $this->getUser()->hasCredential('xyz')
}


template:

<?php if ($show_additional_column): ?>
...
<?php endif; ?>


What do you think about that?
Previous Topic:eclipse PDT Content Assist
Next Topic:dompdf Installation
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software