Thursday, June 12, 2014

Steps on How to Write a New Module in Orange HRM

It is not easy to write a new module in Orange HRM since it is divided in many layers. I will guide you step by step on how to create new module in Orange HRM.

Step 1

First download latest version of Orange HRM. Then extract it, and place it to root directory. Now install the Orange HRM. After the installation is complete, your file folder should look like.

Step 2

Create a folder named orangehrmTestPlugin in plugins folder. Test is name of the plugin, you can change its name. This folder contains the code of the module.

Step 3

Now you have to enable the plugin. Go to Symfony/apps/orangehrm/config/setting.yml. Symfony folder contains the code of OrangeHRM.

Step 4

Now add plugin to admin configure list. This allows admin to easily enable or disable plugin at any time. To do this you need to include your plugin in the database. Open up ‘ohrm_module’ and ‘hs_hr_module’ tables in database and make these changes.

Status ‘1’ in ‘ohrm_module’ shows that this module is enabled.
Now the plugin needs to be included in the database. To add module in code go to ‘symfony\plugins\orangehrmAdminPlugin\lib\form\ModuleForm.php’ and make changes in there.

The admin should make changes in the check box class. Simply add these lines in ‘symfony\plugins\orangehrmAdminPlugin\modules\admin\templates\viewModulesSuccess.php’.

Now delete cache and refresh your browser. Click on Admin ->Configuration ->Modules. Your plugin will be shown there.

Step 5


Create these folders inside your plugin. Lib folder contains dao, form, and service.
Dao (Database Access Object) contains all the database operation (fetch, update, insert and delete).
Form contains forms to get data from user.
Service allows user to call dao operations.
Modules contain your plugin with 2 folders inside (actions and templates).
Actions consist of different classes that will perform actions when user interacts with system.
Default action must have a template file. An action class may have 1 or more template file.
Action file ends with Action.class.php. Templates consist of HTML code for GUI.

Step 6

Now include your plugin on main menu. To do this you need to create screen in your database. Open up ‘`ohrm_screen’ Table and insert line no 105 as shown in figure below.

ViewTestMessage is the file inside actions and templates folder. This is the default class. Whenever user clicks on Test Message execute function inside ViewTestMessageAction.class.php executes. Inside Actions folder, template against this file is viewTestMessageSuccess.php which is executed. You can create 1 or more screens in a plugin, but every screen name must be different from other.
Every screen must have a user which means that specific user can access this screen. Simply add screen id (105) and any user roleid (user role id from ‘ohrm_user_role’ Table) in‘ohrm_user_role_screen’ Table. Also specify what operation can perform this user role. Now time to show TestMessage in main Menu.
Open up ‘ohrm_menu_item’ Table. Insert menu_title as Test Message, screen_id as 105 (created in ‘ohrm_screen’ Table), parent_id as Null (if it is parent itself), level as 1 (2 for sub menu and 3 for 3rd level), order_hint as 800 (100 for most left side, 200 for second place from left, 300 for 3rd place and so on), url_extras as Null, and states as 1 (0 mean don’t show).
Now logout delete cache and login back. You will see Test Message in your main menu bar.

Friday, March 28, 2014

4 Steps to Optimize Your Drupal Site, Increase Traffic

I recently used acquia.com to demonstrate how to increase site traffic on a Drupal website by improving the online marketing. This conversation made me think that I could share some of the key things I do on acquia.com with other Drupal site managers. For starters, SEO, or search engine optimization, is a huge focus for me and there are some great tools in Drupal to help with this.

Step1:
Please start by enabling clean URLs within your system settings. It’s easy. Just a check box.

Step 2:
Now, for a bit more work. I’ve listed out the top 5 modules I suggest putting on your website to help with SEO.

  • Global Redirect

  • This modules does a bunch of things but the important features are that it checks for multiple aliases for 1 URL and 301 redirects them to the correct URL. Drupal by default does not remove the old or original path if you create an alias which can cause duplicate content in search engines and negatively effect your SEO efforts.

  • Page title

  • This module gives you granular control of your browser page title to enhance your ranking on SERPs (search engine result pages) and help your SEO because you will be using rich keywords in those page titles.

  • Meta tags quick (Drupal 7) or Nodewords (Drupal 6)
    The great thing about Drupal is there are many ways to do the same thing, so pick the one that works best for you. I personally like nodewords and meta tags quick as my meta keywords, meta descriptions and canonical tags module. If you go do Drupal.org and search meta data, you will find many others. Pick the one that you like best. This is just a way to get your meta descriptions on your pages.

  • Path auto
    This module automatically generates your page URLs based on content you define. For example, you can pick a content type of blog to always have the URL /blog/[blog title] . This way the user doesn’t have to manually specify a path alias. And if you give your content keyword rich titles, your URLs will also contain those high ranking terms to improve your SEO.

  • XML Sitemap
    This module creates an XML sitemap for search engines to easily find and index pages on your site. This module also allows for you to submit your sitemap to popular search engines.
There are of course many more modules you can add and once you’ve set these up and configured them you may have need for more. A great tool that I use on acquia.com to check what other modules I could be running to help improve SEO is the SEO Grader tool within Acquia Insight.


Step 3:
Now that you have all the base modules for SEO, my suggestion would be to define your targeted keyword list. Update: The Google keyword planner shows the number of searches for a specific term. This can tell you if there is any traffic potential from that keyword if you are able to rank for it.
  • Google Trends – Allows you to see how a keyword has done over the years.
  • WordTracker – Provides dozens of tools to help you find the best keywords.
  • WebCEO – This software has tools for reporting, site audits, keyword research and link building. They have a free version and a paid version. Best for a DIY team.
Once you have used the keyword tools, you should have a list of keywords that will be the focus of your SEO campaign.


Step 4: 
Map your targeted keywords to specific pages. This will give you a better chance to rank for those key terms. Each page should have 1 or 2 targeting keywords. Once your keyword mapping process is done, write page descriptions for each of those targeted pages containing those keywords; create or update page titles in your page title module field; and be sure to update page content to include those targeted keywords.
Search engine algorithms change all the time so you’ll want to make sure you have some type of analytics software enabled to watch your keyword trends and your organic site traffic.
Congratulations! You now have a well optimized Drupal website!
Still need help with Drupal Search Engine Optimization? Check out Acquia Insight and the SEO grader tool or scan your site now with a Free scan of Insight.
With this being my first blog post, I should probably introduce myself, my name is Kate Fogarty and I am the web manager for acquia.com. I have been using Drupal for the past 5 years and bring an interesting mix of design, development and marketing to the marketing team