Пример #1
0
 function mdobject($_course, $eid)
 {
     if (!($dotpos = strpos($eid, '.'))) {
         return;
     }
     $this->mdo_course = $_course;
     $this->mdo_eid = $eid;
     $this->mdo_type = $type = substr($eid, 0, $dotpos);
     $this->mdo_id = $id = substr($eid, $dotpos + 1);
     if ($type == 'Document' || $type == 'Scorm') {
         $table = $type == 'Scorm' ? Database::get_course_table(TABLE_SCORMDOC) : Database::get_course_table(TABLE_DOCUMENT);
         if ($dotpos = strpos($id, '.')) {
             $urlp = '?sid=' . urlencode(substr($id, $dotpos + 1));
             $id = substr($id, 0, $dotpos);
         }
         if ($docinfo = @mysql_fetch_array(Database::query("SELECT path,comment,filetype FROM\n                 {$table} WHERE id='" . addslashes($id) . "'"))) {
             $this->mdo_path = $docinfo['path'];
             $this->mdo_comment = $docinfo['comment'];
             $this->mdo_filetype = $docinfo['filetype'];
             if ($type == 'Scorm') {
                 $this->mdo_base_url = get_course_web() . $this->mdo_course['path'] . '/scorm' . $this->mdo_path;
                 $this->mdo_url = $this->mdo_base_url . '/index.php' . $urlp;
             } else {
                 $this->mdo_url = api_get_path(WEB_PATH) . 'main/document/' . ($this->mdo_filetype == 'file' ? 'download' : 'document') . '.php?' . ($this->mdo_filetype == 'file' ? 'doc_url=' : 'curdirpath=') . urlencode($this->mdo_path);
             }
         }
     } elseif ($type == 'Link') {
         $link_table = Database::get_course_table(TABLE_LINK);
         if ($linkinfo = @mysql_fetch_array(Database::query("SELECT url,title,description,category_id FROM\n                 {$link_table} WHERE id='" . addslashes($id) . "'"))) {
             $this->mdo_url = $linkinfo['url'];
         }
     }
 }
Пример #2
0
 function mdobject($_course, $id)
 {
     global $ieee_dcmap_e, $ieee_dcmap_v;
     // md_funcs
     $scormdocument = Database::get_course_table(TABLE_LP_MAIN);
     $this->mdo_course = $_course;
     $this->mdo_type = 'Scorm';
     $this->mdo_id = $id;
     $this->mdo_eid = $this->mdo_type . '.' . $id;
     $this->mdo_dcmap_e = $ieee_dcmap_e;
     $this->mdo_dcmap_v = $ieee_dcmap_v;
     $sql = "SELECT path,description,lp_type FROM {$scormdocument} WHERE id='" . addslashes($id) . "'";
     if ($docinfo = @Database::fetch_array(Database::query($sql))) {
         $this->mdo_path = $docinfo['path'];
         //Sometimes the new scorm-tool adds '/.' at the end of a directory name, so remove this before continue
         //the process -- bmol
         if (substr($this->mdo_path, -2) == '/.') {
             $this->mdo_path = substr($this->mdo_path, 0, strlen($this->mdo_path) - 2);
         }
         $this->mdo_comment = $docinfo['description'];
         //Don't think the next line is correct. There used to be a 'type' field in the scormdocument table.
         //This metadata tool only works on folder types -- bmol
         $this->mdo_filetype = $docinfo['lp_type'] == 2 ? 'folder' : 'xxx';
         $this->mdo_url = get_course_web() . $this->mdo_course['path'] . '/scorm/' . $this->mdo_path . '/index.php';
     }
 }
Пример #3
0
function define_htt($htt_file, $urlp, $course_path) {
	global $charset;

    ($htt_file_contents = @fgc($htt_file))
        or give_up('Templates file "' . $htt_file . '" is missing...');

    $xhtDoc = new xhtdoc($htt_file_contents);
    if ($xhtDoc->htt_error)
        give_up('Templates file "' . $htt_file . '": ' . $xhtDoc->htt_error);

    $xhtDoc->xht_param['self'] = api_get_self() . $urlp;

    $xhtDoc->xht_param['dateTime'] = date('Y-m-d');

    $ckw = $course_path . '/CourseKwds.js';
    define('KEYWORDS_CACHE', get_course_path() . $ckw);

    if (file_exists(KEYWORDS_CACHE)) $kcdt =
        htmlspecialchars(date('Y/m/d H:i:s', filemtime(KEYWORDS_CACHE)), ENT_QUOTES, $charset);

    $xhtDoc->xht_param['keywordscache'] = $kcdt ?
        '<script type="text/javascript" src="' . get_course_web() . $ckw . '"></script>' .
        '<br /><small><i>(CourseKwds cache: ' . $kcdt . ')</i></small>' : '';

    return $xhtDoc;
}