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


PHP JForm::loadFile方法代码示例

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


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

示例1: onContentPrepareForm

 /**
  * Injects several fields into specific forms.
  *
  * @param   JForm  $form  The form to be altered.
  * @param   array  $data  The associated data for the form.
  *
  * @return  boolean
  *
  * @since   2.0
  */
 public function onContentPrepareForm($form, $data)
 {
     // Check we are manipulating a valid form
     if (!$form instanceof JForm) {
         $this->_subject->setError('JERROR_NOT_A_FORM');
         return false;
     }
     // Check if the password field needs injecting
     if ($this->params->get('use_ldap_password', false) && in_array($form->getName(), $this->passwordForms)) {
         // Check if this user should have a profile
         if (SHLdapHelper::isUserLdap(isset($data->id) ? $data->id : 0)) {
             if ($this->params->get('ldap_password_layout_edit', true)) {
                 // Check if this is in the 'edit' layout or in the save state
                 if (strtolower(JFactory::getApplication()->input->get('layout')) === 'edit' || strtolower(JFactory::getApplication()->input->get('task')) === 'save') {
                     $form->loadFile(realpath(__DIR__) . '/forms/ldap_password.xml', false, false);
                 }
             } else {
                 $form->loadFile(realpath(__DIR__) . '/forms/ldap_password.xml', false, false);
             }
         }
     }
     // Check if the domain field needs injecting
     if ($this->params->get('use_ldap_domain', false) && in_array($form->getName(), $this->domainForms)) {
         $form->loadFile(realpath(__DIR__) . '/forms/ldap_domain.xml', false, false);
     }
     return true;
 }
开发者ID:philbertphotos,项目名称:JMapMyLDAP,代码行数:37,代码来源:injection.php

示例2: preprocessForm

 protected function preprocessForm(\JForm $form, $data, $group = 'content')
 {
     // if no data, grab the posted form data.
     if (!$data instanceof JObject) {
         $data = JFactory::getApplication()->input->get('jform', $data, 'array');
         $data = JArrayHelper::toObject($data);
     }
     $params = new JRegistry();
     $params->loadArray($data->params);
     if ($params->get('discovery.url')) {
         $plugin = $params->get('discovery.type');
         $language = JFactory::getLanguage();
         $language->load('plg_harvest_' . $plugin);
         $path = JPATH_ROOT . '/plugins/harvest/' . $plugin . '/forms/harvest.xml';
         $form->loadFile($path, false);
         foreach (JPluginHelper::getPlugin('ingest') as $plugin) {
             $language->load('plg_ingest_' . $plugin->name);
             $path = JPATH_ROOT . '/plugins/ingest/' . $plugin->name . '/forms/ingest.xml';
             $form->loadFile($path, false);
         }
         $form->removeField('originating_url');
         $form->removeField('harvester');
         // hide the run_once value (users cannot set it after discovery)
         $form->setFieldAttribute("run_once", 'type', 'hidden');
         $form->setFieldAttribute("run_once", 'class', '');
     } else {
         $form->removeField('state');
         $form->removeField('harvested');
         $form->removeField('url', 'params.discovery');
         $form->removeField('type', 'params.discovery');
     }
     parent::preprocessForm($form, $data, $group);
 }
开发者ID:knowledgearcdotorg,项目名称:jharvest,代码行数:33,代码来源:harvest.php

示例3: onContentPrepareForm

 /**
  * 
  * Enter description here ...
  * @param JForm $form
  * @param unknown $data
  */
 function onContentPrepareForm($form, $data)
 {
     $app = JFactory::getApplication();
     $doc = JFactory::getDocument();
     $this->template = $this->getTemplateName();
     if ($this->template && ($app->isAdmin() && $form->getName() == 'com_templates.style' || $app->isSite() && ($form->getName() == 'com_config.templates' || $form->getName() == 'com_templates.style'))) {
         jimport('joomla.filesystem.path');
         //JForm::addFormPath( dirname(__FILE__) . DS. 'includes' . DS .'assets' . DS . 'admin' . DS . 'params');
         $plg_file = JPath::find(dirname(__FILE__) . DS . 'includes' . DS . 'assets' . DS . 'admin' . DS . 'params', 'template.xml');
         $tpl_file = JPath::find(JPATH_ROOT . DS . 'templates' . DS . $this->template, 'templateDetails.xml');
         if (!$plg_file) {
             return false;
         }
         if ($tpl_file) {
             $form->loadFile($plg_file, false, '//form');
             $form->loadFile($tpl_file, false, '//config');
         } else {
             $form->loadFile($plg_file, false, '//form');
         }
         if ($app->isSite()) {
             $jmstorage_fields = $form->getFieldset('jmstorage');
             foreach ($jmstorage_fields as $name => $field) {
                 $form->removeField($name, 'params');
             }
             $form->removeField('config', 'params');
         }
         if ($app->isAdmin()) {
             $doc->addStyleDeclaration('#jm-ef3plugin-info, .jm-row > .jm-notice {display: none !important;}');
         }
     }
 }
