} } // Get right group of terms to show on multiple select. $fixed_queries = array(); $course_filter = NULL; if ( ($cid=api_get_course_id()) != -1 ) { // Results only from actual course. $course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID . $cid); } if (count($term_array)) { $fixed_queries = chamilo_join_queries($term_array, null, $op); if ($course_filter != NULL) { $fixed_queries = chamilo_join_queries($fixed_queries, $course_filter, 'and'); } } else { if (!empty($query)) { $fixed_queries = array($course_filter); } } list($count, $results) = chamilo_query_query(api_convert_encoding($query, 'UTF-8', $charset), 0, 1000, $fixed_queries); // Prepare blocks to show. $blocks = array(); if ($count > 0) { foreach ($results as $result) { // Fill the result array.
return $sf_terms; } $term = $_GET['term']; $prefix = $_GET['prefix']; $operator = $_GET['operator']; $specific_fields = get_specific_field_list(); $sf_terms = array(); if (($cid = api_get_course_id()) != -1) { // with cid // course filter $filter[] = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID . $cid); // term filter if ($term != '__all__') { $filter[] = chamilo_get_boolean_query($prefix . $term); // always and between term and courseid $filter = chamilo_join_queries($filter, null, 'and'); } $sf_terms = get_usual_sf_terms($filter, $specific_fields); } else { // without cid if ($term != '__all__') { $filter[] = chamilo_get_boolean_query($prefix . $term); $sf_terms = get_usual_sf_terms($filter, $specific_fields); } else { // no cid and all/any terms foreach ($specific_fields as $specific_field) { foreach (xapian_get_all_terms(1000, $specific_field['code']) as $raw_term) { if (count($raw_term['name']) > 1) { $normal_term = substr($raw_term['name'], 1); $sf_terms[$specific_field['code']][$normal_term] = $normal_term; }