-
+ $html = '
'.$content.'
';
-
return $html;
}
diff --git a/main/course_home/course_home.php b/main/course_home/course_home.php
index d692fccad2..93c1147e47 100755
--- a/main/course_home/course_home.php
+++ b/main/course_home/course_home.php
@@ -286,18 +286,8 @@ if (api_get_setting('homepage_view') == 'activity' ||
require 'vertical_activity.php';
}
-$editIconButton = '';
-// The icons customization is only available in the base course at this time
-if (api_is_allowed_to_edit() && empty($sessionId)) {
- $editIconButton = '
'.Display::url(
- get_lang('CustomizeIcons'),
- api_get_path(WEB_CODE_PATH).'course_info/tools.php?'.api_get_cidreq(),
- ['class' => 'btn btn-default' ]
- );
- $editIconButton .= '
';
-}
-$content = '
'.$editIconButton.$content.'
';
+$content = '
'.$content.'
';
$tpl = new Template(null);
$tpl->assign('message', $show_message);
$tpl->assign('content', $content);
diff --git a/main/course_info/tools.php b/main/course_info/tools.php
index eb4a1a5bc4..1dffde023f 100644
--- a/main/course_info/tools.php
+++ b/main/course_info/tools.php
@@ -35,7 +35,7 @@ switch ($action) {
api_not_allowed(true);
}
- $interbreadcrumb[] = array('url' => api_get_self().'?'.api_get_cidreq(), 'name' => get_lang('Tools'));
+ $interbreadcrumb[] = array('url' => api_get_self().'?'.api_get_cidreq(), 'name' => get_lang('CustomizeIcons'));
$toolName = $tool['name'];
@@ -43,9 +43,18 @@ switch ($action) {
$form = new FormValidator('icon_edit', 'post', $currentUrl);
$form->addElement('header', get_lang('EditIcon'));
+ $form->addHtml('
');
$form->addElement('text', 'name', get_lang('Name'));
$form->addElement('text', 'link', get_lang('Links'));
-
+ $allowed_picture_types = array ('jpg', 'jpeg', 'png');
+ $form->addElement('file', 'icon', get_lang('CustomIcon'));
+ $form->addRule('icon', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types);
+ $form->addElement('select', 'target', get_lang('Target'), array('_self' => '_self', '_blank' => '_blank'));
+ $form->addElement('select', 'visibility', get_lang('Visibility'), array(1 => get_lang('Visible'), 0 => get_lang('Invisible')));
+ $form->addElement('textarea', 'description', get_lang('Description'),array ('rows' => '3', 'cols' => '40'));
+ $form->addButtonUpdate(get_lang('Update'));
+ $form->addHtml('
');
+ $form->addHtml('
');
if (isset($tool['custom_icon']) && !empty($tool['custom_icon'])) {
$form->addLabel(
get_lang('Icon'),
@@ -56,15 +65,8 @@ switch ($action) {
$form->addCheckBox('delete_icon', null, get_lang('DeletePicture'));
}
+ $form->addHtml('
');
- $allowed_picture_types = array ('jpg', 'jpeg', 'png');
- $form->addElement('file', 'icon', get_lang('CustomIcon'));
- $form->addRule('icon', get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')', 'filetype', $allowed_picture_types);
-
- $form->addElement('select', 'target', get_lang('Target'), array('_self' => '_self', '_blank' => '_blank'));
- $form->addElement('select', 'visibility', get_lang('Visibility'), array(1 => get_lang('Visible'), 0 => get_lang('Invisible')));
- $form->addElement('textarea', 'description', get_lang('Description'),array ('rows' => '3', 'cols' => '40'));
- $form->addButtonUpdate(get_lang('Update'));
$form->setDefaults($tool);
@@ -77,40 +79,76 @@ switch ($action) {
if (isset($data['delete_icon'])) {
CourseHome::deleteIcon($id);
}
-
- header('Location: '.$currentUrl);
+ $currentUrlReturn = api_get_self().'?'.api_get_cidreq();
+ header('Location: '.$currentUrlReturn);
exit;
}
break;
case 'list':
default:
- $toolName = get_lang('Tools');
+
$toolList = CourseHome::toolsIconsAction(
api_get_course_int_id(),
api_get_session_id()
);
-
- $table = '
';
+ $iconsTools = '';
+ $iconsTools .= Display::page_header( get_lang('CustomizeIcons'),null,'h4');
+ $iconsTools .= '
';
foreach ($toolList as $tool) {
- $table .= '
';
- $table .= '
- | ';
- $table .= '' .
- $tool['name']. ' | ';
- $table .= '
- ' .
- get_lang('Edit'). ' | ';
- $delete = (!empty($tool['custom_icon'])) ? '' .
- get_lang('Delete'). '' : '';
- $table .= '' . $delete . ' | ';
- $table .= '
';
+
+ if ($tool['id']>20) {
+ $toolName = $tool['name'];
+ } else {
+ $toolName = get_lang('Tool'.api_underscore_to_camel_case($tool['name']));
+ }
+
+ $iconsTools .= '
';
+ $iconsTools .= '
';
+ $iconsTools .= '
';
}
- $table .= '
';
- $content = $table;
+ $iconsTools .= '