|
@@ -37,7 +37,7 @@ $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
|
|
|
$tool_name= get_lang('SubscribeCoursesToSession');
|
|
|
|
|
|
$add_type = 'multiple';
|
|
|
-if (isset($_GET['add_type']) && $_GET['add_type']!=''){
|
|
|
+if (isset($_GET['add_type']) && $_GET['add_type'] != '') {
|
|
|
$add_type = Security::remove_XSS($_REQUEST['add_type']);
|
|
|
}
|
|
|
|
|
@@ -151,7 +151,7 @@ if ($ajax_search) {
|
|
|
$Courses = Database::store_result($result);
|
|
|
|
|
|
foreach ($Courses as $course) {
|
|
|
- $sessionCourses[$course['id']] = $course ;
|
|
|
+ $sessionCourses[$course['id']] = $course;
|
|
|
}
|
|
|
} else {
|
|
|
$sql = "SELECT course.id, code, title, visual_code, session_id
|
|
@@ -175,7 +175,7 @@ if ($ajax_search) {
|
|
|
INNER JOIN $tbl_course_rel_access_url url_course
|
|
|
ON (url_course.c_id = course.id)
|
|
|
WHERE access_url_id = $access_url_id
|
|
|
- ORDER BY ".(sizeof($courses)?"(code IN(".implode(',',$courses).")) DESC,":"")." title";
|
|
|
+ ORDER BY ".(sizeof($courses) ? "(code IN(".implode(',',$courses).")) DESC,":"")." title";
|
|
|
}
|
|
|
}
|
|
|
$result = Database::query($sql);
|
|
@@ -206,162 +206,156 @@ if (!api_is_platform_admin() && api_is_teacher()) {
|
|
|
|
|
|
unset($Courses);
|
|
|
?>
|
|
|
- <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $sessionId; ?><?php if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>>
|
|
|
- <legend><?php echo $tool_name.' ('.$session_info['name'].')'; ?></legend>
|
|
|
- <input type="hidden" name="formSent" value="1" />
|
|
|
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $sessionId; ?><?php if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>>
|
|
|
+ <legend><?php echo $tool_name.' ('.$session_info['name'].')'; ?></legend>
|
|
|
+ <input type="hidden" name="formSent" value="1" />
|
|
|
|
|
|
- <?php
|
|
|
- if (!empty($errorMsg)) {
|
|
|
- Display::display_normal_message($errorMsg); //main API
|
|
|
- }
|
|
|
- ?>
|
|
|
- <div id="multiple-add-session" class="row">
|
|
|
- <div class="col-md-4">
|
|
|
- <label><?php echo get_lang('CourseListInPlatform') ?> :</label>
|
|
|
- <?php
|
|
|
- if (!($add_type == 'multiple')) {
|
|
|
- ?>
|
|
|
- <input type="text" id="course_to_add" onkeyup="xajax_search_courses(this.value,'single')" class="form-control"/>
|
|
|
- <div id="ajax_list_courses_single"></div>
|
|
|
- <?php
|
|
|
- } else {
|
|
|
- ?>
|
|
|
- <div id="ajax_list_courses_multiple">
|
|
|
- <select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" class="form-control">
|
|
|
- <?php foreach ($nosessionCourses as $enreg) { ?>
|
|
|
- <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')',ENT_QUOTES).'"'; if(in_array($enreg['code'],$CourseList)) echo 'selected="selected"'; ?>>
|
|
|
- <?php echo $enreg['title'].' ('.$enreg['visual_code'].')'; ?>
|
|
|
- </option>
|
|
|
- <?php } ?>
|
|
|
- </select>
|
|
|
- </div>
|
|
|
- <?php
|
|
|
- }
|
|
|
- unset($nosessionCourses);
|
|
|
+ <?php
|
|
|
+ if (!empty($errorMsg)) {
|
|
|
+ Display::display_normal_message($errorMsg); //main API
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+ <div id="multiple-add-session" class="row">
|
|
|
+ <div class="col-md-4">
|
|
|
+ <label><?php echo get_lang('CourseListInPlatform') ?> :</label>
|
|
|
+ <?php
|
|
|
+ if (!($add_type == 'multiple')) {
|
|
|
?>
|
|
|
- </div>
|
|
|
- <div class="col-md-4">
|
|
|
- <?php if($add_type == 'multiple') { ?>
|
|
|
- <div class="code-course">
|
|
|
- <?php echo get_lang('FirstLetterCourse'); ?> :
|
|
|
-
|
|
|
- <select name="firstLetterCourse" onchange = "xajax_search_courses(this.value,'multiple')" class="selectpicker show-tick form-control">
|
|
|
- <option value="%">--</option>
|
|
|
- <?php
|
|
|
- echo Display :: get_alphabet_options();
|
|
|
- echo Display :: get_numeric_options(0,9,'');
|
|
|
- ?>
|
|
|
- </select>
|
|
|
- </div>
|
|
|
- <?php } ?>
|
|
|
- <div class="control-course">
|
|
|
-
|
|
|
- <?php
|
|
|
- if ($ajax_search) {
|
|
|
- ?>
|
|
|
- <div class="separate-action">
|
|
|
- <button class="btn btn-primary" type="button" onclick="remove_item(document.getElementById('destination'))">
|
|
|
- <em class="fa fa-chevron-left"></em>
|
|
|
- </button>
|
|
|
- </div>
|
|
|
- <?php
|
|
|
- } else {
|
|
|
- ?>
|
|
|
- <div class="separate-action">
|
|
|
- <button class="btn btn-primary" type="button" onclick="moveItem(document.getElementById('origin'), document.getElementById('destination'))" onclick="moveItem(document.getElementById('origin'), document.getElementById('destination'))">
|
|
|
- <em class="fa fa-chevron-right"></em>
|
|
|
- </button>
|
|
|
- </div>
|
|
|
- <div class="separate-action">
|
|
|
- <button class="btn btn-primary" type="button" onclick="moveItem(document.getElementById('destination'), document.getElementById('origin'))" onclick="moveItem(document.getElementById('destination'), document.getElementById('origin'))">
|
|
|
- <em class="fa fa-chevron-left"></em>
|
|
|
- </button>
|
|
|
- </div>
|
|
|
-
|
|
|
- <?php
|
|
|
- }
|
|
|
+ <input type="text" id="course_to_add" onkeyup="xajax_search_courses(this.value,'single')" class="form-control"/>
|
|
|
+ <div id="ajax_list_courses_single"></div>
|
|
|
+ <?php
|
|
|
+ } else {
|
|
|
?>
|
|
|
- <div class="separate-action">
|
|
|
- <label>
|
|
|
- <input type="checkbox" name="copy_evaluation">
|
|
|
- <?php echo get_lang('ImportGradebookInCourse'); ?>
|
|
|
- </label>
|
|
|
- </div>
|
|
|
-
|
|
|
- <?php
|
|
|
- echo '<div class="separate-action">';
|
|
|
- if (isset($_GET['add'])) {
|
|
|
- echo '<button class="btn btn-success" type="button" value="" onclick="valide()" >'.get_lang('NextStep').'</button>';
|
|
|
- } else {
|
|
|
- echo '<button class="btn btn-success" type="button" value="" onclick="valide()" >'.get_lang('SubscribeCoursesToSession').'</button>';
|
|
|
- }
|
|
|
- echo '</div>';
|
|
|
+ <div id="ajax_list_courses_multiple">
|
|
|
+ <select id="origin" name="NoSessionCoursesList[]" multiple="multiple" size="20" class="form-control">
|
|
|
+ <?php foreach ($nosessionCourses as $enreg) { ?>
|
|
|
+ <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')',ENT_QUOTES).'"'; if(in_array($enreg['code'],$CourseList)) echo 'selected="selected"'; ?>>
|
|
|
+ <?php echo $enreg['title'].' ('.$enreg['visual_code'].')'; ?>
|
|
|
+ </option>
|
|
|
+ <?php } ?>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <?php
|
|
|
+ }
|
|
|
+ unset($nosessionCourses);
|
|
|
+ ?>
|
|
|
+ </div>
|
|
|
+ <div class="col-md-4">
|
|
|
+ <?php if($add_type == 'multiple') { ?>
|
|
|
+ <div class="code-course">
|
|
|
+ <?php echo get_lang('FirstLetterCourse'); ?> :
|
|
|
+
|
|
|
+ <select name="firstLetterCourse" onchange = "xajax_search_courses(this.value,'multiple')" class="selectpicker show-tick form-control">
|
|
|
+ <option value="%">--</option>
|
|
|
+ <?php
|
|
|
+ echo Display :: get_alphabet_options();
|
|
|
+ echo Display :: get_numeric_options(0, 9, '');
|
|
|
+ ?>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <?php } ?>
|
|
|
+ <div class="control-course">
|
|
|
+ <?php
|
|
|
+ if ($ajax_search) {
|
|
|
?>
|
|
|
-
|
|
|
+ <div class="separate-action">
|
|
|
+ <button class="btn btn-primary" type="button" onclick="remove_item(document.getElementById('destination'))">
|
|
|
+ <em class="fa fa-chevron-left"></em>
|
|
|
+ </button>
|
|
|
</div>
|
|
|
+ <?php
|
|
|
+ } else {
|
|
|
+ ?>
|
|
|
+ <div class="separate-action">
|
|
|
+ <button class="btn btn-primary" type="button" onclick="moveItem(document.getElementById('origin'), document.getElementById('destination'))" onclick="moveItem(document.getElementById('origin'), document.getElementById('destination'))">
|
|
|
+ <em class="fa fa-chevron-right"></em>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ <div class="separate-action">
|
|
|
+ <button class="btn btn-primary" type="button" onclick="moveItem(document.getElementById('destination'), document.getElementById('origin'))" onclick="moveItem(document.getElementById('destination'), document.getElementById('origin'))">
|
|
|
+ <em class="fa fa-chevron-left"></em>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ <?php } ?>
|
|
|
+ <div class="separate-action">
|
|
|
+ <label>
|
|
|
+ <input type="checkbox" name="copy_evaluation">
|
|
|
+ <?php echo get_lang('ImportGradebookInCourse'); ?>
|
|
|
+ </label>
|
|
|
+ </div>
|
|
|
+ <?php
|
|
|
+ echo '<div class="separate-action">';
|
|
|
+ if (isset($_GET['add'])) {
|
|
|
+ echo '<button class="btn btn-success" type="button" value="" onclick="valide()" >'.get_lang('NextStep').'</button>';
|
|
|
+ } else {
|
|
|
+ echo '<button class="btn btn-success" type="button" value="" onclick="valide()" >'.get_lang('SubscribeCoursesToSession').'</button>';
|
|
|
+ }
|
|
|
+ echo '</div>';
|
|
|
+ ?>
|
|
|
</div>
|
|
|
- <div class="col-md-4">
|
|
|
- <label><?php echo get_lang('CourseListInSession') ?> :</label>
|
|
|
- <select id='destination' name="SessionCoursesList[]" multiple="multiple" size="20" class="form-control">
|
|
|
+ </div>
|
|
|
+ <div class="col-md-4">
|
|
|
+ <label><?php echo get_lang('CourseListInSession') ?> :</label>
|
|
|
+ <select id='destination' name="SessionCoursesList[]" multiple="multiple" size="20" class="form-control">
|
|
|
|
|
|
- <?php
|
|
|
- foreach($sessionCourses as $enreg) {
|
|
|
- ?>
|
|
|
- <option value="<?php echo $enreg['id']; ?>" title="<?php echo htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')',ENT_QUOTES); ?>">
|
|
|
- <?php echo $enreg['title'].' ('.$enreg['visual_code'].')'; ?>
|
|
|
- </option>
|
|
|
- <?php
|
|
|
- }
|
|
|
- unset($sessionCourses);
|
|
|
+ <?php
|
|
|
+ foreach($sessionCourses as $enreg) {
|
|
|
?>
|
|
|
- </select>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </form>
|
|
|
- <script>
|
|
|
- function moveItem(origin , destination) {
|
|
|
- for(var i = 0 ; i<origin.options.length ; i++) {
|
|
|
- if(origin.options[i].selected) {
|
|
|
- destination.options[destination.length] = new Option(origin.options[i].text,origin.options[i].value);
|
|
|
- origin.options[i]=null;
|
|
|
- i = i-1;
|
|
|
+ <option value="<?php echo $enreg['id']; ?>" title="<?php echo htmlspecialchars($enreg['title'].' ('.$enreg['visual_code'].')',ENT_QUOTES); ?>">
|
|
|
+ <?php echo $enreg['title'].' ('.$enreg['visual_code'].')'; ?>
|
|
|
+ </option>
|
|
|
+ <?php
|
|
|
}
|
|
|
+ unset($sessionCourses);
|
|
|
+ ?>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</form>
|
|
|
+<script>
|
|
|
+ function moveItem(origin , destination) {
|
|
|
+ for(var i = 0 ; i<origin.options.length ; i++) {
|
|
|
+ if(origin.options[i].selected) {
|
|
|
+ destination.options[destination.length] = new Option(origin.options[i].text,origin.options[i].value);
|
|
|
+ origin.options[i]=null;
|
|
|
+ i = i-1;
|
|
|
}
|
|
|
- destination.selectedIndex = -1;
|
|
|
- sortOptions(destination.options);
|
|
|
}
|
|
|
+ destination.selectedIndex = -1;
|
|
|
+ sortOptions(destination.options);
|
|
|
+ }
|
|
|
|
|
|
- function sortOptions(options) {
|
|
|
- newOptions = new Array();
|
|
|
- for (i = 0 ; i<options.length ; i++) {
|
|
|
- newOptions[i] = options[i];
|
|
|
- }
|
|
|
+ function sortOptions(options) {
|
|
|
+ newOptions = new Array();
|
|
|
+ for (i = 0 ; i<options.length ; i++) {
|
|
|
+ newOptions[i] = options[i];
|
|
|
+ }
|
|
|
|
|
|
- newOptions = newOptions.sort(mysort);
|
|
|
- options.length = 0;
|
|
|
+ newOptions = newOptions.sort(mysort);
|
|
|
+ options.length = 0;
|
|
|
|
|
|
- for(i = 0 ; i < newOptions.length ; i++){
|
|
|
- options[i] = newOptions[i];
|
|
|
- }
|
|
|
+ for(i = 0 ; i < newOptions.length ; i++){
|
|
|
+ options[i] = newOptions[i];
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- function mysort(a, b) {
|
|
|
- if(a.text.toLowerCase() > b.text.toLowerCase()){
|
|
|
- return 1;
|
|
|
- }
|
|
|
- if(a.text.toLowerCase() < b.text.toLowerCase()){
|
|
|
- return -1;
|
|
|
- }
|
|
|
- return 0;
|
|
|
+ function mysort(a, b) {
|
|
|
+ if(a.text.toLowerCase() > b.text.toLowerCase()){
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ if(a.text.toLowerCase() < b.text.toLowerCase()){
|
|
|
+ return -1;
|
|
|
}
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
|
|
|
- function valide() {
|
|
|
- var options = document.getElementById('destination').options;
|
|
|
- for (i = 0 ; i<options.length ; i++)
|
|
|
- options[i].selected = true;
|
|
|
+ function valide() {
|
|
|
+ var options = document.getElementById('destination').options;
|
|
|
+ for (i = 0 ; i<options.length ; i++)
|
|
|
+ options[i].selected = true;
|
|
|
|
|
|
- document.forms.formulaire.submit();
|
|
|
- }
|
|
|
- </script>
|
|
|
+ document.forms.formulaire.submit();
|
|
|
+ }
|
|
|
+</script>
|
|
|
<?php
|
|
|
Display::display_footer();
|