开发者ID:chaudhary4k4,项目名称:modernstore,代码行数:37,代码来源:jmframework.php

示例4: 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;
 }
开发者ID:esorone,项目名称:efcpw,代码行数:30,代码来源:ckcontainer.php

示例5: 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;
 }
开发者ID:pjasmits,项目名称:JoomlaPluginsBook,代码行数:43,代码来源:ch05test02.php

示例6: preprocessForm

 /**
  * Method to preprocess the form
  *
  * @param   JForm   $form   A form object.
  * @param   mixed   $data   The data expected for the form.
  * @param   string  $group  The name of the plugin group to import (defaults to "content").
  *
  * @return  void
  *
  * @since   3.2
  * @throws  Exception if there is an error loading the form.
  */
 protected function preprocessForm(JForm $form, $data, $group = 'content')
 {
     jimport('joomla.filesystem.path');
     $lang = JFactory::getLanguage();
     $module = $this->getState()->get('module.name');
     $basePath = JPATH_BASE;
     $formFile = JPath::clean($basePath . '/modules/' . $module . '/' . $module . '.xml');
     // Load the core and/or local language file(s).
     $lang->load($module, $basePath, null, false, true) || $lang->load($module, $basePath . '/modules/' . $module, null, false, true);
     if (file_exists($formFile)) {
         // Get the module form.
         if (!$form->loadFile($formFile, false, '//config')) {
             throw new Exception(JText::_('JERROR_LOADFILE_FAILED'));
         }
         // Attempt to load the xml file.
         if (!($xml = simplexml_load_file($formFile))) {
             throw new Exception(JText::_('JERROR_LOADFILE_FAILED'));
         }
     }
     // Load the default advanced params
     JForm::addFormPath(JPATH_BASE . '/components/com_config/model/form');
     $form->loadFile('modules_advanced', false);
     // Trigger the default form events.
     parent::preprocessForm($form, $data, $group);
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:37,代码来源:modules.php

示例7: preprocessForm

 /**
  * Override preprocessForm to load the user plugin group instead of content.
  *
  * @param   JForm   $form   A JForm object.
  * @param   mixed   $data   The data expected for the form.
  * @param   string  $group  The name of the plugin group to import (defaults to "content").
  *
  * @return  void
  *
  * @since   1.6
  * @throws  Exception if there is an error in the form event.
  */
 protected function preprocessForm(JForm $form, $data, $group = 'user')
 {
     $userParams = JComponentHelper::getParams('com_users');
     //Add the choice for site language at registration time
     if ($userParams->get('site_language') == 1 && $userParams->get('frontend_userparams') == 1) {
         $form->loadFile('sitelang', false);
     }
 }
开发者ID:vstorm83,项目名称:propertease,代码行数:20,代码来源:login.php

示例8: getForm

 public static function getForm()
 {
     $myForm = new JForm('callback');
     // Добавили путь где лежит форма здесь form.xml лежит в корне модуля
     $myForm->addFormPath(__DIR__);
     // Прочитали и вернули
     $myForm->loadFile('form', false);
     return $myForm;
 }
开发者ID:spiridonov-oa,项目名称:SheinCandles,代码行数:9,代码来源:helper.php

示例9: getAssignments

 /**
  * Function that gets the config settings
  *
  * @return    Object
  */
 protected function getAssignments()
 {
     if (!isset($this->assignments)) {
         $xmlfile = JPATH_ADMINISTRATOR . '/components/com_advancedmodules/assignments.xml';
         $assignments = new JForm('assignments', array('control' => 'advancedparams'));
         $assignments->loadFile($xmlfile, 1, '//config');
         $assignments->bind($this->item->advancedparams);
         $this->assignments = $assignments;
     }
     return $this->assignments;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:16,代码来源:view.html.php

示例10: onContentPrepareForm

 /**
  * Event onContentPrepareForm
  *
  * @param JForm $form
  * @param array $data
  *
  * @return bool
  */
 public function onContentPrepareForm($form, $data)
 {
     if (!$form instanceof JForm) {
         $this->_subject->setError('JERROR_NOT_A_FORM');
         return false;
     }
     $context = $form->getName();
     if (!in_array($context, $this->allowedContext)) {
         return true;
     }
     JForm::addFormPath(__DIR__ . '/form');
     $form->loadFile('form', false);
     return true;
 }
开发者ID:apiceweb,项目名称:MageBridgeCore,代码行数:22,代码来源:magebridgefirstlast.php

示例11: displayTask

 /**
  * Display configurations for registration
  *
  * @return  void
  */
 public function displayTask()
 {
     $config = new \JForm('com_members.registration');
     $config->loadFile(dirname(dirname(__DIR__)) . DS . 'config' . DS . 'config.xml', true, '/config');
     $config->bind($this->config->toArray());
     $this->config = $config;
     $this->view->params = $config->getFieldset('registration');
     // Set any errors
     if ($this->getError()) {
         $this->view->setError($this->getError());
     }
     // Output the HTML
     $this->view->display();
 }
开发者ID:mined-gatech,项目名称:hubzero-cms,代码行数:19,代码来源:registration.php

示例12: onContentPrepareForm

 /**
  * @param   JForm   $form   The form to be altered.
  * @param   array   $data   The associated data for the form.
  *
  * @return    boolean
  */
 public function onContentPrepareForm($form, $data)
 {
     if (!$form instanceof JForm) {
         $this->_subject->setError('JERROR_NOT_A_FORM');
         return false;
     }
     // Check we are manipulating a valid form.
     if (!in_array($form->getName(), array('com_admin.profile', 'com_users.user', 'com_users.registration', 'com_users.profile'))) {
         return true;
     }
     // Add the registration fields to the form.
     JForm::addFormPath(dirname(__FILE__) . '/form');
     $form->loadFile('socialmetatags', false);
     return true;
 }
开发者ID:n9iels,项目名称:pkg_SocialMetaTags,代码行数:21,代码来源:socialmetatags.php

示例13: onContentPrepareForm

 /**
  * @param	JForm	$form	The form to be altered.
  * @param	array	$data	The associated data for the form.
  *
  * @return	boolean
  * @since	1.6
  */
 function onContentPrepareForm($form, $data)
 {
     if (!$form instanceof JForm) {
         $this->_subject->setError('JERROR_NOT_A_FORM');
         return false;
     }
     // Check we are manipulating a valid form.
     $name = $form->getName();
     if (!in_array($name, array('com_users.registration'))) {
         return true;
     }
     // Add the registration fields to the form.
     JForm::addFormPath(dirname(__FILE__) . '/forms');
     $form->loadFile('hprecaptcha', false);
     return true;
 }
开发者ID:ngxuanmui,项目名称:hanhphuc.vn,代码行数:23,代码来源:hprecaptcha.php

示例14: 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;
     }
     JForm::addFormPath(__DIR__ . '/form');
     $form->loadFile('form');
     if (!empty($data->id)) {
         $data = $this->loadTest($data);
     }
     return true;
 }
开发者ID:pjasmits,项目名称:JoomlaPluginsBook,代码行数:25,代码来源:ch05test01.php

示例15: onContentPrepareForm

 function onContentPrepareForm(JForm $form, $data)
 {
     $name = $form->getName();
     if (!in_array($name, array('com_admin.profile', 'com_users.user', 'com_users.profile', 'com_users.registration'))) {
         return true;
     }
     // Add the extra fields
     JForm::addFormPath(dirname(__FILE__) . '/profiles');
     $form->loadFile('profile', false);
     // If we're admin we can do some extra things
     if ($name != "com_users.user") {
         $form->setFieldAttribute("programmename", "readonly", true, "swg_extras");
         // 			$form->setFieldAttrib("leaderid", "readonly", )
         $form->removeField("leaderid", "swg_extras");
         $form->removeField("leadersetup", "swg_extras");
     }
     return true;
 }
开发者ID:SheffieldWalkingGroup,项目名称:swgwebsite,代码行数:18,代码来源:swg_profileextras.php


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