|
|
|
@ -1,5 +1,10 @@ |
|
|
|
|
<?php |
|
|
|
|
/* For licensing terms, see /license.txt */ |
|
|
|
|
|
|
|
|
|
use Chamilo\CoreBundle\Entity\Session; |
|
|
|
|
use Chamilo\UserBundle\Entity\User; |
|
|
|
|
use Chamilo\CoreBundle\Entity\Course; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Courses reporting |
|
|
|
|
* @package chamilo.reporting |
|
|
|
@ -7,8 +12,6 @@ |
|
|
|
|
|
|
|
|
|
require_once __DIR__.'/../inc/global.inc.php'; |
|
|
|
|
|
|
|
|
|
use \Chamilo\CoreBundle\Entity\Session; |
|
|
|
|
|
|
|
|
|
api_block_anonymous_users(true); |
|
|
|
|
|
|
|
|
|
if (api_is_student()) { |
|
|
|
@ -20,21 +23,22 @@ $toolName = get_lang('WorksInSessionReport'); |
|
|
|
|
|
|
|
|
|
$em = Database::getManager(); |
|
|
|
|
$session = null; |
|
|
|
|
$sessionsInfo = api_is_platform_admin() |
|
|
|
|
? SessionManager::get_sessions_list() |
|
|
|
|
: Tracking::get_sessions_coached_by_user(api_get_user_id()); |
|
|
|
|
|
|
|
|
|
if (api_is_platform_admin()) { |
|
|
|
|
$sessionList = SessionManager::get_sessions_list(); |
|
|
|
|
} else { |
|
|
|
|
$sessionList = Tracking::get_sessions_coached_by_user(api_get_user_id()); |
|
|
|
|
} |
|
|
|
|
$form = new FormValidator('work_report', 'GET'); |
|
|
|
|
$selectSession = $form->addSelect('session', get_lang('Session'), [0 => get_lang('None')]); |
|
|
|
|
$form->addButtonFilter(get_lang('Filter')); |
|
|
|
|
|
|
|
|
|
foreach ($sessionsInfo as $sessionInfo) { |
|
|
|
|
foreach ($sessionList as $sessionInfo) { |
|
|
|
|
$selectSession->addOption($sessionInfo['name'], $sessionInfo['id']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (isset($_GET['session']) && intval($_GET['session'])) { |
|
|
|
|
$form->setDefaults(['session' => intval($_GET['session'])]); |
|
|
|
|
|
|
|
|
|
/** @var Session $session */ |
|
|
|
|
$session = $em->find('ChamiloCoreBundle:Session', intval($_GET['session'])); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -45,11 +49,13 @@ if ($session) { |
|
|
|
|
$sessionCourses = $session->getCourses(); |
|
|
|
|
|
|
|
|
|
foreach ($sessionCourses as $sessionCourse) { |
|
|
|
|
/** @var Course $course */ |
|
|
|
|
$course = $sessionCourse->getCourse(); |
|
|
|
|
$coursesInfo[$course->getId()] = $course->getCode(); |
|
|
|
|
$userCourseSubscriptions = $session->getUserCourseSubscriptionsByStatus($course, Session::STUDENT); |
|
|
|
|
|
|
|
|
|
foreach ($userCourseSubscriptions as $userCourseSubscription) { |
|
|
|
|
/** @var User $user */ |
|
|
|
|
$user = $userCourseSubscription->getUser(); |
|
|
|
|
|
|
|
|
|
if (!array_key_exists($user->getId(), $usersInfo)) { |
|
|
|
@ -85,7 +91,12 @@ if ($session) { |
|
|
|
|
$session->getId() |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
$lastPublication = Tracking::getLastStudentPublication($user, 'work', $course, $session); |
|
|
|
|
$lastPublication = Tracking::getLastStudentPublication( |
|
|
|
|
$user, |
|
|
|
|
'work', |
|
|
|
|
$course, |
|
|
|
|
$session |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if (!$lastPublication) { |
|
|
|
|
continue; |
|
|
|
|