File tree Expand file tree Collapse file tree 3 files changed +71
-0
lines changed Expand file tree Collapse file tree 3 files changed +71
-0
lines changed Original file line number Diff line number Diff line change 3
3
4
4
use Chamilo \CoreBundle \Entity \BranchSync ;
5
5
use Chamilo \CoreBundle \Entity \Repository \BranchSyncRepository ;
6
+ use GuzzleHttp \Client ;
6
7
7
8
/**
8
9
* Responses to AJAX calls.
72
73
73
74
echo file_get_contents ("{$ newUrlDir }{$ blockName }_extra.html " );
74
75
break ;
76
+ case 'get_latest_news ' :
77
+ if (api_get_configuration_value ('admin_chamilo_announcements_disable ' ) === true ) {
78
+ break ;
79
+ }
80
+
81
+ $ latestNews = getLatestNews ();
82
+ $ latestNews = json_decode ($ latestNews , true );
83
+
84
+ echo Security::remove_XSS ($ latestNews ['text ' ], COURSEMANAGER );
85
+ break ;
75
86
}
76
87
77
88
/**
@@ -225,3 +236,34 @@ function check_system_version()
225
236
226
237
return '<span style="color:red"> ' .get_lang ('ImpossibleToContactVersionServerPleaseTryAgain ' ).'</span> ' ;
227
238
}
239
+
240
+ /**
241
+ * Display the latest news from the Chamilo Association for admins
242
+ *
243
+ * @throws \GuzzleHttp\Exception\GuzzleException
244
+ *
245
+ * @return string|void
246
+ */
247
+ function getLatestNews ()
248
+ {
249
+ global $ language_interface ;
250
+
251
+ $ url = 'https://version.chamilo.org/news/latest.php ' ;
252
+
253
+ $ client = new Client ();
254
+ $ response = $ client ->request (
255
+ 'GET ' ,
256
+ $ url ,
257
+ [
258
+ 'query ' => [
259
+ 'language ' => $ language_interface ,
260
+ ],
261
+ ]
262
+ );
263
+
264
+ if ($ response ->getStatusCode () !== 200 ) {
265
+ return ;
266
+ }
267
+
268
+ return $ response ->getBody ()->getContents ();
269
+ }
Original file line number Diff line number Diff line change 1093
1093
// Default selected row in jqgrid/sortable tables
1094
1094
//$_configuration['table_default_row'] = 50;
1095
1095
1096
+ // Disable Chamilo.org announcements at the top of the admin page
1097
+ //$_configuration['admin_chamilo_announcements_disable'] = false;
1098
+
1096
1099
// ------ Custom DB changes (keep this at the end)
1097
1100
// Add user activation by confirmation email
1098
1101
// This option prevents the new user to login in the platform if your account is not confirmed via email
Original file line number Diff line number Diff line change
1
+ {% set admin_chamilo_announcements_disable = ' admin_chamilo_announcements_disable' |api_get_configuration_value %}
2
+
1
3
<script >
2
4
$ (document ).ready (function () {
3
5
$.ajax({
35
37
} );
36
38
} );
37
39
} )(window.CKEDITOR);
40
+
41
+ {% if not admin_chamilo_announcements_disable %}
42
+ $
43
+ .ajax(' { { web_admin_ajax_url } } ?a=get_latest_news' )
44
+ .then(function (response) {
45
+ $(' #chamilo-news' ).removeClass(' hidden' );
46
+ $(' #chamilo-news-content' ).html(response);
47
+ } );
48
+ {% endif %}
38
49
{% endif %}
39
50
} );
40
51
</script >
41
52
53
+ {% if not admin_chamilo_announcements_disable %}
54
+ <section id =" chamilo-news" class =" row hidden" >
55
+ <div class =" col-xs-12" >
56
+ <div class =" alert alert-info" >
57
+ <button type =" button" class =" close" data-dismiss =" alert" aria-label =" Close" >
58
+ <span aria-hidden =" true" >× ; </span >
59
+ </button >
60
+ <div id =" chamilo-news-content" >
61
+
62
+ </div >
63
+ </div >
64
+ </div >
65
+ </section >
66
+ {% endif %}
67
+
42
68
<section id =" settings" class =" row" >
43
69
{% set columns = 2 %}
44
70
{% for block_item in blocks %}
You can’t perform that action at this time.
0 commit comments