aboutsummaryrefslogtreecommitdiff
path: root/h-source/Library/Helper/Popup.php
diff options
context:
space:
mode:
Diffstat (limited to 'h-source/Library/Helper/Popup.php')
-rwxr-xr-xh-source/Library/Helper/Popup.php44
1 files changed, 29 insertions, 15 deletions
diff --git a/h-source/Library/Helper/Popup.php b/h-source/Library/Helper/Popup.php
index 4f67a5c..f3e6058 100755
--- a/h-source/Library/Helper/Popup.php
+++ b/h-source/Library/Helper/Popup.php
@@ -2,7 +2,7 @@
// EasyGiant is a PHP framework for creating and managing dynamic content
//
-// Copyright (C) 2009 - 2011 Antonio Gallo
+// Copyright (C) 2009 - 2014 Antonio Gallo (info@laboratoriolibero.com)
// See COPYRIGHT.txt and LICENSE.txt.
//
// This file is part of EasyGiant
@@ -25,6 +25,15 @@ if (!defined('EG')) die('Direct access not allowed!');
//class to create the popup menu
class Helper_Popup extends Helper_Html {
+ //the HTML of the popup
+ public static $popupHtml = array(
+ "before_loop" => "",
+ "top" => "<div class='row col-md-2 ext_menu_block ext_menu_block_[[field]]'><ul class='menuBlock'><li class='innerItem inner_item_[[field]]'>[[name]]<ul class='innerList'>\n",
+ "middle" => "</ul>\n</li>\n</ul>\n",
+ "bottom" => "</div>",
+ "after_loop" => "",
+ );
+
public $popupArray = array(); //array of popup objects (see popup.php)
public $url = null; //the url (controller/action) to link by means of the popup menĂ¹
// public $fieldArg = null; //the key of the viewArgs array to set to the field in the where clause
@@ -85,9 +94,17 @@ class Helper_Popup extends Helper_Html {
}
}
+ public function replacePlaceholders($string, $field, $name)
+ {
+ $string = str_replace("[[field]]",$field,$string);
+ $string = str_replace("[[name]]",$name,$string);
+
+ return $string;
+ }
+
//create the HTML of the popup
public function render() {
- $returnString = null;
+ $returnString = self::$popupHtml["before_loop"];
if ($this->checkViewArgs())
{
if (isset($this->viewArgs[$this->pageArg]))
@@ -104,11 +121,12 @@ class Helper_Popup extends Helper_Html {
$tempArg = $this->viewArgs[$field];
$this->legend[$field] = $tempArg;
- $returnString .= "<ul onMouseOver='DisplayTag(this,\"block\");' onMouseOut='DisplayTag(this,\"none\");' id='menuBlock'><li class='innerItem inner_item_$field'>".$popup->name."<ul class='innerList'>\n";
+ $returnString .= $this->replacePlaceholders(self::$popupHtml["top"],$field,$popup->name);
+
for ($i = 0; $i < count($popup->itemsValue); $i++)
{
$this->viewArgs[$field] = $popup->itemsValue[$i];
- $viewStatus = Url::createUrl(array_values($this->viewArgs));
+ $viewStatus = Url::createUrl($this->viewArgs);
$returnString .= "<li><a href='".Url::getRoot($this->url).$viewStatus."'>".$popup->itemsName[$i]."</a></li>\n";
//set the legend
@@ -118,24 +136,20 @@ class Helper_Popup extends Helper_Html {
}
}
$this->viewArgs[$field] = Params::$nullQueryValue;
- $viewStatus = Url::createUrl(array_values($this->viewArgs));
+ $viewStatus = Url::createUrl($this->viewArgs);
$returnString .= "<li><a href='".Url::getRoot($this->url).$viewStatus."'>".$this->allString."</a></li>\n";
- $returnString .= "</ul>\n</li>\n</ul>\n";
+ $returnString .= self::$popupHtml["middle"];
$this->viewArgs[$field] = $tempArg;
- }
- if ($this->printLegend)
- {
- $returnString .= "<div class='popup_legend'>\n";
- foreach ($this->popupArray as $field => $popup)
+
+ if ($this->printLegend)
{
$returnString .= "<div class='popup_legend_item popup_legend_item_$field'>".$this->legend[$field]."</div>";
}
- $returnString .= "</div>\n";
- }
- if (count($this->popupArray)>0) {
- $returnString .= "<script type=\"text/javascript\" src=\"http://".DOMAIN_NAME."/Public/Js/DisplayTag.js\"></script>\n";
+
+ $returnString .= self::$popupHtml["bottom"];
}
}
+ $returnString .= self::$popupHtml["after_loop"];
return $returnString;
}