コード例 #1
0
 /**
  * @param $form
  * @param $data
  *
  * @return mixed
  */
 protected function processModuleConfig($form, $data)
 {
     // check the module to see if it has a rokconfig.xml
     $module_type = $this->getModuleType($data);
     $app = JFactory::getApplication();
     $container = RokCommon_Service::getContainer();
     $options = new RokCommon_Options();
     $section = new RokCommon_Options_Section('roksprocket_module', 'module_config.xml');
     $section->addPath(JPATH_SITE . '/components/com_roksprocket/');
     $section->addPath($container['roksprocket.template.override.path']);
     $options->addSection($section);
     $provider = null;
     $layout = null;
     if (empty($data) && $app->input->get('jform', false, 'array') !== false) {
         $data = $app->input->get('jform', false, 'array');
         $provider = $data['params']['provider'];
         $layout = $data['params']['layout'];
     } elseif (isset($data->params['provider']) && isset($data->params['layout'])) {
         $provider = $data->params['provider'];
         $layout = $data->params['layout'];
     }
     if (!empty($data) && isset($provider) && isset($layout)) {
         // load up the Providers
         $provider_key = "roksprocket.providers.registered.{$provider}";
         if ($container->hasParameter($provider_key)) {
             $providerinfo = $container->getParameter($provider_key);
             $provider_class = $container[sprintf('roksprocket.providers.registered.%s.class', $provider)];
             $available = call_user_func(array($provider_class, 'isAvailable'));
             if ($available) {
                 $section = new RokCommon_Options_Section('provider_' . $provider, $providerinfo->optionfile);
                 $section->addPath($providerinfo->path);
                 $options->addSection($section);
             }
         }
         // load up the layouts
         $layout_key = "roksprocket.layouts.{$layout}";
         if ($container->hasParameter($layout_key)) {
             $layoutinfo = $container->getParameter($layout_key);
             $section = new RokCommon_Options_Section('layout_' . $layout, $layoutinfo->options->file);
             foreach ($layoutinfo->paths as $layoutpath) {
                 $section->addPath($layoutpath);
             }
             $options->addSection($section);
         }
     }
     $rcform = new RokCommon_Config_Form($form);
     $xml = $options->getJoinedXml();
     $jxml = new JXMLElement($xml->asXML());
     $fieldsets = $jxml->xpath('/config/fields[@name = "params"]/fieldset');
     foreach ($fieldsets as $fieldset) {
         $overwrite = (string) $fieldset['overwrite'] == 'true' ? true : false;
         $rcform->load($fieldset, $overwrite, '/config');
     }
     JForm::addFieldPath(JPATH_SITE . '/components/com_roksprocket/fields');
 }
コード例 #2
0
ファイル: Articles.php プロジェクト: densem-2013/exikom
 /**
  * @param $type
  *
  * @return RokCommon_Config_Form
  */
 protected function getPerItemsForm($type)
 {
     JForm::addFieldPath(JPATH_SITE . '/components/com_roksprocket/fields');
     $options = new RokCommon_Options();
     $container = RokCommon_Service::getContainer();
     // load up the layouts
     $layoutinfo = $container['roksprocket.layouts.' . $type];
     if (isset($layoutinfo->options->peritem)) {
         $section = new RokCommon_Options_Section('peritem_' . $type, $layoutinfo->options->peritem);
         foreach ($layoutinfo->paths as $layoutpath) {
             $section->addPath($layoutpath);
         }
         $options->addSection($section);
     }
     $rcform = $rcform = new RokCommon_Config_Form(new JForm('roksprocket_peritem'));
     $xml = $options->getJoinedXml();
     $version = new JVersion();
     if (version_compare($version->getShortVersion(), '3.0', '>=')) {
         $jxml = new SimpleXMLElement($xml->asXML());
     } elseif (version_compare($version->getShortVersion(), '3.0', '<')) {
         $jxml = new JXMLElement($xml->asXML());
     }
     $fieldsets = $jxml->xpath('/config/fields[@name = "params"]/fieldset');
     foreach ($fieldsets as $fieldset) {
         $overwrite = (string) $fieldset['overwrite'] == 'true' ? true : false;
         $rcform->load($fieldset, $overwrite, '/config');
     }
     return $rcform;
 }
