Zend Naviagtion/Menu - zend-framework

Im trying to figure out the best way to keep track of my navigation for a site im working on.
I already use Zend Navigation to render a top menu with drop down submenus. This works fine. However I also want to keep track of my menu items which apply directly to a single item/model which the above menu displays. For instance my menu now.
<nav>
<job>
<label>Jobs</label>
<resource>job</resource>
<controller>job</controller>
<action>list</action>
<pages>
.....
</pages>
<job>
</nav>
This works good for handling "menus" which do not ally to a specific record in database. It is possible to keep track of the "actions" that are carried out on individual records. These extra items should not be rendered inside the main navigation as they only have context with a certain id, but could be rendered as a menu when viewing a record.
so maybe like:
<nav>
<resource>
<menu items to be rendered without specific context>
<possible submenu items>
</possible submenu items>
</menu items to be rendered without specific context>
<menu items to be rendered inside a specific context(like viewings a record)>
<view></view>
<edit></edit>
<invoice></invoice>
</menu items to be rendered inside a specific context(like viewings a record)>
</resource>
</nav>
I was thinking I could have a separate .xml for my context specific menu items but I would like to keep the resources grouped together.

So you want a drill down menu? You can do it easily with CSS. Example: (I prefer arrays but you can adjust).
Create your navigation as you normally would but ensure you set the subitems for each action:
$menu = array(
array(
'label' => 'Add Booking',
'module' => 'booking',
'controller' => 'admin',
'action' => 'addBooking',
'route' => 'default',
'pages'=>array(
array(
'label'=>'test',
'module' => 'booking',
'controller' => 'admin',
'action' => 'anotheraction',
)
)
)
);
CSS:
ul.navigation li ul li {
display:none;
}
ul.navigation li.active ul li {
display: block;
}
As long as you set the parameters for the parent page correctly it will should work fine.

Related

How to link this button to another route in Laravel Bacpack

So i have this view below :
The button view that i want to route to another page
Theres a button named Go To Question that i want to link to edit-question route. This is the code for the button.
[ // CustomHTML
'name' => 'separator',
'type' => 'custom_html',
'value' => '<a href="{{$this->crud->setEditView(`backpack::crud.question`,3);}}"
target="_blank">Go to question ></a>'
],
Does anyone know how to do this ?
You can easily link to a Backpack page using the backpack_url() helper instead of Laravel's standard url(). That will also add the admin prefix that you've set in your config/backpack/base.php (by default admin).
But take note that you cannot add a link to a particular view in Laravel. You should point to a route, that points to a controller, that loads a view. So your button should look more like this:
[ // CustomHTML
'name' => 'separator',
'type' => 'custom_html',
'value' => '<a href="{{ backpack_url('question/3/edit') }}"
target="_blank">Go to question ></a>'
],
This will point to the Questions CRUD route, which will load QuestionCrudController, which in its turn will load the edit view - assuming you do have that CRUD.

How to add custom action button in suiteCRM module sub panel list?

I need some suggestion in my suite CRM module integration.
I have a sub-panel in one of my modules and required to add one more edit button to redirect to a custom form to take some input from the user for each row separately.
Below is a sample image of my sub-panel list view.
In the above image on click of the edit button of a row, there is a remove button, I want to add one more custom button after remove and need to redirect from there to my new form.
I have checked some of forums and blogs but didn't found the solution.
To add a button you will need to modify the metadata of that sub-panel. In metadata, you will see the following code for the Edit and Remove buttons:
'edit_button' =>
array (
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'module' => 'Contacts',
'width' => '5%',
'default' => true,
),
'remove_button' =>
array (
'vname' => 'LBL_REMOVE',
'widget_class' => 'SubPanelRemoveButton',
'module' => 'Contacts',
'width' => '5%',
'default' => true,
),
You can add your new button using same array syntax. As you can see that every button use specific widget class(defined as widget_class) therefore you will need to add new widget_class class for that. You can find existing widget classes in this folder: include/generic/SugarWidgets.
Cheers!

How to unmerge edit and remove buttons in sugarCRM?

When in SugarCRM CE when I insert an edit button into a custom sub panel meta file for some reason it merges it with the "remove" button as per attach. So the edit button gets a dropdown arrow and 'remove' button appears when we click on the arrow.
The code I use to show the buttons is
// Edit button
'edit_button'=>array(
'widget_class' => 'SubPanelEditUsersprjct_projectsButton',
'projects_users_id'=>'projects_users_id',
'module' => 'Users',
'width' => '5%',
),
'remove_button'=>array(
'vname' => 'LBL_REMOVE',
'widget_class' => 'SubPanelRemoveButton',
'module' => 'Users',
'width' => '4%',
'linked_field' => 'users',
),
How do I get the 2 buttons to show up next to each other.
Exact same issue as described here: http://wiki-crm-forum.com/forum/viewtopic.php?f=2&t=9632&p=33429&sid=e82d1abbf9f4d0b39f01137dd9e4c913#p33429 but there's no solution it seems
I see the problem but I have a workaround.
You may remove "Remove" from subpanels and use this free plugin to add "Remove" button in subpanel in front of each row.
https://store.outrightcrm.com/product/outright-listview-delete/

"Theme Customizer" - different background image for different category

I'm trying to make setting in theme customizer which will allow me to choose different background image to different category. I have two settings working separately, but i don't know how to combine them to work together and it seems like there was no problem like this before.
In theme customizer it looks like
> this <.
How make it work together?
EDIT:
I was trying in many ways to acomplish this, but only thing that worked as i wanted was creating a section for each category and add background image there, like this:
$wp_customize->add_section( 'background_section_cat_a', array(
'title' => __( 'Category: cat_a', 'twentythirteen-child'),
'description' => 'Options prepared to change background settings', 'twentythirteen-child',
'priority' => 160,
'panel' => 'background_panel',
));
$wp_customize->add_setting( 'background_image_cat_a', array(
'default' => 'abc.jpg',
));
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'background_image_cat_a', array(
'label' => __( 'Select background image', 'twentythirteen-child' ),
'section' => 'background_section_cat_a',
'settings' => 'background_image_cat_a',
)));
and use this setting:
body.category-cat-a {
background-image: url(<?php echo get_theme_mod('background_image_cat_a'); ?>);}
But when I add new category, I have to enter my theme customizer options and add it there, and it is very time time consuming.
There is another way:
1. Add custom field with image to your Category taxonomy
2. call your image in category.php page.

Cakephp input form view as unordered list

I'm developing a website using cakephp 2.x.
Now, I create a form using Cakedc/search. This form has input(select/dropdown list).
But the list is too long, so I want the dropdown to be view as unordered list (< ul >< li >).
Like in the lazada (search for brand): http://www.lazada.com.my/womens-watches-bags-accessories/.
the code:
<?php echo $this->Form->create('Product', array(
'url' => array_merge(array('action' => 'search'), $this->params['pass'])));
echo $this->Form->input('brand_id', array('label' => 'Brand', 'options' => $brands, 'empty' => 'Select Brand'));
<?php echo $this->Form->submit(__('Search', true), array('div' => false));
echo $this->Form->end();
?>
Please someone help me. Thanks in advance..
You'll have to use javascript to get the id of the clicked li element or the link inside, use data attributes for that for example. Then set this value to a hidden form field or directly submit the whole form using ajax to update your results.
Your example URL is a simple list by the way that is just doing redirect on click.