Fix paths + add fixes from 1.9.x

1.10.x
jmontoya 10 years ago
parent b65d66ae2e
commit f7511895b3
  1. 5
      main/document/edit_document.php
  2. 2
      main/document/edit_draw.php
  3. 6
      main/document/edit_paint.php
  4. 6
      main/document/showinframes.php
  5. 14
      main/forum/editpost.php
  6. 14
      main/forum/editthread.php
  7. 111
      main/forum/forumfunction.inc.php
  8. 10
      main/forum/forumsearch.php
  9. 21
      main/forum/newthread.php
  10. 16
      main/forum/reply.php
  11. 26
      main/forum/viewthread.php
  12. 62
      main/group/group_space.php
  13. 18
      main/inc/lib/api.lib.php
  14. 18
      main/inc/lib/groupmanager.lib.php

@ -155,7 +155,7 @@ $course_id = api_get_course_int_id();
if (!empty($group_id)) {
$interbreadcrumb[] = array(
'url' => '../group/group_space.php?'.api_get_cidreq(),
'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
'name' => get_lang('GroupSpace'),
);
$group_document = true;
@ -164,14 +164,13 @@ if (!empty($group_id)) {
if (!$is_certificate_mode) {
$interbreadcrumb[] = array(
"url" => "./document.php?curdirpath=".urlencode($currentDirPath).'&'.api_get_cidreq(),
"url" => api_get_path(WEB_CODE_PATH)."document/document.php?curdirpath=".urlencode($currentDirPath).'&'.api_get_cidreq(),
"name" => get_lang('Documents'),
);
} else {
$interbreadcrumb[]= array('url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook'));
}
// Interbreadcrumb for the current directory root path
if (empty($document_data['parents'])) {
$interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']);
} else {

@ -80,7 +80,7 @@ if (!is_dir($filepath)) {
//groups //TODO:clean
if (!empty($group_id)) {
$req_gid = '&gidReq='.$group_id;
$interbreadcrumb[] = array ('url' => '../group/group_space.php?gidReq='.$group_id, 'name' => get_lang('GroupSpace'));
$interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?gidReq='.$group_id, 'name' => get_lang('GroupSpace'));
$group_document = true;
$noPHP_SELF = true;
}

@ -85,12 +85,14 @@ if (!is_dir($filepath)) {
//groups //TODO:clean
if (!empty($groupId)) {
$interbreadcrumb[] = array ('url' => '../group/group_space.php?'.api_get_cidreq(), 'name' => get_lang('GroupSpace'));
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
'name' => get_lang('GroupSpace'),
);
$group_document = true;
$noPHP_SELF = true;
}
$is_certificate_mode = DocumentManager::is_certificate_mode($dir);
if (!$is_certificate_mode)

@ -118,15 +118,15 @@ $current_group_name = $current_group['name'];
if (isset($group_id) && $group_id != '') {
$interbreadcrumb[] = array(
'url' => '../group/group.php?'.api_get_cidreq(),
'url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(),
'name' => get_lang('Groups'),
);
$interbreadcrumb[] = array(
'url' => '../group/group_space.php?'.api_get_cidreq(),
'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
'name' => get_lang('GroupSpace').' '.$current_group_name,
);
$name_to_show = explode('/', $name_to_show);
unset ($name_to_show[1]);
unset($name_to_show[1]);
$name_to_show = implode('/', $name_to_show);
}

@ -75,15 +75,15 @@ if (!empty($gradebook) && $gradebook == 'view') {
if ($origin == 'group') {
$_clean['toolgroup'] = api_get_group_id();
$group_properties = GroupManager::get_group_properties($_clean['toolgroup']);
$interbreadcrumb[] = array('url' => '../group/group.php?'.api_get_cidreq(), 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => '../group/group_space.php?'.api_get_cidreq(), 'name' => get_lang('GroupSpace').' '.$group_properties['name']);
$interbreadcrumb[] = array('url' => 'viewforum.php?origin='.$origin.'&'.api_get_cidreq().'&forum='.intval($_GET['forum']), 'name' => prepare4display($current_forum['forum_title']));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(), 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(), 'name' => get_lang('GroupSpace').' '.$group_properties['name']);
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?origin='.$origin.'&'.api_get_cidreq().'&forum='.intval($_GET['forum']), 'name' => prepare4display($current_forum['forum_title']));
$interbreadcrumb[] = array('url' => 'javascript: void (0);', 'name' => get_lang('EditPost'));
} else {
$interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq(), 'name' => $nameTools);
$interbreadcrumb[] = array('url' => 'viewforumcategory.php?forumcategory='.$current_forum_category['cat_id'], 'name' => prepare4display($current_forum_category['cat_title']));
$interbreadcrumb[] = array('url' => 'viewforum.php?origin='.$origin.'&forum='.intval($_GET['forum']), 'name' => prepare4display($current_forum['forum_title']));
$interbreadcrumb[] = array('url' => 'viewthread.php?'.api_get_cidreq().'&origin='.$origin.'&forum='.intval($_GET['forum']).'&thread='.intval($_GET['thread']), 'name' => prepare4display($current_thread['thread_title']));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq(), 'name' => $nameTools);
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforumcategory.php?forumcategory='.$current_forum_category['cat_id'], 'name' => prepare4display($current_forum_category['cat_title']));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?origin='.$origin.'&forum='.intval($_GET['forum']), 'name' => prepare4display($current_forum['forum_title']));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewthread.php?'.api_get_cidreq().'&origin='.$origin.'&forum='.intval($_GET['forum']).'&thread='.intval($_GET['thread']), 'name' => prepare4display($current_thread['thread_title']));
$interbreadcrumb[] = array('url' => 'javascript: void (0);', 'name' => get_lang('EditPost'));
}

