parent
4826375032
commit
98ef2b54cb
@ -0,0 +1,86 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
use Chamilo\SkillBundle\Entity\SkillRelCourse; |
||||
|
||||
$cidReset = true; |
||||
require_once __DIR__.'/../inc/global.inc.php'; |
||||
|
||||
if (api_get_configuration_value('allow_skill_rel_items') == false) { |
||||
api_not_allowed(true); |
||||
} |
||||
|
||||
$courseId = isset($_GET['course_id']) ? (int) $_GET['course_id'] : 0; |
||||
|
||||
$course = api_get_course_entity($courseId); |
||||
if (empty($course)) { |
||||
api_not_allowed(true); |
||||
} |
||||
|
||||
$sessionId = isset($_GET['session_id']) ? (int) $_GET['session_id'] : null; |
||||
|
||||
$url = api_get_self().'?course_id='.$courseId.'&session_id='.$sessionId; |
||||
$form = new FormValidator('skills', 'post', $url); |
||||
|
||||
$sessionName = $course->getTitleAndCode(); |
||||
if (!empty($sessionId)) { |
||||
$session = api_get_session_entity($sessionId); |
||||
$courseExistsInSession = SessionManager::sessionHasCourse($sessionId, $course->getCode()); |
||||
if (!$courseExistsInSession) { |
||||
api_not_allowed(true); |
||||
} |
||||
$sessionName = ' '.$session->getName().' - '.$course->getTitleAndCode(); |
||||
} |
||||
|
||||
$form->addHeader(get_lang('AddSkills').$sessionName); |
||||
|
||||
$skillList = []; |
||||
$em = Database::getManager(); |
||||
$items = $em->getRepository('ChamiloSkillBundle:SkillRelCourse')->findBy( |
||||
['course' => $courseId, 'session' => $sessionId] |
||||
); |
||||
/** @var SkillRelCourse $skillRelCourse */ |
||||
foreach ($items as $skillRelCourse) { |
||||
$skillList[$skillRelCourse->getSkill()->getId()] = $skillRelCourse->getSkill()->getName(); |
||||
} |
||||
|
||||
$form->addHidden('course_id', $courseId); |
||||
$form->addHidden('session_id', $sessionId); |
||||
|
||||
$form->addSelectAjax( |
||||
'skills', |
||||
get_lang('Skills'), |
||||
$skillList, |
||||
[ |
||||
'url' => api_get_path(WEB_AJAX_PATH).'skill.ajax.php?a=search_skills', |
||||
'multiple' => 'multiple', |
||||
] |
||||
); |
||||
|
||||
$form->addButtonSave(get_lang('Save')); |
||||
|
||||
$form->setDefaults(['skills' => array_keys($skillList)]); |
||||
|
||||
if ($form->validate()) { |
||||
$result = Skill::saveSkillsToCourseFromForm($form); |
||||
if ($result) { |
||||
Display::addFlash(Display::return_message(get_lang('Updated'))); |
||||
} |
||||
header('Location: '.$url); |
||||
exit; |
||||
} |
||||
$content = $form->returnForm(); |
||||
|
||||
$interbreadcrumb[] = [ |
||||
'url' => api_get_path(WEB_CODE_PATH).'session/session_list.php', |
||||
'name' => get_lang('SessionList'), |
||||
]; |
||||
|
||||
$interbreadcrumb[] = [ |
||||
'url' => api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session='.$sessionId, |
||||
'name' => get_lang('SessionOverview'), |
||||
]; |
||||
|
||||
$template = new Template(get_lang('SkillRelCourses')); |
||||
$template->assign('content', $content); |
||||
$template->display_one_col_template(); |
||||
@ -0,0 +1,87 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
use Chamilo\SkillBundle\Entity\SkillRelItem; |
||||
|
||||
require_once __DIR__.'/../inc/global.inc.php'; |
||||
|
||||
if (api_get_configuration_value('allow_skill_rel_items') == false) { |
||||
api_not_allowed(true); |
||||
} |
||||
|
||||
api_protect_course_script(); |
||||
GradebookUtils::block_students(); |
||||
$courseId = api_get_course_int_id(); |
||||
$sessionId = api_get_session_id(); |
||||
|
||||
$userId = isset($_GET['user_id']) ? (int) $_GET['user_id'] : 0; |
||||
$categoryId = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0; |
||||
$userInfo = api_get_user_info($userId); |
||||
|
||||
if (empty($userInfo)) { |
||||
api_not_allowed(true); |
||||
} |
||||
|
||||
$skills = Skill::getSkillRelItemsPerCourse($courseId, $sessionId); |
||||
$uniqueSkills = []; |
||||
$itemsPerSkill = []; |
||||
$uniqueSkillsConclusion = []; |
||||
$skillRelUser = new SkillRelUser(); |
||||
$userSkills = $skillRelUser->getUserSkills($userId, api_get_course_int_id(), api_get_session_id()); |
||||
$userSkillsList = []; |
||||
if (!empty($userSkills)) { |
||||
foreach ($userSkills as $userSkill) { |
||||
$userSkillsList[] = $userSkill['skill_id']; |
||||
} |
||||
} |
||||
|
||||
$em = Database::getManager(); |
||||
$codePath = api_get_path(WEB_CODE_PATH); |
||||
/** @var SkillRelItem $skill */ |
||||
foreach ($skills as $skill) { |
||||
$skillId = $skill->getSkill()->getId(); |
||||
$uniqueSkills[$skillId] = $skill->getSkill(); |
||||
$itemInfo = Skill::getItemInfo($skill->getItemId(), $skill->getItemType()); |
||||
|
||||
$criteria = [ |
||||
'user' => $userId, |
||||
'skillRelItem' => $skill, |
||||
]; |
||||
/** @var \Chamilo\SkillBundle\Entity\SkillRelItemRelUser $skillRelItemRelUser */ |
||||
$skillRelItemRelUser = $em->getRepository('ChamiloSkillBundle:SkillRelItemRelUser')->findOneBy($criteria); |
||||
$itemInfo['status'] = $skillRelItemRelUser ? true : false; |
||||
$itemInfo['url_activity'] = $codePath.$skill->getItemResultList(api_get_cidreq()); |
||||
if ($skillRelItemRelUser) { |
||||
$itemInfo['url_activity'] = $codePath.$skillRelItemRelUser->getUserItemResultUrl(api_get_cidreq()); |
||||
} |
||||
|
||||
$itemsPerSkill[$skillId][]['info'] = $itemInfo; |
||||
} |
||||
foreach ($itemsPerSkill as $skillId => $skillList) { |
||||
$uniqueSkillsConclusion[$skillId] = in_array($skillId, $userSkillsList); |
||||
} |
||||
|
||||
$interbreadcrumb[] = [ |
||||
'url' => Category::getUrl(), |
||||
'name' => get_lang('Gradebook'), |
||||
]; |
||||
$interbreadcrumb[] = [ |
||||
'url' => api_get_path(WEB_CODE_PATH).'gradebook/gradebook_display_summary.php?'.api_get_cidreq().'&selectcat='.$categoryId, |
||||
'name' => get_lang('GradebookListOfStudentsReports'), |
||||
]; |
||||
|
||||
$url = api_get_path(WEB_AJAX_PATH).'skill.ajax.php?a=assign_user_to_skill'; |
||||
|
||||
$template = new Template(get_lang('SkillUserList')); |
||||
$template->assign('conclusion_list', $uniqueSkillsConclusion); |
||||
$template->assign('skills', $uniqueSkills); |
||||
$template->assign('items', $itemsPerSkill); |
||||
$template->assign('user', $userInfo); |
||||
$template->assign('course_id', api_get_course_int_id()); |
||||
$template->assign('session_id', api_get_session_id()); |
||||
$template->assign('assign_user_url', $url); |
||||
|
||||
$templateName = $template->get_template('gradebook/skill_rel_user.tpl'); |
||||
$content = $template->fetch($templateName); |
||||
$template->assign('content', $content); |
||||
$template->display_one_col_template(); |
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,79 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
/** |
||||
* This is a learning path creation and player tool in Chamilo - previously. |
||||
* |
||||
* @author Julio Montoya - Improving the list of templates |
||||
* |
||||
* @package chamilo.learnpath |
||||
*/ |
||||
$this_section = SECTION_COURSES; |
||||
|
||||
require_once __DIR__.'/../inc/global.inc.php'; |
||||
|
||||
api_protect_course_script(); |
||||
$allow = api_is_allowed_to_edit(null, true); |
||||
$lpId = !empty($_GET['lp_id']) ? intval($_GET['lp_id']) : 0; |
||||
|
||||
if (!$allow || empty($lpId)) { |
||||
api_not_allowed(true); |
||||
} |
||||
|
||||
$lp = new learnpath(api_get_course_id(), $lpId, api_get_user_id()); |
||||
|
||||
if (api_is_in_gradebook()) { |
||||
$interbreadcrumb[] = [ |
||||
'url' => Category::getUrl(), |
||||
'name' => get_lang('ToolGradebook'), |
||||
]; |
||||
} |
||||
|
||||
$interbreadcrumb[] = [ |
||||
'url' => 'lp_controller.php?action=list&'.api_get_cidreq(), |
||||
'name' => get_lang('LearningPaths'), |
||||
]; |
||||
$interbreadcrumb[] = [ |
||||
'url' => api_get_self()."?action=build&lp_id=$lpId&".api_get_cidreq(), |
||||
'name' => $lp->get_name(), |
||||
]; |
||||
|
||||
$form = new FormValidator( |
||||
'', |
||||
'POST', |
||||
api_get_self().'?'.api_get_cidreq().'&lp_id='.$lpId, |
||||
'', |
||||
[ |
||||
'id' => "upload_form", |
||||
'enctype' => "multipart/form-data", |
||||
] |
||||
); |
||||
$form->addHeader(get_lang('UpdateFile')); |
||||
$form->addHtml(Display::return_message(get_lang('TheScormPackageWillBeUpdatedYouMustUploadTheFileWithTheSameName'))); |
||||
$form->addLabel(null, Display::return_icon('scorm_logo.jpg', null, ['style' => 'width:230px;height:100px'])); |
||||
$form->addElement('hidden', 'curdirpath', ''); |
||||
$form->addElement('file', 'user_file', get_lang('FileToUpload')); |
||||
$form->addRule('user_file', get_lang('ThisFieldIsRequired'), 'required'); |
||||
$form->addButtonUpload(get_lang('Upload')); |
||||
|
||||
if ($form->validate()) { |
||||
$oScorm = new scorm(); |
||||
$manifest = $oScorm->import_package( |
||||
$_FILES['user_file'], |
||||
'', |
||||
api_get_course_info(), |
||||
true, |
||||
$lp |
||||
); |
||||
if ($manifest) { |
||||
Display::addFlash(Display::return_message(get_lang('Updated'))); |
||||
} |
||||
header('Location: '.api_get_path(WEB_CODE_PATH).'lp/lp_list.php?'.api_get_cidreq()); |
||||
exit; |
||||
} |
||||
|
||||
$content = $form->returnForm(); |
||||
|
||||
$tpl = new Template(null); |
||||
$tpl->assign('content', $content); |
||||
$tpl->display_one_col_template(); |
||||
@ -0,0 +1,59 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
use Chamilo\CoreBundle\Entity\Course; |
||||
use Chamilo\CoreBundle\Entity\Session; |
||||
use Chamilo\CourseBundle\Entity\CSurvey; |
||||
use Chamilo\CourseBundle\Entity\CSurveyInvitation; |
||||
|
||||
$cidReset = true; |
||||
|
||||
require_once __DIR__.'/../inc/global.inc.php'; |
||||
|
||||
api_block_anonymous_users(true); |
||||
|
||||
$em = Database::getManager(); |
||||
|
||||
$currentUser = api_get_user_entity(api_get_user_id()); |
||||
$avatarPath = UserManager::getUserPicture($currentUser->getId()); |
||||
$pending = SurveyUtil::getUserPendingInvitations($currentUser->getId()); |
||||
|
||||
$surveysData = []; |
||||
|
||||
foreach ($pending as $i => $item) { |
||||
if (is_a($item, 'Chamilo\CourseBundle\Entity\CSurveyInvitation')) { |
||||
continue; |
||||
} |
||||
|
||||
/** @var CSurvey $survey */ |
||||
$survey = $item; |
||||
/** @var CSurveyInvitation invitation */ |
||||
$invitation = $pending[$i + 1]; |
||||
/** @var Course $course */ |
||||
$course = $em->find('ChamiloCoreBundle:Course', $survey->getCId()); |
||||
/** @var Session $session */ |
||||
$session = $em->find('ChamiloCoreBundle:Session', $survey->getSessionId()); |
||||
|
||||
$course = $course ? ['id' => $course->getId(), 'title' => $course->getTitle(), 'code' => $course->getCode()] : null; |
||||
$session = $session ? ['id' => $session->getId(), 'name' => $session->getName()] : null; |
||||
$surveysData[$survey->getSurveyId()] = [ |
||||
'title' => $survey->getTitle(), |
||||
'invitation_code' => $invitation->getInvitationCode(), |
||||
'avail_from' => $survey->getAvailFrom(), |
||||
'avail_till' => $survey->getAvailTill(), |
||||
'course' => $course, |
||||
'session' => $session, |
||||
]; |
||||
} |
||||
|
||||
$toolName = get_lang('PendingSurveys'); |
||||
|
||||
$template = new Template($toolName); |
||||
$template->assign('user', $currentUser); |
||||
$template->assign('user_avatar', $avatarPath); |
||||
$template->assign('surveys', $surveysData); |
||||
$layout = $template->get_template('survey/pending.tpl'); |
||||
$content = $template->fetch($layout); |
||||
$template->assign('header', $toolName); |
||||
$template->assign('content', $content); |
||||
$template->display_one_col_template(); |
||||
@ -0,0 +1,77 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
require_once __DIR__.'/../inc/global.inc.php'; |
||||
|
||||
$allow = api_get_configuration_value('allow_user_message_tracking'); |
||||
|
||||
if (!$allow) { |
||||
api_not_allowed(true); |
||||
} |
||||
|
||||
$allowUser = api_is_platform_admin() || api_is_drh(); |
||||
|
||||
if (!$allowUser) { |
||||
api_not_allowed(true); |
||||
} |
||||
|
||||
$fromUserId = isset($_GET['from_user']) ? (int) $_GET['from_user'] : 0; |
||||
$toUserId = isset($_GET['to_user']) ? (int) $_GET['to_user'] : 0; |
||||
if (empty($fromUserId) || empty($toUserId)) { |
||||
api_not_allowed(true); |
||||
} |
||||
|
||||
if (api_is_drh()) { |
||||
$isFollowed = UserManager::is_user_followed_by_drh($fromUserId, api_get_user_id()); |
||||
if (!$isFollowed) { |
||||
api_not_allowed(true); |
||||
} |
||||
} |
||||
|
||||
$usersData[$toUserId] = api_get_user_info($toUserId); |
||||
$usersData[$fromUserId] = api_get_user_info($fromUserId); |
||||
$messages = MessageManager::getAllMessagesBetweenStudents($toUserId, $fromUserId); |
||||
|
||||
$content = Display::page_subheader2(sprintf( |
||||
get_lang('MessagesExchangeBetweenXAndY'), |
||||
$usersData[$toUserId]['complete_name'], |
||||
$usersData[$fromUserId]['complete_name'] |
||||
)); |
||||
|
||||
$interbreadcrumb[] = [ |
||||
'url' => api_get_path(WEB_CODE_PATH).'mySpace/student.php', |
||||
'name' => get_lang('MyStudents'), |
||||
]; |
||||
$interbreadcrumb[] = [ |
||||
'url' => api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?student='.$fromUserId, |
||||
'name' => get_lang('StudentDetails'), |
||||
]; |
||||
|
||||
$uniqueMessageList = []; |
||||
foreach ($messages as $message) { |
||||
$message['title']. |
||||
$subText = get_lang('From').': '.$usersData[$message['user_sender_id']]['complete_name']; |
||||
$title = empty($message['title']) ? get_lang('Untitled') : $message['title']; |
||||
$title = $title.' - '.$subText.'<span class="pull-right">'.Display::dateToStringAgoAndLongDate($message['send_date']).'</span>'; |
||||
$messageId = $message['id']; |
||||
|
||||
$hash = sha1($message['title'].$message['content'].$message['send_date']); |
||||
if (in_array($hash, $uniqueMessageList)) { |
||||
continue; |
||||
} |
||||
|
||||
$content .= Display::panelCollapse( |
||||
$title, |
||||
$message['content'].'<br />'.Display::dateToStringAgoAndLongDate($message['send_date']), |
||||
'message-'.$message['id'], |
||||
null, |
||||
'message-'.$message['id'], |
||||
'collapse-'.$message['id'], |
||||
false |
||||
); |
||||
$uniqueMessageList[] = $hash; |
||||
} |
||||
|
||||
$template = new Template(get_lang('MessageTracking')); |
||||
$template->assign('content', $content); |
||||
$template->display_one_col_template(); |
||||
Loading…
Reference in new issue