Merge pull request #4826 from christianbeeznest/ofaj-20846-migration04

Migrations: Improve registration and search diagnosis - refs BT#20846
pull/4830/head
christianbeeznest 1 year ago committed by GitHub
commit d313eb51e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      public/main/admin/user_list.php
  2. 25
      public/main/auth/inscription.php
  3. 15
      public/main/inc/ajax/model.ajax.php
  4. 5
      public/main/inc/lib/formvalidator/Element/DatePicker.php
  5. 2
      public/main/inc/lib/security.lib.php
  6. 6
      public/main/inc/lib/sessionmanager.lib.php
  7. 6
      public/main/inc/lib/usermanager.lib.php
  8. 36
      public/main/search/load_search.php
  9. 24
      public/main/search/search.php
  10. 2
      public/main/session/session_list.php

@ -1105,6 +1105,7 @@ $status_options[COURSEMANAGER] = get_lang('Trainer');
$status_options[DRH] = get_lang('Human Resources Manager');
$status_options[SESSIONADMIN] = get_lang('Course sessionsAdmin');
$status_options[PLATFORM_ADMIN] = get_lang('Administrator');
$status_options[STUDENT_BOSS] = get_lang('RoleStudentBoss');
$form->addSelect(
'keyword_status',

@ -32,10 +32,14 @@ if (false !== $allowedFieldsConfiguration) {
$allowedFields['extra_fields'] = isset($allowedFieldsConfiguration['extra_fields']) ? $allowedFieldsConfiguration['extra_fields'] : [];
}
$webserviceUrl = api_get_plugin_setting('logintcc', 'webservice_url');
$hash = api_get_plugin_setting('logintcc', 'hash');
if (!empty($webserviceUrl)) {
$pluginTccDirectoryPath = api_get_path(SYS_PLUGIN_PATH) . 'logintcc';
$isTccEnabled = (is_dir($pluginTccDirectoryPath) && 'true' === api_get_plugin_setting('logintcc', 'tool_enable'));
$webserviceUrl = '';
$hash = '';
if ($isTccEnabled) {
$webserviceUrl = api_get_plugin_setting('logintcc', 'webservice_url');
$hash = api_get_plugin_setting('logintcc', 'hash');
$htmlHeadXtra[] = '<script>
$(document).ready(function() {
$("#search_user").click(function() {
@ -168,7 +172,7 @@ if (!empty($course_code_redirect)) {
}
if (false === $userAlreadyRegisteredShowTerms &&
'false' !== api_get_setting('allow_registration')
'true' === api_get_setting('allow_registration')
) {
// EMAIL
$form->addElement('text', 'email', get_lang('e-mail'), ['size' => 40]);
@ -176,7 +180,7 @@ if (false === $userAlreadyRegisteredShowTerms &&
$form->addRule('email', get_lang('Required field'), 'required');
}
if (!empty($webserviceUrl)) {
if ($isTccEnabled) {
$form->addButtonSearch(get_lang('SearchTCC'), 'search', ['id' => 'search_user']);
}
@ -464,10 +468,9 @@ if (false === $userAlreadyRegisteredShowTerms &&
false,
$extraFieldList,
[],
[],
false,
false,
false,
[],
[],
[],
false,
@ -843,10 +846,12 @@ if ($form->validate()) {
// Moved here to include extra fields when creating a user. Formerly placed after user creation
// Register extra fields
$extras = [];
$extraParams = [];
foreach ($values as $key => $value) {
if ('extra_' == substr($key, 0, 6)) {
if ('extra_' === substr($key, 0, 6)) {
//an extra field
$extras[substr($key, 6)] = $value;
$extraParams[$key] = $value;
}
}
@ -882,7 +887,7 @@ if ($form->validate()) {
null,
1,
0,
$extras,
$extraParams,
null,
true,
false,

@ -1940,6 +1940,21 @@ switch ($action) {
}
$sidx = in_array($sidx, $columns) ? $sidx : 'name';
$limit = 20;
$total_pages = 0;
if ($count > 0) {
if (!empty($limit)) {
$total_pages = ceil((float) $count / (float) $limit);
}
}
if ($page > $total_pages) {
$page = $total_pages;
}
$start = $limit * $page - $limit;
if ($start < 0) {
$start = 0;
}
switch ($listType) {
case 'complete':
$result = SessionManager::get_sessions_admin_complete(

@ -41,7 +41,9 @@ class DatePicker extends HTML_QuickForm_text
$value = api_format_date($value, DATE_FORMAT_LONG_NO_DAY);
}
$label = $this->getLabel();
return '
<div>'.$label.'</div>
<div id="'.$id.'" class="flex flex-row mt-1">
<input '.$this->_getAttrString($this->_attributes).'
class="form-control border" type="text" value="'.$value.'" placeholder="'.get_lang('Select date ..').'" data-input>
@ -97,6 +99,9 @@ class DatePicker extends HTML_QuickForm_text
}
};
$('#{$id}').flatpickr(config);
if ($('label[for=\"".$id."\"]').length > 0) {
$('label[for=\"".$id."\"]').hide();
}
});
</script>";

@ -548,7 +548,7 @@ class Security
];
$passwordRequirements = api_get_setting('security.password_requirements', true);
if (!empty($passwordRequirements)) {
if (is_array($passwordRequirements)) {
$requirements = $passwordRequirements;
}

@ -743,7 +743,7 @@ class SessionManager
$fieldDataToString = '';
if (!empty($fieldData)) {
foreach ($fieldData as $data) {
$fieldDataArray[] = $data['value'];
$fieldDataArray[] = $data['field_value'];
}
$fieldDataToString = implode(', ', $fieldDataArray);
}
@ -832,7 +832,7 @@ class SessionManager
$fieldDataToString = '';
if (!empty($fieldData)) {
foreach ($fieldData as $data) {
$fieldDataArray[] = $data['value'];
$fieldDataArray[] = $data['field_value'];
}
$fieldDataToString = implode(', ', $fieldDataArray);
}
@ -9717,7 +9717,7 @@ class SessionManager
'url' => api_get_path(WEB_CODE_PATH).'session/session_list_simple.php?list_type=complete',
],*/
];
$default = null;
switch ($listType) {
case 'all':
$default = 1;

@ -334,9 +334,9 @@ class UserManager
$userFieldValue->saveFieldValues(
$extra,
true,
null,
null,
null,
false,
[],
[],
true
);
} else {

@ -508,6 +508,22 @@ $userForm->addButtonSave(get_lang('Save'), 'submit_partial[collapseEight]');
$userForm->addEndPanel();
$form->addButtonSave(get_lang('Save Diagnostic Changes'), 'save');
// Get list of session status
if (api_get_configuration_value('allow_session_status')) {
$statusList = SessionManager::getStatusList();
$statusSelectList[0] = ' -- '.get_lang('All').' --';
foreach ($statusList as $nro => $name) {
$statusSelectList[$nro] = $name;
}
$form->addSelect(
'filter_status',
get_lang('SessionStatus'),
$statusSelectList,
['id' => 'filter_status']
);
}
$form->addButtonSearch(get_lang('Search Sessions'), 'search');
$extraFieldsToFilter = $extraField->get_all(['variable = ?' => 'temps_de_travail']);
@ -579,17 +595,6 @@ if (!empty($filters)) {
if ($count > 5) {
if (isset($filters[$column['name']])) {
$defaultValues['jqg'.$countExtraField] = $filters[$column['name']];
/*switch ($column['name']) {
case 'extra_theme_it':
case 'extra_theme_de':
case 'extra_theme_es':
case 'extra_theme_fr':
break;
case 'extra_domaine':
break;
case '':
break;
}*/
$filterToSend['rules'][] = [
'field' => $column['name'],
'op' => 'cn',
@ -656,6 +661,10 @@ if ($form->validate()) {
}
}
}
if (!empty($_REQUEST['filter_status'])) {
$filterToSend['filter_status'] = (int) $_REQUEST['filter_status'];
}
}
if ($save) {
@ -968,7 +977,7 @@ if (!empty($filterToSend)) {
$filterToSend = json_encode($filterToSend);
$url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_sessions&_search=true&load_extra_field='.
$extraFieldListToString.'&_force_search=true&rows=20&page=1&sidx=&sord=asc&filters2='.$filterToSend;
$extraFieldListToString.'&filters2='.$filterToSend;
if (isset($params['search_using_2'])) {
$url .= '&lang='.$lang;
}
@ -1130,6 +1139,9 @@ if ($data) {
}
$numHours = $total - $sumHours;
if ($numHours < 0) {
$numHours = 0;
}
$headers = [
get_lang('Total Available Hours') => $total,
get_lang('Sum Hours Sessions Subscribed') => $sumHours,

@ -44,7 +44,10 @@ if ($diagnosisComplete && isset($diagnosisComplete['value']) && 1 == $diagnosisC
}
}
$hide = true;
$hide = false;
$defaultValueStatus = '';
/*
$hide = false;
if (false !== $wantStage) {
$hide = 'yes' === $wantStage['value'];
}
@ -53,6 +56,7 @@ $defaultValueStatus = 'extraFiliere.hide()';
if (false === $hide) {
$defaultValueStatus = '';
}
*/
$url = api_get_path(WEB_AJAX_PATH).'extra_field.ajax.php?a=order&user_id='.$userId;
@ -80,19 +84,31 @@ switch ($targetLanguage) {
break;
}
$htmlHeadXtra[] = '<script>
$htmlHeadXtra[] = '
<script>
document.addEventListener("DOMContentLoaded", function() {
var targetBlock = window.location.hash;
var targetBlockWithoutHash = targetBlock.substring(1);
const diapoButton = document.querySelector("#card_"+targetBlockWithoutHash+" a");
setTimeout(function() {
diapoButton.click();
}, 500);
});
</script>
<script>
$(function() {
var themeDefault = "extra_'.$theme.'";
var extraFiliere = $("input[name=\'extra_filiere[extra_filiere]\']").parent().parent().parent();
'.$defaultValueStatus.'
$("input[name=\'extra_filiere_want_stage[extra_filiere_want_stage]\']").change(function() {
/*$("input[name=\'extra_filiere_want_stage[extra_filiere_want_stage]\']").change(function() {
if ($(this).val() == "no") {
extraFiliere.show();
} else {
extraFiliere.hide();
}
});
});*/
$("#extra_theme").parent().append(
$("<a>", {

@ -2,6 +2,8 @@
/* For licensing terms, see /license.txt */
ini_set('memory_limit', '2024M');
/**
* List sessions in an efficient and usable way.
*/

Loading…
Cancel
Save