Orangehrm:Create new menu function - symfony

I am new to symfony framework. Now I am customizing orangehrm to suit certain new requirements.
For example: Similar to Admin>Qualifications>skills menu, I need to create Admin>Qualifications>Category.I have made the menu modifications by editing index.php file.
The functionality for this new page is similar to 'Skill' page.But we need to use different database table. Orangehrm uses doctrine for database related operation. I am not at all familiar with doctrine either.
Could someone please give the instructions for implementing 'Admin>Qualifications>Category' function? It is very urgent and I think the process is also very simple (not sure).

First you have to add your menu in database then create classes in your specific module.
Step 1: Check in which module do you want to add your menu.
module list is in ohrm_module table.
Step 2: Check under what user roll you want to add menu.
user roll is in ohrm_user_role.
Step 3: Add Screen on bases of module (step 1).
insert data into ohrm_screen
step 4: Add Menu Item on bases of Screen (step 3).
insert into ohrm_menu_item
Step 5: Assign screen to user on bases of user roll (step 2) and screen (step 3).
insert into ohrm_user_role_screen
Step 6: Logout and login again. New menu will be there.
Step 7: Go to your plugin folder and create your controller in action folder like this
class YourLinkNameAction extends sfAction {
//SANI: Start all coding in execute method
}
Step 8: Create your View in template folder like this
YourLinkNameSuccess.php
That's all

Related

Batch multi step and/or form multi step in sonata admin bundle

I have make search but I found nothing that help me. I use sonata admin bundle and first I want to know if it's possible to make multi step form.
Second, I'd like to make a new batch action (this step is ok for me), but after user chose the batch action I want a form with field that I can use in my custom batch action.
I have see it's possible to add field next the batch action list but this field are visible for all batch action for me I would like the user first chose the batch action and then see field on a other page for example the confirmation one.
Is there a way to do this?
Thanks a lot for your help.
Multi steps form
I found this bundle CraueFormFlowBundle but i never test it.
You could try use the jquery-steps front-end library with sonata and custom template for the edit/create view by generate js with js.twig files.
Batch action
For the batch action, you could use redirection in your code batch action logic

User can edit only it's nodes

I want to make one website with for instance 10 pages/nodes.
User 1 can edit the node 2, User 2 can edit page 5, User 4 can edit page 4, ...
How can I make this possible with drupal modules without custom dev?
you could create a role for each user (if there are really just 10 nodes/users) and use the Content Access Module to controll, who can edit what page...
This module allows you to manage permissions for content types by role and author. It allows you to specifiy custom view, edit and delete permissions for each content type. Optionally you can enable per content access settings, so you can customize the access for each content node.
unfortunately, i'm not totally sure, if this works without any custom development.. you should give it a try
In fact, no modules are needed.
What I've done is :
Create Role that can create one specific node type - called fullUser
Create role that can only edit it's nodes - called regularUser
Then after, for each user:
Create user, set fullUser
Connect with this user and create a node
Change rone from fullUser to regularUser
Now the user created can only edit it's node

Orange Hrm 3.1- adding new menu title to tab

i m new to symfony framework , i m using orangehrm-3.1.1 i have added a new menu title in the second level tab , but i dont know how to navigate to the particualar href link. Please help me out with the steps.
Here is how I add menu item via database.
To add a menu in orangehrm there are 3 tables you should check:
ohrm_screen
ohrm_menu_item (the menu hierarchy)
ohrm_user_role_screen (the user role permissions to specific screen)
First, add your link into ohrm_screen, specify your module_id and action_url (Check the module_id in ohrm_module).
After that add the screen into ohrm_menu_item table.
And then add new record in ohrm_user_role_screen with the allowed user_role_id and your screen_id, the can_read field should be 1 (true)
And finally try re-login to your application
Hope you can understand my messy english. :p
I don't know if you want the answer for your question still now. But I have solution for your question and for everyone who wants to add new tab in the orange HRM. Orange HRM is built in symfony framework, so without solid understanding of symfony framework it is difficult to change anything in orange HRM.
Go to the file-/orangehrm3.1.1/symfony/plugins/orangehrmCorePlugin/lib/authorization/service/MenuService.php
In this file you will find the main menu service .
Then go to the orangehrm database you will find ohrm_menu_item table and add the name of the menu you want to display.
Step 1: Check in which module do you want to add your menu
module list is in ohrm_module table.
Step 2: Check under what user roll you want to add menu
user roll is in ohrm_user_role.
Step 3: Add Screen on bases of module (step 1)
insert data into ohrm_screen
step 4: Add Menu Item on bases of Screen (step 3)
insert into ohrm_menu_item
Step 5: Assign screen to user on bases of user roll (step 2) and screen (step 3)
insert into ohrm_user_role_screen
Step 6: Logout and login again. New menu will be there.
That's all
You could use the approach mentioned on this page.

