Ejemplo n.º 1
0
 /**
  * Determine which modules should be searched against.
  *
  * @return array
  */
 protected function getSearchModules()
 {
     $usa = new UnifiedSearchAdvanced();
     $unified_search_modules_display = $usa->getUnifiedSearchModulesDisplay();
     // load the list of unified search enabled modules
     $modules = array();
     //check to see if the user has  customized the list of modules available to search
     $users_modules = $GLOBALS['current_user']->getPreference('globalSearch', 'search');
     if (!empty($users_modules)) {
         // use user's previous selections
         foreach ($users_modules as $key => $value) {
             if (isset($unified_search_modules_display[$key]) && !empty($unified_search_modules_display[$key]['visible'])) {
                 $modules[$key] = $key;
             }
         }
     } else {
         foreach ($unified_search_modules_display as $key => $data) {
             if (!empty($data['visible'])) {
                 $modules[$key] = $key;
             }
         }
     }
     // make sure the current module appears first in the list
     if (isset($modules[$this->module])) {
         unset($modules[$this->module]);
         $modules = array_merge(array($this->module => $this->module), $modules);
     }
     return $modules;
 }