Your IP : 216.73.216.240


Current Path : /home/juvelize/www/plugins/content/uyguntabs/uyguntabs/includes/elements/
Upload File :
Current File : /home/juvelize/www/plugins/content/uyguntabs/uyguntabs/includes/elements/template.php

<?php
// Uyguntabs Copyright 2012
// Version 1.0
// GNU GPL based on Tabs and Sliders joomlaworks.net

// no direct access
defined('_JEXEC') or die('Restricted access');

	jimport('joomla.form.formfield');
	class JFormFieldTemplate extends JFormField {

		var	$type = 'template';

		function getInput(){
			return JElementTemplate::fetchElement($this->name, $this->value, $this->element, $this->options['control']);
		}

	}


jimport('joomla.html.parameter.element');

class JElementTemplate{

	var $_name = 'template';

	function fetchElement($name, $value, & $node, $control_name) {

		jimport('joomla.filesystem.folder');
		$mainframe = &JFactory::getApplication();
		$fieldName = $name : $control_name.'['.$name.']';

		$pluginTemplatesPath = JPATH_SITE.'/plugins'.'/content'.'/uyguntabs'.'/uyguntabs'.'/tmpl';

		$pluginTemplatesFolders = file_get_contents($pluginTemplatesPath);
		
		$db =& JFactory::getDBO();
			$query = "SELECT template FROM #__template_styles WHERE client_id = 0 AND home = 1";

		
		$db->setQuery($query);
		$template = $db->loadResult();
		$templatePath = JPATH_SITE.'/templates'.$template.'/html'.'/uyguntabs';
		
		if (JFolder::exists($templatePath)){
			$templateFolders = JFolder::folders($templatePath);
			$folders = @array_merge($templateFolders, $pluginTemplatesFolders);
			$folders = @array_unique($folders);
		} else {
			$folders = $pluginTemplatesFolders;
		}

		sort($folders);

		$options = array();
		foreach($folders as $folder) {
			$options[] = JHTML::_('select.option', $folder, $folder);
		}

		return JHTML::_('select.genericlist', $options, $fieldName, 'class="inputbox"', 'value', 'text', $value);
	}

}