/**
  * @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');
 }
Example #2
0
 /**
  * @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;
 }
Example #3
0
 /**
  * @param $type
  *
  * @return RokSprocket_ConfigForm
  */
 protected function getPerItemsForm($type)
 {
     $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 RokSprocket_ConfigForm(new RokCommon_Form('roksprocket_peritem'));
     $xml = $options->getJoinedXml();
     $jxml = new RokCommon_XMLElement($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;
 }
Example #4
0
 /**
  * @param RokCommon_Options_Section $section
  */
 public function addSection(RokCommon_Options_Section &$section)
 {
     $this->sections[$section->getIdentifier()] = $section;
 }
Example #5
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');
 }
Example #6
0
 protected function addPerItemsOptionsForLayout($type, RokCommon_Options &$options)
 {
     $container = RokCommon_Service::getContainer();
     $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);
     }
 }