$smarty->assign("T_MODULE_COURSE_SETTINGS_TABPAGES", $moduleTabPages); $smarty->assign("T_TABLE_OPTIONS", $options); $smarty->assign("T_COURSE_OPTIONS", array(array('text' => _EDITCOURSE, 'image' => "16x16/edit.png", 'href' => basename($_SERVER['PHP_SELF']) . "?ctg=courses&edit_course=" . $_GET['course']))); if ($_GET['op'] == 'course_info') { $form = new HTML_QuickForm("empty_form", "post", null, null, null, true); $courseInformation = unserialize($currentCourse->course['info']); $information = new LearningObjectInformation($courseInformation); if (!isset($currentUser->coreAccess['course_settings']) || $currentUser->coreAccess['course_settings'] == 'change') { $smarty->assign("T_COURSE_INFO_HTML", $information->toHTML($form, false)); } else { $smarty->assign("T_COURSE_INFO_HTML", $information->toHTML($form, false, false)); } $courseMetadata = unserialize($currentCourse->course['metadata']); $metadata = new DublinCoreMetadata($courseMetadata); if (!isset($currentUser->coreAccess['course_settings']) || $currentUser->coreAccess['course_settings'] == 'change') { $smarty->assign("T_COURSE_METADATA_HTML", $metadata->toHTML($form)); } else { $smarty->assign("T_COURSE_METADATA_HTML", $metadata->toHTML($form, true, false)); } if (isset($_POST['postAjaxRequest'])) { if (in_array($_POST['dc'], array_keys($information->metadataAttributes))) { if ($_POST['value']) { $courseInformation[$_POST['dc']] = urldecode($_POST['value']); } else { unset($courseInformation[$_POST['dc']]); } $currentCourse->course['info'] = serialize($courseInformation); } elseif (in_array($_POST['dc'], array_keys($metadata->metadataAttributes))) { if ($_POST['value']) { $courseMetadata[$_POST['dc']] = urldecode($_POST['value']); } else {
exit; } $loadScripts[] = 'includes/metadata'; try { if ($_GET['unit']) { $currentUnit = new EfrontUnit($_GET['unit']); if (!$currentUnit['metadata']) { $defaultMetadata = array('title' => $currentUnit['name'], 'date' => date("Y/m/d", $currentUnit['timestamp'])); $currentUnit['metadata'] = serialize($defaultMetadata); $currentUnit->persist(); } $form = new HTML_QuickForm("empty_form", "post", null, null, null, true); try { $contentMetadata = unserialize($currentUnit['metadata']); $metadata = new DublinCoreMetadata($contentMetadata); $smarty->assign("T_CONTENT_METADATA_HTML", $metadata->toHTML($form)); $smarty->assign("T_CURRENT_UNIT", $currentUnit); } catch (Exception $e) { handleNormalFlowExceptions($e); } if (isset($_POST['postAjaxRequest'])) { if (in_array($_POST['dc'], array_keys($metadata->metadataAttributes))) { if ($_POST['value']) { $contentMetadata[$_POST['dc']] = htmlspecialchars(urldecode($_POST['value'])); } else { unset($contentMetadata[$_POST['dc']]); } $currentUnit['metadata'] = serialize($contentMetadata); } try { $currentUnit->persist();