示例#1
0
 public function search($words, $limit = 0)
 {
     if ($words != "") {
         $rights = new Phprojekt_Item_Rights();
         $display = new Phprojekt_Search_Display();
         $results = $this->_tagsTableMapper->searchForProjectsWithTags(explode(" ", $words), $limit);
         $allowedModules = array();
         foreach ($results as $moduleId => $itemIds) {
             $allowedIds = array();
             $moduleName = Phprojekt_Module::getModuleName($moduleId);
             foreach ($itemIds as $itemId) {
                 $model = Phprojekt_Loader::getModel($moduleName, $moduleName);
                 if ($model) {
                     $model = $model->find($itemId);
                     if (!empty($model)) {
                         $allowedIds[] = $itemId;
                     }
                 }
             }
             if (count($allowedIds) > 0) {
                 $allowedModules[$moduleId] = $allowedIds;
             }
         }
         return $display->getDisplay($allowedModules);
     } else {
         return array();
     }
 }