} // exit if no POST data if (!register_posted_variables(array('search_terms' => false, 'search_terms_title' => false, 'search_terms_keywords' => false, 'search_terms_instructor' => false, 'search_terms_coursecode' => false, 'search_terms_description' => false), 'any')) { $tool_content .= CourseIndexer::getDetailedSearchForm(); draw($tool_content, 0); exit; } // search in the index $idx = new Indexer(); $hits1 = $idx->searchRaw(CourseIndexer::buildQuery($_POST)); // courses with visible 1 or 2 // Additional Access Rights $anonymous = false; if (isset($uid) and $uid) { $anonymous = true; $hits2 = $idx->searchRaw(CourseIndexer::buildQuery($_POST, false)); // courses with visible 0 or 3 if ($uid == 0) { $hits = array_merge($hits1, $hits2); // admin has access to all } else { $res = Database::get()->queryArray("SELECT course.id \n FROM course \n JOIN course_user ON course.id = course_user.course_id \n AND course_user.user_id = ?d", $uid); $subscribed = array(); foreach ($res as $row) { $subscribed[] = $row->id; } $hits3 = array(); foreach ($hits2 as $hit2) { if (in_array($hit2->pkid, $subscribed)) { $hits3[] = $hit2; }
/** * Batch remove all index contents related to a Course. * * @param int $courseId */ public function removeAllByCourse($courseId) { if (!get_config('enable_indexing')) { return; } $cidx = new CourseIndexer($this); $cidx->remove($courseId); $aidx = new AnnouncementIndexer($this); $aidx->removeByCourse($courseId); $agdx = new AgendaIndexer($this); $agdx->removeByCourse($courseId); $lidx = new LinkIndexer($this); $lidx->removeByCourse($courseId); $vdx = new VideoIndexer($this); $vdx->removeByCourse($courseId); $vldx = new VideolinkIndexer($this); $vldx->removeByCourse($courseId); $eidx = new ExerciseIndexer($this); $eidx->removeByCourse($courseId); $fidx = new ForumIndexer($this); $fidx->removeByCourse($courseId); $ftdx = new ForumTopicIndexer($this); $ftdx->removeByCourse($courseId); $fpdx = new ForumPostIndexer($this); $fpdx->removeByCourse($courseId); $didx = new DocumentIndexer($this); $didx->removeByCourse($courseId); $uidx = new UnitIndexer($this); $uidx->removeByCourse($courseId); $urdx = new UnitResourceIndexer($this); $urdx->removeByCourse($courseId); $ndx = new NoteIndexer($this); $ndx->removeByCourse($courseId); }
'search_terms_instructor' => false, 'search_terms_coursecode' => false, 'search_terms_description' => false), 'any')) { $tool_content .= CourseIndexer::getDetailedSearchForm(); draw($tool_content, 0); exit(); } // search in the index $idx = new Indexer(); $hits1 = $idx->searchRaw(CourseIndexer::buildQuery($_POST)); // courses with visible 1 or 2 // Additional Access Rights $anonymous = false; if (isset($uid) and $uid) { $anonymous = true; $hits2 = $idx->searchRaw(CourseIndexer::buildQuery($_POST, false)); // courses with visible 0 or 3 if ($uid == 0) { $hits = array_merge($hits1, $hits2); // admin has access to all } else { $res = Database::get()->queryArray("SELECT course.id FROM course JOIN course_user ON course.id = course_user.course_id AND course_user.user_id = ?d", $uid); $subscribed = array(); foreach ($res as $row) { $subscribed[] = $row->id; } $hits3 = array(); foreach ($hits2 as $hit2) { if (in_array($hit2->pkid, $subscribed)) {