configure_extensions.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Edition of extensions configuration
  5. * @package chamilo.admin
  6. */
  7. $cidReset=true;
  8. //require_once '../inc/global.inc.php';
  9. $this_section=SECTION_PLATFORM_ADMIN;
  10. api_protect_admin_script();
  11. $interbreadcrumb[] = array ('url' => Container::getRouter()->generate('administration'), 'name' => get_lang('PlatformAdmin'));
  12. // Database Table Definitions
  13. $tbl_settings_current = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
  14. $message = '';
  15. if (isset($_POST['activeExtension'])) {
  16. switch ($_POST['extension_code']) {
  17. case 'ppt2lp' :
  18. $sql = 'UPDATE '.$tbl_settings_current.' SET
  19. selected_value="true"
  20. WHERE variable="service_ppt2lp"
  21. AND subkey="active"';
  22. $rs = Database::query($sql);
  23. if (Database::affected_rows($rs)>0){
  24. $message = get_lang('ServiceActivated');
  25. }
  26. $sql = 'UPDATE '.$tbl_settings_current.' SET
  27. selected_value="'.addslashes($_POST['host']).'"
  28. WHERE variable="service_ppt2lp"
  29. AND subkey="host"';
  30. Database::query($sql);
  31. $sql = 'UPDATE '.$tbl_settings_current.' SET
  32. selected_value="'.addslashes($_POST['port']).'"
  33. WHERE variable="service_ppt2lp"
  34. AND subkey="port"';
  35. Database::query($sql);
  36. $sql = 'UPDATE '.$tbl_settings_current.' SET
  37. selected_value="'.addslashes($_POST['ftp_password']).'"
  38. WHERE variable="service_ppt2lp"
  39. AND subkey="ftp_password"';
  40. Database::query($sql);
  41. $sql = 'UPDATE '.$tbl_settings_current.' SET
  42. selected_value="'.addslashes($_POST['user']).'"
  43. WHERE variable="service_ppt2lp"
  44. AND subkey="user"';
  45. Database::query($sql);
  46. $sql = 'UPDATE '.$tbl_settings_current.' SET
  47. selected_value="'.addslashes($_POST['path_to_lzx']).'"
  48. WHERE variable="service_ppt2lp"
  49. AND subkey="path_to_lzx"';
  50. Database::query($sql);
  51. $sql = 'UPDATE '.$tbl_settings_current.' SET
  52. selected_value="'.addslashes($_POST['size']).'"
  53. WHERE variable="service_ppt2lp"
  54. AND subkey="size"';
  55. Database::query($sql);
  56. break;
  57. }
  58. }
  59. $listActiveServices = array();
  60. // get the list of active services
  61. $sql = 'SELECT variable FROM '.$tbl_settings_current.'
  62. WHERE variable LIKE "service_%" AND subkey="active" and selected_value="true"';
  63. $rs = Database::query($sql);
  64. while($row = Database::fetch_array($rs)){
  65. $listActiveServices[] = $row['variable'];
  66. }
  67. // javascript to handle accordion behaviour
  68. $javascript_message = '';
  69. if(!empty($message)){
  70. $javascript_message = '
  71. document.getElementById("message").style.display = "block";
  72. var timer = setTimeout(hideMessage, 5000);';
  73. }
  74. $htmlHeadXtra[]= '<script>
  75. var listeDiv;
  76. var extensionsHeader = new Array();
  77. var extensionsContent = new Array();
  78. window.onload = loadTables;
  79. function loadTables(){
  80. '.$javascript_message.'
  81. var listeDiv = document.getElementsByTagName("div");
  82. // fill extensionsHeader and extensionsContent
  83. for(var i=0 ; i < listeDiv.length ; i++){
  84. if(listeDiv[i].id.indexOf(\'extension_header\')!=-1){
  85. listeDiv[i].onclick = afficheContent;
  86. extensionsHeader.push(listeDiv[i]);
  87. }
  88. if(listeDiv[i].id.indexOf("extension_content")!=-1){
  89. extensionsContent.push(listeDiv[i]);
  90. }
  91. }
  92. }
  93. function hideMessage(){
  94. document.getElementById("message").style.display = "none";
  95. }
  96. function afficheContent(event){
  97. var id = this.id.replace("header","content");
  98. switch(document.getElementById(id).style.display){
  99. case "block" :
  100. document.getElementById(id).style.display = "none";
  101. break;
  102. case "none" :
  103. document.getElementById(id).style.display = "block";
  104. for(var i=0 ; i < extensionsContent.length ; i++){
  105. if(extensionsContent[i].id != id)
  106. extensionsContent[i].style.display = "none";
  107. }
  108. break;
  109. }
  110. }
  111. </script>';
  112. $nameTool = get_lang('ConfigureExtensions');
  113. Display::display_header($nameTool);
  114. ?>
  115. <div id="message" style="display: none">
  116. <?php
  117. if(!empty($message))
  118. Display::display_normal_message($message)
  119. ?>
  120. </div>
  121. <div id="content" align="center">
  122. <!-- INSTRUCTIONS TO ADD AN EXTENSION HERE
  123. - copy paste a "main_*" div
  124. - set the names of the subdiv to extension_header_yourextension and extension_content_yourextension
  125. - extension_content_yourextension is the hidden div where you have to put your form / activation process
  126. - extension_header_yourextension is the name of your extension
  127. - you do not need to add javascript to display / hide your divs
  128. - please fill free to improve the global display of the document
  129. -->
  130. <!-- VISIOCONFERENCE -->
  131. <?php /*
  132. <div id="main_visio">
  133. <div id="extension_header_visio" class="accordion_header">
  134. <a href="#"><?php echo get_lang('Visioconf') ?></a>
  135. </div>
  136. <div id="extension_content_visio" style="display:none" class="accordion_content">
  137. <?php echo get_lang('VisioconfDescription') ?><br /><br />
  138. <table width="100%">
  139. <tr>
  140. <td align="center">
  141. <?php Display::display_icon('screenshot_conf.jpg', get_lang('Visioconf')); ?>
  142. </td>
  143. <td align="center" width="50%">
  144. <?php
  145. $form = new FormValidator('visio');
  146. $form -> addElement('text', 'visio_host', get_lang('VisioHost'));
  147. $form -> addElement('html','<br /><br />');
  148. $form -> addElement('text', 'visio_port', get_lang('VisioPort'));
  149. $form -> addElement('html','<br /><br />');
  150. $form -> addElement('text', 'visio_pass', get_lang('VisioPassword'));
  151. $form -> addElement('html','<br /><br />');
  152. $group = array();
  153. $group[] =& HTML_QuickForm::createElement('radio', 'visio_use_rtmpt',null,get_lang('Yes'),'true');
  154. $group[] =& HTML_QuickForm::createElement('radio', 'visio_use_rtmpt',null,get_lang('No'),'false');
  155. $form->addGroup($group, '', get_lang('VisioUseRtmptTitle').' ('.get_lang('VisioUseRtmptComment').')', '&nbsp;');
  156. //$form -> addElement('text', 'visio_is_web_rtmp', get_lang('VisioRTMPIsWeb'));
  157. //$form -> addElement('html','<br /><br />');
  158. $form -> addElement('hidden', 'extension_code', 'visio');
  159. $defaults = array();
  160. $renderer = $form -> defaultRenderer();
  161. $renderer -> setElementTemplate('<div style="text-align:left">{label}</div><div style="text-align:left">{element}</div>');
  162. $form -> addElement('html','<br /><br />');
  163. if(in_array('service_visio',$listActiveServices))
  164. {
  165. $sql = 'SELECT subkey, selected_value FROM '.$tbl_settings_current.'
  166. WHERE variable = "service_visio"';
  167. $rs = Database::query($sql);
  168. while($row = Database::fetch_array($rs,'ASSOC'))
  169. {
  170. $defaults[$row['subkey']] = $row['selected_value'];
  171. }
  172. $form -> addElement('style_submit_button', 'activeExtension', get_lang('ReconfigureExtension'),'class="save"');
  173. }
  174. else {
  175. $form -> addElement('style_submit_button', 'activeExtension', get_lang('ActivateExtension'),'class="save"');
  176. }
  177. $form -> setDefaults($defaults);
  178. $form -> display();
  179. ?>
  180. </td>
  181. </tr>
  182. </table>
  183. </div>
  184. </div>
  185. */ ?>
  186. <!-- PPT2LP -->
  187. <div class="chamilo-rapid">
  188. <div class="row">
  189. <div class="col-md-12">
  190. <?php echo Display::panel(get_lang('Ppt2lpDescription').' '.get_lang('Ppt2lpVoiceRecordingNeedsRed5'), get_lang('Ppt2lp')) ?>
  191. </div>
  192. </div>
  193. <div class="row">
  194. <div class="col-md-5">
  195. <?php Display::display_icon('screenshot_ppt2lp.jpg', get_lang('Ppt2lp'), array('class'=>'img-responsive')); ?>
  196. </div>
  197. <div class="col-md-7">
  198. <form method="POST" class="form-horizontal" action="<?php echo api_get_self(); ?>">
  199. <?php
  200. $form = new FormValidator('ppt2lp');
  201. $form -> addElement('text', 'host', get_lang('Host'));
  202. //$form -> addElement('html','<br /><br />');
  203. $form -> addElement('text', 'port', get_lang('Port'));
  204. //$form -> addElement('html','<br /><br />');
  205. $form -> addElement('text', 'user', get_lang('UserOnHost'));
  206. //$form -> addElement('html','<br /><br />');
  207. $form -> addElement('text', 'ftp_password', get_lang('FtpPassword'));
  208. //$form -> addElement('html','<br /><br />');
  209. $form -> addElement('text', 'path_to_lzx', get_lang('PathToLzx'));
  210. //$form -> addElement('html','<br /><br />');
  211. $options = array(
  212. '540x405'=>'540x405',
  213. '640x480'=>'640x480',
  214. '720x540'=>'720x540',
  215. '800x600'=>'800x600',
  216. '1000x750'=>'1000x750'
  217. );
  218. $form -> addElement('select', 'size', get_lang('SlideSize'), $options);
  219. $form -> addElement('hidden', 'extension_code', 'ppt2lp');
  220. $defaults = array();
  221. $renderer = $form -> defaultRenderer();
  222. $renderer -> setElementTemplate('<div style="text-align:left">{label}</div><div style="text-align:left">{element}</div>');
  223. //$form -> addElement('html','<br /><br />');
  224. if(in_array('service_ppt2lp',$listActiveServices))
  225. {
  226. $sql = 'SELECT subkey, selected_value FROM '.$tbl_settings_current.'
  227. WHERE variable = "service_ppt2lp"
  228. AND subkey <> "active"';
  229. $rs = Database::query($sql);
  230. while($row = Database::fetch_array($rs,'ASSOC'))
  231. {
  232. $defaults[$row['subkey']] = $row['selected_value'];
  233. }
  234. $form->addButtonSave(get_lang('ReconfigureExtension'), 'activeExtension');
  235. }
  236. else {
  237. $defaults['host'] = 'localhost';
  238. $defaults['port'] = '2002';
  239. $defaults['size'] = '720x540';
  240. $form->addButtonSave(get_lang('ActivateExtension'), 'activeExtension');
  241. }
  242. $form -> setDefaults($defaults);
  243. $form -> display();
  244. echo '<br />';
  245. ?>
  246. </form>
  247. </div>
  248. </div>
  249. </div>
  250. <?php
  251. /*
  252. <!-- EPHORUS -->
  253. <div id="main_ephorus">
  254. <div id="extension_header_ephorus" class="accordion_header">
  255. <a href="#"><?php echo get_lang('EphorusPlagiarismPrevention') ?></a>
  256. </div>
  257. <div id="extension_content_ephorus" style="display:none;padding:0;width:780px;" class="accordion_content">
  258. <table width="100%" cellpadding="0" cellspacing="0">
  259. <tr>
  260. <td align="center">
  261. <TABLE style="WIDTH: 750px" cellSpacing="0" cellPadding="0" align="middle" border="0">
  262. <TBODY>
  263. <TR>
  264. <TD>
  265. <TABLE style="WIDTH: 475px" cellSpacing="0" cellPadding="0" border="0">
  266. <TBODY>
  267. <TR>
  268. <TD>
  269. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  270. <a title="http://www.ephorus.com/dokeos_activate.html" href="http://www.ephorus.com/dokeos_activate.html" target="_blank">
  271. <?php Display::display_icon('ephorus.gif','Ephorus'); ?>
  272. </a>
  273. </TD>
  274. <TD>
  275. <P align=center>
  276. <FONT color="#669966" size="3"><?php echo get_lang('EphorusLeadersInAntiPlagiarism') ?></FONT>
  277. </P>
  278. </TD>
  279. </TR>
  280. </TBODY>
  281. </TABLE>
  282. </TD>
  283. </TR>
  284. <TR>
  285. <TD>
  286. <P>
  287. <TABLE style="WIDTH: 85%" cellSpacing="0" cellPadding="0" border="0">
  288. <TBODY>
  289. <TR>
  290. <TD width="50">&nbsp;
  291. </TD>
  292. <TD>
  293. <P>
  294. <?php echo get_lang('EphorusDescription') ?>
  295. </P>
  296. <P>
  297. <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>
  298. </P>
  299. <P>
  300. <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>.
  301. </P>
  302. </TD>
  303. </TR>
  304. </TBODY>
  305. </TABLE>
  306. </P>
  307. </TD>
  308. </TR>
  309. </TBODY>
  310. </TABLE>
  311. </td>
  312. </tr>
  313. </table>
  314. </div>
  315. </div>
  316. */
  317. /*
  318. <!-- SEARCH -->
  319. <div id="main_search">
  320. <div id="extension_header_search" class="accordion_header">
  321. <a href="#"><?php echo get_lang('SearchEngine') ?></a>
  322. </div>
  323. <div id="extension_content_search" style="display:none" class="accordion_content">
  324. <?php echo get_lang('SearchEngineDescription') ?><br /><br />
  325. <table width="100%">
  326. <tr>
  327. <td width="50%">
  328. <?php Display::display_icon('screenshot_search.jpg', get_lang('SearchEngine')); ?>
  329. </td>
  330. <td align="center" width="50%">
  331. <form method="POST" action="<?php echo api_get_self(); ?>">
  332. <input type="hidden" name="extension_code" value="search" />
  333. <button type="submit" class="save" name="activeExtension" value="<?php echo get_lang('ActivateExtension') ?>" ><?php echo get_lang('ActivateExtension') ?></button>
  334. </form>
  335. </td>
  336. </tr>
  337. </table>
  338. </div>
  339. </div>
  340. <!-- SERVER STATS -->
  341. <div id="main_serverstats">
  342. <div id="extension_header_serverstats" class="accordion_header">
  343. <a href="#"><?php echo get_lang('ServerStatistics') ?></a>
  344. </div>
  345. <div id="extension_content_serverstats" style="display:none" class="accordion_content">
  346. <?php echo get_lang('ServerStatisticsDescription') ?><br /><br />
  347. <table width="100%">
  348. <tr>
  349. <td width="50%">
  350. <?php Display::display_icon('screenshot_serverstats.jpg', get_lang('ServerStatistics')); ?>
  351. </td>
  352. <td align="center" width="50%">
  353. <form method="POST" action="<?php echo api_get_self(); ?>">
  354. <input type="hidden" name="extension_code" value="serverstats" />
  355. <button type="submit" class="save" name="activeExtension" value="<?php echo get_lang('ActivateExtension') ?>" ><?php echo get_lang('ActivateExtension') ?></button>
  356. </form>
  357. </td>
  358. </tr>
  359. </table>
  360. </div>
  361. </div>
  362. <!-- BANDWIDTH STATS -->
  363. <div id="main_bandwidthstats">
  364. <div id="extension_header_bandwidthstats" class="accordion_header">
  365. <a href="#"><?php echo get_lang('BandWidthStatistics') ?></a>
  366. </div>
  367. <div id="extension_content_bandwidthstats" style="display:none" class="accordion_content">
  368. <?php echo get_lang('BandWidthStatisticsDescription') ?><br /><br />
  369. <table width="100%">
  370. <tr>
  371. <td width="50%">
  372. <?php Display::display_icon('screenshot_bandwidth.jpg', get_lang('BandWidthStatistics')); ?>
  373. </td>
  374. <td align="center" width="50%">
  375. <form method="POST" action="<?php echo api_get_self(); ?>">
  376. <input type="hidden" name="extension_code" value="bandwidthstats" />
  377. <button type="submit" class="save" name="activeExtension" value="<?php echo get_lang('ActivateExtension') ?>" ><?php echo get_lang('ActivateExtension') ?></button>
  378. </form>
  379. </td>
  380. </tr>
  381. </table>
  382. </div>
  383. </div>
  384. */ ?>
  385. </div><!-- /content -->
  386. <?php
  387. Display::display_footer();