"index.php", "name" => get_lang('CourseProgram')); $description_type = isset ($_REQUEST['description_type']) ? Security::remove_XSS($_REQUEST['description_type']) : null; $description_id = isset ($_REQUEST['description_id']) ? Security::remove_XSS($_REQUEST['description_id']) : null; $action = isset($_GET['action'])?Security::remove_XSS($_GET['action']):''; $edit = isset($_POST['edit'])?Security::remove_XSS($_POST['edit']):''; $add = isset($_POST['add'])?Security::remove_XSS($_POST['add']):''; if(intval($description_type) == 1) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('GeneralDescription')); if(intval($description_type) == 2) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Objectives')); if(intval($description_type) == 3) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Topics')); if(intval($description_type) == 4) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Methodology')); if(intval($description_type) == 5) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('CourseMaterial')); if(intval($description_type) == 6) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('HumanAndTechnicalResources')); if(intval($description_type) == 7) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Assessment')); if(intval($description_type) >= 8) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('NewBloc')); api_protect_course_script(true); $nameTools = get_lang('CourseProgram'); Display :: display_header(''); //api_display_tool_title($nameTools); /* ----------------------------------------------------------- Constants and variables ----------------------------------------------------------- */ $nameTools = get_lang(TOOL_COURSE_DESCRIPTION); /* ----------------------------------------------------------- Introduction section ----------------------------------------------------------- */ Display::display_introduction_section(TOOL_COURSE_DESCRIPTION); $tbl_course_description = Database::get_course_table(TABLE_COURSE_DESCRIPTION); $show_description_list = true; $show_peda_suggest = true; define('ADD_BLOCK', 8); // Default descriptions $default_description_titles = array(); $default_description_titles[1]= get_lang('GeneralDescription'); $default_description_titles[2]= get_lang('Objectives'); $default_description_titles[3]= get_lang('Topics'); $default_description_titles[4]= get_lang('Methodology'); $default_description_titles[5]= get_lang('CourseMaterial'); $default_description_titles[6]= get_lang('HumanAndTechnicalResources'); $default_description_titles[7]= get_lang('Assessment'); $default_description_titles[8]= get_lang('Other'); $default_description_icon = array(); $default_description_icon[1]= 'edu_miscellaneous.gif'; $default_description_icon[2]= 'spire.gif'; $default_description_icon[3]= 'kcmdf_big.gif'; $default_description_icon[4]= 'misc.gif'; $default_description_icon[5]= 'laptop.gif'; $default_description_icon[6]= 'personal.gif'; $default_description_icon[7]= 'korganizer.gif'; $default_description_icon[8]= 'ktip.gif'; $question = array(); $question[1]= get_lang('GeneralDescriptionQuestions'); $question[2]= get_lang('ObjectivesQuestions'); $question[3]= get_lang('TopicsQuestions'); $question[4]= get_lang('MethodologyQuestions'); $question[5]= get_lang('CourseMaterialQuestions'); $question[6]= get_lang('HumanAndTechnicalResourcesQuestions'); $question[7]= get_lang('AssessmentQuestions'); $information = array(); $information[1]= get_lang('GeneralDescriptionInformation'); $information[2]= get_lang('ObjectivesInformation'); $information[3]= get_lang('TopicsInformation'); $information[4]= get_lang('MethodologyInformation'); $information[5]= get_lang('CourseMaterialInformation'); $information[6]= get_lang('HumanAndTechnicalResourcesInformation'); $information[7]= get_lang('AssessmentInformation'); $default_description_title_editable = array(); $default_description_title_editable[1] = true; $default_description_title_editable[2] = true; $default_description_title_editable[3] = true; $default_description_title_editable[4] = true; $default_description_title_editable[5] = true; $default_description_title_editable[6] = true; $default_description_title_editable[7] = true; /* ----------------------------------------------------------- Tracking ----------------------------------------------------------- */ event_access_tool(TOOL_COURSE_DESCRIPTION); /* ============================================================================== MAIN CODE ============================================================================== */ $condition_session = api_get_session_condition($session_id, false); $current_session_id = api_get_session_id(); $sql = "SELECT description_type,title FROM $tbl_course_description $condition_session ORDER BY description_type "; $result = Database::query($sql, __FILE__, __LINE__); while ($row = Database::fetch_array($result)) { $default_description_titles[$row['description_type']] = $row['title']; } $actions = array('add','delete','edit'); if ((api_is_allowed_to_edit(null,true) && !is_null($description_type)) || in_array($action,$actions)) { $description_id = intval($description_id); $description_type = intval($description_type); // Delete a description block if ($action == 'delete') { $sql = "DELETE FROM $tbl_course_description WHERE id='".$description_id."'"; Database::query($sql, __FILE__, __LINE__); //update item_property (delete) api_item_property_update(api_get_course_info(), TOOL_COURSE_DESCRIPTION, Database::escape_string($description_id), 'delete', api_get_user_id()); Display :: display_confirmation_message(get_lang('CourseDescriptionDeleted')); } // Add or edit a description block else { if (!empty($description_type)) { $sql = "SELECT * FROM $tbl_course_description WHERE description_type='$description_type' AND session_id='$current_session_id'"; $result = Database::query($sql, __FILE__, __LINE__); if ($description = Database::fetch_array($result)) { $default_description_titles[$description_type] = $description['title']; $description_content = $description['content']; } else { $current_title = $default_description_titles[$description_type]; } } else { $sql = "SELECT MAX(description_type) as MAX FROM $tbl_course_description $condition_session"; $result = Database::query($sql, __FILE__, __LINE__); $max= Database::fetch_array($result); $description_type = $max['MAX']+1; if ($description_type < ADD_BLOCK) { $description_type=8; } } //Se borro: echo '