当前位置: 首页>>代码示例>>PHP>>正文


PHP JParameter::getFieldAttribute方法代码示例

本文整理汇总了PHP中JParameter::getFieldAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP JParameter::getFieldAttribute方法的具体用法?PHP JParameter::getFieldAttribute怎么用?PHP JParameter::getFieldAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JParameter的用法示例。


在下文中一共展示了JParameter::getFieldAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display

    function display($tpl = null)
    {
        //initialise variables
        $app = JFactory::getApplication();
        $user = JFactory::getUser();
        //JHTML::_('behavior.tooltip');
        //get vars
        $cid = JRequest::getVar('cid');
        $field_type = JRequest::getVar('field_type', 0);
        //Get data from the model
        $model = $this->getModel();
        $form = $this->get('Form');
        if (!FLEXI_J16GE) {
            $row =& $this->get('Field');
            //Import File system
            jimport('joomla.filesystem.file');
            // Create the form
            $pluginpath = JPATH_PLUGINS . DS . 'flexicontent_fields' . DS . $field_type . '.xml';
            if (JFile::exists($pluginpath)) {
                $form = new JParameter('', $pluginpath);
            } else {
                $form = new JParameter('', JPATH_PLUGINS . DS . 'flexicontent_fields' . DS . 'core.xml');
            }
            $form->loadINI($row->attribs);
        }
        $isnew = FLEXI_J16GE ? !$form->getValue('id') : !$row->id;
        // fail if checked out not by 'me'
        if (!$isnew) {
            if ($model->isCheckedOut($user->get('id'))) {
                JError::raiseWarning('SOME_ERROR_CODE', $row->name . ' ' . JText::_('FLEXI_EDITED_BY_ANOTHER_ADMIN'));
                $app->redirect('index.php?option=com_flexicontent&view=fields');
            }
        }
        /*if ($field_type)
        		{
        			if (!FLEXI_J16GE) {
        				echo $form->render('params', 'group-' . $field_type );
        			} else {
        				foreach ($form->getFieldset('group-' . $field_type) as $field) {
        					echo '<fieldset class="panelform">' . $field->label . $field->input . '</fieldset>' . "\n";
        				}
        			}
        		} else {
        			echo "<br /><span style=\"padding-left:25px;\"'>" . JText::_( 'FLEXI_APPLY_TO_SEE_THE_PARAMETERS' ) . "</span><br /><br />";
        		}*/
        ?>
			<div class="fctabber fields_tabset" id="field_specific_props_tabset">
			<?php 
        $fieldSets = $form->getFieldsets('attribs');
        $prefix_len = strlen('group-' . $field_type . '-');
        foreach ($fieldSets as $name => $fieldSet) {
            if ($name != 'basic' && $name != 'standard' && (substr($name, 0, $prefix_len) != 'group-' . $field_type . '-' || $name === 'group-' . $field_type)) {
                continue;
            }
            if ($fieldSet->label) {
                $label = JText::_($fieldSet->label);
            } else {
                $label = $name == 'basic' || $name == 'standard' ? JText::_('FLEXI_BASIC') : ucfirst(str_replace("group-", "", $name));
            }
            if (@$fieldSet->label_prefix) {
                $label = JText::_($fieldSet->label_prefix) . ' - ' . $label;
            }
            $icon = @$fieldSet->icon_class ? 'data-icon-class="' . $fieldSet->icon_class . '"' : '';
            $prepend = @$fieldSet->prepend_text ? 'data-prefix-text="' . JText::_($fieldSet->prepend_text) . '"' : '';
            $description = $fieldSet->description ? JText::_($fieldSet->description) : '';
            ?>
				<div class="tabbertab" id="fcform_tabset_<?php 
            echo $name;
            ?>
_tab" <?php 
            echo $icon;
            ?>
 <?php 
            echo $prepend;
            ?>
>
					<h3 class="tabberheading hasTooltip" title="<?php 
            echo $description;
            ?>
"><?php 
            echo $label;
            ?>
 </h3>
					<?php 
            $i = 0;
            ?>
					<?php 
            foreach ($form->getFieldset($name) as $field) {
                $_depends = FLEXI_J30GE ? $field->getAttribute('depend_class') : $form->getFieldAttribute($field->__get('fieldname'), 'depend_class', '', 'attribs');
                echo '
						<fieldset class="panelform' . ($i ? '' : ' fc-nomargin') . ' ' . ($_depends ? ' ' . $_depends : '') . '" id="' . $field->id . '-container">
							' . ($field->label ? '
								<span class="label-fcouter">' . str_replace('class="', 'class="label label-fcinner ', $field->label) . '</span>
								<div class="container_fcfield">' . $field->input . '</div>
							' : $field->input) . '
						</fieldset>
						';
                $i++;
            }
            ?>
//.........这里部分代码省略.........
开发者ID:khetsothea,项目名称:flexicontent-cck,代码行数:101,代码来源:view.raw.php

示例2: getlayoutparams


//.........这里部分代码省略.........
            JFactory::getLanguage()->load($module_name, JPATH_SITE, 'en-GB', true);
            JFactory::getLanguage()->load($module_name, JPATH_SITE, null, true);
        } else {
            if ($ext_view == 'field') {
                $query = 'SELECT attribs FROM #__flexicontent_fields WHERE id = ' . $ext_id;
            } else {
                echo "not supported extension/view: " . $ext_view;
                return;
            }
        }
        if ($ext_option != 'com_flexicontent' && $ext_option != 'com_modules' && $ext_option != 'com_advancedmodules' && $ext_option != 'com_menus') {
            echo '<div class="alert fcpadded fcinlineblock" style="">You are editing module via extension: <span class="label label-warning">' . $ext_option . '</span><br/> - If extension does not call Joomla event <span class="label label-warning">onExtensionBeforeSave</span> then custom layout parameters may not be saved</div>';
        }
        $db->setQuery($query);
        $ext_params_str = $db->loadResult();
        $layout_names = explode(':', $layout_name);
        if (count($layout_names) > 1) {
            $layout_name = $layout_names[1];
            $layoutpath = JPATH_ROOT . DS . 'templates' . DS . $layout_names[0] . DS . 'html' . DS . 'mod_flexicontent/' . $layout_name . '.xml';
        } else {
            $layoutpath = $path . DS . $layout_name . '.xml';
        }
        if (!file_exists($layoutpath)) {
            if (file_exists($path . DS . '_fallback' . DS . '_fallback.xml')) {
                $layoutpath = $path . DS . '_fallback' . DS . '_fallback.xml';
                echo '<div class="alert fcpadded fcinlineblock">Currently selected layout: <b>"' . $layout_name . '"</b> does not have a parameters XML file, using general defaults. if this is an old template then these parameters will allow to continue using it, but we recommend that you create parameter file: ' . $layout_name . '.xml</div><div class="clear"></div>';
            } else {
                echo !FLEXI_J16GE ? '<div style="font-size: 11px; color: gray; background-color: lightyellow; border: 1px solid lightgray; width: auto; padding: 4px 2%; margin: 1px 8px; height: auto;">' : '<p class="tip">';
                echo ' Currently selected layout: <b>"' . $layout_name . '"</b> does not have layout specific parameters';
                echo !FLEXI_J16GE ? '</div>' : '</p>';
                exit;
            }
        }
        //Get data from the model
        if (FLEXI_J16GE) {
            // Load XML file
            if (FLEXI_J30GE) {
                $xml = simplexml_load_file($layoutpath);
                $xmldoc =& $xml;
            } else {
                $xml = JFactory::getXMLParser('Simple');
                $xml->loadFile($layoutpath);
                $xmldoc =& $xml->document;
            }
            // Create form object, (form name seems not to cause any problem)
            $jform = new JForm('com_flexicontent.template.item', array('control' => 'jform', 'load_data' => true));
            $tmpl_params = FLEXI_J30GE ? $xmldoc->asXML() : $xmldoc->toString();
            $jform->load($tmpl_params);
            // Load existing layout values into the object (that we got from DB)
            $ext_params = new JRegistry($ext_params_str);
            // and for J1.5:  new JParameter($ext_params_str);
            $grpname = 'params';
            // this is the name of <fields> container
            foreach ($jform->getGroup($grpname) as $field) {
                $fieldname = $field->__get('fieldname');
                $value = $ext_params->get($fieldname);
                if (strlen($value)) {
                    $jform->setValue($fieldname, $grpname, $value);
                }
            }
        } else {
            // Create a parameters object
            $form = new JParameter('', $layoutpath);
            // Load existing layout values into the object (that we got from DB)
            $form->loadINI($ext_params_str);
        }
        if ($layout_name) {
            if (!FLEXI_J16GE) {
                echo $form->render('params', 'layout');
            } else {
                ?>
				<fieldset class="panelform"><?php 
                /*<ul class="adminformlist">*/
                ?>
					<?php 
                $grpname = 'params';
                // this is the name of <fields> container
                foreach ($jform->getGroup($grpname) as $field) {
                    //echo '<li>'. $field->label . $field->input .'</li>';
                    $_depends = FLEXI_J30GE ? $field->getAttribute('depend_class') : $form->getFieldAttribute($field->__get('fieldname'), 'depend_class', '', 'attribs');
                    echo '
						<fieldset class="panelform ' . ($_depends ? ' ' . $_depends : '') . '" id="' . $field->id . '-container">
							' . ($field->label ? '
								<span class="label-fcouter">' . str_replace('class="', 'class="label label-fcinner ', $field->label) . '</span>
								<div class="container_fcfield">' . $field->input . '</div>
							' : $field->input) . '
						</fieldset>';
                }
                ?>
				<?php 
                /*</ul>*/
                ?>
</fieldset>
				<?php 
            }
        } else {
            echo "<br /><span style=\"padding-left:25px;\"'>" . JText::_('FLEXI_APPLY_TO_SEE_THE_PARAMETERS') . "</span><br /><br />";
        }
        //parent::display($tpl);
    }
开发者ID:khetsothea,项目名称:flexicontent-cck,代码行数:101,代码来源:templates.raw.php


注:本文中的JParameter::getFieldAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。