Ejemplo n.º 1
0
 /**
  * 
  * 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 = HelperUniteRev::getBulletsSet($set);
     }
     $options = $set["options"];
     $imgLeft = UniteFunctionsRev::getVal($set, "url_bgleft");
     $imgRight = UniteFunctionsRev::getVal($set, "url_bgright");
     $imgCenter = UniteFunctionsRev::getVal($set, "url_bgrepeat");
     $idBackground = false;
     if (!empty($imgCenter)) {
         $idBackground = true;
         //validate background fields
         UniteFunctionsRev::validateArrayFieldExists($options, "bg_height,bg_left_width,bg_right_width,padding_top", "getBulletsHtml, background field not found in options");
         UniteFunctionsRev::validateNotEmpty($imgRight, "right image");
         UniteFunctionsRev::validateNotEmpty($imgLeft, "left image");
     }
     $space_middle = UniteFunctionsRev::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;
 }