1919use ChamiloSession as Session ;
2020use Doctrine \Common \Collections \Criteria ;
2121use Symfony \Component \HttpFoundation \File \UploadedFile ;
22+ use Chamilo \CoreBundle \Component \Utils \ActionIcon ;
23+
2224
2325/**
2426 * @todo convert this library into a class
@@ -918,7 +920,7 @@ function returnVisibleInvisibleIcon(
918920 }
919921 }
920922 $ html .= 'action=invisible&content= ' .$ content .'&id= ' .$ id .'"> ' .
921- Display::return_icon ( ' visible.png ' , get_lang ('MakeInvisible ' ), [], ICON_SIZE_SMALL ).'</a> ' ;
923+ Display::getMdiIcon (ActionIcon:: VISIBLE , ' ch-tool-icon ' , null , ICON_SIZE_SMALL , get_lang ('MakeInvisible ' )).'</a> ' ;
922924 }
923925 if (0 == $ current_visibility_status ) {
924926 $ html .= '<a href=" ' .api_get_self ().'? ' .api_get_cidreq ().'& ' ;
@@ -928,7 +930,7 @@ function returnVisibleInvisibleIcon(
928930 }
929931 }
930932 $ html .= 'action=visible&content= ' .$ content .'&id= ' .$ id .'"> ' .
931- Display::return_icon ( ' invisible.png ' , get_lang ('Make Visible ' ), [], ICON_SIZE_SMALL ).'</a> ' ;
933+ Display::getMdiIcon (ActionIcon:: INVISIBLE , ' ch-tool-icon ' , null , ICON_SIZE_SMALL , get_lang ('Make Visible ' )).'</a> ' ;
932934 }
933935
934936 return $ html ;
@@ -952,13 +954,14 @@ function returnLockUnlockIcon(
952954 //check if the forum is blocked due
953955 if ('thread ' === $ content ) {
954956 if (api_resource_is_locked_by_gradebook ($ id , LINK_FORUM_THREAD )) {
955- return $ html .Display::return_icon (
956- 'lock_na.png ' ,
957+ return $ html .Display::getMdiIcon (
958+ ActionIcon::LOCK ,
959+ 'ch-tool-icon-disabled ' ,
960+ '' ,
961+ ICON_SIZE_SMALL ,
957962 get_lang (
958963 '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. '
959- ),
960- [],
961- ICON_SIZE_SMALL
964+ )
962965 );
963966 }
964967 }
@@ -970,7 +973,7 @@ function returnLockUnlockIcon(
970973 }
971974 }
972975 $ html .= 'action=unlock&content= ' .$ content .'&id= ' .$ id .'"> ' .
973- Display::return_icon ( ' lock.png ' , get_lang ('Unlock ' ), [], ICON_SIZE_SMALL ).'</a> ' ;
976+ Display::getMdiIcon (ActionIcon:: LOCK , ' ch-tool-icon ' , null , ICON_SIZE_SMALL , get_lang ('Unlock ' )).'</a> ' ;
974977 }
975978 if ('0 ' == $ current_lock_status ) {
976979 $ html .= '<a href=" ' .api_get_self ().'? ' .api_get_cidreq ().'& ' ;
@@ -980,7 +983,7 @@ function returnLockUnlockIcon(
980983 }
981984 }
982985 $ html .= 'action=lock&content= ' .$ content .'&id= ' .$ id .'"> ' .
983- Display::return_icon ( ' unlock.png ' , get_lang ('Lock ' ), [], ICON_SIZE_SMALL ).'</a> ' ;
986+ Display::getMdiIcon (ActionIcon:: UNLOCK , ' ch-tool-icon ' , null , ICON_SIZE_SMALL , get_lang ('Lock ' )).'</a> ' ;
984987 }
985988
986989 return $ html ;
@@ -1017,10 +1020,10 @@ function returnUpDownIcon(string $content, int $id, array $list): string
10171020 $ return_value = '<a
10181021 href=" ' .api_get_self ().'? ' .api_get_cidreq ().'&action=move&direction=up&content= ' .$ content .'&forumcategory= ' .$ forumCategory .'&id= ' .$ id .'"
10191022 title=" ' .get_lang ('Move up ' ).'"> ' .
1020- Display::return_icon ( ' up.png ' , get_lang ('Move up ' ), [], ICON_SIZE_SMALL ).'</a> ' ;
1023+ Display::getMdiIcon (ActionIcon:: UP , ' ch-tool-icon ' , null , ICON_SIZE_SMALL , get_lang ('Move up ' )).'</a> ' ;
10211024 } else {
10221025 $ return_value = Display::url (
1023- Display::return_icon ( ' up_na.png ' , '- ' , [] , ICON_SIZE_SMALL ),
1026+ Display::getMdiIcon (ActionIcon:: UP , 'ch-tool-icon-disabled ' , null , ICON_SIZE_SMALL , '' ),
10241027 'javascript:void(0) '
10251028 );
10261029 }
@@ -1029,10 +1032,10 @@ function returnUpDownIcon(string $content, int $id, array $list): string
10291032 $ return_value .= '<a
10301033 href=" ' .api_get_self ().'? ' .api_get_cidreq ().'&action=move&direction=down&content= ' .$ content .'&forumcategory= ' .$ forumCategory .'&id= ' .$ id .'"
10311034 title=" ' .get_lang ('Move down ' ).'" > ' .
1032- Display::return_icon ( ' down.png ' , get_lang ('Move down ' ), [], ICON_SIZE_SMALL ).'</a> ' ;
1035+ Display::getMdiIcon (ActionIcon:: DOWN , ' ch-tool-icon ' , null , ICON_SIZE_SMALL , get_lang ('Move down ' )).'</a> ' ;
10331036 } else {
10341037 $ return_value = Display::url (
1035- Display::return_icon ( ' down_na.png ' , '- ' , [] , ICON_SIZE_SMALL ),
1038+ Display::getMdiIcon (ActionIcon:: DOWN , 'ch-tool-icon-disabled ' , null , ICON_SIZE_SMALL , '' ),
10361039 'javascript:void(0) '
10371040 );
10381041 }
@@ -1483,7 +1486,6 @@ function get_thread_users_details(int $thread_id)
14831486 AND course_user.relation_type <> " .COURSE_RELATION_TYPE_RRHH ."
14841487 AND p.thread_id = $ thread_id
14851488 AND course_user.status != '1' AND
1486- p.c_id = $ course_id AND
14871489 course_user.c_id = $ course_id $ orderby " ;
14881490 }
14891491
@@ -3381,7 +3383,6 @@ function handle_mail_cue($content, $id)
33813383 $ sql = "SELECT users.firstname, users.lastname, users.id as user_id, users.email, posts.forum_id
33823384 FROM $ table_mailcue mailcue, $ table_posts posts, $ table_users users
33833385 WHERE
3384- posts.c_id = $ course_id AND
33853386 mailcue.c_id = $ course_id AND
33863387 posts.thread_id = $ id AND
33873388 posts.post_notification = '1' AND
@@ -4000,7 +4001,7 @@ function search_link()
40004001 $ origin = api_get_origin ();
40014002 if ('learnpath ' != $ origin ) {
40024003 $ return = '<a href="forumsearch.php? ' .api_get_cidreq ().'&action=search"> ' ;
4003- $ return .= Display::return_icon ( ' search.png ' , get_lang ( ' Search ' ), '' , ICON_SIZE_MEDIUM ).'</a> ' ;
4004+ $ return .= Display::getMdiIcon ( ' magnify-plus-outline ' , ' ch-tool-icon ' , null , ICON_SIZE_SMALL , get_lang ( ' Search ' ) ).'</a> ' ;
40044005
40054006 if (!empty ($ _GET ['search ' ])) {
40064007 $ return .= ': ' .Security::remove_XSS ($ _GET ['search ' ]).' ' ;
@@ -4012,7 +4013,7 @@ function search_link()
40124013 }
40134014 }
40144015 $ url .= implode ('& ' , $ url_parameter );
4015- $ return .= '<a href=" ' .$ url .'"> ' .Display::return_icon ( ' delete.gif ' , get_lang ('Clean search results ' )).'</a> ' ;
4016+ $ return .= '<a href=" ' .$ url .'"> ' .Display::getMdiIcon (ActionIcon:: DELETE , ' ch-tool-icon ' , '' , ICON_SIZE_SMALL , get_lang ('Clean search results ' )).'</a> ' ;
40164017 }
40174018 }
40184019
@@ -4638,20 +4639,20 @@ function get_thread_user_post(Course $course, $thread_id, $user_id)
46384639/**
46394640 * This function get the name of an thread by id.
46404641 *
4641- * @param int $thread_id
4642+ * @param int $threadId
46424643 *
46434644 * @return string
46444645 *
46454646 * @author Christian Fasanando
46464647 * @author Julio Montoya <gugli100@gmail.com> Adding security
46474648 */
4648- function get_name_thread_by_id ($ thread_id )
4649+ function get_name_thread_by_id (int $ threadId ): string
46494650{
4650- $ t_forum_thread = Database::get_course_table (TABLE_FORUM_THREAD );
4651+ $ tForumThread = Database::get_course_table (TABLE_FORUM_THREAD );
46514652 $ course_id = api_get_course_int_id ();
46524653 $ sql = "SELECT thread_title
4653- FROM $ t_forum_thread
4654- WHERE c_id = $ course_id AND iid = ' " .( int ) $ thread_id . " ' " ;
4654+ FROM $ tForumThread
4655+ WHERE iid = $ threadId " ;
46554656 $ result = Database::query ($ sql );
46564657 $ row = Database::fetch_array ($ result );
46574658
@@ -4700,12 +4701,7 @@ function get_all_post_from_user(int $user_id, int $courseId): string
47004701 $ post_counter = count ($ post_list );
47014702 if (is_array ($ post_list ) && count ($ post_list ) > 0 ) {
47024703 $ hand_forums .= '<div id="social-thread"> ' ;
4703- $ hand_forums .= Display::return_icon (
4704- 'thread.png ' ,
4705- get_lang ('Thread ' ),
4706- '' ,
4707- ICON_SIZE_MEDIUM
4708- );
4704+ $ hand_forums .= Display::getMdiIcon ('format-quote-open ' , 'ch-tool-icon ' , null , ICON_SIZE_SMALL , get_lang ('Thread ' ));
47094705 $ hand_forums .= ' ' .Security::remove_XSS ($ thread ->getThreadTitle (), STUDENT );
47104706 $ hand_forums .= '</div> ' ;
47114707
@@ -4724,7 +4720,7 @@ function get_all_post_from_user(int $user_id, int $courseId): string
47244720 $ forum_results .= '<div id="social-forum"> ' ;
47254721 $ forum_results .= '<div class="clear"></div><br /> ' ;
47264722 $ forum_results .= '<div id="social-forum-title"> ' .
4727- Display::return_icon ( ' forum.gif ' , get_lang ('Forum ' )).' ' .Security::remove_XSS ($ forum ->getForumTitle (), STUDENT ).
4723+ Display::getMdiIcon ( ' comment-quote ' , ' ch-tool-icon ' , '' , ICON_SIZE_SMALL , get_lang ('Forum ' )).' ' .Security::remove_XSS ($ forum ->getForumTitle (), STUDENT ).
47284724 '<div style="float:right;margin-top:-35px">
47294725 <a href="../forum/viewforum.php? ' .api_get_cidreq_params ($ courseId ).'&forum= ' .$ forum ->getIid ().' " > ' .
47304726 get_lang ('See forum ' ).'
@@ -5061,16 +5057,16 @@ function getAttachedFiles(
50615057 // Check if $row is consistent
50625058 if ($ attachment ) {
50635059 // Set result as success and bring delete URL
5064- $ json ['result ' ] = Display::return_icon ( ' accept.png ' , get_lang ('Uploaded. ' ));
5060+ $ json ['result ' ] = Display::getMdiIcon ( ' check-circle ' , ' ch-tool-icon ' , null , ICON_SIZE_SMALL , get_lang ('Uploaded. ' ));
50655061 $ url = api_get_path (WEB_CODE_PATH ).'forum/viewthread.php? ' .api_get_cidreq ().'&action=delete_attach&forum= ' .$ forumId .'&thread= ' .$ threadId .'&id_attach= ' .$ row ['iid ' ];
50665062 $ json ['delete ' ] = Display::url (
5067- Display::return_icon ( ' delete.png ' , get_lang ('Delete ' ), [], ICON_SIZE_SMALL ),
5063+ Display::getMdiIcon (ActionIcon:: DELETE , ' ch-tool-icon ' , null , ICON_SIZE_SMALL , get_lang ('Delete ' )),
50685064 $ url ,
50695065 ['class ' => 'deleteLink ' ]
50705066 );
50715067 } else {
50725068 // If not, set an exclamation result
5073- $ json ['result ' ] = Display::return_icon ( ' exclamation.png ' , get_lang ('Error ' ));
5069+ $ json ['result ' ] = Display::getMdiIcon ( ' close-circle ' , ' ch-tool-icon ' , null , ICON_SIZE_SMALL , get_lang ('Error ' ));
50745070 }
50755071 // Store array data into $_SESSION
50765072 $ _SESSION ['forum ' ]['upload_file ' ][$ courseId ][$ json ['id ' ]] = $ json ;
0 commit comments