'; $htmlHeadXtra[] = ''; $htmlHeadXtra[] =''; api_block_anonymous_users(); $allowToSee = api_is_drh() || api_is_student_boss() || api_is_platform_admin(); if ($allowToSee === false) { api_not_allowed(true); } $userId = api_get_user_id(); $userInfo = api_get_user_info(); $userToLoad = isset($_GET['user_id']) ? $_GET['user_id'] : ''; $userToLoadInfo = []; if ($userToLoad) { $userToLoadInfo = api_get_user_info($userToLoad); } $action = isset($_GET['action']) ? $_GET['action'] : ''; switch ($action) { case 'subscribe_user': $sessionId = isset($_GET['session_id']) ? $_GET['session_id'] : ''; SessionManager::subscribe_users_to_session( $sessionId, [$userToLoad], SESSION_VISIBLE_READ_ONLY, false ); Display::addFlash(Display::return_message(get_lang('UserAdded'))); header("Location: ".api_get_self().'?user_id='.$userToLoad.'#session-table'); exit; break; case 'unsubscribe_user': $sessionId = isset($_GET['session_id']) ? $_GET['session_id'] : ''; SessionManager::unsubscribe_user_from_session($sessionId, $userToLoad); Display::addFlash(Display::return_message(get_lang('Unsubscribed'))); header("Location: ".api_get_self().'?user_id='.$userToLoad.'#session-table'); break; } $em = Database::getManager(); $formSearch = new FormValidator('load', 'get', api_get_self()); $formSearch->addHeader(get_lang('LoadDiagnosis')); if (!empty($userInfo)) { $users = []; switch ($userInfo['status']) { case DRH: $users = UserManager::get_users_followed_by_drh($userId); break; case STUDENT_BOSS: $users = UserManager::getUsersFollowedByStudentBoss($userId); break; } if (!empty($users)) { $userList = []; foreach ($users as $user) { $userList[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']); } $formSearch->addSelect('user_id', get_lang('User'), $userList); } } if ($userToLoad) { $formSearch->setDefaults(['user_id' => $userToLoad]); } $formSearch->addButtonSearch(get_lang('ShowDiagnostic'), 'save'); $form = new FormValidator('search', 'post', api_get_self().'?user_id='.$userToLoad.'#session-table'); $form->addHeader(get_lang('Diagnosis')); $form->addHidden('user_id', $userToLoad); /** @var ExtraFieldSavedSearch $saved */ $search = [ 'user' => $userToLoad ]; $items = $em->getRepository('ChamiloCoreBundle:ExtraFieldSavedSearch')->findBy($search); if (empty($items)) { Display::addFlash(Display::return_message('NoData')); } $defaults = []; $tagsData = []; if (!empty($items)) { /** @var ExtraFieldSavedSearch $item */ foreach ($items as $item) { $variable = 'extra_'.$item->getField()->getVariable(); if ($item->getField()->getFieldType() == ExtraField::FIELD_TYPE_TAG) { $tagsData[$variable] = $item->getValue(); } $defaults[$variable] = $item->getValue(); } } $extraField = new ExtraField('session'); $extraFieldValue = new ExtraFieldValue('session'); $theme = 'theme_fr'; if ($userToLoadInfo) { $lang = $userToLoadInfo['language']; switch ($lang) { case 'french2': case 'french': $theme = 'theme_fr'; break; case 'german2': case 'german': $theme = 'theme_de'; break; } } $extraFieldUser = new ExtraField('user'); $userForm = new FormValidator('user_form', 'post', api_get_self()); $userForm->addHtml('
' . get_lang('FiliereExplanation') .'
'); $fieldsToShow = [ 'statusocial', 'filiere_user', 'filiereprecision', 'filiere_want_stage', ]; $forceShowFields = true; $filter = false; $extra = $extraFieldUser->addElements( $userForm, $userToLoad, [], $filter, true, $fieldsToShow, $fieldsToShow, [], [], false, $forceShowFields, //$forceShowFields = false [], [], $fieldsToShow ); $userForm->addHtml('' . get_lang('DisponibilitePendantMonStageExplanation') . '
'); $fieldsToShow = [ 'datedebutstage', 'datefinstage', 'poursuiteapprentissagestage', 'heures_disponibilite_par_semaine_stage' ]; $extra = $extraFieldUser->addElements( $userForm, $userToLoad, [], $filter, true, $fieldsToShow, $fieldsToShow, [], [], false, $forceShowFields, //$forceShowFields = false [], [], $fieldsToShow ); $userForm->addHtml('' . get_lang('ObjectifsApprentissageExplanation') . '
'); $fieldsToShow = [ 'objectif_apprentissage' ]; $extra = $extraFieldUser->addElements( $userForm, $userToLoad, [], $filter, false, $fieldsToShow, $fieldsToShow, $defaults, [], false, $forceShowFields,//$forceShowFields = false [], [], $fieldsToShow ); $userForm->addHtml('' . get_lang('MethodeTravailExplanation') . '
'); $fieldsToShow = [ 'methode_de_travaille', 'accompagnement' ]; $extra = $extraFieldUser->addElements( $userForm, $userToLoad, [], $filter, true, $fieldsToShow, $fieldsToShow, [], [], false, $forceShowFields, //$forceShowFields = false [], [], $fieldsToShow ); $userForm->addHtml('' . get_lang('DisponibiliteAvantExplanation') . '
'); // Session fields $showOnlyThisFields = [ 'access_start_date', 'access_end_date' ]; $extra = $extraField->addElements( $form, '', [], false, //filter true, $showOnlyThisFields, $showOnlyThisFields, $defaults, [], false, //$orderDependingDefaults true, // force [], // $separateExtraMultipleSelect [] ); $fieldsToShow = [ 'heures_disponibilite_par_semaine', ]; $extra = $extraFieldUser->addElements( $form, $userToLoad, [], $filter, true, $fieldsToShow, $fieldsToShow, [], [], false, $forceShowFields //$forceShowFields = false ); $form->addHtml('' . get_lang('ThemesObjectifsExplanation') . '
'); $showOnlyThisFields = [ 'domaine', 'filiere', $theme, ]; $extra = $extraField->addElements( $form, '', [], false, //filter true, $showOnlyThisFields, $showOnlyThisFields, $defaults, [], false, //$orderDependingDefaults true, // force [ 'domaine' => 3, $theme => 5], // $separateExtraMultipleSelect [ 'domaine' => [ get_lang('Domaine').' 1', get_lang('Domaine').' 2', get_lang('Domaine').' 3' ], $theme => [ get_lang('ThemeField').' 1', get_lang('ThemeField').' 2', get_lang('ThemeField').' 3', get_lang('ThemeField').' 4', get_lang('ThemeField').' 5' ], ], [], true ); $form->addHtml('' . get_lang('NiveauLangueExplanation') . '
'); $showOnlyThisFields = [ 'ecouter', 'lire', 'participer_a_une_conversation', 's_exprimer_oralement_en_continu', 'ecrire' ]; $extra = $extraField->addElements( $form, '', [], false, //filter true, $showOnlyThisFields, $showOnlyThisFields, $defaults, [], false, //$orderDependingDefaults true, // force [ 'domaine' => 3, $theme => 5], // $separateExtraMultipleSelect [ 'domaine' => [ get_lang('Domaine').' 1', get_lang('Domaine').' 2', get_lang('Domaine').' 3' ], $theme => [ get_lang('Theme').' 1', get_lang('Theme').' 2', get_lang('Theme').' 3', get_lang('Theme').' 4', get_lang('Theme').' 5' ], ] ); $form->addHtml('