@ -104,14 +104,14 @@ if (api_is_invitee()) {
$groupId = api_get_group_id();
if (!empty($groupId)) {
$groupProperties = GroupManager :: get_group_properties($groupId);
$interbreadcrumb[] = array('url' => '../group/group.php?'.$cidreq, 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => '../group/group_space.php?'.$cidreq, 'name' => get_lang('GroupSpace').' '.$groupProperties['name']);
$interbreadcrumb[] = array('url' => 'viewforum.php?'.$cidreq.'&forum='.intval($_GET['forum']), 'name' => $currentForum['forum_title']);
$interbreadcrumb[] = array('url' => 'newthread.php?'.$cidreq.'&forum='.intval($_GET['forum']),'name' => get_lang('EditThread'));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.$cidreq, 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.$cidreq, 'name' => get_lang('GroupSpace').' '.$groupProperties['name']);
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?'.$cidreq.'&forum='.intval($_GET['forum']), 'name' => $currentForum['forum_title']);
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/newthread.php?'.$cidreq.'&forum='.intval($_GET['forum']),'name' => get_lang('EditThread'));
} else {
$interbreadcrumb[] = array('url' => 'index.php?'.$cidreq, 'name' => $nameTools);
$interbreadcrumb[] = array('url' => 'viewforumcategory.php?'.$cidreq.'&forumcategory='.$currentForumCategory['cat_id'], 'name' => $currentForumCategory['cat_title']);
$interbreadcrumb[] = array('url' => 'viewforum.php?'.$cidreq.'&forum='.intval($_GET['forum']), 'name' => $currentForum['forum_title']);
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/index.php?'.$cidreq, 'name' => $nameTools);
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforumcategory.php?'.$cidreq.'&forumcategory='.$currentForumCategory['cat_id'], 'name' => $currentForumCategory['cat_title']);
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?'.$cidreq.'&forum='.intval($_GET['forum']), 'name' => $currentForum['forum_title']);
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('EditThread'));
}

