Your IP : 216.73.216.55


Current Path : /home/g/i/t/giteleslfp/www/administrator/components/com_templateck/views/browse/tmpl/
Upload File :
Current File : /home/g/i/t/giteleslfp/www/administrator/components/com_templateck/views/browse/tmpl/default.php

<?php
/**
 * @name		Template Creator CK
 * @package		com_templateck
 * @copyright	Copyright (C) 2013. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 * @author		Cedric Keiflin - http://www.template-creator.com - http://www.joomlack.fr
 */

defined('TCK_LOADED') or die;
$imagespath = TEMPLATECREATORCK_MEDIA_URI . '/images/';
JHtml::_('jquery.framework');
$doc = JFactory::getDocument();
$doc->addStylesheet(TEMPLATECREATORCK_MEDIA_URI . '/assets/ckbrowse.css');
$doc->addScript(TEMPLATECREATORCK_MEDIA_URI . '/assets/ckbrowse.js');
$input = JFactory::getApplication()->input;

$returnFunc = $input->get('func', 'ckSelectFile', 'cmd');
$returnField = $input->get('field', '', 'string');
$type = $input->get('type', 'image', 'string');

switch ($type) {
	case 'video' :
		$fileicon = 'file_video.png';
		break;
	case 'audio' :
		$fileicon = 'file_audio.png';
		break;
	case 'image' :
	default :
		$fileicon = 'file_image.png';
		break;
}
?>

<div id="maincktabcontent">
	<div class="mainmenulink menulink current" tab="tab_files"><h3><?php echo JText::_('CK_FILES'); ?></h3></div>
	<div class="mainmenulink menulink" tab="tab_pixabay"><h3><?php echo JText::_('Pixabay'); ?></h3></div>
	<div class="clr"></div>

	<div class="maintab current" id="tab_files">

<?php /* --- Start image browser ---*/ ?>

<div id="ckbrowse" class="clearfix">
<div id="ckfolderupload">
	<div class="inner">
		<div class="upload">
			<h2 class="uploadinstructions"><?php echo TCK_Text::_( 'Drop files here to upload' ); ?></h2>
			<p><?php echo TCK_Text::_( 'or Select Files' ); ?></p><input id="tck_file_upload" type="file" class="" />
		</div>
		<?php
		// $max_upload_size = wp_max_upload_size();
		// if ( ! $max_upload_size ) {
			// $max_upload_size = 0;
		// }
		?>

		<p class="max-upload-size"><?php
			// printf( __( 'Maximum upload file size: %s.' ), esc_html( size_format( $max_upload_size ) ) );
		?></p>
	</div>
</div>
<div id="ckfoldertreelist">
<p><?php echo TCK_Text::_('CK_BROWSE_INFOS') ?></p>
<?php
$lastitem = 0;
foreach ($this->items as $i => $folder) {
	$submenustyle = '';
	$folderclass = '';
	if ($folder->level == 1) {
		$submenustyle = 'display: block;';
		$folderclass = 'ckcurrent';
	}
	?>
	<div class="ckfoldertree <?php echo $folderclass ?> <?php echo ($folder->deeper ? 'parent' : '') ?> <?php echo (count($folder->files) ? 'hasfiles' : '') ?>" data-level="<?php echo $folder->level ?>" data-path="<?php echo utf8_encode($folder->basepath) ?>">
		<?php if ($folder->level > 1) { ?><div class="ckfoldertreetoggler" onclick="ckToggleTreeSub(this)"></div><?php } ?>
		<div class="ckfoldertreename" onclick="ckShowFiles(this)"><img src="<?php echo $imagespath ?>folder.png" /><?php echo utf8_encode($folder->name); ?></div>
		<div class="ckfoldertreecount"><?php echo count($folder->files); ?></div>
		<div class="ckfoldertreefiles">
		<?php foreach ($folder->files as $j => $file) {
			$thumb = ($type == 'video') ? JUri::root(true)  . '/administrator/components/com_templateck/images/file_video.png' : JUri::root(true) . '/' . utf8_encode($folder->basepath) . '/' . utf8_encode($file);
		?>
			<div class="ckfoldertreefile ckwait" data-type="<?php echo $type ?>" onclick="ckSelectFile(this)" data-path="<?php echo utf8_encode($folder->basepath) ?>" data-filename="<?php echo utf8_encode($file) ?>"><div class="ckfakeimage" data-src="<?php echo $thumb; ?>" title="<?php echo utf8_encode($file); ?>" ></div></div>
		<?php } ?>
		</div>

	<?php
		if ($folder->deeper)
		{
			echo '<div class="cksubfolder" style="' . $submenustyle . '">';
		}
		elseif ($folder->shallower)
		{
			// The next item is shallower.
			echo '</div>'; // close ckfoldertree
			echo str_repeat('</div></div>', $folder->level_diff); // close cksubfolder + ckfoldertree
		} 
		else
		{
			// The next item is on the same level.
			echo '</div>'; // close ckfoldertree
		}
}

