configure_extensions.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. use Chamilo\CoreBundle\Component\Utils\ChamiloApi;
  4. /**
  5. * Edition of extensions configuration.
  6. *
  7. * @package chamilo.admin
  8. */
  9. $cidReset = true;
  10. require_once __DIR__.'/../inc/global.inc.php';
  11. $this_section = SECTION_PLATFORM_ADMIN;
  12. api_protect_admin_script();
  13. $interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
  14. // Database Table Definitions
  15. $tbl_settings_current = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
  16. $message = '';
  17. if (isset($_POST['activeExtension'])) {
  18. switch ($_POST['extension_code']) {
  19. case 'ppt2lp':
  20. $sql = 'UPDATE '.$tbl_settings_current.' SET
  21. selected_value="true"
  22. WHERE variable="service_ppt2lp"
  23. AND subkey="active"';
  24. $rs = Database::query($sql);
  25. if (Database::affected_rows($rs) > 0) {
  26. $message = get_lang('ServiceActivated');
  27. }
  28. $sql = 'UPDATE '.$tbl_settings_current.' SET
  29. selected_value="'.addslashes($_POST['host']).'"
  30. WHERE variable="service_ppt2lp"
  31. AND subkey="host"';
  32. Database::query($sql);
  33. $sql = 'UPDATE '.$tbl_settings_current.' SET
  34. selected_value="'.addslashes($_POST['port']).'"
  35. WHERE variable="service_ppt2lp"
  36. AND subkey="port"';
  37. Database::query($sql);
  38. $sql = 'UPDATE '.$tbl_settings_current.' SET
  39. selected_value="'.addslashes($_POST['ftp_password']).'"
  40. WHERE variable="service_ppt2lp"
  41. AND subkey="ftp_password"';
  42. Database::query($sql);
  43. $sql = 'UPDATE '.$tbl_settings_current.' SET
  44. selected_value="'.addslashes($_POST['user']).'"
  45. WHERE variable="service_ppt2lp"
  46. AND subkey="user"';
  47. Database::query($sql);
  48. $sql = 'UPDATE '.$tbl_settings_current.' SET
  49. selected_value="'.addslashes($_POST['path_to_lzx']).'"
  50. WHERE variable="service_ppt2lp"
  51. AND subkey="path_to_lzx"';
  52. Database::query($sql);
  53. $sql = 'UPDATE '.$tbl_settings_current.' SET
  54. selected_value="'.addslashes($_POST['size']).'"
  55. WHERE variable="service_ppt2lp"
  56. AND subkey="size"';
  57. Database::query($sql);
  58. break;
  59. }
  60. }
  61. $listActiveServices = [];
  62. // get the list of active services
  63. $sql = 'SELECT variable FROM '.$tbl_settings_current.'
  64. WHERE variable LIKE "service_%" AND subkey="active" and selected_value="true"';
  65. $rs = Database::query($sql);
  66. while ($row = Database::fetch_array($rs)) {
  67. $listActiveServices[] = $row['variable'];
  68. }
  69. // javascript to handle accordion behaviour
  70. $javascript_message = '';
  71. if (!empty($message)) {
  72. $javascript_message = '
  73. document.getElementById("message").style.display = "block";
  74. var timer = setTimeout(hideMessage, 5000);';
  75. }
  76. $htmlHeadXtra[] = '<script>
  77. var listeDiv;
  78. var extensionsHeader = new Array();
  79. var extensionsContent = new Array();
  80. window.onload = loadTables;
  81. function loadTables(){
  82. '.$javascript_message.'
  83. var listeDiv = document.getElementsByTagName("div");
  84. // fill extensionsHeader and extensionsContent
  85. for(var i=0 ; i < listeDiv.length ; i++){
  86. if(listeDiv[i].id.indexOf(\'extension_header\')!=-1){
  87. listeDiv[i].onclick = afficheContent;
  88. extensionsHeader.push(listeDiv[i]);
  89. }
  90. if(listeDiv[i].id.indexOf("extension_content")!=-1){
  91. extensionsContent.push(listeDiv[i]);
  92. }
  93. }
  94. }
  95. function hideMessage(){
  96. document.getElementById("message").style.display = "none";
  97. }
  98. function afficheContent(event){
  99. var id = this.id.replace("header","content");
  100. switch(document.getElementById(id).style.display){
  101. case "block" :
  102. document.getElementById(id).style.display = "none";
  103. break;
  104. case "none" :
  105. document.getElementById(id).style.display = "block";
  106. for(var i=0 ; i < extensionsContent.length ; i++){
  107. if(extensionsContent[i].id != id)
  108. extensionsContent[i].style.display = "none";
  109. }
  110. break;
  111. }
  112. }
  113. </script>';
  114. $nameTool = get_lang('ConfigureExtensions');
  115. Display::display_header($nameTool);
  116. ?>
  117. <div id="message" style="display: none">
  118. <?php
  119. if (!empty($message)) {
  120. echo Display::return_message($message, 'normal');
  121. }
  122. ?>
  123. </div>
  124. <div id="content" align="center">
  125. <!-- PPT2LP -->
  126. <div class="chamilo-rapid">
  127. <div class="row">
  128. <div class="col-md-12">
  129. <?php echo Display::panel(get_lang('Ppt2lpDescription').' '.get_lang('Ppt2lpVoiceRecordingNeedsRed5'), get_lang('Ppt2lp')); ?>
  130. </div>
  131. </div>
  132. <div class="row">
  133. <div class="col-md-5">
  134. <?php Display::display_icon('screenshot_ppt2lp.jpg', get_lang('Ppt2lp'), ['class' => 'img-responsive']); ?>
  135. </div>
  136. <div class="col-md-7">
  137. <form method="POST" class="form-horizontal" action="<?php echo api_get_self(); ?>">
  138. <?php
  139. $form = new FormValidator('ppt2lp');
  140. $form->addElement('text', 'host', get_lang('Host'));
  141. //$form -> addElement('html','<br /><br />');
  142. $form->addElement('text', 'port', get_lang('Port'));
  143. //$form -> addElement('html','<br /><br />');
  144. $form->addElement('text', 'user', get_lang('UserOnHost'));
  145. //$form -> addElement('html','<br /><br />');
  146. $form->addElement('text', 'ftp_password', get_lang('FtpPassword'));
  147. //$form -> addElement('html','<br /><br />');
  148. $form->addElement('text', 'path_to_lzx', get_lang('PathToLzx'));
  149. //$form -> addElement('html','<br /><br />');
  150. $options = ChamiloApi::getDocumentConversionSizes();
  151. $form->addElement('select', 'size', get_lang('SlideSize'), $options);
  152. $form->addElement('hidden', 'extension_code', 'ppt2lp');
  153. $defaults = [];
  154. $renderer = $form->defaultRenderer();
  155. $renderer->setElementTemplate(
  156. '<div style="text-align:left">{label}</div><div style="text-align:left">{element}</div>'
  157. );
  158. if (in_array('service_ppt2lp', $listActiveServices)) {
  159. $sql = 'SELECT subkey, selected_value FROM '.$tbl_settings_current.'
  160. WHERE variable = "service_ppt2lp"
  161. AND subkey <> "active"';
  162. $rs = Database::query($sql);
  163. while ($row = Database::fetch_array($rs, 'ASSOC')) {
  164. $defaults[$row['subkey']] = $row['selected_value'];
  165. }
  166. $form->addButtonSave(get_lang('ReconfigureExtension'), 'activeExtension');
  167. } else {
  168. $defaults['host'] = 'localhost';
  169. $defaults['port'] = '2002';
  170. $defaults['size'] = '720x540';
  171. $form->addButtonSave(get_lang('ActivateExtension'), 'activeExtension');
  172. }
  173. $form->setDefaults($defaults);
  174. $form->display();
  175. echo '<br />';
  176. ?>
  177. </form>
  178. </div>
  179. </div>
  180. </div>
  181. <?php
  182. /*
  183. <!-- EPHORUS -->
  184. <div id="main_ephorus">
  185. <div id="extension_header_ephorus" class="accordion_header">
  186. <a href="#"><?php echo get_lang('EphorusPlagiarismPrevention') ?></a>
  187. </div>
  188. <div id="extension_content_ephorus" style="display:none;padding:0;width:780px;" class="accordion_content">
  189. <table width="100%" cellpadding="0" cellspacing="0">
  190. <tr>
  191. <td align="center">
  192. <TABLE style="WIDTH: 750px" cellSpacing="0" cellPadding="0" align="middle" border="0">
  193. <TBODY>
  194. <TR>
  195. <TD>
  196. <TABLE style="WIDTH: 475px" cellSpacing="0" cellPadding="0" border="0">
  197. <TBODY>
  198. <TR>
  199. <TD>
  200. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  201. <a title="http://www.ephorus.com/dokeos_activate.html" href="http://www.ephorus.com/dokeos_activate.html" target="_blank">
  202. <?php Display::display_icon('ephorus.gif','Ephorus'); ?>
  203. </a>
  204. </TD>
  205. <TD>
  206. <P align=center>
  207. <FONT color="#669966" size="3"><?php echo get_lang('EphorusLeadersInAntiPlagiarism') ?></FONT>
  208. </P>
  209. </TD>
  210. </TR>
  211. </TBODY>
  212. </TABLE>
  213. </TD>
  214. </TR>
  215. <TR>
  216. <TD>
  217. <P>
  218. <TABLE style="WIDTH: 85%" cellSpacing="0" cellPadding="0" border="0">
  219. <TBODY>
  220. <TR>
  221. <TD width="50">&nbsp;
  222. </TD>
  223. <TD>
  224. <P>
  225. <?php echo get_lang('EphorusDescription') ?>
  226. </P>
  227. <P>
  228. <A title="http://www.ephorus.nl/demo_account_en.html" href="http://www.ephorus.nl/demo_account_en.html" target="_blank"><?php echo get_lang('EphorusClickHereForADemoAccount') ?></A>
  229. </P>
  230. <P>
  231. <A title="http://www.ephorus.nl:80/dokeos_activate.html" href="http://www.ephorus.nl/dokeos_activate.html" target="_blank"><?php echo get_lang('EphorusClickHereForInformationsAndPrices') ?></A>.
  232. </P>
  233. </TD>
  234. </TR>
  235. </TBODY>
  236. </TABLE>
  237. </P>
  238. </TD>
  239. </TR>
  240. </TBODY>
  241. </TABLE>
  242. </td>
  243. </tr>
  244. </table>
  245. </div>
  246. </div>
  247. */
  248. /*
  249. <!-- SEARCH -->
  250. <div id="main_search">
  251. <div id="extension_header_search" class="accordion_header">
  252. <a href="#"><?php echo get_lang('SearchEngine') ?></a>
  253. </div>
  254. <div id="extension_content_search" style="display:none" class="accordion_content">
  255. <?php echo get_lang('SearchEngineDescription') ?><br /><br />
  256. <table width="100%">
  257. <tr>
  258. <td width="50%">
  259. <?php Display::display_icon('screenshot_search.jpg', get_lang('SearchEngine')); ?>
  260. </td>
  261. <td align="center" width="50%">
  262. <form method="POST" action="<?php echo api_get_self(); ?>">
  263. <input type="hidden" name="extension_code" value="search" />
  264. <button type="submit" class="save" name="activeExtension" value="<?php echo get_lang('ActivateExtension') ?>" ><?php echo get_lang('ActivateExtension') ?></button>
  265. </form>
  266. </td>
  267. </tr>
  268. </table>
  269. </div>
  270. </div>
  271. <!-- SERVER STATS -->
  272. <div id="main_serverstats">
  273. <div id="extension_header_serverstats" class="accordion_header">
  274. <a href="#"><?php echo get_lang('ServerStatistics') ?></a>
  275. </div>
  276. <div id="extension_content_serverstats" style="display:none" class="accordion_content">
  277. <?php echo get_lang('ServerStatisticsDescription') ?><br /><br />
  278. <table width="100%">
  279. <tr>
  280. <td width="50%">
  281. <?php Display::display_icon('screenshot_serverstats.jpg', get_lang('ServerStatistics')); ?>
  282. </td>
  283. <td align="center" width="50%">
  284. <form method="POST" action="<?php echo api_get_self(); ?>">
  285. <input type="hidden" name="extension_code" value="serverstats" />
  286. <button type="submit" class="save" name="activeExtension" value="<?php echo get_lang('ActivateExtension') ?>" ><?php echo get_lang('ActivateExtension') ?></button>
  287. </form>
  288. </td>
  289. </tr>
  290. </table>
  291. </div>
  292. </div>
  293. <!-- BANDWIDTH STATS -->
  294. <div id="main_bandwidthstats">
  295. <div id="extension_header_bandwidthstats" class="accordion_header">
  296. <a href="#"><?php echo get_lang('BandWidthStatistics') ?></a>
  297. </div>
  298. <div id="extension_content_bandwidthstats" style="display:none" class="accordion_content">
  299. <?php echo get_lang('BandWidthStatisticsDescription') ?><br /><br />
  300. <table width="100%">
  301. <tr>
  302. <td width="50%">
  303. <?php Display::display_icon('screenshot_bandwidth.jpg', get_lang('BandWidthStatistics')); ?>
  304. </td>
  305. <td align="center" width="50%">
  306. <form method="POST" action="<?php echo api_get_self(); ?>">
  307. <input type="hidden" name="extension_code" value="bandwidthstats" />
  308. <button type="submit" class="save" name="activeExtension" value="<?php echo get_lang('ActivateExtension') ?>" ><?php echo get_lang('ActivateExtension') ?></button>
  309. </form>
  310. </td>
  311. </tr>
  312. </table>
  313. </div>
  314. </div>
  315. */ ?>
  316. </div><!-- /content -->
  317. <?php
  318. Display::display_footer();