'; $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::subscribeUsersToSession( $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'); $extraFieldValueUser = new ExtraFieldValue('user'); $theme = 'theme_fr'; $lang = $defaultLangCible = api_get_interface_language(); if ($userToLoadInfo) { $lang = $userToLoadInfo['language']; $targetLanguageInfo = $extraFieldValueUser->get_values_by_handler_and_field_variable( $userToLoad, 'langue_cible' ); if (!empty($targetLanguageInfo)) { $defaultLangCible = $targetLanguageInfo['value']; } switch ($lang) { case 'italian': $theme = 'theme_it'; break; case 'polish': $theme = 'theme_pl'; break; case 'spanish': $theme = 'theme_es'; break; 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()); $jqueryExtra = ''; $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 [], [] ); $userForm->addHtml(''.get_lang('DisponibilitePendantMonStageExplanation').'
'); $fieldsToShow = [ 'datedebutstage', 'datefinstage', 'deja_sur_place', 'poursuiteapprentissagestage', 'heures_disponibilite_par_semaine_stage', ]; $extra = $extraFieldUser->addElements( $userForm, $userToLoad, [], $filter, true, $fieldsToShow, $fieldsToShow, [], false, $forceShowFields, //$forceShowFields = false [], [] ); $userForm->addHtml(''.get_lang('ObjectifsApprentissageExplanation').'
'); $fieldsToShow = [ 'objectif_apprentissage', ]; $extra = $extraFieldUser->addElements( $userForm, $userToLoad, [], $filter, false, $fieldsToShow, $fieldsToShow, $defaults, false, $forceShowFields,//$forceShowFields = false [], [] ); $userForm->addHtml(''.get_lang('MethodeTravailExplanation').'
'); $fieldsToShow = [ 'methode_de_travaille', 'accompagnement', ]; $extra = $extraFieldUser->addElements( $userForm, $userToLoad, [], $filter, true, $fieldsToShow, $fieldsToShow, [], false, $forceShowFields, //$forceShowFields = false [], [] ); $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', 'moment_de_disponibilite', //'langue_cible', ]; $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 ); // Commented because BT#15776 $fieldsToShow = [ 'langue_cible', ]; $extra = $extraFieldUser->addElements( $form, $userToLoad, [], $filter, true, $fieldsToShow, $fieldsToShow, [], false, $forceShowFields //$forceShowFields = false ); $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(''.get_lang('MonEnvironnementDeTravailExplanation').'
'); $fieldsToShow = [ 'outil_de_travail_ordinateur', 'outil_de_travail_ordinateur_so', 'outil_de_travail_tablette', 'outil_de_travail_tablette_so', 'outil_de_travail_smartphone', 'outil_de_travail_smartphone_so', ]; $userForm->addLabel(null, get_lang('MonEnvironnementDeTravailExplanationIntro1')); $extra = $extraFieldUser->addElements( $userForm, $userToLoad, [], $filter, true, $fieldsToShow, $fieldsToShow, [], false, $forceShowFields ); $userForm->addLabel(null, get_lang('MonEnvironnementDeTravailExplanationIntro2')); $jqueryExtra .= $extra['jquery_ready_content']; $fieldsToShow = [ 'browser_platforme', 'browser_platforme_autre', 'browser_platforme_version', ]; $extra = $extraFieldUser->addElements( $userForm, $userToLoad, [], $filter, true, $fieldsToShow, $fieldsToShow, [], false, $forceShowFields, //$forceShowFields = false [], [] ); $jqueryExtra .= $extra['jquery_ready_content']; $userForm->addHtml(''.get_lang('MonEnvironnementDeTravailRenvoiFAQ').'
'); $userForm->addButtonSave(get_lang('Save'), 'submit_partial[collapseEight]'); $userForm->addHtml('