|
|
|
@ -57,9 +57,23 @@ require_once api_get_path(LIBRARY_PATH).'WCAG/WCAG_rendering.php'; |
|
|
|
|
require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php'; |
|
|
|
|
require_once api_get_path(LIBRARY_PATH).'course_category.lib.php'; |
|
|
|
|
|
|
|
|
|
$htmlHeadXtra[] = '<script> |
|
|
|
|
$(function() { |
|
|
|
|
$("#all_langs").change(function() { |
|
|
|
|
var checkboxes = $(this).closest("form").find("#table_langs").find(":checkbox"); |
|
|
|
|
if($(this).is(":checked")) { |
|
|
|
|
checkboxes.attr("checked", "checked"); |
|
|
|
|
} else { |
|
|
|
|
checkboxes.removeAttr("checked"); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
</script>'; |
|
|
|
|
|
|
|
|
|
global $_configuration; |
|
|
|
|
|
|
|
|
|
$action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : null; |
|
|
|
|
$tbl_category = Database::get_main_table(TABLE_MAIN_CATEGORY); |
|
|
|
|
$tool_name = get_lang('ConfigureHomePage'); |
|
|
|
|
$_languages = api_get_languages(); |
|
|
|
|
|
|
|
|
@ -208,9 +222,10 @@ if (!empty($action)) { |
|
|
|
|
$fp = fopen($homep.$topf.'_'.$lang.$ext, 'w'); |
|
|
|
|
fputs($fp, $home_top); |
|
|
|
|
fclose($fp); |
|
|
|
|
if ($_POST['all_langs']) { |
|
|
|
|
|
|
|
|
|
foreach ($_languages['name'] as $key => $value) { |
|
|
|
|
$lang_name = $_languages['folder'][$key]; |
|
|
|
|
if (isset($_POST[$lang_name])) { |
|
|
|
|
if (file_exists($homep.$topf.'_'.$lang_name.$ext)) { |
|
|
|
|
if (is_writable($homep.$topf.'_'.$lang_name.$ext)) { |
|
|
|
|
$fp = fopen($homep.$topf.'_'.$lang_name.$ext, 'w'); |
|
|
|
@ -220,6 +235,7 @@ if (!empty($action)) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
$errorMsg = get_lang('HomePageFilesNotWritable'); |
|
|
|
|
} |
|
|
|
@ -228,17 +244,20 @@ if (!empty($action)) { |
|
|
|
|
$fp = fopen($homep.$topf.'_'.$lang.$ext, 'w'); |
|
|
|
|
fputs($fp, $home_top); |
|
|
|
|
fclose($fp); |
|
|
|
|
if ($_POST['all_langs']) { |
|
|
|
|
|
|
|
|
|
foreach ($_languages['name'] as $key => $value) { |
|
|
|
|
$lang_name = $_languages['folder'][$key]; |
|
|
|
|
if (isset($_POST[$lang_name])) { |
|
|
|
|
if (file_exists($homep.$topf.'_'.$lang_name.$ext)) { |
|
|
|
|
$fp = fopen($homep.$topf.'_'.$lang_name.$ext, 'w'); |
|
|
|
|
fputs($fp, $home_top); |
|
|
|
|
fclose($fp); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (EventsMail::check_if_using_class('portal_homepage_edited')) { |
|
|
|
|
EventsDispatcher::events('portal_homepage_edited',array('about_user' => api_get_user_id())); |
|
|
|
|
} |
|
|
|
@ -257,9 +276,10 @@ if (!empty($action)) { |
|
|
|
|
$fp = fopen($homep.$noticef.'_'.$lang.$ext, 'w'); |
|
|
|
|
if ($errorMsg == '') { |
|
|
|
|
fputs($fp, "<b>$notice_title</b><br />\n$notice_text"); |
|
|
|
|
if ($_POST['all_langs']) { |
|
|
|
|
|
|
|
|
|
foreach ($_languages['name'] as $key => $value) { |
|
|
|
|
$lang_name = $_languages['folder'][$key]; |
|
|
|
|
if (isset($_POST[$lang_name])) { |
|
|
|
|
if (file_exists($homep.$noticef.'_'.$lang_name.$ext)) { |
|
|
|
|
if (is_writable($homep.$noticef.'_'.$lang_name.$ext)) { |
|
|
|
|
$fp = fopen($homep.$noticef.'_'.$lang_name.$ext, 'w'); |
|
|
|
@ -269,15 +289,18 @@ if (!empty($action)) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
fputs($fp, ''); |
|
|
|
|
if ($_POST['all_langs']) { |
|
|
|
|
|
|
|
|
|
foreach ($_languages['name'] as $key => $value) { |
|
|
|
|
$lang_name = $_languages['folder'][$key]; |
|
|
|
|
if (isset($_POST[$lang_name])) { |
|
|
|
|
if (file_exists($homep.$noticef.'_'.$lang_name.$ext)) { |
|
|
|
|
$fp1 = fopen($homep.$noticef.'_'.$lang_name.$ext, 'w'); |
|
|
|
|
fputs($fp1, ''); |
|
|
|
|
fclose($fp1); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -463,9 +486,10 @@ if (!empty($action)) { |
|
|
|
|
fputs($fp, $home_menu); |
|
|
|
|
home_tabs($homep.$menuf.'_'.$lang.$ext); |
|
|
|
|
fclose($fp); |
|
|
|
|
if (!empty($_POST['all_langs'])) { |
|
|
|
|
|
|
|
|
|
foreach ($_languages['name'] as $key => $value) { |
|
|
|
|
$lang_name = $_languages['folder'][$key]; |
|
|
|
|
if (isset($_POST[$lang_name])) { |
|
|
|
|
if (file_exists($homep.$menuf.'_'.$lang_name.$ext)) { |
|
|
|
|
if (is_writable($homep.$menuf.'_'.$lang_name.$ext)) { |
|
|
|
|
$fp = fopen($homep.$menuf.'_'.$lang_name.$ext, 'w'); |
|
|
|
@ -476,6 +500,7 @@ if (!empty($action)) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (file_exists($homep.$menuf.$ext)) { |
|
|
|
|
if (is_writable($homep.$menuf.$ext)) { |
|
|
|
|
$fpo = fopen($homep.$menuf.$ext, 'w'); |
|
|
|
@ -493,14 +518,16 @@ if (!empty($action)) { |
|
|
|
|
fputs($fp, $home_menu); |
|
|
|
|
home_tabs($homep.$menuf.'_'.$lang.$ext); |
|
|
|
|
fclose($fp); |
|
|
|
|
if ($_POST['all_langs']) { |
|
|
|
|
|
|
|
|
|
foreach ($_languages['name'] as $key => $value) { |
|
|
|
|
$lang_name = $_languages['folder'][$key]; |
|
|
|
|
if (isset($_POST[$lang_name])) { |
|
|
|
|
if (file_exists($homep.$menuf.'_'.$lang_name.$ext)) { |
|
|
|
|
$fp = fopen($homep.$menuf.'_'.$lang_name.$ext, 'w'); |
|
|
|
|
fputs($fp, $home_menu); |
|
|
|
|
home_tabs($homep.$menuf.'_'.$lang_name.$ext); |
|
|
|
|
fclose($fp); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -849,7 +876,24 @@ switch ($action) { |
|
|
|
|
$form->add_html_editor('link_html', get_lang('Content'), false, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400')); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'), 1); |
|
|
|
|
$form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'), array('id' => 'all_langs')); |
|
|
|
|
$form->addElement('html','<table id="table_langs" style="margin-left:159px;"><tr>'); |
|
|
|
|
$i = 0; |
|
|
|
|
foreach ($_languages['name'] as $key => $value) { |
|
|
|
|
$i++; |
|
|
|
|
$lang_name = $_languages['folder'][$key]; |
|
|
|
|
if (file_exists($homep.$topf.'_'.$lang_name.$ext)) { |
|
|
|
|
$html_langs = '<td width="300">'; |
|
|
|
|
$html_langs .= '<label><input type="checkbox" id="lang" name="'.$lang_name.'" /> '.$lang_name.'<label/>'; |
|
|
|
|
$html_langs .= '</td>'; |
|
|
|
|
if($i%5 == 0) { |
|
|
|
|
$html_langs .= '</tr><tr>'; |
|
|
|
|
} |
|
|
|
|
$form->addElement('html', $html_langs); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$form->addElement('html','</tr></table><br/>'); |
|
|
|
|
$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -873,7 +917,6 @@ switch ($action) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$default = array(); |
|
|
|
|
|
|
|
|
|
$form = new FormValidator('configure_homepage_'.$action, 'post', api_get_self().'?action='.$action, '', array('style' => 'margin: 0px;')); |
|
|
|
|
$renderer =& $form->defaultRenderer(); |
|
|
|
|
$renderer->setHeaderTemplate(''); |
|
|
|
@ -909,7 +952,24 @@ switch ($action) { |
|
|
|
|
$default[$name] = str_replace('{rel_path}', api_get_path(REL_PATH), $open); |
|
|
|
|
$form->add_html_editor($name, '', true, false, array('ToolbarSet' => 'PortalHomePage', 'Width' => '100%', 'Height' => '400')); |
|
|
|
|
} |
|
|
|
|
$form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'), 1); |
|
|
|
|
$form->addElement('checkbox', 'all_langs', null, get_lang('ApplyAllLanguages'),array('id' => 'all_langs')); |
|
|
|
|
$form->addElement('html','<table id="table_langs" style="margin-left:5px;"><tr>'); |
|
|
|
|
$i = 0; |
|
|
|
|
foreach ($_languages['name'] as $key => $value) { |
|
|
|
|
$i++; |
|
|
|
|
$lang_name = $_languages['folder'][$key]; |
|
|
|
|
if (file_exists($homep.$topf.'_'.$lang_name.$ext)) { |
|
|
|
|
$html_langs = '<td width="300">'; |
|
|
|
|
$html_langs .= '<label><input type="checkbox" id="lang" name="'.$lang_name.'" /> '.$lang_name.'<label/>'; |
|
|
|
|
$html_langs .= '</td>'; |
|
|
|
|
if($i%5 == 0) { |
|
|
|
|
$html_langs .= '</tr><tr>'; |
|
|
|
|
} |
|
|
|
|
$form->addElement('html', $html_langs); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$form->addElement('html','</tr></table><br/>'); |
|
|
|
|
$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"'); |
|
|
|
|
$form->setDefaults($default); |
|
|
|
|
$form->display(); |
|
|
|
@ -1112,6 +1172,7 @@ switch ($action) { |
|
|
|
|
?> |
|
|
|
|
</ul> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
</td> |
|
|
|
|
</tr> |
|
|
|
|
</table> |
|
|
|
|