function renderEntry($node, $level, $type) { if (in_array($this->_menuType, array('tree', 'sitemap', 'rows')) && $this->_tpl->blockExists($this->_prefix . ($level + 1) . '_' . $this->_typeNames[$type])) { $blockName = $this->_prefix . ($level + 1) . '_' . $this->_typeNames[$type]; } else { $blockName = $this->_prefix . $this->_typeNames[$type]; } if (('tree' == $this->_menuType || 'sitemap' == $this->_menuType) && $this->_tpl->blockExists($blockName . '_indent')) { for ($i = 0; $i < $level; $i++) { $this->_tpl->touchBlock($blockName . '_indent'); $this->_tpl->parse($blockName . '_indent'); } } foreach ($node as $k => $v) { if ('sub' != $k && $this->_tpl->placeholderExists($this->_prefix . $k, $blockName)) { $this->_tpl->setVariable($this->_prefix . $k, $v); } } $this->_tpl->parse($blockName); if ('rows' == $this->_menuType && $this->_tpl->blockExists($this->_prefix . ($level + 1) . '_entry_loop')) { $this->_tpl->parse($this->_prefix . ($level + 1) . '_entry_loop'); } else { $this->_tpl->parse($this->_prefix . 'entry_loop'); } }
function renderElement(&$element, $required, $error) { $blockName = $this->_matchBlock($element); // are we inside a group? if ('qf_main_loop' != $this->_tpl->currentBlock) { if (0 != $this->_groupElementIdx && $this->_tpl->placeholderExists('qf_separator', $blockName)) { if (is_array($this->_groupSeparator)) { $this->_tpl->setVariable('qf_separator', $this->_groupSeparator[($this->_groupElementIdx - 1) % count($this->_groupSeparator)]); } else { $this->_tpl->setVariable('qf_separator', (string)$this->_groupSeparator); } } $this->_groupElementIdx++; } elseif(!empty($error)) { // show the error message or keep it for later use if ($this->_tpl->blockExists($blockName . '_error')) { $this->_tpl->setVariable('qf_error', $error); } else { $this->_errors[] = $error; } } // show an '*' near the required element if ($required) { $this->_showRequired = true; if ($this->_tpl->blockExists($blockName . '_required')) { $this->_tpl->touchBlock($blockName . '_required'); } } // Prepare multiple labels $labels = $element->getLabel(); if (is_array($labels)) { $mainLabel = array_shift($labels); } else { $mainLabel = $labels; } // render the element itself with its main label $this->_tpl->setVariable('qf_element', $element->toHtml()); if ($this->_tpl->placeholderExists('qf_label', $blockName)) { $this->_tpl->setVariable('qf_label', $mainLabel); } // render extra labels, if any if (is_array($labels)) { foreach($labels as $key => $label) { $key = is_int($key)? $key + 2: $key; if ($this->_tpl->blockExists($blockName . '_label_' . $key)) { $this->_tpl->setVariable('qf_label_' . $key, $label); } } } $this->_tpl->parse($blockName); $this->_tpl->parseCurrentBlock(); }
function renderEntry($node, $level, $type) { // Close the entry if previous was on same or higher level if ($this->_level >= $level) { if ($this->_tpl->blockExists($this->_prefix . ($level + 1) . '_entry_close')) { $this->_tpl->touchBlock($this->_prefix . ($level + 1) . '_entry_close'); } else { $this->_tpl->touchBlock($this->_prefix . 'entry_close'); } $this->_tpl->parse($this->_prefix . 'tree_loop'); // If the new level is higher then open the level } else { if ($this->_tpl->blockExists($this->_prefix . ($level + 1) . '_level_open')) { $this->_tpl->touchBlock($this->_prefix . ($level + 1) . '_level_open'); } else { $this->_tpl->touchBlock($this->_prefix . 'level_open'); } $this->_tpl->parse($this->_prefix . 'tree_loop'); } // Open the entry if ($this->_tpl->blockExists($this->_prefix . ($level + 1) . '_entry_open')) { $this->_tpl->touchBlock($this->_prefix . ($level + 1) . '_entry_open'); } else { $this->_tpl->touchBlock($this->_prefix . 'entry_open'); } $this->_tpl->parse($this->_prefix . 'tree_loop'); if ($this->_tpl->blockExists($this->_prefix . ($level + 1) . '_' . $this->_typeNames[$type])) { $blockName = $this->_prefix . ($level + 1) . '_' . $this->_typeNames[$type]; } else { $blockName = $this->_prefix . $this->_typeNames[$type]; } foreach ($node as $k => $v) { if ('sub' != $k && $this->_tpl->placeholderExists($this->_prefix . $k, $blockName)) { $this->_tpl->setVariable($this->_prefix . $k, $v); } } $this->_tpl->parse($blockName); $this->_tpl->parse($this->_prefix . 'tree_loop'); $this->_level = $level; }