本文整理汇总了PHP中JForm::addFieldPath方法的典型用法代码示例。如果您正苦于以下问题:PHP JForm::addFieldPath方法的具体用法?PHP JForm::addFieldPath怎么用?PHP JForm::addFieldPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JForm
的用法示例。
在下文中一共展示了JForm::addFieldPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Метод для отображения формы вопроса
* @param unknown_type $tpl
*/
public function display($tpl = null)
{
$catid = JRequest::getInt('catid', null, 'GET');
if (!$catid) {
throw new Exception('Category id not set');
}
JForm::addFormPath('components/com_smfaq/models/forms');
JForm::addFieldPath('components/com_smfaq/models/fields');
$form = JForm::getInstance('question', 'question');
$categories = JCategories::getInstance('SmFaq');
$category = $categories->get($catid);
$params = $category->getParams();
if ($layout = $params->get('category_layout')) {
$this->setLayout($layout);
}
JPluginHelper::importPlugin('smfaq');
$dispatcher = JDispatcher::getInstance();
$results = $dispatcher->trigger('onPrepareForm', array($form));
// Check for errors encountered while preparing the form.
if (count($results) && in_array(false, $results, true)) {
// Get the last error.
$error = $dispatcher->getError();
if (!$error instanceof Exception) {
throw new Exception($error);
}
}
$this->assignRef('form', $form);
$this->assignRef('params', $params);
$this->assignRef('category', $category);
parent::display($tpl);
}
示例2: getForm
/**
* Method to get the row form.
*
* @return mixed JForm object on success, false on failure.
*/
public function getForm()
{
// Initialise variables.
$app = JFactory::getApplication();
// Get the form.
jimport('joomla.form.form');
JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
JForm::addFieldPath(JPATH_COMPONENT . '/models/fields');
$form = JForm::getInstance('com_localise.languages', 'languages', array('control' => 'filters', 'event' => 'onPrepareForm'));
// Check for an error.
if (JError::isError($form)) {
$this->setError($form->getMessage());
return false;
}
// Check the session for previously entered form data.
$data = $app->getUserState('com_localise.select', array());
// Bind the form data if present.
if (!empty($data)) {
$form->bind(array('select' => $data));
}
// Check the session for previously entered form data.
$data = $app->getUserState('com_localise.languages.search', array());
// Bind the form data if present.
if (!empty($data)) {
$form->bind(array('search' => $data));
}
return $form;
}
示例3: onContentPrepareForm
public function onContentPrepareForm($form, $data)
{
$app = JFactory::getApplication();
if (!$app->isAdmin()) {
return;
}
$option = JFactory::getApplication()->input->getWord('option');
$layout = JFactory::getApplication()->input->getWord('layout');
$view = JFactory::getApplication()->input->getWord('view');
$task = JFactory::getApplication()->input->getWord('task');
$id = JFactory::getApplication()->input->getInt('id');
$module = $this->getModuleType($data);
if (in_array($option, array('com_modules', 'com_advancedmodules')) && $layout == 'edit' && $module == 'mod_rokminievents3') {
JForm::addFieldPath(JPATH_ROOT . '/modules/mod_rokminievents3/fields');
//Find Sources
$sources = RokMiniEvents3_SourceLoader::getAvailableSources(self::$SOURCE_DIR);
foreach ($sources as $source_name => $source) {
if (file_exists($source->paramspath) && is_readable($source->paramspath)) {
$form->loadFile($source->paramspath, false);
JForm::addFieldPath(dirname($source->paramspath) . "/" . $source->name);
//$this->element_dirs[] = dirname($source->paramspath) . "/" . $source->name;
$language = JFactory::getLanguage();
$language->load('com_' . $source->name, JPATH_ADMINISTRATOR);
$language->load($source->name, dirname($source->paramspath), $language->getTag(), true);
}
}
$subfieldform = RokSubfieldForm::getInstanceFromForm($form);
if (!empty($data) && isset($data->params)) {
$subfieldform->setOriginalParams($data->params);
}
if ($task == 'save' || $task == 'apply') {
$subfieldform->makeSubfieldsVisable();
}
}
}
示例4: display
function display($tpl = null)
{
// Load the helper(s)
$this->addHelperPath(VMPATH_ADMIN . DS . 'helpers');
if (!class_exists('vmPSPlugin')) {
require VMPATH_PLUGINLIBS . DS . 'vmpsplugin.php';
}
if (!class_exists('VmHTML')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
}
$model = VmModel::getModel();
$layoutName = vRequest::getCmd('layout', 'default');
$this->SetViewTitle();
$layoutName = vRequest::getCmd('layout', 'default');
if ($layoutName == 'edit') {
VmConfig::loadJLang('plg_vmpsplugin', false);
JForm::addFieldPath(VMPATH_ADMIN . DS . 'fields');
$shipment = $model->getShipment();
// Get the payment XML.
$formFile = vRequest::filterPath(VMPATH_ROOT . DS . 'plugins' . DS . 'vmshipment' . DS . $shipment->shipment_element . DS . $shipment->shipment_element . '.xml');
if (file_exists($formFile)) {
$shipment->form = JForm::getInstance($shipment->shipment_element, $formFile, array(), false, '//vmconfig | //config[not(//vmconfig)]');
$shipment->params = new stdClass();
$varsToPush = vmPlugin::getVarsToPushFromForm($shipment->form);
VmTable::bindParameterableToSubField($shipment, $varsToPush);
$shipment->form->bind($shipment->getProperties());
} else {
$shipment->form = null;
}
if (!class_exists('VmImage')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'image.php';
}
if (!class_exists('VirtueMartModelVendor')) {
require VMPATH_ADMIN . DS . 'models' . DS . 'vendor.php';
}
$vendor_id = 1;
$currency = VirtueMartModelVendor::getVendorCurrency($vendor_id);
$this->assignRef('vendor_currency', $currency->currency_symbol);
if ($this->showVendors()) {
$vendorList = ShopFunctions::renderVendorList($shipment->virtuemart_vendor_id);
$this->assignRef('vendorList', $vendorList);
}
$this->pluginList = self::renderInstalledShipmentPlugins($shipment->shipment_jplugin_id);
$this->assignRef('shipment', $shipment);
$this->shopperGroupList = ShopFunctions::renderShopperGroupList($shipment->virtuemart_shoppergroup_ids, true);
$this->addStandardEditViewCommands($shipment->virtuemart_shipmentmethod_id);
} else {
JToolBarHelper::custom('cloneshipment', 'copy', 'copy', vmText::_('COM_VIRTUEMART_SHIPMENT_CLONE'), true);
$this->addStandardDefaultViewCommands();
$this->addStandardDefaultViewLists($model);
$this->shipments = $model->getShipments();
VmConfig::loadJLang('com_virtuemart_shoppers', TRUE);
foreach ($this->shipments as &$data) {
// Write the first 5 shoppergroups in the list
$data->shipmentShoppersList = shopfunctions::renderGuiList($data->virtuemart_shoppergroup_ids, 'shoppergroups', 'shopper_group_name', 'shopper');
}
$this->pagination = $model->getPagination();
}
parent::display($tpl);
}
示例5: getForm
/**
* Method to get the record form.
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
*
* @return JForm A JForm object on success, false on failure.
*
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
// The folder and element vars are passed when saving the form.
if (empty($data)) {
$item = $this->getItem();
$folder = $item->folder;
$element = $item->element;
} else {
$folder = ArrayHelper::getValue($data, 'folder', '', 'cmd');
$element = ArrayHelper::getValue($data, 'element', '', 'cmd');
}
// Add the default fields directory
JForm::addFieldPath(JPATH_PLUGINS . '/' . $folder . '/' . $element . '/field');
// These variables are used to add data from the plugin XML files.
$this->setState('item.folder', $folder);
$this->setState('item.element', $element);
// Get the form.
$form = $this->loadForm('com_plugins.plugin', 'plugin', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form)) {
return false;
}
// Modify the form based on access controls.
if (!$this->canEditState((object) $data)) {
// Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true');
$form->setFieldAttribute('enabled', 'disabled', 'true');
// Disable fields while saving.
// The controller has already verified this is a record you can edit.
$form->setFieldAttribute('ordering', 'filter', 'unset');
$form->setFieldAttribute('enabled', 'filter', 'unset');
}
return $form;
}
示例6: onPaymentExtras
/**
* This method prepares a payment gateway - buttons, forms,...
* That gateway will be displayed on the summary page as a payment option.
*
* @param string $context This string gives information about that where it has been executed the trigger.
* @param object $item A project data.
* @param Joomla\Registry\Registry $params The parameters of the component
*
* @return null|string
*/
public function onPaymentExtras($context, &$item, &$params)
{
if (strcmp("com_crowdfunding.payment.step2", $context) != 0) {
return null;
}
if ($this->app->isAdmin()) {
return null;
}
$doc = JFactory::getDocument();
/** @var $doc JDocumentHtml */
// Check document type
$docType = $doc->getType();
if (strcmp("html", $docType) != 0) {
return null;
}
// Load language file of the component.
$language = JFactory::getLanguage();
$language->load('com_crowdfundingdata', CROWDFUNDINGDATA_PATH_COMPONENT_SITE);
$componentParams = JComponentHelper::getParams("com_crowdfunding");
/** @var $componentParams Joomla\Registry\Registry */
// Get payment session.
$paymentSessionContext = Crowdfunding\Constants::PAYMENT_SESSION_CONTEXT . $item->id;
$paymentSession = $this->app->getUserState($paymentSessionContext);
if (!isset($paymentSession->step1)) {
$path = JPath::clean(JPluginHelper::getLayoutPath('crowdfundingpayment', 'data', 'error'));
// Render error layout.
ob_start();
include $path;
return ob_get_clean();
}
// Get the value of therms and conditions.
$this->terms = $paymentSession->terms;
// Check for duplication of session ID.
$this->prepareSessionId($item);
// Load the form.
JForm::addFormPath(CROWDFUNDINGDATA_PATH_COMPONENT_SITE . '/models/forms');
JForm::addFieldPath(CROWDFUNDINGDATA_PATH_COMPONENT_SITE . '/models/fields');
$form = JForm::getInstance('com_crowdfundingdata.record', 'record', array('control' => "jform", 'load_data' => false));
// Prepare default name of a user.
$user = JFactory::getUser();
if ($user->get("id")) {
$form->setValue("name", null, $user->get("name"));
}
// Set item id to the form.
$form->setValue("project_id", null, $item->id);
$this->form = $form;
// Load jQuery
JHtml::_("jquery.framework");
// Include Chosen
if ($this->params->get("enable_chosen", 0)) {
JHtml::_('formbehavior.chosen', '#jform_country_id');
}
// Get the path for the layout file
$path = JPath::clean(JPluginHelper::getLayoutPath('crowdfundingpayment', 'data'));
// Render the form.
ob_start();
include $path;
$html = ob_get_clean();
return $html;
}
示例7: getInput
protected function getInput()
{
$html = '';
if ($this->form->getValue('params.provider_type') && $this->form->getValue('params.widget_type') != 'widget') {
SCStringUtilities::loadLanguage('com_jfbconnect', JPATH_ADMINISTRATOR);
JForm::addFieldPath(JPATH_ROOT . '/components/com_jfbconnect/libraries/provider/' . $this->form->getValue('params.provider_type') . '/widget');
$xmlFile = JPATH_ROOT . '/components/com_jfbconnect/libraries/provider/' . $this->form->getValue('params.provider_type') . '/widget/' . $this->form->getValue('params.widget_type') . '.xml';
if (JFile::exists($xmlFile)) {
$options = array('control' => 'jform');
$form = JForm::getInstance('com_jfbconnect_' . $this->form->getValue('params.widget_type'), $xmlFile, $options);
$registry = $this->form->getValue('params');
$settings = new JRegistry();
$settings->set('params.widget_settings', $registry->widget_settings);
$form->bind($settings);
ob_start();
foreach ($form->getFieldsets() as $fieldsets => $fieldset) {
foreach ($form->getFieldset($fieldset->name) as $field) {
$this->formShowField($field);
}
}
$html = ob_get_clean();
}
}
return '<div id="widget_settings">' . $html . '</div>';
}
示例8: display
/**
* Method to display the view.
*
* @param string The template file to include
* @since 1.6
*/
public function display($tpl = null)
{
//load required files
JForm::addFormPath(JPATH_SITE . '/components/com_users/models/forms');
JForm::addFieldPath(JPATH_SITE . '/components/com_users/models/fields');
require_once JPATH_SITE . '/components/com_users/models/registration.php';
//load com_users language
$lang = JFactory::getLanguage();
$lang->load('com_users');
$model = JModelLegacy::getInstance('Registration', 'UsersModel');
$app = JFactory::getApplication();
// Get the view data.
$this->data = $model->getData();
$this->form = $model->getForm();
//$this->state = $model->get('State');
$this->params = $app->getParams('com_hs_users');
// Check for errors.
if (count($errors = $model->get('Errors'))) {
JError::raiseError(500, implode('<br />', $errors));
return false;
}
// Check for layout override
$active = JFactory::getApplication()->getMenu()->getActive();
if (isset($active->query['layout'])) {
$this->setLayout($active->query['layout']);
}
//Escape strings for HTML output
$this->pageclass_sfx = htmlspecialchars($this->params->get('pageclass_sfx'));
$this->prepareDocument();
parent::display($tpl);
}
示例9: getForm
/**
* Method to get the link form.
*
* @return mixed JForm object on success, false on failure.
* @since 1.6
*/
public function getForm($view = null)
{
// Initialise variables.
$false = false;
if (!$view) {
$view = JRequest::getWord('view', 'language');
}
// Get the form.
jimport('joomla.form.form');
JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
JForm::addFieldPath(JPATH_COMPONENT . '/models/fields');
try {
$form = JForm::getInstance('jform', $view, array('control' => 'jform'));
} catch (Exception $e) {
$this->setError($e->getMessage());
return false;
}
// Check the session for previously entered form data.
$data = (array) $this->getOptions();
// Bind the form data if present.
if (!empty($data)) {
$form->bind($data);
}
return $form;
}
示例10: getForm
/**
* Method to get the form.
*
* @param string $view The view being processed
*
* @return mixed JForm object on success, false on failure.
*
* @since 3.1
*/
public function getForm($view = null)
{
/* @var InstallationApplicationWeb $app */
$app = JFactory::getApplication();
if (!$view) {
$view = $app->input->getWord('view', 'site');
}
// Get the form.
JForm::addFormPath(JPATH_COMPONENT . '/model/forms');
JForm::addFieldPath(JPATH_COMPONENT . '/model/fields');
JForm::addRulePath(JPATH_COMPONENT . '/model/rules');
try {
$form = JForm::getInstance('jform', $view, array('control' => 'jform'));
} catch (Exception $e) {
$app->enqueueMessage($e->getMessage(), 'error');
return false;
}
// Check the session for previously entered form data.
$data = (array) $this->getOptions();
// Bind the form data if present.
if (!empty($data)) {
$form->bind($data);
}
return $form;
}
示例11: getForm
public function getForm($data = array(), $loadData = true)
{
JForm::addFormPath(JPATH_COMPONENT_ADMINISTRATOR . '/models/forms');
JForm::addFieldPath(JPATH_COMPONENT_ADMINISTRATOR . '/models/fields');
$form = parent::getForm($data, $loadData);
return $form;
}
示例12: render
/**
* Render HTML Markup for administrator UI
*
* @return string
*/
public function render()
{
$adminFormXml = $this->_generateFormXML();
// Create form instance
$this->adminForm = new JForm('template-setting');
$this->adminForm->addFieldPath(JSN_PATH_TPLFRAMEWORK . '/libraries/joomlashine/form/fields');
$this->adminForm->load($adminFormXml->asXML());
$params = $this->helper->loadParams($this->data->params, $this->data->template);
// Bind value of parameters to form
foreach ($params as $key => $value) {
$this->adminForm->setValue($key, 'jsn', $value);
}
// Get Joomla application object
$app = JFactory::getApplication();
// Store current compression parameters
$app->setUserState('jsn.template.maxCompressionSize', $params['maxCompressionSize']);
$app->setUserState('jsn.template.cacheDirectory', $params['cacheDirectory']);
// Start rendering
ob_start();
include JSN_PATH_TPLFRAMEWORK_LIBRARIES . '/template/tmpl/default.php';
$body = ob_get_clean();
// Detect method to use for getting and setting response body
if (version_compare(JVERSION, '3.2.0', 'ge')) {
$get = array($app, 'getBody');
$set = array($app, 'setBody');
} else {
$get = array('JResponse', 'getBody');
$set = array('JResponse', 'setBody');
}
// Parse current response body
list($head, $tmp) = preg_split('/<form[^>]+name="adminForm"[^>]*>/', call_user_func($get), 2);
list($tmp, $foot) = explode('</form>', $tmp, 2);
// Replace current response body
call_user_func($set, $head . $body . $foot);
}
示例13: before
/**
* Load user form.
*
* @return void
*/
protected function before()
{
parent::before();
$userParams = JComponentHelper::getParams('com_users');
// Check if user is allowed to change his name.
$this->changeUsername = $userParams->get('change_login_name', 1);
// Check to see if Frontend User Params have been enabled.
if ($userParams->get('frontend_userparams', 0))
{
JFactory::getLanguage()->load('com_users', JPATH_ADMINISTRATOR);
JForm::addFormPath(JPATH_ROOT . '/components/com_users/models/forms');
JForm::addFieldPath(JPATH_ROOT . '/components/com_users/models/fields');
JPluginHelper::importPlugin('user');
$registry = new JRegistry($this->user->params);
$form = JForm::getInstance('com_users.profile', 'frontend');
$data = new StdClass;
$data->params = $registry->toArray();
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onContentPrepareForm', array($form, $data));
$form->bind($data);
$this->frontendForm = $form->getFieldset('params');
}
$this->headerText = JText::_('COM_KUNENA_PROFILE_EDIT_USER_TITLE');
}
示例14: display
function display($tpl = null)
{
// Load the helper(s)
if (!class_exists('VmHTML')) {
require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'html.php';
}
if (!class_exists('vmCustomPlugin')) {
require JPATH_VM_PLUGINS . DS . 'vmcustomplugin.php';
}
$model = VmModel::getModel('custom');
// TODO Make an Icon for custom
$this->SetViewTitle('PRODUCT_CUSTOM_FIELD');
$layoutName = vRequest::getCmd('layout', 'default');
if ($layoutName == 'edit') {
$this->addStandardEditViewCommands();
$customPlugin = '';
$this->custom = $model->getCustom();
$customfields = VmModel::getModel('customfields');
//vmdebug('VirtuemartViewCustom',$this->custom);
JPluginHelper::importPlugin('vmcustom');
$dispatcher = JDispatcher::getInstance();
$retValue = $dispatcher->trigger('plgVmOnDisplayEdit', array($this->custom->virtuemart_custom_id, &$customPlugin));
$this->SetViewTitle('PRODUCT_CUSTOM_FIELD', $this->custom->custom_title);
$selected = 0;
if (!empty($this->custom->custom_jplugin_id)) {
VmConfig::loadJLang('plg_vmpsplugin', false);
JForm::addFieldPath(JPATH_VM_ADMINISTRATOR . DS . 'fields');
$selected = $this->custom->custom_jplugin_id;
// Get the payment XML.
$formFile = JPath::clean(JPATH_ROOT . DS . 'plugins' . DS . 'vmcustom' . DS . $this->custom->custom_element . DS . $this->custom->custom_element . '.xml');
if (file_exists($formFile)) {
$this->custom->form = JForm::getInstance($this->custom->custom_element, $formFile, array(), false, '//vmconfig | //config[not(//vmconfig)]');
$this->custom->params = new stdClass();
$varsToPush = vmPlugin::getVarsToPushByXML($formFile, 'customForm');
$this->custom->params->custom_params = $this->custom->custom_params;
VmTable::bindParameterable($this->custom->params, 'custom_params', $varsToPush);
$this->custom->form->bind($this->custom);
} else {
$this->custom->form = null;
}
}
$this->pluginList = self::renderInstalledCustomPlugins($selected);
$this->assignRef('customPlugin', $customPlugin);
$this->assignRef('customfields', $customfields);
} else {
JToolBarHelper::custom('createClone', 'copy', 'copy', vmText::_('COM_VIRTUEMART_CLONE'), true);
JToolBarHelper::custom('toggle.admin_only.1', 'publish', '', vmText::_('COM_VIRTUEMART_TOGGLE_ADMIN'), true);
JToolBarHelper::custom('toggle.admin_only.0', 'unpublish', '', vmText::_('COM_VIRTUEMART_TOGGLE_ADMIN'), true);
JToolBarHelper::custom('toggle.is_hidden.1', 'publish', '', vmText::_('COM_VIRTUEMART_TOGGLE_HIDDEN'), true);
JToolBarHelper::custom('toggle.is_hidden.0', 'unpublish', '', vmText::_('COM_VIRTUEMART_TOGGLE_HIDDEN'), true);
$this->addStandardDefaultViewCommands();
$this->addStandardDefaultViewLists($model);
$customs = $model->getCustoms(vRequest::getInt('custom_parent_id'), vRequest::getCmd('keyword'));
$this->assignRef('customs', $customs);
$pagination = $model->getPagination();
$this->assignRef('pagination', $pagination);
}
parent::display($tpl);
}
示例15: __construct
public function __construct($config = array())
{
JForm::addFieldPath(JPATH_ROOT . '/administrator/components/com_azurapagebuilder/models/fields');
//JForm::addFormPath(JPATH_ROOT.'/templates/protostar/html/com_azurapagebuilder/forms');
JForm::addFormPath(JPATH_ROOT . '/administrator/components/com_azurapagebuilder/models/forms');
JForm::addFormPath(JPATH_THEMES . '/' . JFactory::getApplication()->getTemplate() . '/html/com_azurapagebuilder/forms');
parent::__construct();
}