peer_method in symfony's admin generator - php

I have a symfony module for my GenericImport class. Rather than the default method symfony uses for the list page, I want to use GenericImportTable::getQueue(). I thought the following would work but it didn't:
config:
actions: ~
fields:
list:
peer_method: getQueue
How can I use a custom query for the list page? (I'm using Doctrine.)
(To be clear, I don't wish to manually create a whole new custom action. I'm going the route I'm going because I want to take advantage of everything that comes with the admin generator like batch actions, the filter, etc.)

Try table_method.
...and read more here: http://www.symfony-project.org/jobeet/1_4/Doctrine/en/12#chapter_12_sub_table_method

Related

Sulu CMS - custom form

How to add a custom form to sulu CMS (example: complex contact form) and save values to database? Is there any good example? Documentation does not mention about custom development.
Regards,
As long as your forms are static (meaning the content manager is not able to choose which fields are appearing), you can simply do what is described in the Symfony documentation.
There are two (probably even more) different possibilities to include Symfony forms:
The first one is to create your own route and controller, working with Symfony forms as you would do in any other Symfony application.
The second one is to use the template system of Sulu as described in our documentation. Then you can add a few fields for content management around the form the content manager can use. In the template defined in the <view> tag of the XML you can again use Symfony form stuff. If you need any special information from the system you can even change the <controller> tag of the XML, to pass more than only the data from the content management.
There are also some ideas concerning a more sophisticated form manager floating around, but that's far from being published.

Pagination in front end Module Joomla

I've searching trough google for a way of adding pagination into a module, but i could only find information about adding it into components like here:
How to add pagination for component front end (Joomla 2.5)
Is it posible to implement this same principles to make a pagination for a module?, or a different approach is needed?
I think this is not the correct way of doing to try to implement pagination in a joomla module. Normally, only component are made to be able to use standard Joomla pagination, because it uses itself models and view controller...
The example we see on the link you propose is using pagination from the view controller (view.html.php), witch extend JViewLegacy (witch is an alias for JView). Pagination is natively supported by it.
I imagine you need to show many items pages on a module, but maybe reload the page for it is not the best option. You can perhaps try to load more items, and to use a JS script to do pagination (even a slider can do it nicely), or simply to add a link to the whole section of the associated component.

How to override prestashop's default front-office template and controller in module

I want to override prestashop's default front-office template and controller in my newly created module without modifying prestashop's internal code/structure.
Example :
I have created one module i.e. "mymodule" in /modules folder where I want use prestashop's address form (address.tpl).
see : http://demo-store.prestashop.com/en/address.
I want to enhance address form by providing some additional fields/functionality but without changing prestashop's core functionality.
So, How can I override its controller/themes/templates in my module? I have searched lot of about this on google but didn't found anything :(
Any help would be appreciated.
Modules can work like you ask only if there's an HOOK inside the template/controller that allow you to run your customized function. Look if you have a chance of hooking your module somewhere by watching on the list showed inside
backoffice > modules > position
the Address controllers hasn't got any Hook if i recall well, so you have 3 ways to edit its functionality:
Go for an (imho) horrible client-side modification, by an heavy usage of jquery/ajax call to perform the action you need. Place the code by using a module that only add your js script in the header by using the hookHeader() function. Since this hook it's always called in all the site you can exploit the missing hook in the address template.
add yourself an hook inside the Controller and the template by following this procedure: http://www.prestashop.com/forums/topic/218291-create-custom-and-new-hook-in-ps-15/
use the amazing override features of the prestashop framework to modify what you need in the Controller file placed inside your prestashop_root/override/controllers/front/AddressController.php and inside your /prestashop_root/themes/my_theme/address.tpl. this way you can ovverride any function of the Controller withouth loosing the original functionality and if you'll need to upgrade your installation you will just need to check for the function you changed in the overrided file just as you would do for your module.

CakePHP 1.3: Alaxos ACL Plugin not recognizing Pages Plugin

I have been developing with CakePHP and the Alaxos ACL plugin has helped in tremendously.
However, I am facing one issue I am not sure how to fix it?
I added a plugin named 'pages', but I cannot get ACL to see it so it is added to the list of allowed/denied actions.
If I access the plugin thru domain.com/pages/pages I get the following error
DbAcl::check() - Failed ARO/ACO node lookup in permissions check.
When I check thru the ACL plugin display, there is no reference to the pages controller and if I run the ACL build function, it simply says that there is nothing to add.
Is it because this controller is named pages and there is already a pages controller within Cake?
If it is how do I fix it? Is my only option, at this time, adding this manually to the Db? Should I go thru this plugin and rename pages to something else? or is there anything else I should be doing?
Thanks,
I see two things here. First like you suspect, having two classes in your application that share the same name is a bad idea. It will likely give you some problems in one way or another, with the wrong class being instantiated or whatever. As far as Cake does not use namespaces, this is not recommended.
Then, even if you change this name, there will be another problem if the controller you want to manage with ACL is the 'default' controller (a controller that has the same name as the plugin). There was an issue with the ACO nodes retrieval when the path contains twice the same name, which is the case for plugins default controllers.
controllers/Pages/Pages/index
So I decided to just skip the plugins default controllers from the controllers supported by the ACL plugin.
If you are the author of this plugin, you could rename it (because PagesController exists already), and move the actions in some other controller than the default controller.

Using Symfony, sfDoctrineGuardPlugin plugin, How can i customise sf_content? Using partials?

I am using symfony 1.4.8 with sfDoctrineGuardPlugin for my backend.
My question is how can i customise sfDoctrineGuardPlugin's default content? For example, how can i do something on the page between filter and table (on the left hand site)? Or, how can i customize table (http://goo.gl/ZmRey)?
I cannot find any solution for using partials on backend. Is there any way to use partials/components/slots on backend?
I hope you understand my question and tell me a way.
Thanks for your answer(s),
Erman
Partials, components and slots are no different on the back-end to the front-end - your "backend" is just another Symfony application. From the screenshot you gave, it looks like you're looking to customise the admin generator theme.
The quickest way to get started with this is to look in your cache/appname/ folder and see the automatically-generated modules here, with all the template files, partial files and so on. You can then create an empty module in your application, and override select parts of the theme with whatever you want to change. See this part of the Symfony docs for a full list of partials etc, and how to go about overriding them in more detail.
In the specific case of sfDoctrineGuardPlugin-module pages, these can be overrided in the same way as normal modules - simply create eg an sfGuardAuth module and override the selected parts of the module you want to.
If you want to go further and create your own admin generator theme, this is a bit more advanced. Here I will shamelessly promote a blog post I wrote last year ;-) John Cleveley's presentation also provides some great tips.

Categories