|
|
|
|
@ -1,9 +1,11 @@ |
|
|
|
|
<?php |
|
|
|
|
/* For licensing terms, see /license.txt */ |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Configure the portal homepage (manages multi-urls and languages) |
|
|
|
|
* @package chamilo.admin |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Creates menu tabs for logged and anonymous users |
|
|
|
|
* |
|
|
|
|
@ -44,7 +46,7 @@ function home_tabs($file_logged_in) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$language_file = array('index','admin', 'accessibility'); |
|
|
|
|
$language_file = array('index', 'admin', 'accessibility'); |
|
|
|
|
$cidReset = true; |
|
|
|
|
require_once '../inc/global.inc.php'; |
|
|
|
|
|
|
|
|
|
@ -78,10 +80,17 @@ $tbl_category = Database::get_main_table(TABLE_MAIN_CATEGORY); |
|
|
|
|
$tool_name = get_lang('ConfigureHomePage'); |
|
|
|
|
$_languages = api_get_languages(); |
|
|
|
|
|
|
|
|
|
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
|
|
|
$interbreadcrumb[] = array( |
|
|
|
|
'url' => 'index.php', |
|
|
|
|
'name' => get_lang('PlatformAdmin') |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if (!empty($action)) { |
|
|
|
|
$interbreadcrumb[] = array('url' => 'configure_homepage.php', 'name' => get_lang('ConfigureHomePage')); |
|
|
|
|
$interbreadcrumb[] = array( |
|
|
|
|
'url' => 'configure_homepage.php', |
|
|
|
|
'name' => get_lang('ConfigureHomePage') |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
switch ($action) { |
|
|
|
|
case 'edit_top': |
|
|
|
|
$tool_name = get_lang('EditHomePage'); |
|
|
|
|
@ -165,7 +174,7 @@ $noticef = 'home_notice'; //noticef for Notice File |
|
|
|
|
$menutabs= 'home_tabs'; //menutabs for tabs Menu |
|
|
|
|
$mtloggedin= 'home_tabs_logged_in'; //menutabs for tabs Menu |
|
|
|
|
$ext = '.html'; //ext for HTML Extension - when used frequently, variables are |
|
|
|
|
// faster than hardcoded strings |
|
|
|
|
// faster than hardcoded strings |
|
|
|
|
$homef = array($menuf, $newsf, $topf, $noticef, $menutabs, $mtloggedin); |
|
|
|
|
|
|
|
|
|
// If language-specific file does not exist, create it by copying default file |
|
|
|
|
@ -229,7 +238,7 @@ if (!empty($action)) { |
|
|
|
|
$fp = fopen($homep.$topf.'_'.$lang.$ext, 'w'); |
|
|
|
|
fputs($fp, $home_top); |
|
|
|
|
fclose($fp); |
|
|
|
|
|
|
|
|
|
var_dump($_languages['name']);exit; |
|
|
|
|
foreach ($_languages['name'] as $key => $value) { |
|
|
|
|
$lang_name = $_languages['folder'][$key]; |
|
|
|
|
if (isset($_POST[$lang_name])) { |
|
|
|
|
@ -242,7 +251,6 @@ if (!empty($action)) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
$errorMsg = get_lang('HomePageFilesNotWritable'); |
|
|
|
|
} |
|
|
|
|
@ -530,7 +538,13 @@ if (!empty($action)) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
event_system(LOG_HOMEPAGE_CHANGED, $action, cut($link_name.':'.$link_url, 254), api_get_utc_datetime(), api_get_user_id()); |
|
|
|
|
event_system( |
|
|
|
|
LOG_HOMEPAGE_CHANGED, |
|
|
|
|
$action, |
|
|
|
|
cut($link_name . ':' . $link_url, 254), |
|
|
|
|
api_get_utc_datetime(), |
|
|
|
|
api_get_user_id() |
|
|
|
|
); |
|
|
|
|
break; |
|
|
|
|
} //end of switch($action) |
|
|
|
|
|
|
|
|
|
@ -885,6 +899,7 @@ switch ($action) { |
|
|
|
|
$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]; |
|
|
|
|
@ -920,7 +935,13 @@ switch ($action) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$default = array(); |
|
|
|
|
$form = new FormValidator('configure_homepage_'.$action, 'post', api_get_self().'?action='.$action, '', array('style' => 'margin: 0px;')); |
|
|
|
|
$form = new FormValidator( |
|
|
|
|
'configure_homepage_'.$action, |
|
|
|
|
'post', |
|
|
|
|
api_get_self().'?action='.$action, |
|
|
|
|
'', |
|
|
|
|
array('style' => 'margin: 0px;') |
|
|
|
|
); |
|
|
|
|
$renderer =& $form->defaultRenderer(); |
|
|
|
|
$renderer->setHeaderTemplate(''); |
|
|
|
|
$renderer->setFormTemplate('<form{attributes}><table border="0" cellpadding="5" cellspacing="0" width="100%">{content}</table></form>'); |
|
|
|
|
@ -944,6 +965,7 @@ switch ($action) { |
|
|
|
|
$html .= '</select></td></tr>'; |
|
|
|
|
$form->addElement('html', $html); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (api_get_setting('wcag_anysurfer_public_pages') == 'true') { |
|
|
|
|
//TODO: review these lines |
|
|
|
|
// Print WCAG-specific HTML editor |
|
|
|
|
@ -958,18 +980,17 @@ switch ($action) { |
|
|
|
|
$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) { |
|
|
|
|
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"'); |
|
|
|
|
@ -983,8 +1004,12 @@ switch ($action) { |
|
|
|
|
<tr> |
|
|
|
|
<td width="70%" valign="top"> |
|
|
|
|
<div class="actions"> |
|
|
|
|
<a href="<?php echo api_get_self(); ?>?action=edit_top"><?php Display::display_icon('edit.gif', get_lang('EditHomePage')); ?></a>
|
|
|
|
|
<a href="<?php echo api_get_self(); ?>?action=edit_top"><?php echo get_lang('EditHomePage'); ?></a>
|
|
|
|
|
<a href="<?php echo api_get_self(); ?>?action=edit_top">
|
|
|
|
|
<?php Display::display_icon('edit.gif', get_lang('EditHomePage')); ?> |
|
|
|
|
</a> |
|
|
|
|
<a href="<?php echo api_get_self(); ?>?action=edit_top">
|
|
|
|
|
<?php echo get_lang('EditHomePage'); ?> |
|
|
|
|
</a> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<table border="0" cellpadding="5" cellspacing="0" width="100%"> |
|
|
|
|
|