/** * 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 onBulletsSelect(data){'; $script[] = ' alert("do something: " + 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=com_unitehcarousel&view=slider&layout=bullets&tmpl=component'; $html[] = '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . $this->value . '" />'; $bulletsText = "Change Bullets"; $buttonID = $this->id . "-btn"; $desc = UniteFunctionsHCar::getVal($this->element, "description"); $htmlAddon = ""; if (!empty($desc)) { $htmlAddon = ' title="' . $desc . '"'; //$class .= " hasTip"; //making problems with rel } // The user select button. $html[] = ' <a id="' . $buttonID . '" class="modal panel_button" ' . $htmlAddon . ' href="' . $link . '&' . JSession::getFormToken() . '=1" rel="{handler: \'iframe\', size: {x: 900, y: 450}}">' . $bulletsText . '</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() { // 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; }
/** * * 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; }
/** * * get slider id */ public function getSliderID() { $sliderID = JRequest::getVar("id"); if (empty($sliderID)) { UniteFunctionsHCar::throwError("Slider ID url argument not found (id)"); } return $sliderID; }
/** * Method to get the field input markup. * * @return string The field input markup. * @since 1.6 */ protected function getInput() { // Initialize some field attributes. if (empty($class)) { $class = "button1"; } $id = $this->element['name']; $label = $this->element['label']; $desc = UniteFunctionsHCar::getVal($this->element, "description"); $htmlAddon = ""; if (!empty($desc)) { $htmlAddon = "class='hasTip' title='{$desc}'"; } $html = "<input type='button' id='{$id}' value='{$label}' {$htmlAddon}>"; return $html; }
/** * Method to get the field input markup. * * @return string The field input markup. * * @since 11.1 */ protected function getInput() { // Initialize some field attributes. $size = $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; $maxLength = $this->element['maxlength'] ? ' maxlength="' . (int) $this->element['maxlength'] . '"' : ''; $class = $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : ''; $readonly = (string) $this->element['readonly'] == 'true' ? ' readonly="readonly"' : ''; $disabled = (string) $this->element['disabled'] == 'true' ? ' disabled="disabled"' : ''; $unit = (string) UniteFunctionsHCar::getVal($this->element, 'unit', ""); // Initialize JavaScript field attributes. $onchange = $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : ''; $html = '<input type="text" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"' . $class . $size . $disabled . $readonly . $onchange . $maxLength . '/>'; if (!empty($unit)) { $html .= "<span class='unit'>{$unit}</span>"; } return $html; }
/** * * draw some filter */ private function putFilter($filter) { $type = $filter["type"]; switch ($filter["type"]) { case self::FILTER_TYPE_PUBLISHED: ?> <select name="filter_published" class="inputbox" onchange="this.form.submit()"> <option value=""><?php echo JText::_('JOPTION_SELECT_PUBLISHED'); ?> </option> <?php echo JHtml::_('select.options', array(JHtml::_('select.option', '1', 'JPUBLISHED'), JHtml::_('select.option', '0', 'JUNPUBLISHED')), 'value', 'text', $this->state->get('filter.published'), true); ?> </select> <?php break; default: UniteFunctionsHCar::throwError("Wrong filter type: " . $type); break; } }
<?php /** * @package Unite Horizontal Carousel 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('Restricted access'); require_once JPATH_ADMINISTRATOR . "/components/com_unitehcarousel/includes.php"; //error_reporting(E_ALL); // debug // Include dependancies jimport('joomla.application.component.controller'); if (UniteFunctionsHCar::isJoomla3()) { $controller = JControllerLegacy::getInstance(GlobalsUniteHCar::EXTENSION_NAME); } else { $controller = JController::getInstance(GlobalsUniteHCar::EXTENSION_NAME); } // Perform the Request task $task = JRequest::getVar('task'); $controller->execute($task); $controller->redirect();
/** * * include some view, give path from "views" folder */ public static function includeView($pathView) { $filepathView = GlobalsUniteHCar::$pathViews . $pathView; if (file_exists($filepathView) == false) { UniteFunctionsHCar::throwError("View not found: {$pathView}"); } require $filepathView; }
/** * * output the css */ public function outputCss() { $sliderID = UniteFunctionsHCar::getGetVar("slider_id"); $sliderJSID = UniteFunctionsHCar::getGetVar("slider_js_id"); try { $this->initSlider($sliderID); $this->initCSSOutput(); $this->sliderJSID = $sliderJSID; $this->putCss(); } catch (Exception $e) { $message = $e->getMessage(); UniteFunctionsHCar::errorHtmlOutput($message); } }
<?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;
<?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
private function outputImageForDownload($filepath, $filename, $mimeType = "") { $contents = file_get_contents($filepath); $filesize = strlen($contents); if ($mimeType == "") { $info = UniteFunctionsHCar::getPathInfo($filepath); $ext = $info["extension"]; $mimeType = "image/{$ext}"; } header("Content-Type: {$mimeType}"); header("Content-Disposition: attachment; filename=\"{$filename}\""); header("Content-Length: {$filesize}"); echo $contents; exit; }
<?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);
/** * * do "trim" operation on all array items. */ public static function trimArrayItems($arr) { if (gettype($arr) != "array") { UniteFunctionsHCar::throwError("trimArrayItems error: The type must be array"); } foreach ($arr as $key => $item) { $arr[$key] = trim($item); } return $arr; }
/** * Get url of image for output */ public static function getImageOutputUrl($filename, $width = 0, $height = 0, $exact = false, $encode = true) { $pathImages = JPATH_SITE . "/"; $filenameThumb = UniteImageViewHCar::getThumbFilenameFromInput($filename, $width, $height, $exact); $pathCache = self::getPathCache(); $filepath = $pathCache . $filenameThumb; if (file_exists($filepath)) { $urlImage = GlobalsUniteHCar::$urlCache . $filenameThumb; return $urlImage; } //exact validation: if (($exact == "true" || $exact == true) && (empty($width) || empty($height))) { UniteFunctionsHCar::throwError("Exact must have both - width and height"); } if ($encode == true) { $filename = base64_encode($filename); } $url = "index.php?option=" . self::$componentName . "&task=showimage&img={$filename}"; if (!empty($width)) { $url .= "&w=" . $width; } if (!empty($height)) { $url .= "&h=" . $height; } if ($exact == true) { $url .= "&t=exact"; } if ($encode == false) { $url .= "&noencode=true"; } return $url; }