diff --git a/main/coursecopy/backup.php b/main/coursecopy/backup.php index 1cd67199c1..757f6b8a9d 100755 --- a/main/coursecopy/backup.php +++ b/main/coursecopy/backup.php @@ -1,5 +1,6 @@ "../course_info/maintenance.php", "name" => get_lang('Maintenance')); +// Section for the tabs +$this_section = SECTION_COURSES; + +// Breadcrumbs +$interbreadcrumb[] = array('url' => '../course_info/maintenance.php', 'name' => get_lang('Maintenance')); // Displaying the header $nameTools = get_lang('Backup'); @@ -32,17 +33,17 @@ Display::display_header($nameTools); api_display_tool_title($nameTools); /* MAIN CODE */ -?> +?> \ No newline at end of file diff --git a/main/coursecopy/copy_course.php b/main/coursecopy/copy_course.php index 0072577d0e..6d38556762 100755 --- a/main/coursecopy/copy_course.php +++ b/main/coursecopy/copy_course.php @@ -1,46 +1,44 @@ - "../course_info/maintenance.php", "name" => get_lang('Maintenance')); +// Breadcrumbs +$interbreadcrumb[] = array ('url' => '../course_info/maintenance.php', 'name' => get_lang('Maintenance')); -// the section (for the tabs) -$this_section=SECTION_COURSES; +// The section (for the tabs) +$this_section = SECTION_COURSES; // Display the header Display::display_header(get_lang('CopyCourse')); //api_display_tool_title($nameTools); -/* - MAIN CODE -*/ + +/* MAIN CODE */ + // If a CourseSelectForm is posted or we should copy all resources, then copy them -if ((isset ($_POST['action']) && $_POST['action'] == 'course_select_form') || (isset ($_POST['copy_option']) && $_POST['copy_option'] == 'full_copy')) { - if (isset ($_POST['action']) && $_POST['action'] == 'course_select_form') { +if ((isset($_POST['action']) && $_POST['action'] == 'course_select_form') || (isset($_POST['copy_option']) && $_POST['copy_option'] == 'full_copy')) { + if (isset($_POST['action']) && $_POST['action'] == 'course_select_form') { $course = CourseSelectForm :: get_posted_course('copy_course'); } else { $cb = new CourseBuilder(); @@ -74,12 +72,12 @@ if ((isset ($_POST['action']) && $_POST['action'] == 'course_select_form') || (i } $sql .= ' AND target_course_code IS NULL AND cu.user_id = '.$user_info['user_id'].' AND c.code != '."'".$course_info['sysCode']."'".' ORDER BY title ASC'; $res = Database::query($sql); - if( Database::num_rows($res) == 0) { + if (Database::num_rows($res) == 0) { Display::display_normal_message(get_lang('NoDestinationCoursesAvailable')); } else { ?>
- '; while ($obj = Database::fetch_object($res)) { @@ -90,30 +88,29 @@ if ((isset ($_POST['action']) && $_POST['action'] == 'course_select_form') || (i

- +
- +

- +
- - + +
- - + +
- - + +

- +
- diff --git a/main/coursecopy/copy_course_session.php b/main/coursecopy/copy_course_session.php index fe30e70c6e..5a890cc6ee 100755 --- a/main/coursecopy/copy_course_session.php +++ b/main/coursecopy/copy_course_session.php @@ -1,5 +1,6 @@ '../admin/index.php',"name" => get_lang('PlatformAdmin')); +$interbreadcrumb[] = array('url' => '../admin/index.php', 'name' => get_lang('PlatformAdmin')); // Database Table Definitions $tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); @@ -49,7 +49,7 @@ $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); /* FUNCTIONS */ -function make_select_session_list($name,$sessions,$attr = array()) { +function make_select_session_list($name, $sessions, $attr = array()) { $attrs = ''; if (count($attr) > 0) { @@ -76,15 +76,13 @@ function make_select_session_list($name,$sessions,$attr = array()) { function display_form() { - global $charset; - $html = ''; $sessions = SessionManager::get_sessions_list(); - // actions + // Actions $html .= '
'; - // link back to the documents overview - $html .= ''.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('PlatformAdmin'),array('style'=>'vertical-align:middle')).get_lang('BackTo').' '.get_lang('PlatformAdmin').''; + // Link back to the documents overview + $html .= ''.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('PlatformAdmin'), array('style' => 'vertical-align:middle')).get_lang('BackTo').' '.get_lang('PlatformAdmin').''; $html .= '
'; $html .= '
'.get_lang('CopyCourse').'
'; @@ -94,9 +92,9 @@ function display_form() { $html .= ''.get_lang('OriginCoursesFromSession').':'; $html .= ' '.get_lang('DestinationCoursesFromSession').':'; - $html .= ''.make_select_session_list('sessions_list_origin',$sessions,array('onchange'=>'xajax_search_courses(this.value,\'origin\')')).''; + $html .= ''.make_select_session_list('sessions_list_origin', $sessions, array('onchange' => 'javascript: xajax_search_courses(this.value,\'origin\');')).''; $html .= ' 
'; - $html .= ''; $html .= '
'; $html .= '
'; @@ -105,17 +103,14 @@ function display_form() { // Options configuration //$html .= '
'.get_lang('CopyCourse').'
'; $html .= ''; - $introduction = get_lang('CopyCourseFromSessionToSessionExplanation',true); + $introduction = get_lang('CopyCourseFromSessionToSessionExplanation'); $html .= '
'.$introduction.'
'; $html .= '

