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


PHP JForm::getInstance方法代码示例

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


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

示例1: display

 /**
  * Display method
  *
  * @param string $tpl
  * @return null
  */
 public function display($tpl = null)
 {
     // Fetch this item
     $this->fetchItem();
     // Initialize the form-file
     $file = JPATH_ADMINISTRATOR . '/components/com_magebridge/models/product.xml';
     // Prepare the params-form
     $params = YireoHelper::toRegistry($this->item->params)->toArray();
     $params_form = JForm::getInstance('params', $file);
     $params_form->bind(array('params' => $params));
     $this->params_form = $params_form;
     // Prepare the actions-form
     $actions = YireoHelper::toRegistry($this->item->actions)->toArray();
     $actions_form = JForm::getInstance('actions', $file);
     JPluginHelper::importPlugin('magebridgeproduct');
     JFactory::getApplication()->triggerEvent('onMageBridgeProductPrepareForm', array(&$actions_form, (array) $this->item));
     $actions_form->bind(array('actions' => $actions));
     $this->actions_form = $actions_form;
     // Build the fields
     $this->lists['product'] = MageBridgeFormHelper::getField('magebridge.product', 'sku', $this->item->sku, null);
     // Check for a previous connector-value
     if (!empty($this->item->connector)) {
         $plugin = JPluginHelper::getPlugin('magebridgeproduct', $this->item->connector);
         if (empty($plugin)) {
             $plugin_warning = JText::sprintf('COM_MAGEBRIDGE_PRODUCT_PLUGIN_WARNING', $this->item->connector);
             JError::raiseWarning(500, $plugin_warning);
         }
     }
     parent::display($tpl);
 }
开发者ID:apiceweb,项目名称:MageBridgeCore,代码行数:36,代码来源:view.html.php

示例2: display

 function display($tpl = null)
 {
     // Get a refrence of the page instance in joomla
     $document = JFactory::getDocument();
     $version = urlencode(JoomleagueHelper::getVersion());
     $css = 'components/com_joomleague/assets/css/tabs.css?v=' . $version;
     $document->addStyleSheet($css);
     // Joomleague model
     $model = $this->getModel();
     $user = JFactory::getUser();
     $rankingconfig = $model->getTemplateConfig("ranking");
     $this->assignRef('project', $model->getProject());
     $this->assignRef('overallconfig', $model->getTemplateConfig('overall'));
     $this->assignRef('rankingconfig', $rankingconfig);
     $this->assignRef('playgrounds', $model->getPlaygrounds());
     $this->assignRef('match', $model->getMatch());
     $this->assignRef('team1', $model->getTeaminfo($this->match->projectteam1_id));
     $this->assignRef('team2', $model->getTeaminfo($this->match->projectteam2_id));
     $isAllowed = $model->isAllowed() || $model->isMatchAdmin($this->match->id, $user->id);
     $this->assignRef('showediticon', $isAllowed);
     //echo '<br /><pre>~' . print_r( $this->match, true ) . '~</pre><br />';
     // extended match data
     $xmlfile = JLG_PATH_ADMIN . DS . 'assets' . DS . 'extended' . DS . 'match.xml';
     $jRegistry = new JRegistry();
     $jRegistry->loadString($this->match->extended, 'ini');
     $extended =& JForm::getInstance('extended', $xmlfile, array('control' => 'extended'), false, '/config');
     $extended->bind($jRegistry);
     $lists = array();
     // build the html select booleanlist for cancel
     $lists['cancel'] = JHTML::_('select.booleanlist', 'cancel', 'class="inputbox"', $this->match->cancel);
     $playgrounds[] = JHTML::_('select.option', '0', JText::_('COM_JOOMLEAGUE_GLOBAL_SELECT_PLAYGROUND'));
     if (!empty($this->playgrounds)) {
         $playgrounds = array_merge($playgrounds, $this->playgrounds);
     }
     $lists['playgrounds'] = JHTML::_('select.genericlist', $playgrounds, 'playground_id', 'class="inputbox" size="1"', 'value', 'text', $this->match->playground_id);
     //match relation lists
     //$mdlMatch = $model->getMatch();
     $oldmatches[] = JHTML::_('select.option', '0', JText::_('COM_JOOMLEAGUE_EDITMATCH_SELECT_PREV_MATCH'));
     $res = array();
     $new_match_id = $this->match->new_match_id ? $this->match->new_match_id : 0;
     if ($res =& $model->getMatchRelationsOptions($this->project->id, $this->match->id . "," . $new_match_id)) {
         $oldmatches = array_merge($oldmatches, $res);
     }
     unset($res);
     $lists['old_match'] = JHTML::_('select.genericlist', $oldmatches, 'old_match_id', 'class="inputbox" size="1"', 'value', 'text', $this->match->old_match_id);
     $newmatches[] = JHTML::_('select.option', '0', JText::_('COM_JOOMLEAGUE_EDITMATCH_SELECT_NEW_MATCH'));
     $res = array();
     $old_match_id = $this->match->old_match_id ? $this->match->old_match_id : 0;
     if ($res =& $model->getMatchRelationsOptions($this->project->id, $this->match->id . "," . $old_match_id)) {
         $newmatches = array_merge($newmatches, $res);
     }
     unset($res);
     $lists['new_match'] = JHTML::_('select.genericlist', $newmatches, 'new_match_id', 'class="inputbox" size="1"', 'value', 'text', $this->match->new_match_id);
     $this->assignRef('form', $this->get('form'));
     $this->assignRef('extended', $extended);
     $this->assignRef('lists', $lists);
     $pageTitle = JText::_('COM_JOOMLEAGUE_EDITMATCH_MATCHDETAILS');
     $document->setTitle($pageTitle);
     parent::display($tpl);
 }
