if ($profileId > 0) {
             $skill_data = $skill_profile->updateProfileInfo($profileId, $params['name'], $params['description']);
         } else {
             $skill_data = $skill_profile->save($params);
         }
         if (!empty($skill_data)) {
             echo 1;
         } else {
             echo 0;
         }
     }
     break;
 case 'delete_profile':
     if (api_is_platform_admin() || api_is_drh()) {
         $profileId = $_REQUEST['profile'];
         $skillProfile = new SkillProfile();
         $isDeleted = $skillProfile->delete($profileId);
         echo json_encode(array('status' => $isDeleted));
     }
     break;
 case 'skill_exists':
     $skill_data = $skill->get($_REQUEST['skill_id']);
     if (!empty($skill_data)) {
         echo 1;
     } else {
         echo 0;
     }
     break;
 case 'search_skills':
     $skills = $skill->find('all', ['where' => ['name LIKE %?% ' => $_REQUEST['q']]]);
     $returnSkills = [];
/* For licensing terms, see /license.txt */
/**
 *  @package chamilo.admin
 */
use ChamiloSession as Session;
$cidReset = true;
//require_once '../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
if (api_get_setting('skill.allow_skills_tool') != 'true') {
    api_not_allowed();
}
$interbreadcrumb[] = array('url' => 'index.php', "name" => get_lang('PlatformAdmin'));
$skill = new Skill();
$skill_profile = new SkillProfile();
$skill_rel_user = new SkillRelUser();
$url = api_get_path(WEB_AJAX_PATH) . 'skill.ajax.php';
$tpl = new Template(get_lang('Skills'));
$form = new FormValidator('profile_search');
$form->addElement('header', get_lang('SearchSkills'));
$form->addElement('select', 'skills', null, null, array('id' => 'skills'));
$form->addButtonSearch(get_lang('Search'));
$profiles = $skill_profile->get_all();
$tpl->assign('profiles', $profiles);
$total_skills_to_search = array();
if ($form->validate()) {
    $values = $form->getSubmitValues();
    $skills = $values['skills'];
    if (!empty($skills)) {
        $hidden_skills = isset($values['hidden_skills']) ? $values['hidden_skills'] : array();
         if (!empty($_REQUEST['skill_id']) && !empty($_REQUEST['gradebook_id'])) {
             $skill_item = $skill_gradebook->get_skill_info($_REQUEST['skill_id'], $_REQUEST['gradebook_id']);
             if (!empty($skill_item)) {
                 $skill_gradebook->delete($skill_item['id']);
                 echo 1;
             } else {
                 echo 0;
             }
         } else {
             echo 0;
         }
     }
     break;
 case 'save_profile':
     if (api_is_platform_admin() || api_is_drh()) {
         $skill_profile = new SkillProfile();
         $params = $_REQUEST;
         //$params['skills'] = isset($_SESSION['skills']) ? $_SESSION['skills'] : null;
         $params['skills'] = $params['skill_id'];
         $skill_data = $skill_profile->save($params);
         if (!empty($skill_data)) {
             echo 1;
         } else {
             echo 0;
         }
     }
     break;
 case 'skill_exists':
     $skill_data = $skill->get($_REQUEST['skill_id']);
     if (!empty($skill_data)) {
         echo 1;