/**
     * Display the form session export
     * @param array $hidden_fiels Hidden fields to add to the form.
     * @param boolean the document array will be serialize. This is used in the course_copy.php file
     */
    function display_form_session_export($list_course, $hidden_fields = null, $avoid_serialize = false)
    {
        $iconPath = api_get_path(WEB_IMG_PATH);
        ?>
		<script>
			function exp(item) {
				el = document.getElementById('div_'+item);
				if (el.style.display=='none'){
					el.style.display='';
					document.getElementById('img_'+item).src='../img/1.gif';
				}
				else{
					el.style.display='none';
					document.getElementById('img_'+item).src='../img/0.gif';
				}
			}
			function setCheckbox(type,value) {
 				d = document.course_select_form;
 				for (i = 0; i < d.elements.length; i++) {
   					if (d.elements[i].type == "checkbox") {
						var name = d.elements[i].attributes.getNamedItem('name').nodeValue;
 						if( name.indexOf(type) > 0 || type == 'all' ){
						     d.elements[i].checked = value;
						}
   					}
 				}
			}
			function checkLearnPath(message){
				d = document.course_select_form;
 				for (i = 0; i < d.elements.length; i++) {
 					if (d.elements[i].type == "checkbox") {
						var name = d.elements[i].attributes.getNamedItem('name').nodeValue;
 						if( name.indexOf('learnpath') > 0){
 							if(d.elements[i].checked){
	 							setCheckbox('document',true);
	 							alert(message);
	 							break;
 							}
 						}
 					}
 				}
			}
		</script>
		<?php 
        //get destination course title
        if (!empty($hidden_fields['destination_course'])) {
            $course_infos = CourseManager::get_course_information($hidden_fields['destination_course']);
            echo '<h3>';
            echo get_lang('DestinationCourse') . ' : ' . $course_infos['title'];
            echo '</h3>';
        }
        echo '<script src="' . api_get_path(WEB_CODE_PATH) . 'inc/lib/javascript/upload.js" type="text/javascript"></script>';
        echo '<script type="text/javascript">var myUpload = new upload(1000);</script>';
        echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="myUpload.start(\'dynamic_div\',\'' . api_get_path(WEB_CODE_PATH) . 'img/progress_bar.gif\',\'' . get_lang('PleaseStandBy') . '\',\'upload_form\')">';
        echo '<input type="hidden" name="action" value="course_select_form"/>';
        foreach ($list_course as $course) {
            foreach ($course->resources as $type => $resources) {
                if (count($resources) > 0) {
                    echo '<img id="img_' . $course->code . '" src="' . $iconPath . '1.gif" onclick="javascript:exp(' . "'{$course->code}'" . ');" />';
                    echo '<b  onclick="javascript:exp(' . "'{$course->code}'" . ');" > ' . $course->code . '</b><br />';
                    echo '<div id="div_' . $course->code . '">';
                    echo '<blockquote>';
                    echo '<div class="btn-group">';
                    echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('" . $course->code . "',true);\" >" . get_lang('All') . "</a>";
                    echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('" . $course->code . "',false);\" >" . get_lang('None') . "</a>";
                    echo '</div><br />';
                    foreach ($resources as $id => $resource) {
                        echo '<label class="checkbox" for="resource[' . $course->code . '][' . $id . ']">';
                        echo '<input type="checkbox" name="resource[' . $course->code . '][' . $id . ']" id="resource[' . $course->code . '][' . $id . ']"/>';
                        $resource->show();
                        echo '</label>';
                    }
                    echo '</blockquote>';
                    echo '</div>';
                    echo '<script type="text/javascript">exp(' . "'{$course->code}'" . ')</script>';
                }
            }
        }
        if ($avoid_serialize) {
            //Documents are avoided due the huge amount of memory that the serialize php function "eats" (when there are directories with hundred/thousand of files)
            // this is a known issue of serialize
            $course->resources['document'] = null;
        }
        echo '<input type="hidden" name="course" value="' . base64_encode(Course::serialize($course)) . '"/>';
        if (is_array($hidden_fields)) {
            foreach ($hidden_fields as $key => $value) {
                echo "\n";
                echo '<input type="hidden" name="' . $key . '" value="' . $value . '"/>';
            }
        }
        echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\'' . addslashes(get_lang('DocumentsWillBeAddedToo')) . '\')">' . get_lang('Ok') . '</button>';
        CourseSelectForm::display_hidden_quiz_questions($course);
        CourseSelectForm::display_hidden_scorm_directories($course);
        echo '</form>';
        echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>';
    }