'.get_lang('TypeOfCopy').'

'; $html .= ''; $html .= '
'; $html .= ''; $html .= '

'; - $html .= '
'; - - - + $html .= '
'; $html .= ''; $html .= '
'; @@ -125,7 +120,8 @@ function display_form() { echo $html; } -function search_courses($id_session,$type) { +function search_courses($id_session, $type) { + global $tbl_course, $tbl_session_rel_course, $course_list; $xajax_response = new XajaxResponse(); @@ -137,7 +133,7 @@ function search_courses($id_session,$type) { if ($type == 'origin') { - // search courses by id_session for origin list + // Search courses by id_session for origin list $sql = "SELECT c.code, c.visual_code, c.title, src.id_session FROM $tbl_course c, $tbl_session_rel_course src WHERE src.course_code = c.code @@ -146,13 +142,12 @@ function search_courses($id_session,$type) { $course_list = array(); - $return .= ''; + while ($course = Database :: fetch_array($rs)) { $course_list[] = "'{$course['code']}'"; $course_title=str_replace("'","\'",$course_title); - $return .= ''; - + $return .= ''; } $return .= ''; @@ -170,34 +165,34 @@ function search_courses($id_session,$type) { $rs_select_destination = Database::query($sql); - $select_destination .= ''; $select_destination .= ''; while($session = Database :: fetch_array($rs_select_destination)) { $select_destination .= ''; } $select_destination .= ''; - $xajax_response -> addAssign('ajax_sessions_list_destination','innerHTML',api_utf8_encode($select_destination)); + $xajax_response -> addAssign('ajax_sessions_list_destination', 'innerHTML', api_utf8_encode($select_destination)); } else{ - $select_destination .= ''; $select_destination .= ''; $select_destination .= ''; - $xajax_response -> addAssign('ajax_sessions_list_destination','innerHTML',api_utf8_encode($select_destination)); + $xajax_response -> addAssign('ajax_sessions_list_destination', 'innerHTML', api_utf8_encode($select_destination)); } - // select multiple destination empty + // Select multiple destination empty $select_multiple_empty = ''; - // send response by ajax - $xajax_response -> addAssign('ajax_list_courses_origin','innerHTML',api_utf8_encode($return)); - $xajax_response -> addAssign('ajax_list_courses_destination','innerHTML',api_utf8_encode($select_multiple_empty)); + // Send response by ajax + $xajax_response -> addAssign('ajax_list_courses_origin', 'innerHTML', api_utf8_encode($return)); + $xajax_response -> addAssign('ajax_list_courses_destination', 'innerHTML', api_utf8_encode($select_multiple_empty)); } else { - $list_courses_origin = implode(',',$_SESSION['course_list']); + $list_courses_origin = implode(',', $_SESSION['course_list']); $session_origin = $_SESSION['session_origin']; - // search courses by id_session where course codes is include en courses list destination + // Search courses by id_session where course codes is include en courses list destination $sql = "SELECT c.code, c.visual_code, c.title, src.id_session FROM $tbl_course c, $tbl_session_rel_course src WHERE src.course_code = c.code @@ -206,48 +201,46 @@ function search_courses($id_session,$type) { $rs = Database::query($sql); $course_list_destination = array(); - $return .= ''; + while ($course = Database :: fetch_array($rs)) { $course_list_destination[] = $course['code']; - $course_title=str_replace("'","\'",$course_title); - $return .= ''; + $course_title = str_replace("'", "\'", $course_title); + $return .= ''; } $return .= ''; $_SESSION['course_list_destination'] = $course_list_destination; - // send response by ajax - $xajax_response -> addAssign('ajax_list_courses_destination','innerHTML',api_utf8_encode($return)); + // Send response by ajax + $xajax_response -> addAssign('ajax_list_courses_destination', 'innerHTML', api_utf8_encode($return)); - // disable option from session courses list origin where if no the same con the destination + // Disable option from session courses list origin where if no the same con the destination $sql = "SELECT c.code, c.visual_code, c.title, src.id_session FROM $tbl_course c, $tbl_session_rel_course src WHERE src.course_code = c.code AND src.id_session = '".intval($session_origin)."'"; $result = Database::query($sql); - $return_option_disabled = ''; + while ($cours = Database :: fetch_array($result)) { + $course_title=str_replace("'", "\'", $course_title); if (count($course_list_destination) > 0) { - if (!in_array($cours['code'],$course_list_destination)) { + if (!in_array($cours['code'], $course_list_destination)) { $return_option_disabled .= ''.$cours['title'].' ('.$cours['visual_code'].')'; } else { - $return_option_disabled .= ''; + $return_option_disabled .= ''; } } else { if (empty($id_session)) { - $return_option_disabled .= ''; + $return_option_disabled .= ''; } else { $return_option_disabled .= ''.$cours['title'].' ('.$cours['visual_code'].')'; } - } } $return_option_disabled .= ''; - // send response by ajax - $xajax_response -> addAssign('ajax_list_courses_origin','innerHTML',api_utf8_encode($return_option_disabled)); + // Send response by ajax + $xajax_response -> addAssign('ajax_list_courses_origin', 'innerHTML', api_utf8_encode($return_option_disabled)); } - } return $xajax_response; } @@ -256,7 +249,7 @@ $xajax -> processRequests(); /* HTML head extra */ $htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/'); -$htmlHeadXtra[] = '