syncparams.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. $cidReset = true;
  4. require_once '../../../main/inc/global.inc.php';
  5. api_protect_admin_script();
  6. $action = isset($_GET['what']) ? $_GET['what'] : '';
  7. define('CHAMILO_INTERNAL', true);
  8. $plugin = VChamiloPlugin::create();
  9. $thisurl = api_get_path(WEB_PLUGIN_PATH).'vchamilo/views/manage.php';
  10. if ($action) {
  11. require_once(api_get_path(SYS_PLUGIN_PATH).'vchamilo/views/syncparams.controller.php');
  12. }
  13. $settings = api_get_settings();
  14. $table = new HTML_Table(array('class' => 'data_table', 'width' => '100%'));
  15. $column = 0;
  16. $row = 0;
  17. // $table->set_additional_parameters($parameters);
  18. $headers = array(
  19. '',
  20. $plugin->get_lang('variable').' ['.$plugin->get_lang('subkey').']',
  21. $plugin->get_lang('category'),
  22. $plugin->get_lang('accessurl'),
  23. $plugin->get_lang('value'),
  24. '',
  25. );
  26. $attrs = array('center' => 'left');
  27. $table->addRow($headers, $attrs, 'th');
  28. foreach ($settings as $param) {
  29. if ($param['subkey'] == 'vchamilo') {
  30. continue;
  31. }
  32. // $check = '<input type="checkbox" name="sync_'.$param->id.'" value="'.$param->selected_value.'" />';
  33. //<input type="checkbox" name="del_'.$param['id'].'" value="1" title="'.$plugin->get_lang('deleteifempty').'" />
  34. $check = '';
  35. $attrs = array('center' => 'left');
  36. $syncthisbutton = '<input type="button" name="syncthis" value="'.$plugin->get_lang('syncthis').'" onclick="ajax_sync_setting(\''.$_configuration['root_web'].'\', \''.$param['id'].'\')" />
  37. <span id="res_'.$param['id'].'"></span>';
  38. $data = array(
  39. $check,
  40. isset($param['subkey']) && !empty($param['subkey']) ? $param['variable'].' ['.$param['subkey'].']' : $param['variable'],
  41. $param['category'],
  42. $param['access_url'],
  43. '<input type="text" name="value_'.$param['id'].'" value="'.htmlspecialchars($param['selected_value'], ENT_COMPAT, 'UTF-8' ).'" />'.
  44. '<br />Master value: '.$param['selected_value'],
  45. $syncthisbutton,
  46. );
  47. $row = $table->addRow($data, $attrs, 'td');
  48. $table->setRowAttributes($row, array('id' => 'row_'.$param['id']), true);
  49. }
  50. $content = '<form name="settingsform" action="'.$thisurl.'">';
  51. $content .= '<input type="hidden" name="what" value="" />';
  52. $content .= $table->toHtml();
  53. // $content .= '<div class"vchamilo-right"><div></div><div><input type="button" name="syncall" value="'.$plugin->get_lang('syncall').'" onclick="this.form.what.value=\'syncall\';this.form.submit();">';
  54. $content .= '</form>';
  55. $actions = '';
  56. Display::addFlash(Display::return_message($plugin->get_lang('Sync your master settings to all instances.')));
  57. $message = require_js('ajax.js', 'vchamilo', true);
  58. $interbreadcrumb[] = array('url' => 'manage.php', 'name' => get_lang('VChamilo'));
  59. $tpl = new Template($plugin->get_lang('sync_settings'), true, true, false, true, false);
  60. $tpl->assign('actions', $actions);
  61. $tpl->assign('message', $message);
  62. $tpl->assign('content', $content);
  63. $tpl->display_one_col_template();