コード例 #1
0
 /**
  * Update the file or directory path in the document db document table
  *
  * @author - Hugues Peeters <*****@*****.**>
  * @param  - action (string) - action type require : 'delete' or 'update'
  * @param  - old_path (string) - old path info stored to change
  * @param  - new_path (string) - new path info to substitute
  * @desc Update the file or directory path in the document db document table
  *
  */
 static function update_db_info($action, $old_path, $new_path = '')
 {
     $dbTable = Database::get_course_table(TABLE_DOCUMENT);
     $course_id = api_get_course_int_id();
     /* DELETE */
     if ($action == 'delete') {
         $old_path = Database::escape_string($old_path);
         $to_delete = "WHERE c_id = {$course_id} AND path LIKE BINARY '" . $old_path . "' OR path LIKE BINARY '" . $old_path . "/%'";
         $query = "DELETE FROM {$dbTable} " . $to_delete;
         $result = Database::query("SELECT id FROM {$dbTable} " . $to_delete);
         if (Database::num_rows($result)) {
             require_once api_get_path(INCLUDE_PATH) . '../metadata/md_funcs.php';
             $mdStore = new mdstore(true);
             // create if needed
             $md_type = substr($dbTable, -13) == 'scormdocument' ? 'Scorm' : 'Document';
             while ($row = Database::fetch_array($result)) {
                 $eid = $md_type . '.' . $row['id'];
                 $mdStore->mds_delete($eid);
                 $mdStore->mds_delete_offspring($eid);
             }
         }
     }
     /* UPDATE */
     if ($action == 'update') {
         if ($new_path[0] == '.') {
             $new_path = substr($new_path, 1);
         }
         $new_path = str_replace('//', '/', $new_path);
         // Attempt to update	- tested & working for root	dir
         $new_path = Database::escape_string($new_path);
         $query = "UPDATE {$dbTable}\n            SET path = CONCAT('" . $new_path . "', SUBSTRING(path, LENGTH('" . $old_path . "')+1) )\n            WHERE c_id = {$course_id} AND path LIKE BINARY '" . $old_path . "' OR path LIKE BINARY '" . $old_path . "/%'";
     }
     Database::query($query);
 }
コード例 #2
0
 /**
  * @param int $document_id
  */
 public static function delete_document_metadata($document_id)
 {
     // needed to deleted medadata
     require_once api_get_path(SYS_CODE_PATH) . 'metadata/md_funcs.php';
     require_once api_get_path(LIBRARY_PATH) . 'fileManage.lib.php';
     $mdStore = new mdstore(true);
     //delete metadata
     $eid = 'Document' . '.' . $document_id;
     $mdStore->mds_delete($eid);
     $mdStore->mds_delete_offspring($eid);
 }
コード例 #3
0
}
$sdisub = substr(ereg_replace("[^0-9A-Za-z]", "", $sdisub), 0, 4);
// $sdisub is for split manifests - Scorm.NNN.$sdisub_xxx e.g. Scorm.3.1979_12
define('MFFNAME', 'imsmanifest');
define('MFFDEXT', '.xml');
define('HTF', 'mdp_scorm.htt');
$regs = array();
$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 && api_is_allowed_to_edit();
if (!$is_allowed_to_edit) {
    give_up(get_lang('Denied'));
}
$baseWorkDir = get_course_path() . ($courseDir = $_course['path'] . '/scorm');
$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';
// SET CURRENT SCORM DIRECTORY - HEADER --------------------------------------->
if (isset($workWith)) {
    $scormdocument = Database::get_course_table(TABLE_LP_MAIN);
    $sql = "SELECT id FROM {$scormdocument} WHERE path='" . Database::escape_string(api_substr($workWith, 1)) . "' OR path='" . Database::escape_string(substr($workWith, 1)) . "/.'";
    $result = Database::query($sql);
    if (Database::num_rows($result) == 1) {
        if ($row = Database::fetch_array($result)) {
            $sdi = $row['id'];
        }
    }
}
コード例 #4
0
/**
 * This function writes the imsmanifest.xml and exports the chapter names
 * @param    array        Array containing filenames
 * @param    integer    Learnpath_id
 * @return    void
 */
