コード例 #1
0
	function execute($modelParams, $params, $templatePath)
	{
		$thumbProvider = new AriThumbnailProvider('arithumb', null, 'mod_arisexylightbox');
		$data = $thumbProvider->getStoredData($this->getThumbProviderParams($modelParams, $params));
		
		$this->modifyData($data, $params, $modelParams);
		
		if ($modelParams['type'] == 'customtext')
		{
			$cId = uniqid('asb_', false);
			$modelParams['customtemplate'] = '<div id="' . $cId . '" style="cursor: pointer;">' . $modelParams['customtemplate'] . '</div>';
			$document =& JFactory::getDocument();
			$document->addScriptDeclaration(sprintf('jQuery(document).ready(function($){ $("#%1$s").click(function(event) { $("#%1$s").closest(".ari_lightbox_container").find("a[rel^=\'sexylightbox\']").eq(0).click(); }); });',
				$cId));			
		}

		parent::execute(
			$data, 
			array(
				'simpleGallery' => ASEXYBOX_SIMPLEGALLERYTEMPLATE,
				'singleGallery' => ASEXYBOX_SINGLEIMAGEGALLERYTEMPLATE,
				'hiddenItems' => ASEXYBOX_HIDDENITEMSTEMPLATE,
				'slickGallery' => ASEXYBOX_SLICKGALLERYTEMPLATE),
			$modelParams,
			$params,
			$templatePath);
	}
コード例 #2
0
	function execute($modelParams, $params, $templatePath)
	{
		if (!$this->checkCompatibility())
			return ;
		
		$picasaProvider = new AriPicasaProvider($modelParams, null, 'mod_arisexylightbox');
		
		if ($modelParams['type'] == 'customtext')
		{
			$cId = uniqid('asb_', false);
			$modelParams['customtemplate'] = '<div id="' . $cId . '" style="cursor: pointer;">' . $modelParams['customtemplate'] . '</div>';
			$document =& JFactory::getDocument();
			$document->addScriptDeclaration(sprintf('jQuery(document).ready(function($){ $("#%1$s").click(function(event) { $("#%1$s").closest(".ari_lightbox_container").find("a[rel^=\'sexylightbox\']").eq(0).click(); }); });',
				$cId));			
		}
		
		$picasaData = $picasaProvider->getData($modelParams);
		if ($picasaProvider->getError())
		{
			echo '<div style="color: red; font-weight: bold;font-size:18px;">ARI Sexy Lightbox: ' . $picasaProvider->getError() . '</div>';
			return ;
		}

		parent::execute(
			$this->getData(
				$picasaData,
				$modelParams, 
				$params), 
			array(
				'simpleGallery' => ASEXYBOX_SIMPLEGALLERYTEMPLATE,
				'singleGallery' => ASEXYBOX_SINGLEIMAGEGALLERYTEMPLATE,
				'hiddenItems' => ASEXYBOX_HIDDENITEMSTEMPLATE,
				'slickGallery' => ASEXYBOX_SLICKGALLERYTEMPLATE),
			$modelParams,
			$params,
			$templatePath);
	}
