<?php
/**
 * @package		Joomla Bamboo Zen Grid Framework
 * @Type        Core Framework Files
 * @version		v1.0
 * @author		Joomal Bamboo http://www.joomlabamboo.com
 * @copyright 	Copyright (C) 2007 - 2010 Joomla Bamboo
 * @license		http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
 */
// Check to ensure this file is within the rest of the framework
defined('JPATH_BASE') or die();
/**
 * Renders a editors element
 *
 * @package 	Joomla.Framework
 * @subpackage		Parameter
 * @since		1.5
 */
class JElementJboverview extends JElement
{
	/**
	* Element name
	*
	* @access	protected
	* @var		string
	*/
	var	$_name = 'Jboverview';
	function fetchElement($name, $value, &$node, $control_name)
	{
		global $mainframe;
		require_once('zengrid.php');
		$logopath = str_replace('\\', '/', JPATH_ROOT.Zengrid::getParam('logoLocation').DS);
		$logo = false;
		$controlMainArea = Zengrid::getParam('controlMainArea');
		if (is_dir($logopath)) {
			$logodir = opendir($logopath);
			while (($file = readdir($logodir)) !== false) {
        	    if ($file == Zengrid::getParam('logoFile')) $logo = true;
			}
			closedir($logodir);
        }
		if (!$logo) JError::raiseNotice('400', JText::_('ZENLOGODOESNOTEXIST').JText::_('ZENPLEASEUPDATEYOUR').'<a href="#" onclick="accordion.display(3)">'.JText::_('ZENLOGOSETTINGS').'</a>');
		$manifest = Zengrid::getManifest();
		$style = Zengrid::getParam('style');
		$path = JPATH_ROOT.DS.'templates'.DS.Zengrid::getTemplate().DS.'layout'.DS;
		$override['banner'] = JText::_('ZENBANNER');
		$override['bottom'] = JText::_('ZENBOTTOM');
		$override['closeContainer'] = JText::_('ZENCLOSECONTAINER');
		$override['footer'] = JText::_('ZENFOOTER');
		$override['grid1'] = JText::_('ZENGRID1');
		$override['grid2'] = JText::_('ZENGRID2');
		$override['grid3'] = JText::_('ZENGRID3');
		$override['grid4'] = JText::_('ZENGRID4');
		$override['grid5'] = JText::_('ZENGRID5');
		$override['grid6'] = JText::_('ZENGRID6');
		$override['header'] = JText::_('ZENHEADER');
		$override['index'] = JText::_('ZENENTIREINDEX');
		$override['main'] = JText::_('ZENMAINCONTENT');
		$override['nav'] = JText::_('ZENNAVIGATION');
		$override['openContainer'] = JText::_('ZENOPENINGCONTAINER');
		$override['panel'] = JText::_('ZENPANEL');
		$override['top'] = JText::_('ZENTOP');
		$override_check = JText::_('ZENTHEREARENOOVERRIDESAFFECTINGYOURTEMPLATE');
		foreach ($override as $name => $label) {
			if(file_exists($path.$name.".php")) { 
				$override_check = '<li>'.JText::_('ZENYOURTEMPLATEHASACTIVEOVERRIDES').'&nbsp;'.JText::_('ZENPLEASEVIEWTHEACTIVEOVERRIDES').'<a href="#" onclick="accordion.display(18)">'.JText::_('ZENHERE').'</a></li>';
			}
		}
		if ($controlMainArea) {
			$mainAreaWarning = "<li>".JText::_('ZENPLEASENOTETHATYOURMAINCONTENTAREAISHIDDENONTHEFRONTPAGE').'&nbsp;'.JText::_('ZENYOUCANCHANGETHATSETTING')."<a href='#' onclick='accordion.display(5)'>".JText::_('ZENHERE')."</a></li>";
		}
		else $mainAreaWarning = "";
		$html = '<h3 class="toggler atStart"></h3><div class="element atStart"></div>';
		$html .= '<div class="intro">';
		$html .= '<div class="jbTemplateOverview"><a href="http://www.joomlabamboo.com"><img src="'.JURI::root(true).'/templates/'.Zengrid::getTemplate().'/templateTeaser.jpg" alt="joomla Bamboo" class="zgfTeaser" /></a></div><div class="clear"></div>' . $manifest->description . '</div>';
		$html .= '<div class="templateDetails"><h3 class="intro">Overview</h3><ul id="zgf_overview">';
		$html .= '<li><strong>'.JText::_('ZENTEMPLATEVERSION').'&nbsp;</strong> ' . $manifest->version . '</li>';
		$html .= '<li><strong>'.JText::_('ZENCURRENTLOGOLOCATION').'&nbsp;</strong> ' . Zengrid::getParam('logoLocation') . '/' . Zengrid::getParam('logoFile') . '</li>';
		$html .= '<br />' . $override_check . '';
		if ($controlMainArea ="1") {
			$html .= ''. $mainAreaWarning.'<br />';
		}
		$html .= '</ul>';
		$html .= '</div>';
		return $html;
	}
	function fetchTooltip($label, $description, &$xmlElement, $control_name='', $name='') {
		return false;
	}
}
?>
