/** * * get slider id */ private function setRedirectToSlides() { $data = JRequest::getVar('jform', array(), 'post', 'array'); $sliderID = $data["sliderid"]; $redirectUrl = HelperUniteHCar::getViewUrl_Items($sliderID); $this->setRedirect($redirectUrl); }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { // Load the modal behavior script. JHtml::_('behavior.modal', 'a.modal'); // Build the script. $script = array(); $script[] = ' function onArrowsSelect(data){'; $script[] = ' UniteAdmin.onArrowsChange(data);'; $script[] = ' SqueezeBox.close();'; $script[] = ' }'; // Add the script to the document head. JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); // Setup variables for display. $html = array(); $link = 'index.php?option=' . GlobalsUniteHCar::COMPONENT_NAME . '&view=slider&layout=arrows&tmpl=component&settingid=' . $this->id; $buttonType = $this->value; $arrArrowSet = HelperUniteHCar::getArrowSet($buttonType); $arrowName = $arrArrowSet["name"]; $html[] = '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . $this->value . '" />'; $buttonID = $this->id . "-btn"; $desc = UniteFunctionsHCar::getVal($this->element, "description"); // The the arrow $imageArrow = $arrArrowSet["url_right"]; $html[] = '<span class="chooser-image-wrapper"><img id="' . $this->id . '-img" title="' . $arrowName . '" src="' . $imageArrow . '"></span>'; //put select button $html[] = ' <a id="' . $buttonID . '" class="modal button-secondary button-chooser" href="' . $link . '&' . JSession::getFormToken() . '=1" rel="{handler: \'iframe\', size: {x: 900, y: 450}}">Change</a>'; $html = implode("\n", $html); return $html; }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { //get script declaration HelperUniteHCar::addScript("farbtastic/farbtastic.js"); HelperUniteHCar::addStylesheet("farbtastic/farbtastic.css"); // Initialize some field attributes. $size = $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; $maxLength = $this->element['maxlength'] ? ' maxlength="' . (int) $this->element['maxlength'] . '"' : ''; $class = ' class="color-picker"'; $readonly = (string) $this->element['readonly'] == 'true' ? ' readonly="readonly"' : ''; $disabled = (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : ''; // Initialize JavaScript field attributes. $onchange = $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : ''; return '<input type="text" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"' . $class . $size . $disabled . $readonly . $onchange . $maxLength . '/>'; return $html; }
/** * the main disply function */ public function display($tpl = null) { // Initialiase variables. $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); $this->isNew = $this->item->id == 0; if ($this->_layout == "default" || $this->_layout == "edit") { if ($this->isNew == false) { $this->linkEditSlides = HelperUniteHCar::getViewUrl_Items($this->item->id); } } // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } $this->addToolbar(); parent::display($tpl); }
protected function addToolbar() { //$sliderTitle = $this->arrSliders[$this->sliderID]["title"]; $arrSlider = HelperUniteHCar::getSlider($this->sliderID); $sliderTitle = $arrSlider["title"]; $title = JText::_('COM_UNITEHCAROUSEL') . " - " . $sliderTitle . " - "; $title .= "<small>[" . JText::_('COM_UNITEHCAROUSEL_SLIDES') . "]</small>"; JToolBarHelper::title($title, 'generic.png'); $numSliders = count($this->arrSliders); if ($numSliders > 0) { JToolBarHelper::addNew('items.add', 'JTOOLBAR_NEW'); JToolBarHelper::deleteList('', 'items.delete', 'JTOOLBAR_DELETE'); JToolBarHelper::divider(); JToolBarHelper::custom('items.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::custom('items.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true); JToolBarHelper::divider(); JToolBarHelper::cancel('slider.cancel', 'JTOOLBAR_CLOSE'); //JToolBarHelper::divider(); //JToolBarHelper::preferences('com_unitehcarousel', 300, 600); } }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { $this->requireFramework(); $arrSliders = HelperUniteHCar::getArrSliders(); $html = "<select id='{$this->id}_id' name='{$this->name}'>"; foreach ($arrSliders as $slider) { $title = $slider["title"]; $id = $slider["id"]; $selected = ""; $selectedID = $this->value; if (empty($selectedID)) { $selectedID = JRequest::getVar("sliderid"); } if ($id == $selectedID) { $selected = 'selected="selected"'; } $html .= "<option value='{$id}' {$selected}>{$title}</option>"; } $html .= "</select>"; return $html; }
/** * * 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}';"); }
" method="post" name="adminForm" id="item-form" class="form-validate"> <div class="slide_wrapper"> <div class="width-100 fltlft"> <?php echo $this->loadTemplate("inside"); ?> </div> <!-- width_100 --> </div> <!-- slide wrapper --> <input type="hidden" name="task" value="" /> <?php echo JHtml::_('form.token'); ?> </form> <script type="text/javascript"> jQuery(document).ready(function(){ UniteHCarousel.initItemView(); }); </script> <div class="clr"></div> <?php HelperUniteHCar::includeView("sliders/tmpl/footer.php"); ?>
/** * * pub bullets set html * @param mixed $set - can be array or set name */ public static function getBulletsHtml($set, $num = 5) { if ($num < 3) { $num = 3; } if (gettype($set) == "string") { $set = HelperUniteHCar::getBulletsSet($set); } $options = $set["options"]; $imgLeft = UniteFunctionsHCar::getVal($set, "url_bgleft"); $imgRight = UniteFunctionsHCar::getVal($set, "url_bgright"); $imgCenter = UniteFunctionsHCar::getVal($set, "url_bgrepeat"); $idBackground = false; if (!empty($imgCenter)) { $idBackground = true; //validate background fields UniteFunctionsHCar::validateArrayFieldExists($options, "bg_height,bg_left_width,bg_right_width,padding_top", "getBulletsHtml, background field not found in options"); UniteFunctionsHCar::validateNotEmpty($imgRight, "right image"); UniteFunctionsHCar::validateNotEmpty($imgLeft, "left image"); } $space_middle = UniteFunctionsHCar::getVal($options, "space_middle", 3); $html = ""; //Width Background if ($idBackground == true) { $bgHeight = $options["bg_height"]; $bgWidthLeft = $options["bg_left_width"]; $bgWidthRight = $options["bg_right_width"]; $paddingTop = $options["padding_top"]; $styleLeft = "float:left;height:{$bgHeight}px;width:{$bgWidthLeft}px;background-image:url(\"{$imgLeft}\");background-repeat:no-repeat;"; $styleRight = "float:left;height:{$bgHeight}px;width:{$bgWidthLeft}px;background-image:url(\"{$imgRight}\");background-repeat:no-repeat;"; $styleCenter = "float:left;height:{$bgHeight}px;background-image:url(\"{$imgCenter}\");background-repeat:releat-x;"; $html .= "<div class='bullets_left' style='{$styleLeft}' ></div>"; $html .= "<div class='bullets_middle' style='{$styleCenter}'>"; $html .= "<div class='bullets_inner' style='padding-top:" . $paddingTop . "px;'>"; $html .= '<ul>'; for ($i = 0; $i < $num; $i++) { $urlBullet = $set["url_normal"]; if ($i == 1) { $urlBullet = $set["url_active"]; } $styleLI = ""; if ($i > 0) { $styleLI = "margin-left:" . $space_middle . "px"; } $html .= "<li style='{$styleLI}'><img src='{$urlBullet}'/></li>"; } $html .= '</ul>'; $html .= '</div>'; $html .= '</div>'; $html .= "<div class='bullets_right' style='{$styleRight}'></div>"; } else { //no background: $html .= '<ul>'; for ($i = 0; $i < $num; $i++) { $urlBullet = $set["url_normal"]; if ($i == 1) { $urlBullet = $set["url_active"]; } $styleLI = ""; if ($i > 0) { $styleLI = "margin-left:" . $space_middle . "px"; } $html .= "<li style='{$styleLI}'><img src='{$urlBullet}'/></li>"; } $html .= '</ul>'; } $html .= '<div class="clear"></div>'; return $html; }
/** * * put arrows css */ private function putCss_arrows() { $params = $this->params; $showArrows = $params->get("show_arrows", "true") == "true" ? true : false; if ($showArrows == false) { return false; } $arrowType = $params->get("arrow_type"); $arrowSet = HelperUniteHCar::getArrowSet($arrowType); $hasHover = $arrowSet["has_hover"]; $arrowWidth = $arrowSet["options"]["width"]; $arrowHeight = $arrowSet["options"]["height"]; $arrowsPaddingSide = $params->get("arrows_padding_sides", 5); $verticalTuning = $params->get("arrows_vertical_tuning", 0); $imageLeft = $arrowSet["url_left"]; $imageRight = $arrowSet["url_right"]; $posLeft = -$arrowWidth - $arrowsPaddingSide; $posRight = $posLeft; $posVertCenter = floor(($this->height - $arrowHeight) / 2); $posVertCenter += $verticalTuning; ?> #left_arrow_<?php echo $this->sliderJSID; ?> { width:<?php echo $arrowWidth; ?> px; height:<?php echo $arrowHeight; ?> px; background:url('<?php echo $imageLeft; ?> '); border:none; display:block; position:absolute; left:<?php echo $posLeft; ?> px; top:<?php echo $posVertCenter; ?> px; z-index:1000; } #right_arrow_<?php echo $this->sliderJSID; ?> { width:<?php echo $arrowWidth; ?> px; height:<?php echo $arrowHeight; ?> px; background:url('<?php echo $imageRight; ?> '); display:block; border:none; position:absolute; top:<?php echo $posVertCenter; ?> px; right:<?php echo $posRight; ?> px; z-index:1001; } <?php if ($hasHover == true) { ?> #left_arrow_<?php echo $this->sliderJSID; ?> :hover{ background:url('<?php echo $arrowSet["url_left_hover"]; ?> '); } #right_arrow_<?php echo $this->sliderJSID; ?> :hover{ background:url('<?php echo $arrowSet["url_right_hover"]; ?> '); } <?php } }
/** * * set redirect url */ private function setRedirectToSlides() { $sliderID = JRequest::getVar("sliderid"); $redirectUrl = HelperUniteHCar::getViewUrl_Items($sliderID); $this->setRedirect($redirectUrl); }
<?php /** * @package Unite Horizontal Carousel for Joomla 1.7-2.5 * @author UniteCMS.net * @copyright (C) 2012 Unite CMS, All Rights Reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html **/ // No direct access. defined('_JEXEC') or die; $bulletsSets = HelperUniteHCar::getBulletsList(); ?> <div class="bullets_grid"> <ul class="bullets_list"> <?php foreach ($bulletsSets as $name => $set) { $urlPreview = $set["url_preview"]; ?> <li> <a href="javascript:void(0)" class="link_bullet" id="<?php echo $name; ?> " title="<?php echo $name; ?> "> <span> <img src="<?php echo $urlPreview; ?>
<?php /** * @package Unite Horizontal Carousel for Joomla 1.7-2.5 * @author UniteCMS.net * @copyright (C) 2012 Unite CMS, All Rights Reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html **/ // No direct access. defined('_JEXEC') or die; $arrowsSets = HelperUniteHCar::getArrowsList(); $settingID = UniteFunctionsHCar::getGetVar("settingid"); ?> <div class="arrows_grid"> <ul class="arrows_list"> <?php foreach ($arrowsSets as $name => $set) { $urlLeft = $set["url_left"]; $urlRight = $set["url_right"]; ?> <li> <a href="javascript:void(0)" class="link_arrow" id="<?php echo $name; ?> " title="<?php echo $name; ?> "> <span> <img src="<?php
<?php /** * @package Unite Horizontal Carousel for Joomla 1.7-2.5 * @author UniteCMS.net * @copyright (C) 2012 Unite CMS, All Rights Reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html **/ // No direct access. defined('_JEXEC') or die; $action = UniteFunctionsHCar::getPostVariable("action"); $data = UniteFunctionsHCar::getPostVariable("data"); $response = array("action" => $action, "success" => true); try { switch ($action) { case "get_bullets_html": $setName = UniteFunctionsHCar::getVal($data, "setName"); $html = HelperUniteHCar::getBulletsHtml($setName); $response["bullets_html"] = $html; break; default: UniteFunctionsHCar::throwError("Wrong action: <b>{$action}</b>"); break; } } catch (Exception $e) { $message = $e->getMessage(); UniteFunctionsHCar::jsonErrorResponse($message); } UniteFunctionsHCar::jsonResponse($response);
/** * get items rewrited, add slider title to slide properties */ public function getItems() { $items = parent::getItems(); $arrSlidersAssoc = HelperUniteHCar::getArrSlidersAssoc(); foreach ($items as $key => $item) { if (!isset($arrSlidersAssoc[$item->sliderid])) { throw new Exception("Slider with id: {$item->sliderid} not found"); } $slider = $arrSlidersAssoc[$item->sliderid]; $items[$key]->slider_name = $slider["title"]; } return $items; }
<?php /** * @package Unite Horizontal Carousel Module for Joomla 1.7-2.5 * @version 1.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; //include item files $pathIncludes = JPATH_ADMINISTRATOR . "/components/com_unitehcarousel/includes.php"; require_once $pathIncludes; //set active menu link $urlBase = JURI::base(); $sliderID = $params->get("sliderid"); $document = JFactory::getDocument(); $include_jquery = $params->get("include_jquery", "true"); if ($include_jquery == "true") { $jsPrefix = "http"; if (JURI::getInstance()->isSSL() == true) { $jsPrefix = "https"; } $document->addScript("{$jsPrefix}://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"); } $loadType = $params->get("js_load_type", "head"); $isJSInBody = $loadType == "body" ? true : false; $noConflictMode = $params->get("no_conflict_mode") == "true" ? true : false; HelperUniteHCar::outputSlider($sliderID, $isJSInBody, $noConflictMode);