diff options
Diffstat (limited to 'h-source/Library/Helper')
-rwxr-xr-x | h-source/Library/Helper/List.php | 45 | ||||
-rwxr-xr-x | h-source/Library/Helper/Popup.php | 4 |
2 files changed, 27 insertions, 22 deletions
diff --git a/h-source/Library/Helper/List.php b/h-source/Library/Helper/List.php index ba59643..7f8fb77 100755 --- a/h-source/Library/Helper/List.php +++ b/h-source/Library/Helper/List.php @@ -172,47 +172,48 @@ class Helper_List extends Helper_Html { public function replaceFields($string,$rowArray) { $this->__rowArray = $rowArray; //used by the replaceField method - $string = preg_replace_callback('/(\;)(.*?)(\;)/', 'Helper_List::replaceField' ,$string); + $string = preg_replace_callback('/(\;)(.*?)(\;)/', array($this, 'replaceField') ,$string); return $string; } + //get : or . as char used to separate table and field + public function getChar($string) + { + return strstr($string,':') ? ':' : '.'; + } + //replace a single string wrapped by ; with its correspondent value taken by the $recordArray associative array (a row of the select query) public function replaceField($match) { $string = $match[2]; - if (strstr($string,':') or strstr($string,'.')) { - if (strstr($string,':')) - { - $char = ':'; - } - else - { - $char = '.'; - } - //check if a function has been indicated - if (strstr($string,'|')) + //check if a function has been indicated + if (strstr($string,'|')) + { + //get the function + $firstArray = explode('|',$string); + if (strstr($firstArray[1],':') or strstr($firstArray[1],'.')) { - //get the function - $firstArray = explode('|',$string); $func = $firstArray[0]; //replace the fields + $char = $this->getChar($firstArray[1]); $temp = explode($char,$firstArray[1]); $string = $this->__rowArray[$temp[0]][$temp[1]]; - if (!function_exists($func)) { - throw new Exception('Error in <b>'.__METHOD__.'</b>: function <b>'.$func.'</b> does not exists..'); - } - //apply the function - $string = call_user_func($func,$string); + $string = callFunction($func,$string,__METHOD__); } - else + } + else + { + if (strstr($string,':') or strstr($string,'.')) { + $char = $this->getChar($string); $temp = explode($char,$string); $string = $this->__rowArray[$temp[0]][$temp[1]]; } } + return $string; } @@ -477,6 +478,10 @@ class Helper_List extends Helper_Html { $viewStatus = Url::createUrl(array_values($this->viewArgs)); if (strcmp($value,Params::$nullQueryValue) === 0) $value = ''; } + else + { + $viewStatus = $this->viewStatus; + } $this->viewArgs[$viewArgsName] = $temp; $action = Url::getRoot($this->url).$viewStatus; diff --git a/h-source/Library/Helper/Popup.php b/h-source/Library/Helper/Popup.php index 18bb00d..4f67a5c 100755 --- a/h-source/Library/Helper/Popup.php +++ b/h-source/Library/Helper/Popup.php @@ -104,7 +104,7 @@ 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'>".$popup->name."<ul class='innerList'>\n"; + $returnString .= "<ul onMouseOver='DisplayTag(this,\"block\");' onMouseOut='DisplayTag(this,\"none\");' id='menuBlock'><li class='innerItem inner_item_$field'>".$popup->name."<ul class='innerList'>\n"; for ($i = 0; $i < count($popup->itemsValue); $i++) { $this->viewArgs[$field] = $popup->itemsValue[$i]; @@ -128,7 +128,7 @@ class Helper_Popup extends Helper_Html { $returnString .= "<div class='popup_legend'>\n"; foreach ($this->popupArray as $field => $popup) { - $returnString .= "<div class='popup_legend_item'>".$this->legend[$field]."</div>"; + $returnString .= "<div class='popup_legend_item popup_legend_item_$field'>".$this->legend[$field]."</div>"; } $returnString .= "</div>\n"; } |