|
|
|
@ -18,22 +18,22 @@ class CourseSelectForm |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
static function display_form($course, $hidden_fields = null, $avoid_serialize=false) { |
|
|
|
static function display_form($course, $hidden_fields = null, $avoid_serialize=false) { |
|
|
|
global $charset; |
|
|
|
global $charset; |
|
|
|
$resource_titles[RESOURCE_EVENT] = get_lang('Events'); |
|
|
|
$resource_titles[RESOURCE_EVENT] = get_lang('Events'); |
|
|
|
$resource_titles[RESOURCE_ANNOUNCEMENT] = get_lang('Announcements'); |
|
|
|
$resource_titles[RESOURCE_ANNOUNCEMENT] = get_lang('Announcements'); |
|
|
|
$resource_titles[RESOURCE_DOCUMENT] = get_lang('Documents'); |
|
|
|
$resource_titles[RESOURCE_DOCUMENT] = get_lang('Documents'); |
|
|
|
$resource_titles[RESOURCE_LINK] = get_lang('Links'); |
|
|
|
$resource_titles[RESOURCE_LINK] = get_lang('Links'); |
|
|
|
$resource_titles[RESOURCE_COURSEDESCRIPTION] = get_lang('CourseDescription'); |
|
|
|
$resource_titles[RESOURCE_COURSEDESCRIPTION] = get_lang('CourseDescription'); |
|
|
|
$resource_titles[RESOURCE_FORUM] = get_lang('Forums'); |
|
|
|
$resource_titles[RESOURCE_FORUM] = get_lang('Forums'); |
|
|
|
$resource_titles[RESOURCE_FORUMCATEGORY] = get_lang('ForumCategory'); |
|
|
|
$resource_titles[RESOURCE_FORUMCATEGORY] = get_lang('ForumCategory'); |
|
|
|
$resource_titles[RESOURCE_QUIZ] = get_lang('Tests'); |
|
|
|
$resource_titles[RESOURCE_QUIZ] = get_lang('Tests'); |
|
|
|
$resource_titles[RESOURCE_LEARNPATH] = get_lang('Learnpaths'); |
|
|
|
$resource_titles[RESOURCE_LEARNPATH] = get_lang('ToolLearnpath'); |
|
|
|
$resource_titles[RESOURCE_SCORM] = 'SCORM'; |
|
|
|
$resource_titles[RESOURCE_SCORM] = 'SCORM'; |
|
|
|
$resource_titles[RESOURCE_TOOL_INTRO] = get_lang('ToolIntro'); |
|
|
|
$resource_titles[RESOURCE_TOOL_INTRO] = get_lang('ToolIntro'); |
|
|
|
$resource_titles[RESOURCE_SURVEY] = get_lang('Survey'); |
|
|
|
$resource_titles[RESOURCE_SURVEY] = get_lang('Survey'); |
|
|
|
$resource_titles[RESOURCE_GLOSSARY] = get_lang('Glossary'); |
|
|
|
$resource_titles[RESOURCE_GLOSSARY] = get_lang('Glossary'); |
|
|
|
$resource_titles[RESOURCE_WIKI] = get_lang('Wiki'); |
|
|
|
$resource_titles[RESOURCE_WIKI] = get_lang('Wiki'); |
|
|
|
$resource_titles[RESOURCE_THEMATIC] = get_lang('Thematic'); |
|
|
|
$resource_titles[RESOURCE_THEMATIC] = get_lang('Thematic'); |
|
|
|
$resource_titles[RESOURCE_ATTENDANCE] = get_lang('Attendance'); |
|
|
|
$resource_titles[RESOURCE_ATTENDANCE] = get_lang('Attendance'); |
|
|
|
?> |
|
|
|
?> |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
function exp(item) { |
|
|
|
function exp(item) { |
|
|
|
@ -47,13 +47,13 @@ class CourseSelectForm |
|
|
|
document.getElementById('img_'+item).src='../img/0.gif'; |
|
|
|
document.getElementById('img_'+item).src='../img/0.gif'; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function setCheckboxForum(type, value, item_id) { |
|
|
|
function setCheckboxForum(type, value, item_id) { |
|
|
|
d = document.course_select_form; |
|
|
|
d = document.course_select_form; |
|
|
|
for (i = 0; i < d.elements.length; i++) { |
|
|
|
for (i = 0; i < d.elements.length; i++) { |
|
|
|
if (d.elements[i].type == "checkbox") { |
|
|
|
if (d.elements[i].type == "checkbox") { |
|
|
|
var name = d.elements[i].attributes.getNamedItem('name').nodeValue; |
|
|
|
var name = d.elements[i].attributes.getNamedItem('name').nodeValue; |
|
|
|
|
|
|
|
|
|
|
|
if( name.indexOf(type) > 0 || type == 'all' ){ |
|
|
|
if( name.indexOf(type) > 0 || type == 'all' ){ |
|
|
|
if ($(d.elements[i]).attr('rel') == item_id) { |
|
|
|
if ($(d.elements[i]).attr('rel') == item_id) { |
|
|
|
d.elements[i].checked = value; |
|
|
|
d.elements[i].checked = value; |
|
|
|
@ -62,7 +62,7 @@ class CourseSelectForm |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function setCheckbox(type,value) { |
|
|
|
function setCheckbox(type,value) { |
|
|
|
d = document.course_select_form; |
|
|
|
d = document.course_select_form; |
|
|
|
for (i = 0; i < d.elements.length; i++) { |
|
|
|
for (i = 0; i < d.elements.length; i++) { |
|
|
|
@ -74,7 +74,7 @@ class CourseSelectForm |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function checkLearnPath(message){ |
|
|
|
function checkLearnPath(message){ |
|
|
|
d = document.course_select_form; |
|
|
|
d = document.course_select_form; |
|
|
|
for (i = 0; i < d.elements.length; i++) { |
|
|
|
for (i = 0; i < d.elements.length; i++) { |
|
|
|
@ -90,42 +90,42 @@ class CourseSelectForm |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function check_forum(obj) { |
|
|
|
function check_forum(obj) { |
|
|
|
var id = $(obj).attr('rel'); |
|
|
|
var id = $(obj).attr('rel'); |
|
|
|
var my_id = $(obj).attr('my_rel'); |
|
|
|
var my_id = $(obj).attr('my_rel'); |
|
|
|
var checked = false; |
|
|
|
var checked = false; |
|
|
|
if ($('#resource_forum_'+my_id).attr('checked')) { |
|
|
|
if ($('#resource_forum_'+my_id).attr('checked')) { |
|
|
|
checked = true; |
|
|
|
checked = true; |
|
|
|
} |
|
|
|
} |
|
|
|
setCheckboxForum('thread', checked, my_id); |
|
|
|
setCheckboxForum('thread', checked, my_id); |
|
|
|
$('#resource_Forum_Category_'+id).attr('checked','checked'); |
|
|
|
$('#resource_Forum_Category_'+id).attr('checked','checked'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function check_category(obj) { |
|
|
|
function check_category(obj) { |
|
|
|
var my_id = $(obj).attr('my_rel'); |
|
|
|
var my_id = $(obj).attr('my_rel'); |
|
|
|
var checked = false; |
|
|
|
var checked = false; |
|
|
|
if ($('#resource_Forum_Category_'+my_id).attr('checked')) { |
|
|
|
if ($('#resource_Forum_Category_'+my_id).attr('checked')) { |
|
|
|
checked = true; |
|
|
|
checked = true; |
|
|
|
} |
|
|
|
} |
|
|
|
$('.resource_forum').each(function(index, value) { |
|
|
|
$('.resource_forum').each(function(index, value) { |
|
|
|
if ($(value).attr('rel') == my_id) { |
|
|
|
if ($(value).attr('rel') == my_id) { |
|
|
|
$(value).attr('checked', checked); |
|
|
|
$(value).attr('checked', checked); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$('.resource_topic').each(function(index, value) { |
|
|
|
$('.resource_topic').each(function(index, value) { |
|
|
|
if ($(value).attr('cat_id') == my_id) { |
|
|
|
if ($(value).attr('cat_id') == my_id) { |
|
|
|
$(value).attr('checked', checked); |
|
|
|
$(value).attr('checked', checked); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function check_topic(obj) { |
|
|
|
function check_topic(obj) { |
|
|
|
var my_id = $(obj).attr('cat_id'); |
|
|
|
var my_id = $(obj).attr('cat_id'); |
|
|
|
var forum_id = $(obj).attr('forum_id'); |
|
|
|
var forum_id = $(obj).attr('forum_id'); |
|
|
|
$('#resource_Forum_Category_'+my_id).attr('checked','checked'); |
|
|
|
$('#resource_Forum_Category_'+my_id).attr('checked','checked'); |
|
|
|
$('#resource_forum_'+forum_id).attr('checked','checked'); |
|
|
|
$('#resource_forum_'+forum_id).attr('checked','checked'); |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
<?php |
|
|
|
<?php |
|
|
|
@ -153,17 +153,17 @@ class CourseSelectForm |
|
|
|
$forum_categories = array(); |
|
|
|
$forum_categories = array(); |
|
|
|
$forums = array(); |
|
|
|
$forums = array(); |
|
|
|
$forum_topics = array(); |
|
|
|
$forum_topics = array(); |
|
|
|
|
|
|
|
|
|
|
|
echo '<p>'; |
|
|
|
echo '<p>'; |
|
|
|
echo get_lang('SelectResources'); |
|
|
|
echo get_lang('SelectResources'); |
|
|
|
echo '</p>'; |
|
|
|
echo '</p>'; |
|
|
|
|
|
|
|
|
|
|
|
Display::display_normal_message(get_lang('DontForgetToSelectTheMediaFilesIfYourResourceNeedIt')); |
|
|
|
Display::display_normal_message(get_lang('DontForgetToSelectTheMediaFilesIfYourResourceNeedIt')); |
|
|
|
|
|
|
|
|
|
|
|
foreach ($course->resources as $type => $resources) { |
|
|
|
foreach ($course->resources as $type => $resources) { |
|
|
|
if (count($resources) > 0) { |
|
|
|
if (count($resources) > 0) { |
|
|
|
switch ($type) { |
|
|
|
switch ($type) { |
|
|
|
//Resources to avoid |
|
|
|
//Resources to avoid |
|
|
|
case RESOURCE_FORUMCATEGORY : |
|
|
|
case RESOURCE_FORUMCATEGORY : |
|
|
|
foreach ($resources as $id => $resource) { |
|
|
|
foreach ($resources as $id => $resource) { |
|
|
|
$forum_categories[$id] = $resource; |
|
|
|
$forum_categories[$id] = $resource; |
|
|
|
@ -183,7 +183,7 @@ class CourseSelectForm |
|
|
|
$element_count++; |
|
|
|
$element_count++; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case RESOURCE_LINKCATEGORY : |
|
|
|
case RESOURCE_LINKCATEGORY : |
|
|
|
case RESOURCE_FORUMPOST : |
|
|
|
case RESOURCE_FORUMPOST : |
|
|
|
case RESOURCE_QUIZQUESTION: |
|
|
|
case RESOURCE_QUIZQUESTION: |
|
|
|
case RESOURCE_SURVEYQUESTION: |
|
|
|
case RESOURCE_SURVEYQUESTION: |
|
|
|
case RESOURCE_SURVEYINVITATION: |
|
|
|
case RESOURCE_SURVEYINVITATION: |
|
|
|
@ -222,80 +222,60 @@ class CourseSelectForm |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Fixes forum order |
|
|
|
//Fixes forum order |
|
|
|
if (!empty($forum_categories)) { |
|
|
|
if (!empty($forum_categories)) { |
|
|
|
$type = RESOURCE_FORUMCATEGORY; |
|
|
|
$type = RESOURCE_FORUMCATEGORY; |
|
|
|
|
|
|
|
|
|
|
|
echo '<img id="img_'.$type.'" src="../img/1.gif" onclick="javascript:exp('."'$type'".');" /> '; |
|
|
|
echo '<img id="img_'.$type.'" src="../img/1.gif" onclick="javascript:exp('."'$type'".');" /> '; |
|
|
|
echo '<b onclick="javascript:exp('."'$type'".');" >'.$resource_titles[RESOURCE_FORUM].'</b><br />'; |
|
|
|
echo '<b onclick="javascript:exp('."'$type'".');" >'.$resource_titles[RESOURCE_FORUM].'</b><br />'; |
|
|
|
echo '<div id="div_'.$type.'">'; |
|
|
|
echo '<div id="div_'.$type.'">'; |
|
|
|
|
|
|
|
|
|
|
|
//All non categories |
|
|
|
|
|
|
|
/*echo '<div class="btn-group">'; |
|
|
|
|
|
|
|
echo "<a class=\"btn\" href=\"javascript: void(0);\" onclick=\"javascript:setCheckbox('".RESOURCE_FORUMCATEGORY."', true);\" >".get_lang('All')."</a>"; |
|
|
|
|
|
|
|
echo "<a class=\"btn\" href=\"javascript: void(0);\" onclick=\"javascript:setCheckbox('".RESOURCE_FORUMCATEGORY."', false);\" >".get_lang('None')."</a>"; |
|
|
|
|
|
|
|
echo '</div><br />';*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo '<ul>'; |
|
|
|
echo '<ul>'; |
|
|
|
foreach ($forum_categories as $forum_category_id => $forum_category) { |
|
|
|
foreach ($forum_categories as $forum_category_id => $forum_category) { |
|
|
|
echo '<li>'; |
|
|
|
echo '<li>'; |
|
|
|
echo '<label class="checkbox">'; |
|
|
|
echo '<label class="checkbox">'; |
|
|
|
|
|
|
|
|
|
|
|
echo '<input type="checkbox" id="resource_'.RESOURCE_FORUMCATEGORY.'_'.$forum_category_id.'" my_rel="'.$forum_category_id.'" onclick="javascript:check_category(this);" name="resource['.RESOURCE_FORUMCATEGORY.']['.$forum_category_id.']" /> '; |
|
|
|
echo '<input type="checkbox" id="resource_'.RESOURCE_FORUMCATEGORY.'_'.$forum_category_id.'" my_rel="'.$forum_category_id.'" onclick="javascript:check_category(this);" name="resource['.RESOURCE_FORUMCATEGORY.']['.$forum_category_id.']" /> '; |
|
|
|
$forum_category->show(); |
|
|
|
$forum_category->show(); |
|
|
|
echo '</label>'; |
|
|
|
echo '</label>'; |
|
|
|
|
|
|
|
|
|
|
|
if (isset($forums[$forum_category_id]) && count($forums[$forum_category_id]) > 1) { |
|
|
|
|
|
|
|
/*echo '<div class="btn-group">'; |
|
|
|
|
|
|
|
echo "<a class=\"btn\" href=\"javascript: void(0);\" onclick=\"javascript:setCheckboxForum('".RESOURCE_FORUM."',true, '".$forum_category_id."');\" >".get_lang('All')."</a>"; |
|
|
|
|
|
|
|
echo "<a class=\"btn\" href=\"javascript: void(0);\" onclick=\"javascript:setCheckboxForum('".RESOURCE_FORUM."',false, '".$forum_category_id."' );\" >".get_lang('None')."</a>"; |
|
|
|
|
|
|
|
echo '</div>';*/ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
echo '</li>'; |
|
|
|
echo '</li>'; |
|
|
|
|
|
|
|
|
|
|
|
if (isset($forums[$forum_category_id])) { |
|
|
|
if (isset($forums[$forum_category_id])) { |
|
|
|
$my_forums = $forums[$forum_category_id]; |
|
|
|
$my_forums = $forums[$forum_category_id]; |
|
|
|
echo '<ul>'; |
|
|
|
echo '<ul>'; |
|
|
|
foreach ($my_forums as $forum_id => $forum) { |
|
|
|
foreach ($my_forums as $forum_id => $forum) { |
|
|
|
echo '<li>'; |
|
|
|
echo '<li>'; |
|
|
|
echo '<label class="checkbox">'; |
|
|
|
echo '<label class="checkbox">'; |
|
|
|
echo '<input type="checkbox" class="resource_forum" id="resource_'.RESOURCE_FORUM.'_'.$forum_id.'" onclick="javascript:check_forum(this);" my_rel="'.$forum_id.'" rel="'.$forum_category_id.'" name="resource['.RESOURCE_FORUM.']['.$forum_id.']" />'; |
|
|
|
echo '<input type="checkbox" class="resource_forum" id="resource_'.RESOURCE_FORUM.'_'.$forum_id.'" onclick="javascript:check_forum(this);" my_rel="'.$forum_id.'" rel="'.$forum_category_id.'" name="resource['.RESOURCE_FORUM.']['.$forum_id.']" />'; |
|
|
|
$forum->show(); |
|
|
|
$forum->show(); |
|
|
|
echo '</label>'; |
|
|
|
echo '</label>'; |
|
|
|
|
|
|
|
|
|
|
|
if (isset($forum_topics[$forum_id])) { |
|
|
|
|
|
|
|
/*echo '<div class="btn-group">'; |
|
|
|
|
|
|
|
echo "<a class=\"btn\" href=\"javascript: void(0);\" onclick=\"javascript:setCheckboxForum('".RESOURCE_FORUMTOPIC."',true, '".$forum_id."');\" >".get_lang('All')."</a>"; |
|
|
|
|
|
|
|
echo "<a class=\"btn\" href=\"javascript: void(0);\" onclick=\"javascript:setCheckboxForum('".RESOURCE_FORUMTOPIC."',false, '".$forum_id."' );\" >".get_lang('None')."</a>"; |
|
|
|
|
|
|
|
echo '</div>';*/ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo '</li>'; |
|
|
|
echo '</li>'; |
|
|
|
if (isset($forum_topics[$forum_id])) { |
|
|
|
if (isset($forum_topics[$forum_id])) { |
|
|
|
$my_forum_topics = $forum_topics[$forum_id]; |
|
|
|
$my_forum_topics = $forum_topics[$forum_id]; |
|
|
|
|
|
|
|
|
|
|
|
if (!empty($my_forum_topics)) { |
|
|
|
if (!empty($my_forum_topics)) { |
|
|
|
echo '<ul>'; |
|
|
|
echo '<ul>'; |
|
|
|
foreach ($my_forum_topics as $topic_id => $topic) { |
|
|
|
foreach ($my_forum_topics as $topic_id => $topic) { |
|
|
|
echo '<li>'; |
|
|
|
echo '<li>'; |
|
|
|
echo '<label class="checkbox">'; |
|
|
|
echo '<label class="checkbox">'; |
|
|
|
echo '<input type="checkbox" id="resource_'.RESOURCE_FORUMTOPIC.'_'.$topic_id.'" onclick="javascript:check_topic(this);" class="resource_topic" forum_id="'.$forum_id.'" rel="'.$forum_id.'" cat_id="'.$forum_category_id.'" name="resource['.RESOURCE_FORUMTOPIC.']['.$topic_id.']" />'; |
|
|
|
echo '<input type="checkbox" id="resource_'.RESOURCE_FORUMTOPIC.'_'.$topic_id.'" onclick="javascript:check_topic(this);" class="resource_topic" forum_id="'.$forum_id.'" rel="'.$forum_id.'" cat_id="'.$forum_category_id.'" name="resource['.RESOURCE_FORUMTOPIC.']['.$topic_id.']" />'; |
|
|
|
$topic->show(); |
|
|
|
$topic->show(); |
|
|
|
echo '</label>'; |
|
|
|
echo '</label>'; |
|
|
|
echo '</li>'; |
|
|
|
echo '</li>'; |
|
|
|
} |
|
|
|
} |
|
|
|
echo '</ul>'; |
|
|
|
echo '</ul>'; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
echo '</ul>'; |
|
|
|
echo '</ul>'; |
|
|
|
} |
|
|
|
} |
|
|
|
echo '<hr/>'; |
|
|
|
echo '<hr/>'; |
|
|
|
} |
|
|
|
} |
|
|
|
echo '</ul>'; |
|
|
|
echo '</ul>'; |
|
|
|
echo '</div>'; |
|
|
|
echo '</div>'; |
|
|
|
echo '<script language="javascript">exp('."'$type'".')</script>'; |
|
|
|
echo '<script language="javascript">exp('."'$type'".')</script>'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($avoid_serialize) { |
|
|
|
if ($avoid_serialize) { |
|
|
|
@ -326,7 +306,7 @@ class CourseSelectForm |
|
|
|
CourseSelectForm :: display_hidden_quiz_questions($course); |
|
|
|
CourseSelectForm :: display_hidden_quiz_questions($course); |
|
|
|
CourseSelectForm :: display_hidden_scorm_directories($course); |
|
|
|
CourseSelectForm :: display_hidden_scorm_directories($course); |
|
|
|
echo '</form>'; |
|
|
|
echo '</form>'; |
|
|
|
echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>'; |
|
|
|
echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -352,7 +332,7 @@ class CourseSelectForm |
|
|
|
if (count($resources) > 0) { |
|
|
|
if (count($resources) > 0) { |
|
|
|
switch($type) { |
|
|
|
switch($type) { |
|
|
|
case RESOURCE_SCORM: |
|
|
|
case RESOURCE_SCORM: |
|
|
|
foreach ($resources as $id=>$resource) { |
|
|
|
foreach ($resources as $id => $resource) { |
|
|
|
echo '<input type="hidden" name="resource['.RESOURCE_SCORM.']['.$id.']" id="resource['.RESOURCE_SCORM.']['.$id.']" value="On" />'; |
|
|
|
echo '<input type="hidden" name="resource['.RESOURCE_SCORM.']['.$id.']" id="resource['.RESOURCE_SCORM.']['.$id.']" value="On" />'; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
@ -370,13 +350,13 @@ class CourseSelectForm |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
static function get_posted_course($from = '', $session_id = 0, $course_code = '') { |
|
|
|
static function get_posted_course($from = '', $session_id = 0, $course_code = '') { |
|
|
|
$course = null; |
|
|
|
$course = null; |
|
|
|
|
|
|
|
|
|
|
|
if (isset($_POST['course'])) { |
|
|
|
if (isset($_POST['course'])) { |
|
|
|
$course = Course::unserialize(base64_decode($_POST['course'])); |
|
|
|
$course = Course::unserialize(base64_decode($_POST['course'])); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//Create the resource DOCUMENT objects |
|
|
|
//Create the resource DOCUMENT objects |
|
|
|
//Loading the results from the checkboxes of ethe javascript |
|
|
|
//Loading the results from the checkboxes of ethe javascript |
|
|
|
$resource = $_POST['resource'][RESOURCE_DOCUMENT]; |
|
|
|
$resource = $_POST['resource'][RESOURCE_DOCUMENT]; |
|
|
|
@ -388,7 +368,7 @@ class CourseSelectForm |
|
|
|
$course_id = $course_info['real_id']; |
|
|
|
$course_id = $course_info['real_id']; |
|
|
|
|
|
|
|
|
|
|
|
// Searching the documents resource that have been set to null because $avoid_serialize is true in the display_form() function |
|
|
|
// Searching the documents resource that have been set to null because $avoid_serialize is true in the display_form() function |
|
|
|
|
|
|
|
|
|
|
|
if ($from == 'copy_course') { |
|
|
|
if ($from == 'copy_course') { |
|
|
|
if (is_array($resource)) { |
|
|
|
if (is_array($resource)) { |
|
|
|
$resource = array_keys($resource); |
|
|
|
$resource = array_keys($resource); |
|
|
|
@ -426,7 +406,7 @@ class CourseSelectForm |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (is_array($course->resources)) { |
|
|
|
if (is_array($course->resources)) { |
|
|
|
foreach ($course->resources as $type => $resources) { |
|
|
|
foreach ($course->resources as $type => $resources) { |
|
|
|
switch ($type) { |
|
|
|
switch ($type) { |
|
|
|
@ -448,15 +428,15 @@ class CourseSelectForm |
|
|
|
unset($course->resources[RESOURCE_FORUMTOPIC][$thread_id]); |
|
|
|
unset($course->resources[RESOURCE_FORUMTOPIC][$thread_id]); |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
$forum_id = $obj->obj->forum_id; |
|
|
|
$forum_id = $obj->obj->forum_id; |
|
|
|
$title = $obj->obj->thread_title; |
|
|
|
$title = $obj->obj->thread_title; |
|
|
|
foreach ($posts as $post_id => $post) { |
|
|
|
foreach ($posts as $post_id => $post) { |
|
|
|
if ($post->obj->thread_id == $thread_id && $forum_id == $post->obj->forum_id && $title == $post->obj->post_title) { |
|
|
|
if ($post->obj->thread_id == $thread_id && $forum_id == $post->obj->forum_id && $title == $post->obj->post_title) { |
|
|
|
//unset($course->resources[RESOURCE_FORUMPOST][$post_id]); |
|
|
|
//unset($course->resources[RESOURCE_FORUMPOST][$post_id]); |
|
|
|
$posts_to_save[] = $post_id; |
|
|
|
$posts_to_save[] = $post_id; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (!empty($posts)) { |
|
|
|
if (!empty($posts)) { |
|
|
|
foreach ($posts as $post_id => $post) { |
|
|
|
foreach ($posts as $post_id => $post) { |
|
|
|
if (!in_array($post_id, $posts_to_save)) { |
|
|
|
if (!in_array($post_id, $posts_to_save)) { |
|
|
|
@ -467,7 +447,7 @@ class CourseSelectForm |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case RESOURCE_LINKCATEGORY : |
|
|
|
case RESOURCE_LINKCATEGORY : |
|
|
|
case RESOURCE_FORUMCATEGORY : |
|
|
|
case RESOURCE_FORUMCATEGORY : |
|
|
|
case RESOURCE_QUIZQUESTION : |
|
|
|
case RESOURCE_QUIZQUESTION : |
|
|
|
case RESOURCE_DOCUMENT: |
|
|
|
case RESOURCE_DOCUMENT: |
|
|
|
// Mark folders to import which are not selected by the user to import, |
|
|
|
// Mark folders to import which are not selected by the user to import, |
|
|
|
@ -490,6 +470,7 @@ class CourseSelectForm |
|
|
|
if (is_array($resources)) { |
|
|
|
if (is_array($resources)) { |
|
|
|
foreach ($resources as $id => $obj) { |
|
|
|
foreach ($resources as $id => $obj) { |
|
|
|
$resource_is_used_elsewhere = $course->is_linked_resource($obj); |
|
|
|
$resource_is_used_elsewhere = $course->is_linked_resource($obj); |
|
|
|
|
|
|
|
//var_dump($obj, $resource_is_used_elsewhere); |
|
|
|
// check if document is in a quiz (audio/video) |
|
|
|
// check if document is in a quiz (audio/video) |
|
|
|
if ($type == RESOURCE_DOCUMENT && $course->has_resources(RESOURCE_QUIZ)) { |
|
|
|
if ($type == RESOURCE_DOCUMENT && $course->has_resources(RESOURCE_QUIZ)) { |
|
|
|
foreach($course->resources[RESOURCE_QUIZ] as $qid => $quiz) { |
|
|
|
foreach($course->resources[RESOURCE_QUIZ] as $qid => $quiz) { |
|
|
|
@ -505,7 +486,7 @@ class CourseSelectForm |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return $course; |
|
|
|
return $course; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|