function createimsmanifest($circle1_files, $learnpath_id)
{
    global $LPname, $expdir, $LPnamesafe;
    $_course = api_get_course_info();
    //$tbl_learnpath_main, $tbl_learnpath_chapter, $tbl_learnpath_item,
    $tbl_learnpath_main = Database::get_course_table(TABLE_LEARNPATH_MAIN);
    $tbl_learnpath_item = Database::get_course_table(TABLE_LEARNPATH_ITEM);
    $tbl_learnpath_chapter = Database::get_course_table(TABLE_LEARNPATH_CHAPTER);
    include_once '../metadata/md_funcs.php';
    // RH: export metadata
    // Header
    // Charset should be dependent on content.
    $header = '<?xml version="1.0" encoding="' . api_get_system_encoding() . '"?>' . "\n<manifest identifier='" . $LPnamesafe . "' version='1.1'\n xmlns='http://www.imsproject.org/xsd/imscp_rootv1p1p2'\n xmlns:adlcp='http://www.adlnet.org/xsd/adlcp_rootv1p2'\n xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'\n xsi:schemaLocation='http://www.imsproject.org/xsd/imscp_rootv1p1p2 imscp_rootv1p1p2.xsd\n http://www.imsglobal.org/xsd/imsmd_rootv1p2p1 imsmd_rootv1p2p1.xsd\n http://www.adlnet.org/xsd/adlcp_rootv1p2 adlcp_rootv1p2.xsd'>\n";
    $org = xmltagwrite('metadata', 'open');
    $org .= '  ' . xmltagwrite('schema', 'full', 'ADL SCORM');
    $org .= '  ' . xmltagwrite('schemaversion', 'full', '1.2');
    $org .= xmltagwrite('metadata', 'close');
    $defaultorgname = 'default_org';
    $attributes[0][0] = 'default';
    $attributes[1][0] = $defaultorgname;
    $org .= xmltagwrite('organizations', 'open', $attributes);
    $attributes[0][0] = 'identifier';
    $attributes[1][0] = $defaultorgname;
    $org .= '  ' . xmltagwrite('organization', 'open', $attributes);
    $org .= '    ' . xmltagwrite('title', 'full', $LPname);
    // Items list.
    $i = 0;
    $course_id = api_get_course_int_id();
    $previous_item_id = '00';
    while ($circle1_files[0][$i]) {
        // Check whether we are in the border of two chapters.
        //if (!$desc=strpos($circle1_files[2][$i],'scription')) {  // This is needed if the descriptions are exported to file.
        $sql = "SELECT * FROM {$tbl_learnpath_item} WHERE c_id = {$course_id} AND (id=" . $circle1_files[2][$i] . ")";
        $result = Database::query($sql);
        $row = Database::fetch_array($result);
        $parent_item_id = $row['parent_item_id'];
        if ($parent_item_id != $previous_item_id) {
            // We create the item tag for the chapter (without indifierref).
            $sql2 = "SELECT * FROM {$tbl_learnpath_chapter} WHERE c_id = {$course_id} AND (id=" . $parent_item_id . ")";
            $result2 = Database::query($sql2);
            $row2 = Database::fetch_array($result2);
            $chapter_name = $row2['chapter_name'];
            $attributes = '';
            $attributes[0][] = 'identifier';
            $attributes[1][] = 'chapter_' . $row2['id'];
            $attributes[0][] = 'isvisible';
            $attributes[1][] = '1';
            if ($previous_item_id != '00') {
                $org .= '    ' . xmltagwrite('item', 'close');
            }
            $org .= '    ' . xmltagwrite('item', 'open', $attributes);
            $org .= '      ' . xmltagwrite('title', 'full', $chapter_name);
            if ($row2['chapter_description'] != '') {
                // Chapter description.
                $attributes = '';
                $attributes[0][] = 'identifier';
                $attributes[1][] = 'chapter_' . $row2['id'] . '_desc';
                $attributes[0][] = 'isvisible';
                $attributes[1][] = '1';
                $org .= '    ' . xmltagwrite('item', 'open', $attributes);
                $org .= '      ' . xmltagwrite('title', 'full', ' ' . $row2['chapter_description']);
                $org .= '    ' . xmltagwrite('item', 'close');
            }
        }
        $previous_item_id = $parent_item_id;
        //}
        $attributes = '';
        // Item output.
        $attributes[0][] = 'identifier';
        $attributes[1][] = 'item_' . $circle1_files[2][$i];
        $attributes[0][] = 'identifierref';
        $attributes[1][] = 'item_ref_' . $circle1_files[2][$i];
        $attributes[0][] = 'isvisible';
        $attributes[1][] = '1';
        $org .= '    ' . xmltagwrite('item', 'open', $attributes);
        $org .= '      ' . xmltagwrite('title', 'full', $circle1_files[1][$i]);
        if ($row['prereq_id'] != '') {
            // Item prerequisites.
            $attributes = '';
            $attributes[0][] = 'type';
            $attributes[1][] = 'aicc_script';
            $org .= '      ' . xmltagwrite('adlcp:prerequisites', 'open', $attributes, 'no_linebreak');
            if ($row['prereq_type'] == 'i') {
                $org .= 'item_' . $row['prereq_id'];
            }
            if ($row['prereq_type'] == 'c') {
                $org .= 'chapter_' . $row['prereq_id'];
            }
            $org .= xmltagwrite('adlcp:prerequisites', 'close', $attributes);
        }
        if ($row['description'] != '') {
            // Item description.
            $attributes = '';
            $attributes[0][] = 'identifier';
            $attributes[1][] = 'item_' . $circle1_files[2][$i] . '_desc';
            $attributes[0][] = 'isvisible';
            $attributes[1][] = '1';
            $org .= '    ' . xmltagwrite('item', 'open', $attributes);
            $org .= '      ' . xmltagwrite('title', 'full', ' ' . $row['description']);
            $org .= '    ' . xmltagwrite('item', 'close');
        }
        $mds = new mdstore(true);
        // RH: export metadata; if no table, create it
        if ($mdt = $mds->mds_get($row['item_type'] . '.' . $row['item_id'])) {
            if (($mdo = api_strpos($mdt, '<metadata>')) && ($mdc = api_strpos($mdt, '</metadata>'))) {
                $org .= '    ' . api_substr($mdt, $mdo, $mdc - $mdo + 11) . "\n";
            }
        }
        $org .= '    ' . xmltagwrite('item', 'close');
        $i++;
    }
    if ($circle1_files) {
        $org .= '    ' . xmltagwrite('item', 'close');
    }
    // Not needed in case of a blank path.
    $org .= '  ' . xmltagwrite('organization', 'close');
    $org .= xmltagwrite('organizations', 'close');
    $org .= xmltagwrite('resources', 'open');
    // Resources list.
    $i = 0;
    while ($circle1_files[0][$i]) {
        $attributes = '';
        $attributes[0][] = 'identifier';
        $attributes[1][] = 'item_ref_' . $circle1_files[2][$i];
        $attributes[0][] = 'type';
        $attributes[1][] = 'webcontent';
        $attributes[0][] = 'adlcp:scormtype';
        $attributes[1][] = 'sco';
        $attributes[0][] = 'href';
        $attributes[1][] = $circle1_files[0][$i];
        $org .= '  ' . xmltagwrite('resource', 'open', $attributes);
        $org .= '    ' . xmltagwrite('metadata', 'open');
        $org .= '      ' . xmltagwrite('schema', 'full', 'ADL SCORM');
        $org .= '      ' . xmltagwrite('schemaversion', 'full', '1.2');
        $org .= '    ' . xmltagwrite('metadata', 'close');
        $attributes = '';
        $attributes[0][] = 'href';
        $attributes[1][] = $circle1_files[0][$i];
        $org .= '    ' . xmltagwrite('file', 'open', $attributes);
        $org .= '  ' . xmltagwrite('resource', 'close');
        $i++;
    }
    $org .= xmltagwrite('resources', 'close');
    $org .= xmltagwrite('manifest', 'close');
    $manifest = $header . $org;
    exporttofile('imsmanifest.xml', 'Manifest file', '0', $manifest);
}
コード例 #5
0
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 && api_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[] = '
<link rel="stylesheet" type="text/css" href="md_styles.css">
<script type="text/javascript" src="md_script.js"></script>
';
Display::display_header($nameTools);
if (isset($dmo)) {
    echo '<h3>', $dmo, '</h3>', "\n";
    // document metadata op
    // if ($dmo == get_lang('Index')) $dmo = $dmo;
コード例 #6
0
if (strpos(strtolower(realpath(DIRECTORY)), $topdir) !== 0) {
    give_up('Invalid directory: ' . DIRECTORY);
}
chdir(DIRECTORY);
for ($i = 0; $i < 10; $i++) {
    if (!file_exists(HTT . '.htt')) {
        if (strtolower(realpath(getcwd())) == $topdir) {
            break;
        } else {
            chdir('..');
        }
    }
}
// XML and DB STUFF ----------------------------------------------------------->
$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && api_is_allowed_to_edit();
$mdStore = new mdstore($is_allowed_to_edit);
if (($mdt_rec = $mdStore->mds_get(EID)) === FALSE) {
    // no record, default XML
    $mdt = $mdObj->mdo_generate_default_xml_metadata();
} else {
    $mdt = $mdt_rec;
}
$xhtxmldoc = new xmddoc(explode("\n", $mdt));
!$xhtxmldoc->error or give_up($xhtxmldoc->error);
if (SID == $id_range_first && ($prv = $xhtxmldoc->xmd_select_single_element('previous')) != -1) {
    $xhtxmldoc->xmd_remove_element($prv);
}
if (SID == $id_range_last && ($nxt = $xhtxmldoc->xmd_select_single_element('next')) != -1) {
    $xhtxmldoc->xmd_remove_element($nxt);
}
$before_first = $id_range_first ? TRUE : FALSE;
コード例 #7
0
*   In this example, MD is defined for 'Document.1001', 1002, 1003
*/
require "../md_funcs.php";
define('EID_TYPE', 'Document');
require '../md_' . strtolower(EID_TYPE) . '.php';
// name of the language file that needs to be included
/*
$language_file = 'Whatever';
*/
require "../../inc/global.inc.php";
isset($_course) or give_up("Select a course first...");
$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && is_allowed_to_edit();
if (!$is_allowed_to_edit) {
    give_up("You're not allowed to edit...");
}
$mdStore = new mdstore($is_allowed_to_edit);
// create table if needed
require api_get_path(LIBRARY_PATH) . 'xmd.lib.php';
// mds_update_xml_and_mdt
require api_get_path(LIBRARY_PATH) . 'xht.lib.php';
// mdo_generate_default_xml_metadata
$noPHP_SELF = TRUE;
Display::display_header($nameTools);
echo "\n";
// if the language file in use is not 'md_' . EID_TYPE ...
$langMdTitle = 'Default Title (if doc not in DB)';
$langMdDescription = 'Default description (if doc has no comment)';
$langMdCoverage = 'bachelor of engineering';
$langMdCopyright = 'Ghent University';
foreach (array(1001, 1002, 1003) as $eid_id) {
    $mdObj = new mdobject($_course, $eid_id);
コード例 #8
0
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 && api_is_allowed_to_edit();
if (!$is_allowed_to_edit) give_up(get_lang('Denied'));

$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 = new mdobject($_course, 0);
$mdCat = $mdObj->mdo_dcmap_v['Coverage'];
$mdUrl = 'metadata/lom/technical/location[1]';

$mdObj->mdo_add_breadcrump_nav();  // see 'md_' . EID_TYPE . '.php'

$htmldecode = array_flip(get_html_translation_table(HTML_SPECIALCHARS));

コード例 #9
0
// e.g. 'Document' or 'Scorm'
define('TPLEN', strlen(EID_TYPE) + 1);
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';
$this_section = SECTION_COURSES;
$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 && api_is_allowed_to_edit();
if (!$is_allowed_to_edit) {
    give_up(get_lang('Denied'));
}
$mdStore = new mdstore($is_allowed_to_edit);
// create table if needed
$mdObj = new mdobject($_course, 0);
require api_get_path(LIBRARY_PATH) . 'xmd.lib.php';
require api_get_path(LIBRARY_PATH) . 'xht.lib.php';
$xhtDoc = $mdObj->mdo_define_htt();
$mdObj->mdo_add_breadcrump_nav();
// see 'md_' . EID_TYPE . '.php'
Display::display_header($nameTools);
// OPERATIONS ----------------------------------------------------------------->
echo '<h3>', htmlspecialchars(EID_TYPE, ENT_QUOTES, $charset), '</h3>', "\n";
$result = $mdStore->mds_get_many('eid,mdxmltext', "eid LIKE '" . EID_TYPE . ".%'");
echo get_lang('TotalMDEs'), $total = Database::num_rows($result), "<br><br>\n";
if ($total > 100) {
    set_time_limit((int) ($total / 10));
}
コード例 #10
0
ファイル: dcex.php プロジェクト: ilosada/chamilo-lms-icpna
<?php

/**
 * Test file for metadata
 * @package chamilo.metadata
 */
/**
 * Init
 */
require_once api_get_path(SYS_CODE_PATH) . 'metadata/md_funcs.php';
$mdStore = new mdstore(TRUE);
require_once api_get_path(LIBRARY_PATH) . 'xmd.lib.php';
require_once api_get_path(LIBRARY_PATH) . 'xht.lib.php';
require_once api_get_path(SYS_CODE_PATH) . 'metadata/md_document.php';
$mdObj = new mdobject($_course, $docId);
// e.g. '12'
// Fetch example:
if (is_array($dcelems = $mdStore->mds_get_dc_elements($mdObj))) {
    echo '<div>', htmlspecialchars($dcelems['Identifier']), ': ', htmlspecialchars($dcelems['Description']), '</div>';
}
// Store example:
$langMdCopyright = 'Provided the source is acknowledged';
$mdStore->mds_put_dc_elements($mdObj, array('Description' => time()));
コード例 #11
0
require 'md_funcs.php';
define('EID_TYPE', 'Mix');
require 'md_' . strtolower(EID_TYPE) . '.php';
// name of the language file that needs to be included
$language_file = 'md_mix';
include '../inc/global.inc.php';
$this_section = SECTION_COURSES;
$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 && api_is_allowed_to_edit();
if (!$is_allowed_to_edit) {
    give_up(get_lang('Denied'));
}
$mdStore = new mdstore(FALSE);
// no create from statistics
require api_get_path(LIBRARY_PATH) . 'xmd.lib.php';
require api_get_path(LIBRARY_PATH) . 'xht.lib.php';
$htmldecode = array_flip(get_html_translation_table(HTML_SPECIALCHARS));
// STATISTICS ----------------------------------------------------------------->
$noPHP_SELF = TRUE;
// in breadcrumps
Display::display_header($nameTools);
echo '<h3>', get_lang('Statistics'), '</h3>', "\n";
$ckw = $_course['path'] . '/CourseKwds.js';
define('KEYWORDS_CACHE', get_course_path() . $ckw);
if (!file_exists(KEYWORDS_CACHE)) {
    echo get_lang('NoKeywords');
    Display::display_footer();
    exit;
コード例 #12
0
ファイル: index.php プロジェクト: ilosada/chamilo-lms-icpna
require api_get_path(LIBRARY_PATH) . 'xmd.lib.php';
require api_get_path(LIBRARY_PATH) . 'xht.lib.php';
$mdObj = new mdobject($_course, EID_ID);
// see 'md_' . EID_TYPE . '.php'
// Construct assoclist $langLangs from language table ------------------------->
$result = Database::query("SELECT isocode FROM " . Database::get_main_table(TABLE_MAIN_LANGUAGE) . " WHERE available='1' ORDER BY isocode ASC");
$sep = ":";
$langLangs = $sep . "xx" . $sep . "xx";
while ($row = Database::fetch_array($result)) {
    if ($isocode = $row['isocode']) {
        $langLangs .= ",, " . $isocode . $sep . $isocode;
    }
}
// XML and DB STUFF ----------------------------------------------------------->
$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && api_is_allowed_to_edit();
$mdStore = new mdstore($is_allowed_to_edit);
if (($mdt_rec = $mdStore->mds_get(EID)) === FALSE) {
    // no record, default XML
    $mdt = $mdObj->mdo_generate_default_xml_metadata();
} else {
    $mdt = $mdt_rec;
}
$xhtxmldoc = new xmddoc(explode("\n", $mdt));
$httfile = $xhtxmldoc->error ? 'md_editxml.htt' : HTT . '.htt';
if (!$xhtxmldoc->error && $mdt_rec !== FALSE && method_exists($mdObj, 'mdo_override')) {
    $mdt = $mdObj->mdo_override($xhtxmldoc);
}
$xhtDoc = define_htt($httfile, $urlp, $_course['path']);
define('HSH', md5($mdt . LFN . $nameTools . get_lang('Sorry') . $httfile . implode('{}', $xhtDoc->htt_array)));
// cached HTML depends on LFN+HTT
$xhtDoc->xht_param['traceinfo'] = $xhtxmldoc->error;
コード例 #13
0
ファイル: search.php プロジェクト: ilosada/chamilo-lms-icpna
}
// name of the language file that needs to be included
$language_file = LFN;
require "../inc/global.inc.php";
$this_section = SECTION_COURSES;
$nameTools = get_lang('Tool');
$nameTools && get_lang('Sorry') or give_up('Language file ' . LFN . " doesn't define 'Tool' and 'Sorry'");
$_course = api_get_course_info();
isset($_course) or give_up(get_lang('Sorry'));
require api_get_path(LIBRARY_PATH) . 'xmd.lib.php';
require api_get_path(LIBRARY_PATH) . 'xht.lib.php';
$xhtDoc = define_htt(HTT . '.htt', $urlp, $_course['path']);
$xhtDoc->xht_param['type'] = TYPE;
$xhtDoc->xht_param['index'] = str_replace('/search.php', '/index.php', api_get_self());
// XML and DB STUFF ----------------------------------------------------------->
$mdStore = new mdstore(FALSE);
// no create DB table from search
$xhtDoc->xht_get_lang = 'get_lang';
$xhtDoc->xht_xmldoc = new xmddoc('');
if ($xhtDoc->xht_xmldoc->error) {
    give_up($xhtDoc->xht_xmldoc->error);
}
$mdt = $xhtDoc->xht_fill_template('DEFAULT' . TYPE) or give_up('No template DEFAULT' . TYPE);
$xhtDoc->xht_xmldoc = new xmddoc(explode("\n", $mdt));
if ($xhtDoc->xht_xmldoc->error) {
    give_up($xhtDoc->xht_xmldoc->error);
}
$xmlDoc = new xmddoc('');
if ($xmlDoc->error) {
    give_up($xmlDoc->error);
}