/** * @brief search in course * @global Indexer $idx * @param type $searchTerms * @param type $courseId * @param type $anonymous * @return boolean */ function search_in_course($searchTerms, $courseId, $anonymous) { global $idx; $data = array(); $data['search_terms'] = $searchTerms; $data['course_id'] = $courseId; require_once 'announcementindexer.class.php'; $anhits = $idx->searchRaw(AnnouncementIndexer::buildQuery($data, $anonymous)); if (count($anhits) > 0) { return true; } require_once 'agendaindexer.class.php'; $aghits = $idx->searchRaw(AgendaIndexer::buildQuery($data, $anonymous)); if (count($aghits) > 0) { return true; } require_once 'documentindexer.class.php'; $dhits = $idx->searchRaw(DocumentIndexer::buildQuery($data, $anonymous)); if (count($dhits) > 0) { return true; } require_once 'exerciseindexer.class.php'; $exhits = $idx->searchRaw(ExerciseIndexer::buildQuery($data, $anonymous)); if (count($exhits) > 0) { return true; } require_once 'forumindexer.class.php'; $fhits = $idx->searchRaw(ForumIndexer::buildQuery($data, $anonymous)); if (count($fhits) > 0) { return true; } require_once 'forumtopicindexer.class.php'; $fthits = $idx->searchRaw(ForumTopicIndexer::buildQuery($data, $anonymous)); if (count($fthits) > 0) { return true; } require_once 'linkindexer.class.php'; $lhits = $idx->searchRaw(LinkIndexer::buildQuery($data, $anonymous)); if (count($lhits) > 0) { return true; } require_once 'videoindexer.class.php'; $vhits = $idx->searchRaw(VideoIndexer::buildQuery($data, $anonymous)); if (count($vhits) > 0) { return true; } require_once 'videolinkindexer.class.php'; $vlhits = $idx->searchRaw(VideolinkIndexer::buildQuery($data, $anonymous)); if (count($vlhits) > 0) { return true; } require_once 'unitindexer.class.php'; $uhits = $idx->searchRaw(UnitIndexer::buildQuery($data, $anonymous)); if (count($uhits) > 0) { return true; } require_once 'unitresourceindexer.class.php'; $urhits = $idx->searchRaw(UnitResourceIndexer::buildQuery($data, $anonymous)); if (count($urhits) > 0) { return true; } return false; }
$numLine = 0; foreach ($exerciseHits as $exerciseHit) { $exercise = Database::get()->querySingle("SELECT title, description FROM exercise WHERE id = ?d", $exerciseHit->pkid); $class = $numLine % 2 ? 'odd' : 'even'; $tool_content .= "<tr class='{$class}'>\n <td width='1' valign='top'><img style='padding-top:3px;' src='{$themeimg}/arrow.png' title='bullet' /></td>\n <td>"; $desc_text = empty($exercise->description) ? "" : "<br /> <span class='smaller'>" . $exercise->description . "</span>"; $tool_content .= "<a href='" . $exerciseHit->url . "'>" . q($exercise->title) . "</a>{$desc_text} </td></tr>"; $numLine++; } $tool_content .= "</table>"; $found = true; } } // search in forums if ($forums) { $forumHits = $idx->searchRaw(ForumIndexer::buildQuery($_POST)); $forumTopicHits = $idx->searchRaw(ForumTopicIndexer::buildQuery($_POST)); $forumPostHits = $idx->searchRaw(ForumPostIndexer::buildQuery($_POST)); if (count($forumHits) > 0) { $tool_content .= "<script type='text/javascript' src='../auth/sorttable.js'></script>\n <table width='99%' class='sortable' id='t5' align='left'>\n <tr>\n <th colspan='2' class='left'>{$langForum} ({$langCategories}):</th>\n </tr>"; $numLine = 0; foreach ($forumHits as $forumHit) { $forum = Database::get()->querySingle("SELECT name, `desc` FROM forum WHERE id = ?d", $forumHit->pkid); $class = $numLine % 2 ? 'odd' : 'even'; $tool_content .= "<tr class='{$class}'>\n <td width='1' valign='top'><img style='padding-top:3px;' src='{$themeimg}/arrow.png' title='bullet' /></td>\n <td>"; $desc_text = empty($forum->desc) ? "" : "<br /><span class='smaller'>(" . q($forum->desc) . ")</span>"; $tool_content .= "<a href='" . $forumHit->url . "'>" . q($forum->name) . "</a> " . $desc_text . " </td></tr>"; $numLine++; } $tool_content .= "</table>"; $found = true;