Ejemplo n.º 1
0
 function mdo_generate_default_xml_metadata()
 {
     global $iso639_2_code, $ieee_xml;
     $xhtDoc = new xhtdoc($ieee_xml);
     $_user = api_get_user_info();
     if ($xhtDoc->htt_error) {
         give_up('IEEE XML (metadata/md_funcs): ' . $xhtDoc->htt_error);
     }
     $xhtDoc->xht_get_lang = 'get_lang';
     $xhtDoc->xht_xmldoc = new xmddoc('');
     if ($xhtDoc->xht_xmldoc->error) {
         give_up($xhtDoc->xht_xmldoc->error);
     }
     $xhtDoc->xht_param['siteUri'] = make_uri();
     $xhtDoc->xht_param['entry'] = $this->mdo_course['sysCode'] . '.Link.' . $this->mdo_id;
     // 2005-05-30: path->sysCode
     $xhtDoc->xht_param['location'] = $this->mdo_url . '';
     $xhtDoc->xht_param['mdlang'] = strtolower($iso639_2_code);
     $xhtDoc->xht_param['lang'] = strtolower($iso639_2_code);
     $xhtDoc->xht_param['title'] = $this->mdo_title ? $this->mdo_title : get_lang('MdTitle');
     if ($d = $this->mdo_description) {
         if ($keywords = $this->_find_keywords($d)) {
             $d = array_pop($keywords);
         }
         $xhtDoc->xht_param['description'] = $d;
     } else {
         $xhtDoc->xht_param['description'] = get_lang('MdDescription');
     }
     $xhtDoc->xht_param['coverage'] = $this->mdo_category_title ? $this->mdo_category_title : get_lang('MdCoverage');
     if (isset($_user)) {
         $xhtDoc->xht_param['author'] = "BEGIN:VCARD\\nFN:" . api_get_person_name($_user['firstName'], $_user['lastName'], null, PERSON_NAME_EMAIL_ADDRESS) . "\\nEMAIL:" . $_user['mail'] . "\\nEND:VCARD\\n";
     }
     $xhtDoc->xht_param['dateTime'] = date('Y-m-d');
     $xhtDoc->xht_param['format'] = '';
     $xhtDoc->xht_param['size'] = '0';
     if (count($keywords)) {
         $xd = new xmddoc(explode("\n", $mdt = $xhtDoc->xht_fill_template('XML')));
         if ($xd->error) {
             return $mdt;
         }
         // and worry later
         $this->_add_keywords($xd, $keywords);
         return $xd->xmd_xml();
     }
     return $xhtDoc->xht_fill_template('XML');
 }
Ejemplo n.º 2
0
 function mdo_generate_default_xml_metadata()
 {
     global $iso639_2_code, $ieee_xml;
     $xhtDoc = new xhtdoc($ieee_xml);
     $_user = api_get_user_info();
     if ($xhtDoc->htt_error) {
         give_up('IEEE XML (metadata/md_funcs): ' . $xhtDoc->htt_error);
     }
     $xhtDoc->xht_get_lang = 'get_lang';
     $xhtDoc->xht_xmldoc = new xmddoc('');
     if ($xhtDoc->xht_xmldoc->error) {
         give_up($xhtDoc->xht_xmldoc->error);
     }
     $xhtDoc->xht_param['siteUri'] = make_uri();
     $xhtDoc->xht_param['entry'] = $this->mdo_course['sysCode'] . '.Document.' . $this->mdo_id;
     // 2005-05-30: path->sysCode
     $xhtDoc->xht_param['location'] = api_get_path(WEB_PATH) . 'main/metadata/openobject.php?cidReq=' . urlencode($this->mdo_course['sysCode']) . '&eid=' . urlencode($this->mdo_eid);
     $xhtDoc->xht_param['mdlang'] = strtolower($iso639_2_code);
     $xhtDoc->xht_param['lang'] = strtolower($iso639_2_code);
     $xhtDoc->xht_param['title'] = $this->mdo_title ? $this->mdo_title : ($this->mdo_path ? $this->mdo_path : get_lang('MdTitle', ''));
     $xhtDoc->xht_param['description'] = $this->mdo_comment ? $this->mdo_comment : get_lang('MdDescription', '');
     $xhtDoc->xht_param['coverage'] = get_lang('MdCoverage', '');
     if (isset($_user)) {
         $xhtDoc->xht_param['author'] = "BEGIN:VCARD\\nFN:" . api_get_person_name($_user['firstName'], $_user['lastName'], null, PERSON_NAME_EMAIL_ADDRESS) . "\\nEMAIL:" . $_user['mail'] . "\\nEND:VCARD\\n";
     }
     $xhtDoc->xht_param['dateTime'] = date('Y-m-d');
     if ($this->mdo_filetype == 'folder') {
         $format = "inode/directory";
     } else {
         require_once api_get_path(LIBRARY_PATH) . 'document.lib.php';
         $format = DocumentManager::file_get_mime_type($this->mdo_path);
     }
     $xhtDoc->xht_param['format'] = $format;
     $xhtDoc->xht_param['size'] = ($s = filesize(get_course_path() . $this->mdo_course['path'] . '/document' . $this->mdo_path)) ? $s : '0';
     return $xhtDoc->xht_fill_template('XML');
 }