<?php defined('SYSPATH') or die('No direct access allowed.');

/**
 * This is class helps with rendering JPGraph images.
 *
 * @package    lnApp
 * @subpackage JPGraph
 * @category   Helpers
 * @author     Deon George
 * @copyright  (c) 2010 Deon George
 * @license    http://dev.leenooks.net/license.html
 */
abstract class lnApp_JPGraph {
	public function __construct() {
		// JPGraph should be installed in a our includes dir
		$jpgraph = DOCROOT.'includes/jpgraph/src';

        if (! file_exists($jpgraph.'/jpgraph_gantt.php'))
            throw new Kohana_Exception('jpgraph_gantt.php must be installed in '.$jpgraph);

		if (! function_exists('imagetypes') && ! function_exists('imagecreatefromstring'))
            throw new Kohana_Exception('It seems that GD support is not available. Please add GD support to your PHP configuration.');

		require_once($jpgraph.'/jpgraph.php');

		return $jpgraph;
	}
}
?>