Ejemplo n.º 1
0
 *
 * Open eClass is an open platform distributed in the hope that it will
 * be useful (without any warranty), under the terms of the GNU (General
 * Public License) as published by the Free Software Foundation.
 * The full license can be read in "/info/license/license_gpl.txt".
 *
 * Contact address: GUnet Asynchronous eLearning Group,
 *                  Network Operations Center, University of Athens,
 *                  Panepistimiopolis Ilissia, 15784, Athens, Greece
 *                  e-mail: info@openeclass.org
 * ======================================================================== */


require_once '../../include/baseTheme.php';
require_once 'modules/course_metadata/CourseXML.php';
require_once 'modules/course_metadata/CourseXMLConfig.php';

if (isset($_REQUEST['course'])) {
    $code = $_REQUEST['course'];
    $course_id = course_code_to_id($code);
}

// exit if feature disabled or no metadata present
if (!isset($_REQUEST['course']) || !get_config('course_metadata') || !file_exists(CourseXMLConfig::getCourseXMLPath($code))) {
    echo "course error";
    exit();
}

$xml = CourseXMLElement::init($course_id, $code);
echo $xml->asDiv();
exit();
Ejemplo n.º 2
0
 *
 * Contact address: GUnet Asynchronous eLearning Group,
 *                  Network Operations Center, University of Athens,
 *                  Panepistimiopolis Ilissia, 15784, Athens, Greece
 *                  e-mail: info@openeclass.org
 * ======================================================================== */

$require_current_course = true;
define('STATIC_MODULE', 1);
require_once '../../include/baseTheme.php';
$pageName = $langCourseMetadata;
require_once 'modules/course_metadata/CourseXML.php';
require_once 'modules/course_metadata/CourseXMLConfig.php';

// exit if feature disabled or no metadata present
if (!get_config('course_metadata') || !file_exists(CourseXMLConfig::getCourseXMLPath($course_code))) {
    header("Location: {$urlServer}courses/$course_code/index.php");
    exit();
}

$xml = CourseXMLElement::init($course_id, $course_code);
$tool_content .= $xml->asDiv();

$head_content .= <<<EOF
<style type="text/css">
.ui-widget {
    font-family: "Trebuchet MS",Tahoma,Arial,Helvetica,sans-serif;
    font-size: 13px;
}

