本文整理汇总了PHP中JForm::addFormPath方法的典型用法代码示例。如果您正苦于以下问题:PHP JForm::addFormPath方法的具体用法?PHP JForm::addFormPath怎么用?PHP JForm::addFormPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JForm
的用法示例。
在下文中一共展示了JForm::addFormPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* HTML view display method
*
* @param string $tpl The name of the template file to parse
* @return void
* @since 3.0
*/
public function display($tpl = null)
{
JToolBarHelper::title(JText::_('COM_JOOMGALLERY_AJAX_UPLOAD'), 'upload');
$this->_doc->addScriptDeclaration(' var jg_filenamewithjs = ' . ($this->_config->get('jg_filenamewithjs') ? 'true' : 'false') . ';');
// Load Fine Uploader resources
$this->_doc->addStyleSheet($this->_ambit->getScript('fineuploader/fineuploader.css'));
$this->_doc->addScript($this->_ambit->getScript('fineuploader/js/fineuploader' . (JFactory::getConfig()->get('debug') ? '' : '.min') . '.js'));
$this->fileSizeLimit = 0;
$this->chunkSize = 0;
$post_max_size = @ini_get('post_max_size');
if (!empty($post_max_size)) {
$post_max_size = JoomHelper::iniToBytes($post_max_size);
$this->chunkSize = (int) min(500000, (int) (0.8 * $post_max_size));
}
$upload_max_filesize = @ini_get('upload_max_filesize');
if (!empty($upload_max_filesize)) {
$upload_max_filesize = JoomHelper::iniToBytes($upload_max_filesize);
$this->fileSizeLimit = $upload_max_filesize;
}
$this->editFilename = $this->_config->get('jg_useorigfilename');
JForm::addFormPath(JPATH_COMPONENT . '/models/forms');
$this->form = JForm::getInstance(_JOOM_OPTION . '.ajaxupload', 'ajaxupload');
$this->form->setFieldAttribute('access', 'default', (int) JFactory::getConfig()->get('access'));
if ($this->_config->get('jg_useorigfilename')) {
$this->form->setFieldAttribute('imgtitle', 'required', 'false');
}
$this->sidebar = JHtmlSidebar::render();
parent::display($tpl);
}
示例2: getInput
protected function getInput()
{
$end = $this->element['end'];
$styles = $this->element['styles'];
$background = $this->element['background'] ? 'background-image: url(' . $this->getPathToImages() . '/images/' . $this->element['background'] . ');' : '';
$tag = $this->element['tag'];
if ($end == '1') {
// $html = '</li></'.$tag.'><li>';
$html = '</' . $tag . '><div><div>';
} else {
// $html = '</li><'.$tag.' style="'.$background.$styles.'" ><li>';
$html = '</div></div><' . $tag . ' style="' . $background . $styles . '" >';
}
// var_dump($html);
$identifier = 'menustyles';
$form = new JForm($identifier);
JForm::addFormPath(JPATH_SITE . '/modules/mod_slideshowck/elements/test');
if (!($formexists = $form->loadFile($identifier, false))) {
echo '<p style="color:red">' . JText::_('Problem loading the file : ' . $identifier . '.xml') . '</p>';
return '';
}
$fields = $form->getFieldset();
foreach ($fields as $key => $field) {
// echo '<div class="ckpopup_row">';
$html .= $form->getLabel(str_replace($identifier . "_", "", $key), $identifier);
$html .= $form->getInput(str_replace($identifier . "_", "", $key), $identifier);
// echo '</div>';
}
return $html;
}
示例3: onContentPrepareForm
/**
* Rendering Menu Params in menu editting form
*/
function onContentPrepareForm($form, $data)
{
if ($form->getName() == 'com_menus.item') {
JForm::addFormPath(dirname(__FILE__) . DS . "admin" . DS . "menu");
$form->loadFile('params', false);
}
}
示例4: onContentPrepareForm
function onContentPrepareForm($form, $data)
{
if ($form->getName() == 'com_menus.item') {
JForm::addFormPath(JPATH_SITE . '/plugins/system/yt/includes/libs/menu/params');
$form->loadFile('params', false);
}
}
示例5: onContentPrepareForm
function onContentPrepareForm($form, $data)
{
if ($form->getName()=='com_menus.item')//Add Helix menu params to the menu item
{
JHtml::_('behavior.framework', true);
$doc = JFactory::getDocument();
JForm::addFormPath(JPATH_PLUGINS.DS.'system'.DS.'helix'.DS.'elements');
$form->loadFile('params', false);
//Load js
$plg_path = JURI::root(true).'/plugins/system/helix/elements/menuscript.js';
$doc->addScript($plg_path, "text/javascript");
}
if ($form->getName()=='com_modules.module') {//Add Module positions :)
JHtml::_('behavior.framework', true);
$doc = JFactory::getDocument();
echo $this->getPositions();
$templates = $this->getTemplates ();
$groupHTML = array();
foreach($templates as $template){
$groupHTML[] = JHTML::_('select.option', $template, $template);
}
echo JHTML::_('select.genericlist', $groupHTML, "sp_tmpl", ' style="display:none" ', 'value', 'text', 'value');
$plg_path = JURI::root(true).'/plugins/system/helix/elements/positions.js';
$doc->addScript($plg_path, "text/javascript");
}
}
示例6: 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;
}
示例7: 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;
}
示例8: 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');
}
示例9: onContentPrepareForm
function onContentPrepareForm($form, $data)
{
if ($form->getName() == 'com_menus.item') {
JForm::addFormPath($this->_pluginPath);
$form->loadFile('parameters', false);
}
}
示例10: display
/**
* Method to display the view.
*
* @param string $tpl The template file to include
* @since 1.6
*/
public function display($tpl = null)
{
JForm::addFormPath(JPATH_SITE . '/components/com_users/models/forms');
require_once JPATH_SITE . '/components/com_users/models/profile.php';
$userModel = JModelLegacy::getInstance('Profile', 'UsersModel');
// Get the view data.
$this->data = $userModel->getData();
$this->form = $userModel->getForm();
$this->state = $userModel->get('State');
$this->params = JComponentHelper::getParams('com_users');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode('<br />', $errors));
return false;
}
// Check if a user was found.
if (!$this->data->id) {
JError::raiseError(404, JText::_('JERROR_USERS_PROFILE_NOT_FOUND'));
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);
}
示例11: post
public function post()
{
// Set variables to be used
JMHelper::setSessionUser();
JFactory::getLanguage()->load('com_users', JPATH_ADMINISTRATOR);
// Include dependencies
jimport('joomla.application.component.controller');
jimport('joomla.form.form');
jimport('joomla.database.table');
JModel::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_users/models');
JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/com_users/models/forms');
JTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_users/tables');
// Get user data
$data = JRequest::getVar('jform', array(), 'post', 'array');
if (!isset($data['groups'])) {
$data['groups'] = array();
}
// Save user
$model = JModel::getInstance('User', 'UsersModel');
$model->getState('user.id');
// This is only here to trigger populateState()
$success = $model->save($data);
if ($model->getError()) {
$response = $this->getErrorResponse(400, $model->getError());
} elseif (!$success) {
$response = $this->getErrorResponse(400, JText::_('COM_JM_ERROR_OCURRED'));
} else {
$response = $this->getSuccessResponse(201, JText::_('COM_JM_SUCCESS'));
$response->id = $model->getState('user.id');
}
$this->plugin->setResponse($response);
}
示例12: onContentPrepareForm
function onContentPrepareForm($form, $data)
{
$app = JFactory::getApplication();
$option = $app->input->get('option');
$show = $this->params->get('showfield');
switch ($option) {
case 'com_content':
if ($show == 0) {
if ($app->isAdmin()) {
JForm::addFormPath(__DIR__ . '/forms');
$form->loadFile('content', false);
}
if ($app->isSite()) {
JForm::addFormPath(__DIR__ . '/forms');
$form->loadFile('content', false);
}
} elseif ($show == 1) {
if ($app->isAdmin()) {
JForm::addFormPath(__DIR__ . '/forms');
$form->loadFile('content', false);
}
} else {
if ($app->isSite()) {
JForm::addFormPath(__DIR__ . '/forms');
$form->loadFile('content', false);
}
}
return true;
}
return true;
}
示例13: onContentPrepareForm
/**
* Event method that runs on content preparation
*
* @param JForm $form The form object
* @param integer $data The form data
*
* @return bool
*/
public function onContentPrepareForm($form, $data)
{
if (!$form instanceof JForm) {
$this->_subject->setError('JERROR_NOT_A_FORM');
return false;
}
$name = $form->getName();
if (!in_array($name, array('com_content.article'))) {
return true;
}
$include_categories = $this->params->get('include_categories');
if (empty($include_categories)) {
return true;
}
if (empty($data)) {
$input = JFactory::getApplication()->input;
$data = (object) $input->post->get('jform', array(), 'array');
}
if (is_array($data)) {
jimport('joomla.utilities.arrayhelper');
$data = JArrayHelper::toObject($data);
}
if (empty($data->catid)) {
return true;
}
if (!in_array($data->catid, $include_categories)) {
return true;
}
JForm::addFormPath(__DIR__ . '/form');
$form->loadFile('form');
if (!empty($data->id)) {
$data = $this->loadTest($data);
}
return true;
}
示例14: edit
function edit()
{
JEVHelper::stylesheet('eventsadmin.css', 'administrator/components/' . JEV_COM_COMPONENT . '/assets/css/');
$document =& JFactory::getDocument();
$document->setTitle(JText::_('COM_JEVENTS_CONFIGURATION'));
// Set toolbar items for the page
JToolBarHelper::title(JText::_('COM_JEVENTS_CONFIGURATION'), 'jevents');
//APPLY BUTTON BY PRAKASH.
JToolBarHelper::apply('params.apply');
//APPLY BUTTON
JToolBarHelper::save('params.save');
JToolBarHelper::cancel('cpanel.cpanel');
$model = $this->getModel();
$this->params =& $model->getParams();
$component = JComponentHelper::getComponent(JEV_COM_COMPONENT);
JHTML::_('behavior.tooltip');
if (JVersion::isCompatible("1.6.0")) {
// Get the actions for the asset.
$actions = JAccess::getActions(JEV_COM_COMPONENT, "component");
jimport('joomla.form.form');
// Add the search path for the admin component config.xml file.
JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/' . JEV_COM_COMPONENT);
// Get the form.
$modelForm = $model->getForm();
$this->assignRef("form", $modelForm);
}
}
示例15: onContentPrepareForm
function onContentPrepareForm($form, $data)
{
if ($form->getName() == 'com_menus.item') {
JForm::addFormPath($this->_resources);
$form->loadFile('menus_edit_params', false);
}
}