public function form($instance)
    {
        $slider = new BannerRotator();
        $arrSliders = $slider->getArrSlidersShort();
        if (empty($arrSliders)) {
            echo __("No sliders found, Please create a slider");
        } else {
            $field = "banner_rotator";
            $fieldPages = "banner_rotator_pages";
            $fieldCheck = "banner_rotator_homepage";
            $sliderID = UniteFunctionsBanner::getVal($instance, $field);
            $homepage = UniteFunctionsBanner::getVal($instance, $fieldCheck);
            $pagesValue = UniteFunctionsBanner::getVal($instance, $fieldPages);
            $fieldID = $this->get_field_id($field);
            $fieldName = $this->get_field_name($field);
            $select = UniteFunctionsBanner::getHTMLSelect($arrSliders, $sliderID, 'name="' . $fieldName . '" id="' . $fieldID . '"', true);
            $fieldID_check = $this->get_field_id($fieldCheck);
            $fieldName_check = $this->get_field_name($fieldCheck);
            $checked = "";
            if ($homepage == "on") {
                $checked = "checked='checked'";
            }
            $fieldPages_ID = $this->get_field_id($fieldPages);
            $fieldPages_Name = $this->get_field_name($fieldPages);
            ?>
				Choose Slider: <?php 
            echo $select;
            ?>
				<div style="padding-top:10px;"></div>
				
				<label for="<?php 
            echo $fieldID_check;
            ?>
">Home Page Only:</label>
				<input type="checkbox" name="<?php 
            echo $fieldName_check;
            ?>
" id="<?php 
            echo $fieldID_check;
            ?>
" <?php 
            echo $checked;
            ?>
 >
				<br><br>
				<label for="<?php 
            echo $fieldPages_ID;
            ?>
">Pages: (example: 2,10) </label>
				<input type="text" name="<?php 
            echo $fieldPages_Name;
            ?>
" id="<?php 
            echo $fieldPages_ID;
            ?>
" value="<?php 
            echo $pagesValue;
            ?>
">
				
				<div style="padding-top:10px;"></div>
			<?php 
        }
    }
Ejemplo n.º 2
0
<?php

$sliderID = self::getGetVar("id");
if (empty($sliderID)) {
    UniteFunctionsBanner::throwError("Slider ID not found");
}
$slider = new BannerRotator();
$slider->initByID($sliderID);
$sliderParams = $slider->getParams();
$arrSliders = $slider->getArrSlidersShort($sliderID);
$selectSliders = UniteFunctionsBanner::getHTMLSelect($arrSliders, "", "id='selectSliders'", true);
$numSliders = count($arrSliders);
//Set iframe parameters
$width = $sliderParams["width"];
$height = $sliderParams["height"];
$iframeWidth = $width + 60;
$iframeHeight = $height + 50;
$iframeStyle = "width:{$iframeWidth}px;height:{$iframeHeight}px;";
//Handle wpml
$isWpmlExists = UniteWpmlBanner::isWpmlExists();
$useWpml = $slider->getParam("useWpml", "false");
$wpmlActive = false;
if ($isWpmlExists && $useWpml == "true") {
    $wpmlActive = true;
    //Get langs floating menu
    $urlIconDelete = self::$url_plugin . "images/icon-trash.png";
    $urlIconEdit = self::$url_plugin . "images/icon-edit.png";
    $urlIconPreview = self::$url_plugin . "images/preview.png";
    $textDelete = __("Delete Slide", BANNERROTATOR_TEXTDOMAIN);
    $textEdit = __("Edit Slide", BANNERROTATOR_TEXTDOMAIN);
    $textPreview = __("Preview Slide", BANNERROTATOR_TEXTDOMAIN);