%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home/lightco1/www/administrator/components/com_virtuemart/views/media/
Upload File :
Create Path :
Current File : /home/lightco1/www/administrator/components/com_virtuemart/views/media/view.json.php

<?php
/**
*
* Description
*
* @package	VirtueMart
* @subpackage
* @author  Patrick Kohl
* @link http://www.virtuemart.net
* @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* @version $Id: view.html.php 3006 2011-04-08 13:16:08Z Milbo $
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

// Load the view framework
if(!class_exists('VmViewAdmin'))require(VMPATH_ADMIN.DS.'helpers'.DS.'vmviewadmin.php');

/**
 * Json View class for the VirtueMart Component
 *
 * @package		VirtueMart
 * @author  Patrick Kohl
 */
class VirtuemartViewMedia extends VmViewAdmin {

	/* json object */
	private $json = null;

	function display($tpl = null) {
		$document =JFactory::getDocument();
		$document->setMimeEncoding( 'application/json' );

		if ($virtuemart_media_id = vRequest::getInt('virtuemart_media_id')) {
			//JResponse::setHeader( 'Content-Disposition', 'attachment; filename="media'.$virtuemart_media_id.'.json"' );

			$model = VmModel::getModel('Media');
			$image = $model->createMediaByIds($virtuemart_media_id);
// 			echo '<pre>'.print_r($image,1).'</pre>';
			$this->json = $image[0];
			//echo json_encode($this->json);
			if (isset($this->json->file_url)) {
				$this->json->file_root = JURI::root(true).'/';
				$this->json->msg =  'OK';
				echo vmJsApi::safe_json_encode($this->json);
			} else {
				$this->json->msg =  '<b>'.vmText::_('COM_VIRTUEMART_NO_IMAGE_SET').'</b>';
				echo @json_encode($this->json);
			}
		}
		else {
			if (!class_exists('VmMediaHandler')) require(VMPATH_ADMIN.DS.'helpers'.DS.'mediahandler.php');
			$start = vRequest::getInt('start',0);

			$type = vRequest::getCmd('mediatype',0);
			$list = VmMediaHandler::displayImages($type,$start );
			echo vmJsApi::safe_json_encode($list);
		}

		jExit();
	}


}
// pure php no closing tag

Zerion Mini Shell 1.0