/** * * display some view */ public function display($cachable = false, $urlparams = false) { $urlAssets = GlobalsUniteHCar::$urlAssets; $isJoomla3 = UniteFunctionsHCar::isJoomla3(); if ($isJoomla3) { JHtml::_('bootstrap.framework'); } //add style $document = JFactory::getDocument(); $document->addStyleSheet($urlAssets . "style.css"); //add jquery //$document->addScript("http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"); //add jquery ui //$document->addScript("http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"); $document->addStyleSheet($urlAssets . "jui/jquery-ui-1.8.19.custom.css"); //add custom scripts if ($isJoomla3 == false) { $document->addScript($urlAssets . "jquery.min.js"); } $document->addScript($urlAssets . "jquery-ui.min.js"); $document->addScript($urlAssets . "admin.js"); $document->addScript($urlAssets . "hcarousel.js"); //add ajax url: $currentView = JRequest::getVar('view', $this->default_view); $ajaxUrl = UniteFunctionJoomlaHCar::getViewUrl($currentView, "ajax"); $document->addScriptDeclaration("var g_urlAjax='{$ajaxUrl}';"); if ($isJoomla3) { $document->addStyleSheet($urlAssets . "style-joomla3.css?app=hcarousel"); } parent::display(); return $this; }
function bind($array, $ignore = '') { $array["visual"] = UniteFunctionJoomlaHCar::encodeArrayToRegistry($array, "visual"); $array["params"] = UniteFunctionJoomlaHCar::encodeArrayToRegistry($array, "params"); if (empty($array['alias'])) { $array['alias'] = $array['title']; } $array['alias'] = UniteFunctionJoomlaHCar::normalizeAlias($array['alias']); return parent::bind($array, $ignore); }
/** * * set image style and preview url */ private function setImage() { //get slider id if (!empty($this->item->id)) { $sliderID = $this->item->sliderid; } else { $sliderID = JRequest::getVar("sliderid"); } $slider = HelperUniteHCar::getSlider($sliderID); $params = $slider["params"]; $imageHeight = $params->get("image_height", 100); $imageWidth = $params->get("image_width", 150); $this->slider = $slider; //put image if ($this->isEmpty == false) { $filenameImage = $this->params->get("image"); $this->urlPreview = UniteFunctionJoomlaHCar::getImageOutputUrl($filenameImage, $imageWidth, $imageHeight, true); } else { $this->imagePreviewStyle = "style='display:none;'"; } //add image pattern to js $pattern = UniteFunctionJoomlaHCar::getImageOutputUrl("IMAGE_PLACE", $imageWidth, $imageHeight, true, false); UniteFunctionJoomlaHCar::addScriptDeclaration("var g_imagePattern='{$pattern}';"); }
/** * * add submenu */ public static function addSubmenu($currentView, $currentLayout) { switch ($currentView) { default: case GlobalsUniteHCar::VIEW_SLIDER: $sliderID = JRequest::getVar("id"); $isNew = empty($sliderID); //disable the menu on new slider if ($isNew == true) { return false; } $viewSliderSettings = UniteFunctionJoomlaHCar::getViewUrl(GlobalsUniteHCar::VIEW_SLIDER, GlobalsUniteHCar::LAYOUT_SLIDER_GENERAL, "id=" . $sliderID); $viewSliderVisual = UniteFunctionJoomlaHCar::getViewUrl(GlobalsUniteHCar::VIEW_SLIDER, GlobalsUniteHCar::LAYOUT_SLIDER_VISUAL, "id=" . $sliderID); $viewSlides = UniteFunctionJoomlaHCar::getViewUrl(GlobalsUniteHCar::VIEW_ITEMS, "", "id=" . $sliderID); //slider settings: $selectedGeneral = $currentView == GlobalsUniteHCar::VIEW_SLIDER && $currentLayout == GlobalsUniteHCar::LAYOUT_SLIDER_GENERAL; $selectedVisual = $currentView == GlobalsUniteHCar::VIEW_SLIDER && $currentLayout == GlobalsUniteHCar::LAYOUT_SLIDER_VISUAL; $selectedSlides = $currentView == GlobalsUniteHCar::VIEW_ITEMS; JSubMenuHelper::addEntry(JText::_('COM_UNITEHCAROUSEL_GENERAL_SETTINGS'), $viewSliderSettings, $selectedGeneral); JSubMenuHelper::addEntry(JText::_('COM_UNITEHCAROUSEL_VISUAL_SETTINGS'), $viewSliderVisual, $selectedVisual); JSubMenuHelper::addEntry(JText::_('COM_UNITEHCAROUSEL_SLIDES'), $viewSlides, $selectedSlides); break; case GlobalsUniteHCar::VIEW_SLIDERS: //don't show menu at all. break; } }
/** * * output the slides */ private function putSlides() { $imageWidth = $this->params->get("image_width", 150); $imageHeight = (int) $this->params->get("image_height"); foreach ($this->arrSlides as $slide) { $slideParams = $slide["params"]; $slideImage = $slideParams->get("image"); $activateLink = trim($slideParams->get("activate_link", "no")); $openIn = $slideParams->get("link_open_in", "new"); $htmlTarget = $openIn == "new" ? 'target="_blank"' : ''; $link = $slideParams->get("link", "javascript:void(0)"); $urlImageReized = UniteFunctionJoomlaHCar::getImageOutputUrl($slideImage, $imageWidth, $imageHeight, true); ?> <li> <?php if ($activateLink == "yes") { ?> <a href='<?php echo $link; ?> ' <?php echo $htmlTarget; ?> > <?php } ?> <img width="<?php echo $imageWidth; ?> " alt="slide image" height="<?php echo $imageHeight; ?> " src="<?php echo $urlImageReized; ?> " /> <?php if ($activateLink == "yes") { ?> </a> <?php } ?> </li> <?php } }
//$user->authorise('core.create', 'com_contact.category.'.$item->catid); $canEdit = true; //$user->authorise('core.edit', 'com_contact.category.'.$item->catid); $canCheckin = true; //$user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0; $canEditOwn = true; //$user->authorise('core.edit.own', 'com_contact.category.'.$item->catid) && $item->created_by == $userId; $canChange = true; //$user->authorise('core.edit.state', 'com_contact.category.'.$item->catid) && $canCheckin; //get params $params = new JRegistry(); $params->loadString($item->params, "json"); $urlRoot = JURI::root(); //get image url's: $image = $params->get("image"); $thumbUrl = UniteFunctionJoomlaHCar::getImageOutputUrl($image, 200, 100, true); $imageUrl = $urlRoot . $image; $img_file = pathinfo($imageUrl, PATHINFO_BASENAME); $itemTitle = $item->title . " ({$img_file})"; ?> <tr class="row<?php echo $i % 2; ?> "> <td class="center"> <?php echo JHtml::_('grid.id', $i, $item->id); ?> </td> <td> <?php
<?php /** * @package Unite Horizontal Carousel for Joomla 1.7-2.5 * @version 1.0.0 * @author UniteCMS.net * @copyright (C) 2012- Unite CMS * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html * */ // no direct access defined('_JEXEC') or die('Restricted access'); $currentDir = dirname(__FILE__) . "/"; require_once $currentDir . "helpers/globals.class.php"; require_once $currentDir . "helpers/helper.class.php"; require_once $currentDir . "helpers/output.class.php"; require_once $currentDir . "unitejoomla/includes.php"; $isJoomla3 = UniteFunctionsHCar::isJoomla3(); if ($isJoomla3) { require_once dirname(__FILE__) . "/models/model_joomla3.php"; } else { //joomla 2.5 require_once dirname(__FILE__) . "/models/model_joomla2.php"; } //init the globals GlobalsUniteHCar::init(); UniteFunctionJoomlaHCar::$componentName = GlobalsUniteHCar::COMPONENT_NAME;
} else { $boxTitle = JText::_('COM_UNITEHCAROUSEL_SLIDER_SETTINGS'); } ?> <div class="width-60 fltlft"> <?php UniteFunctionJoomlaHCar::putHtmlFieldsetBox($this->form, "general", $boxTitle); ?> <?php if ($this->isNew == false) { ?> <a href="<?php echo $this->linkEditSlides; ?> " id="button_edit_slides_general" class="button-primary">Edit Slides</a> <?php } ?> </div> <div class="width-40 fltrt"> <?php UniteFunctionJoomlaHCar::putHtmlFieldsetBoxes($this->form, "params"); ?> </div> <div class="clr"></div>
/** * show some image */ public function showimage() { UniteFunctionJoomlaHCar::showImageFromRequest(); exit; }
/** * * get post or get application */ public static function getPostGetVar($name, $default = "", $filter = "STRING") { if (empty(self::$app)) { self::$app = JFactory::getApplication(); } $jinput = self::$app->input; $var = $jinput->get($name, $default, $filter); return $var; }