Exemplo n.º 1
0
 /**
  * builds and adds the querystring to the href element
  * 
  * @param array $item current item for which to build the href
  * @param CBaseElement $DOMitem the element where to set the href property
  * 
  * @access private
  */
 private function buildHREFParams($item, $DOMitem)
 {
     if (strpos($item['href_paramlist'], 'template_field') !== false) {
         /**
          * if href_paramlist is a template field append it right away
          */
         $paramString = $item['href_paramlist'];
     } else {
         /**
          * if it's not a template field, must check the parameters 
          * list against the passed menu options array
          */
         // explode and trim requested parameters name
         $requestedParams = array_map('trim', explode(",", $item['href_paramlist']));
         $foundParams = array();
         /**
          * search each parameter in the options array, either in parameter
          * name array key or in the <item_id, parameter name> array key
          */
         foreach ($requestedParams as $param) {
             if (isset($this->_menuOptions[$param]) && strlen($this->_menuOptions[$param]) > 0) {
                 $foundParams[$param] = $this->_menuOptions[$param];
             } else {
                 if (isset($this->_menuOptions[$item['item_id']][$param]) && strlen($this->_menuOptions[$item['item_id']][$param]) > 0) {
                     $foundParams[$param] = $this->_menuOptions[$item['item_id']][$param];
                 }
             }
         }
         if (count($foundParams) > 0) {
             $paramString = http_build_query($foundParams, '', '&amp;');
         }
     }
     // set the actual href value
     if (isset($paramString) && strlen($paramString) > 0) {
         // add the question mark or ampersand to the href
         $conjunction = strpos($DOMitem->getAttribute('href'), '?') === false ? '?' : '&amp;';
         // add actual parameters
         $DOMitem->setAttribute('href', $DOMitem->getAttribute('href') . $conjunction . $paramString);
     }
 }
Exemplo n.º 2
0
 /**
  * renders the HTML of the form
  * 
  * @return string
  * @access public
  */
 public function getHtml()
 {
     return $this->_form->getHtml();
 }