/** * Render the group by heading as a JLayout list.fabrik-group-by-heading * * @param string $groupedBy Group by key for $this->grouptemplates * @param array $group Group data * * @return string */ public function layoutGroupHeading($groupedBy, $group) { $displayData = new stdClass(); $displayData->emptyDataMessage = $this->emptyDataMessage; $displayData->tmpl = $this->tmpl; $displayData->title = $this->grouptemplates[$groupedBy]; $displayData->count = count($group); $layout = FabrikHelperHTML::getLayout('list.fabrik-group-by-heading'); return $layout->render($displayData); }
/** * Set the page title * * @param object $w parent worker * @param object &$params parameters * * @return void */ protected function setTitle($w, &$params) { parent::setTitle($w, $params); $model = $this->getModel(); // Set the download file name based on the document title $layout = FabrikHelperHTML::getLayout('form.fabrik-pdf-title'); $displayData = new stdClass(); $displayData->doc = $this->doc; $displayData->model = $this->getModel(); $this->doc->setName($layout->render($displayData)); }
/** * Get a form JLayout file * * @param string $name layout name * @param array $paths Optional paths to add as includes * @param array $options Options * * @return FabrikLayoutFile */ public function getLayout($name, $paths = array(), $options = array()) { $view = $this->isEditable() ? 'form' : 'details'; $paths[] = COM_FABRIK_FRONTEND . '/views/' . $view . '/tmpl/' . $this->getTmpl() . '/layouts'; $layout = FabrikHelperHTML::getLayout($name, $paths, $options); return $layout; }
/** * If all filters are set to read only then don't return a clear button * otherwise do * * @return string clear filter button link */ public function getClearButton() { $filters = $this->getFilters('listform_' . $this->getRenderContext(), 'list'); $params = $this->getParams(); if (count($filters) > 0 || $params->get('advanced-filter')) { $displayData = new stdClass(); $displayData->tmpl = $this->getTmpl(); $layout = FabrikHelperHTML::getLayout('list.fabrik-clear-button'); return $layout->render($displayData); } else { return ''; } }
/** * Attempt to compare exported ACL setting with the site's existing ACL setting * * @return string */ public function aclCheckUI() { $xpath = new DOMXpath($this->doc); $parent = $xpath->query('/contenttype'); $importViewLevels = $xpath->query('/contenttype/viewlevels/viewlevel'); $importGroups = $xpath->query('/contenttype/groups/group'); $contentTypeViewLevels = array(); $contentTypeGroups = array(); $alteredGroups = array(); foreach ($importGroups as $importGroup) { $group = FabrikContentTypHelper::domNodeAttributesToArray($importGroup); $contentTypeGroups[$group['id']] = $group; } foreach ($importViewLevels as $importViewLevel) { $viewLevel = FabrikContentTypHelper::domNodeAttributesToArray($importViewLevel); $rules = json_decode($viewLevel['rules']); foreach ($rules as &$rule) { $rule = array_key_exists($rule, $contentTypeGroups) ? $contentTypeGroups[$rule]['title'] : $rule; } $viewLevel['rules_labels'] = implode(', ', $rules); $contentTypeViewLevels[] = $viewLevel; } $viewLevels = $this->getViewLevels(); $groups = $this->getGroups(); foreach ($viewLevels as &$viewLevel) { $rules = json_decode($viewLevel['rules']); foreach ($rules as &$rule) { $rule = array_key_exists($rule, $groups) ? $groups[$rule]['title'] : $rule; } $viewLevel['rules_labels'] = implode(', ', $rules); } foreach ($groups as $group) { if (array_key_exists($group['id'], $contentTypeGroups)) { $importGroup = $contentTypeGroups[$group['id']]; if ($group['lft'] !== $importGroup['lft'] || $group['rgt'] !== $importGroup['rgt'] || $group['parent_id'] !== $importGroup['parent_id']) { $alteredGroups[] = $group; } } } $layoutData = (object) array('viewLevels' => $viewLevels, 'contentTypeViewLevels' => $contentTypeViewLevels, 'match' => true, 'groups' => $groups, 'importGroups' => $contentTypeGroups, 'alteredGroups' => $alteredGroups); try { $this->validateViewLevelXML(); } catch (Exception $e) { $layoutData->match = false; } foreach ($parent as $p) { if ($p->getAttribute('ignoreacl') === 'true') { $layoutData->match = true; } } $this->checkVersion($xpath, $layoutData); $layout = FabrikHelperHTML::getLayout('fabrik-content-type-compare'); return $layout->render($layoutData); }
/** * Get the element's HTML label * * @param int $repeatCounter Group repeat counter * @param string $tmpl Form template * * @return string label */ public function getLabel($repeatCounter, $tmpl = '') { $element = $this->getElement(); $this->modHTMLId($elementHTMLId); $model = $this->getFormModel(); $displayData = new stdClass(); $displayData->canView = $this->canView(); $displayData->id = $this->getHTMLId($repeatCounter); $displayData->canUse = $this->canUse(); $displayData->j3 = FabrikWorker::j3(); $displayData->hidden = $this->isHidden(); $displayData->label = FText::_($element->label); $displayData->hasLabel = $this->get('hasLabel'); $displayData->view = $this->app->input->get('view', 'form'); $displayData->tip = $this->tipHtml($model->data); $displayData->tipText = $this->tipTextAndValidations('form', $model->data); $displayData->rollOver = $this->isTipped(); $displayData->isEditable = $this->isEditable(); $displayData->tipOpts = $this->tipOpts(); $labelClass = ''; if ($displayData->canView || $displayData->canUse) { $labelClass = 'fabrikLabel control-label'; if (empty($displayData->label)) { $labelClass .= ' fabrikEmptyLabel'; } if ($displayData->rollOver) { $labelClass .= ' fabrikHover'; } if ($displayData->hasLabel && !$displayData->hidden) { if ($displayData->tip !== '') { $labelClass .= ' fabrikTip'; } } } $displayData->icons = ''; $iconOpts = array('icon-class' => 'small'); if ($displayData->rollOver) { $displayData->icons .= FabrikHelperHTML::image('question-sign.png', 'form', $tmpl, $iconOpts) . ' '; } if ($displayData->isEditable) { $displayData->icons .= $this->validator->labelIcons(); } $displayData->labelClass = $labelClass; $layout = FabrikHelperHTML::getLayout('fabrik-element-label', $this->labelPaths()); $str = $layout->render($displayData); return $str; }
/** * Shows the data formatted for the list view * * @param string $data Elements data * @param stdClass &$thisRow All the data in the lists current row * @param array $opts Rendering options * * @return string formatted value */ public function renderListData($data, stdClass &$thisRow, $opts = array()) { $params = $this->getParams(); $listModel = $this->getListModel(); $multiple = $this->isMultiple(); $mergeGroupRepeat = $this->getGroup()->canRepeat() && $this->getListModel()->mergeJoinedData(); $useIcon = $params->get('icon_folder', 0) && ArrayHelper::getValue($opts, 'icon', 1); // Give priority to raw value icons (podion) $raw = $this->isJoin() ? $this->getFullName(true, false) . '_raw' : $this->getFullName(true, false) . '_id'; if (isset($thisRow->{$raw})) { $rawData = FabrikWorker::JSONtoData($thisRow->{$raw}, true); foreach ($rawData as &$val) { $val = $useIcon ? $this->replaceWithIcons($val, 'list', $listModel->getTmpl()) : $val; } if ($this->iconsSet) { // Use raw icons $data = $rawData; $useIcon = false; } } // Repeat group data $gdata = FabrikWorker::JSONtoData($data, true); $this->listPreformat($gdata, $thisRow); $addHtml = (count($gdata) !== 1 || $multiple || $mergeGroupRepeat) && $this->renderWithHTML; $uls = array(); foreach ($gdata as $i => $d) { $lis = array(); $values = is_array($d) ? $d : FabrikWorker::JSONtoData($d, true); foreach ($values as $tmpVal) { $l = $useIcon ? $this->replaceWithIcons($tmpVal, 'list', $listModel->getTmpl()) : $tmpVal; if (!$this->iconsSet == true) { if (!is_a($this, 'PlgFabrik_ElementDatabasejoin')) { $l = $this->getLabelForValue($tmpVal); } else { $l = $tmpVal; } $l = $this->replaceWithIcons($l, 'list', $listModel->getTmpl()); } if ($this->renderWithHTML) { if (ArrayHelper::getValue($opts, 'rollover', 1)) { $l = $this->rollover($l, $thisRow, 'list'); } if (ArrayHelper::getValue($opts, 'link', 1)) { $l = $listModel->_addLink($l, $this, $thisRow, $i); } } if (trim($l) !== '') { $lis[] = $l; } else { // was trying to fix issue with empty merged repeat rows not having height but messes CSV export //$lis[] = ' '; $lis[] = ''; } } if (!empty($lis)) { $uls[] = $lis; } } // Do all uls only contain one record, if so condense to 1 ul (avoids nested <ul>'s each with one <li> $condense = true; foreach ($uls as $ul) { if (count($ul) > 1) { $condense = false; } } $layout = FabrikHelperHTML::getLayout('fabrik-element-elementlist-details', array(COM_FABRIK_FRONTEND . '/layouts/element')); $displayData = array('uls' => $uls, 'condense' => $condense, 'addHtml' => $addHtml); return $layout->render((object) $displayData); }
<?php // No direct access defined('_JEXEC') or die('Restricted access'); if (!empty($this->tabs)) { ?> <div> <?php echo FabrikHelperHTML::getLayout('fabrik-tabs')->render((object) array('tabs' => $this->tabs)); ?> </div> <?php }
/** * Attach the details view as a PDF to the email * * @param array &$thisAttachments Attachments * * @throws RuntimeException * * @return void */ protected function pdfAttachment(&$thisAttachments) { $params = $this->getParams(); if ($params->get('attach_pdf', 0) == 0) { return; } /** @var FabrikFEModelForm $model */ $model = $this->getModel(); $document = JFactory::getDocument(); $docType = $document->getType(); $document->setType('pdf'); $input = $this->app->input; $orig['details'] = $input->get('view'); $orig['format'] = $input->get('format'); $input->set('view', 'details'); $input->set('format', 'pdf'); // set editable false so things like getFormCss() pick up the detail, not form, CSS $model->setEditable(false); // Ensure the package is set to fabrik $prevUserState = $this->app->getUserState('com_fabrik.package'); $this->app->setUserState('com_fabrik.package', 'fabrik'); try { $model->getFormCss(); foreach ($document->_styleSheets as $url => $ss) { $url = htmlspecialchars_decode($url); $formCss[] = file_get_contents($url); } // Require files and set up DOM pdf require_once JPATH_SITE . '/components/com_fabrik/helpers/pdf.php'; require_once JPATH_SITE . '/components/com_fabrik/controllers/details.php'; FabrikPDFHelper::iniDomPdf(); $domPdf = new DOMPDF(); $size = strtoupper($params->get('pdf_size', 'A4')); $orientation = $params->get('pdf_orientation', 'portrait'); $domPdf->set_paper($size, $orientation); $controller = new FabrikControllerDetails(); /** * $$$ hugh - stuff our model in there, with already formatted data, so it doesn't get rendered * all over again by the view, with unformatted data. Should probably use a setModel() method * here instead of poking in to the _model, but I don't think there is a setModel for controllers? */ $controller->_model = $model; $controller->_model->data = $this->getProcessData(); // Store in output buffer ob_start(); $controller->display(); $html = ob_get_contents(); ob_end_clean(); if (!empty($formCss)) { $html = "<style>\n" . implode("\n", $formCss) . "</style>\n" . $html; } // Load the HTML into DOMPdf and render it. $domPdf->load_html(utf8_decode($html)); $domPdf->render(); // Store the file in the tmp folder so it can be attached $layout = FabrikHelperHTML::getLayout('form.fabrik-pdf-title'); $displayData = new stdClass(); $displayData->doc = $document; $displayData->model = $model; $fileName = $layout->render($displayData); $file = $this->config->get('tmp_path') . '/' . JStringNormalise::toDashSeparated($fileName) . '.pdf'; $pdf = $domPdf->output(); if (JFile::write($file, $pdf)) { $thisAttachments[] = $file; } else { throw new RuntimeException('Could not write PDF file to tmp folder'); } } catch (Exception $e) { $this->app->enqueueMessage($e->getMessage(), 'error'); } // set back to editable $model->setEditable(true); // Set the package back to what it was before rendering the module $this->app->setUserState('com_fabrik.package', $prevUserState); // Reset input foreach ($orig as $key => $val) { $input->set($key, $val); } // Reset document type $document->setType($docType); }
/** * Create bootstrap horizontal tab headings from fieldset labels * Used for rendering viz plugin options * * @param JForm $form Plugin form * @param array &$output Plugin render output * @param int $repeatCounter Repeat count for plugin * * @since 3.1 * * @return void */ protected function renderFromNavTabHeadings($form, &$output, $repeatCounter = 0) { $fieldsets = $form->getFieldsets(); if (count($fieldsets) <= 1) { return; } $tabs = array(); $i = 0; foreach ($fieldsets as $fieldset) { if (isset($fieldset->modal) && $fieldset->modal) { continue; } $tab = new stdClass(); $tab->href = 'tab-' . $fieldset->name . '-' . $repeatCounter; $tab->id = 'tab-' . $fieldset->name; $tab->class = $i === 0 ? 'active' : ''; $tab->label = $fieldset->label; $tabs[] = $tab; $i++; } $displayData = new stdClass(); $displayData->tabs = $tabs; $layout = FabrikHelperHTML::getLayout('fabrik-tabs'); $output[] = $layout->render($displayData); }
<?php /** * Bootstrap List Template: Default Headings * * @package Joomla * @subpackage Fabrik * @copyright Copyright (C) 2005-2015 fabrikar.com - All rights reserved. * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html * @since 3.0 */ // No direct access defined('_JEXEC') or die('Restricted access'); $btnLayout = FabrikHelperHTML::getLayout('fabrik-button'); $layoutData = (object) array('class' => 'btn-info fabrik_filter_submit button', 'name' => 'filter', 'label' => FabrikHelperHTML::icon('icon-filter', FText::_('COM_FABRIK_GO'))); ?> <tr class="fabrik___heading"> <?php foreach ($this->headings as $key => $heading) { $h = $this->headingClass[$key]; $style = empty($h['style']) ? '' : 'style="' . $h['style'] . '"'; ?> <th class="heading <?php echo $h['class']; ?> " <?php echo $style; ?> > <?php echo $heading;
/** * Build the HTML for the plug-in button * * @return string */ public function button_result() { if ($this->canUse()) { $p = $this->onGetFilterKey_result(); $j3 = FabrikWorker::j3(); FabrikHelperHTML::addPath('plugins/fabrik_list/' . $p . '/images/', 'image', 'list'); $name = $this->_getButtonName(); $label = $this->buttonLabel(); $imageName = $this->getImageName(); $tmpl = $this->getModel()->getTmpl(); $properties = array(); $opts = array('forceImage' => false); if (FabrikWorker::isImageExtension($imageName)) { $opts['forceImage'] = true; } $img = FabrikHelperHTML::image($imageName, 'list', $tmpl, $properties, false, $opts); $text = $this->buttonAction == 'dropdown' ? $label : '<span class="hidden">' . $label . '</span>'; if ($j3 && $this->buttonAction != 'dropdown') { $layout = FabrikHelperHTML::getLayout('fabrik-button'); $layoutData = (object) array('tag' => 'a', 'attributes' => 'data-list="' . $this->context . '" title="' . $label . '"', 'class' => $name . ' listplugin btn-default', 'label' => $img . ' ' . $text); return $layout->render($layoutData); } else { $a = '<a href="#" data-list="' . $this->context . '" class="' . $name . ' listplugin" title="' . $label . '">'; return $a . $img . ' ' . $text . '</a>'; } } return ''; }
/** * Create the HTML for a list footer * * @param array $list Pagination list data structure. * * @return string HTML for a list footer */ protected function _list_footer($list) { $limitLabel = $this->showDisplayNum ? FText::_('COM_FABRIK_DISPLAY_NUM') : ''; // Initialize variables $paths = array(); $displayData = new stdClass(); $displayData->id = $this->id; $displayData->label = $limitLabel; $displayData->value = $list['limitstart']; $displayData->list = $list['limitfield']; $displayData->pagesCounter = $list['pagescounter']; $displayData->listName = 'limit' . $this->id; $displayData->links = $list['pageslinks']; $paths[] = JPATH_THEMES . '/' . JFactory::getApplication()->getTemplate() . '/html/layouts/com_fabrik/list_' . $this->id; $layout = FabrikHelperHTML::getLayout('pagination.fabrik-pagination-footer', $paths); return $layout->render($displayData); }
/** * Add tips on element labels * does ACL check on element's label in details setting * * @param string $txt Label * @param array $data Row data * @param string $mode Form/list render context * * @return string Label with tip */ protected function rollover($txt, $data = array(), $mode = 'form') { if (is_object($data)) { $data = ArrayHelper::fromObject($data); } //$title = $this->tipTextAndValidations($mode, $data); //$opts = $this->tipOpts(); //$opts = json_encode($opts); //return $title !== '' ? 'title="' . $title . '" opts=\'' . $opts . '\'' : ''; $layout = FabrikHelperHTML::getLayout('element.fabrik-element-tip'); $displayData = new stdClass(); $displayData->tipTitle = $this->tipTextAndValidations($mode, $data); $displayData->tipText = $txt; $displayData->rollOver = $this->isTipped(); $displayData->isEditable = $this->isEditable(); $displayData->tipOpts = $this->tipOpts(); $rollOver = $layout->render($displayData); return $rollOver; }
/** * Get a list JLayout file * * @param string $type form/details/list * @param array $paths Optional paths to add as includes * * @return FabrikLayoutFile */ public function getLayout($name, $paths = array(), $options = array()) { $paths[] = COM_FABRIK_FRONTEND . '/views/list/tmpl/' . $this->getTmpl() . '/layouts'; $layout = FabrikHelperHTML::getLayout($name, $paths, $options); return $layout; }
/** * Build the advanced search link * * @return string <a href...> link */ public function link() { $model = $this->model; $params = $model->getParams(); if ($params->get('advanced-filter', '0')) { $displayData = new stdClass(); $displayData->url = $this->url(); $displayData->tmpl = $model->getTmpl(); $layout = FabrikHelperHTML::getLayout('list.fabrik-advanced-search-button'); return $layout->render($displayData); } else { return ''; } }
/** * Displays a calendar control field * * hacked from behaviour as you need to check if the element exists * it might not as you could be using a custom template * * @param string $value The date value (must be in the same format as supplied by $format) * @param string $name The name of the text field * @param string $id The id of the text field * @param string $format The date format (not used) * @param array $attribs Additional html attributes * @param int $repeatCounter Repeat group counter (not used) * * @deprecated - use JLayouts instead * * @return string */ public function calendar($value, $name, $id, $format = '%Y-%m-%d', $attribs = null, $repeatCounter = 0) { $j3 = FabrikWorker::j3(); if (is_array($attribs)) { $attribs = ArrayHelper::toString($attribs); } FabrikHelperHTML::addPath(COM_FABRIK_BASE . 'media/system/images/', 'image', 'form', false); $opts = $j3 ? array('alt' => 'calendar') : array('alt' => 'calendar', 'class' => 'calendarbutton', 'id' => $id . '_cal_img'); $img = FabrikHelperHTML::image('calendar.png', 'form', @$this->tmpl, $opts); $html = array(); if ($j3) { $btnLayout = FabrikHelperHTML::getLayout('fabrik-button'); $layoutData = (object) array('class' => 'calendarbutton', 'id' => $id . '_cal_img', 'label' => $img); $img = $btnLayout->render($layoutData); $html[] = '<div class="input-append">'; } $html[] = '<input type="text" name="' . $name . '" id="' . $id . '" value="' . $value . '" ' . $attribs . ' />' . $img; if ($j3) { $html[] = '</div>'; } return implode("\n", $html); }
<?php } if ($this->showCSVImport || $this->showCSV) { ?> <?php $displayData = new stdClass(); $displayData->icon = FabrikHelperHTML::icon('icon-upload'); $displayData->label = FText::_('COM_FABRIK_CSV'); $displayData->links = array(); if ($this->showCSVImport) { $displayData->links[] = '<a href="' . $this->csvImportLink . '" class="csvImportButton">' . FabrikHelperHTML::icon('icon-download', FText::_('COM_FABRIK_IMPORT_FROM_CSV')) . '</a>'; } if ($this->showCSV) { $displayData->links[] = '<a href="#" class="csvExportButton">' . FabrikHelperHTML::icon('icon-upload', FText::_('COM_FABRIK_EXPORT_TO_CSV')) . '</a>'; } $layout = FabrikHelperHTML::getLayout('fabrik-nav-dropdown'); echo $layout->render($displayData); ?> <?php } if ($this->showRSS) { ?> <li> <a href="<?php echo $this->rssLink; ?> " class="feedButton"> <?php echo FabrikHelperHTML::image('feed.png', 'list', $this->tmpl); ?>
/** * Create the form bottom hidden fields * * @param object &$form Object containing form view properties * * @return void */ protected function _loadTmplBottom(&$form) { $input = $this->app->input; $itemId = FabrikWorker::itemId(); /** @var FabrikFEModelForm $model */ $model = $this->getModel(); $listModel = $model->getListModel(); $row = JArrayHelper::toObject($model->data); $canDelete = $listModel->canDelete($row); $params = $model->getParams(); $task = 'form.process'; $refer = $input->server->get('HTTP_REFERER', '', 'string'); // $$$rob - if returning from a failed validation then we should use the fabrik_referrer post var $refer = str_replace('&', '&', $input->get('fabrik_referrer', $refer, 'string')); $thisRowId = is_array($model->getRowId()) ? implode('|', $model->getRowId()) : $model->getRowId(); $fields = array(); $fields[] = '<input type="hidden" name="listid" value="' . $listModel->getId() . '" />'; $fields[] = '<input type="hidden" name="listref" value="' . $listModel->getId() . '" />'; $fields[] = '<input type="hidden" name="rowid" value="' . $thisRowId . '" />'; $fields[] = '<input type="hidden" name="Itemid" value="' . $itemId . '" />'; $fields[] = '<input type="hidden" name="option" value="com_' . $this->package . '" />'; $fields[] = '<input type="hidden" name="task" value="' . $task . '" />'; $fields[] = '<input type="hidden" name="isMambot" value="' . $this->isMambot . '" />'; $fields[] = '<input type="hidden" name="formid" value="' . $model->get('id') . '" />'; $fields[] = '<input type="hidden" name="returntoform" value="0" />'; $fields[] = '<input type="hidden" name="fabrik_referrer" value="' . $refer . '" />'; $fields[] = '<input type="hidden" name="fabrik_ajax" value="' . (int) $model->isAjax() . '" />'; $fields[] = '<input type="hidden" name="package" value="' . $this->app->getUserState('com_fabrik.package', 'fabrik') . '" />'; $fields[] = '<input type="hidden" name="packageId" value="' . $model->packageId . '" />'; if ($useKey = FabrikWorker::getMenuOrRequestVar('usekey', '')) { // $$$rob v's been set from -1 to the actual row id - so ignore usekey not sure if we should comment this out // see http://fabrikar.com/forums/showthread.php?t=10297&page=5 $fields[] = '<input type="hidden" name="usekey" value="' . $useKey . '" />'; $pk_val = FArrayHelper::getValue($model->data, $listModel->getPrimaryKey(true)); if (empty($pk_val)) { $fields[] = '<input type="hidden" name="usekey_newrecord" value="1" />'; } } /** $$$ hugh - testing a fix for pagination issue when submitting a 'search form'. * If this is a search form, we need to clear 'limitstart', otherwise ... say we * were last on page 4 of the (unfiltered) target table, and the search yields less than 4 pages, * we end up with a blank table 'cos the wrong LIMIT's are applied to the query */ $saveInSessions = $params->get('save_insession', ''); if (is_array($saveInSessions)) { foreach ($saveInSessions as $saveInSession) { if ($saveInSession == '1') { $fields[] = '<input type="hidden" name="limitstart" value="0" />'; break; } } } $fields[] = JHTML::_('form.token'); $resetLabel = FText::_($params->get('reset_button_label')); $resetIcon = $params->get('reset_icon', ''); $copyLabel = FText::_($params->get('copy_button_label')); $copyIcon = $params->get('copy_icon', ''); $applyLabel = FText::_($params->get('apply_button_label')); $applyIcon = $params->get('apply_icon', ''); $deleteLabel = FText::_($params->get('delete_button_label', 'Delete')); $deleteIcon = $params->get('delete_icon', ''); $goBackLabel = FText::_($params->get('goback_button_label')); $goBackIcon = $params->get('goback_icon', ''); $btnLayout = FabrikHelperHTML::getLayout('fabrik-button'); if ($resetIcon !== '') { $resetIcon = FabrikHelperHTML::icon($resetIcon); $before = $params->get('reset_icon_location', 'before') == 'before'; $resetLabel = $before ? $resetIcon . ' ' . $resetLabel : $resetLabel . ' ' . $resetIcon; } $layoutData = (object) array('type' => 'reset', 'class' => 'btn-warning button', 'name' => 'Reset', 'label' => $resetLabel); $form->resetButton = $params->get('reset_button', 0) && $this->editable == '1' ? $btnLayout->render($layoutData) : ''; if ($copyIcon !== '') { $copyIcon = FabrikHelperHTML::icon($copyIcon); $copyLabel = $params->get('copy_icon_location', 'before') == 'before' ? $copyIcon . ' ' . $copyLabel : $copyLabel . ' ' . $copyIcon; } $layoutData = (object) array('type' => 'submit', 'class' => 'button', 'name' => 'Copy', 'label' => $copyLabel); $form->copyButton = $params->get('copy_button', 0) && $this->editable && $model->getRowId() != '' ? $btnLayout->render($layoutData) : ''; if ($applyIcon !== '') { $applyIcon = FabrikHelperHTML::icon($applyIcon); $before = $params->get('apply_icon_location', 'before') == 'before'; $applyLabel = $before ? $applyIcon . ' ' . $applyLabel : $applyLabel . ' ' . $applyIcon; } $layoutData = (object) array('type' => $model->isAjax() ? 'button' : 'submit', 'class' => 'button', 'name' => 'apply', 'label' => $applyLabel); $form->applyButton = $params->get('apply_button', 0) && $this->editable ? $btnLayout->render($layoutData) : ''; if ($deleteIcon !== '') { $deleteIcon = FabrikHelperHTML::icon($deleteIcon); $before = $params->get('delete_icon_location', 'before') == 'before'; $deleteLabel = $before ? $deleteIcon . ' ' . $deleteLabel : $deleteLabel . ' ' . $deleteIcon; } $layoutData = (object) array('type' => 'submit', 'class' => 'btn-danger button', 'name' => 'delete', 'label' => $deleteLabel); $form->deleteButton = $params->get('delete_button', 0) && $canDelete && $this->editable && $thisRowId != '' ? $btnLayout->render($layoutData) : ''; if ($goBackIcon !== '') { $goBackIcon = FabrikHelperHTML::icon($goBackIcon); $before = $params->get('goback_icon_location', 'before') == 'before'; $goBackLabel = $before ? $goBackIcon . ' ' . $goBackLabel : $goBackLabel . ' ' . $goBackIcon; } $layoutData = (object) array('type' => 'button', 'class' => 'button', 'name' => 'Goback', 'label' => $goBackLabel, 'attributes' => $model->isAjax() ? '' : FabrikWorker::goBackAction()); $form->gobackButton = $params->get('goback_button', 0) ? $btnLayout->render($layoutData) : ''; if ($model->isEditable() && $params->get('submit_button', 1)) { $submitClass = FabrikString::clean($form->submit_button_label); $submitIcon = $params->get('save_icon', ''); $submitLabel = FText::_($form->submit_button_label); if ($submitIcon !== '') { $submitIcon = FabrikHelperHTML::icon($submitIcon); $before = $params->get('save_icon_location', 'before') == 'before'; $submitLabel = $before ? $submitIcon . ' ' . $submitLabel : $submitLabel . ' ' . $submitIcon; } $layoutData = (object) array('type' => $model->isAjax() ? 'button' : 'submit', 'class' => 'btn-primary button ' . $submitClass, 'name' => 'Submit', 'label' => $submitLabel); $form->submitButton = $btnLayout->render($layoutData); } else { $form->submitButton = ''; } if ($this->isMultiPage) { $layoutData = (object) array('type' => 'button', 'class' => 'fabrikPagePrevious button', 'name' => 'fabrikPagePrevious', 'label' => FabrikHelperHTML::icon('icon-previous', FText::_('COM_FABRIK_PREV'))); $form->prevButton = $btnLayout->render($layoutData); $layoutData = (object) array('type' => 'button', 'class' => 'fabrikPageNext button', 'name' => 'fabrikPageNext', 'label' => FText::_('COM_FABRIK_NEXT') . ' ' . FabrikHelperHTML::icon('icon-next')); $form->nextButton = $btnLayout->render($layoutData); } else { $form->nextButton = ''; $form->prevButton = ''; } // $$$ hugh - hide actions section is we're printing, or if not actions selected $noButtons = empty($form->nextButton) && empty($form->prevButton) && empty($form->submitButton) && empty($form->gobackButton) && empty($form->deleteButton) && empty($form->applyButton) && empty($form->copyButton) && empty($form->resetButton); $this->hasActions = $input->get('print', '0') == '1' || $noButtons ? false : true; $format = $model->isAjax() ? 'raw' : 'html'; $fields[] = '<input type="hidden" name="format" value="' . $format . '" />'; $groups = $model->getGroupsHiarachy(); foreach ($groups as $groupModel) { if ($groupModel->isJoin()) { $groupPk = $groupModel->getJoinModel()->getForeignId(); // Use raw otherwise we inject the actual <input> into the hidden field's value $groupPk .= '_raw'; $groupRowIds = (array) FArrayHelper::getValue($this->data, $groupPk, array()); $groupRowIds = htmlentities(json_encode($groupRowIds)); // Used to check against in group process(), when deleting removed repeat groups $fields[] = '<input type="hidden" name="fabrik_group_rowids[' . $groupModel->getId() . ']" value="' . $groupRowIds . '" />'; } $group = $groupModel->getGroup(); $c = $groupModel->repeatTotal; // Used for validations $fields[] = '<input type="hidden" name="fabrik_repeat_group[' . $group->id . ']" value="' . $c . '" id="fabrik_repeat_group_' . $group->id . '_counter" />'; } // $$$ hugh - testing social_profile_hash stuff if ($input->get('fabrik_social_profile_hash', '') != '') { $fields[] = '<input type="hidden" name="fabrik_social_profile_hash" value="' . $input->get('fabrik_social_profile_hash', '') . '" id="fabrik_social_profile_hash" />'; } $this->_cryptQueryString($fields); $this->_cryptViewOnlyElements($fields); $this->hiddenFields = implode("\n", $fields); }
/** * Bootstrap Tabs Form Template - group details * * @package Joomla * @subpackage Fabrik * @copyright Copyright (C) 2005-2015 fabrikar.com - All rights reserved. * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html * @since 3.1 */ // No direct access defined('_JEXEC') or die('Restricted access'); $rowStarted = false; $layout = FabrikHelperHTML::getLayout('form.fabrik-control-group'); $gridStartLayout = FabrikHelperHTML::getLayout('grid.fabrik-grid-start'); $gridEndLayout = FabrikHelperHTML::getLayout('grid.fabrik-grid-end'); foreach ($this->elements as $element) { $this->element = $element; $this->class = 'fabrikErrorMessage'; // Don't display hidden element's as otherwise they wreck multi-column layouts if (trim($element->error) !== '') { $element->error = $this->errorIcon . ' ' . $element->error; $element->containerClass .= ' error'; $this->class .= ' help-inline text-danger'; } if ($element->startRow) { echo $gridStartLayout->render(new stdClass()); $rowStarted = true; } $style = $element->hidden ? 'style="display:none"' : ''; $span = $element->hidden ? '' : ' ' . $element->span;
/** * Render an icon using JLayouts * * @param string $icon Icon class name * @param string $label Label * @param string $properties Additional html properties * * @return string */ public static function icon($icon, $label = '', $properties = '') { $icon = FabrikHelperHTML::getLayout('fabrik-icon')->render((object) array('icon' => $icon, 'properties' => $properties)); if ($label != '') { $icon .= ' ' . $label; } return $icon; }
foreach ($d->filters as $key => $filter) { if ($filter->displayValue !== '') { $showClearFilters = true; } } ?> <div data-modal-state-container style="display:<?php echo $showClearFilters ? '' : 'none'; ?> "> <?php echo JText::_('COM_FABRIK_FILTERS_ACTIVE'); ?> <span data-modal-state-display> <?php $layout = FabrikHelperHTML::getLayout('list.fabrik-filters-modal-state-label'); foreach ($d->filters as $key => $filter) { if ($filter->displayValue !== '') { $layoutData = (object) array('label' => $filter->label, 'displayValue' => $filter->displayValue, 'key' => $key); echo $layout->render($layoutData); } } ?> </span> </div> <div class="fabrikFilterContainer modal hide fade" id="filter_modal"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h3><?php echo FabrikHelperHTML::icon('icon-filter', FText::_('COM_FABRIK_FILTER'));