'string', 'mdsc'=>'string', 'kwdswere_string'=>'string', // Dokeos 'refine'=>'integer', 'refine_url'=>'string', 'site'=>'string', // set to integer later 'limite'=>'integer', 'option'=>'string', 'lim_start'=>'integer', 'browse'=>'integer', 'path'=>'string' ) ),EXTR_SKIP); $adlog_flag = 0; $rssdf = ""; // end of part copied (with some changes) from standard PhpDig search.php // Course keywords $_course = api_get_course_info(); $ckw = $_course['path'] . '/CourseKwds.js'; define('KEYWORDS_CACHE', api_get_path(SYS_COURSE_PATH) . $ckw); if (file_exists(KEYWORDS_CACHE)) $kcdt = htmlspecialchars(date('Y/m/d H:i:s', filemtime(KEYWORDS_CACHE))); $keywordscache = $kcdt ? '' . '
(CourseKwds cache: ' . $kcdt . ')' : ''; // Dokeos header $nameTools = get_lang('Search'); $htmlHeadXtra[] = ''; $htmlHeadXtra[] = ''; $htmlHeadXtra[] = ' '; Display::display_header($nameTools); echo "\n"; echo '', '

', get_lang('Search'), '

'; // Store new extra criteria (course manager only, see below), or execute // PhpDig Search and echo result message + table with results + pages bar if (!$query_string) $query_string = trim($mdsc); $ckwcdt = file_exists($ckwc = KEYWORDS_CACHE . 'c') ? date('Y/m/d H:i:s', filemtime($ckwc)) : '?'; $pkwc = ''; if (substr($query_string, 0, 2) == '<>' && api_is_allowed_to_edit()) { if ($ckwcdt{0} != '?') { $fckwc = fopen($ckwc, 'rb'); $pkwc = fread($fckwc, filesize($ckwc)); fclose($fckwc); unset($fckwc); } if(($fckwc = fopen($ckwc, 'wb'))) { fwrite($fckwc, $query_string); fclose($fckwc); unset($fckwc); $ckwcdt = file_exists($ckwc) ? date('Y/m/d H:i:s', filemtime($ckwc)) : '? Write Error'; } else $ckwcdt = '? Open Error'; $phpdigSearchResults = array('result_message' => $ckw . 'c: ' . $ckwcdt, 'pages_bar' => '', 'results' => array()); } else { $phpdigSearchResults = phpdigSearch($id_connect, $query_string, $option, $refine, $refine_url, $lim_start, $limite, $browse, $site, $path, $relative_script_path, $template, $adlog_flag, $rssdf, $template_demo); } $result_message = ''; $hits = 11; if ($result_message = $phpdigSearchResults['result_message']) if (($cspos = strpos($result_message, ', ')) !== FALSE) if (($sppos = strpos($result_message, ' ', $cspos += 2)) !== FALSE) if (is_numeric($total = substr($result_message, $cspos, $sppos-$cspos))) $hits = (int) $total; if (!($pages_bar = $phpdigSearchResults['pages_bar'])) $hits = 0; if ($result_message == phpdigMsg('noresults')) $result_message .= ' '.phpdigMsg('on').' "'.htmlspecialchars($query_string,ENT_QUOTES).'"'; echo $result_message, '

', "\n"; if ($phpdigSearchResults['results']) foreach ($phpdigSearchResults['results'] as $searchResult) { $url = $searchResult['complete_path']; if (ereg("/[^?/]*\\?.*thumb=", $url)) { // direct URL: $thumburl = ereg_replace("/[^?/]*\\?.*thumb=", "/", $url); $thumburl = ereg_replace("\\?.*thumb=", "?th=", $url); // via index.php } else { $thumburl = "tpl_img/link.gif"; } echo '', "\n"; } echo '
', $searchResult['link_title'], '
', $searchResult['text'], '

'; if ($result_message && ($hits > 10)) echo "Results page ", str_replace('?template_demo=', '?kwdswere_string=' . urlencode($kwdswere_string), $pages_bar), '

'; /* Extra criteria: A course manager can define and edit them in the TEXTAREA. If he types in something as in the example below, and clicks 'Go', the new criteria are stored and the old ones are displayed. So it is easy to restore the old ones. To confirm the new ones, empty the TEXTAREA. <>This selection empties extra criteria Label Descriptive text */ $tdhtm = ''; function tdhtm($xc) { $eol = '
'; if ($xc{0} == '<') $xc = substr($xc, 1); if (($eov = strpos($xc, '>')) === FALSE) $value = $label = $xc; else { $value = substr($xc, 0, $eov); $label = substr($xc, $eov+1); if (($eot = strpos($label, '<')) !== FALSE) { $eol = substr($label, $eot); $label = substr($label, 0, $eot); } } return '' . htmlspecialchars($label) . '' . $eol; } if ($ckwcdt{0} != '?') // there is a file with extra criteria { $fckwc = fopen($ckwc, 'rb'); foreach (explode("\n", fread($fckwc, filesize($ckwc))) as $xc) $tdhtm .= "\n" . tdhtm($xc); fclose($fckwc); unset($fckwc); } // Search criteria form and keywords tree ?>
', htmlspecialchars($pkwc), ''; else echo ''; ?>
  Keywords-restrictive search