Plugin: LTI: Improve form in session context

#4114
pull/4141/head
Angel Fernando Quiroz Campos 4 years ago
parent 8d30d63ad5
commit 90da89c45a
  1. 12
      plugin/ims_lti/multiply_session.php
  2. 4
      plugin/ims_lti/session.php

@ -25,10 +25,6 @@ try {
$ltiToolId = $request->query->getInt('id');
$sessionId = $request->query->getInt('session_id');
if (empty($sessionId)) {
api_not_allowed();
}
/** @var ImsLtiTool $tool */
$tool = $em->find('ChamiloPluginBundle:ImsLti\ImsLtiTool', $ltiToolId);
@ -40,6 +36,12 @@ try {
throw new Exception($plugin->get_lang('NoAllowed'));
}
$session = api_get_session_entity($sessionId);
if (!$session) {
api_not_allowed(true);
}
$content = '';
$courses = ImsLtiPlugin::getCoursesForParentTool($tool);
@ -54,6 +56,7 @@ try {
$selectedCoursesIds = array_keys($slctCourses);
$form = new FormValidator('frm_multiply', 'post', api_get_self().'?id='.$tool->getId().'&session_id='.$sessionId);
$form->addLabel(get_lang('SessionName'), $session);
$form->addLabel($plugin->get_lang('Tool'), $tool->getName());
$form->addSelectAjax(
'courses',
@ -105,7 +108,6 @@ try {
if ($newSelectedCourseIds) {
foreach ($newSelectedCourseIds as $newSelectedCourseId) {
$newSelectedCourse = api_get_course_entity($newSelectedCourseId);
$session = api_get_session_entity($sessionId);
$newTool = clone $tool;
$newTool->setParent($tool);

@ -79,8 +79,8 @@ try {
$interbreadcrumb[] = ['url' => api_get_path(WEB_CODE_PATH).'admin/index.php', 'name' => get_lang('PlatformAdmin')];
$interbreadcrumb[] = ['url' => api_get_path(WEB_PLUGIN_PATH).'ims_lti/admin.php', 'name' => $plugin->get_title()];
$template = new Template($plugin->get_lang('AddInCourses'));
$template->assign('header', $plugin->get_lang('AddInCourses'));
$template = new Template($plugin->get_lang('AddInSessions'));
$template->assign('header', $plugin->get_lang('AddInSessions'));
$template->assign('content', $content);
$template->display_one_col_template();
} catch (Exception $exception) {

Loading…
Cancel
Save