开发者ID:santas156,项目名称:joomleague-2-komplettpaket,代码行数:60,代码来源:view.html.php

示例3: edit

 function edit($tpl = null)
 {
     // Toolbar
     JToolBarHelper::title(JText::_('COM_MIJOSEF_COMMON_CONFIGURATION'), 'mijosef');
     JToolBarHelper::custom('save', 'save1.png', 'save1.png', JText::_('Save'), false);
     JToolBarHelper::custom('apply', 'apply1.png', 'apply1.png', JText::_('Apply'), false);
     JToolBarHelper::custom('cancel', 'cancel1.png', 'cancel1.png', JText::_('Cancel'), false);
     JToolBarHelper::divider();
     $this->toolbar->appendButton('Popup', 'purgeupdate', JText::_('COM_MIJOSEF_COMMON_PURGEUPDATE'), 'index.php?option=com_mijosef&amp;controller=purgeupdate&amp;task=view&amp;tmpl=component', 470, 320);
     $this->toolbar->appendButton('Popup', 'cache', JText::_('COM_MIJOSEF_CACHE_CLEAN'), 'index.php?option=com_mijosef&amp;controller=purgeupdate&amp;task=cache&amp;tmpl=component', 300, 380);
     JToolBarHelper::divider();
     $this->toolbar->appendButton('Popup', 'help1', JText::_('Help'), 'http://www.mijosoft.com/support/docs/mijosef/user-manual/configuration?tmpl=component', 650, 500);
     // Get behaviors
     JHTML::_('behavior.mootools');
     JHTML::_('behavior.tooltip');
     // Import Editor
     $editor = JFactory::getEditor();
     if ($this->MijosefConfig->sm_auto_cron_last == "") {
         $this->MijosefConfig->sm_auto_cron_last = time();
     }
     $permissions = JForm::getInstance('permissions', JPATH_MIJOSEF_ADMIN . '/permissions.xml', array(), true, 'config');
     $permissions->bind(array('permissions' => json_decode($this->get('Permissions'))));
     // Get data from the model
     $this->editor = $editor;
     $this->lists = $this->get('Lists');
     $this->permissions = $permissions;
     parent::display($tpl);
 }
开发者ID:affiliatelk,项目名称:ecc,代码行数:28,代码来源:view.edit.php

示例4: getInput

 protected function getInput()
 {
     $end = $this->element['end'];
     $styles = $this->element['styles'];
     $imageurl = 'url(' . $this->getPathToElements() . '/images/slideshowck_styles.png)';
     // load the form
     $identifier = 'params';
     //var_dump($this->form);die();
     $form = JForm::getInstance('com_modules.module');
     // JForm::addFormPath(JPATH_SITE . '/modules/mod_slideshowck/elements/ckslideshowstyles');
     // if (!$formexists = $form->loadFile('ckslideshowstyles', false)) {
     // echo '<p style="color:red">'.JText::_('Problem loading the file : '.$identifier.'.xml').'</p>';
     // return '';
     // }
     // $this->setJsFunction();
     $fields = $form->getFieldset();
     // var_dump($fields);
     $html = '';
     $html .= '<input name="' . $this->name . '" id="ckslideshowstyles" type="hidden" value="' . $this->value . '" />';
     $html .= '<div style="position:relative;">';
     foreach ($fields as $key => $field) {
         // var_dump($key);
         // var_dump($field->fieldname);//die();
         // $html .=  $form->getInput('height','params');
         // $html .= $form->getLabel(str_replace($identifier."_","",$key), $identifier);
         // $html .= $form->getInput(str_replace($identifier."_","",$key), $identifier);
     }
     // $html .=  $form->getInput('height','params',NULL);
     // $html .=  $form->getInput('params_height');
     $html .= '</div>';
     return $html;
 }
