/**
  * Gets client files of type $type (view, layout, field) for a module or for the system
  *
  * @param  string $type   The type of files to get
  * @param  string $module Module name (leave blank to get the system wide files)
  * @return array
  */
 public function getSystemClientData($type)
 {
     // This is a semi-complicated multi-step process, so we're going to try and make this as easy as possible.
     // This should get us a list of the client files for the system
     $fileList = MetaDataFiles::getClientFiles($this->platforms, $type);
     // And this should get us the contents of those files, properly sorted and everything.
     $results = MetaDataFiles::getClientFileContents($fileList, $type);
     return $results;
 }
 /**
  * Get the link name for a subpanel using witchcraft and wizardry
  * @param string $subpanelName - this is the name of the subpanel
  * @param string $loadedModule - this is the name of the module that is loaded
  * @return string the linkname for the subpanel
  */
 protected function getLinkName($subpanelName, $loadedModule)
 {
     if (isModuleBWC($loadedModule) && !file_exists("modules/{$loadedModule}/clients/" . $this->getViewClient() . "/layouts/subpanels/subpanels.php")) {
         @(include "modules/{$loadedModule}/metadata/subpaneldefs.php");
         if (empty($layout_defs[$loadedModule]['subpanel_setup'])) {
             $GLOBALS['log']->error("Cannot find subpanel layout defs for {$loadedModule}");
             return $subpanelName;
         }
         foreach ($layout_defs[$loadedModule]['subpanel_setup'] as $linkName => $def) {
             if ($def['module'] == $subpanelName) {
                 return $linkName;
             }
         }
     }
     $viewdefs = MetaDataFiles::getClientFileContents(MetaDataFiles::getClientFiles(array($this->getViewClient()), 'layout', $loadedModule), 'layout', $loadedModule);
     if (empty($viewdefs['subpanels'])) {
         return $subpanelName;
     }
     $legacyDefs = $this->mdc->toLegacySubpanelLayoutDefs($viewdefs['subpanels']['meta']['components'], BeanFactory::newBean($loadedModule));
     if (empty($legacyDefs['subpanel_setup'])) {
         $GLOBALS['log']->error("Could not convert subpanels for subpanel: {$subpanelName} - {$loadedModule}");
         return $subpanelName;
     }
     foreach ($legacyDefs['subpanel_setup'] as $linkName => $def) {
         if ($def['module'] == $subpanelName) {
             return $linkName;
         }
     }
     return $subpanelName;
 }