Is there a Drupal module that can redirect from root URL to a certain page?

I wonder if there's a Drupal module that can do this kind of functionality: if i go to home page, it will take me to some subpath within the site. i.e. www.something.com will redirect to www.something.com/product/node/11.
I tried creating an alias and used Path redirect module but for some reason, i can't reach the expanded URL when going to home page. it will display the content of www.something.com/product/node/11 but still using www.something.com.
I'm thinking that this can only be implemented in Apache server, not inside Drupal?
Note that our purpose of doing this feature is whenever a new product is created, we want our home website to point to that (i.e. www.something.com -> www.something.com/product2/home, before www.something.com/product1/home). If this is configurable inside Drupal, the changes would be easier and can be done by a Drupal administrator.
You should be able to go to /admin/settings/site-information and set the Default Front Page at the bottom of the form. That doesn't do a redirect: the home page will BE whatever you set the default to.
Create a new view (Node type) named "frontpage_redirect"
As suggested in answer by Michael D, create and save a view configured to search for your specified criteria:
display: page display, path = frontpage-redirect
pager: 1 item
row style = Fields
fields: Node => Node ID
filters: node type = product
sort: post date desc
Save your new view
At admin/config/system/site-information, set your "Default front page" to the view display path above (frontpage-redirect in my example)
In the view edit screen select "Theme: Information" link in the Page display. Look for the most specific (rightmost) entry under "Field Node: Nid (ID: nid)" - should be something like views-view-field--frontpage-redirect--page-1--nid.tpl.php, but will depend on the view name and display name. Copy the default views template views-view.tpl.php into your theme folder using the filename from 3.
Edit the template and put this code in it:
if (isset($row->nid)) {
drupal_goto('node/' . $row->nid);
}
This way of setting up the redirect lets you drive it from Views, which gives flexibility. When your customer decides in six weeks that they want to feature only the latest red product on the frontpage, you'll be able to update the logic behind the redirect using the views UI. (And you can do it from your phone on the train home!)
You avoid the need to create a custom module (which is easy enough, but does add some complexity) or to move your site logic into .htaccess.
Using the Views module, create a new view that displays one full node, ordered by last created, filtered appropriately, then create a page display in the view. Then follow Graham's instruction to set the site homepage to the view URL.
Another way would be to write a very simple custom module that db-queries for the latest node created of the sort you want, grab the URL to the page, then redirect there using drupal_goto().
There are other ways to do what you want inside Drupal, but I can't think of any that are more direct and simple at the moment...
What you are asking seems wrong. Sorry if I misunderstand some detail, but it seems you should reconsider the problem on a higher level.
If I understand you right, you want to show the page for the latest product as the homepage?
If so, maybe you should turn that into show the latest project page on the homepage. That fits a lot better with the RESTfullness of the web. And with expectations of the users.
The pattern would then be:
GET /products/22 shows product 22
GET /products/23 shows product 23
GET /product/latest shows the last product (in this case, the page would be exactly similar to /products/23)
To achieve that, you can use views module.
On similar lines to Michael D's post, assuming you want to pull the most recently published product from a custom content type called "products," you could put something like this in your settings.php:
function yourtheme_preprocess_page(&$variables) {
$query = db_query("SELECT nid FROM {content_type_products} ORDER BY nid DESC LIMIT 1");
while ($row = db_fetch_object($query)) {
$redirect_nid = $row->nid;
}
if ($variables['is_front'] == 1) drupal_goto("/node/" . $redirect_nid);
}
modify the .htaccess file.
http://drupal.org/node/50322#comment-2456576

Drupal views & to do list

Wondered if anyone can tell me whether the following is possible within views.
I have installed To do module - http://drupal.org/project/to_do
I then created my own view which lists all the tasks created in a particular Organic Group, which works lovely.
One of the fields ive added as the to do button field which gives the user the ability to mark a task as finshed from the view listing.
the problem I have is that all users part of that group can see that buton & has the ability to mark the task as finished.
Is there a way I can use views to only show that button if the current logged in user is the author of that node( to do task).
Views have different templates. In one of them all the fields are being printed. You could in that template make a check if the user is the author and then only print the todo field.
You cam click the theme information link inside the view to get a list of templates that's used and what you could call a custom template for views to use it.
This will only show content the user created. It's a pretty simple argument

Resources