开发者ID:esorone,项目名称:efcpw,代码行数:32,代码来源:ckslideshowstyles.php

示例5: 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);
 }
开发者ID:enjoy2000,项目名称:714engineers,代码行数:36,代码来源:view.html.php

示例6: 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);
 }
开发者ID:ASDAFF,项目名称:smfaq,代码行数:35,代码来源:view.html.php

示例7: 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');
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:37,代码来源:display.php

示例8: getForm

 public static function getForm()
 {
     $form = JForm::getInstance('wow_demo', __DIR__ . '/forms/default.xml');
     $data = JFactory::getSession()->get('wow_demo', new Joomla\Registry\Registry());
     $form->bind($data->toArray());
     return $form;
 }
开发者ID:b2un0,项目名称:joomla-package-wow-demo,代码行数:7,代码来源:helper.php

示例9: showAdminForm

 function showAdminForm()
 {
     $model = JModel::getInstance('Gateways', 'JTheFactoryModel');
     $params = $model->loadGatewayParams($this->name);
     jimport('joomla.form.form');
     $form = JForm::getInstance($this->name, $this->formxml);
     $form->bind($params->toArray());
     $fieldsets = $form->getFieldsets();
     if (file_exists($this->pluginfolder . DS . 'logo.png')) {
         echo "<div style='padding:15px;'><img src='" . $this->getLogo() . "' border='0'></div>";
     }
     echo "<form name='adminForm' action='index.php' method='post'>";
     echo "<input name='option' type='hidden' value='" . APP_EXTENSION . "'>";
     echo "<input name='task' type='hidden' value='gateways.save'>";
     echo "<input name='classname' type='hidden' value='{$this->name}'>";
     if (count($fieldsets)) {
         foreach ($fieldsets as $fieldset) {
             $fields = $form->getFieldset((string) $fieldset->name);
             $this->showFieldSet($fields, (string) $fieldset->name);
         }
     } else {
         $fields = $form->getFieldset();
         $this->showFieldSet($fields);
     }
     echo "</form>";
     self::setToolbar();
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:27,代码来源:gateways.php

示例10: 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;
 }
开发者ID:pashakiz,项目名称:crowdf,代码行数:70,代码来源:data.php

示例11: 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>';
 }
开发者ID:q0821,项目名称:esportshop,代码行数:25,代码来源:widgetsettings.php

示例12: display

 function display($tmpl = 'default', $return = false)
 {
     //JHTMLBehavior::formvalidation();
     $form =& JForm::getInstance('plg_contactformpro.form', dirname(__FILE__) . '/../../forms/form.xml');
     if (!$form instanceof JForm) {
         $this->_subject->setError('JERROR_NOT_A_FORM');
         return false;
     }
     $dispatcher = JDispatcher::getInstance();
     // CHANGE FOR A COPY OF POST + CUSTOM FIELDS
     // Trigger the form preparation event.
     $dispatcher->trigger('onContentPrepareForm', array($form, $this->params));
     // Trigger the data preparation event.
     $dispatcher->trigger('onContentPrepareData', array('plg_contactformpro.form', $this->params));
     // Load the data into the form after the plugins have operated.
     $form->bind($this->params);
     $config = JFactory::getConfig();
     $site_url = $config->get('site_url');
     if (trim($site_url) == '') {
         $uri = JURI::getInstance();
         $site_url = $uri->toString(array('scheme', 'host', 'port'));
     }
     $footer = defined('JF_PREMIUM_PATH') ? '' : '<p class="jf-copy" style="display:block !important;position:absolute;bottom:0;right:0;background: none #ffffff;margin:0;padding:0;"><small><a href="http://joomfever.com/extensions-joomla/viewcategory/24-banner-rotator">Joomla! Banner Rotator</a></small></p>';
     if ($return) {
         ob_start();
     }
     include 'tmpl' . DS . $tmpl . '.php';
     if ($return) {
         return ob_get_clean();
     }
 }
开发者ID:jmangarret,项目名称:webtuagencia24,代码行数:31,代码来源:view.html.php

示例13: 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;
 }
开发者ID:Joomla-on-NoSQL,项目名称:LaMojo,代码行数:31,代码来源:setup.php

