addHeader(get_lang('Diagnosis')); /** @var ExtraFieldSavedSearch $saved */ $search = [ 'user' => $userId, ]; $items = $em->getRepository('ChamiloCoreBundle:ExtraFieldSavedSearch')->findBy($search); $extraFieldSession = new ExtraField('session'); $extraFieldValueSession = new ExtraFieldValue('session'); $filter = false; $extraFieldValue = new ExtraFieldValue('user'); $wantStage = $extraFieldValue->get_values_by_handler_and_field_variable( api_get_user_id(), 'filiere_want_stage' ); $diagnosisComplete = $extraFieldValue->get_values_by_handler_and_field_variable( api_get_user_id(), 'diagnosis_completed' ); if ($diagnosisComplete && isset($diagnosisComplete['value']) && $diagnosisComplete['value'] == 1) { if (!isset($_GET['result'])) { //header('Location:'.api_get_self().'?result=1'); //exit; } } $hide = true; if ($wantStage !== false) { $hide = $wantStage['value'] === 'yes'; } $defaultValueStatus = 'extraFiliere.hide()'; if ($hide === false) { $defaultValueStatus = ''; } $url = api_get_path(WEB_AJAX_PATH).'extra_field.ajax.php?a=order&user_id='.$userId; // Use current user language $targetLanguage = $userInfo['language']; // Theme fix /* $targetLanguage = api_get_interface_language(); $targetLanguageInfo = $extraFieldValue->get_values_by_handler_and_field_variable( api_get_user_id(), 'langue_cible' ); if (!empty($targetLanguageInfo)) { $targetLanguage = strtolower($targetLanguageInfo['value']); }*/ $theme = 'theme_fr'; switch ($targetLanguage) { 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; } $htmlHeadXtra[] = ''; $form->addButtonSave(get_lang('Save'), 'save'); $result = SessionManager::getGridColumns('simple'); $columns = $result['columns']; $column_model = $result['column_model']; $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(); } } $form->setDefaults($defaults); $filterToSend = ''; if ($form->validate()) { $params = $form->getSubmitValues(); /** @var \Chamilo\UserBundle\Entity\User $user */ $user = $em->getRepository('ChamiloUserBundle:User')->find($userId); if (isset($params['save'])) { MessageManager::send_message_simple( $userId, get_lang('DiagnosisFilledSubject'), get_lang('DiagnosisFilledDescription') ); $drhList = UserManager::getDrhListFromUser($userId); if ($drhList) { foreach ($drhList as $drhId) { $subject = sprintf(get_lang('UserXHasFilledTheDiagnosis'), $userInfo['complete_name']); $content = sprintf(get_lang('UserXHasFilledTheDiagnosisDescription'), $userInfo['complete_name']); MessageManager::send_message_simple($drhId, $subject, $content); } } Display::addFlash(Display::return_message(get_lang('Saved'))); header("Location: ".api_get_self()); exit; } else { // Search $filters = []; // Parse params. foreach ($params as $key => $value) { if (substr($key, 0, 6) != 'extra_' && substr($key, 0, 7) != '_extra_') { continue; } if (!empty($value)) { $filters[$key] = $value; } } $filterToSend = []; if (!empty($filters)) { $filterToSend = ['groupOp' => 'AND']; if ($filters) { $count = 1; $countExtraField = 1; foreach ($result['column_model'] as $column) { if ($count > 5) { if (isset($filters[$column['name']])) { $defaultValues['jqg'.$countExtraField] = $filters[$column['name']]; $filterToSend['rules'][] = ['field' => $column['name'], 'op' => 'cn', 'data' => $filters[$column['name']]]; } $countExtraField++; } $count++; } } } } } $forceShowFields = true; $extraField = new ExtraField('user'); $userForm = new FormValidator('user_form', 'post', api_get_self()); $jqueryExtra = ''; $htmlHeadXtra[] = ''; $userForm->addHtml('
'); $userForm->addHtml(get_lang('DiagnosticIntroduction')); $userForm->addHtml('
'.get_lang('FiliereExplanation').'
'); $fieldsToShow = [ 'statusocial', 'filiere_user', 'filiereprecision', 'filiere_want_stage', ]; $extra = $extraField->addElements( $userForm, api_get_user_id(), [], $filter, true, $fieldsToShow, $fieldsToShow, [], false, $forceShowFields //$forceShowFields = false ); $jqueryExtra .= $extra['jquery_ready_content']; $fieldsToShow = [ 'filiere', ]; $extra = $extraFieldSession->addElements( $userForm, api_get_user_id(), [], $filter, true, $fieldsToShow, $fieldsToShow, [], false, $forceShowFields //$forceShowFields = false ); $jqueryExtra .= $extra['jquery_ready_content']; $userForm->addButtonSave(get_lang('Save'), 'submit_partial[collapseOne]'); $userForm->addHtml(''.get_lang('DisponibiliteAvantExplanation').'
'); $extra = $extraFieldSession->addElements( $userForm, '', [], $filter, true, ['access_start_date', 'access_end_date'], [], [], false, $forceShowFields //$forceShowFields = false ); $userForm->addRule( ['extra_access_start_date', 'extra_access_end_date'], get_lang('StartDateMustBeBeforeTheEndDate'), 'compare_datetime_text', '< allow_empty' ); $jqueryExtra .= $extra['jquery_ready_content']; $elements = $userForm->getElements(); $variables = ['access_start_date', 'access_end_date']; foreach ($elements as $element) { $element->setAttribute('extra_label_class', 'red_underline'); } $fieldsToShow = [ 'heures_disponibilite_par_semaine', 'moment_de_disponibilite', ]; $extra = $extraField->addElements( $userForm, api_get_user_id(), [], $filter, true, $fieldsToShow, $fieldsToShow, [], false, $forceShowFields //$forceShowFields = false ); $userForm->addButtonSave(get_lang('Save'), 'submit_partial[collapseTwo]'); $jqueryExtra .= $extra['jquery_ready_content']; $userForm->addHtml(''.get_lang('DisponibilitePendantMonStageExplanation').'
'); $fieldsToShow = [ 'datedebutstage', 'datefinstage', 'je_ne_connais_pas_encore_mes_dates_de_stage', 'deja_sur_place', 'poursuiteapprentissagestage', 'heures_disponibilite_par_semaine_stage', ]; $extra = $extraField->addElements( $userForm, api_get_user_id(), [], $filter, true, $fieldsToShow, $fieldsToShow, [], false, $forceShowFields //$forceShowFields = false ); $userForm->addRule( ['extra_datedebutstage', 'extra_datefinstage'], get_lang('StartDateMustBeBeforeTheEndDate'), 'compare_datetime_text', '< allow_empty' ); $jqueryExtra .= $extra['jquery_ready_content']; $userForm->addButtonSave(get_lang('Save'), 'submit_partial[collapseThree]'); $userForm->addHtml(''.get_lang('ThemesObjectifsExplanation').'
'); $introductionTextList = [ 'domaine' => get_lang('DomaineIntroduction'), $theme => get_lang('ThemeFieldIntroduction'), ]; $fieldsToShow = [ 'domaine', $theme, ]; $extra = $extraFieldSession->addElements( $userForm, api_get_user_id(), [], $filter, false, //tag as select $fieldsToShow, $fieldsToShow, $defaults, true, $forceShowFields, // $forceShowFields ['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, //$addEmptyOptionSelects $introductionTextList ); $jqueryExtra .= $extra['jquery_ready_content']; $userForm->addButtonSave(get_lang('Save'), 'submit_partial[collapseFour]'); $userForm->addHtml(''.get_lang('NiveauLangueExplanation').'
'); $fieldsToShow = [ //'competenceniveau' 'ecouter', 'lire', 'participer_a_une_conversation', 's_exprimer_oralement_en_continu', 'ecrire', ]; $extra = $extraFieldSession->addElements( $userForm, api_get_user_id(), [], $filter, true, $fieldsToShow, $fieldsToShow, $defaults, false, //$orderDependingDefaults = false, $forceShowFields //$forceShowFields = false ); $jqueryExtra .= $extra['jquery_ready_content']; $userForm->addButtonSave(get_lang('Save'), 'submit_partial[collapseFive]'); $userForm->addHtml(''.get_lang('ObjectifsApprentissageExplanation').'
'); $fieldsToShow = [ 'objectif_apprentissage', ]; $extra = $extraField->addElements( $userForm, api_get_user_id(), [], $filter, false, $fieldsToShow, $fieldsToShow, [], false, $forceShowFields //$forceShowFields = false ); $jqueryExtra .= $extra['jquery_ready_content']; $userForm->addButtonSave(get_lang('Save'), 'submit_partial[collapseSix]'); $userForm->addHtml(''.get_lang('MethodeTravailExplanation').'
'); $fieldsToShow = [ 'methode_de_travaille', 'accompagnement', ]; $extra = $extraField->addElements( $userForm, api_get_user_id(), [], $filter, true, $fieldsToShow, $fieldsToShow, [], false, $forceShowFields //$forceShowFields = false ); $jqueryExtra .= $extra['jquery_ready_content']; $userForm->addButtonSave(get_lang('Save'), 'submit_partial[collapseSeven]'); $userForm->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 = $extraField->addElements( $userForm, api_get_user_id(), [], $filter, true, $fieldsToShow, $fieldsToShow, [], false, $forceShowFields //$forceShowFields = false ); $userForm->addLabel(null, get_lang('MonEnvironnementDeTravailExplanationIntro2')); $jqueryExtra .= $extra['jquery_ready_content']; $fieldsToShow = [ 'browser_platforme', 'browser_platforme_autre', 'browser_platforme_version', ]; $extra = $extraField->addElements( $userForm, api_get_user_id(), [], $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('