function _get_word_context_on_page($projectid, $page, $round, $word) { $lpage = new LPage($projectid, $page, "{$round}.page_saved", 0); $page_text = $lpage->get_text(); return _get_word_context_from_text($page_text, $word); }
if ($layout == LAYOUT_HORIZ) { echo "layout=" . LAYOUT_VERT . "'>" . _("Change to vertical layout"); } else { echo "layout=" . LAYOUT_HORIZ . "'>" . _("Change to horizontal layout"); } echo "</a>"; echo "</p>"; // get the latest possible round $last_possible_round = get_Round_for_round_number(MAX_NUM_PAGE_EDITING_ROUNDS); $pages_res = page_info_query($projectid, $last_possible_round->id, 'LE'); // iterate through all the pages until we find $wordInstances of the word // we're looking for $foundInstances = 0; while (list($page_text, $page, $proofer_names) = page_info_fetch($pages_res)) { // get a context string list($context_strings, $totalLines) = _get_word_context_from_text($page_text, $word); if (!count($context_strings)) { continue; } echo "<p>"; echo "<b>" . _("Page") . "</b>: <a href='displayimage.php?project={$projectid}&imagefile={$page}&showreturnlink=0' target='imageframe'>{$page}</a><br>"; foreach ($context_strings as $lineNum => $context_string) { $context_string = _highlight_word(html_safe($context_string, ENT_NOQUOTES), $word); echo "<b>", _("Line"), "</b>: ", sprintf(_('~%1$d of %2$d'), $lineNum, $totalLines), " | "; echo "<b>" . _("Context") . "</b>:<br><span class='mono'>{$context_string}</span><br>"; } echo "</p>"; echo "<hr>"; $foundInstances++; if ($foundInstances >= $wordInstances) { break;