protected function getInput() { if (!defined('VERTEX_LOADED')) { $vertex_admin_path = JURI::root() . 'templates/' . VERTEX_TEMPLATE_NAME . '/vertex/admin'; $template_path = JURI::root(true) . '/templates/' . VERTEX_TEMPLATE_NAME; $document = JFactory::getDocument(); $cmsversion = new JVersion(); $document->addStyleSheet(JURI::root(true) . '/templates/' . VERTEX_TEMPLATE_NAME . '/vertex/admin/vertex.css'); $document->addScript($vertex_admin_path . '/js/vertexAdmin.Loader.js'); $document->setMetaData('meta', 'IE=EmulateIE7', 'X-UA-Compatible'); $session = JFactory::getSession(); $main_path = dirname(dirname(dirname(dirname(__FILE__)))); $lang_dir = dirname(dirname($main_path)) . '/language/'; $Vertex = new vertexAdmin($main_path . '/xml/Vertex.xml', 'sienna', $main_path . '/xml/Specific.xml', $lang_dir, $vertex_admin_path . '/df-images', $cmsversion->RELEASE); $Vertex->loadTD(); vertex_fix('joomla3', $document); if ($cmsversion->RELEASE <= 2.5) { require_once dirname(dirname(__FILE__)) . '/spec/JLegacy.php'; } else { require_once dirname(dirname(__FILE__)) . '/spec/JCurrent.php'; } $script = "\n"; $script .= "var vertex_ajax_url = '{$vertex_admin_path}';"; $script .= "var img_path = '{$vertex_admin_path}/df-images';"; $script .= "var json_path = '{$template_path}/vertex.json';"; $script .= "var vertex_version = '2.1';"; $script .= "var vertex_cmsversion = '{$cmsversion->RELEASE}';"; $script .= "var vertexNoAdd = " . json_encode($Vertex->noAdd) . ";\n"; $script .= $sjs; $document->addScriptDeclaration($script); $table = JForm::getFieldsets('adminform'); $data = null; foreach ((array) $this->form as $key => $val) { if ($val instanceof JRegistry) { $data =& $val; break; } } $title = $data->toArray(); $title = $title['title']; $html = $Vertex->vertexLoadAdmin($title); define('VERTEX_LOADED', true); // Output return $html; } }
/** * * get controls array from form * get all groups on the way * @param JForm $form */ private static function getControlsFromForm(JForm $form) { $fieldsets = $form->getFieldsets(); self::$arrGroupsAssoc = array(); $arrControls = array(); foreach ($fieldsets as $key => $fieldsetObj) { $fieldset = $form->getFieldset($key); foreach ($fieldset as $fieldName => $field) { $group = (string) $field->group; if (!empty($group)) { self::$arrGroupsAssoc[$field->group] = ""; } if ($field->type == "control") { //get controls array from the control (can be multiple children) $controls = $field->getControlFields(); foreach ($controls as $control) { $arrControls[] = $control; } //end control foreach } } } return $arrControls; }
/** * 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; } $output[] = '<div class="row-fluid">'; $output[] = '<ul class="nav nav-tabs">'; $i = 0; foreach ($fieldsets as $fieldset) { if (isset($fieldset->modal) && $fieldset->modal) { continue; } $class = $i === 0 ? ' class="active"' : ''; $id = 'tab-' . $fieldset->name; $id .= '-' . $repeatCounter; $output[] = '<li' . $class . '> <a data-toggle="tab" href="#' . $id . '"> ' . JText::_($fieldset->label) . ' </a> </li>'; $i++; } $output[] = '</ul>'; $output[] = '</div>'; }
protected function getInput() { if (!function_exists('xtcsortfn')) { function xtcsortfn($a, $b) { return strnatcmp($a[0], $b[0]); } } jimport('joomla.filesystem.folder'); JHTML::_('behavior.modal', 'a.modal'); $live_site = JURI::root(); $template = basename(dirname(dirname(dirname(__FILE__)))); $document = JFactory::getDocument(); $id = JRequest::getInt('id'); $document->addStyleSheet($live_site . "templates/{$template}/XTC/XTC.css", 'text/css'); $path = JPATH_ROOT . '/templates/' . $template; $files = JFolder::files($path . '/parameters', 'xml'); $onopen = "var iSize;\n var iFrame = this.asset;\n iFrame.addEvent('load', function(){\n var iBody = (iFrame.contentDocument) ? iFrame.contentDocument.getElementsByTagName('body')[0] : iFrame.contentWindow.document.getElementsByTagName('body')[0];\n\n\t iSize = {x:this.size.x, y:iBody.offsetHeight};\n var per = (window.innerHeight * 0.9).toInt();\n iSize.y = (iSize.y > per) ? per : iSize.y ;\n iFrame.setStyles({'height':'100%'});\n\n this.resize(iSize, false);\n }.bind(this));"; $parmsfound = false; $prefix = trim($this->element['group']); $label = trim($this->element['label']); $parameters = array(); foreach ($files as $file) { @(list($filename, $extension) = explode('.', $file, 2)); if ($extension != 'xml') { continue; } // Not an XML if (strpos($filename, $prefix) !== 0) { continue; } // Not the right prefix $xmlFile = $path . '/parameters/' . $file; if (is_readable($xmlFile)) { $xml = simplexml_load_file($xmlFile); $name = isset($xml->name) ? $xml->name : $filename; $description = isset($xml->description) ? trim($xml->description) : ''; } else { $name = $filename; $description = ''; } $thumbnail = ''; if (file_exists($path . '/parameters/' . $filename . '.gif')) { $thumbnail = $filename . '.gif'; } elseif (file_exists($path . '/parameters/' . $filename . '.jpg')) { $thumbnail = $filename . '.jpg'; } elseif (file_exists($path . '/parameters/' . $filename . '.png')) { $thumbnail = $filename . '.png'; } $fullimage = ''; if (file_exists($path . '/parameters/' . $filename . '_full.gif')) { $fullimage = $filename . '_full.gif'; } elseif (file_exists($path . '/parameters/' . $filename . '_full.jpg')) { $fullimage = $filename . '_full.jpg'; } elseif (file_exists($path . '/parameters/' . $filename . '_full.png')) { $fullimage = $filename . '_full.png'; } $parameters[] = array($name, $filename, $description, $thumbnail, $fullimage); } usort($parameters, "xtcsortfn"); $stringFilter = JFilterInput::getInstance(); require_once $path . '/XTC/XTC_library.php'; $templateParameters = xtcLoadParams($id); $html = ''; $navHtml = ''; $tabHtml = ''; $count = count($parameters); $openClass = $count == 1 ? ' open' : ''; foreach ($parameters as $i => $parameter) { // Draw parameters list($name, $filename, $description, $thumbnail, $fullimage) = $parameter; $params = isset($templateParameters->group->{$filename}) ? $templateParameters->group->{$filename} : new stdClass(); $tabid = $filename . $i; // Parameter Tab $active = $i == 0 ? ' class="active"' : ''; $navHtml .= '<li' . $active . '>'; $navHtml .= '<a href="#' . $tabid . '" data-toggle="tab">'; if ($thumbnail) { $thumbnailURL = $live_site . 'templates/' . $template . '/parameters/' . $thumbnail; $navHtml .= '<img class="img-rounded" src="' . $thumbnailURL . '" alt="" /><br/>'; } $navHtml .= '<center>' . $name . '</center>'; $navHtml .= '</a>'; $navHtml .= '</li>'; // Parameter Tab contents $form = new JForm('jxtc'); $form->addFieldPath(JPATH_ROOT . '/templates/' . $template . '/XTC/elements'); $xmlFile = $path . '/parameters/' . $filename . '.xml'; $form->loadFile($xmlFile); $getFieldsets = $form->getFieldsets(); $active = $i == 0 ? ' active' : ''; $tabHtml .= '<div class="tab-pane' . $active . '" id="' . $tabid . '">'; $tabHtml .= '<div class="xtc row-fluid">'; $tabHtml .= '<div class="span5">'; foreach ($getFieldsets as $fieldsets => $fieldset) { $label = trim($fieldset->label); if (empty($label)) { $label = trim($fieldset->name); } $fieldsetDescription = isset($fieldset->description) ? trim($fieldset->description) : ''; if (count($getFieldsets) > 1) { $tabHtml .= '<fieldset>'; if ($label) { $tabHtml .= '<legend>' . $label . '</legend>'; } if ($fieldsetDescription) { $tabHtml .= '<div class="well">' . $fieldsetDescription . '</div>'; } } foreach ($form->getFieldset($fieldset->name) as $field) { $xtcName = substr($field->name, 7, -1); if (isset($params->{$xtcName})) { $field->value = $params->{$xtcName}; } $field->name = str_replace('params[', 'xtcparam[' . $prefix . '][' . $filename . '][', $field->name); $field->id = $stringFilter->clean($field->name, 'cmd'); $tabHtml .= '<div class="control-group">'; $tabHtml .= '<div class="control-label">' . $field->getLabel() . '</div>'; $tabHtml .= '<div class="controls">' . $field->getInput() . '</div>'; $tabHtml .= '</div>'; } if (count($getFieldsets) > 1) { $tabHtml .= '</fieldset>'; } } $tabHtml .= '</div>'; // span5 if ($description || $fullimage) { $tabHtml .= '<div class="span1"></div>'; $tabHtml .= '<div class="span4"><div class="well">'; $tabHtml .= '<h3>' . $name . '</h3>'; if ($description) { $tabHtml .= $description . '<br/><br/>'; } if ($fullimage) { $fullimageURL = $live_site . 'templates/' . $template . '/parameters/' . $fullimage; $headerimg_size = getimagesize($path . '/layouts/' . $folder . '/' . $fullimage); $width = $headerimg_size[0]; $height = $headerimg_size[1]; $onclick = "onclick=\"MyWindow=window.open('{$fullimageURL}','_blank','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width={$width},height={$height}'); return false;\""; $tabHtml .= '<a class="btn btn-primary" href="#" ' . $onclick . '>' . JText::_('TPL_JXTC_VIEWLAYOUT') . '</a>'; } $tabHtml .= '</div></div>'; } $tabHtml .= '</div>'; // row-fluid $tabHtml .= '</div>'; // tab-pane } $html .= '<div class="tabbable">'; $html .= '<ul class="nav nav-tabs">' . $navHtml . '</ul>'; $html .= '<div class="tab-content">' . $tabHtml . '</div>'; $html .= '</div>'; return $html; }
function getInput() { $formRegistration = new JForm('com_users.registration'); $formProfile = new JForm('com_users.registration'); $plugin = JPluginHelper::getPlugin('user', 'profile'); //load language com_user and plugin profile $language = JFactory::getLanguage(); $language_tag = $language->getTag(); JFactory::getLanguage()->load('lib_joomla', JPATH_SITE, $language_tag, true); JFactory::getLanguage()->load('com_users', JPATH_SITE, $language_tag, true); JFactory::getLanguage()->load('plg_user_profile', JPATH_ADMINISTRATOR, $language_tag, true); // Add the registration fields to the form. $formRegistration->loadFile(JPATH_ROOT . '/components/com_users/models/forms/registration.xml', false); // remove unused fiels of registrer form $formRegistration->removeField('captcha'); $formRegistration->removeField('spacer'); $formRegistration->removeField('password1'); $formRegistration->removeField('password2'); $formRegistration->removeField('email2'); //setting list box $class = $this->element['class'] ? (string) $this->element['class'] : ''; $social = $this->element['social'] ? (string) $this->element['social'] : ''; $html = '<ul class="profile-fields ' . $class . '" id="' . $this->id . '" version="' . JVERSION . '">'; $options = array(); switch ($social) { case 'facebook': $options[] = JHtml::_('select.option', '', JText::_('JNONE')); $options[] = JHtml::_('select.option', 'id', JText::_('ID')); $options[] = JHtml::_('select.option', 'name', 'Name'); $options[] = JHtml::_('select.option', 'username', 'Username'); $options[] = JHtml::_('select.option', 'email', 'Email'); $options[] = JHtml::_('select.option', 'link', 'Profile link'); //$options[] = JHtml::_('select.option', 'picture', 'Profile Picture'); $options[] = JHtml::_('select.option', 'birthday', 'Date of birth'); $options[] = JHtml::_('select.option', 'location', 'Location'); $options[] = JHtml::_('select.option', 'hometown', 'Hometown'); $options[] = JHtml::_('select.option', 'website', 'Website'); $options[] = JHtml::_('select.option', 'bio', 'About me'); $options[] = JHtml::_('select.option', 'quotes', 'Favorite Quotes'); break; case 'google': $options[] = JHtml::_('select.option', '', JText::_('JNONE')); $options[] = JHtml::_('select.option', 'id', JText::_('ID')); $options[] = JHtml::_('select.option', 'name', 'Name'); $options[] = JHtml::_('select.option', 'username', 'Username'); $options[] = JHtml::_('select.option', 'email', 'Email'); $options[] = JHtml::_('select.option', 'link', 'Profile link'); //$options[] = JHtml::_('select.option', 'picture', 'Profile Picture'); $options[] = JHtml::_('select.option', 'birthday', 'Date of birth'); break; case 'twitter': $options[] = JHtml::_('select.option', '', JText::_('JNONE')); $options[] = JHtml::_('select.option', 'id', JText::_('ID')); $options[] = JHtml::_('select.option', 'name', 'Name'); $options[] = JHtml::_('select.option', 'username', 'Screen Name'); $options[] = JHtml::_('select.option', 'link', 'Profile link'); //$options[] = JHtml::_('select.option', 'picture', 'Profile Picture'); $options[] = JHtml::_('select.option', 'birthday', 'Date of birth'); $options[] = JHtml::_('select.option', 'location', 'Location'); $options[] = JHtml::_('select.option', 'website', 'Website'); $options[] = JHtml::_('select.option', 'bio', 'Description'); $options[] = JHtml::_('select.option', 'status', 'Status'); break; } //add field from register form foreach ($formRegistration->getFieldsets() as $fieldset) { $fields = $formRegistration->getFieldset($fieldset->name); if (count($fields)) { foreach ($fields as $field) { $html .= '<li class="control-group">' . $field->getLabel(); if ($field->fieldname == 'name') { $html .= JHtml::_('select.genericlist', $options, '', 'class="name control-group"', 'value', 'text', 'name'); } elseif ($field->fieldname == 'username') { $html .= JHtml::_('select.genericlist', $options, '', 'class="username control-group"', 'value', 'text', $social == 'google' ? 'email' : 'username'); } elseif ($field->fieldname == 'email1') { $html .= JHtml::_('select.genericlist', $options, '', 'class="email1 control-group" disabled="disabled"', 'value', 'text', 'email'); if ($social == 'twitter') { $html .= '<br /><span style="color:red;line-height:200%">The Twitter API does not provide the user\'s email address. So if you turn off "editing email" the twitter users will have email type: screen_name@twitter.com</span>'; } } } } } //load fields of plugin profile if ($plugin != null) { $params = new JRegistry(); $params->loadString($plugin->params); $formProfile->loadFile(JPATH_ROOT . '/plugins/user/profile/profiles/profile.xml', false); $fields = array('address1', 'address2', 'city', 'region', 'country', 'postal_code', 'website', 'favoritebook', 'aboutme', 'dob'); //remove field unused $formProfile->removeField('tos', 'profile'); //$formProfile->removeField('city','profile'); //$formProfile->removeField('region','profile'); //$formProfile->removeField('country','profile'); $formProfile->removeField('postal_code', 'profile'); $formProfile->removeField('favoritebook', 'profile'); $formProfile->removeField('phone', 'profile'); //remove field disable in profile form foreach ($fields as $field) { if ($params->get('register-require_' . $field, 1) > 0) { $formProfile->setFieldAttribute($field, 'required', $params->get('register-require_' . $field) == 2 ? 'required' : '', 'profile'); } else { $formProfile->removeField($field, 'profile'); } } foreach ($formProfile->getFieldsets() as $fieldset) { $fields = $formProfile->getFieldset($fieldset->name); if (count($fields)) { $html .= '<li class="control-group"><h3 class="enable_profile_1">Profile plugin:</h3></li>'; foreach ($fields as $field) { $html .= '<li class="control-group">' . $field->getLabel(); if ($field->fieldname == 'address1') { $html .= JHtml::_('select.genericlist', $options, '', 'class="profile_address1 enable_profile_1"', 'value', 'text', 'location'); } elseif ($field->fieldname == 'address2') { $html .= JHtml::_('select.genericlist', $options, '', 'class="profile_address2 enable_profile_1"', 'value', 'text', ''); } elseif ($field->fieldname == 'city') { $html .= JHtml::_('select.genericlist', $options, '', 'class="profile_city enable_profile_1"', 'value', 'text', 'hometown'); } elseif ($field->fieldname == 'region') { $html .= JHtml::_('select.genericlist', $options, '', 'class="profile_region enable_profile_1"', 'value', 'text', ''); } elseif ($field->fieldname == 'country') { $html .= JHtml::_('select.genericlist', $options, '', 'class="profile_country enable_profile_1"', 'value', 'text', ''); } elseif ($field->fieldname == 'website') { $html .= JHtml::_('select.genericlist', $options, '', 'class="profile_website enable_profile_1"', 'value', 'text', 'website'); } elseif ($field->fieldname == 'aboutme') { $html .= JHtml::_('select.genericlist', $options, '', 'class="profile_aboutme enable_profile_1"', 'value', 'text', 'bio'); } elseif ($field->fieldname == 'dob') { $html .= JHtml::_('select.genericlist', $options, '', 'class="profile_dob enable_profile_1"', 'value', 'text', 'birthday'); } } } } } $html .= "</ul>"; $html .= '<input class="socialinput" type="hidden" name="' . $this->name . '" value="' . $this->value . '" />'; return $html; }
/** * Updates the component configuration. * It first fetches the config.xml file & reads all entries there. * Then we load the current component parameters from the db * and merge them with the .xml file. This way we ensure that * the db has all the current values for each setting even if the * user doesn't edit his config. * * @return array - the parameters */ public function updateConfiguration() { $settings = JPATH_ADMINISTRATOR . '/components/' . $this->component . '/config.xml'; $json = array(); $form = new JForm('config'); $form->loadFile($settings, true, '/config'); $params = JComponentHelper::getParams($this->component)->toArray(); $fieldsets = $form->getFieldsets(); foreach ($fieldsets as $fieldsetkey => $fieldset) { $fields = $form->getFieldset($fieldsetkey); foreach ($fields as $fieldkey => $field) { // If we have a group for this field, use it! if ($field->group) { $json[$field->group][$field->fieldname] = $field->value; } else { $json[$field->fieldname] = $field->value; } } } $merged = array_merge($json, $params); $this->updateParams($merged); return $merged; }
/** * Method to store parameters as LESS variables * * @access public * @return boolean True on success * @since 1.5 */ function storeLessConf($folder, $cfgname, $layout, $attribs) { // Load the XML file into a JForm object $jform = new JForm('com_flexicontent.template.category', array('control' => 'jform', 'load_data' => true)); $jform->load($this->_getLayout()->params); // params is the XML file contents as a string $layout_type = $layout == 'items' ? 'item' : 'category'; $tmpldir = JPath::clean(JPATH_ROOT . DS . 'components' . DS . 'com_flexicontent' . DS . 'templates'); $less_path = JPath::clean($tmpldir . DS . $folder . DS . 'less/include/config_auto_' . $layout_type . '.less'); //echo "<pre>".$less_path."<br/>"; $var_pfx = '@FC' . ($layout == 'items' ? 'I' : 'C') . '_'; // Get 'attribs' fieldset $fieldSets = $jform->getFieldsets($groupname = 'attribs'); // Iterate though the form elements and only use parameters with cssprep="less" $less_data = "/* This is created automatically, do NOT edit this manually! \nThis is used by " . $layout_type . " layout to save parameters as less variables. \nNOTE: Make sure that this is imported by 'config.less' \n to make a parameter be a LESS variable, edit parameter in " . $layout_type . ".xml and add cssprep=\"less\" \n created parameters will be like: @FC" . ($layout == 'items' ? 'I' : 'C') . "_parameter_name: value; */\n\n"; foreach ($jform->getFieldsets($groupname) as $fsname => $fieldSet) { foreach ($jform->getFieldset($fsname) as $field) { if ($field->getAttribute('cssprep') != 'less') { continue; } // Only add parameters meant to be less variables if (is_array($attribs[$field->fieldname])) { continue; } // array parameters not supported $v = trim($attribs[$field->fieldname]); if (!strlen($v)) { $v = $field->getAttribute('default'); if (!strlen($v)) { continue; } // do not add empty parameters } $less_data .= $var_pfx . $field->fieldname . ': ' . $v . ";\n"; } } file_put_contents($less_path, $less_data); return true; }
/** * Display our CMC fields at the registration * * @param object $tab - The tab * @param JUser $user - The user * @param object $ui - The UI * @param object $postdata - The postdata * * @return string */ public function getDisplayRegistration($tab, $user, $ui, $postdata) { JHtml::_('stylesheet', JURI::root() . 'media/mod_cmc/css/cmc.css'); CompojoomHtmlBehavior::jquery(); $plugin = GetCmcTab::getPlugin(); $listid = $plugin->params->get('listid', ""); $interests = $plugin->params->get('interests', ''); $fields = $plugin->params->get('fields', ''); // Create the xml for JForm $builder = CmcHelperXmlbuilder::getInstance($plugin->params); // Load JS & Co JFactory::getDocument()->addScriptDeclaration("\n\t\t\tjQuery(document).ready(function(){\n\t\t\t\tvar \$ = jQuery;\n\n\t\t\t\t\$('#cmc_check_newsletter').on('click', function() {\n\t\t\t\t\tif(\$(this).prop('checked'))\n\t\t\t\t\t{\n\t\t\t\t\t\t\$('input.cmc_req').addClass('required');\n\t\t\t\t\t\t\$('#cmc_newsletter').show();\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\t\$('input.cmc_req').removeClass('required');\n\t\t\t\t\t\t\$('#cmc_newsletter').hide();\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\t\$('#cmc_newsletter').hide();\n\t\t\t});\n\t\t"); // We have to set the fields / interests manually for cb because they are no array! See explode if (!empty($fields)) { $fields = explode("|*|", $plugin->params->get('fields', '')); $builder->fields = $fields; } if (!empty($interests)) { $interests = explode("|*|", $plugin->params->get('interests', '')); $builder->interests = $interests; } $xml = $builder->build(); $form = new JForm('myform'); $form->addFieldPath(JPATH_ADMINISTRATOR . '/components/com_cmc/models/fields'); $form->load($xml); $fieldsets = $form->getFieldsets(); $ret = '<div class="cbFieldsContentsTab">'; $ret .= '<div class="sectiontableentry1 cbft_predefined cbtt_input form-group cb_form_line clearfix">'; $ret .= '<label for="name" id="cblabname" class="control-label col-sm-3">' . JText::_('PLG_CMCCB_SUBSCRIPTION') . '</label>'; $ret .= '<div class="cb_field col-sm-9">'; $ret .= '<input type="checkbox" name="cmc[newsletter]" id="cmc_check_newsletter" value="1" /> '; $ret .= '<label for="cmc_check_newsletter" id="cmc_newsletter_lbl">' . JText::_('PLG_CMCCB_NEWSLETTER') . '</label>'; $ret .= "</div>\n"; $ret .= "</div>"; $ret .= "<div id='cmc_td_newsletter' style='' class=\"cbFieldsContentsTab\">\n"; $ret .= "<div id=\"cmc_newsletter\" style=\"display: block;\">\n"; // Render Content foreach ($fieldsets as $key => $value) { if ($key != "cmc") { $ret .= '<div class="sectiontableentry1 cbft_predefined cbtt_input form-group cb_form_line clearfix">'; $ret .= '<label class="col-sm-12">' . JText::_($value->label) . '</label>'; $ret .= '</div>'; $fields = $form->getFieldset($key); foreach ($fields as $field) { $ret .= '<div class="sectiontableentry1 cbft_predefined cbtt_input form-group cb_form_line clearfix">'; $ret .= '<div class="control-label col-sm-3">' . $field->label . '</div>'; $ret .= '<div class="cb_field col-sm-9">'; $ret .= $field->input; $ret .= '</div>'; $ret .= '</div>'; } } } $ret .= '<input type="hidden" name="cmc[listid]" id="cmc_listid" value="' . $listid . '" />'; // End open tables / divs $ret .= "</div>\n"; $ret .= "</div>\n"; return $ret; }
<?php JHtml::_('behavior.formvalidation'); JHtml::_('behavior.keepalive'); JHtml::_('formbehavior.chosen', 'select'); jimport('joomla.form.form'); $session = JFactory::getSession(); $modid = $module->id; $defaultparams = JPath::clean(JPATH_ADMINISTRATOR . '/modules/mod_quickpublish/form/comcontent.xml'); $data = ''; if (JFile::exists($defaultparams)) { JForm::addFormPath(JPath::clean(JPATH_ADMINISTRATOR . '/modules/mod_quickpublish/form')); $form = new JForm('quickpublishcomponents'); $form->loadFile('comcontent', false); $form->bind($data); $fieldSets = $form->getFieldsets('quickpublishcomponents'); foreach ($fieldSets as $name => $fieldSet) { //var_dump($name); ?> <div class="row-fluid"> <div class="span12"> <form id="modquickpublish<?php echo $name; ?> " name="modquickpublish<?php echo $name; ?> " action="index.php"> <?php foreach ($form->getFieldset($name) as $field) {
/** * Render the initial plugin options, such as the plugin selector, and whether its rendered in front/back/both etc * * @return string */ public function top() { $data = $this->getData(); $c = $this->getState('c') + 1; $str = array(); $str[] = '<div class="pane-slider content pane-down">'; $str[] = '<fieldset class="adminform pluginContanier" id="formAction_' . $c . '"><ul>'; $formName = 'com_fabrik.' . $this->getState('type') . '-plugin'; $topForm = new JForm($formName, array('control' => 'jform')); $topForm->repeatCounter = $c; $xmlFile = JPATH_SITE . '/administrator/components/com_fabrik/models/forms/' . $this->getState('type') . '-plugin.xml'; // Add the plugin specific fields to the form. $topForm->loadFile($xmlFile, false); $topForm->bind($data); // Filer the forms fieldsets for those starting with the correct $serachName prefix foreach ($topForm->getFieldsets() as $fieldset) { if ($fieldset->label != '') { $str[] = '<legend>' . $fieldset->label . '</legend>'; } foreach ($topForm->getFieldset($fieldset->name) as $field) { $str[] = '<li>' . $field->label . $field->input . '</li>'; } } $str[] = '</ul>'; $str[] = '<div class="pluginOpts" style="clear:left"></div>'; $str[] = '<a href="#" class="delete removeButton">' . JText::_('COM_FABRIK_DELETE') . '</a>'; $str[] = '</fieldset>'; $str[] = '</div>'; return implode("\n", $str); }
/** * Method to get the field input markup. * * @return string The field input markup. */ function getInput() { $jdoc = JFactory::getDocument(); if (version_compare(JVERSION, '3.0', 'lt')) { $jdoc->addScript('http://code.jquery.com/jquery-latest.js'); // add bootstrap for Joomla 2.5 if (defined('T3_ADMIN_URL')) { $jdoc->addStyleSheet(T3_ADMIN_URL . '/admin/bootstrap/css/bootstrap.min.css'); $jdoc->addScript(T3_ADMIN_URL . '/admin/bootstrap/js/bootstrap.min.js'); } } // add font awesome 4 if (defined('T3_ADMIN_URL')) { $jdoc->addStyleSheet(T3_ADMIN_URL . '/admin/fonts/fa4/css/font-awesome.min.css'); } $jdoc->addStyleSheet(JUri::root(true) . '/modules/mod_ja_acm/admin/assets/style.css'); $jdoc->addStyleSheet('//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css'); $jdoc->addScript('//code.jquery.com/ui/1.11.1/jquery-ui.js'); $jdoc->addScript(JUri::root(true) . '/modules/mod_ja_acm/admin/assets/script.js'); // load all xml $paths = array(); $paths['_'] = JPATH_ROOT . '/modules/mod_ja_acm/acm/'; // template folders $tpls = JFolder::folders(JPATH_ROOT . '/templates/'); foreach ($tpls as $tpl) { $paths[$tpl] = JPATH_ROOT . '/templates/' . $tpl . '/acm/'; } $fields = array(); $group_types = array(); $group_layouts = array(); foreach ($paths as $template => $path) { if (!is_dir($path)) { continue; } $types = JFolder::folders($path); if (!is_array($types)) { continue; } $group_types[$template] = array(); // get layout for each type foreach ($types as $type) { if (!isset($group_layouts[$type])) { $group_layouts[$type] = array(); } if (!is_dir($path . $type . '/tmpl')) { continue; } $layouts = JFolder::files($path . $type . '/tmpl', '.php'); if (is_array($layouts)) { foreach ($layouts as $layout) { $layout = JFile::stripExt($layout); $group_layouts[$type][] = $layout; } } } foreach ($types as $type) { $lname = $type; if (is_file($path . $type . '/config.xml')) { $form = new JForm($lname); // $form->loadFile ($path . $type . '/config.xml', false); $xml = JFactory::getXML($path . $type . '/config.xml', true); $form->load($xml, false); $fieldsets = $form->getFieldsets(); /* $fieldsets_html = array(); if (!is_array($fieldsets)) continue; foreach ($fieldsets as $fsname => $fieldset) { $fieldsets_html[$fsname] = $this->renderFieldSet ($form, $fsname); } */ $title = isset($xml->title) ? $xml->title : $lname; $description = isset($xml->description) ? $xml->description : ''; $sampledata = isset($xml->sampledata) ? $xml->sampledata : ''; $group_types[$template][$lname] = $title; $fields[$lname] = $this->renderLayout('jaacm-type', array('form' => $form, 'fieldsets' => $fieldsets, 'type' => $type, 'layouts' => $group_layouts[$type], 'description' => $description, 'sample-data' => $sampledata)); /* $fields[$lname] = $this->renderConfig('layout-config', array('form' => $form, 'fieldsets' => $fieldsets, 'type' => $type, 'layouts' => $group_layouts[$type], 'description' => $description, 'sample-data' => $sampledata), JPATH_ROOT); */ } } } $html = ''; $html .= "\n<input type=\"hidden\" name=\"{$this->name}\" id=\"jatools-config\" value=\"" . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . "\" />"; $html .= $this->renderLayout('jaacm', array('group_types' => $group_types, 'fields' => $fields)); // $html .= $this->renderConfig('layouts-config', array('group_types' => $group_types, 'fields' => $fields), JPATH_ROOT); return $html; }
/** * 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); }
protected function getInput() { jimport('joomla.html.parameter'); jimport('joomla.html.pane'); $id = JRequest::getInt('id'); $live_site = JURI::root(); $template = basename(dirname(dirname(dirname(__FILE__)))); $path = JPATH_ROOT . '/templates/' . $template; $document = JFactory::getDocument(); $document->addStyleSheet($live_site . "templates/{$template}/XTC/XTC.css", 'text/css'); $xmlFile = JPATH_ROOT . '/templates/' . $template . '/XTC/XTC_config.xml'; if (!is_readable($xmlFile)) { return "No parameters found."; } else { if (is_readable($xmlFile)) { $xml = simplexml_load_file($xmlFile); $name = isset($xml->name) ? $xml->name : ''; $description = isset($xml->description) ? trim($xml->description) : ''; } else { $name = ''; $description = ''; } } $form = new JForm('jxtc'); $form->addFieldPath(JPATH_ROOT . '/templates/' . $template . '/XTC/elements'); $form->loadFile($xmlFile); $getFieldsets = $form->getFieldsets(); require_once $path . '/XTC/XTC_library.php'; $templateParameters = xtcLoadParams($id); $html = ''; $html .= '<div class="xtc row-fluid">'; $html .= '<div class="span5">'; foreach ($getFieldsets as $fieldsets => $fieldset) { $label = trim($fieldset->label); if (empty($label)) { $label = trim($fieldset->name); } $fieldsetDescription = isset($fieldset->description) ? trim($fieldset->description) : ''; if (count($getFieldsets) > 1) { // Split in xtc fieldsets $html .= '<fieldset>'; if ($label) { $html .= '<legend>' . $label . '</legend>'; } if ($fieldsetDescription) { $html .= '<div>' . $fieldsetDescription . '</div>'; } } foreach ($form->getFieldset($fieldset->name) as $field) { $xtcName = substr($field->name, 7, -1); if (isset($templateParameters->{$xtcName})) { $field->value = $templateParameters->{$xtcName}; } $field->name = str_replace('params[', 'jform[params][', $field->name); $html .= '<div class="control-group">'; $html .= '<div class="control-label">' . $field->getLabel() . '</div>'; $html .= '<div class="controls">' . $field->getInput() . '</div>'; $html .= '</div>'; } if (count($getFieldsets) > 1) { $html .= '</fieldset>'; } } $html .= '</div>'; //span if ($description) { $html .= '<div class="span1"></div>'; $html .= '<div class="span4">'; $html .= '<h3>' . $name . '</h3>'; $html .= '<div class="well">' . $description . '</div></div>'; } $html .= '</div>'; // row-fluid $html .= '<script type="text/javascript"> original = Joomla.submitbutton; Joomla.submitbutton = function(task) { if (task == "style.apply" || task == "style.save" || task == "style.save2copy") { form = document.getElementById("style-form"); form.action="index.php?option=com_jxtc&id=' . JRequest::getInt('id') . '" form.task.value = task.substr(6); form.submit(); } else { original(task); } } function switchpane(name) { pane = document.getElementById(name); if (pane.className == "xtcPane") { pane.setAttribute("class", "xtcPane open"); } else { pane.setAttribute("class", "xtcPane"); } } </script>'; return $html; }
/** * Method to get the field input markup. * * @return string The field input markup. */ function getInput() { $jdoc = JFactory::getDocument(); if (version_compare(JVERSION, '3.0', 'lt')) { $jdoc->addScript('//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'); // add bootstrap for Joomla 2.5 if (defined('T3_ADMIN_URL')) { $jdoc->addStyleSheet(T3_ADMIN_URL . '/admin/bootstrap/css/bootstrap.min.css'); $jdoc->addScript(T3_ADMIN_URL . '/admin/bootstrap/js/bootstrap.min.js'); } } // add font awesome 4 if (defined('T3_ADMIN_URL')) { $jdoc->addStyleSheet(T3_ADMIN_URL . '/admin/fonts/fa4/css/font-awesome.min.css'); } //$jdoc->addStyleSheet('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css'); //$jdoc->addScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js'); // jBox library $jdoc->addScript(JUri::root(true) . '/modules/mod_ja_acm/admin/assets/jBox/jBox.min.js'); $jdoc->addStyleSheet(JUri::root(true) . '/modules/mod_ja_acm/admin/assets/jBox/jBox.css'); $jdoc->addScript(JUri::root(true) . '/modules/mod_ja_acm/admin/assets/script.js'); $jdoc->addStyleSheet(JUri::root(true) . '/modules/mod_ja_acm/admin/assets/style.css'); // helper $params = new JRegistry(); $params->set('jatools-config', $this->value); JLoader::register('ModJAACMHelper', JPATH_SITE . '/modules/mod_ja_acm/helper.php'); $helper = new ModJAACMHelper($params); // get active type //$activetype = JFactory::getApplication()->input->cookie->get('activetype', '', 'raw'); $activelayout = $activetypename = $activetpl = ''; $activetype = JFactory::getApplication()->input->cookie->get('activetype', '', 'raw'); if (!$activetype) { $value = json_decode($this->value, true); if (isset($value[':type'])) { $activetype = $value[':type']; } } else { setcookie('activetype', null, -1, '/'); $tmp = explode('::', $activetype); if (count($tmp) > 1) { $activelayout = $tmp[1]; $activetype = $tmp[0]; } } if ($activetype) { $tmp = explode(':', $activetype); $activetypename = count($tmp) > 1 ? $tmp[1] : $tmp[0]; $activetpl = count($tmp) > 1 ? $tmp[0] : '_'; if (!$activelayout && isset($value[$activetypename]) && isset($value[$activetypename]['jatools-layout-' . $activetypename])) { $activelayout = $value[$activetypename]['jatools-layout-' . $activetypename]; if (is_array($activelayout)) { $activelayout = $activelayout[0]; } } // clear value if not the right layout $savedlayout = isset($value[$activetypename]) && isset($value[$activetypename]['jatools-layout-' . $activetypename]) ? $value[$activetypename]['jatools-layout-' . $activetypename] : ''; if (is_array($savedlayout)) { $savedlayout = $savedlayout[0]; } if ($savedlayout != $activelayout) { $this->value = null; } } // load all xml $paths = array(); $paths['_'] = JPATH_ROOT . '/modules/mod_ja_acm/acm/'; // template folders $tpls = JFolder::folders(JPATH_ROOT . '/templates/'); foreach ($tpls as $tpl) { $paths[$tpl] = JPATH_ROOT . '/templates/' . $tpl . '/acm/'; } $fields = array(); $group_types = array(); $group_layouts = array(); foreach ($paths as $template => $path) { if (!is_dir($path)) { continue; } $types = JFolder::folders($path); if (!is_array($types)) { continue; } $group_types[$template] = array(); // get layout for each type foreach ($types as $type) { if (!isset($group_layouts[$type])) { $group_layouts[$type] = array(); } if (!is_dir($path . $type . '/tmpl')) { continue; } $layouts = JFolder::files($path . $type . '/tmpl', '.php'); if (is_array($layouts)) { foreach ($layouts as $layout) { $layout = JFile::stripExt($layout); $group_layouts[$type][] = $layout; } } } foreach ($types as $type) { $lname = $type; if (is_file($path . $type . '/config.xml')) { $xml = JFactory::getXML($path . $type . '/config.xml', true); $title = isset($xml->title) ? $xml->title : $lname; $group_types[$template][$lname] = $title; } } } $description = $sampledata = $configform = ''; $activetypetitle = $activetypename; // load activetype xml if ($activetype && $activelayout) { $type = $activetypename; $tpl = $activetpl; $path = $paths[$tpl]; // load template language if ($tpl != '_') { JFactory::getLanguage()->load('tpl_' . $tpl . '.sys', JPATH_SITE); } if (is_file($path . $type . '/config.xml')) { $xml = JFactory::getXML($path . $type . '/config.xml', true); $description = isset($xml->description) ? $xml->description : ''; if ($xml->title) { $activetypetitle = (string) $xml->title; } $sampledata = isset($xml->sampledata) ? $xml->sampledata : ''; // load xml for selected layout $lname = $activelayout; $lform = new JForm($lname); $lform->load($xml, false); if (is_file($path . $type . '/tmpl/' . $activelayout . '.xml')) { $lxml = JFactory::getXML($path . $type . '/tmpl/' . $activelayout . '.xml', true); if (isset($lxml->sampledata)) { $sampledata = $lxml->sampledata; } $lform->load($lxml, false); } $fieldsets = $lform->getFieldsets(); $configform = $this->renderLayout('jaacm-type', array('form' => $lform, 'fieldsets' => $fieldsets, 'sample-data' => $sampledata, 'helper' => $helper)); } } $layoutform = $this->renderLayout('jaacm-select-layout', array('group_types' => $group_types, 'group_layouts' => $group_layouts, 'activetype' => $activetype, 'activetypename' => $activetypename, 'activelayout' => $activelayout, 'activetypetitle' => $activetypetitle, 'activelayouttitle' => $activelayout)); $html = ''; $html .= "\n<input type=\"hidden\" name=\"{$this->name}\" id=\"jatools-config\" value=\"" . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . "\" />"; $html .= $this->renderLayout('jaacm', array('config-form' => $configform, 'layout-form' => $layoutform, 'activetype' => $activetype, 'activetypename' => $activetypename, 'activelayout' => $activelayout, 'description' => $description)); // $html .= $this->renderConfig('layouts-config', array('group_types' => $group_types, 'fields' => $fields), JPATH_ROOT); return $html; }
protected function getInput() { if (!function_exists('xtcsortfn')) { function xtcsortfn($a, $b) { return strnatcmp($a[0], $b[0]); } } jimport('joomla.filesystem.folder'); JHTML::_('behavior.modal', 'a.modal'); $template = basename(dirname(dirname(dirname(__FILE__)))); $live_site = JURI::root(); $document = JFactory::getDocument(); $id = JRequest::getInt('id'); $document->addStyleSheet($live_site . "templates/{$template}/XTC/XTC.css", 'text/css'); $path = JPATH_ROOT . '/templates/' . $template; $folders = JFolder::folders($path . '/layouts'); $layouts = array(); foreach ($folders as $folder) { // Parse parameter files $xmlFile = $path . '/layouts/' . $folder . '/config.xml'; if (is_readable($xmlFile)) { $xml = simplexml_load_file($xmlFile); $name = isset($xml->name) ? $xml->name : $folder; $description = isset($xml->description) ? trim($xml->description) : ''; } else { $name = $folder; $description = ''; } $thumbnail = ''; if (file_exists($path . '/layouts/' . $folder . '/thumbnail.gif')) { $thumbnail = 'thumbnail.gif'; } elseif (file_exists($path . '/layouts/' . $folder . '/thumbnail.jpg')) { $thumbnail = 'thumbnail.jpg'; } elseif (file_exists($path . '/layouts/' . $folder . '/thumbnail.png')) { $thumbnail = 'thumbnail.png'; } $fullimage = ''; if (file_exists($path . '/layouts/' . $folder . '/layout.gif')) { $fullimage = 'layout.gif'; } elseif (file_exists($path . '/layouts/' . $folder . '/layout.jpg')) { $fullimage = 'layout.jpg'; } elseif (file_exists($path . '/layouts/' . $folder . '/layout.png')) { $fullimage = 'layout.png'; } $layouts[] = array($name, $folder, $description, $thumbnail, $fullimage); } usort($layouts, "xtcsortfn"); $stringFilter = JFilterInput::getInstance(); require_once $path . '/XTC/XTC_library.php'; $templateParameters = xtcLoadParams($id); $html = ''; $navHtml = ''; $tabHtml = ''; $count = count($layouts); $openClass = $count == 1 ? ' open' : ''; foreach ($layouts as $i => $layout) { // Draw layouts list($name, $folder, $description, $thumbnail, $fullimage) = $layout; $params = isset($templateParameters->group->{$folder}) ? $templateParameters->group->{$folder} : new stdClass(); $tabid = $folder . $i; // Parameter Tab $active = $i == 0 ? ' class="active"' : ''; $navHtml .= '<li' . $active . '>'; $navHtml .= '<a href="#' . $tabid . '" data-toggle="tab">'; if ($thumbnail) { $thumbnailURL = $live_site . 'templates/' . $template . '/layouts/' . $folder . '/' . $thumbnail; $navHtml .= '<img class="img-rounded" src="' . $thumbnailURL . '" alt="" /><br/>'; } $navHtml .= '<center>' . $name . '</center>'; $navHtml .= '</a>'; $navHtml .= '</li>'; // Parameter Tab contents $form = new JForm('jxtc'); $form->addFieldPath(JPATH_ROOT . '/templates/' . $template . '/XTC/elements'); $xmlFile = $path . '/layouts/' . $folder . '/config.xml'; $form->loadFile($xmlFile); $getFieldsets = $form->getFieldsets(); $active = $i == 0 ? ' active' : ''; $tabHtml .= '<div class="tab-pane' . $active . '" id="' . $tabid . '">'; $tabHtml .= '<div class="xtc row-fluid">'; $tabHtml .= '<div class="span5">'; foreach ($getFieldsets as $fieldsets => $fieldset) { $label = trim($fieldset->label); if (empty($label)) { $label = trim($fieldset->name); } $fieldsetDescription = isset($fieldset->description) ? trim($fieldset->description) : ''; if (count($getFieldsets) > 1) { $tabHtml .= '<fieldset>'; if ($label) { $tabHtml .= '<legend>' . $label . '</legend>'; } if ($fieldsetDescription) { $tabHtml .= '<div class="well">' . $fieldsetDescription . '</div>'; } } foreach ($form->getFieldset($fieldset->name) as $field) { $xtcName = substr($field->name, 7, -1); if (isset($params->{$xtcName})) { $field->value = $params->{$xtcName}; } $field->name = str_replace('params[', 'xtcparam[layout][' . $folder . '][', $field->name); $field->id = $stringFilter->clean($field->name, 'cmd'); $tabHtml .= '<div class="control-group">'; $tabHtml .= '<div class="control-label">' . $field->getLabel() . '</div>'; $tabHtml .= '<div class="controls">' . $field->getInput() . '</div>'; $tabHtml .= '</div>'; } if (count($getFieldsets) > 1) { $tabHtml .= '</fieldset>'; } } $tabHtml .= '</div>'; // span5 if ($description || $fullimage) { $tabHtml .= '<div class="span1"></div>'; $tabHtml .= '<div class="span4"><div class="well">'; $tabHtml .= '<h3>' . $name . '</h3>'; if ($description) { $tabHtml .= $description . '<br/><br/>'; } if ($fullimage) { $fullimageURL = $live_site . 'templates/' . $template . '/layouts/' . $folder . '/' . $fullimage; $headerimg_size = getimagesize($path . '/layouts/' . $folder . '/' . $fullimage); $width = $headerimg_size[0]; $height = $headerimg_size[1]; $onclick = "onclick=\"MyWindow=window.open('{$fullimageURL}','_blank','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width={$width},height={$height}'); return false;\""; $tabHtml .= '<a class="btn btn-primary" href="#" ' . $onclick . '>' . JText::_('TPL_JXTC_VIEWLAYOUT') . '</a>'; } $tabHtml .= '</div></div>'; } $tabHtml .= '</div>'; // row-fluid $tabHtml .= '</div>'; // tab-pane } $html .= '<div class="tabbable">'; $html .= '<ul class="nav nav-tabs">' . $navHtml . '</ul>'; $html .= '<div class="tab-content">' . $tabHtml . '</div>'; $html .= '</div>'; return $html; }
/** * * @param JForm $form form object * @param string $name name of the fieldset * @param string $group name of the group * @param string $type may be classic, table, params * @return string Raw HTML text */ public static function renderFieldset($form, $name, $defaults, $group = null, $type = 1, $title = 1) { $fieldsets = $form->getFieldsets($group); $fieldset = $fieldsets[$name]; if (is_array($defaults)) { $registry = new JRegistry(); $registry->loadArray($defaults); $defaults = $registry; } /*else if(is_string($item->params)) { $registry = new JRegistry; $registry->loadString($item->params); $defaults = $registry; }*/ $fields = $form->getFieldset($name); $defaultGetName = empty($group) ? '%2$s' : '%s.%s'; $doc = JFactory::getDocument(); $doc->addStyleSheet(JURI::root() . 'libraries/mint/forms/style.css'); $out = ''; switch ($type) { case FORM_STYLE_CLASSIC: if ($title && $fieldset->label) { $out .= '<fieldset class="adminform whitebg"><legend>' . JText::_($fieldset->label) . '</legend>'; } if (isset($fieldset->description) && !empty($fieldset->description)) { $out .= '<small class="small">' . JText::_($fieldset->description) . '</small>'; } $out .= '<ul class="adminformlist">'; foreach ($fields as $key => $field) { $out .= '<li>'; if (!$field->hidden) { $out .= $field->label; } $out .= $form->getInput($field->fieldname, $group, $defaults->get(sprintf($defaultGetName, $group, $field->fieldname))); $out .= '</li>'; } $out .= '</ul>'; if ($title) { $out .= '</fieldset>'; } break; case FORM_STYLE_TABLE: if ($title && $fieldset->label) { $out .= '<legend>' . JText::_($fieldset->label) . '</legend>'; } if (isset($fieldset->description) && !empty($fieldset->description)) { $out .= '<small>' . JText::_($fieldset->description) . '</small><br /><br />'; } $out .= '<table class="table table-bordered table-striped table-hover">'; $i = 1; $hidden = array(); foreach ($fields as $key => $field) { if ($field->hidden) { $hidden[] = $field; continue; } if ($field->type == 'Caddress' || $field->type == 'Ccontacts' || $field->type == 'Clinks' || $field->type == 'Cobaltevents') { if (trim($out) == '<legend>' . JText::_($fieldset->label) . '</legend><table class="table table-bordered table-striped table-hover">') { $out = '<legend>' . JText::_($fieldset->label) . '</legend>'; } else { $out .= '</table>'; } //$out .= '<tr class="row'.$i = 1 - $i.'"><td colspan="2">'; if ($field->type != 'Cobaltevents') { $out .= '<legend>' . $field->label . '</legend>'; $out .= '<br />'; } $out .= $form->getInput($field->fieldname, $group, $defaults->get(sprintf($defaultGetName, $group, $field->fieldname))); //$out .= '</td></tr>'; $out .= '<br /><table class="table table-bordered table-striped table-hover">'; } else { $out .= '<tr><td>'; if (substr($field->description, 0, 3) == 'XX_') { $out .= '<img src="' . JUri::root(true) . '/media/mint/icons/16/exclamation-button.png" alt="Important" class="pull-right">'; } $out .= $field->label; $out .= '</td><td nowrap="nowrap">'; $out .= $form->getInput($field->fieldname, $group, $defaults->get(sprintf($defaultGetName, $group, $field->fieldname))); $out .= '</td></tr>'; } } $out .= '</table>'; foreach ($hidden as $field) { $out .= $field->input; } break; case FORM_STYLE_PARAMS: $hidden = array(); if ($title && $fieldset->label) { $out .= '<h2 class="params-title">' . JText::_($fieldset->label) . '</h2>'; } if (isset($fieldset->description) && !empty($fieldset->description)) { $out .= '<p class="params-description">' . JText::_($fieldset->description) . '</p>'; } foreach ($fields as $key => $field) { if ($field->hidden) { $hidden[] = $field; continue; } $switch = array('checkbox'); if (in_array(strtolower($field->type), $switch)) { $out .= '<div class="params-line">'; $out .= $form->getInput($field->fieldname, $group, $defaults->get(sprintf($defaultGetName, $group, $field->fieldname))); $out .= $field->label; $out .= '</div>'; } else { $out .= '<div class="params-line">'; $out .= $field->label; $out .= $form->getInput($field->fieldname, $group, $defaults->get(sprintf($defaultGetName, $group, $field->fieldname))); $out .= '</div>'; } } foreach ($hidden as $field) { $out .= $form->getInput($field->fieldname, $group, $defaults->get(sprintf($defaultGetName, $group, $field->fieldname))); } $out .= '<br />'; break; } return $out; }
/** * Render the initial plugin options, such as the plugin selector, and whether its rendered in front/back/both etc * * @return string */ public function top() { $data = $this->getData(); $c = $this->getState('c') + 1; $version = new JVersion(); $j3 = version_compare($version->RELEASE, '3.0') >= 0 ? true : false; $class = $j3 ? 'form-horizontal ' : 'adminform '; $str = array(); $str[] = '<div class="pane-slider content pane-down accordion-inner">'; $str[] = '<fieldset class="' . $class . 'pluginContainer" id="formAction_' . $c . '"><ul>'; $formName = 'com_fabrik.' . $this->getState('type') . '-plugin'; $topForm = new JForm($formName, array('control' => 'jform')); $topForm->repeatCounter = $c; $xmlFile = JPATH_SITE . '/administrator/components/com_fabrik/models/forms/' . $this->getState('type') . '-plugin.xml'; // Add the plugin specific fields to the form. $topForm->loadFile($xmlFile, false); $topForm->bind($data); // Filter the forms fieldsets for those starting with the correct $searchName prefix foreach ($topForm->getFieldsets() as $fieldset) { if ($fieldset->label != '') { $str[] = '<legend>' . $fieldset->label . '</legend>'; } foreach ($topForm->getFieldset($fieldset->name) as $field) { if (!$j3) { $str[] = '<li>' . $field->label . $field->input . '</li>'; } else { $str[] = '<div class="control-group"><div class="control-label">' . $field->label; $str[] = '</div><div class="controls">' . $field->input . '</div></div>'; } } } $str[] = '</ul>'; $str[] = '<div class="pluginOpts" style="clear:left"></div>'; if ($j3) { $str[] = '<div class="form-actions"><a href="#" class="btn btn-danger" data-button="removeButton">'; $str[] = '<i class="icon-delete"></i> ' . FText::_('COM_FABRIK_DELETE') . '</a></div>'; } else { $str[] = '<a href="#" class="delete removeButton">' . FText::_('COM_FABRIK_DELETE') . '</a>'; } $str[] = '</fieldset>'; $str[] = '</div>'; return implode("\n", $str); }
/** * Rendering Theme Customiser's form. Not for template developers. */ public function renderThemer() { $form = new JForm('jmframework.themecustomiser'); jimport('joomla.filesystem.path'); $plg_file = JPath::find(JMF_FRAMEWORK_PATH . DS . 'includes' . DS . 'assets' . DS . 'admin' . DS . 'params', 'template.xml'); $tpl_file = JPath::find(JPATH_ROOT . DS . 'templates' . DS . JMF_TPL, 'templateDetails.xml'); if (!$tpl_file && !$plg_file) { return false; } if ($plg_file) { $form->loadFile($plg_file, false, '//form'); } if ($tpl_file) { $form->loadFile($tpl_file, false, '//config'); } $fieldSets = $form->getFieldsets('themecustomiser'); if (empty($fieldSets)) { return false; } $path = JPath::clean(JMF_FRAMEWORK_PATH . '/includes/assets/admin/layouts/themecustomiser.php'); ob_start(); if (JFile::exists($path)) { include $path; } else { throw new Exception('Missing file: ' . $layoutbuilder_path, 500); } $html = ob_get_contents(); ob_end_clean(); return $html; }
function render() { $config = JComponentHelper::getParams(WBADVERT_NAME); $form = new JForm('jform'); $form->loadFile(WBADVERT_PATH . 'config.xml', false, '//config'); $form->bind($config->toArray()); $fieldSets = $form->getFieldsets(); $html[] = '<div class="control-fieldset">'; foreach ($form->getFieldset('component') as $field) { $field->name = 'params[' . $field->name . ']'; $html[] = $field->renderField(); } $html[] = '</div>'; return implode(PHP_EOL, $html); }