2014-12-01 23:55:08 +01:00
|
|
|
|
// swad_record.h: users' record cards
|
|
|
|
|
|
|
|
|
|
#ifndef _SWAD_REC
|
|
|
|
|
#define _SWAD_REC
|
|
|
|
|
/*
|
|
|
|
|
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.
|
2023-03-10 17:21:04 +01:00
|
|
|
|
Copyright (C) 1999-2023 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_user.h"
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2017-01-29 12:42:19 +01:00
|
|
|
|
/***************************** Public constants ******************************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
2015-12-13 17:49:53 +01:00
|
|
|
|
|
2017-03-08 14:12:33 +01:00
|
|
|
|
#define Rec_MAX_CHARS_NAME_FIELD (128 - 1) // 127
|
|
|
|
|
#define Rec_MAX_BYTES_NAME_FIELD ((Rec_MAX_CHARS_NAME_FIELD + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
2017-03-08 01:21:21 +01:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#define Rec_MIN_LINES_IN_EDITION_FIELD 1
|
|
|
|
|
#define Rec_MAX_LINES_IN_EDITION_FIELD 50
|
2017-01-29 12:42:19 +01:00
|
|
|
|
#define Rec_DEF_LINES_IN_EDITION_FIELD Rec_MIN_LINES_IN_EDITION_FIELD
|
|
|
|
|
|
|
|
|
|
#define Rec_MIN_RECORDS_PER_PAGE 1
|
|
|
|
|
#define Rec_MAX_RECORDS_PER_PAGE 10
|
|
|
|
|
#define Rec_DEF_RECORDS_PER_PAGE Rec_MIN_RECORDS_PER_PAGE
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************************* Public types ********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2018-10-09 00:06:30 +02:00
|
|
|
|
#define Rec_SHARED_NUM_VIEW_TYPES 8
|
2014-12-01 23:55:08 +01:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
2017-05-30 02:17:33 +02:00
|
|
|
|
Rec_SHA_SIGN_UP_IN_CRS_FORM,
|
2015-03-05 21:42:02 +01:00
|
|
|
|
|
2016-11-18 00:17:53 +01:00
|
|
|
|
Rec_SHA_MY_RECORD_FORM,
|
2015-03-05 21:42:02 +01:00
|
|
|
|
|
2016-11-18 00:17:53 +01:00
|
|
|
|
Rec_SHA_OTHER_EXISTING_USR_FORM,
|
|
|
|
|
Rec_SHA_OTHER_NEW_USR_FORM,
|
|
|
|
|
Rec_SHA_OTHER_USR_CHECK,
|
2015-03-05 21:42:02 +01:00
|
|
|
|
|
2016-11-18 00:17:53 +01:00
|
|
|
|
Rec_SHA_RECORD_LIST,
|
|
|
|
|
Rec_SHA_RECORD_PRINT,
|
|
|
|
|
Rec_SHA_RECORD_PUBLIC,
|
|
|
|
|
} Rec_SharedRecordViewType_t;
|
2015-03-05 21:42:02 +01:00
|
|
|
|
|
2017-05-08 20:48:27 +02:00
|
|
|
|
#define Rec_COURSE_NUM_VIEW_TYPES 6
|
2016-11-18 00:17:53 +01:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
Rec_CRS_MY_RECORD_AS_STUDENT_FORM,
|
|
|
|
|
Rec_CRS_MY_RECORD_AS_STUDENT_CHECK,
|
2017-05-08 20:48:27 +02:00
|
|
|
|
Rec_CRS_LIST_ONE_RECORD,
|
|
|
|
|
Rec_CRS_LIST_SEVERAL_RECORDS,
|
|
|
|
|
Rec_CRS_PRINT_ONE_RECORD,
|
|
|
|
|
Rec_CRS_PRINT_SEVERAL_RECORDS,
|
2016-11-18 00:17:53 +01:00
|
|
|
|
} Rec_CourseRecordViewType_t;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
|
Rec_RECORD_USERS_UNKNOWN,
|
|
|
|
|
Rec_RECORD_USERS_GUESTS,
|
|
|
|
|
Rec_RECORD_USERS_STUDENTS,
|
|
|
|
|
Rec_RECORD_USERS_TEACHERS,
|
|
|
|
|
} Rec_UsrsType_t;
|
|
|
|
|
|
|
|
|
|
// Related with user's index card
|
2017-01-29 12:42:19 +01:00
|
|
|
|
#define Rec_NUM_TYPES_VISIBILITY 3
|
2014-12-01 23:55:08 +01:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
Rec_HIDDEN_FIELD = 0,
|
|
|
|
|
Rec_VISIBLE_FIELD = 1,
|
|
|
|
|
Rec_EDITABLE_FIELD = 2,
|
|
|
|
|
} Rec_VisibilityRecordFields_t;
|
2017-01-29 12:42:19 +01:00
|
|
|
|
#define Rec_VISIBILITY_DEFAULT Rec_HIDDEN_FIELD
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
struct RecordField
|
|
|
|
|
{
|
|
|
|
|
long FieldCod; // FieldCode
|
2017-03-08 01:21:21 +01:00
|
|
|
|
char Name[Rec_MAX_BYTES_NAME_FIELD + 1]; // Field name
|
2014-12-01 23:55:08 +01:00
|
|
|
|
unsigned NumLines; // Number of rows of form used to edit the filed (always >= 2)
|
|
|
|
|
Rec_VisibilityRecordFields_t Visibility; // Hidden, visible or editable by students?
|
|
|
|
|
char *Text; // Filed text
|
|
|
|
|
};
|
2017-01-29 12:42:19 +01:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
struct LstRecordFields
|
|
|
|
|
{
|
|
|
|
|
struct RecordField *Lst; // List of card fields
|
|
|
|
|
unsigned Num; // Number of fields
|
|
|
|
|
int NestedCalls; // Number of nested calls to the function that allocates memory for the list
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Public prototypes *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_ReqEditRecordFields (void);
|
|
|
|
|
void Rec_GetListRecordFieldsInCurrentCrs (void);
|
|
|
|
|
void Rec_ShowFormCreateRecordField (void);
|
|
|
|
|
void Rec_ReceiveFormField (void);
|
|
|
|
|
unsigned Rec_ConvertToNumLinesField (const char *StrNumLines);
|
2023-03-10 00:13:55 +01:00
|
|
|
|
bool Rec_CheckIfRecordFieldIsRepeated (const char *FldName);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Rec_CreateRecordField (void);
|
|
|
|
|
void Rec_ReqRemField (void);
|
|
|
|
|
void Rec_RemoveFieldFromDB (void);
|
|
|
|
|
void Rec_RemoveField (void);
|
|
|
|
|
void Rec_RenameField (void);
|
|
|
|
|
void Rec_ChangeLinesField (void);
|
|
|
|
|
void Rec_ChangeVisibilityField (void);
|
|
|
|
|
void Rec_FreeListFields (void);
|
|
|
|
|
|
|
|
|
|
void Rec_PutLinkToEditRecordFields (void);
|
2017-05-09 20:56:02 +02:00
|
|
|
|
|
|
|
|
|
void Rec_ListRecordsGstsShow (void);
|
|
|
|
|
void Rec_ListRecordsGstsPrint (void);
|
|
|
|
|
|
2019-01-10 15:26:33 +01:00
|
|
|
|
void Rec_GetUsrAndShowRecOneStdCrs (void);
|
2017-05-09 20:56:02 +02:00
|
|
|
|
void Rec_ListRecordsStdsShow (void);
|
|
|
|
|
void Rec_ListRecordsStdsPrint (void);
|
|
|
|
|
|
2019-01-10 15:26:33 +01:00
|
|
|
|
void Rec_GetUsrAndShowRecOneTchCrs (void);
|
2017-05-09 20:56:02 +02:00
|
|
|
|
void Rec_ListRecordsTchsShow (void);
|
|
|
|
|
void Rec_ListRecordsTchsPrint (void);
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Rec_UpdateAndShowMyCrsRecord (void);
|
|
|
|
|
void Rec_UpdateAndShowOtherCrsRecord (void);
|
|
|
|
|
void Rec_GetFieldsCrsRecordFromForm (void);
|
|
|
|
|
void Rec_UpdateCrsRecord (long UsrCod);
|
|
|
|
|
void Rec_AllocMemFieldsRecordsCrs (void);
|
|
|
|
|
void Rec_FreeMemFieldsRecordsCrs (void);
|
|
|
|
|
|
2017-05-30 02:17:33 +02:00
|
|
|
|
void Rec_ShowFormSignUpInCrsWithMySharedRecord (void);
|
2022-09-24 18:30:26 +02:00
|
|
|
|
void Rec_ShowFormOtherNewSharedRecord (struct Usr_Data *UsrDat,Rol_Role_t DefaultRole);
|
2019-03-09 22:01:06 +01:00
|
|
|
|
void Rec_ShowOtherSharedRecordEditable (void);
|
2016-11-18 01:07:00 +01:00
|
|
|
|
void Rec_ShowMySharedRecordUpd (void);
|
2022-09-24 18:30:26 +02:00
|
|
|
|
void Rec_ShowSharedRecordUnmodifiable (struct Usr_Data *UsrDat);
|
2018-10-09 01:04:47 +02:00
|
|
|
|
void Rec_ShowPublicSharedRecordOtherUsr (void);
|
2016-11-18 00:17:53 +01:00
|
|
|
|
void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
|
2022-09-24 18:30:26 +02:00
|
|
|
|
struct Usr_Data *UsrDat,const char *Anchor);
|
2023-03-10 00:13:55 +01:00
|
|
|
|
void Rec_PutParUsrCodEncrypted (__attribute__((unused)) void *Args);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
void Rec_UpdateMyRecord (void);
|
|
|
|
|
Rol_Role_t Rec_GetRoleFromRecordForm (void);
|
2022-09-24 18:30:26 +02:00
|
|
|
|
void Rec_GetUsrNameFromRecordForm (struct Usr_Data *UsrDat);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2018-10-09 13:41:55 +02:00
|
|
|
|
void Rec_ShowMySharedRecordAndMore (void);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Rec_ChgCountryOfMyInstitution (void);
|
|
|
|
|
void Rec_UpdateMyInstitution (void);
|
2021-03-07 21:21:04 +01:00
|
|
|
|
void Rec_UpdateMyCenter (void);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Rec_UpdateMyDepartment (void);
|
|
|
|
|
void Rec_UpdateMyOffice (void);
|
|
|
|
|
void Rec_UpdateMyOfficePhone (void);
|
|
|
|
|
|
|
|
|
|
#endif
|