コード例 #3
0
ファイル: module.php プロジェクト: atikahmed/joomla-probid
 /**
  * @param $type
  *
  * @return \RokCommon_Config_Form
  */
 public function getPerItemsForm($type = null)
 {
     $options = new RokCommon_Options();
     $container = RokCommon_Service::getContainer();
     // load up the layouts
     if (null == $type) {
         foreach ($container['roksprocket.layouts'] as $type => $layoutinfo) {
             $this->addPerItemsOptionsForLayout($type, $options);
         }
     } else {
         $this->addPerItemsOptionsForLayout($type, $options);
     }
     $rcform = $rcform = new RokCommon_Config_Form(new JForm('roksprocket_peritem'));
     $xml = $options->getJoinedXml();
     $jxml = new JXMLElement($xml->asXML());
     $fieldsets = $jxml->xpath('/config/fields[@name = "params"]/fieldset');
     foreach ($fieldsets as $fieldset) {
         $overwrite = (string) $fieldset['overwrite'] == 'true' ? true : false;
         $rcform->load($fieldset, $overwrite, '/config');
     }
     JForm::addFieldPath(JPATH_SITE . '/components/com_roksprocket/fields');
     return $rcform;
 }
コード例 #4
0
 /**
  * @param $form
  * @param $data
  *
  * @return mixed
  */
 protected function processModuleConfig($form, $data)
 {
     // check the module to see if it has a rokconfig.xml
     $module_type = $this->getModuleType($data);
     $container = RokCommon_Service::getContainer();
     $options = new RokCommon_Options();
     $section = new RokCommon_Options_Section('roksprocket_module', 'module_config.xml');
     $section->addPath(JPATH_SITE . '/components/com_roksprocket/');
     $section->addPath($container['roksprocket.template.override.path']);
     $options->addSection($section);
     // load up the Providers
     foreach ($container['roksprocket.providers.registered'] as $type => $providerinfo) {
         $provider_class = $container[sprintf('roksprocket.providers.registered.%s.class', $type)];
         $available = call_user_func(array($provider_class, 'isAvailable'));
         if ($available) {
             $section = new RokCommon_Options_Section('provider_' . $type, $providerinfo->optionfile);
             $section->addPath($providerinfo->path);
             $options->addSection($section);
         }
     }
     // load up the layouts
     foreach ($container['roksprocket.layouts'] as $type => $layoutinfo) {
         $section = new RokCommon_Options_Section('layout_' . $type, $layoutinfo->options->file);
         foreach ($layoutinfo->paths as $layoutpath) {
             $section->addPath($layoutpath);
         }
         $options->addSection($section);
     }
     $container = RokCommon_Service::getContainer();
     $rcform = new RokCommon_Config_Form($form);
     $xml = $options->getJoinedXml();
     $jxml = new JXMLElement($xml->asXML());
     $fieldsets = $jxml->xpath('/config/fields[@name = "params"]/fieldset');
     foreach ($fieldsets as $fieldset) {
         $overwrite = (string) $fieldset['overwrite'] == 'true' ? true : false;
         $rcform->load($fieldset, $overwrite, '/config');
     }
     JForm::addFieldPath(JPATH_SITE . '/components/com_roksprocket/fields');
 }
コード例 #5
0
ファイル: Form.php プロジェクト: atikahmed/joomla-probid
 /**
  * Method to load the form description from an XML file.
  *
  * The reset option works on a group basis. If the XML file references
  * groups that have already been created they will be replaced with the
  * fields in the new XML file unless the $reset parameter has been set
  * to false.
  *
  * @param	string	$file		The filesystem path of an XML file.
  * @param	string	$replace	Flag to toggle whether form fields should be replaced if a field
  *								already exists with the same group/name.
  * @param	string	$xpath		An optional xpath to search for the fields.
  *
  * @return	boolean	True on success, false otherwise.
  * @since	1.6
  */
 public function loadFile($file, $reset = true, $xpath = false)
 {
     // Check to see if the path is an absolute path.
     if (!is_file($file)) {
         // Not an absolute path so let's attempt to find one using JPath.
         $file = RokCommon_Config_FormHelper::find(self::addFormPath(), $file . '.xml');
         // If unable to find the file return false.
         if (!$file) {
             return false;
         }
     }
     // Attempt to load the XML file.
     $xml = RokCommon_Config_Form::getXML($file, true);
     return $this->load($xml, $reset, $xpath);
 }