.ui-widget-content {
Ejemplo n.º 3
0
/**
 * @brief upgrade to 2.10
 * @global type $langUpgCourse
 * @param type $code
 * @param type $course_id
 * @param type $extramessage
 */
function upgrade_course_2_10($code, $course_id) {
    global $langUpgCourse;

    Database::get()->query("USE `$code`");
    
    Database::get()->query("ALTER TABLE `dropbox_file` CHANGE `description` `description` TEXT");

    // refresh XML metadata
    require_once "modules/course_metadata/CourseXML.php";
    if (file_exists(CourseXMLConfig::getCourseXMLPath($code))) {
        CourseXMLElement::refreshCourse($course_id, $code, true);
    }
    if (!DBHelper::fieldExists('poll', 'description', $code)) {
        Database::get()->query('ALTER TABLE poll ADD description MEDIUMTEXT NOT NULL,
                                   ADD end_message MEDIUMTEXT NOT NULL,
                                   ADD anonymized INT(1) NOT NULL DEFAULT 0');
        Database::get()->query('ALTER TABLE poll_question
                    CHANGE qtype qtype tinyint(3) UNSIGNED NOT NULL');
    }
}
Ejemplo n.º 4
0
    /**
     * Save the XML structure for a specific course.
     * 
     * @param int              $courseId
     * @param string           $courseCode
     * @param CourseXMLElement $xml
     */
    public static function save($courseId, $courseCode, $xml) {
        // pre-save operations
        foreach ($xml->instructor as $instructor) {
            $instrFirst = array();
            $instrLast = array();
            foreach ($instructor->firstName as $fname) {
                $fnameLang = (string) $fname->getAttribute('lang');
                $instrFirst[$fnameLang] = (string) $fname;
            }
            foreach ($instructor->lastName as $lname) {
                $lnameLang = (string) $lname->getAttribute('lang');
                $instrLast[$lnameLang] = (string) $lname;
            }
            foreach ($instructor->fullName as $name) {
                $nameLang = (string) $name->getAttribute('lang');
                $name->{0} = $instrFirst[$nameLang] . " " . $instrLast[$nameLang];
            }
        }

        $doc = new DOMDocument('1.0');
        $doc->loadXML($xml->asXML(), LIBXML_NONET | LIBXML_DTDLOAD | LIBXML_DTDATTR);
        $doc->formatOutput = true;
        $doc->save(CourseXMLConfig::getCourseXMLPath($courseCode));

        $is_certified = 1;
        $level = '';
        if ($xml->confirmAPlusLevel == 'true') {
            $level = $GLOBALS['langOpenCoursesAPlusLevel'];
        } else if ($xml->confirmALevel == 'true') {
            $level = $GLOBALS['langOpenCoursesALevel'];
        } else if ($xml->confirmAMinusLevel == 'true') {
            $level = $GLOBALS['langOpenCoursesAMinusLevel'];
        } else {
            $is_certified = 0;
        }
        $deleted = ($is_certified) ? 0 : 1;
        $firstCreateDate = null;
        $ts = strtotime($xml->firstCreateDate);
        if ($ts > 0) {
            $firstCreateDate = gmdate('Y-m-d H:i:s', $ts);
        } else {
            $firstCreateDate = gmdate('Y-m-d H:i:s');
        }
        $nowdatestamp = gmdate('Y-m-d H:i:s');

        // insert or update oai_record
        $exists = Database::get()->querySingle("SELECT 1 AS `exists` FROM oai_record WHERE course_id = ?d", $courseId);
        if ($exists && intval($exists->exists) == 1) {
            Database::get()->query("UPDATE oai_record SET
                `oai_identifier` = ?s,
                `datestamp` = ?t,
                `deleted` = ?d
                WHERE course_id = ?d", "oai:" . $_SERVER['SERVER_NAME'] . ":" . $courseId, $nowdatestamp, $deleted, intval($courseId));
        } else {
            if ($is_certified) {
                Database::get()->query("INSERT INTO oai_record SET
                    `course_id` = ?d,
                    `oai_identifier` = ?s,
                    `datestamp` = ?t,
                    `deleted` = ?d", intval($courseId), "oai:" . $_SERVER['SERVER_NAME'] . ":" . $courseId, $nowdatestamp, $deleted);
            }
        }
        
        if (($exists && intval($exists->exists) == 1) || $is_certified) {
            $oaiRecordId = Database::get()->querySingle("SELECT id FROM oai_record WHERE course_id = ?d", $courseId)->id;

            // Metadata fields
            self::storeMetadata($oaiRecordId, 'dc_title', self::serialize($xml->title));
            self::storeMetadata($oaiRecordId, 'dc_description', self::serialize($xml->description));
            self::storeMetadata($oaiRecordId, 'dc_syllabus', self::serialize($xml->contents));
            self::storeMetadata($oaiRecordId, 'dc_subject', self::makeMultiLang($xml->thematic));
            self::storeMetadata($oaiRecordId, 'dc_subsubject', self::makeMultiLang($xml->subthematic));
            self::storeMetadata($oaiRecordId, 'dc_objectives', self::serialize($xml->objectives));
            self::storeMetadata($oaiRecordId, 'dc_level', self::makeMultiLang($xml->level));
            self::storeMetadata($oaiRecordId, 'dc_prerequisites', self::serialize($xml->prerequisites));
            self::storeMetadata($oaiRecordId, 'dc_instructor', self::serializeMulti($xml->instructor, "fullName"));
            self::storeMetadata($oaiRecordId, 'dc_department', self::serialize($xml->department));
            self::storeMetadata($oaiRecordId, 'dc_institution', self::makeMultiLang($xml->institution));
            self::storeMetadata($oaiRecordId, 'dc_coursephoto', (string) $xml->coursePhoto);
            self::storeMetadata($oaiRecordId, 'dc_coursephotomime', (string) $xml->coursePhoto['mime']);
            self::storeMetadata($oaiRecordId, 'dc_instructorphoto', self::serializeMulti($xml->instructor, "photo"));
            self::storeMetadata($oaiRecordId, 'dc_instructorphotomime', self::serializeAttr($xml->instructor, "photo", "mime"));
            self::storeMetadata($oaiRecordId, 'dc_instructorregistrationcode', self::serializeMulti($xml->instructor, "registrationCode"));
            self::storeMetadata($oaiRecordId, 'dc_url', (string) $xml->url);
            // unused ATM self::storeMetadata($oaiRecordId, 'dc_identifier', );
            self::storeMetadata($oaiRecordId, 'dc_language', self::serialize($xml->language));
            self::storeMetadata($oaiRecordId, 'dc_date', $firstCreateDate);
            self::storeMetadata($oaiRecordId, 'dc_format', $level);
            self::storeMetadata($oaiRecordId, 'dc_rights', self::serialize($xml->license));
            self::storeMetadata($oaiRecordId, 'dc_videolectures', (string) $xml->videolectures);
            self::storeMetadata($oaiRecordId, 'dc_visits', (string) $xml->visits);
            self::storeMetadata($oaiRecordId, 'dc_hits', (string) $xml->hits);
            self::storeMetadata($oaiRecordId, 'dc_code', (string) $xml->code);
            self::storeMetadata($oaiRecordId, 'dc_keywords', self::serialize($xml->keywords));
            self::storeMetadata($oaiRecordId, 'dc_contentdevelopment', self::serialize($xml->contentDevelopment));
            self::storeMetadata($oaiRecordId, 'dc_formattypes', (string) $xml->format);
            self::storeMetadata($oaiRecordId, 'dc_recommendedcomponents', self::serialize($xml->recommendedComponents));
            self::storeMetadata($oaiRecordId, 'dc_assignments', self::serialize($xml->assignments));
            self::storeMetadata($oaiRecordId, 'dc_requirements', self::serialize($xml->requirements));
            self::storeMetadata($oaiRecordId, 'dc_remarks', self::serialize($xml->remarks));
            self::storeMetadata($oaiRecordId, 'dc_acknowledgments', self::serialize($xml->acknowledgments));
            self::storeMetadata($oaiRecordId, 'dc_coteaching', (string) $xml->coTeaching);
            self::storeMetadata($oaiRecordId, 'dc_coteachingcolleagueopenscourse', (string) $xml->coTeachingColleagueOpensCourse);
            self::storeMetadata($oaiRecordId, 'dc_coteachingautonomousdepartment', (string) $xml->coTeachingAutonomousDepartment);
            self::storeMetadata($oaiRecordId, 'dc_coteachingdepartmentcredithours', (string) $xml->coTeachingDepartmentCreditHours);
            self::storeMetadata($oaiRecordId, 'dc_yearofstudy', (string) $xml->yearOfStudy);
            self::storeMetadata($oaiRecordId, 'dc_semester', (string) $xml->semester);
            self::storeMetadata($oaiRecordId, 'dc_coursetype', (string) $xml->type);
            self::storeMetadata($oaiRecordId, 'dc_credithours', (string) $xml->credithours);
            self::storeMetadata($oaiRecordId, 'dc_credits', (string) $xml->credits);
            self::storeMetadata($oaiRecordId, 'dc_institutiondescription', self::serialize($xml->institutionDescription));
            self::storeMetadata($oaiRecordId, 'dc_curriculumtitle', self::serialize($xml->curriculumTitle));
            self::storeMetadata($oaiRecordId, 'dc_curriculumdescription', self::serialize($xml->curriculumDescription));
            self::storeMetadata($oaiRecordId, 'dc_outcomes', self::serialize($xml->outcomes));
            self::storeMetadata($oaiRecordId, 'dc_curriculumkeywords', self::serialize($xml->curriculumKeywords));
            self::storeMetadata($oaiRecordId, 'dc_sector', self::serialize($xml->sector));
            self::storeMetadata($oaiRecordId, 'dc_targetgroup', self::serialize($xml->targetGroup));
            self::storeMetadata($oaiRecordId, 'dc_curriculumtargetgroup', self::serialize($xml->curriculumTargetGroup));
            self::storeMetadata($oaiRecordId, 'dc_featuredbooks', self::serialize($xml->featuredBooks));
            self::storeMetadata($oaiRecordId, 'dc_structure', self::serialize($xml->structure));
            self::storeMetadata($oaiRecordId, 'dc_teachingmethod', self::serialize($xml->teachingMethod));
            self::storeMetadata($oaiRecordId, 'dc_assessmentmethod', self::serialize($xml->assessmentMethod));
            self::storeMetadata($oaiRecordId, 'dc_eudoxuscode', (string) $xml->eudoxusCode);
            self::storeMetadata($oaiRecordId, 'dc_eudoxusurl', (string) $xml->eudoxusURL);
            self::storeMetadata($oaiRecordId, 'dc_kalliposurl', (string) $xml->kalliposURL);
            self::storeMetadata($oaiRecordId, 'dc_numberofunits', (string) $xml->numberOfUnits);
            self::storeMetadata($oaiRecordId, 'dc_unittitle', self::serializeMulti($xml->unit, "title"));
            self::storeMetadata($oaiRecordId, 'dc_unitdescription', self::serializeMulti($xml->unit, "description"));
            self::storeMetadata($oaiRecordId, 'dc_unitkeywords', self::serializeMulti($xml->unit, "keywords"));
        }
    }