aboutsummaryrefslogtreecommitdiff
path: root/h-source/Library/Helper/Popup.php
diff options
context:
space:
mode:
authorYuchen Pei <me@ypei.me>2021-07-29 14:17:20 +1000
committerYuchen Pei <me@ypei.me>2021-07-29 14:17:20 +1000
commit3ff03dc4f0a72432b34c00da620272cf011e4ddd (patch)
tree5746711ba17a91aed56c6529ea8cceb06c3ad16a /h-source/Library/Helper/Popup.php
parentcd4534aa10ba3b122963992741721289fa50d0ab (diff)
Publishing h-node.org code.
- this is the h-node.org code, except - removed a js file (3x copies at three different locations) without license / copyright headers - /Js/linkToForm.js - /Public/Js/linkToForm.js - /admin/Public/Js/linkToForm.js - removed config files containing credentials - /Application/Include/params.php - /Config/Config.php - /admin/Application/Include/params.php - /admin/Config/Config.php - added license and copyright header to one php file - /admin/Library/ErrorReporting.php (almost identical to /Library/ErrorReporting.php which has the headers)
Diffstat (limited to 'h-source/Library/Helper/Popup.php')
-rwxr-xr-xh-source/Library/Helper/Popup.php46
1 files changed, 16 insertions, 30 deletions
diff --git a/h-source/Library/Helper/Popup.php b/h-source/Library/Helper/Popup.php
index f3e6058..18bb00d 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 - 2014 Antonio Gallo (info@laboratoriolibero.com)
+// Copyright (C) 2009 - 2011 Antonio Gallo
// See COPYRIGHT.txt and LICENSE.txt.
//
// This file is part of EasyGiant
@@ -25,15 +25,6 @@ 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
@@ -94,17 +85,9 @@ 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 = self::$popupHtml["before_loop"];
+ $returnString = null;
if ($this->checkViewArgs())
{
if (isset($this->viewArgs[$this->pageArg]))
@@ -121,12 +104,11 @@ class Helper_Popup extends Helper_Html {
$tempArg = $this->viewArgs[$field];
$this->legend[$field] = $tempArg;
- $returnString .= $this->replacePlaceholders(self::$popupHtml["top"],$field,$popup->name);
-
+ $returnString .= "<ul onMouseOver='DisplayTag(this,\"block\");' onMouseOut='DisplayTag(this,\"none\");' id='menuBlock'><li class='innerItem'>".$popup->name."<ul class='innerList'>\n";
for ($i = 0; $i < count($popup->itemsValue); $i++)
{
$this->viewArgs[$field] = $popup->itemsValue[$i];
- $viewStatus = Url::createUrl($this->viewArgs);
+ $viewStatus = Url::createUrl(array_values($this->viewArgs));
$returnString .= "<li><a href='".Url::getRoot($this->url).$viewStatus."'>".$popup->itemsName[$i]."</a></li>\n";
//set the legend
@@ -136,20 +118,24 @@ class Helper_Popup extends Helper_Html {
}
}
$this->viewArgs[$field] = Params::$nullQueryValue;
- $viewStatus = Url::createUrl($this->viewArgs);
+ $viewStatus = Url::createUrl(array_values($this->viewArgs));
$returnString .= "<li><a href='".Url::getRoot($this->url).$viewStatus."'>".$this->allString."</a></li>\n";
- $returnString .= self::$popupHtml["middle"];
+ $returnString .= "</ul>\n</li>\n</ul>\n";
$this->viewArgs[$field] = $tempArg;
-
- if ($this->printLegend)
+ }
+ if ($this->printLegend)
+ {
+ $returnString .= "<div class='popup_legend'>\n";
+ foreach ($this->popupArray as $field => $popup)
{
- $returnString .= "<div class='popup_legend_item popup_legend_item_$field'>".$this->legend[$field]."</div>";
+ $returnString .= "<div class='popup_legend_item'>".$this->legend[$field]."</div>";
}
-
- $returnString .= self::$popupHtml["bottom"];
+ $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["after_loop"];
return $returnString;
}