defaultRenderer(); $renderer->setElementTemplate('
{element}
'); $toolbar_set = 'Introduction'; $width = '100%'; $height = '300'; // The global variable $fck_attribute has been deprecated. It stays here for supporting old external code. global $fck_attribute; if (is_array($fck_attribute)) { if (isset($fck_attribute['ToolbarSet'])) { $toolbar_set = $fck_attribute['ToolbarSet']; } if (isset($fck_attribute['Width'])) { $toolbar_set = $fck_attribute['Width']; } if (isset($fck_attribute['Height'])) { $toolbar_set = $fck_attribute['Height']; } } if (is_array($editor_config)) { if (!isset($editor_config['ToolbarSet'])) { $editor_config['ToolbarSet'] = $toolbar_set; } if (!isset($editor_config['Width'])) { $editor_config['Width'] = $width; } if (!isset($editor_config['Height'])) { $editor_config['Height'] = $height; } } else { $editor_config = array('ToolbarSet' => $toolbar_set, 'Width' => $width, 'Height' => $height); } $form->add_html_editor('intro_content', null, null, false, $editor_config); $form->addElement('style_submit_button', 'intro_cmdUpdate', get_lang('SaveIntroText'), 'class="save"'); /* INTRODUCTION MICRO MODULE - COMMANDS SECTION (IF ALLOWED) */ $course_id = api_get_course_int_id(); if ($intro_editAllowed) { $moduleId = Database::escape_string($moduleId); /* Replace command */ if ($intro_cmdUpdate) { if ($form->validate()) { $form_values = $form->exportValues(); $intro_content = Security::remove_XSS(stripslashes(api_html_entity_decode($form_values['intro_content'])), COURSEMANAGERLOWSECURITY); if (!empty($intro_content)) { $sql = "REPLACE $TBL_INTRODUCTION SET c_id = $course_id, id='$moduleId',intro_text='".Database::escape_string($intro_content)."', session_id='".intval($session_id)."'"; Database::query($sql); $introduction_section .= Display::return_message(get_lang('IntroductionTextUpdated'),'confirmation', false); } else { $intro_cmdDel = true; // got to the delete command } } else { $intro_cmdEdit = true; } } /* Delete Command */ if ($intro_cmdDel) { Database::query("DELETE FROM $TBL_INTRODUCTION WHERE c_id = $course_id AND id='".$moduleId."' AND session_id='".intval($session_id)."'"); $introduction_section .= Display::return_message(get_lang('IntroductionTextDeleted'), 'confirmation'); } } /* INTRODUCTION MICRO MODULE - DISPLAY SECTION */ /* Retrieves the module introduction text, if exist */ $sql = "SELECT intro_text FROM $TBL_INTRODUCTION WHERE c_id = $course_id AND id='".Database::escape_string($moduleId)."' AND session_id = '".intval($session_id)."'"; $intro_dbQuery = Database::query($sql); if (Database::num_rows($intro_dbQuery) > 0) { $intro_dbResult = Database::fetch_array($intro_dbQuery); $intro_content = $intro_dbResult['intro_text']; } else { $intro_content = ''; } /* Determines the correct display */ if ($intro_cmdEdit || $intro_cmdAdd) { $intro_dispDefault = false; $intro_dispForm = true; $intro_dispCommand = false; } else { $intro_dispDefault = true; $intro_dispForm = false; if ($intro_editAllowed) { $intro_dispCommand = true; } else { $intro_dispCommand = false; } } /* Executes the display */ // display thematic advance inside a postit if ($intro_dispForm) { $default['intro_content'] = $intro_content; $form->setDefaults($default); $introduction_section .= '
'; $introduction_section .= $form->return_form(); $introduction_section .= '
'; } $thematic_description_html = ''; if ($tool == TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) { $thematic = new Thematic(); if (api_get_course_setting('display_info_advance_inside_homecourse') == '1') { $information_title = get_lang('InfoAboutLastDoneAdvance'); $last_done_advance = $thematic->get_last_done_thematic_advance(); $thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance); } else if(api_get_course_setting('display_info_advance_inside_homecourse') == '2') { $information_title = get_lang('InfoAboutNextAdvanceNotDone'); $next_advance_not_done = $thematic->get_next_thematic_advance_not_done(); $thematic_advance_info = $thematic->get_thematic_advance_list($next_advance_not_done); } else if(api_get_course_setting('display_info_advance_inside_homecourse') == '3') { $information_title = get_lang('InfoAboutLastDoneAdvanceAndNextAdvanceNotDone'); $last_done_advance = $thematic->get_last_done_thematic_advance(); $next_advance_not_done = $thematic->get_next_thematic_advance_not_done(); $thematic_advance_info = $thematic->get_thematic_advance_list($last_done_advance); $thematic_advance_info2 = $thematic->get_thematic_advance_list($next_advance_not_done); } if (!empty($thematic_advance_info)) { $thematic_advance = get_lang('CourseThematicAdvance').' '.$thematic->get_total_average_of_thematic_advances().'%'; if (api_is_allowed_to_edit(null, true)) { //$thematic_advance = ''.get_lang('CourseThematicAdvance').' '.$thematic->get_total_average_of_thematic_advances().'%'; } $thematic_info = $thematic->get_thematic_list($thematic_advance_info['thematic_id']); $thematic_advance_info['start_date'] = api_get_local_time($thematic_advance_info['start_date']); $thematic_advance_info['start_date'] = api_format_date($thematic_advance_info['start_date'], DATE_TIME_FORMAT_LONG); $thematic_description_html = '

'.$thematic_advance.'

'; } } $introduction_section .= '
'; $introduction_section .= $thematic_description_html; $introduction_section .= '
'; $introduction_section .= '
'; if ($intro_dispDefault) { $intro_content = text_filter($intro_content); // parse [tex] codes if (!empty($intro_content)) { $introduction_section .= $intro_content; } } $introduction_section .= '
'; if ($intro_dispCommand) { if (empty($intro_content)) { // Displays "Add intro" commands $introduction_section .= '
'; if (!empty ($GLOBALS['_cid'])) { $introduction_section .= ""; $introduction_section .= Display::return_icon('introduction_add.gif', get_lang('AddIntro')).' '; $introduction_section .= ""; } else { $introduction_section .= "\n".get_lang('AddIntro').""; } $introduction_section .= "
"; } else { // Displays "edit intro && delete intro" commands $introduction_section .= '
'; if (!empty ($GLOBALS['_cid'])) { $introduction_section .= "".Display::return_icon('edit.png',get_lang('Modify'),'',ICON_SIZE_SMALL).""; $introduction_section .= "".Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).""; } else { $introduction_section .= "".Display::return_icon('edit.png',get_lang('Modify'),'',ICON_SIZE_SMALL).""; $introduction_section .= "".Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).""; } $introduction_section .= "
"; } } $introduction_section .= '
';