コード例 #3
0
	function execute($modelParams, $params, $templatePath)
	{
		$flickrProvider = new AriFlickrProvider($modelParams, null, 'mod_arisexylightbox');
		$flickrData = $this->getData(
			$flickrProvider->getData($modelParams),
			$modelParams, 
			$params);
		
		if ($modelParams['type'] == 'customtext')
		{
			$cId = uniqid('asb_', false);
			$modelParams['customtemplate'] = '<div id="' . $cId . '" style="cursor: pointer;">' . $modelParams['customtemplate'] . '</div>';
			$document =& JFactory::getDocument();
			$document->addScriptDeclaration(sprintf('jQuery(document).ready(function($){ $("#%1$s").click(function(event) { $("#%1$s").closest(".ari_lightbox_container").find("a[rel^=\'sexylightbox\']").eq(0).click(); }); });',
				$cId));			
		} 
		else if ($modelParams['type'] == 'flickrimage')
		{
			$photoId = $modelParams['flickrimage']['photoId'];
			$photo = AriUtils::getParam($flickrData['photos'], $photoId);
			$repeater = new AriRepeaterWebControl(ASEXYBOX_SINGLEIMAGEGALLERYTEMPLATE, $flickrData['photos']);

			AriTemplate::display(
				$templatePath . 'flickrimage.html.php', 
				array(
					'repeater' => $repeater, 
					'template' => AriSimpleTemplate::parse($modelParams['flickrimage']['template'], array('data' => $photo))
				)
			);
			return ;
		}
		else if ($modelParams['type'] == 'flickrphotosets')
		{
			$captionTemplate = AriUtils2::getParam($modelParams, 'caption', '{$Title}');
			$needParseTemplate = strpos($captionTemplate, '{$') !== false;
			
			$firstPhotosetsPhoto = array();
			$photosetsPhoto = array();
			$modal = AriUtils2::parseValueBySample($params['_default']['modal'], false);
			
			foreach ($flickrData['photos'] as $dataItem)
			{
				$photosetId = $dataItem['photosetId'];
				$title = $needParseTemplate
					? AriSimpleTemplate::parse($captionTemplate, $dataItem, true)
					: $captionTemplate;
				if (!isset($firstPhotosetsPhoto[$photosetId]))
				{
					$photoset = AriUtils2::getParam($flickrData['photosets'], $photosetId);
					$aAttrs = array('href' => $dataItem['imgUrl'] . ($modal ? '?modal=1' : ''), 'rel' => 'sexylightbox[ps_' . $photosetId . ']', 'title' => $title);
					$imgAttrs = array('src' => $dataItem['thumbUrl'], 'border' => '0', 'alt' => $dataItem['Title']);
					$dataItem['Caption'] = AriUtils2::getParam($photoset, 'title', '');
					$dataItem['sexyimage'] = sprintf('<a%1$s><img%2$s/></a>',
						AriHtmlHelper::getAttrStr($aAttrs),
						AriHtmlHelper::getAttrStr($imgAttrs));
					$firstPhotosetsPhoto[$photosetId] = $dataItem;
				}
				else
				{
					$aAttrs = array('href' => $dataItem['imgUrl'] . ($modal ? '?modal=1' : ''), 'rel' => 'sexylightbox[ps_' . $photosetId . ']', 'title' => $title);
					$dataItem['sexyimage'] = sprintf('<a%1$s></a>',
						AriHtmlHelper::getAttrStr($aAttrs));
					$photosetsPhoto[] = $dataItem;
				}
			}
			
			$showTitle = (bool)$modelParams['flickrphotosets']['showTitle'];
			$rptParams = $modelParams['flickrphotosets'];
			$rptParams['GalleryCaption'] = $showTitle ? '{$data:Caption}' : '';
			$repeater = new AriRepeaterWebControl(
				AriSimpleTemplate::parse(
					ASEXYBOX_SIMPLEGALLERYTEMPLATE,
					$rptParams
				), $firstPhotosetsPhoto);
			AriTemplate::display(
				$templatePath . 'flickrphotosets.html.php', 
				array(
					'repeater' => $repeater,
					'photos' => $photosetsPhoto
				)
			);
			return ;
		}
		
		parent::execute(
			$flickrData['photos'], 
			array(
				'simpleGallery' => ASEXYBOX_SIMPLEGALLERYTEMPLATE,
				'singleGallery' => ASEXYBOX_SINGLEIMAGEGALLERYTEMPLATE,
				'hiddenItems' => ASEXYBOX_HIDDENITEMSTEMPLATE,
				'slickGallery' => ASEXYBOX_SLICKGALLERYTEMPLATE),
			$modelParams,
			$params,
			$templatePath);
	}