/** * Ajax method to display the application settings * * @params $id Int Application id. * @params $appName String Application element **/ public function ajaxShowSettings($id, $appName) { $filter = JFilterInput::getInstance(); $id = $filter->clean($id, 'int'); $appName = $filter->clean($appName, 'string'); // Check permissions $my =& JFactory::getUser(); if ($my->id == 0) { return $this->ajaxBlockUnregister(); } $objResponse = new JAXResponse(); $appsModel = CFactory::getModel('apps'); $lang =& JFactory::getLanguage(); $lang->load('com_community'); $lang->load('plg_' . JString::strtolower($appName)); $lang->load('plg_' . JString::strtolower($appName), JPATH_ROOT . DS . 'administrator'); $xmlPath = CPluginHelper::getPluginPath('community', $appName) . DS . $appName . DS . 'config.xml'; jimport('joomla.filesystem.file'); $actions = ''; if (JFile::exists($xmlPath)) { $paramStr = $appsModel->getUserAppParams($id); $params = new CParameter($paramStr, $xmlPath); //$paramData = (isset($params->_xml['_default']->param)) ? $params->_xml['_default']->param : array(); $paramData = $params->getParams(); $html = '<form method="POST" action="" name="appSetting" id="appSetting">'; $html .= $params->render(); $html .= '<input type="hidden" value="' . $id . '" name="appid"/>'; $html .= '<input type="hidden" value="' . $appName . '" name="appname"/>'; $html .= '</form>'; if (!empty($paramData) && $paramData !== false) { $actions = '<input onclick="joms.apps.saveSettings()" type="submit" value="' . JText::_('COM_COMMUNITY_APPS_SAVE_BUTTON') . '" class="button" name="Submit"/>'; } } else { $html = '<div class-"ajax-notice-apps-configure">' . JText::_('COM_COMMUNITY_APPS_AJAX_NO_CONFIG') . '</div>'; } $objResponse->addScriptCall('cWindowAddContent', $html, $actions); $objResponse->addAssign('cwin_logo', 'innerHTML', JText::_('COM_COMMUNITY_APPS_SETTINGS_TITLE')); return $objResponse->sendResponse(); }