/** * Render the definitions column */ protected function _renderColumn_Definitions(ConceptSearchResultsGroup $csrg, Concept $c, $group_i, $i) { echo "\n<td class=\"col_4\">\n\t"; // Get the search terms $arr_term_type = array(MCL_SEARCH_TERM_TYPE_TEXT, MCL_SEARCH_TERM_TYPE_CONCEPT_DESCRIPTION); $arr_search_term = $csrg->csg->getSearchTermCollection()->getSearchTerms($arr_term_type, null, true); // Definitions foreach ($c->getConceptDescriptionIds() as $_desc_i) { $cd = $c->getConceptDescription($_desc_i); $desc = htmlentities($cd->description); foreach ($arr_search_term as $search_term) { $desc = preg_replace('/\\b(' . addslashes($search_term->needle) . ')/i', '<span class="h">$1</span>', $desc); } echo '<div class="concept_def"><span class="concept_def_header">[' . $cd->locale . ']</span> ' . $desc . "</div>"; } /** * Answers - Only the first CSRR::num_display_qa_results answers are visible; set to zero to make * all visible by default. */ if ($c->hasAnswers()) { echo "<div style=\"margin-bottom:15px;\">This concept is a question with the following answer(s):\n"; echo '<ul class="qa_set" style="margin-bottom:0;padding-bottom:0;">'; $_i = 0; $num_results = $c->getNumberAnswers(); foreach ($c->getAnswerIds() as $_answer_id) { $ca = $this->cc->getConcept($_answer_id, $c->css_dict); echo '<li>' . htmlentities($ca->getPreferredName()) . ' (<a href="' . $this->getSearchUrl('id:' . $_answer_id, array('source' => $c->css_dict->dict_db)) . '">' . $_answer_id . '</a>)</li>'; $_i++; if ($_i == $this->num_display_qa_results && $num_results > $this->num_display_qa_results) { $ul_toggle_id = 'ul_answer_toggle_' . $c->css_dict->dict_id . '_' . $group_i . '_' . $c->concept_id; $ul_more_id = 'ul_answer_more_' . $c->css_dict->dict_id . '_' . $group_i . '_' . $c->concept_id; $num_more_results = $num_results - $this->num_display_qa_results; echo "</ul>\n" . '<ul id="' . $ul_toggle_id . '" style="padding-left:24px;margin-top:6px;padding-top:0;list-style-type:none;">' . '<li><a href="javascript:toggleElementVisibility(\'' . $ul_toggle_id . '\');toggleElementVisibility(\'' . $ul_more_id . '\');">' . 'See ' . $num_more_results . ' more...</a></li></ul>' . "\n"; echo '<ul class="qa_set" id="' . $ul_more_id . '" style="display:none;margin-top:0;padding-top:0;margin-bottom:0;padding-bottom:0;">'; } } echo '</ul></div>'; } /** * Questions - Only the first CSRR::num_display_qa_results questions are visible; * set to zero to make all visible by default. */ if ($c->hasQuestions()) { echo "<div style=\"margin-bottom:15px;\">This concept is an answer for the following question(s):\n"; echo '<ul class="qa_set" style="margin-bottom:0;padding-bottom:0;">'; $_i = 0; $num_results = $c->getNumberQuestions(); foreach ($c->getQuestionIds() as $_question_id) { $cq = $this->cc->getConcept($_question_id, $c->css_dict); echo '<li>' . htmlentities($cq->getPreferredName()) . ' (<a href="' . $this->getSearchUrl('id:' . $_question_id, array('source' => $c->css_dict->dict_db)) . '">' . $_question_id . '</a>)</li>'; $_i++; if ($_i == $this->num_display_qa_results && $num_results > $this->num_display_qa_results) { echo "</ul>\n"; $ul_toggle_id = 'ul_question_toggle_' . $c->css_dict->dict_id . '_' . $c->concept_id; $ul_more_id = 'ul_question_more_' . $c->css_dict->dict_id . '_' . $c->concept_id; $num_more_results = $num_results - $this->num_display_qa_results; echo '<ul id="' . $ul_toggle_id . '" style="padding-left:24px;margin-top:6px;padding-top:0;list-style-type:none;">' . '<li><a href="javascript:toggleElementVisibility(\'' . $ul_toggle_id . '\');toggleElementVisibility(\'' . $ul_more_id . '\');">' . 'See ' . $num_more_results . ' more...</a></li></ul>' . "\n"; echo '<ul class="qa_set" id="' . $ul_more_id . '" style="display:none;margin-top:0;padding-top:0;margin-bottom:0;padding-bottom:0;">'; } } echo '</ul></div>'; } // End of column 3 echo '</td>'; }