Display the extra content in admin panels - refs BT#9325

1.9.x
Angel Fernando Quiroz Campos 10 years ago
parent 646a600e3e
commit 64d4c41450
  1. 41
      main/admin/index.php
  2. 6
      main/inc/ajax/admin.ajax.php
  3. 4
      main/template/default/admin/settings_index.tpl

@ -26,6 +26,21 @@ api_protect_admin_script(true);
$nameTools = get_lang('PlatformAdmin');
if (api_is_multiple_url_enabled()) {
$accessUrlId = api_get_current_access_url_id();
if ($accessUrlId != -1) {
$urlInfo = api_get_access_url($accessUrlId);
$url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $urlInfo['url']));
$cleanUrl = replace_dangerous_char($url);
$cleanUrl = str_replace('/', '-', $cleanUrl);
$adminExtraContentDir = api_get_path(SYS_PATH) . "home/$cleanUrl/admin/";
}
} else {
$adminExtraContentDir = api_get_path(SYS_PATH) . "home/admin/";
}
// Displaying the header
$message = '';
@ -67,6 +82,12 @@ $blocks['users']['icon'] = Display::return_icon('members.gif', get_lang('Users'
$blocks['users']['label'] = api_ucfirst(get_lang('Users'));
$blocks['users']['class'] = 'block-admin-users';
$usersBlockExtraFile = "{$adminExtraContentDir}block-admin-users_extra.html";
if (file_exists($usersBlockExtraFile)) {
$blocks['users']['extraContent'] = file_get_contents($usersBlockExtraFile);
}
if (api_is_platform_admin()) {
$blocks['users']['editable'] = true;
@ -112,6 +133,12 @@ if (api_is_platform_admin()) {
$blocks['courses']['class'] = 'block-admin-courses';
$blocks['courses']['editable'] = true;
$coursesBlockExtraFile = "{$adminExtraContentDir}block-admin-courses_extra.html";
if (file_exists($coursesBlockExtraFile)) {
$blocks['courses']['extraContent'] = file_get_contents($coursesBlockExtraFile);
}
$search_form = ' <form method="get" class="form-search" action="course_list.php">
<input class="span3" type="text" name="keyword" value="">
<button class="btn" type="submit">'.get_lang('Search').'</button>
@ -150,7 +177,13 @@ if (api_is_platform_admin()) {
$blocks['platform']['icon'] = Display::return_icon('platform.png', get_lang('Platform'), array(), ICON_SIZE_MEDIUM, false);
$blocks['platform']['label'] = api_ucfirst(get_lang('Platform'));
$blocks['platform']['class'] = 'block-admin-platform';
$blocks['platform']['editable'] =true;
$blocks['platform']['editable'] = true;
$platformBlockExtraFile = "{$adminExtraContentDir}block-admin-platform_extra.html";
if (file_exists($platformBlockExtraFile)) {
$blocks['platform']['extraContent'] = file_get_contents($platformBlockExtraFile);
}
$search_form = ' <form method="get" action="settings.php" class="form-search">
<input class="span3" type="text" name="search_field" value="" >
@ -197,6 +230,12 @@ $blocks['sessions']['icon'] = Display::return_icon('session.png', get_lang('Ses
$blocks['sessions']['label'] = api_ucfirst(get_lang('Sessions'));
$blocks['sessions']['class'] = 'block-admin-sessions';
$sessionsBlockExtraFile = "{$adminExtraContentDir}block-admin-sessions_extra.html";
if (file_exists($sessionsBlockExtraFile)) {
$blocks['sessions']['extraContent'] = file_get_contents($sessionsBlockExtraFile);
}
if (api_is_platform_admin()) {
$blocks['sessions']['editable'] = true;
}

@ -62,12 +62,10 @@ switch ($action) {
}
if (!is_dir($newUrlDir)) {
mkdir($newUrlDir, api_get_permissions_for_new_directories());
mkdir($newUrlDir, api_get_permissions_for_new_directories(), true);
}
$fullFilePath = "{$newUrlDir}{$blockId}_extra.txt";
echo $fullFilePath;
$fullFilePath = "{$newUrlDir}{$blockId}_extra.html";
if (file_exists($fullFilePath)) {
unlink($fullFilePath);

@ -66,6 +66,10 @@ $(document).ready(function() {
{{ block_item.extra }}
</div>
{% endif %}
{% if block_item.extraContent %}
<div>{{ block_item.extraContent }}</div>
{% endif %}
</div>
</div>
{% endfor %}

Loading…
Cancel
Save