@ -231,9 +231,7 @@ function show_add_forumcategory_form($inputvalues = array(), $lp_id)
function show_add_forum_form($inputvalues = array(), $lp_id)
{
$_course = api_get_course_info();
$gradebook = Security::remove_XSS($_GET['gradebook']);
// Initialize the object.
$form = new FormValidator('forumcategory', 'post', 'index.php?gradebook='.$gradebook.'&'.api_get_cidreq());
// The header for the form
@ -634,6 +632,7 @@ function store_forum($values, $courseInfo = array(), $returnId = false)
if (!empty($_POST['remove_picture'])) {
delete_forum_image($values['forum_id']);
}
$new_file_name = '';
if (isset($upload_ok)) {
if ($has_attachment) {
@ -641,7 +640,10 @@ function store_forum($values, $courseInfo = array(), $returnId = false)
$sys_course_path = api_get_path(SYS_COURSE_PATH);
$updir = $sys_course_path.$course_dir;
// Try to add an extension to the file if it hasn't one.
$new_file_name = add_ext_on_mime(Database::escape_string($_FILES['picture']['name']), $_FILES['picture']['type']);
$new_file_name = add_ext_on_mime(
Database::escape_string($_FILES['picture']['name']),
$_FILES['picture']['type']
);
if (!filter_extension($new_file_name)) {
//Display :: display_error_message(get_lang('UplUnableToSaveFileFilteredExtension'));
$image_moved = false;
@ -908,10 +910,12 @@ function delete_post($post_id)
if (is_array($last_post_of_thread)) {
// Decreasing the number of replies for this thread and also changing the last post information.
$sql = "UPDATE $table_threads SET thread_replies=thread_replies-1,
$sql = "UPDATE $table_threads
SET
thread_replies=thread_replies-1,
thread_last_post = ".intval($last_post_of_thread['post_id']).",
thread_date='".Database::escape_string($last_post_of_thread['post_date'])."'
WHERE c_id = $course_id AND thread_id = ".intval($_GET['thread'])."";
WHERE c_id = $course_id AND thread_id = ".intval($_GET['thread']);
Database::query($sql);
return 'PostDeleted';
@ -919,7 +923,7 @@ function delete_post($post_id)
if (!$last_post_of_thread) {
// We deleted the very single post of the thread so we need to delete the entry in the thread table also.
$sql = "DELETE FROM $table_threads
WHERE c_id = $course_id AND thread_id = ".intval($_GET['thread'])."";
WHERE c_id = $course_id AND thread_id = ".intval($_GET['thread']);
Database::query($sql);
return 'PostDeletedSpecial';
@ -958,6 +962,8 @@ function check_if_last_post_of_thread($thread_id)
* @param $content what is it that we want to make (in)visible: forum category, forum, thread, post
* @param $id the id of the content we want to make invisible
* @param $current_visibility_status what is the current status of the visibility (0 = invisible, 1 = visible)
* @param array $additional_url_parameters
*
* @return string HTML
*/
function return_visible_invisible_icon($content, $id, $current_visibility_status, $additional_url_parameters = '')
@ -987,6 +993,13 @@ function return_visible_invisible_icon($content, $id, $current_visibility_status
return $html;
}
/**
* @param $content
* @param $id
* @param $current_lock_status
* @param string $additional_url_parameters
* @return string
*/
function return_lock_unlock_icon($content, $id, $current_lock_status, $additional_url_parameters = '')
{
$html = '';
@ -1750,9 +1763,9 @@ function get_threads($forum_id, $course_code = null)
// because we also have thread.* in it. This is because thread has a field locked and post also has the same field
// since we are merging these we would have the post.locked value but in fact we want the thread.locked value
// This is why it is added to the end of the field selection
$groupCondition = api_get_group_id() != 0 ? " AND item_properties.to_group_id = '$groupId' AND item_properties.c_id = '$course_id'" : "";
$groupCondition = api_get_group_id() != 0 ? " AND item_properties.to_group_id = '$groupId' " : "";
$sql = "SELECT
$sql = "SELECT DISTINCT
thread.*,
item_properties.*,
users.firstname,
@ -1775,7 +1788,7 @@ function get_threads($forum_id, $course_code = null)
if (api_is_allowed_to_edit()) {
$sql = "SELECT
$sql = "SELECT DISTINCT
thread.*,
item_properties.*,
users.firstname,
@ -1788,7 +1801,8 @@ function get_threads($forum_id, $course_code = null)
thread.thread_id = item_properties.ref AND
item_properties.c_id = $course_id AND
thread.c_id = $course_id AND
item_properties.tool = '".TABLE_FORUM_THREAD."' $groupCondition
item_properties.tool = '".TABLE_FORUM_THREAD."'
$groupCondition
LEFT JOIN $table_users users
ON thread.thread_poster_id=users.user_id
WHERE
@ -1796,13 +1810,19 @@ function get_threads($forum_id, $course_code = null)
thread.forum_id = ".intval($forum_id)."
ORDER BY thread.thread_sticky DESC, thread.thread_date DESC";
}
$result = Database::query($sql);
$thread_list = array();
$list = array();
$alreadyAdded = array();
while ($row = Database::fetch_array($result, 'ASSOC')) {
$thread_list[] = $row;
if (in_array($row['thread_id'], $alreadyAdded)) {
continue;
}
$list[] = $row;
$alreadyAdded[] = $row['thread_id'];
}
return $thread_list;
return $list;
}
/**
@ -4107,10 +4127,13 @@ function send_mail($user_info = array(), $thread_information = array())
function move_thread_form()
{
$gradebook = Security::remove_XSS($_GET['gradebook']);
// Initialize the object.
$form = new FormValidator('movepost', 'post', api_get_self().'?forum='.Security::remove_XSS($_GET['forum']).'&gradebook='.$gradebook.'&thread='.Security::remove_XSS($_GET['thread']).'&action='.Security::remove_XSS($_GET['action']).'&'.api_get_cidreq());
$form = new FormValidator(
'movepost',
'post',
api_get_self().'?forum='.intval($_GET['forum']).'&gradebook='.$gradebook.'&thread='.intval($_GET['thread']).'&action='.Security::remove_XSS($_GET['action']).'&'.api_get_cidreq()
);
// The header for the form
$form->addElement('header', '', get_lang('MoveThread'));
$form->addElement('header', get_lang('MoveThread'));
// Invisible form: the thread_id
$form->addElement('hidden', 'thread_id', intval($_GET['thread']));
// the fora
@ -4126,8 +4149,10 @@ function move_thread_form()
foreach ($forum_categories as $key => $category) {
$htmlcontent .= '<optgroup label="'.$category['cat_title'].'">';
foreach ($forums as $key => $forum) {
if ($forum['forum_category'] == $category['cat_id']) {
$htmlcontent .= '<option value="'.$forum['forum_id'].'">'.$forum['forum_title'].'</option>';
if (isset($forum['forum_category'])) {
if ($forum['forum_category'] == $category['cat_id']) {
$htmlcontent .= '<option value="'.$forum['forum_id'].'">'.$forum['forum_title'].'</option>';
}
}
}
$htmlcontent .= '</optgroup>';
@ -4328,20 +4353,56 @@ function store_move_post($values)
*/
function store_move_thread($values)
{
$table_threads = Database :: get_course_table(TABLE_FORUM_THREAD);
$table_posts = Database :: get_course_table(TABLE_FORUM_POST);
$table_threads = Database:: get_course_table(TABLE_FORUM_THREAD);
$table_posts = Database:: get_course_table(TABLE_FORUM_POST);
$course_id = api_get_course_int_id();
$courseId = api_get_course_int_id();
$sessionId = api_get_session_id();
$forumId = intval($_POST['forum']);
$threadId = intval($_POST['thread_id']);
$forumInfo = get_forums($forumId);
// Change the thread table: Setting the forum_id to the new forum.
$sql = "UPDATE $table_threads SET forum_id='".Database::escape_string($_POST['forum'])."'
WHERE c_id = $course_id AND thread_id='".Database::escape_string($_POST['thread_id'])."'";
$sql = "UPDATE $table_threads SET forum_id = $forumId
WHERE c_id = $courseId AND thread_id = $threadId";
Database::query($sql);
// Changing all the posts of the thread: setting the forum_id to the new forum.
$sql = "UPDATE $table_posts SET forum_id='".Database::escape_string($_POST['forum'])."'
WHERE c_id = $course_id AND thread_id='".Database::escape_string($_POST['thread_id'])."'";
$sql = "UPDATE $table_posts SET forum_id = $forumId
WHERE c_id = $courseId AND thread_id= $threadId";
Database::query($sql);
// Fix group id, if forum is moved to a different group
if (!empty($forumInfo['to_group_id'])) {
$groupId = $forumInfo['to_group_id'];
$item = api_get_item_property_info($courseId, TABLE_FORUM_THREAD, $threadId, $sessionId, $groupId);
$table = Database:: get_course_table(TABLE_ITEM_PROPERTY);
$sessionCondition = api_get_session_condition($sessionId);
if (!empty($item)) {
if ($item['to_group_id'] != $groupId) {
$sql = "UPDATE $table
SET to_group_id = $groupId
WHERE
tool = '".TABLE_FORUM_THREAD."' AND
c_id = $courseId AND
ref = ".$item['ref']."
$sessionCondition
";
Database::query($sql);
}
} else {
$sql = "UPDATE $table
SET to_group_id = $groupId
WHERE
tool = '".TABLE_FORUM_THREAD."' AND
c_id = $courseId AND
ref = ".$threadId."
$sessionCondition
";
Database::query($sql);
}
}
return get_lang('ThreadMoved');
}

@ -63,12 +63,12 @@ $groupId = api_get_group_id();
if ($origin == 'group') {
$group_properties = GroupManager :: get_group_properties($groupId);
$interbreadcrumb[] = array('url' => '../group/group.php?'.api_get_cidreq(), 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => '../group/group_space.php?'.api_get_cidreq(), 'name' => get_lang('GroupSpace').' ('.$group_properties['name'].')');
$interbreadcrumb[] = array('url' => 'viewforum.php?origin='.$origin.'&forum='.intval($_GET['forum']).'&'.api_get_cidreq(), 'name' => prepare4display($current_forum['forum_title']));
$interbreadcrumb[] = array('url' => 'forumsearch.php?'.api_get_cidreq(),'name' => get_lang('ForumSearch'));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(), 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(), 'name' => get_lang('GroupSpace').' ('.$group_properties['name'].')');
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?origin='.$origin.'&forum='.intval($_GET['forum']).'&'.api_get_cidreq(), 'name' => prepare4display($current_forum['forum_title']));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/forumsearch.php?'.api_get_cidreq(),'name' => get_lang('ForumSearch'));
} else {
$interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq(), 'name' => $nameTools);
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq(), 'name' => $nameTools);
$nameTools = get_lang('ForumSearch');
}

@ -114,19 +114,18 @@ if (api_is_invitee()) {
$groupId = api_get_group_id();
if (!empty($groupId)) {
$groupProperties = GroupManager :: get_group_properties($groupId);
$interbreadcrumb[] = array('url' => '../group/group.php?'.$cidreq, 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => '../group/group_space.php?'.$cidreq, 'name' => get_lang('GroupSpace').' '.$groupProperties['name']);
$interbreadcrumb[] = array('url' => 'viewforum.php?'.$cidreq.'&forum='.intval($_GET['forum']), 'name' => $current_forum['forum_title']);
$interbreadcrumb[] = array('url' => 'newthread.php?'.$cidreq.'&forum='.intval($_GET['forum']),'name' => get_lang('NewTopic'));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.$cidreq, 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.$cidreq, 'name' => get_lang('GroupSpace').' '.$groupProperties['name']);
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?'.$cidreq.'&forum='.intval($_GET['forum']), 'name' => $current_forum['forum_title']);
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/newthread.php?'.$cidreq.'&forum='.intval($_GET['forum']),'name' => get_lang('NewTopic'));
} else {
$interbreadcrumb[] = array('url' => 'index.php?'.$cidreq, 'name' => $nameTools);
$interbreadcrumb[] = array('url' => 'viewforumcategory.php?'.$cidreq.'&forumcategory='.$current_forum_category['cat_id'], 'name' => $current_forum_category['cat_title']);
$interbreadcrumb[] = array('url' => 'viewforum.php?'.$cidreq.'&forum='.intval($_GET['forum']), 'name' => $current_forum['forum_title']);
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/index.php?'.$cidreq, 'name' => $nameTools);
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforumcategory.php?'.$cidreq.'&forumcategory='.$current_forum_category['cat_id'], 'name' => $current_forum_category['cat_title']);
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?'.$cidreq.'&forum='.intval($_GET['forum']), 'name' => $current_forum['forum_title']);
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewTopic'));
}
/* Resource Linker */
if (isset($_POST['add_resources']) AND $_POST['add_resources'] == get_lang('Resources')) {
$_SESSION['formelements'] = $_POST;
$_SESSION['origin'] = $_SERVER['REQUEST_URI'];
@ -135,8 +134,6 @@ if (isset($_POST['add_resources']) AND $_POST['add_resources'] == get_lang('Reso
exit;
}
/* Header */
$htmlHeadXtra[] = <<<JS
<script>
$(document).on('ready', function() {
@ -165,7 +162,7 @@ handle_forum_and_forumcategories();
echo '<div class="actions">';
echo '<span style="float:right;">'.search_link().'</span>';
echo '<a href="viewforum.php?forum='.intval($_GET['forum']).'&'.$cidreq.'">'.
Display::return_icon('back.png',get_lang('BackToForum'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('back.png', get_lang('BackToForum'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
// Set forum attachment data into $_SESSION
@ -183,7 +180,7 @@ if (!empty($values) && isset($values['SubmitPost'])) {
store_thread($current_forum, $values);
}
if ($origin == 'learnpath') {
if (isset($origin) && $origin == 'learnpath') {
Display::display_reduced_footer();
} else {
Display::display_footer();

@ -95,19 +95,19 @@ if ($origin == 'group') {
$_clean['toolgroup'] = api_get_group_id();
$group_properties = GroupManager :: get_group_properties($_clean['toolgroup']);
$interbreadcrumb[] = array(
'url' => '../group/group.php?'.api_get_cidreq(),
'url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(),
'name' => get_lang('Groups'),
);
$interbreadcrumb[] = array(
'url' => '../group/group_space.php?'.api_get_cidreq(),
'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(),
'name' => get_lang('GroupSpace').' '.$group_properties['name'],
);
$interbreadcrumb[] = array(
'url' => 'viewforum.php?origin='.$origin.'&forum='.intval($_GET['forum']).'&'.api_get_cidreq(),
'url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?origin='.$origin.'&forum='.intval($_GET['forum']).'&'.api_get_cidreq(),
'name' => $current_forum['forum_title'],
);
$interbreadcrumb[] = array(
'url' => 'viewthread.php?origin='.$origin.'&gradebook='.$gradebook.'&forum='.intval($_GET['forum']).'&thread='.intval($_GET['thread']).'&'.api_get_cidreq(),
'url' => api_get_path(WEB_CODE_PATH).'forum/viewthread.php?origin='.$origin.'&gradebook='.$gradebook.'&forum='.intval($_GET['forum']).'&thread='.intval($_GET['thread']).'&'.api_get_cidreq(),
'name' => $current_thread['thread_title'],
);
$interbreadcrumb[] = array(
@ -120,22 +120,21 @@ if ($origin == 'group') {
'name' => $nameTools,
);
$interbreadcrumb[] = array(
'url' => 'viewforumcategory.php?forumcategory='.$current_forum_category['cat_id'].'&'.api_get_cidreq(),
'url' => api_get_path(WEB_CODE_PATH).'forum/viewforumcategory.php?forumcategory='.$current_forum_category['cat_id'].'&'.api_get_cidreq(),
'name' => $current_forum_category['cat_title'],
);
$interbreadcrumb[] = array(
'url' => 'viewforum.php?origin='.$origin.'&forum='.intval($_GET['forum']).'&'.api_get_cidreq(),
'url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?origin='.$origin.'&forum='.intval($_GET['forum']).'&'.api_get_cidreq(),
'name' => $current_forum['forum_title'],
);
$interbreadcrumb[] = array(
'url' => 'viewthread.php?origin='.$origin.'&gradebook='.$gradebook.'&forum='.intval($_GET['forum']).'&thread='.intval($_GET['thread']).'&'.api_get_cidreq(),
'url' => api_get_path(WEB_CODE_PATH).'forum/viewthread.php?origin='.$origin.'&gradebook='.$gradebook.'&forum='.intval($_GET['forum']).'&thread='.intval($_GET['thread']).'&'.api_get_cidreq(),
'name' => $current_thread['thread_title'],
);
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Reply'));
}
/* Resource Linker */
if (isset($_POST['add_resources']) && $_POST['add_resources'] == get_lang('Resources')) {
$_SESSION['formelements'] = $_POST;
$_SESSION['origin'] = $_SERVER['REQUEST_URI'];
@ -145,7 +144,6 @@ if (isset($_POST['add_resources']) && $_POST['add_resources'] == get_lang('Resou
}
/* Header */
$htmlHeadXtra[] = <<<JS
<script>
$(document).on('ready', function() {

@ -61,16 +61,15 @@ $sessionId = api_get_session_id();
if ($origin == 'group') {
$group_properties = GroupManager::get_group_properties($groupId);
$interbreadcrumb[] = array(
'url' => '../group/group.php',
'url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(),
'name' => get_lang('Groups')
);
$interbreadcrumb[] = array(
'url' => '../group/group_space.php?' . api_get_cidreq(),
'url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?' . api_get_cidreq(),
'name' => get_lang('GroupSpace') . ' ' . $group_properties['name']
);
$interbreadcrumb[] = array(
'url' => 'viewforum.php?forum=' . intval($_GET['forum']) . '&' . api_get_cidreq()
. "&origin=$origin&search=" . Security::remove_XSS(urlencode($my_search)),
'url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?forum='.intval($_GET['forum']).'&'.api_get_cidreq(). "&origin=$origin&search=" . Security::remove_XSS(urlencode($my_search)),
'name' => Security::remove_XSS($current_forum['forum_title'])
);
$interbreadcrumb[] = array(
@ -85,20 +84,20 @@ if ($origin == 'group') {
Display::display_reduced_header();
} else {
$interbreadcrumb[] = array(
'url' => 'index.php?'
'url' => api_get_path(WEB_CODE_PATH).'forum/index.php?'
. (isset($gradebook) ? "gradebook=$gradebook&" : '')
. 'search=' . Security::remove_XSS(urlencode($my_search)),
'name' => $nameTools
);
$interbreadcrumb[] = array(
'url' => 'viewforumcategory.php?forumcategory='
'url' => api_get_path(WEB_CODE_PATH).'forum/viewforumcategory.php?forumcategory='
. $current_forum_category['cat_id']
. "&origin=$origin&search="
. Security::remove_XSS(urlencode($my_search)),
'name' => Security::remove_XSS($current_forum_category['cat_title'])
);
$interbreadcrumb[] = array(
'url' => 'viewforum.php?forum=' . intval($_GET['forum'])
'url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?forum=' . intval($_GET['forum'])
. "&origin=$origin&search="
. Security::remove_XSS(urlencode($my_search)),
'name' => Security::remove_XSS($current_forum['forum_title'])
@ -152,7 +151,6 @@ if ($my_action == 'move' && isset($_GET['post'])) {
}
/* Display the action messages */
$my_message = isset($message) ? $message : '';
if ($my_message) {
Display::display_confirmation_message(get_lang($my_message));
@ -164,7 +162,6 @@ if ($my_message != 'PostDeletedSpecial') {
increase_thread_view($_GET['thread']);
/* Action Links */
if ($origin == 'learnpath') {
echo '<div style="height:15px">&nbsp;</div>';
}
@ -186,7 +183,7 @@ if ($my_message != 'PostDeletedSpecial') {
api_is_allowed_to_edit(false, true)
) {
// The link should only appear when the user is logged in or when anonymous posts are allowed.
if ($_user['user_id'] OR ($current_forum['allow_anonymous'] == 1 && !$_user['user_id'])) {
if ($_user['user_id'] || ($current_forum['allow_anonymous'] == 1 && !$_user['user_id'])) {
// reply link
if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) {
echo '<a href="' . $forumUrl . 'reply.php?' . api_get_cidreq() . '&forum='
@ -204,7 +201,7 @@ if ($my_message != 'PostDeletedSpecial') {
($current_forum['allow_new_threads'] == 1 && isset($_user['user_id'])) ||
($current_forum['allow_new_threads'] == 1 && !isset($_user['user_id']) && $current_forum['allow_anonymous'] == 1)
) {
if ($current_forum['locked'] <> 1 AND $current_forum['locked'] <> 1) {
if ($current_forum['locked'] <> 1 && $current_forum['locked'] <> 1) {
echo '&nbsp;&nbsp;';
} else {
echo get_lang('ForumLocked');
@ -230,8 +227,7 @@ if ($my_message != 'PostDeletedSpecial') {
echo '</div>&nbsp;';
/* Display Forum Category and the Forum information */
if (!isset($_SESSION['view'])) {
if (!isset($_SESSION['view'])) {
$viewMode = $current_forum['default_view'];
} else {
$viewMode = $_SESSION['view'];
@ -247,7 +243,7 @@ if ($my_message != 'PostDeletedSpecial') {
}
if (isset($_GET['msg']) && isset($_GET['type'])) {
switch($_GET['type']) {
switch ($_GET['type']) {
case 'error':
Display::display_error_message($_GET['msg']);
break;
@ -257,7 +253,7 @@ if ($my_message != 'PostDeletedSpecial') {
}
}
if ($current_thread['thread_peer_qualify'] == 1 ) {
if ($current_thread['thread_peer_qualify'] == 1) {
echo Display::return_message(get_lang('ForumThreadPeerScoringStudentComment'), 'info');
}

@ -122,10 +122,8 @@ if (api_is_allowed_to_edit(false, true) ||
$forums_of_groups = get_forums_of_group($current_group['id']);
if (is_array($forums_of_groups)) {
if ($current_group['forum_state'] != GroupManager::TOOL_NOT_AVAILABLE ) {
if ($current_group['forum_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
foreach ($forums_of_groups as $key => $value) {
//*!empty($user_subscribe_to_current_group) && */
if ($value['forum_group_public_private'] == 'public' ||
($value['forum_group_public_private'] == 'private') ||
!empty($user_is_tutor) ||
@ -133,17 +131,23 @@ if (api_is_allowed_to_edit(false, true) ||
) {
$actions_array[] = array(
'url' => '../forum/viewforum.php?forum='.$value['forum_id'].'&'.api_get_cidreq().'&origin=group',
'content' => Display::return_icon('forum.png', get_lang('Forum').': '.$value['forum_title'] , array(), 32)
'url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?forum='.$value['forum_id'].'&'.api_get_cidreq().'&origin=group',
'content' => Display::return_icon(
'forum.png',
get_lang('Forum').': '.$value['forum_title'],
array(),
32
),
);
}
}
}
}
if ($current_group['doc_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
// Link to the documents area of this group
$actions_array[] = array(
'url' => '../document/document.php?'.api_get_cidreq(),
'url' => api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq(),
'content' => Display::return_icon('folder.png', get_lang('GroupDocument'), array(), 32)
);
}
@ -155,14 +159,14 @@ if (api_is_allowed_to_edit(false, true) ||
}
// Link to a group-specific part of agenda
$actions_array[] = array(
'url' => '../calendar/agenda_js.php?'.api_get_cidreq().$groupFilter,
'url' => api_get_path(WEB_CODE_PATH).'calendar/agenda_js.php?'.api_get_cidreq().$groupFilter,
'content' => Display::return_icon('agenda.png', get_lang('GroupCalendar'), array(), 32)
);
}
if ($current_group['work_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
// Link to the works area of this group
$actions_array[] = array(
'url' => '../work/work.php?'.api_get_cidreq(),
'url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(),
'content' => Display::return_icon('work.png', get_lang('GroupWork'), array(), 32)
);
@ -170,7 +174,7 @@ if (api_is_allowed_to_edit(false, true) ||
if ($current_group['announcements_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
// Link to a group-specific part of announcements
$actions_array[] = array(
'url' => '../announcements/announcements.php?'.api_get_cidreq(),
'url' => api_get_path(WEB_CODE_PATH).'announcements/announcements.php?'.api_get_cidreq(),
'content' => Display::return_icon('announce.png', get_lang('GroupAnnouncements'), array(), 32)
);
}
@ -178,7 +182,7 @@ if (api_is_allowed_to_edit(false, true) ||
if ($current_group['wiki_state'] != GroupManager::TOOL_NOT_AVAILABLE) {
// Link to the wiki area of this group
$actions_array[] = array(
'url' => '../wiki/index.php?'.api_get_cidreq().'&action=show&title=index&session_id='.api_get_session_id().'&group_id='.$current_group['id'],
'url' => api_get_path(WEB_CODE_PATH).'wiki/index.php?'.api_get_cidreq().'&action=show&title=index&session_id='.api_get_session_id().'&group_id='.$current_group['id'],
'content' => Display::return_icon('wiki.png', get_lang('GroupWiki'), array(), 32)
);
}
@ -195,7 +199,7 @@ if (api_is_allowed_to_edit(false, true) ||
);
} else {
$actions_array[] = array(
'url' => "../chat/chat.php?".api_get_cidreq()."&toolgroup=".$current_group['id'],
'url' => api_get_path(WEB_CODE_PATH)."chat/chat.php?".api_get_cidreq()."&toolgroup=".$current_group['id'],
'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32)
);
}
@ -212,11 +216,11 @@ if (api_is_allowed_to_edit(false, true) ||
$forums_of_groups = get_forums_of_group($current_group['id']);
if (is_array($forums_of_groups)) {
if ( $current_group['forum_state'] == GroupManager::TOOL_PUBLIC ) {
if ( $current_group['forum_state'] == GroupManager::TOOL_PUBLIC) {
foreach ($forums_of_groups as $key => $value) {
if ($value['forum_group_public_private'] == 'public' ) {
if ($value['forum_group_public_private'] == 'public') {
$actions_array[] = array(
'url' => '../forum/viewforum.php?cidReq='.api_get_course_id().'&forum='.$value['forum_id'].'&gidReq='.Security::remove_XSS($current_group['id']).'&origin=group',
'url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?cidReq='.api_get_course_id().'&forum='.$value['forum_id'].'&gidReq='.Security::remove_XSS($current_group['id']).'&origin=group',
'content' => Display::return_icon('forum.png', get_lang('GroupForum'), array(), ICON_SIZE_MEDIUM)
);
}
@ -227,7 +231,7 @@ if (api_is_allowed_to_edit(false, true) ||
if ($current_group['doc_state'] == GroupManager::TOOL_PUBLIC) {
// Link to the documents area of this group
$actions_array[] = array(
'url' => '../document/document.php?'.api_get_cidreq(),
'url' => api_get_path(WEB_CODE_PATH).'document/document.php?'.api_get_cidreq(),
'content' => Display::return_icon('folder.png', get_lang('GroupDocument'), array(), ICON_SIZE_MEDIUM)
);
}
@ -235,7 +239,7 @@ if (api_is_allowed_to_edit(false, true) ||
if ($current_group['calendar_state'] == GroupManager::TOOL_PUBLIC) {
// Link to a group-specific part of agenda
$actions_array[] = array(
'url' => '../calendar/agenda.php?'.api_get_cidreq(),
'url' => api_get_path(WEB_CODE_PATH).'calendar/agenda.php?'.api_get_cidreq(),
'content' => Display::return_icon('agenda.png', get_lang('GroupCalendar'), array(), ICON_SIZE_MEDIUM)
);
@ -244,7 +248,7 @@ if (api_is_allowed_to_edit(false, true) ||
if ($current_group['work_state'] == GroupManager::TOOL_PUBLIC) {
// Link to the works area of this group
$actions_array[] = array(
'url' => '../work/work.php?'.api_get_cidreq(),
'url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(),
'content' => Display::return_icon('work.png', get_lang('GroupWork'), array(), ICON_SIZE_MEDIUM)
);
}
@ -252,7 +256,7 @@ if (api_is_allowed_to_edit(false, true) ||
if ($current_group['announcements_state'] == GroupManager::TOOL_PUBLIC) {
// Link to a group-specific part of announcements
$actions_array[] = array(
'url' => '../announcements/announcements.php?'.api_get_cidreq(),
'url' => api_get_path(WEB_CODE_PATH).'announcements/announcements.php?'.api_get_cidreq(),
'content' => Display::return_icon('announce.png', get_lang('GroupAnnouncements'), array(), ICON_SIZE_MEDIUM)
);
}
@ -260,12 +264,12 @@ if (api_is_allowed_to_edit(false, true) ||
if ($current_group['wiki_state'] == GroupManager::TOOL_PUBLIC) {
// Link to the wiki area of this group
$actions_array[] = array(
'url' => '../wiki/index.php?'.api_get_cidreq().'&action=show&title=index&session_id='.api_get_session_id().'&group_id='.$current_group['id'],
'url' => api_get_path(WEB_CODE_PATH).'wiki/index.php?'.api_get_cidreq().'&action=show&title=index&session_id='.api_get_session_id().'&group_id='.$current_group['id'],
'content' => Display::return_icon('wiki.png', get_lang('GroupWiki'), array(), 32)
);
}
if ($current_group['chat_state'] == GroupManager::TOOL_PUBLIC ) {
if ($current_group['chat_state'] == GroupManager::TOOL_PUBLIC) {
// Link to the chat area of this group
if (api_get_course_setting('allow_open_chat_window')) {
$actions_array[] = array(
@ -274,7 +278,7 @@ if (api_is_allowed_to_edit(false, true) ||
);
} else {
$actions_array[] = array(
'url' => "../chat/chat.php?".api_get_cidreq()."&toolgroup=".$current_group['id'],
'url' => api_get_path(WEB_CODE_PATH)."chat/chat.php?".api_get_cidreq()."&toolgroup=".$current_group['id'],
'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32)
);
}
@ -322,7 +326,12 @@ echo '<br />';
*/
echo Display::page_subheader(get_lang('GroupMembers'));
$table = new SortableTable('group_users', 'get_number_of_group_users', 'get_group_user_data', (api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1);
$table = new SortableTable(
'group_users',
'get_number_of_group_users',
'get_group_user_data',
(api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1
);
$my_cidreq = isset($_GET['cidReq']) ? Security::remove_XSS($_GET['cidReq']) : '';
$my_origin = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : '';
$my_gidreq = isset($_GET['gidReq']) ? Security::remove_XSS($_GET['gidReq']) : '';
@ -366,14 +375,15 @@ function get_number_of_group_users()
$course_id = api_get_course_int_id();
// Database table definition
$table_group_user = Database :: get_course_table(TABLE_GROUP_USER);
$table = Database :: get_course_table(TABLE_GROUP_USER);
// Query
$sql = "SELECT count(iid) AS number_of_users
FROM ".$table_group_user."
WHERE c_id = $course_id AND group_id='".Database::escape_string($current_group['id'])."'";
FROM ".$table."
WHERE c_id = $course_id AND group_id='".intval($current_group['id'])."'";
$result = Database::query($sql);
$return = Database::fetch_array($result,'ASSOC');
$return = Database::fetch_array($result, 'ASSOC');
return $return['number_of_users'];
}

@ -4100,13 +4100,15 @@ function api_get_track_item_property_history($tool, $ref)
/**
* Gets item property data from tool of a course id
* @param int course id
* @param string tool name, linked to 'rubrique' of the course tool_list (Warning: language sensitive !!)
* @param int id of the item itself, linked to key of every tool ('id', ...), "*" = all items of the tool
* @param int $course_id
* @param string $tool tool name, linked to 'rubrique' of the course tool_list (Warning: language sensitive !!)
* @param int $ref id of the item itself, linked to key of every tool ('id', ...), "*" = all items of the tool
* @param int $session_id
* @param int $groupId
*
* @return array Array with all fields from c_item_property, empty array if not found or false if course could not be found
*/
function api_get_item_property_info($course_id, $tool, $ref, $session_id = 0)
function api_get_item_property_info($course_id, $tool, $ref, $session_id = 0, $groupId = 0)
{
$courseInfo = api_get_course_info_by_id($course_id);
@ -4134,6 +4136,11 @@ function api_get_item_property_info($course_id, $tool, $ref, $session_id = 0)
ref = $ref AND
$sessionCondition ";
if (!empty($groupId)) {
$groupId = intval($groupId);
$sql .= " AND to_group_id = $groupId ";
}
$rs = Database::query($sql);
$row = array();
if (Database::num_rows($rs) > 0) {
@ -4151,7 +4158,8 @@ function api_get_item_property_info($course_id, $tool, $ref, $session_id = 0)
* @return string
*/
function api_get_languages_combo($name = 'language') {
function api_get_languages_combo($name = 'language')
{
$ret = '';
$platformLanguage = api_get_setting('platformLanguage');

@ -252,14 +252,18 @@ class GroupManager
require_once api_get_path(SYS_CODE_PATH).'forum/forumfunction.inc.php';
$forum_categories = get_forum_categories();
if (empty($forum_categories)) {
$categoryParam = array(
'forum_category_title' => get_lang('GroupForums'),
);
store_forumcategory($categoryParam);
$values = array();
$values['forum_title'] = $name;
$values['group_id'] = $lastId;
$forum_categories = get_forum_categories();
}
$counter = 0;
foreach ($forum_categories as $key=>$value) {
if ($counter==0) {
foreach ($forum_categories as $key => $value) {
if ($counter == 0) {
$forum_category_id = $key;
}
$counter++;
@ -268,6 +272,10 @@ class GroupManager
if (empty($forum_category_id)) {
$forum_category_id = 0;
}
$values = array();
$values['forum_title'] = $name;
$values['group_id'] = $lastId;
$values['forum_category'] = $forum_category_id;
$values['allow_anonymous_group']['allow_anonymous'] = 0;
$values['students_can_edit_group']['students_can_edit'] = 0;

Loading…
Cancel
Save