Пример #1
0
 public function renderSubmissionPosition($position, $args = array())
 {
     // init vars
     $elements = array();
     $output = '';
     $trusted_mode = !JFactory::getUser()->guest && $this->_form->getSubmission()->isInTrustedMode();
     $show_tooltip = $this->_form->getSubmission()->showTooltip();
     // get style
     $style = isset($args['style']) ? $args['style'] : 'default';
     // get renderer
     $renderer = new YRenderer();
     $renderer->addPath($this->_path);
     // render elements
     foreach ($this->_getConfigPosition($position) as $data) {
         if (($element = $this->_item->getElement($data->element)) && ($field = $this->_form->getFormField($data->element))) {
             $metadata = $element->getMetaData();
             if (!$trusted_mode && $metadata['trusted'] == 'true') {
                 continue;
             }
             // bind field data to elements
             if ($field_data = $field->hasError() ? $field->getTaintedValue() : $field->getValue()) {
                 $element->bindData($field_data);
             } else {
                 $element->bindData();
             }
             // set params
             $params = array_merge((array) $data, $args);
             // check value
             $elements[] = compact('element', 'params', 'field');
         }
     }
     foreach ($elements as $i => $data) {
         $params = array_merge(array('first' => $i == 0, 'last' => $i == count($elements) - 1, 'layout_path' => $this->_path), compact('trusted_mode', 'show_tooltip'), $data['params']);
         $output .= $renderer->render("element.{$style}", array('element' => $data['element'], 'field' => $data['field'], 'params' => $params));
     }
     return $output;
 }
Пример #2
0
            }
            echo implode(' | ', $links);
            echo '</div>';
        }
        ?>
			</td>
			<td class="plugin">
				<?php 
        foreach ($this->plugins as $plugin_type => $plugins) {
            foreach ($plugins as $plugin) {
                $plugin_name = $plugin['name'];
                if (($xml = YXML::loadFile(dirname($plugin['path']) . DIRECTORY_SEPARATOR . $plugin['name'] . '.xml')) && $xml->getName() == 'install') {
                    $plugin_name = (string) $xml->getElementByPath('name');
                }
                echo '<div>' . $plugin_name . ': ';
                $renderer = new YRenderer();
                $renderer->addPath($plugin['path']);
                $links = array();
                foreach ($renderer->getLayouts('item') as $layout) {
                    // get layout metadata
                    $metadata = $renderer->getLayoutMetaData("item.{$layout}");
                    // create link
                    $link = '<a href="' . JRoute::_($this->baseurl . '&task=assignelements&type=' . $type->id . '&plugin=' . $plugin_type . '/' . $plugin['name'] . '&layout=' . $layout) . '">' . $metadata->get('name', $layout) . '</a>';
                    // create tooltip
                    if ($description = $metadata->get('description')) {
                        $link = '<span class="editlinktip hasTip" title="' . $metadata->get('name', $layout) . '::' . $description . '">' . $link . '</span>';
                    }
                    $links[] = $link;
                }
                echo implode(' | ', $links);
                echo '</div>';