swad-core/swad_user.h

531 lines
20 KiB
C
Raw Normal View History

2014-12-01 23:55:08 +01:00
// swad_user.h: users
#ifndef _SWAD_USR
#define _SWAD_USR
/*
SWAD (Shared Workspace At a Distance in Spanish),
is a web platform developed at the University of Granada (Spain),
and used to support university teaching.
This file is part of SWAD core.
2020-01-01 14:53:57 +01:00
Copyright (C) 1999-2020 Antonio Ca<EFBFBD>as Vargas
2014-12-01 23:55:08 +01:00
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*****************************************************************************/
/********************************** Headers **********************************/
/*****************************************************************************/
#include <mysql/mysql.h> // To access MySQL databases
#include "swad_action.h"
#include "swad_constant.h"
2020-01-07 13:14:42 +01:00
#include "swad_country.h"
2014-12-01 23:55:08 +01:00
#include "swad_cryptography.h"
#include "swad_date.h"
#include "swad_degree.h"
#include "swad_icon.h"
#include "swad_layout.h"
2015-01-02 01:19:27 +01:00
#include "swad_menu.h"
2014-12-01 23:55:08 +01:00
#include "swad_nickname.h"
2017-03-13 13:33:45 +01:00
#include "swad_password.h"
2016-12-09 13:59:33 +01:00
#include "swad_privacy_visibility_type.h"
2016-12-13 13:32:19 +01:00
#include "swad_role_type.h"
2014-12-01 23:55:08 +01:00
#include "swad_scope.h"
#include "swad_search.h"
#include "swad_string.h"
#include "swad_theme.h"
/*****************************************************************************/
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Usr_MIN_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_USRS 6
#define Usr_DEF_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_USRS 12
#define Usr_MAX_MONTHS_WITHOUT_ACCESS_TO_REMOVE_OLD_USRS 60
2017-03-08 14:12:33 +01:00
#define Usr_MAX_CHARS_FIRSTNAME_OR_SURNAME (32 - 1) // 31
#define Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME ((Usr_MAX_CHARS_FIRSTNAME_OR_SURNAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 511
2017-01-13 01:51:23 +01:00
2017-03-07 19:55:29 +01:00
#define Usr_MAX_BYTES_SURNAMES (Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1 + Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME)
// Surname1 +' '+ Surname2
#define Usr_MAX_BYTES_FULL_NAME (Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1 + Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 6 + Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME)
// Surname1 +' '+ Surname2 + ','+' ' + FirstName
// Surname1 +' '+ Surname2 + '<br />' + FirstName
2014-12-01 23:55:08 +01:00
2018-10-08 12:37:29 +02:00
#define Usr_BIRTHDAY_STR_DB_LENGTH (1 + 4 + 1 + 2 + 1 + 2 + 1) // "'%04u-%02u-%02u'"
2016-05-01 01:52:35 +02:00
2017-03-08 14:12:33 +01:00
#define Usr_MAX_CHARS_ADDRESS (128 - 1) // 127
#define Usr_MAX_BYTES_ADDRESS ((Usr_MAX_CHARS_ADDRESS + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
2017-03-08 01:21:21 +01:00
#define Usr_MAX_CHARS_PHONE 16
#define Usr_MAX_BYTES_PHONE Usr_MAX_CHARS_PHONE
2014-12-01 23:55:08 +01:00
2017-11-30 10:08:37 +01:00
#define Usr_CLASS_PHOTO_COLS_DEF 10 // Default number of columns in a class photo
#define Usr_CLASS_PHOTO_COLS_MAX 100 // Maximum number of columns in a class photo
2014-12-01 23:55:08 +01:00
2017-05-30 11:43:50 +02:00
#define Usr_LIST_WITH_PHOTOS_DEF true
2014-12-01 23:55:08 +01:00
2017-03-07 01:56:41 +01:00
#define Usr_MAX_BYTES_LIST_ENCRYPTED_USR_CODS (Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 * Cfg_MAX_USRS_IN_LIST)
2014-12-01 23:55:08 +01:00
2016-07-25 16:08:25 +02:00
#define Usr_NUM_MAIN_FIELDS_DATA_USR 8
2016-06-15 20:35:49 +02:00
2017-05-25 13:43:54 +02:00
#define Usr_USER_LIST_SECTION_ID "user_list"
2014-12-01 23:55:08 +01:00
/*****************************************************************************/
/******************************** Public types *******************************/
/*****************************************************************************/
2019-03-19 13:22:14 +01:00
// Get user's data with or without personal settings
typedef enum
{
Usr_DONT_GET_PREFS = 0,
Usr_GET_PREFS = 1,
} Usr_GetPrefs_t;
2014-12-01 23:55:08 +01:00
// Related with user's sexs
#define Usr_NUM_SEXS 4 // Unknown, female, male, all
typedef enum
{
Usr_SEX_UNKNOWN = 0,
Usr_SEX_FEMALE = 1,
Usr_SEX_MALE = 2,
Usr_SEX_ALL = 3, // Usr_SEX_ALL is intended for "all sexs"
} Usr_Sex_t;
// Don't change these numbers! They are used for user's sex in database
// Related with class photograph
typedef enum
{
Usr_CLASS_PHOTO_SEL, // Only for selection of users
2019-03-11 00:51:54 +01:00
Usr_CLASS_PHOTO_SEL_SEE, // Selecting and seeing users
2014-12-01 23:55:08 +01:00
Usr_CLASS_PHOTO_PRN, // Only print users
} Usr_ClassPhotoType_t;
// Related with type of list of users
2017-01-29 21:41:08 +01:00
#define Usr_NUM_USR_LIST_TYPES 3
2014-12-01 23:55:08 +01:00
typedef enum
{
2017-01-29 21:41:08 +01:00
Usr_LIST_UNKNOWN = 0,
Usr_LIST_AS_CLASS_PHOTO = 1,
Usr_LIST_AS_LISTING = 2,
2014-12-01 23:55:08 +01:00
} Usr_ShowUsrsType_t;
2017-01-29 21:41:08 +01:00
#define Usr_SHOW_USRS_TYPE_DEFAULT Usr_LIST_AS_CLASS_PHOTO
2014-12-01 23:55:08 +01:00
2019-03-12 12:51:54 +01:00
#define Usr_LIST_USRS_NUM_OPTIONS 8
2019-03-11 13:33:34 +01:00
typedef enum
{
2019-03-12 09:27:04 +01:00
Usr_OPTION_UNKNOWN = 0,
Usr_OPTION_RECORDS = 1,
Usr_OPTION_HOMEWORK = 2,
Usr_OPTION_ATTENDANCE = 3,
Usr_OPTION_MESSAGE = 4,
2019-04-11 21:37:11 +02:00
Usr_OPTION_EMAIL = 5,
2019-03-12 12:51:54 +01:00
Usr_OPTION_FOLLOW = 6,
Usr_OPTION_UNFOLLOW = 7,
2019-03-12 09:27:04 +01:00
} Usr_ListUsrsOption_t;
#define Usr_LIST_USRS_DEFAULT_OPTION Usr_OPTION_RECORDS
2019-03-11 13:33:34 +01:00
2019-09-23 09:44:10 +02:00
typedef enum
{
Usr_ME,
Usr_OTHER,
} Usr_MeOrOther_t;
2019-11-12 00:31:41 +01:00
#define Usr_NUM_WHO 5
2019-11-11 15:46:54 +01:00
typedef enum
{
2019-11-12 00:31:41 +01:00
Usr_WHO_UNKNOWN,
2019-11-11 15:46:54 +01:00
Usr_WHO_ME,
2019-11-12 00:31:41 +01:00
Usr_WHO_SELECTED,
Usr_WHO_FOLLOWED,
2019-11-11 15:46:54 +01:00
Usr_WHO_ALL,
} Usr_Who_t;
#define Usr_WHO_DEFAULT Usr_WHO_ALL
2014-12-01 23:55:08 +01:00
// Related with user's data
struct UsrData
{
long UsrCod;
2017-03-07 01:56:41 +01:00
char EncryptedUsrCod [Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1];
2017-03-13 13:17:53 +01:00
char UsrIDNickOrEmail[Cns_MAX_BYTES_EMAIL_ADDRESS + 1]; // String to store the ID, nickname or email
2014-12-01 23:55:08 +01:00
struct
{
struct ListIDs *List;
unsigned Num;
} IDs;
2017-03-07 01:56:41 +01:00
char Nickname [Nck_MAX_BYTES_NICKNAME_WITHOUT_ARROBA + 1];
2017-03-13 14:22:36 +01:00
char Password [Pwd_BYTES_ENCRYPTED_PASSWORD + 1];
2017-06-04 14:22:04 +02:00
struct
{
2017-06-08 15:32:33 +02:00
struct
{
2019-03-07 13:00:18 +01:00
bool Valid; // Role is valid (is already filled)?
2017-06-08 15:32:33 +02:00
Rol_Role_t Role;
} InCurrentCrs; // Role in current course (Rol_UNK is no course selected)
int InCrss; // Roles in all his/her courses
// Check always if filled/calculated
// >=0 ==> filled/calculated
// <0 ==> not yet filled/calculated
} Roles;
2014-12-01 23:55:08 +01:00
bool Accepted; // User has accepted joining to current course?
2017-03-07 19:55:29 +01:00
char Surname1 [Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1];
char Surname2 [Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1];
char FirstName [Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1];
2017-01-15 18:02:52 +01:00
char FullName [Usr_MAX_BYTES_FULL_NAME + 1];
2014-12-01 23:55:08 +01:00
Usr_Sex_t Sex;
2017-03-13 13:17:53 +01:00
char Email [Cns_MAX_BYTES_EMAIL_ADDRESS + 1];
2014-12-01 23:55:08 +01:00
bool EmailConfirmed;
2017-03-07 01:56:41 +01:00
char Photo [Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1]; // Name of public link to photo
2015-03-06 22:36:29 +01:00
Pri_Visibility_t PhotoVisibility; // Who can see user's photo
2019-03-22 15:21:46 +01:00
Pri_Visibility_t BaPrfVisibility; // Who can see user's basic public profile (minimal record card)
Pri_Visibility_t ExPrfVisibility; // Who can see user's extended public profile (figures, follow)
2014-12-01 23:55:08 +01:00
long CtyCod; // Country
struct Date Birthday;
2017-03-07 11:03:05 +01:00
char StrBirthday [Cns_MAX_BYTES_DATE + 1];
2020-04-29 02:34:54 +02:00
char Phone1 [Usr_MAX_BYTES_PHONE + 1];
char Phone2 [Usr_MAX_BYTES_PHONE + 1];
2014-12-01 23:55:08 +01:00
char *Comments;
long InsCtyCod; // Country of the institution
long InsCod; // Institution
struct
{
long CtrCod; // Centre
long DptCod; // Department
2017-03-08 14:12:33 +01:00
char Office [Usr_MAX_BYTES_ADDRESS + 1];
2017-01-13 10:49:56 +01:00
char OfficePhone [Usr_MAX_BYTES_PHONE + 1];
2014-12-01 23:55:08 +01:00
} Tch;
2019-03-19 13:22:14 +01:00
struct
{
unsigned CreateNotif; // One bit activated for each type of event
unsigned SendEmail; // One bit activated for each type of event
} NtfEvents;
2014-12-01 23:55:08 +01:00
struct
{
2018-12-08 16:43:13 +01:00
Lan_Language_t Language;
2015-11-21 20:23:28 +01:00
unsigned FirstDayOfWeek;
2017-05-04 02:19:23 +02:00
Dat_Format_t DateFormat;
2014-12-01 23:55:08 +01:00
The_Theme_t Theme;
Ico_IconSet_t IconSet;
2015-01-02 01:19:27 +01:00
Mnu_Menu_t Menu;
unsigned SideCols;
2019-03-17 18:20:55 +01:00
bool AcceptThirdPartyCookies; // User has accepted third party cookies
2014-12-01 23:55:08 +01:00
} Prefs;
};
struct UsrLast
{
Sch_WhatToSearch_t WhatToSearch; // Search courses, teachers, documents...?
2019-04-01 23:15:17 +02:00
struct
{
2019-04-03 20:57:04 +02:00
Hie_Level_t Scope; // Course, degree, centre, etc.
2019-04-01 23:15:17 +02:00
long Cod; // Course code, degree code, centre code, etc.
} LastHie;
2019-04-01 13:15:15 +02:00
Act_Action_t LastAct;
Rol_Role_t LastRole;
2019-04-03 21:49:10 +02:00
long LastTime;
2014-12-01 23:55:08 +01:00
long LastAccNotif;
};
struct UsrInList
{
long UsrCod;
2017-03-07 01:56:41 +01:00
char EncryptedUsrCod[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1];
2017-03-13 14:22:36 +01:00
char Password[Pwd_BYTES_ENCRYPTED_PASSWORD + 1];
2017-03-07 19:55:29 +01:00
char Surname1 [Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1];
char Surname2 [Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1];
char FirstName[Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1];
2014-12-01 23:55:08 +01:00
Usr_Sex_t Sex;
2017-03-07 01:56:41 +01:00
char Photo[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1]; // Name of public link to photo
2016-07-25 20:24:07 +02:00
Pri_Visibility_t PhotoVisibility; // Who can see user's photo
2017-03-01 14:53:18 +01:00
long CtyCod; // Country
2016-07-25 20:24:07 +02:00
long InsCod; // Institution
2016-07-26 01:03:41 +02:00
Rol_Role_t RoleInCurrentCrsDB; // Role in current course in database
2014-12-01 23:55:08 +01:00
bool Accepted; // User has accepted joining to one/all courses?
bool Remove; // A boolean associated with each user that indicates if it must be removed
};
2016-06-23 13:10:43 +02:00
struct ListUsrs
2014-12-01 23:55:08 +01:00
{
struct UsrInList *Lst; // List of users
unsigned NumUsrs; // Number of users in the list
};
2019-11-15 03:34:48 +01:00
struct SelectedUsrs
{
char *List[Rol_NUM_ROLES]; // Lists of encrypted codes of users selected from a form
bool Filled; // If lists are already filled/readed
char *ParamSuffix;
Usr_ListUsrsOption_t Option; // What option I have selected to do with these selected users
};
2014-12-01 23:55:08 +01:00
struct ListUsrCods
{
long *Lst; // List of users' codes
unsigned NumUsrs; // Number of users in the list
};
/*****************************************************************************/
/****************************** Public prototypes ****************************/
/*****************************************************************************/
void Usr_InformAboutNumClicksBeforePhoto (void);
void Usr_UsrDataConstructor (struct UsrData *UsrDat);
void Usr_ResetUsrDataExceptUsrCodAndIDs (struct UsrData *UsrDat);
void Usr_ResetMyLastData (void);
void Usr_UsrDataDestructor (struct UsrData *UsrDat);
2019-03-19 13:22:14 +01:00
void Usr_GetAllUsrDataFromUsrCod (struct UsrData *UsrDat,Usr_GetPrefs_t GetPrefs);
2014-12-01 23:55:08 +01:00
void Usr_AllocateListUsrCods (struct ListUsrCods *ListUsrCods);
void Usr_FreeListUsrCods (struct ListUsrCods *ListUsrCods);
2018-10-10 23:56:42 +02:00
bool Usr_ItsMe (long UsrCod);
2014-12-01 23:55:08 +01:00
void Usr_GetUsrCodFromEncryptedUsrCod (struct UsrData *UsrDat);
2019-03-19 13:22:14 +01:00
void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat,Usr_GetPrefs_t GetPrefs);
2014-12-01 23:55:08 +01:00
void Usr_BuildFullName (struct UsrData *UsrDat);
2017-03-05 15:12:48 +01:00
void Usr_WriteFirstNameBRSurnames (const struct UsrData *UsrDat);
2014-12-01 23:55:08 +01:00
2017-07-02 20:36:15 +02:00
void Usr_FlushCachesUsr (void);
2019-04-03 20:57:04 +02:00
bool Usr_CheckIfUsrIsAdm (long UsrCod,Hie_Level_t Scope,long Cod);
2017-06-20 14:43:26 +02:00
void Usr_FlushCacheUsrIsSuperuser (void);
2014-12-01 23:55:08 +01:00
bool Usr_CheckIfUsrIsSuperuser (long UsrCod);
2016-06-16 18:05:23 +02:00
2017-01-27 10:42:20 +01:00
bool Usr_ICanChangeOtherUsrData (const struct UsrData *UsrDat);
2017-01-28 18:08:06 +01:00
bool Usr_ICanEditOtherUsr (const struct UsrData *UsrDat);
2017-01-27 01:02:52 +01:00
2016-06-16 18:05:23 +02:00
unsigned Usr_GetNumCrssOfUsr (long UsrCod);
unsigned Usr_GetNumCrssOfUsrNotAccepted (long UsrCod);
2015-03-14 17:39:04 +01:00
unsigned Usr_GetNumCrssOfUsrWithARole (long UsrCod,Rol_Role_t Role);
2016-06-20 09:43:27 +02:00
unsigned Usr_GetNumCrssOfUsrWithARoleNotAccepted (long UsrCod,Rol_Role_t Role);
2015-03-19 19:10:43 +01:00
unsigned Usr_GetNumUsrsInCrssOfAUsr (long UsrCod,Rol_Role_t UsrRole,
2019-03-05 18:12:35 +01:00
unsigned OthersRoles);
2016-12-09 13:59:33 +01:00
2017-06-20 14:43:26 +02:00
void Usr_FlushCacheUsrBelongsToCurrentCrs (void);
2017-06-08 15:32:33 +02:00
bool Usr_CheckIfUsrBelongsToCurrentCrs (const struct UsrData *UsrDat);
2017-06-20 14:43:26 +02:00
void Usr_FlushCacheUsrHasAcceptedInCurrentCrs (void);
2017-06-09 15:04:02 +02:00
bool Usr_CheckIfUsrHasAcceptedInCurrentCrs (const struct UsrData *UsrDat);
2017-06-23 15:12:49 +02:00
2016-12-09 13:59:33 +01:00
bool Usr_CheckIfICanViewRecordStd (const struct UsrData *UsrDat);
2016-12-13 13:32:19 +01:00
bool Usr_CheckIfICanViewRecordTch (struct UsrData *UsrDat);
2020-04-22 03:15:04 +02:00
bool Usr_CheckIfICanViewTstExaMchResult (const struct UsrData *UsrDat);
2017-10-05 22:29:33 +02:00
bool Usr_CheckIfICanViewAsgWrk (const struct UsrData *UsrDat);
bool Usr_CheckIfICanViewAtt (const struct UsrData *UsrDat);
2016-12-13 13:32:19 +01:00
bool Usr_CheckIfICanViewUsrAgenda (struct UsrData *UsrDat);
2017-06-23 15:12:49 +02:00
2017-06-20 14:43:26 +02:00
void Usr_FlushCacheUsrSharesAnyOfMyCrs (void);
2016-12-13 13:32:19 +01:00
bool Usr_CheckIfUsrSharesAnyOfMyCrs (struct UsrData *UsrDat);
2015-03-06 14:11:11 +01:00
bool Usr_CheckIfUsrSharesAnyOfMyCrsWithDifferentRole (long UsrCod);
2016-10-27 01:30:14 +02:00
2016-10-28 10:03:37 +02:00
void Usr_GetMyCountrs (void);
void Usr_GetMyInstits (void);
2014-12-01 23:55:08 +01:00
void Usr_GetMyCentres (void);
void Usr_GetMyDegrees (void);
void Usr_GetMyCourses (void);
2016-10-28 10:03:37 +02:00
void Usr_FreeMyCountrs (void);
void Usr_FreeMyInstits (void);
void Usr_FreeMyCentres (void);
void Usr_FreeMyDegrees (void);
2016-09-22 01:28:31 +02:00
void Usr_FreeMyCourses (void);
2016-10-27 01:30:14 +02:00
2017-06-20 14:43:26 +02:00
void Usr_FlushCacheUsrBelongsToIns (void);
2017-01-27 01:02:52 +01:00
bool Usr_CheckIfUsrBelongsToIns (long UsrCod,long InsCod);
2017-06-20 14:43:26 +02:00
void Usr_FlushCacheUsrBelongsToCtr (void);
2017-01-27 01:02:52 +01:00
bool Usr_CheckIfUsrBelongsToCtr (long UsrCod,long CtrCod);
2017-06-20 14:43:26 +02:00
void Usr_FlushCacheUsrBelongsToDeg (void);
2017-01-27 01:02:52 +01:00
bool Usr_CheckIfUsrBelongsToDeg (long UsrCod,long DegCod);
2017-06-20 14:43:26 +02:00
void Usr_FlushCacheUsrBelongsToCrs (void);
2017-01-27 01:02:52 +01:00
bool Usr_CheckIfUsrBelongsToCrs (long UsrCod,long CrsCod,
2015-09-17 11:21:49 +02:00
bool CountOnlyAcceptedCourses);
2016-10-27 01:30:14 +02:00
bool Usr_CheckIfIBelongToCty (long CtyCod);
2014-12-01 23:55:08 +01:00
bool Usr_CheckIfIBelongToIns (long InsCod);
bool Usr_CheckIfIBelongToCtr (long CtrCod);
bool Usr_CheckIfIBelongToDeg (long DegCod);
bool Usr_CheckIfIBelongToCrs (long CrsCod);
2016-06-16 18:05:23 +02:00
2014-12-29 00:54:56 +01:00
unsigned Usr_GetCtysFromUsr (long UsrCod,MYSQL_RES **mysql_res);
unsigned long Usr_GetInssFromUsr (long UsrCod,long CtyCod,MYSQL_RES **mysql_res);
2014-12-01 23:55:08 +01:00
unsigned long Usr_GetCtrsFromUsr (long UsrCod,long InsCod,MYSQL_RES **mysql_res);
unsigned long Usr_GetDegsFromUsr (long UsrCod,long CtrCod,MYSQL_RES **mysql_res);
unsigned long Usr_GetCrssFromUsr (long UsrCod,long DegCod,MYSQL_RES **mysql_res);
2019-03-07 13:00:18 +01:00
void Usr_GetMainDeg (long UsrCod,
char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1],
Rol_Role_t *MaxRole);
2014-12-01 23:55:08 +01:00
2017-03-13 20:32:03 +01:00
bool Usr_ChkIfEncryptedUsrCodExists (const char EncryptedUsrCod[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64]);
2014-12-01 23:55:08 +01:00
2016-03-01 03:16:29 +01:00
void Usr_WriteLandingPage (void);
void Usr_WriteFormLogout (void);
2014-12-01 23:55:08 +01:00
void Usr_Logout (void);
2016-02-29 16:22:11 +01:00
void Usr_PutLinkToLogin (void);
2019-04-11 14:45:31 +02:00
void Usr_WriteFormLogin (Act_Action_t NextAction,void (*FuncParams) (void));
2014-12-01 23:55:08 +01:00
void Usr_WelcomeUsr (void);
2016-05-01 01:52:35 +02:00
void Usr_CreateBirthdayStrDB (const struct UsrData *UsrDat,
2017-01-15 22:58:26 +01:00
char BirthdayStrDB[Usr_BIRTHDAY_STR_DB_LENGTH + 1]);
2016-05-01 01:52:35 +02:00
2014-12-01 23:55:08 +01:00
void Usr_PutFormLogIn (void);
void Usr_WriteLoggedUsrHead (void);
void Usr_PutFormLogOut (void);
void Usr_GetParamUsrIdLogin (void);
2014-12-12 18:50:36 +01:00
unsigned Usr_GetParamOtherUsrIDNickOrEMailAndGetUsrCods (struct ListUsrCods *ListUsrCods);
2015-04-02 18:39:49 +02:00
2020-03-26 02:54:30 +01:00
void Usr_PutParamMyUsrCodEncrypted (void *EncryptedUsrCod);
void Usr_PutParamOtherUsrCodEncrypted (void *EncryptedUsrCod);
2017-03-07 01:56:41 +01:00
void Usr_PutParamUsrCodEncrypted (const char EncryptedUsrCod[Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64 + 1]);
2016-01-25 14:40:57 +01:00
void Usr_GetParamOtherUsrCodEncrypted (struct UsrData *UsrDat);
void Usr_GetParamOtherUsrCodEncryptedAndGetListIDs (void);
2014-12-01 23:55:08 +01:00
bool Usr_GetParamOtherUsrCodEncryptedAndGetUsrData (void);
void Usr_ChkUsrAndGetUsrData (void);
2015-04-02 13:38:05 +02:00
void Usr_ShowFormsLogoutAndRole (void);
2014-12-01 23:55:08 +01:00
2019-03-19 13:22:14 +01:00
bool Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (struct UsrData *UsrDat,Usr_GetPrefs_t GetPrefs);
2014-12-01 23:55:08 +01:00
void Usr_UpdateMyLastData (void);
void Usr_InsertMyLastCrsTabAndTime (void);
2016-06-15 20:04:15 +02:00
void Usr_WriteRowUsrMainData (unsigned NumUsr,struct UsrData *UsrDat,
2019-11-15 03:34:48 +01:00
bool PutCheckBoxToSelectUsr,Rol_Role_t Role,
struct SelectedUsrs *SelectedUsrs);
2014-12-01 23:55:08 +01:00
long Usr_GetRamdomStdFromCrs (long CrsCod);
long Usr_GetRamdomStdFromGrp (long GrpCod);
unsigned Usr_GetNumTchsCurrentInsInDepartment (long DptCod);
2020-01-07 13:14:42 +01:00
void Usr_FlushCacheNumUsrsWhoDontClaimToBelongToAnyCty (void);
unsigned Usr_GetNumUsrsWhoDontClaimToBelongToAnyCty (void);
void Usr_FlushCacheNumUsrsWhoClaimToBelongToAnotherCty (void);
unsigned Usr_GetNumUsrsWhoClaimToBelongToAnotherCty (void);
2020-01-07 13:37:00 +01:00
void Usr_FlushCacheNumUsrsWhoClaimToBelongToCty (void);
2020-01-07 13:14:42 +01:00
unsigned Usr_GetNumUsrsWhoClaimToBelongToCty (struct Country *Cty);
2020-01-06 18:00:23 +01:00
void Usr_FlushCacheNumUsrsWhoClaimToBelongToIns (void);
2020-01-07 22:07:06 +01:00
unsigned Usr_GetNumUsrsWhoClaimToBelongToIns (struct Instit *Ins);
2020-01-05 01:46:45 +01:00
void Usr_FlushCacheNumUsrsWhoClaimToBelongToCtr (void);
2020-01-08 00:47:10 +01:00
unsigned Usr_GetNumUsrsWhoClaimToBelongToCtr (struct Centre *Ctr);
2014-12-01 23:55:08 +01:00
unsigned Usr_GetNumberOfTeachersInCentre (long CtrCod);
2019-04-03 20:57:04 +02:00
void Usr_GetListUsrs (Hie_Level_t Scope,Rol_Role_t Role);
2016-06-23 11:31:51 +02:00
2016-06-29 18:27:49 +02:00
void Usr_SearchListUsrs (Rol_Role_t Role);
2017-03-13 20:32:03 +01:00
void Usr_CreateTmpTableAndSearchCandidateUsrs (const char SearchQuery[Sch_MAX_BYTES_SEARCH_QUERY + 1]);
2016-06-29 18:27:49 +02:00
void Usr_DropTmpTableWithCandidateUsrs (void);
2014-12-01 23:55:08 +01:00
void Usr_GetUnorderedStdsCodesInDeg (long DegCod);
2016-07-25 20:55:25 +02:00
void Usr_CopyBasicUsrDataFromList (struct UsrData *UsrDat,const struct UsrInList *UsrInList);
2016-06-23 13:10:43 +02:00
void Usr_FreeUsrsList (Rol_Role_t Role);
2016-07-25 20:55:25 +02:00
2019-04-11 09:55:35 +02:00
bool Usr_GetIfShowBigList (unsigned NumUsrs,
2020-03-26 02:54:30 +01:00
void (*FuncParams) (void *Args),void *Args,
2019-04-11 09:55:35 +02:00
const char *OnSubmit);
2016-12-27 22:48:49 +01:00
2019-11-15 03:34:48 +01:00
void Usr_CreateListSelectedUsrsCodsAndFillWithOtherUsr (struct SelectedUsrs *SelectedUsrs);
void Usr_PutHiddenParSelectedUsrsCods (struct SelectedUsrs *SelectedUsrs);
void Usr_GetListsSelectedEncryptedUsrsCods (struct SelectedUsrs *SelectedUsrs);
2014-12-01 23:55:08 +01:00
bool Usr_GetListMsgRecipientsWrittenExplicitelyBySender (bool WriteErrorMsgs);
2019-11-13 21:31:06 +01:00
2019-11-15 10:48:20 +01:00
bool Usr_FindEncryptedUsrCodsInListOfSelectedEncryptedUsrCods (const char *EncryptedUsrCodToFind,
struct SelectedUsrs *SelectedUsrs);
2019-11-15 03:34:48 +01:00
bool Usr_CheckIfThereAreUsrsInListOfSelectedEncryptedUsrCods (struct SelectedUsrs *SelectedUsrs);
unsigned Usr_CountNumUsrsInListOfSelectedEncryptedUsrCods (struct SelectedUsrs *SelectedUsrs);
void Usr_FreeListsSelectedEncryptedUsrsCods (struct SelectedUsrs *SelectedUsrs);
2019-11-13 21:31:06 +01:00
2019-11-15 03:34:48 +01:00
void Usr_GetListSelectedUsrCods (struct SelectedUsrs *SelectedUsrs,
unsigned NumUsrsInList,
long **LstSelectedUsrCods);
2019-11-13 21:31:06 +01:00
void Usr_FreeListSelectedUsrCods (long *LstSelectedUsrCods);
void Usr_CreateSubqueryUsrCods (long LstSelectedUsrCods[],
unsigned NumUsrsInList,
2019-11-14 02:29:18 +01:00
char **SubQueryUsrs);
void Usr_FreeSubqueryUsrCods (char *SubQueryUsrs);
2019-11-13 21:31:06 +01:00
2014-12-01 23:55:08 +01:00
void Usr_FreeListOtherRecipients (void);
2020-03-26 02:54:30 +01:00
void Usr_ShowFormsToSelectUsrListType (void (*FuncParams) (void *Args),void *Args);
2014-12-01 23:55:08 +01:00
unsigned Usr_GetColumnsForSelectUsrs (void);
2016-06-16 14:34:17 +02:00
void Usr_SetUsrDatMainFieldNames (void);
2016-06-16 18:32:12 +02:00
void Usr_WriteHeaderFieldsUsrDat (bool PutCheckBoxToSelectUsr);
2016-06-16 14:34:17 +02:00
2019-11-15 03:34:48 +01:00
void Usr_PutFormToSelectUsrsToGoToAct (struct SelectedUsrs *SelectedUsrs,
2020-03-26 02:54:30 +01:00
Act_Action_t NextAction,
void (*FuncParams) (void *Args),void *Args,
2019-04-11 23:15:40 +02:00
const char *Title,
2019-04-10 19:19:34 +02:00
const char *HelpLink,
2019-12-09 11:50:03 +01:00
const char *TxtButton,
bool PutFormDateRange);
2019-11-15 03:34:48 +01:00
void Usr_GetSelectedUsrsAndGoToAct (struct SelectedUsrs *SelectedUsrs,
2020-04-06 16:00:06 +02:00
void (*FuncWhenUsrsSelected) (void *ArgsSelected),void *ArgsSelected,
void (*FuncWhenNoUsrsSelected) (void *ArgsNoSelected),void *ArgsNoSelected);
2019-11-15 03:34:48 +01:00
void Usr_ListUsersToSelect (Rol_Role_t Role,struct SelectedUsrs *SelectedUsrs);
2014-12-01 23:55:08 +01:00
void Usr_ListAllDataGsts (void);
void Usr_ListAllDataStds (void);
void Usr_ListAllDataTchs (void);
2017-05-22 20:37:46 +02:00
unsigned Usr_ListUsrsFound (Rol_Role_t Role,
const char SearchQuery[Sch_MAX_BYTES_SEARCH_QUERY]);
2014-12-01 23:55:08 +01:00
void Usr_ListDataAdms (void);
2017-02-01 11:23:48 +01:00
void Usr_PutParamsPrefsAboutUsrList (void);
2014-12-01 23:55:08 +01:00
void Usr_GetAndUpdatePrefsAboutUsrList (void);
void Usr_PutParamUsrListType (Usr_ShowUsrsType_t ListType);
void Usr_GetAndUpdateColsClassPhoto (void);
void Usr_PutParamColsClassPhoto (void);
void Usr_PutParamListWithPhotos (void);
void Usr_GetMyPrefAboutListWithPhotosFromDB (void);
void Usr_SeeGuests (void);
void Usr_SeeStudents (void);
2019-03-11 13:33:34 +01:00
void Usr_SeeTeachers (void);
2019-03-11 00:51:54 +01:00
2019-03-11 13:33:34 +01:00
void Usr_DoActionOnSeveralUsrs1 (void);
void Usr_DoActionOnSeveralUsrs2 (void);
2019-03-11 00:51:54 +01:00
2014-12-01 23:55:08 +01:00
void Usr_SeeGstClassPhotoPrn (void);
void Usr_SeeStdClassPhotoPrn (void);
void Usr_SeeTchClassPhotoPrn (void);
void Usr_PutSelectorNumColsClassPhoto (void);
2019-12-19 01:42:24 +01:00
void Usr_ConstructPathUsr (long UsrCod,char PathUsr[PATH_MAX + 1 + Cns_MAX_DECIMAL_DIGITS_LONG + 1]);
2014-12-01 23:55:08 +01:00
bool Usr_ChkIfUsrCodExists (long UsrCod);
void Usr_ShowWarningNoUsersFound (Rol_Role_t Role);
2017-05-25 19:57:34 +02:00
unsigned Usr_GetTotalNumberOfUsersInPlatform (void);
2020-01-08 23:49:04 +01:00
unsigned Usr_GetNumUsrsInCrss (Hie_Level_t Scope,long Cod,unsigned Roles);
2017-05-25 19:57:34 +02:00
unsigned Usr_GetNumUsrsNotBelongingToAnyCrs (void);
2019-11-11 00:15:44 +01:00
double Usr_GetNumCrssPerUsr (Rol_Role_t Role);
double Usr_GetNumUsrsPerCrs (Rol_Role_t Role);
2014-12-01 23:55:08 +01:00
2015-03-29 01:06:00 +01:00
bool Usr_CheckIfUsrBanned (long UsrCod);
void Usr_RemoveUsrFromUsrBanned (long UsrCod);
2016-12-07 00:41:36 +01:00
void Usr_PrintUsrQRCode (void);
2017-03-04 01:59:27 +01:00
void Usr_WriteAuthor1Line (long UsrCod,bool Hidden);
2019-09-22 19:50:24 +02:00
void Usr_ShowTableCellWithUsrData (struct UsrData *UsrDat,unsigned NumRows);
2019-11-11 15:46:54 +01:00
void Usr_PutWhoIcon (Usr_Who_t Who);
2019-11-12 00:31:41 +01:00
void Usr_PutHiddenParamWho (Usr_Who_t Who);
Usr_Who_t Usr_GetHiddenParamWho (void);
2019-11-11 15:46:54 +01:00
2014-12-01 23:55:08 +01:00
#endif