|
|
|
|
@ -21,8 +21,6 @@ $settings = api_get_settings(); |
|
|
|
|
$table = new HTML_Table(array('class' => 'data_table', 'width' => '100%')); |
|
|
|
|
$column = 0; |
|
|
|
|
$row = 0; |
|
|
|
|
|
|
|
|
|
// $table->set_additional_parameters($parameters); |
|
|
|
|
$headers = array( |
|
|
|
|
'', |
|
|
|
|
$plugin->get_lang('variable').' ['.$plugin->get_lang('subkey').']', |
|
|
|
|
@ -35,24 +33,22 @@ $attrs = array('center' => 'left'); |
|
|
|
|
$table->addRow($headers, $attrs, 'th'); |
|
|
|
|
|
|
|
|
|
foreach ($settings as $param) { |
|
|
|
|
|
|
|
|
|
if ($param['subkey'] == 'vchamilo') { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
// $check = '<input type="checkbox" name="sync_'.$param->id.'" value="'.$param->selected_value.'" />'; |
|
|
|
|
//<input type="checkbox" name="del_'.$param['id'].'" value="1" title="'.$plugin->get_lang('deleteifempty').'" /> |
|
|
|
|
$check = ''; |
|
|
|
|
$attrs = array('center' => 'left'); |
|
|
|
|
$syncthisbutton = '<input type="button" name="syncthis" value="'.$plugin->get_lang('syncthis').'" onclick="ajax_sync_setting(\''.$_configuration['root_web'].'\', \''.$param['id'].'\')" /> |
|
|
|
|
<span id="res_'.$param['id'].'"></span>'; |
|
|
|
|
$syncButton = ' |
|
|
|
|
<input class="btn btn-default" type="button" name="syncthis" value="'.$plugin->get_lang('syncthis').'" onclick="ajax_sync_setting(\''.$param['id'].'\')" /> |
|
|
|
|
<span id="res_'.$param['id'].'"></span>'; |
|
|
|
|
$data = array( |
|
|
|
|
$check, |
|
|
|
|
isset($param['subkey']) && !empty($param['subkey']) ? $param['variable'].' ['.$param['subkey'].']' : $param['variable'], |
|
|
|
|
$param['category'], |
|
|
|
|
$param['access_url'], |
|
|
|
|
'<input type="text" name="value_'.$param['id'].'" value="'.htmlspecialchars($param['selected_value'], ENT_COMPAT, 'UTF-8' ).'" />'. |
|
|
|
|
'<input type="text" disabled name="value_'.$param['id'].'" value="'.htmlspecialchars($param['selected_value'], ENT_COMPAT, 'UTF-8' ).'" />'. |
|
|
|
|
'<br />Master value: '.$param['selected_value'], |
|
|
|
|
$syncthisbutton, |
|
|
|
|
$syncButton, |
|
|
|
|
); |
|
|
|
|
$row = $table->addRow($data, $attrs, 'td'); |
|
|
|
|
$table->setRowAttributes($row, array('id' => 'row_'.$param['id']), true); |
|
|
|
|
@ -61,18 +57,29 @@ foreach ($settings as $param) { |
|
|
|
|
$content = '<form name="settingsform" action="'.$thisurl.'">'; |
|
|
|
|
$content .= '<input type="hidden" name="what" value="" />'; |
|
|
|
|
$content .= $table->toHtml(); |
|
|
|
|
// $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();">'; |
|
|
|
|
$content .= '</form>'; |
|
|
|
|
$actions = ''; |
|
|
|
|
|
|
|
|
|
Display::addFlash(Display::return_message($plugin->get_lang('Sync your master settings to all instances.'))); |
|
|
|
|
|
|
|
|
|
$message = require_js('ajax.js', 'vchamilo', true); |
|
|
|
|
|
|
|
|
|
$interbreadcrumb[] = array('url' => 'manage.php', 'name' => get_lang('VChamilo')); |
|
|
|
|
$htmlHeadXtra[] = "<script> |
|
|
|
|
function ajax_sync_setting(settingid) { |
|
|
|
|
var webUrl = '".api_get_path(WEB_PATH)."'; |
|
|
|
|
var spare = $('#row_'+settingid).html(); |
|
|
|
|
var formobj = document.forms['settingsform']; |
|
|
|
|
var url = webUrl + 'plugin/vchamilo/ajax/service.php?what=syncthis&settingid='+settingid+'&value='+encodeURIComponent(formobj.elements['value_'+settingid].value); |
|
|
|
|
|
|
|
|
|
$('#row_'+settingid).html('<td colspan=\"7\"><img src=\"'+webUrl+'plugin/vchamilo/pix/ajax_waiter.gif\" /></td>'); |
|
|
|
|
|
|
|
|
|
$.get(url, function (data) { |
|
|
|
|
$('#row_'+settingid).html(spare); |
|
|
|
|
$('#res_'+settingid).html(data); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
</script>"; |
|
|
|
|
|
|
|
|
|
$tpl = new Template($plugin->get_lang('sync_settings'), true, true, false, true, false); |
|
|
|
|
$tpl = new Template($plugin->get_lang('SyncSettings'), true, true, false, true, false); |
|
|
|
|
$tpl->assign('actions', $actions); |
|
|
|
|
$tpl->assign('message', $message); |
|
|
|
|
$tpl->assign('content', $content); |
|
|
|
|
$tpl->display_one_col_template(); |
|
|
|
|
|