Skill: Interface improvements between skill levels and skill level profiles - refs BT#20381

pull/4495/head
Yannick Warnier 3 years ago
parent f4592fc8db
commit d7b54bf6db
  1. 2
      main/admin/skill.php
  2. 21
      main/admin/skill_level.php
  3. 2
      main/admin/skill_profile.php
  4. 4
      main/template/default/admin/skill.tpl
  5. 11
      main/template/default/admin/skill_profile.tpl

@ -21,7 +21,7 @@ if (isset($_GET['action']) && in_array($_GET['action'], ['add', 'edit', 'delete'
$action = $_GET['action'];
}
$id = isset($_GET['id']) ? $_GET['id'] : '';
$id = isset($_GET['id']) ? (int) $_GET['id'] : '';
$item = null;
if (!empty($id)) {

@ -25,6 +25,8 @@ if (isset($_GET['action']) && in_array($_GET['action'], ['add', 'edit', 'delete'
$id = isset($_GET['id']) ? $_GET['id'] : '';
$profileId = !empty($_GET['profile_id']) ? (int) $_GET['profile_id'] : 0;
$item = null;
if (!empty($id)) {
/** @var Level $item */
@ -40,7 +42,14 @@ $form->addText('short_name', get_lang('ShortName'));
$form->addSelectFromCollection('profile_id', get_lang('Profile'), $profiles);
$form->addHidden('action', $action);
$form->addHidden('id', $id);
$form->addButtonSave(get_lang('Save'));
// Submit buttons
if ($action == 'edit') {
$form->addButtonSave(get_lang('Save'));
} elseif ($action == 'add') {
$html_results_enabled[] = $form->createElement('button', 'submit', get_lang('Add'), 'plus', 'primary');
$html_results_enabled[] = $form->createElement('button', 'submit_plus', get_lang('Add').'+', 'plus', 'primary');
$form->addGroup($html_results_enabled);
}
if (!empty($item)) {
$form->setDefaults([
@ -48,13 +57,17 @@ if (!empty($item)) {
'short_name' => $item->getShortName(),
'profile_id' => $item->getProfile()->getId(),
]);
} elseif (!empty($profileId)) {
$form->setDefaults([
'profile_id' => $profileId
]);
}
$formToDisplay = '';
$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
$interbreadcrumb[] = ['url' => api_get_path(WEB_CODE_PATH).'admin/skill.php', 'name' => get_lang('ManageSkillsLevels')];
$interbreadcrumb[] = ['url' => api_get_self(), 'name' => get_lang('SkillLevel')];
$interbreadcrumb[] = ['url' => api_get_self(), 'name' => get_lang('SkillLevels')];
switch ($action) {
case 'add':
@ -77,6 +90,10 @@ switch ($action) {
} else {
Display::addFlash(Display::return_message(get_lang('YouNeedToCreateASkillProfile')));
}
if (isset($values['submit_plus'])) {
header('Location: '.$listAction.'?action=add');
exit;
}
header('Location: '.$listAction);
exit;
}

@ -46,7 +46,7 @@ $formToDisplay = $form->returnForm();
$interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')];
$interbreadcrumb[] = ['url' => api_get_path(WEB_CODE_PATH).'admin/skill.php', 'name' => get_lang('ManageSkillsLevels')];
$interbreadcrumb[] = ['url' => api_get_self(), 'name' => get_lang('SkillProfile')];
$interbreadcrumb[] = ['url' => api_get_self(), 'name' => get_lang('SkillLevelProfiles')];
$toolbar = null;

@ -2,12 +2,12 @@
<ul>
<li>
<a href="{{ _p.web_main }}{{ 'admin/skill_profile.php' }}">
{{ 'AddProfile' | get_lang }}
{{ 'SkillLevelProfiles' | get_lang }}
</a>
</li>
<li>
<a href="{{ _p.web_main }}{{ 'admin/skill_level.php' }}">
{{ 'AddLevel' | get_lang }}
{{ 'SkillLevels' | get_lang }}
</a>
</li>
</ul>

@ -10,9 +10,6 @@
<tr>
<td>
{{ item.name }}
{#<a href="{{ _p.web_main }}admin/skill_level.php?action=add_level&id={{ item.id }}">#}
{#<img src="{{ 'add.png'|icon(22) }}">#}
{#</a>#}
</td>
<td>
<ul>
@ -41,10 +38,14 @@
</td>
<td>
<a href="{{ _p.web_main }}admin/skill_profile.php?action=edit&id={{ item.id }}">
<img src="{{ 'edit.png'|icon(22) }}"> </a>
<img src="{{ 'edit.png'|icon(22) }}" alt="{{ 'Edit' | get_lang }}" title="{{ 'Edit' | get_lang }}"> </a>
<a href="{{ _p.web_main }}admin/skill_profile.php?action=delete&id={{ item.id }}">
<img src="{{ 'delete.png'|icon(22) }}">
<img src="{{ 'delete.png'|icon(22) }}" alt="{{ 'Delete' | get_lang }}" title="{{ 'Delete' | get_lang }}">
</a>
<a href="{{ _p.web_main }}admin/skill_level.php?action=add&profile_id={{ item.id }}">
<img src="{{ 'add.png'|icon(22) }}" alt="{{ 'AddLevel' | get_lang }}" title="{{ 'AddLevel' | get_lang }}">
</a>
</td>
</tr>

Loading…
Cancel
Save