*/ /** ============================================================================== * Dokeos Metadata: index all course documents with PhpDig * * @package dokeos.metadata ============================================================================== */ // PRELIMS --------------------------------------------------------------------> $getpostvars = array('dmo'); require('md_funcs.php'); define('EID_TYPE', 'Document'); define('AFTER_DOT', strlen(EID_TYPE) + 1); define('OF_EID_TYPE', "eid LIKE '" . EID_TYPE . ".%'"); require('md_' . strtolower(EID_TYPE) . '.php'); // name of the language file that needs to be included $language_file = 'md_' . strtolower(EID_TYPE); include('../inc/global.inc.php'); $nameTools = get_lang('Tool'); ($nameTools && get_lang('Sorry')) or give_up( 'Language file ' . $language_file . " doesn't define 'Tool' and 'Sorry'"); $_course = api_get_course_info(); isset($_course) or give_up(get_lang('Sorry')); $is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && is_allowed_to_edit(); if (!$is_allowed_to_edit) give_up(get_lang('Denied')); $mdObj = new mdobject($_course, 0); $mdStore = new mdstore($is_allowed_to_edit); // create table if needed require(api_get_path(LIBRARY_PATH) . 'xmd.lib.php'); require(api_get_path(LIBRARY_PATH) . 'xht.lib.php'); require('md_phpdig.php'); $mdObj->mdo_add_breadcrump_nav(); // see 'md_' . EID_TYPE . '.php' $htmlHeadXtra[] = ' '; Display::display_header($nameTools); if (isset($dmo)) // for future use { echo '

', $dmo, '

', "\n"; // document metadata op // if ($dmo == get_lang('Index')) $dmo = $dmo; } $result = $mdStore->mds_get_many('eid,indexabletext', OF_EID_TYPE); echo get_lang('Tool'), ': ', mysql_num_rows($result), "

\n"; $idt = array(); $cidpar = '?cidReq=' . $_course['sysCode']; while ($row = mysql_fetch_array($result)) // load indexabletexts in memory { $mdObj = new mdobject($_course, substr($row['eid'], AFTER_DOT)); $idt[$mdObj->mdo_url . $cidpar] = $row['indexabletext']; } if (count($idt) && file_exists($phpDigIncCn)) { require($phpDigIncCn); // switch to PhpDig DB foreach ($idt as $url => $text) if (ereg('^http://([^/]+)/(.+)/([^/]+)\?cidReq=(.+)$', $url, $regs)) { $path = $regs[2] .'/'; $file = $regs[3] . '?cidReq=' . $regs[4]; if ($site_id = remove_engine_entries('http://' . $regs[1] .'/', $path, $file)) { echo '', "\n"; index_words($site_id, $path, $file, get_first_words($text, $path, $file), get_keywords($text)); echo '
', "\n"; } } if(isset($db)) { mysql_select_db($_configuration['main_database'], $db); // back to Dokeos } } else { echo 'No documents with metadata or no PhpDig in this course...
'; } if (false && file_exists($phpDigIncCn)) // future: buttons for operations { echo '
', "\n", '', "\n", '', "\n", '
', "\n"; } Display::display_footer(); ?>