Display::addFlash(Display::return_message(sprintf(get_lang('SkillXEnabled'), $skill->getName()), 'success')); } header('Location: ' . api_get_self()); exit; break; case 'disable': $skill = $entityManager->find('ChamiloCoreBundle:Skill', $skillId); if (is_null($skill)) { Display::addFlash(Display::return_message(get_lang('SkillNotFound'), 'error')); } else { $updatedAt = new DateTime(api_get_utc_datetime(), new DateTimeZone(_api_get_timezone())); $skill->setStatus(0); $skill->setUpdatedAt($updatedAt); $entityManager->persist($skill); $skillObj = new Skill(); $childrens = $skillObj->get_children($skill->getId()); foreach ($childrens as $children) { $skill = $entityManager->find('ChamiloCoreBundle:Skill', $children['id']); if (empty($skill)) { continue; } $skill->setStatus(0); $skill->setUpdatedAt($updatedAt); $entityManager->persist($skill); } $entityManager->flush(); Display::addFlash(Display::return_message(sprintf(get_lang('SkillXDisabled'), $skill->getName()), 'success')); } header('Location: ' . api_get_self()); exit; break;
break; case 'get_user_skills': $skills = $skill->get_user_skills($user_id, true); Display::display_no_header(); Display::$global_template->assign('skills', $skills); echo Display::$global_template->fetch('default/skill/user_skills.tpl'); break; case 'get_gradebook_info': $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : null; $info = $gradebook->get($id); echo json_encode($info); break; case 'load_children': $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : null; $load_user_data = isset($_REQUEST['load_user_data']) ? $_REQUEST['load_user_data'] : null; $skills = $skill->get_children($id, $load_user_data); $return = array(); foreach ($skills as $skill) { if (isset($skill['data']) && !empty($skill['data'])) { $return[$skill['data']['id']] = array('id' => $skill['data']['id'], 'name' => $skill['data']['name'], 'passed' => $skill['data']['passed']); } } $success = true; if (empty($return)) { $success = false; } $result = array('success' => $success, 'data' => $return); echo json_encode($result); break; case 'load_direct_parents': $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : null;