<?php
/**
 * Library required for Auto Generate Product, Order and Affiliate Id to show 
 * @author Himel Nag Rana
 */
class Application_Utility
{
	
	function Application_Utility()
	{
		
	}

	/**
	 * This method is a generic method, used to generate Ids with Padding 
	 * @author Himel Nag Rana
	 * @param $prefix
	 * @param $id
	 * @return $generated_id
	 * @version PWC 1.2
	 */
	function generateId($prefix,$id)
	{
		$get_instance = &get_instance();
		$pad_length = $get_instance->config->item('pad_length'); 											 
		$pad_string = $get_instance->config->item('pad_string');
		$pad_type = $get_instance->config->item('pad_type');

        if($prefix)
        {
            $generated_id = $prefix.'-'.str_pad($id,$pad_length,$pad_string,$pad_type);
        }
        else
        {
            $generated_id = str_pad($id,$pad_length,$pad_string,$pad_type);
        }
		return $generated_id;
	}
}
?>