示例14: onK2RenderAdminForm

 public function onK2RenderAdminForm(&$form, $row, $type)
 {
     jimport('joomla.form.form');
     $manifest = JPATH_SITE . '/plugins/k2/' . $this->_name . '/' . $this->_name . '.xml';
     $jform = JForm::getInstance('plg_k2_' . $this->_name . '_' . $type, $manifest, array(), true, 'fieldset[starts-with(@name, "' . $type . '")]');
     foreach ($jform->getFieldsets() as $fieldset) {
         if (!isset($form->k2Plugins[$fieldset->name])) {
             $form->k2Plugins[$fieldset->name] = array();
         }
         foreach ($jform->getFieldset($fieldset->name) as $field) {
             // Compute the field name
             $name = $this->_name . '_' . $field->__get('name');
             // Handle array names
             if (strpos($name, '[]')) {
                 $name = str_replace('[]', '', $name);
             }
             // Set the value
             if (isset($row->plugins->{$name})) {
                 $field->setValue($row->plugins->{$name});
             }
             // Set the field name
             $field->__set('name', 'plugins[' . $name . ']');
             // Create field object
             $tmp = new stdClass();
             $tmp->input = $field->__get('input');
             $tmp->label = $field->__get('label');
             // Push it to the array
             $form->k2Plugins[$fieldset->name][] = $tmp;
         }
     }
     $this->onK2RenderAdminHead($row, $type);
     return true;
 }
开发者ID:Naldo100,项目名称:k2-v3-dev-build,代码行数:33,代码来源:plugin.php

示例15: postflight

 /**
  * method to run after an install/update/uninstall method
  *
  * @return void
  */
 function postflight($type, $parent)
 {
     $mainframe =& JFactory::getApplication();
     $db = JFactory::getDbo();
     // $parent is the class calling this method
     // $type is the type of change (install, update or discover_install)
     //echo '<p>' . JText::_('COM_JOOMLEAGUE_POSTFLIGHT_' . $type . '_TEXT' ) . $parent->get('manifest')->version . '</p>';
     $mainframe->enqueueMessage(JText::_(' Joomleague ') . $type . JText::_(' Version: ') . $parent->get('manifest')->version, '');
     $db->setQuery('SELECT params FROM #__extensions WHERE name = "joomleague" and type ="component" ');
     $paramsdata = json_decode($db->loadResult(), true);
     //$mainframe->enqueueMessage(JText::_('postflight paramsdata<br><pre>'.print_r($paramsdata,true).'</pre>'   ),'');
     $params = JComponentHelper::getParams('com_joomleague');
     $xmlfile = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_joomleague' . DS . 'config.xml';
     $jRegistry = new JRegistry();
     $jRegistry->loadString($params->toString('ini'), 'ini');
     $form =& JForm::getInstance('com_joomleague', $xmlfile, array('control' => ''), false, "/config");
     $form->bind($jRegistry);
     $newparams = array();
     foreach ($form->getFieldset($fieldset->name) as $field) {
         //echo 'name -> '. $field->name.'<br>';
         //echo ' -> '. $field->type.'<br>';
         //echo ' -> '. $field->input.'<br>';
         //echo 'value -> '. $field->value.'<br>';
         $newparams[$field->name] = $field->value;
     }
     //$mainframe->enqueueMessage(JText::_('postflight newparams<br><pre>'.print_r($newparams,true).'</pre>'   ),'');
     //$paramsString = json_encode( $newparams );
     //$mainframe->enqueueMessage(JText::_('postflight paramsString<br><pre>'.print_r($paramsString,true).'</pre>'   ),'');
     //$mainframe->enqueueMessage(JText::_('postflight jRegistry<br><pre>'.print_r($jRegistry,true).'</pre>'   ),'');
     //$mainframe->enqueueMessage(JText::_('postflight form<br><pre>'.print_r($form,true).'</pre>'   ),'');
     //$params = $form->getFieldsets('params');
     //$mainframe->enqueueMessage(JText::_('postflight params<br><pre>'.print_r($params,true).'</pre>'   ),'');
     switch ($type) {
         case "install":
             self::installComponentLanguages();
             self::installModules();
             self::installPlugins();
             self::createImagesFolder();
             self::migratePicturePath();
             //self::deleteInstallFolders();
             self::sendInfoMail();
             self::InstallJoomla();
             //$parent->getParent()->setRedirectURL('index.php?option=com_joomleague');
             break;
         case "update":
             self::installComponentLanguages();
             self::installModules();
             self::installPlugins();
             self::createImagesFolder();
             self::migratePicturePath();
             self::setParams($newparams);
             //self::deleteInstallFolders();
             self::sendInfoMail();
             self::InstallJoomla();
             //$parent->getParent()->setRedirectURL('index.php?option=com_joomleague');
             break;
         case "discover_install":
             break;
     }
 }
开发者ID:santas156,项目名称:joomleague-2-komplettpaket,代码行数:65,代码来源:script.php


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