/** * Display form * * @param $cancelUrl string url of the cancel button * @return string html output of form */ public function displayForm($cancelUrl = null) { JavascriptLoader::getInstance()->load('course_form'); $languageList = get_language_to_display_list('availableLanguagesForCourses'); $categoriesList = claroCategory::getAllCategoriesFlat(); $linkedCategoriesListHtml = ''; // Categories linked to the course $unlinkedCategoriesListHtml = ''; // Other categories (not linked to the course) foreach ($categoriesList as $category) { // Is that category linked to the current course or not ? $match = false; foreach ($this->categories as $searchCategory) { if ($category['id'] == (int) $searchCategory->id) { $match = true; break; } else { $match = false; } } // Dispatch in the lists if ($match) { $linkedCategoriesListHtml .= '<option ' . (!$category['visible'] ? 'class="hidden" ' : '') . 'value="' . $category['id'] . '">' . $category['path'] . '</option>' . "\n"; } else { if ($category['canHaveCoursesChild'] || claro_is_platform_admin()) { $unlinkedCategoriesListHtml .= '<option ' . (!$category['visible'] ? 'class="hidden" ' : '') . 'value="' . $category['id'] . '">' . $category['path'] . '</option>' . "\n"; } } } $publicDisabled = !(get_conf('allowPublicCourses', true) || claro_is_platform_admin()) ? ' disabled="disabled"' : ''; $publicCssClass = !(get_conf('allowPublicCourses', true) || claro_is_platform_admin()) ? ' class="notice"' : ''; $publicMessage = $this->access != 'public' && !(get_conf('allowPublicCourses', true) || claro_is_platform_admin()) ? '<br /><span class="notice">' . get_lang('If you need to create a public course, please contact the platform administrator') . '</span>' : ''; $cancelUrl = is_null($cancelUrl) ? get_path('clarolineRepositoryWeb') . 'course/index.php?cid=' . claro_htmlspecialchars($this->courseId) : $cancelUrl; $template = new CoreTemplate('course_form.tpl.php'); $template->assign('formAction', $_SERVER['PHP_SELF']); $template->assign('relayContext', claro_form_relay_context()); $template->assign('course', $this); $template->assign('linkedCategoriesListHtml', $linkedCategoriesListHtml); $template->assign('unlinkedCategoriesListHtml', $unlinkedCategoriesListHtml); $template->assign('languageList', $languageList); $template->assign('publicDisabled', $publicDisabled); $template->assign('publicCssClass', $publicCssClass); $template->assign('publicMessage', $publicMessage); $template->assign('cancelUrl', $cancelUrl); $template->assign('nonRootCategoryRequired', !get_conf('clcrs_rootCategoryAllowed', true)); return $template->render(); }
// Flag forcing the 'current course' reset, as we're not anymore inside a course $cidReset = true; $tidReset = true; $_SESSION['courseSessionCode'] = null; // Include Library and configuration files require './claroline/inc/claro_init_global.inc.php'; // main init include claro_get_conf_repository() . 'CLHOME.conf.php'; // conf file require_once dirname(__FILE__) . '/claroline/inc/lib/coursesearchbox.class.php'; require_once dirname(__FILE__) . '/claroline/inc/lib/course/courselist.lib.php'; if (get_conf('display_former_homepage', false) || !claro_is_user_authenticated()) { // Main template $template = new CoreTemplate('platform_index.tpl.php'); // Languages $template->assign('languages', get_language_to_display_list()); $template->assign('currentLanguage', language::current_language()); // Last user action $lastUserAction = isset($_SESSION['last_action']) && $_SESSION['last_action'] != '1970-01-01 00:00:00' ? $_SESSION['last_action'] : date('Y-m-d H:i:s'); $template->assign('lastUserAction', $lastUserAction); // Manage the search box and search results $searchBox = new CourseSearchBox($_SERVER['REQUEST_URI']); $template->assign('searchBox', $searchBox); if (claro_is_user_authenticated()) { // User course (activated and deactivated) lists and search results (if any) if (empty($_REQUEST['viewCategory'])) { $courseTreeView = CourseTreeNodeViewFactory::getUserCourseTreeView(claro_get_current_user_id()); } else { $courseTreeView = CourseTreeNodeViewFactory::getUserCategoryCourseTreeView(claro_get_current_user_id(), $_REQUEST['viewCategory']); } $template->assign('templateMyCourses', $courseTreeView);
/** * Get html select box for a user language preference * * @return string html * @since 1.8 */ function user_display_preferred_language_select_box() { $language_list = get_language_to_display_list(); $form = ''; if (is_array($language_list) && count($language_list) > 1) { // get the the current language $user_language = language::current_language(); // build language selector form $form .= claro_html_form_select('language', $language_list, $user_language, array('id' => 'language_selector')); } return $form; }