/** * 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); }
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); }
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&controller=purgeupdate&task=view&tmpl=component', 470, 320); $this->toolbar->appendButton('Popup', 'cache', JText::_('COM_MIJOSEF_CACHE_CLEAN'), 'index.php?option=com_mijosef&controller=purgeupdate&task=cache&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); }
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; }
/** * 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); }
/** * Метод для отображения формы вопроса * @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); }
/** * 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'); }
function edit($tpl = NULL) { $row = $this->getModel()->getEditData('MijosefExtensions'); $ext_form = JForm::getInstance('extensionForm', JPATH_MIJOSEF_ADMIN . '/extensions/' . $row->extension . '.xml', array(), true, 'config'); $ext_values = array('params' => json_decode($row->params)); $ext_form->bind($ext_values); $default_form = JForm::getInstance('commonForm', JPATH_MIJOSEF_ADMIN . '/extensions/default_params.xml', array(), true, 'config'); $default_values = array('params' => json_decode($row->params)); $default_form->bind($default_values); $row->description = ''; $row->hasCats = 0; $xml_file = JPATH_MIJOSEF_ADMIN . '/extensions/' . $row->extension . '.xml'; if (file_exists($xml_file)) { $row->description = Mijosef::get('utility')->getXmlText($xml_file, 'description'); $row->hasCats = (int) Mijosef::get('utility')->getXmlText($xml_file, 'hasCats'); } // Get behaviors JHTML::_('behavior.combobox'); JHTML::_('behavior.tooltip'); // Assign data $this->assignRef('row', $row); $this->assignRef('ext_params', $ext_form); $this->assignRef('default_params', $default_form); parent::display($tpl); }
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; }
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(); }
/** * 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; }
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>'; }
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(); } }
/** * 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; }
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; }
/** * 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; } }
function save_code() { $code = JREQUEST::getVar('code', '', '', 'string'); $code = addslashes($code); jimport('joomla.form.form'); $params =& JForm::getInstance('params', JPATH_ADMINISTRATOR . '/components/com_muzeetop/config.xml'); $code_activation = $params->getInput('code_activation'); var_dump($code_activation); var_dump($params); $component =& JComponentHelper::getComponent('com_muzeetop'); if ($code != "" and strlen($code) == 8) { $params->setValue('code_activation', $code); var_dump($params); var_dump($code_activation); $parameters = $params->toString(); $db =& JFactory::getDBO(); $donnees = new stdClass(); $donnees->id = $component->id; $donnees->params = $parameters; $db->updateObject('#__components', $donnees, 'id'); if ($db !== false) { $msg = JTEXT::_('COM_MUZEETOP_MSG_CODE_ENREGISTRE'); } else { $msg = JTEXT::_('COM_MUZEETOP_MSG_ERREUR_BASE_CODE'); } } else { $msg = JText::_('COM_MUZEETOP_ERREUR_SAUVEGARDE_CODE'); } $link = 'index.php?option=com_muzeetop'; $this->setRedirect($link, $msg); }
function display($tpl = null) { $option = JRequest::getCmd('option'); $mainframe = JFactory::getApplication(); $uri = JFactory::getURI(); $user = JFactory::getUser(); $document = JFactory::getDocument(); $version = urlencode(JoomleagueHelper::getVersion()); $css = 'components/com_joomleague/assets/css/tabs.css?v=' . $version; $document->addStyleSheet($css); $model = $this->getModel(); $this->assignRef('club', $model->getClub()); $lists = array(); $this->club->merge_teams = explode(",", $this->club->merge_teams); $this->assignRef('form', $this->get('Form')); // extended club data $xmlfile = JLG_PATH_ADMIN . DS . 'assets' . DS . 'extended' . DS . 'club.xml'; $jRegistry = new JRegistry(); $jRegistry->loadString($this->club->extended, 'ini'); $extended =& JForm::getInstance('extended', $xmlfile, array('control' => 'extended'), false, '/config'); $extended->bind($jRegistry); $this->assignRef('extended', $extended); $this->assignRef('lists', $lists); $this->assign('cfg_which_media_tool', JComponentHelper::getParams('com_joomleague')->get('cfg_which_media_tool', 0)); $this->assign('cfg_be_show_merge_teams', JComponentHelper::getParams('com_joomleague')->get('cfg_be_show_merge_teams', 0)); parent::display($tpl); }
public function rules($config = array()) { $config = new KObjectConfigJson($config); $config->append(array( 'component' => 'com_docman', 'section' => 'component', 'name' => 'rules', 'asset' => null, 'asset_id' => 0 ))->append(array( 'id' => $config->name )); $xml = <<<EOF <form> <fieldset> <field name="asset_id" type="hidden" value="{$config->asset_id}" /> <field name="{$config->name}" type="rules" label="JFIELD_RULES_LABEL" translate_label="false" class="inputbox" filter="rules" component="{$config->component}" section="{$config->section}" validate="rules" id="{$config->id}" /> </fieldset> </form> EOF; $form = JForm::getInstance('com_docman.document.acl', $xml); $form->setValue('asset_id', null, $config->asset_id); return $form->getInput('rules'); }
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); }
/** * 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; }
/** * 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; }
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); }
function getForm() { $form = JForm::getInstance('submit', JPATH_COMPONENT . '/models/forms/submit.xml'); if (empty($form)) { return false; } return $form; }
/** * modified */ public function __construct($data = '', $path = '') { parent::__construct($data); jimport('joomla.form.form'); JForm::addFormPath($path); $form =& JForm::getInstance('templateDetails', JPATH_ADMINISTRATOR . '/templates/rt_missioncontrol/templateDetails.xml', array(), true, '//config'); $this->_form = $form; }
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(); }
public function getForm($group = null) { jimport('joomla.form.form'); if (class_exists('JForm')) { JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/com_jce'); $form = JForm::getInstance('com_jce.component', 'config', array('control' => 'params'), false, '/config'); if ($group) { return $form->getFieldset($group); } return $form; } else { $component = WFExtensionHelper::getComponent(); // get params definitions $params = json_decode($component->params); $rules = isset($params->access) ? $params->access : null; // Build the form control. $curLevel = 0; $actions = $this->getActions(); $groups = $this->getUserGroups(); $tabs = array('<ul class="nav nav-tabs">'); $content = array('<div class="tabs-content">'); foreach ($groups as $group) { $difLevel = $group->level - $curLevel; $html = array(); $item = new StdClass(); $id = $curLevel; $tabs[] = '<li><a href="#permission-' . $id . '">' . str_repeat('<span> › </span> ', $curLevel = $group->level) . $group->text . '</a></li>'; $content[] = '<div id="permission-' . $id . '" class="tab-pane">'; $content[] = '<table border="0" cellspacing="1" class="table table-striped">'; $content[] = '<thead>'; $content[] = '<tr>'; $content[] = '<th><span>' . WFText::_('WF_RULES_ACTION') . '</span></th>'; $content[] = '<th><span>' . WFText::_('WF_RULES_SELECT_SETTING') . '</span></th>'; $content[] = '</tr>'; $content[] = '</thead>'; $content[] = '<tbody>'; foreach ($actions as $action) { $content[] = '<tr>'; $content[] = '<td><label class="tooltip" for="' . $action->name . '_' . $group->value . '" title="' . htmlspecialchars(WFText::_($action->title) . '::' . WFText::_($action->description), ENT_COMPAT, 'UTF-8') . '">' . WFText::_($action->title) . '</label></td>'; $content[] = '<td>'; $content[] = '<select name="params[rules][' . $action->name . '][' . $group->value . ']" id="' . $action->name . '_' . $group->value . '" title="' . WFText::sprintf('WF_RULES_SELECT_ALLOW_DENY_GROUP', WFText::_($action->title), trim($group->text)) . '">'; $assetRule = $this->checkRule($rules, $action->name, $group->value); $content[] = '<option value="1"' . ($assetRule === true ? ' selected="selected"' : '') . '>' . WFText::_('WF_RULES_ALLOWED') . '</option>'; $content[] = '<option value="0"' . ($assetRule === false ? ' selected="selected"' : '') . '>' . WFText::_('WF_RULES_DENIED') . '</option>'; $content[] = '</select>  '; $content[] = '</td>'; $content[] = '</tr>'; } $content[] = '</tbody>'; $content[] = '</table>'; $content[] = '</div>'; } $tabs[] = '</ul>'; $content[] = '</div>'; return implode('', array_merge($tabs, $content)); } return null; }
function display($tpl = null) { $db = JFactory::getDBO(); if ( $virtuemart_media_id = vRequest::getInt('virtuemart_media_id') ) { //$db = JFactory::getDBO(); $query='SELECT `file_url`,`file_title` FROM `#__virtuemart_medias` where `virtuemart_media_id`='.$virtuemart_media_id; $db->setQuery( $query ); $json = $db->loadObject(); if (isset($json->file_url)) { $json->file_url = JURI::root().$json->file_url; $json->msg = 'OK'; echo json_encode($json); } else { $json->msg = '<b>'.vmText::_('COM_VIRTUEMART_NO_IMAGE_SET').'</b>'; echo json_encode($json); } } elseif ( $custom_jplugin_id = vRequest::getInt('custom_jplugin_id') ) { $table = '#__extensions'; $ext_id = 'extension_id'; $q = 'SELECT `params`,`element` FROM `' . $table . '` WHERE `' . $ext_id . '` = "'.$custom_jplugin_id.'"'; $db ->setQuery($q); $this->jCustom = $db ->loadObject(); $customModel = VmModel::getModel('custom'); $this->custom = $customModel -> getCustom(); // Get the payment XML. $formFile = JPath::clean( VMPATH_ROOT .DS. 'plugins' .DS. 'vmcustom' .DS . $this->jCustom->element . DS . $this->jCustom->element . '.xml'); if (file_exists($formFile)){ VmConfig::loadJLang('plg_vmpsplugin', false); if (!class_exists('vmPlugin')) require(VMPATH_PLUGINLIBS . DS . 'vmplugin.php'); $filename = 'plg_vmcustom_' . $this->jCustom->element; vmPlugin::loadJLang($filename,'vmcustom',$this->jCustom->element); $this->custom = VmModel::getModel('custom')->getCustom(); $varsToPush = vmPlugin::getVarsToPushByXML($formFile,'customForm'); $this->custom->form = JForm::getInstance($this->jCustom->element, $formFile, array(),false, '//vmconfig | //config[not(//vmconfig)]'); $this->custom->params = new stdClass(); foreach($varsToPush as $k => $field){ if(strpos($k,'_')!=0){ $this->custom->params->$k = $field[0]; } } $this->custom->form->bind($this->custom->getProperties()); $form = $this->custom->form; include(VMPATH_ADMIN.DS.'fields'.DS.'formrenderer.php'); echo '<input type="hidden" value="'.$this->jCustom->element.'" name="custom_value">'; } else { $this->custom->form = null; VmConfig::$echoDebug = 1; vmdebug ('File does not exist '.$formFile); } } jExit(); }
public function onCCK_FieldPrepareForm(&$field, $value = '', &$config = array(), $inherit = array(), $return = false) { if (self::$type != $field->type) { return; } self::$path = parent::g_getPath(self::$type . '/'); parent::g_onCCK_FieldPrepareForm($field, $config); // Init if (count($inherit)) { $id = isset($inherit['id']) && $inherit['id'] != '' ? $inherit['id'] : $field->name; $name = isset($inherit['name']) && $inherit['name'] != '' ? $inherit['name'] : $field->name; } else { $id = $field->name; $name = $field->name; } $value = $value != '' ? $value : $field->defaultvalue; $value = $value != ' ' ? $value : ''; // Validate $validate = ''; if ($config['doValidation'] > 1) { plgCCK_Field_ValidationRequired::onCCK_Field_ValidationPrepareForm($field, $id, $config); $validate = count($field->validate) ? ' validate[' . implode(',', $field->validate) . ']' : ''; } // Prepare if ($value == 0) { $form = ''; } else { $class = 'inputbox select' . $validate . ($field->css ? ' ' . $field->css : ''); $xml = ' <form addfieldpath="/administrator/components/com_users/models/fields"> <field type="' . self::$type2 . '" name="' . $name . '" id="' . $id . '" label="' . htmlspecialchars($field->label) . '" class="' . $class . '" /> </form> '; $form = JForm::getInstance($id, $xml); $form = $form->getInput($name, '', $value); } // Set if (!$field->variation) { $field->form = $form; if ($field->script) { parent::g_addScriptDeclaration($field->script); } } else { $field->text = JCckDatabase::loadResult('SELECT title FROM #__usergroups WHERE id = ' . (int) $value); parent::g_getDisplayVariation($field, $field->variation, $value, $field->text, $form, $id, $name, '<select', '', '', $config); } $field->value = $value; // Return if ($return === true) { return $field; } }
public function __construct($config = array()) { // Load the AddEvent-form in JForm for the template to use $this->form =& JForm::getInstance('addEventForm', JPATH_COMPONENT . DIRECTORY_SEPARATOR . 'models' . DIRECTORY_SEPARATOR . 'addeventform.xml'); $jinput = JFactory::getApplication()->input; $this->form->setFieldAttribute('category', 'parentid', $jinput->get('category', 0, 'INT'), 'addEventFields'); $this->form->setFieldAttribute('category', 'categorydepth', $jinput->get('categorydepth', 2, 'INT'), 'addEventFields'); parent::__construct($config); }