?>
</div>
<div id="ckfoldertreepreview">
	<div class="inner">
		<?php if ($type == 'image') { ?>
		<div id="ckfoldertreepreviewimage">
		</div>
		<?php } ?>
	</div>
</div>

</div>
	
	<?php /*--- End of images browser ---*/ ?>
	
	</div>

	<div class="maintab" id="tab_pixabay">
		<?php
		require_once TEMPLATECREATORCK_PATH . '/views/pixabay/tmpl/default.php';
		?>
	</div>
</div>
<script>
var $ck = window.$ck || jQuery.noConflict();
var URIROOT = window.URIROOT || '<?php echo JUri::root(true) ?>';
var cktoken = '<?php echo JSession::getFormToken() ?>';

function ckToggleTreeSub(btn) {
	var item = $ck(btn).parent();
	if (item.hasClass('ckopened')) {
		item.removeClass('ckopened');
	} else {
		item.addClass('ckopened')
		// item.find('> .cksubfolder, > .ckfoldertreefiles').css('opacity','0').animate({'opacity': '1'}, 300);
	}
}

function ckShowFiles(btn) {
	// show the image in place of divs
	var fakeImages = $ck(btn).find('~ .ckfoldertreefiles .ckfakeimage');
	if (fakeImages.length) {
		fakeImages.each(function() {
			$fakeImage = $ck(this);
			$fakeImage.after('<img src="' + $fakeImage.attr('data-src') + '" title="' + $fakeImage.attr('title') + '" />');
			$fakeImage.parent().removeClass('ckwait');
			$fakeImage.remove();
		});
	}
	// set the current state on the folder
	var item = $ck(btn).parent();
	$ck('.ckcurrent').not(btn).removeClass('ckcurrent');
	if (item.hasClass('ckcurrent')) {
		item.removeClass('ckcurrent');
	} else {
		item.addClass('ckcurrent')
	}
}

function ckSelectFile(btn) {
	try {
		if (typeof(window.parent.<?php echo $returnFunc ?>) != 'undefined') {
			window.parent.<?php echo $returnFunc ?>($ck(btn).attr('data-path') + '/' + $ck(btn).attr('data-filename'), '<?php echo $returnField ?>');
			if (typeof(window.parent.CKBox) != 'undefined') window.parent.ckCloseMediaManager();
		} else {
			alert('ERROR : The function <?php echo $returnFunc ?> is missing in the parent window. Please contact the developer');
		}
	}
	catch(err) {
		alert('ERROR : ' + err.message + '. Please contact the developper.');
	}
}

// display the images in the root folder
ckShowFiles($ck('.ckfoldertreename').first()[0]);

$ck('#maincktabcontent div.maintab:not(.current)').hide();
$ck('.mainmenulink', $ck('#maincktabcontent')).each(function(i, tab) {
	$ck(tab).click(function() {
		if ($ck('#popup_favoriteck').length) {
			ckCloseFavoritePopup(true);
		}
		$ck('#maincktabcontent div.maintab').hide();
		$ck('.mainmenulink', $ck('#maincktabcontent')).removeClass('current');
		if ($ck('#' + $ck(tab).attr('tab')).length)
			$ck('#' + $ck(tab).attr('tab')).show();
		$ck(this).addClass('current');
	});
});
</script>