Forum: Fix SQL queries with c_id + convert all icons to MDI

pull/5012/head
Yannick Warnier 12 months ago
parent 86faf1ecfd
commit c16fc5fb10
  1. 24
      public/main/forum/editpost.php
  2. 6
      public/main/forum/editthread.php
  3. 60
      public/main/forum/forumfunction.inc.php
  4. 4
      public/main/forum/forumqualify.php
  5. 42
      public/main/forum/index.php
  6. 3
      public/main/forum/newthread.php
  7. 10
      public/main/forum/reply.php
  8. 48
      public/main/forum/viewforum.php
  9. 48
      public/main/forum/viewforumcategory.php
  10. 22
      public/main/forum/viewthread.php

@ -6,6 +6,7 @@ use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CForum;
use Chamilo\CourseBundle\Entity\CForumPost;
use Chamilo\CourseBundle\Entity\CForumThread;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
/**
* These files are a complete rework of the forum. The database structure is
@ -194,7 +195,7 @@ $htmlHeadXtra[] = <<<JS
name: 'user_upload[]'
});
$('[name="user_upload[]"]').parent().append(newInputFile);
});
})
});
</script>
JS;
@ -248,30 +249,15 @@ if ('learnpath' !== $origin) {
//$actions .= '<span style="float:right;">'.search_link().'</span>';
if ('group' === $origin) {
$actions .= '<a href="../group/group_space.php?'.api_get_cidreq().'">'.
Display::return_icon(
'back.png',
get_lang('Back to').' '.get_lang('Groups'),
'',
ICON_SIZE_MEDIUM
).
Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Back to').' '.get_lang('Groups')).
'</a>';
} else {
$actions .= '<a href="index.php?'.api_get_cidreq().'">'.
Display::return_icon(
'back.png',
get_lang('Back toForumOverview'),
'',
ICON_SIZE_MEDIUM
).
Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Back toForumOverview')).
'</a>';
}
$actions .= '<a href="viewforum.php?forum='.$forumId.'&'.api_get_cidreq().'">'.
Display::return_icon(
'forum.png',
get_lang('Back toForum'),
'',
ICON_SIZE_MEDIUM
).
Display::getMdiIcon('comment-quote', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Back toForum')).
'</a>';
echo Display::toolbarAction('toolbar', [$actions]);
}

@ -4,6 +4,8 @@
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CForum;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
/**
* Edit a Forum Thread.
@ -200,7 +202,7 @@ $htmlHeadXtra[] = <<<JS
$("[name='weight_calification']").val(0);
$("[name='thread_peer_qualify'][value='0']").prop('checked', true);
}
});
})
});
</script>
JS;
@ -208,7 +210,7 @@ JS;
// Action links
$actions = [
Display::url(
Display::return_icon('back.png', get_lang('Back to forum'), '', ICON_SIZE_MEDIUM),
Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Back to forum')),
'viewforum.php?forum='.$forumId.'&'.$cidreq
),
search_link(),

@ -19,6 +19,8 @@ use Chamilo\CourseBundle\Entity\CLpItem;
use ChamiloSession as Session;
use Doctrine\Common\Collections\Criteria;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
/**
* @todo convert this library into a class
@ -918,7 +920,7 @@ function returnVisibleInvisibleIcon(
}
}
$html .= 'action=invisible&content='.$content.'&id='.$id.'">'.
Display::return_icon('visible.png', get_lang('MakeInvisible'), [], ICON_SIZE_SMALL).'</a>';
Display::getMdiIcon(ActionIcon::VISIBLE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('MakeInvisible')).'</a>';
}
if (0 == $current_visibility_status) {
$html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&';
@ -928,7 +930,7 @@ function returnVisibleInvisibleIcon(
}
}
$html .= 'action=visible&content='.$content.'&id='.$id.'">'.
Display::return_icon('invisible.png', get_lang('Make Visible'), [], ICON_SIZE_SMALL).'</a>';
Display::getMdiIcon(ActionIcon::INVISIBLE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Make Visible')).'</a>';
}
return $html;
@ -952,13 +954,14 @@ function returnLockUnlockIcon(
//check if the forum is blocked due
if ('thread' === $content) {
if (api_resource_is_locked_by_gradebook($id, LINK_FORUM_THREAD)) {
return $html.Display::return_icon(
'lock_na.png',
return $html.Display::getMdiIcon(
ActionIcon::LOCK,
'ch-tool-icon-disabled',
'',
ICON_SIZE_SMALL,
get_lang(
'This option is not available because this activity is contained by an assessment, which is currently locked. To unlock the assessment, ask your platform administrator.'
),
[],
ICON_SIZE_SMALL
)
);
}
}
@ -970,7 +973,7 @@ function returnLockUnlockIcon(
}
}
$html .= 'action=unlock&content='.$content.'&id='.$id.'">'.
Display::return_icon('lock.png', get_lang('Unlock'), [], ICON_SIZE_SMALL).'</a>';
Display::getMdiIcon(ActionIcon::LOCK, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Unlock')).'</a>';
}
if ('0' == $current_lock_status) {
$html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&';
@ -980,7 +983,7 @@ function returnLockUnlockIcon(
}
}
$html .= 'action=lock&content='.$content.'&id='.$id.'">'.
Display::return_icon('unlock.png', get_lang('Lock'), [], ICON_SIZE_SMALL).'</a>';
Display::getMdiIcon(ActionIcon::UNLOCK, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Lock')).'</a>';
}
return $html;
@ -1017,10 +1020,10 @@ function returnUpDownIcon(string $content, int $id, array $list): string
$return_value = '<a
href="'.api_get_self().'?'.api_get_cidreq().'&action=move&direction=up&content='.$content.'&forumcategory='.$forumCategory.'&id='.$id.'"
title="'.get_lang('Move up').'">'.
Display::return_icon('up.png', get_lang('Move up'), [], ICON_SIZE_SMALL).'</a>';
Display::getMdiIcon(ActionIcon::UP, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Move up')).'</a>';
} else {
$return_value = Display::url(
Display::return_icon('up_na.png', '-', [], ICON_SIZE_SMALL),
Display::getMdiIcon(ActionIcon::UP, 'ch-tool-icon-disabled', null, ICON_SIZE_SMALL, ''),
'javascript:void(0)'
);
}
@ -1029,10 +1032,10 @@ function returnUpDownIcon(string $content, int $id, array $list): string
$return_value .= '<a
href="'.api_get_self().'?'.api_get_cidreq().'&action=move&direction=down&content='.$content.'&forumcategory='.$forumCategory.'&id='.$id.'"
title="'.get_lang('Move down').'" >'.
Display::return_icon('down.png', get_lang('Move down'), [], ICON_SIZE_SMALL).'</a>';
Display::getMdiIcon(ActionIcon::DOWN, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Move down')).'</a>';
} else {
$return_value = Display::url(
Display::return_icon('down_na.png', '-', [], ICON_SIZE_SMALL),
Display::getMdiIcon(ActionIcon::DOWN, 'ch-tool-icon-disabled', null, ICON_SIZE_SMALL, ''),
'javascript:void(0)'
);
}
@ -1483,7 +1486,6 @@ function get_thread_users_details(int $thread_id)
AND course_user.relation_type <> ".COURSE_RELATION_TYPE_RRHH."
AND p.thread_id = $thread_id
AND course_user.status != '1' AND
p.c_id = $course_id AND
course_user.c_id = $course_id $orderby";
}
@ -3381,7 +3383,6 @@ function handle_mail_cue($content, $id)
$sql = "SELECT users.firstname, users.lastname, users.id as user_id, users.email, posts.forum_id
FROM $table_mailcue mailcue, $table_posts posts, $table_users users
WHERE
posts.c_id = $course_id AND
mailcue.c_id = $course_id AND
posts.thread_id = $id AND
posts.post_notification = '1' AND
@ -4000,7 +4001,7 @@ function search_link()
$origin = api_get_origin();
if ('learnpath' != $origin) {
$return = '<a href="forumsearch.php?'.api_get_cidreq().'&action=search"> ';
$return .= Display::return_icon('search.png', get_lang('Search'), '', ICON_SIZE_MEDIUM).'</a>';
$return .= Display::getMdiIcon('magnify-plus-outline ', 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Search')).'</a>';
if (!empty($_GET['search'])) {
$return .= ': '.Security::remove_XSS($_GET['search']).' ';
@ -4012,7 +4013,7 @@ function search_link()
}
}
$url .= implode('&', $url_parameter);
$return .= '<a href="'.$url.'">'.Display::return_icon('delete.gif', get_lang('Clean search results')).'</a>';
$return .= '<a href="'.$url.'">'.Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon', '', ICON_SIZE_SMALL, get_lang('Clean search results')).'</a>';
}
}
@ -4638,20 +4639,20 @@ function get_thread_user_post(Course $course, $thread_id, $user_id)
/**
* This function get the name of an thread by id.
*
* @param int $thread_id
* @param int $threadId
*
* @return string
*
* @author Christian Fasanando
* @author Julio Montoya <gugli100@gmail.com> Adding security
*/
function get_name_thread_by_id($thread_id)
function get_name_thread_by_id(int $threadId): string
{
$t_forum_thread = Database::get_course_table(TABLE_FORUM_THREAD);
$tForumThread = Database::get_course_table(TABLE_FORUM_THREAD);
$course_id = api_get_course_int_id();
$sql = "SELECT thread_title
FROM $t_forum_thread
WHERE c_id = $course_id AND iid = '".(int) $thread_id."' ";
FROM $tForumThread
WHERE iid = $threadId";
$result = Database::query($sql);
$row = Database::fetch_array($result);
@ -4700,12 +4701,7 @@ function get_all_post_from_user(int $user_id, int $courseId): string
$post_counter = count($post_list);
if (is_array($post_list) && count($post_list) > 0) {
$hand_forums .= '<div id="social-thread">';
$hand_forums .= Display::return_icon(
'thread.png',
get_lang('Thread'),
'',
ICON_SIZE_MEDIUM
);
$hand_forums .= Display::getMdiIcon('format-quote-open', 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Thread'));
$hand_forums .= '&nbsp;'.Security::remove_XSS($thread->getThreadTitle(), STUDENT);
$hand_forums .= '</div>';
@ -4724,7 +4720,7 @@ function get_all_post_from_user(int $user_id, int $courseId): string
$forum_results .= '<div id="social-forum">';
$forum_results .= '<div class="clear"></div><br />';
$forum_results .= '<div id="social-forum-title">'.
Display::return_icon('forum.gif', get_lang('Forum')).'&nbsp;'.Security::remove_XSS($forum->getForumTitle(), STUDENT).
Display::getMdiIcon('comment-quote', 'ch-tool-icon', '', ICON_SIZE_SMALL, get_lang('Forum')).'&nbsp;'.Security::remove_XSS($forum->getForumTitle(), STUDENT).
'<div style="float:right;margin-top:-35px">
<a href="../forum/viewforum.php?'.api_get_cidreq_params($courseId).'&forum='.$forum->getIid().' " >'.
get_lang('See forum').'
@ -5061,16 +5057,16 @@ function getAttachedFiles(
// Check if $row is consistent
if ($attachment) {
// Set result as success and bring delete URL
$json['result'] = Display::return_icon('accept.png', get_lang('Uploaded.'));
$json['result'] = Display::getMdiIcon('check-circle', 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Uploaded.'));
$url = api_get_path(WEB_CODE_PATH).'forum/viewthread.php?'.api_get_cidreq().'&action=delete_attach&forum='.$forumId.'&thread='.$threadId.'&id_attach='.$row['iid'];
$json['delete'] = Display::url(
Display::return_icon('delete.png', get_lang('Delete'), [], ICON_SIZE_SMALL),
Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Delete')),
$url,
['class' => 'deleteLink']
);
} else {
// If not, set an exclamation result
$json['result'] = Display::return_icon('exclamation.png', get_lang('Error'));
$json['result'] = Display::getMdiIcon('close-circle', 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Error'));
}
// Store array data into $_SESSION
$_SESSION['forum']['upload_file'][$courseId][$json['id']] = $json;

@ -5,6 +5,8 @@
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CForum;
use Chamilo\CourseBundle\Entity\CForumThread;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
/**
* @todo fix all this qualify files avoid including files, use classes POO jmontoya
@ -339,7 +341,7 @@ if (isset($rows)) {
echo '<tr ><td height="50%">';
$realname = $attachment_list['path'];
$user_filename = $attachment_list['filename'];
echo Display::return_icon('attachment.gif', get_lang('Attachment'));
echo Display::getMdiIcon('paperclip', 'ch-tool-icon', '', ICON_SIZE_SMALL, get_lang('Attachment'));
echo '<a href="download.php?file=';
echo $realname;
echo ' "> '.$user_filename.' </a>';

@ -4,6 +4,7 @@
use Chamilo\CourseBundle\Entity\CForumPost;
use ChamiloSession as Session;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
/**
* These files are a complete rework of the forum. The database structure is
@ -204,11 +205,12 @@ if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])) {
$url = '../lp/lp_controller.php?'.api_get_cidreq()
."&gradebook=&action=add_item&type=step&lp_id='.$lp_id.'#resource_tab-5";
$actionLeft .= Display::url(
Display::return_icon(
'back.png',
get_lang('Back to').' '.get_lang('Learning paths'),
Display::getMdiIcon(
ActionIcon::BACK,
'ch-tool-icon',
null,
ICON_SIZE_MEDIUM
ICON_SIZE_MEDIUM,
get_lang('Back to').' '.get_lang('Learning paths')
),
$url
);
@ -217,23 +219,13 @@ if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])) {
if (api_is_allowed_to_edit(false, true)) {
if (is_array($forumCategories) && !empty($forumCategories)) {
$actionLeft .= Display::url(
Display::return_icon(
'new_forum.png',
get_lang('Add a forum'),
null,
ICON_SIZE_MEDIUM
),
Display::getMdiIcon('comment-quote', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Add a forum')),
api_get_self().'?'.api_get_cidreq().'&action=add_forum&lp_id='.$lp_id
);
}
$actionLeft .= Display::url(
Display::return_icon(
'new_folder.png',
get_lang('Add a forumCategory'),
null,
ICON_SIZE_MEDIUM
),
Display::getMdiIcon('folder-multiple-plus', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Add a forumCategory')),
api_get_self().'?'.api_get_cidreq().'&action=add_category&lp_id='.$lp_id
);
}
@ -346,12 +338,7 @@ if (is_array($forumCategories)) {
) {
$tools .= '<a href="'.api_get_self().'?'.api_get_cidreq()
.'&action=edit_category&content=forumcategory&id='.$categoryId
.'">'.Display::return_icon(
'edit.png',
get_lang('Edit'),
[],
ICON_SIZE_SMALL
)
.'">'.Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Edit'))
.'</a>';
$tools .= '<a href="'.api_get_self().'?'.api_get_cidreq()
@ -362,12 +349,7 @@ if (is_array($forumCategories)) {
ENT_QUOTES
))
."')) return false;\">"
.Display::return_icon(
'delete.png',
get_lang('Delete'),
[],
ICON_SIZE_SMALL
)
.Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Delete'))
.'</a>';
$tools .= returnVisibleInvisibleIcon(
'forumcategory',
@ -542,7 +524,7 @@ if (is_array($forumCategories)) {
if (api_is_allowed_to_edit(false, true)) {
$toolActions .= '<a href="'.api_get_self().'?'.api_get_cidreq()
.'&action=edit_forum&content=forum&id='.$forumId.'">'
.Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL)
.Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Edit'))
.'</a>';
$toolActions .= '<a href="'.api_get_self().'?'.api_get_cidreq()
.'&action=delete_forum&content=forum&id='.$forumId
@ -550,7 +532,7 @@ if (is_array($forumCategories)) {
api_htmlentities(get_lang('Delete forum ?'), ENT_QUOTES)
)
."')) return false;\">"
.Display::return_icon('delete.png', get_lang('Delete'), [], ICON_SIZE_SMALL)
.Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Delete'))
.'</a>';
$toolActions .= returnVisibleInvisibleIcon(

@ -4,6 +4,7 @@
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CForum;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
/**
* These files are a complete rework of the forum. The database structure is
@ -223,7 +224,7 @@ Display::display_header();
//$actions '<span style="float:right;">'.search_link().'</span>';
$actions = '<a href="viewforum.php?forum='.(int) ($_GET['forum']).'&'.$cidreq.'">'.
Display::return_icon('back.png', get_lang('Back to forum'), '', ICON_SIZE_MEDIUM).'</a>';
Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Back to forum')).'</a>';
echo Display::toolbarAction('toolbar', [$actions]);
// Set forum attachment data into $_SESSION

@ -5,6 +5,7 @@
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CForum;
use Chamilo\CourseBundle\Entity\CForumThread;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
/**
* These files are a complete rework of the forum. The database structure is
@ -204,7 +205,7 @@ $htmlHeadXtra[] = <<<JS
});
$('[name="user_upload[]"]').parent().append(newInputFile);
});
})
});
</script>
JS;
@ -239,12 +240,7 @@ Display::display_header();
if ('learnpath' !== $origin) {
//$actionsLeft = '<span style="float:right;">'.search_link().'</span>';
$actionsLeft = '<a href="viewthread.php?'.api_get_cidreq().'&forum='.$forumId.'&thread='.$threadId.'">';
$actionsLeft .= Display::return_icon(
'back.png',
get_lang('Back to thread'),
'',
ICON_SIZE_MEDIUM
).'</a>';
$actionsLeft .= Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Back to thread')).'</a>';
echo Display::toolbarAction('toolbar', [$actionsLeft]);
}

@ -5,6 +5,8 @@
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CForum;
use Chamilo\CourseBundle\Entity\CForumPost;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
use Chamilo\CoreBundle\Component\Utils\ToolIcon;
require_once __DIR__.'/../inc/global.inc.php';
@ -240,7 +242,7 @@ if ('liststd' === $my_action &&
$qualificationBlock .= '</tr>';
$max_qualify = showQualify('2', $userId, $_GET['id']);
$counter = 0;
$icon = Display::return_icon('quiz.png', get_lang('Grade activity'));
$icon = Display::getMdiIcon(ActionIcon::GRADE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Grade activity'));
if (Database::num_rows($student_list) > 0) {
while ($row_student_list = Database::fetch_array($student_list)) {
$userInfo = api_get_user_info($row_student_list['id']);
@ -290,12 +292,12 @@ $actions = '';
if ('learnpath' !== $origin) {
if (!empty($groupId)) {
$actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq().'">'
.Display::return_icon('back.png', get_lang('Back to')
.Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Back to')
.' '.get_lang('Groups'), '', ICON_SIZE_MEDIUM).'</a>';
} else {
$actions .= '<span style="float:right;">'.search_link().'</span>';
$actions .= '<a href="'.$forumUrl.'index.php?'.api_get_cidreq().'">'
.Display::return_icon('back.png', get_lang('Back toForumOverview'), '', ICON_SIZE_MEDIUM)
.Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Back toForumOverview'))
.'</a>';
}
}
@ -312,7 +314,7 @@ if (api_is_allowed_to_edit(false, true) ||
if (!api_is_anonymous() && !api_is_invitee()) {
$actions .= '<a href="'.$forumUrl.'newthread.php?'.api_get_cidreq().'&forum='
.$forumId.'">'
.Display::return_icon('new_thread.png', get_lang('Create thread'), '', ICON_SIZE_MEDIUM)
.Display::getMdiIcon('format-quote-open', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Create thread'))
.'</a>';
}
} else {
@ -321,12 +323,7 @@ if (api_is_allowed_to_edit(false, true) ||
}
$descriptionForum = $forumEntity->getForumComment();
$iconForum = Display::return_icon(
'forum_yellow.png',
get_lang('Forum'),
null,
ICON_SIZE_MEDIUM
);
$iconForum = Display::getMdiIcon('comment-quote', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Forum'));
$header = '';
// The current forum
@ -426,14 +423,9 @@ if (is_array($threads)) {
}
$html .= '<div class="col-md-4">'
.Display::return_icon('post-forum.png', null, null, ICON_SIZE_SMALL)
.Display::getMdiIcon('format-quote-open', 'ch-tool-icon', '', ICON_SIZE_SMALL, get_lang('Replies'))
." {$thread->getThreadReplies()} ".get_lang('Replies').'<br>';
$html .= Display::return_icon(
'post-forum.png',
null,
null,
ICON_SIZE_SMALL
).' '.$thread->getThreadReplies().' '.get_lang('Views').'<br>';
$html .= Display::getMdiIcon('format-quote-open', 'ch-tool-icon', '', ICON_SIZE_SMALL, get_lang('Views')).' '.$thread->getThreadReplies().' '.get_lang('Views').'<br>';
$html .= '</div>';
$last_post = null;
if ($thread->getThreadLastPost()) {
@ -457,20 +449,15 @@ if (is_array($threads)) {
.'&forum='.$forumId.'&thread='
.$thread->getIid()
.'&id_attach='.$id_attach.'">'
.Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL).'</a>';
.Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Edit')).'</a>';
if (api_resource_is_locked_by_gradebook($thread->getIid(), LINK_FORUM_THREAD)) {
$iconsEdit .= Display::return_icon(
'delete_na.png',
get_lang('This option is not available because this activity is contained by an assessment, which is currently locked. To unlock the assessment, ask your platform administrator.'),
[],
ICON_SIZE_SMALL
);
$iconsEdit .= Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon-disabled', null, ICON_SIZE_SMALL, get_lang('This option is not available because this activity is contained by an assessment'));
} else {
$iconsEdit .= '<a href="'.$url.'&forum='.$forumId.'&action=delete_thread&content=thread&id='
.$thread->getIid()."\" onclick=\"javascript:if(!confirm('"
.addslashes(api_htmlentities(get_lang('Delete complete thread?'), ENT_QUOTES))
."')) return false;\">"
.Display::return_icon('delete.png', get_lang('Delete'), [], ICON_SIZE_SMALL).'</a>';
.Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Delete')).'</a>';
}
$iconsEdit .= returnVisibleInvisibleIcon(
@ -492,29 +479,28 @@ if (is_array($threads)) {
]
);
$iconsEdit .= '<a href="'.$viewForumUrl.'&forum='.$forumId.'&action=move_thread&thread='.$threadId.'">'
.Display::return_icon('move.png', get_lang('Move Thread'), [], ICON_SIZE_SMALL)
.Display::getMdiIcon(ActionIcon::MOVE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Move Thread'))
.'</a>';
}
}
$iconnotify = 'notification_mail_na.png';
$disable = true;
if (is_array(
isset($_SESSION['forum_notification']['thread']) ? $_SESSION['forum_notification']['thread'] : null
)
) {
if (in_array($threadId, $_SESSION['forum_notification']['thread'])) {
$iconnotify = 'notification_mail.png';
$disable = false;
}
}
$icon_liststd = 'user.png';
if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) {
$iconsEdit .= '<a href="'.$url.'&forum='.$forumId."&action=notify&content=thread&id={$threadId}".'">'.
Display::return_icon($iconnotify, get_lang('Notify me')).'</a>';
Display::getMdiIcon('email-alert', ($disable ? 'ch-tool-icon-disabled' : 'ch-tool-icon'), '', ICON_SIZE_SMALL, get_lang('Notify me')).'</a>';
}
if (api_is_allowed_to_edit(null, true) && 'learnpath' != $origin) {
$iconsEdit .= '<a href="'.$viewForumUrl.'&forum='.$forumId."&action=liststd&content=thread&id={$threadId}".'">'.
Display::return_icon($icon_liststd, get_lang('Learners list'), [], ICON_SIZE_SMALL)
Display::getMdiIcon(ToolIcon::MEMBER, 'ch-tool-icon', '', ICON_SIZE_SMALL, get_lang('Learners list'))
.'</a>';
}
$html .= $iconsEdit;

@ -4,6 +4,8 @@
use Chamilo\CourseBundle\Entity\CForumPost;
use ChamiloSession as Session;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
use Chamilo\CoreBundle\Component\Utils\ToolIcon;
require_once __DIR__.'/../inc/global.inc.php';
@ -123,12 +125,7 @@ if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])) {
$url = '../lp/lp_controller.php?'.api_get_cidreq()
."&gradebook=&action=add_item&type=step&lp_id='.$lp_id.'#resource_tab-5";
$actionLeft .= Display::url(
Display::return_icon(
'back.png',
get_lang('Back to').' '.get_lang('Learning paths'),
null,
ICON_SIZE_MEDIUM
),
Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', '', ICON_SIZE_MEDIUM, get_lang('Back to').' '.get_lang('Learning paths')),
$url
);
}
@ -137,34 +134,19 @@ if (api_is_allowed_to_edit(false, true)) {
$url = 'index.php?'.api_get_cidreq();
$actionLeft .= Display::url(
Display::return_icon(
'back.png',
get_lang('Back to').' '.get_lang('Learning paths'),
null,
ICON_SIZE_MEDIUM
),
Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', '', ICON_SIZE_MEDIUM, get_lang('Back to').' '.get_lang('Learning paths')),
$url
);
if (is_array($forumCategories) && !empty($forumCategories)) {
$actionLeft .= Display::url(
Display::return_icon(
'new_forum.png',
get_lang('Add a forum'),
null,
ICON_SIZE_MEDIUM
),
Display::getMdiIcon(ToolIcon::FORUM, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Add a forum')),
api_get_self().'?'.api_get_cidreq().'&action=add_forum&lp_id='.$lp_id
);
}
$actionLeft .= Display::url(
Display::return_icon(
'new_folder.png',
get_lang('Add a forumCategory'),
null,
ICON_SIZE_MEDIUM
),
Display::getMdiIcon(ActionIcon::FOLDER_CREATE, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Add a forumCategory')),
api_get_self().'?'.api_get_cidreq().'&action=add_category&lp_id='.$lp_id
);
}
@ -212,12 +194,7 @@ if (is_array($forumCategories)) {
) {
$tools .= '<a href="'.api_get_self().'?'.api_get_cidreq()
.'&action=edit_category&content=forumcategory&id='.$categoryId
.'">'.Display::return_icon(
'edit.png',
get_lang('Edit'),
[],
ICON_SIZE_SMALL
)
.'">'.Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Edit'))
.'</a>';
$tools .= '<a href="'.api_get_self().'?'.api_get_cidreq()
@ -228,12 +205,7 @@ if (is_array($forumCategories)) {
ENT_QUOTES
))
."')) return false;\">"
.Display::return_icon(
'delete.png',
get_lang('Delete'),
[],
ICON_SIZE_SMALL
)
.Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Delete'))
.'</a>';
$tools .= returnVisibleInvisibleIcon(
'forumcategory',
@ -336,7 +308,7 @@ if (is_array($forumCategories)) {
if (api_is_allowed_to_edit(false, true)) {
$toolActions .= '<a href="'.api_get_self().'?'.api_get_cidreq()
.'&action=edit_forum&content=forum&id='.$forumId.'">'
.Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL)
.Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Edit'))
.'</a>';
$toolActions .= '<a href="'.api_get_self().'?'.api_get_cidreq()
.'&action=delete_forum&content=forum&id='.$forumId
@ -344,7 +316,7 @@ if (is_array($forumCategories)) {
api_htmlentities(get_lang('Delete forum ?'), ENT_QUOTES)
)
."')) return false;\">"
.Display::return_icon('delete.png', get_lang('Delete'), [], ICON_SIZE_SMALL)
.Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Delete'))
.'</a>';
$toolActions .= returnVisibleInvisibleIcon(

@ -7,6 +7,8 @@ use Chamilo\CourseBundle\Entity\CForum;
use Chamilo\CourseBundle\Entity\CForumAttachment;
use Chamilo\CourseBundle\Entity\CForumPost;
use Chamilo\CourseBundle\Entity\CForumThread;
use Chamilo\CoreBundle\Component\Utils\ActionIcon;
use Chamilo\CoreBundle\Component\Utils\ToolIcon;
require_once __DIR__.'/../inc/global.inc.php';
@ -295,7 +297,7 @@ if ('learnpath' === $origin) {
$actions = '<span style="float:right;">'.search_link().'</span>';
if ('learnpath' != $origin) {
$actions .= '<a href="'.$forumUrl.'viewforum.php?forum='.$forumId.'&'.api_get_cidreq().'">'
.Display::return_icon('back.png', get_lang('Back to forum'), '', ICON_SIZE_MEDIUM).'</a>';
.Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Back to forum')).'</a>';
}
// The reply to thread link should only appear when the forum_category is
@ -313,14 +315,14 @@ if (($current_forum_category &&
// back link inside lp
if ('learnpath' == $origin && !empty($threadId)) {
$actions .= '<a href="'.$forumUrl.'viewforum.php?forum='.$forumId.'&'.api_get_cidreq().'">'
.Display::return_icon('back.png', get_lang('Back to forum'), '', ICON_SIZE_MEDIUM).'</a>';
.Display::getMdiIcon(ActionIcon::BACK, 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Back to forum')).'</a>';
}
// reply link
if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) {
$actions .= '<a href="'.$forumUrl.'reply.php?'.api_get_cidreq().'&forum='.$forumId.'&thread='
.$threadId.'&action=replythread">'
.Display::return_icon('reply_thread.png', get_lang('Reply to this thread'), '', ICON_SIZE_MEDIUM)
.Display::getMdiIcon('reply', 'ch-tool-icon', null, ICON_SIZE_MEDIUM, get_lang('Reply to this thread'))
.'</a>';
}
// new thread link
@ -437,7 +439,7 @@ foreach ($posts as $post) {
$editUrl = api_get_path(WEB_CODE_PATH).'forum/editpost.php?'.api_get_cidreq();
$editUrl .= "&forum=$forumId&thread=$threadId&post={$post['post_id']}&id_attach=$id_attach";
$iconEdit .= "<a href='".$editUrl."'>"
.Display::return_icon('edit.png', get_lang('Edit'), [], ICON_SIZE_SMALL)
.Display::getMdiIcon(ActionIcon::EDIT, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Edit'))
.'</a>';
$editButton = Display::toolbarButton(
@ -464,7 +466,7 @@ foreach ($posts as $post) {
]
);
$iconEdit .= Display::url(
Display::return_icon('delete.png', get_lang('Delete'), [], ICON_SIZE_SMALL),
Display::getMdiIcon(ActionIcon::DELETE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Delete')),
$deleteUrl,
[
'onclick' => "javascript:if(!confirm('"
@ -501,7 +503,7 @@ foreach ($posts as $post) {
if ($count > 0) {
$iconEdit .= '<a href="viewthread.php?'.api_get_cidreq()
."&forum=$forumId&thread=$threadId&action=move&post={$post['post_id']}"
.'">'.Display::return_icon('move.png', get_lang('Move post'), [], ICON_SIZE_SMALL).'</a>';
.'">'.Display::getMdiIcon(ActionIcon::MOVE, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Move post')).'</a>';
}
}
@ -563,7 +565,7 @@ foreach ($posts as $post) {
."&forum=$forumId&thread=$threadId&action=list&post={$post['post_id']}"
."&user={$userId}&user_id={$userId}"
."&idtextqualify=$current_qualify_thread"
.'" >'.Display::return_icon('quiz.png', get_lang('Grade activity')).'</a>';
.'" >'.Display::getMdiIcon(ToolIcon::QUIZ, 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Grade activity')).'</a>';
}
}
}
@ -666,7 +668,7 @@ foreach ($posts as $post) {
'AW:',
'Aw:',
];
$replace = '<span>'.Display::getMdiIcon('reply').'</span>';
$replace = '<span>'.Display::getMdiIcon('reply', 'ch-tool-icon', '', ICON_SIZE_SMALL).'</span>';
$post['post_title'] = str_replace($search, $replace, Security::remove_XSS($post['post_title']));
// The post title
@ -685,7 +687,7 @@ foreach ($posts as $post) {
$repo = Container::getForumAttachmentRepository();
/** @var CForumAttachment $attachment */
foreach ($attachments as $attachment) {
$post['post_attachments'] .= Display::getMdiIcon('paperclip');
$post['post_attachments'] .= Display::getMdiIcon('paperclip', 'ch-tool-icon', '', ICON_SIZE_SMALL);
$url = $repo->getResourceFileDownloadUrl($attachment).'?'.api_get_cidreq();
$post['post_attachments'] .= Display::url($attachment->getFilename(), $url);
$post['post_attachments'] .= '<span class="forum_attach_comment" >'.$attachment->getComment().'</span>';
@ -697,7 +699,7 @@ foreach ($posts as $post) {
.$attachment->getIid().'&forum='.$forumId.'&thread='.$threadId.'&post='.$post['post_id']
.'" onclick="javascript:if(!confirm(\''
.addslashes(api_htmlentities(get_lang('Please confirm your choice'), ENT_QUOTES)).'\')) return false;">'
.Display::return_icon('delete.png', get_lang('Delete')).'</a><br />';
.Display::getMdiIcon('delete', 'ch-tool-icon', null, ICON_SIZE_SMALL, get_lang('Delete')).'</a><br />';
}
}
}

Loading…
Cancel
Save