*/ require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php'; global $charset; $show_description_field = false; //for now $nameTools = get_lang('Doc'); $this_section = SECTION_COURSES; Event::event_access_tool(TOOL_LEARNPATH); api_protect_course_script(); if (api_is_in_gradebook()) { $interbreadcrumb[]= array( 'url' => api_get_path(WEB_CODE_PATH).'gradebook/index.php?'.api_get_cidreq(), 'name' => get_lang('ToolGradebook') ); } $learnpath = learnpath::getCurrentLpFromSession(); $interbreadcrumb[] = array( 'url' => 'lp_controller.php?action=list&'.api_get_cidreq(), 'name' => get_lang('LearningPaths'), ); $interbreadcrumb[] = array( 'url' => api_get_self()."?action=build&lp_id=".$learnpath->get_id( ).'&'.api_get_cidreq(), 'name' => $learnpath->get_name(), ); $htmlHeadXtra[] = ''; $defaults=array(); $form = new FormValidator('form1', 'post', 'lp_controller.php'); // Form title $form->addElement('header', get_lang('EditLPSettings')); // Title $form->addElement('text', 'lp_name', api_ucfirst(get_lang('LearnpathTitle')), array('size' => 43)); $form->applyFilter('lp_name', 'html_filter'); $form->addRule('lp_name', get_lang('ThisFieldIsRequired'), 'required'); $form->addElement('hidden', 'lp_encoding'); $items = learnpath::getCategoryFromCourseIntoSelect(api_get_course_int_id(), true); $form->addElement('select', 'category_id', get_lang('Category'), $items); // Origin /* $origin_select = $form->addElement('select', 'lp_maker', get_lang('Origin')); $lp_orig = $learnpath->get_maker(); include 'content_makers.inc.php'; foreach ($content_origins as $origin) { if ($lp_orig == $origin) { $s_selected_origin = $origin; } $origin_select->addOption($origin, $origin); } // Content proximity $content_proximity_select = $form->addElement('select', 'lp_proximity', get_lang('ContentProximity')); $lp_prox = $learnpath->get_proximity(); if ($lp_prox != 'local') { $s_selected_proximity = 'remote'; } else { $s_selected_proximity = 'local'; } $content_proximity_select->addOption(get_lang('Local'), 'local'); $content_proximity_select->addOption(get_lang('Remote'), 'remote'); */ //Hide toc frame $hide_toc_frame = $form->addElement( 'checkbox', 'hide_toc_frame', null, get_lang('HideTocFrame'), array('onclick' => '$("#lp_layout_column").toggle()') ); if (api_get_setting('course.allow_course_theme') == 'true') { $mycourselptheme = api_get_course_setting('allow_learning_path_theme'); if (!empty($mycourselptheme) && $mycourselptheme!=-1 && $mycourselptheme== 1) { //LP theme picker $theme_select = $form->addElement('SelectTheme', 'lp_theme', get_lang('Theme')); $form->applyFilter('lp_theme', 'trim'); $s_theme = $learnpath->get_theme(); $theme_select ->setSelected($s_theme); //default } } // Author $form->addHtmlEditor( 'lp_author', get_lang('Author'), array('size' => 80), array( 'ToolbarSet' => 'LearningPathAuthor', 'Width' => '100%', 'Height' => '150px', ) ); $form->applyFilter('lp_author', 'html_filter'); // LP image $form->add_progress_bar(); if (strlen($learnpath->get_preview_image()) > 0) { $show_preview_image = 'get_preview_image().'>'; $form->addElement('label', get_lang('ImagePreview'), $show_preview_image); $form->addElement('checkbox', 'remove_picture', null, get_lang('DelImage')); } $label = ($learnpath->get_preview_image() != '' ? get_lang( 'UpdateImage' ) : get_lang('AddImage')); $form->addElement('file', 'lp_preview_image', array($label, get_lang('ImageWillResizeMsg'))); $form->addRule('lp_preview_image', get_lang('OnlyImagesAllowed'), 'filetype', array ('jpg', 'jpeg', 'png', 'gif')); // Search terms (only if search is activated). if (api_get_setting('search.search_enabled') === 'true') { $specific_fields = get_specific_field_list(); foreach ($specific_fields as $specific_field) { $form->addElement( 'text', $specific_field['code'], $specific_field['name'] ); $filter = array( 'c_id' => "'".api_get_course_int_id()."'", 'field_id' => $specific_field['id'], 'ref_id' => $learnpath->lp_id, 'tool_id' => '\''.TOOL_LEARNPATH.'\'', ); $values = get_specific_field_values_list($filter, array('value')); if (!empty($values)) { $arr_str_values = array(); foreach ($values as $value) { $arr_str_values[] = $value['value']; } $defaults[$specific_field['code']] = implode(', ', $arr_str_values); } } } $defaults['lp_encoding'] = Security::remove_XSS($learnpath->encoding); $defaults['lp_name'] = Security::remove_XSS($learnpath->get_name()); $defaults['lp_author'] = Security::remove_XSS($learnpath->get_author()); $defaults['hide_toc_frame'] = Security::remove_XSS( $learnpath->get_hide_toc_frame() ); $defaults['category_id'] = intval($learnpath->getCategoryId()); $expired_on = $learnpath->expired_on; $publicated_on = $learnpath->publicated_on; // Prerequisites $form->addElement('html','