本文整理汇总了PHP中JFormHelper::addFieldPath方法的典型用法代码示例。如果您正苦于以下问题:PHP JFormHelper::addFieldPath方法的具体用法?PHP JFormHelper::addFieldPath怎么用?PHP JFormHelper::addFieldPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JFormHelper
的用法示例。
在下文中一共展示了JFormHelper::addFieldPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createStatuses
public static function createStatuses()
{
$app = JFactory::getApplication();
$filter_steps = $app->getUserStateFromRequest('com_imc.issues.filter.steps', 'steps', array());
//get issue statuses
JFormHelper::addFieldPath(JPATH_ROOT . '/components/com_imc/models/fields');
$step = JFormHelper::loadFieldType('Step', false);
$statuses = $step->getOptions();
if (empty($filter_steps)) {
$str = '<ul class="imc_ulist imc_ulist_inline">';
foreach ($statuses as $status) {
$str .= '<li>';
$str .= '<input type="checkbox" name="steps[]" value="' . $status->value . '" ' . 'checked="checked"' . '>';
$str .= '<span class="root">' . ' ' . $status->text . '</span>';
$str .= '</li>';
}
$str .= '</ul>';
} else {
$str = '<ul class="imc_ulist imc_ulist_inline">';
foreach ($statuses as $status) {
$str .= '<li>';
$str .= '<input type="checkbox" name="steps[]" value="' . $status->value . '" ' . (in_array($status->value, $filter_steps) ? 'checked="checked"' : '') . '>';
$str .= '<span class="root">' . ' ' . $status->text . '</span>';
$str .= '</li>';
}
$str .= '</ul>';
}
return $str;
}
示例2: display
function display($tpl = null)
{
JFormHelper::addFormPath(JPATH_ADMINISTRATOR . '/components/com_j2store/models/forms');
JFormHelper::addFieldPath(JPATH_ADMINISTRATOR . '/components/com_j2store/models/fields');
$this->form = JForm::getInstance('storeprofile', 'storeprofile');
$this->addToolBar();
parent::display();
}
示例3: display
/**
* display method of Cp view
* @return void
**/
function display($tpl = null)
{
// Initialiase variables.
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
JRequest::setVar('hidemainmenu', true);
$user = JFactory::getUser();
$isNew = empty($this->item->product_id);
$document = JFactory::getDocument();
if (JRequest::getVar('tmpl', '') != 'component') {
$document->addScript(JURI::base(true) . '/components/com_cp/assets/js/jquery-1.10.1.min.js');
$document->addScriptDeclaration('jQuery.noConflict();');
$document->addScript(JURI::base(true) . '/components/com_cp/assets/js/jquery-ui-1.10.3.custom.min.js');
$document->addScript(JURI::base(true) . '/components/com_cp/assets/js/scripts.js');
$document->addStyleSheet(JURI::base(true) . '/components/com_cp/assets/css/style.css');
$document->addStyleSheet(JURI::base(true) . '/components/com_cp/assets/css/smoothness/jquery-ui-1.8.21.custom.css');
$document->addStyleDeclaration('body { min-width: 1170px; }');
}
// Create the form
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
$text = $isNew ? JText::_('COM_CP_NEW') : JText::_('COM_CP_EDIT');
JToolBarHelper::title($text . ' ' . JText::_('COM_CP_PRODUCT_PAGE_TITLE'));
if ($isNew && $user->authorise('core.create', 'com_cp')) {
JToolBarHelper::apply('cpproducts.apply');
JToolBarHelper::save('cpproducts.save');
JToolBarHelper::save2new('cpproducts.save2new');
JToolBarHelper::cancel('cpproducts.cancel');
} else {
if ($user->authorise('core.edit', 'com_cp')) {
JToolBarHelper::apply('cpproducts.apply');
JToolBarHelper::save('cpproducts.save');
if ($user->authorise('core.edit', 'com_cp')) {
JToolBarHelper::save2new('cpproducts.save2new');
}
JToolBarHelper::cancel('cpproducts.cancel', 'COM_CP_CLOSE');
}
}
$helper = new CPHelper();
if ($isNew) {
$countFiles = 0;
} else {
$countFiles = count($this->item->media);
}
// Initialize media files script
$document->addScriptDeclaration('var mediaCount = ' . $countFiles . '; var delText = "' . JText::_('COM_CP_DELETE') . '"; var siteURL = "' . JURI::root() . '";');
$params = JComponentHelper::getParams('com_cp');
$this->assignRef('params', $params);
$this->item->cities = $helper->listCities($this->item->country_code, $this->item->city, 'jform[city]', 'jform_city');
parent::display($tpl);
}
示例4: __construct
public function __construct(&$subject, $config)
{
if (!class_exists('joomlamailerMCAPI')) {
return;
}
parent::__construct($subject, $config);
JFormHelper::addFieldPath(__DIR__ . '/fields');
$this->api = $this->getApiInstance();
$this->debug = JFactory::getConfig()->get('debug');
$this->listId = $this->params->get('listid');
}
示例5: populateState
protected function populateState($ordering = null, $direction = null)
{
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
$published = $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'string');
$this->setState('filter.state', $published);
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
$catID = $this->getUserStateFromRequest($this->context . '.filter.category', 'filter_category');
$this->setState('filter.category', $catID);
$visibility = $this->getUserStateFromRequest($this->context . '.filter.visibility', 'filter_visibility');
$this->setState('filter.category', $visibility);
parent::populateState('a.ordering', 'asc');
}
示例6: onAfterInitialise
/**
* Method to register custom library.
*
* @return void
*/
public function onAfterInitialise()
{
if (!$this->isRedcoreComponent()) {
return;
}
$redcoreLoader = JPATH_LIBRARIES . '/redcore/bootstrap.php';
if (file_exists($redcoreLoader)) {
require_once $redcoreLoader;
// For Joomla! 2.5 compatibility we add some core functions
if (version_compare(JVERSION, '3.0', '<')) {
RLoader::registerPrefix('J', JPATH_LIBRARIES . '/redcore/joomla', false, true);
}
}
// Make available the fields
JFormHelper::addFieldPath(JPATH_LIBRARIES . '/redcore/form/fields');
// Make available the rules
JFormHelper::addRulePath(JPATH_LIBRARIES . '/redcore/form/rules');
}
示例7: onAfterInitialise
/**
* Method to register custom library.
*
* @return void
*/
public function onAfterInitialise()
{
$isAdmin = JFactory::getApplication()->isAdmin();
if (!$isAdmin || !$this->isRedradComponent()) {
return;
}
$redradLoader = JPATH_LIBRARIES . '/redrad/bootstrap.php';
if (file_exists($redradLoader) && !class_exists('Inflector')) {
require_once $redradLoader;
// For Joomla! 2.5 compatibility we add some core functions
if (version_compare(JVERSION, '3.0', '<')) {
RLoader::registerPrefix('J', JPATH_LIBRARIES . '/redrad/joomla', false, true);
}
}
// Make available the fields
JFormHelper::addFieldPath(JPATH_LIBRARIES . '/redrad/form/fields');
// Make available the rules
JFormHelper::addRulePath(JPATH_LIBRARIES . '/redrad/form/rules');
}
示例8: element
/**
* $type, $domId, $value, $options = array(), $formName = null, $disabled = false
*/
public static function element()
{
list($type, $domId, $value, $options) = func_get_args();
$options = (array) $options;
// Load the JFormField object for the field.
JFormHelper::addFieldPath(JPATH_COMPONENT_ADMINISTRATOR . DS . 'models' . DS . 'fields');
$field = JFormHelper::loadFieldType($type, true);
// If the object could not be loaded, get a text field object.
if ($field === false) {
throw new Exception('Cannot load field type ' . $type);
}
$element = new JXMLElement('<field></field>');
$element->addAttribute('id', $domId);
if (!empty($options)) {
foreach ($options as $name => $val) {
$element->addAttribute($name, $val);
}
}
if (!$field->setup($element, $value, null)) {
throw new Exception('Cannot setup field ' . $type);
}
return $field->input;
}
示例9: renderFormField
/**
* Just an idea, still WIP
* @param $type
* @return mixed
*/
static function renderFormField($type)
{
//Get custom field
JFormHelper::addFieldPath(VMPATH_ADMIN . DS . 'fields');
$types = JFormHelper::loadFieldType($type, false);
return $types->getOptions();
}
示例10: bootstrap
/**
* Effectively bootstrap redCORE.
*
* @param bool $loadBootstrap Load bootstrap with redcore plugin options
*
* @return void
*/
public static function bootstrap($loadBootstrap = true)
{
if ($loadBootstrap && !defined('REDCORE_BOOTSTRAPPED')) {
define('REDCORE_BOOTSTRAPPED', 1);
}
if (!defined('REDCORE_LIBRARY_LOADED')) {
// Sets bootstrapped variable, to avoid bootstrapping redCORE twice
define('REDCORE_LIBRARY_LOADED', 1);
// Use our own base field
if (!class_exists('JFormField', false)) {
$baseField = JPATH_LIBRARIES . '/redcore/joomla/form/field.php';
if (file_exists($baseField)) {
require_once $baseField;
}
}
// Register the classes for autoload.
JLoader::registerPrefix('R', JPATH_REDCORE);
// Setup the RLoader.
RLoader::setup();
// Make available the redCORE fields
JFormHelper::addFieldPath(JPATH_REDCORE . '/form/field');
JFormHelper::addFieldPath(JPATH_REDCORE . '/form/fields');
// Make available the redCORE form rules
JFormHelper::addRulePath(JPATH_REDCORE . '/form/rules');
// HTML helpers
JHtml::addIncludePath(JPATH_REDCORE . '/html');
RHtml::addIncludePath(JPATH_REDCORE . '/html');
// Load library language
$lang = JFactory::getLanguage();
$lang->load('lib_redcore', JPATH_REDCORE);
// For Joomla! 2.5 compatibility we add some core functions
if (version_compare(JVERSION, '3.0', '<')) {
RLoader::registerPrefix('J', JPATH_LIBRARIES . '/redcore/joomla', false, true);
}
// Make available the fields
JFormHelper::addFieldPath(JPATH_LIBRARIES . '/redcore/form/fields');
// Make available the rules
JFormHelper::addRulePath(JPATH_LIBRARIES . '/redcore/form/rules');
// Replaces Joomla database driver for redCORE database driver
JFactory::$database = null;
JFactory::$database = RFactory::getDbo();
if (self::getConfig('enable_translations', 0) == 1 && !JFactory::getApplication()->isAdmin()) {
// This is our object now
$db = JFactory::getDbo();
// Enable translations
$db->translate = self::getConfig('enable_translations', 0) == 1;
// Reset plugin translations params if needed
RTranslationHelper::resetPluginTranslation();
}
}
}
示例11: addToolBar
/**
* Setting the toolbar
*/
protected function addToolBar()
{
JToolBarHelper::title(JText::_('COM_COSTBENEFITPROJECTION_CURRENCIES'), 'credit');
JHtmlSidebar::setAction('index.php?option=com_costbenefitprojection&view=currencies');
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
if ($this->canCreate) {
JToolBarHelper::addNew('currency.add');
}
// Only load if there are items
if (CostbenefitprojectionHelper::checkArray($this->items)) {
if ($this->canEdit) {
JToolBarHelper::editList('currency.edit');
}
if ($this->canState) {
JToolBarHelper::publishList('currencies.publish');
JToolBarHelper::unpublishList('currencies.unpublish');
JToolBarHelper::archiveList('currencies.archive');
if ($this->canDo->get('core.admin')) {
JToolBarHelper::checkin('currencies.checkin');
}
}
// Add a batch button
if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) {
// Get the toolbar object instance
$bar = JToolBar::getInstance('toolbar');
// set the batch button name
$title = JText::_('JTOOLBAR_BATCH');
// Instantiate a new JLayoutFile instance and render the batch button
$layout = new JLayoutFile('joomla.toolbar.batch');
// add the button to the page
$dhtml = $layout->render(array('title' => $title));
$bar->appendButton('Custom', $dhtml, 'batch');
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) {
JToolbarHelper::deleteList('', 'currencies.delete', 'JTOOLBAR_EMPTY_TRASH');
} elseif ($this->canState && $this->canDelete) {
JToolbarHelper::trash('currencies.trash');
}
if ($this->canDo->get('core.export') && $this->canDo->get('currency.export')) {
JToolBarHelper::custom('currencies.exportData', 'download', '', 'COM_COSTBENEFITPROJECTION_EXPORT_DATA', true);
}
}
if ($this->canDo->get('core.import') && $this->canDo->get('currency.import')) {
JToolBarHelper::custom('currencies.importData', 'upload', '', 'COM_COSTBENEFITPROJECTION_IMPORT_DATA', false);
}
// set help url for this view if found
$help_url = CostbenefitprojectionHelper::getHelpUrl('currencies');
if (CostbenefitprojectionHelper::checkString($help_url)) {
JToolbarHelper::help('COM_COSTBENEFITPROJECTION_HELP_MANAGER', false, $help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) {
JToolBarHelper::preferences('com_costbenefitprojection');
}
if ($this->canState) {
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true));
// only load if batch allowed
if ($this->canBatch) {
JHtmlBatch_::addListSelection(JText::_('COM_COSTBENEFITPROJECTION_KEEP_ORIGINAL_STATE'), 'batch[published]', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true));
}
}
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_ACCESS'), 'filter_access', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text', $this->state->get('filter.access')));
if ($this->canBatch && $this->canCreate && $this->canEdit) {
JHtmlBatch_::addListSelection(JText::_('COM_COSTBENEFITPROJECTION_KEEP_ORIGINAL_ACCESS'), 'batch[access]', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text'));
}
}
示例12: addFieldPath
/**
* Proxy for {@link JFormHelper::addFieldPath()}.
*
* @param mixed $new A path or array of paths to add.
*
* @return array The list of paths that have been added.
*
* @since 11.1
*/
public static function addFieldPath($new = null)
{
return JFormHelper::addFieldPath($new);
}
示例13: addToolbar
/**
* Add the page title and toolbar.
*
* @since 1.6
*/
protected function addToolbar()
{
require_once JPATH_COMPONENT . '/helpers/imc.php';
$state = $this->get('State');
$canDo = ImcHelper::getActions($state->get('filter.category_id'));
JToolBarHelper::title(JText::_('COM_IMC_TITLE_ISSUES'), 'drawer');
//Check if the form exists before showing the add/edit buttons
$formPath = JPATH_COMPONENT_ADMINISTRATOR . '/views/issue';
if (file_exists($formPath)) {
if ($canDo->get('core.create')) {
JToolBarHelper::addNew('issue.add', 'JTOOLBAR_NEW');
}
if ($canDo->get('core.edit') && isset($this->items[0])) {
JToolBarHelper::editList('issue.edit', 'JTOOLBAR_EDIT');
}
}
if ($canDo->get('core.edit.state')) {
if (isset($this->items[0]->state)) {
JToolBarHelper::divider();
JToolBarHelper::custom('issues.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true);
JToolBarHelper::custom('issues.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true);
} else {
if (isset($this->items[0])) {
//If this component does not use state then show a direct delete button as we can not trash
JToolBarHelper::deleteList('', 'issues.delete', 'JTOOLBAR_DELETE');
}
}
if (isset($this->items[0]->state)) {
JToolBarHelper::divider();
JToolBarHelper::archiveList('issues.archive', 'JTOOLBAR_ARCHIVE');
}
if (isset($this->items[0]->checked_out)) {
JToolBarHelper::custom('issues.checkin', 'checkin.png', 'checkin_f2.png', 'JTOOLBAR_CHECKIN', true);
}
}
//Show trash and delete for components that uses the state field
if (isset($this->items[0]->state)) {
if ($state->get('filter.state') == -2 && $canDo->get('core.delete')) {
JToolBarHelper::deleteList('', 'issues.delete', 'JTOOLBAR_EMPTY_TRASH');
JToolBarHelper::divider();
} else {
if ($canDo->get('core.edit.state')) {
JToolBarHelper::trash('issues.trash', 'JTOOLBAR_TRASH');
JToolBarHelper::divider();
}
}
}
if ($canDo->get('core.admin')) {
JToolBarHelper::preferences('com_imc');
}
//Set sidebar action - New in 3.0
JHtmlSidebar::setAction('index.php?option=com_imc&view=issues');
$this->extra_sidebar = '';
JHtmlSidebar::addFilter(JText::_("JOPTION_SELECT_CATEGORY"), 'filter_catid', JHtml::_('select.options', JHtml::_('category.options', 'com_imc'), "value", "text", $this->state->get('filter.catid')));
//Get custom field
JFormHelper::addFieldPath(JPATH_ROOT . '/components/com_imc/models/fields');
$steps = JFormHelper::loadFieldType('Step', false);
$options = $steps->getOptions();
JHtmlSidebar::addFilter(JText::_("COM_IMC_ISSUES_STEPID_FILTER"), 'filter_stepid', JHtml::_('select.options', $options, "value", "text", $this->state->get('filter.stepid'), true));
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_published', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), "value", "text", $this->state->get('filter.state'), true));
}
示例14: defined
<?php
/**
* Dummy Library file.
* Including this file into your application will make dummy available to use.
*
* @package Dummy.Library
* @copyright Copyright (C) 2013 redCOMPONENT.com. All rights reserved.
* @license GNU General Public License version 2 or later, see LICENSE.
*/
defined('JPATH_PLATFORM') or die;
// Define dummy Library Folder Path
define('JPATH_DUMMY_LIBRARY', __DIR__);
// Bootstraps redCORE
RBootstrap::bootstrap();
// Register library prefix
RLoader::registerPrefix('Dummy', JPATH_DUMMY_LIBRARY);
// Make available the dummy fields
JFormHelper::addFieldPath(JPATH_DUMMY_LIBRARY . '/form/fields');
// Make available the dummy form rules
JFormHelper::addRulePath(JPATH_DUMMY_LIBRARY . '/form/rules');
示例15:
</div>
</div>
<div class="control-group">
<div class="control-label"><?php
echo $this->form->getLabel('location');
?>
</div>
<div class="controls">
<?php
$this->form->setFieldAttribute('location', 'latitude', $this->item->latitude ? $this->item->latitude : 21.0277644, $group = null);
$this->form->setFieldAttribute('location', 'longitude', $this->item->longitude ? $this->item->longitude : 105.83415979999995, $group = null);
echo $this->form->getInput('location');
?>
<?php
JFormHelper::addFieldPath(JPATH_COMPONENT_ADMINISTRATOR . '/elements');
$locationfield = JFormHelper::loadFieldType('location', false);
$location = $locationfield->getMap();
echo $location;
?>
</div>
</div>
<div class="control-group">
<div class="control-label"><?php
echo $this->form->getLabel('desc');
?>
</div>
<div class="controls"><?php
echo $this->form->getInput('desc');
?>