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.
|
2015-01-01 14:34:06 +01:00
|
|
|
|
Copyright (C) 1999-2015 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"
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Public constants ******************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2015-03-21 19:55:00 +01:00
|
|
|
|
#define Rec_RECORD_WIDTH_WIDE 560
|
2015-03-29 13:57:24 +02:00
|
|
|
|
#define Rec_C1_TOP_WIDE 52
|
|
|
|
|
#define Rec_C2_TOP_WIDE 354
|
|
|
|
|
#define Rec_C3_TOP_WIDE 154
|
|
|
|
|
#define Rec_C1_BOTTOM_WIDE (160-2)
|
|
|
|
|
#define Rec_C2_BOTTOM_WIDE (400-2)
|
2015-03-21 19:55:00 +01:00
|
|
|
|
|
|
|
|
|
#define Rec_RECORD_WIDTH_NARROW 460
|
2015-03-29 13:57:24 +02:00
|
|
|
|
#define Rec_C1_TOP_NARROW 52
|
|
|
|
|
#define Rec_C2_TOP_NARROW 254
|
|
|
|
|
#define Rec_C3_TOP_NARROW 154
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
#define Rec_MAX_LENGTH_NAME_FIELD 255
|
|
|
|
|
#define Rec_MIN_LINES_IN_EDITION_FIELD 1
|
|
|
|
|
#define Rec_MAX_LINES_IN_EDITION_FIELD 50
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************************* Public types ********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
Rec_FORM_SIGN_UP,
|
2015-03-05 21:42:02 +01:00
|
|
|
|
|
|
|
|
|
Rec_FORM_MY_COMMON_RECORD,
|
|
|
|
|
Rec_MY_COMMON_RECORD_CHECK,
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Rec_FORM_MODIFY_RECORD_OTHER_EXISTING_USR,
|
|
|
|
|
Rec_FORM_NEW_RECORD_OTHER_NEW_USR,
|
2015-07-17 13:06:32 +02:00
|
|
|
|
Rec_CHECK_OTHER_USR_COMMON_RECORD,
|
2015-03-05 21:42:02 +01:00
|
|
|
|
|
2015-07-17 13:06:32 +02:00
|
|
|
|
Rec_FORM_MY_COURSE_RECORD_AS_STUDENT,
|
|
|
|
|
Rec_CHECK_MY_COURSE_RECORD_AS_STUDENT,
|
|
|
|
|
Rec_CHECK_OTHER_USR_COURSE_RECORD,
|
2015-03-05 21:42:02 +01:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Rec_RECORD_LIST,
|
|
|
|
|
Rec_RECORD_PRINT,
|
2015-03-05 21:42:02 +01:00
|
|
|
|
Rec_RECORD_PUBLIC,
|
2014-12-01 23:55:08 +01:00
|
|
|
|
} Rec_RecordViewType_t;
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
#define Rec_NUM_TYPES_VISIBILITY 3
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
Rec_HIDDEN_FIELD = 0,
|
|
|
|
|
Rec_VISIBLE_FIELD = 1,
|
|
|
|
|
Rec_EDITABLE_FIELD = 2,
|
|
|
|
|
} Rec_VisibilityRecordFields_t;
|
|
|
|
|
struct RecordField
|
|
|
|
|
{
|
|
|
|
|
long FieldCod; // FieldCode
|
|
|
|
|
char Name[Rec_MAX_LENGTH_NAME_FIELD+1]; // Field name
|
|
|
|
|
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
|
|
|
|
|
};
|
|
|
|
|
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_ListFieldsRecordsForEdition (void);
|
|
|
|
|
void Rec_ShowFormCreateRecordField (void);
|
|
|
|
|
void Rec_ReceiveFormField (void);
|
|
|
|
|
unsigned Rec_ConvertToNumLinesField (const char *StrNumLines);
|
|
|
|
|
bool Rec_CheckIfRecordFieldIsRepeated (const char *FieldName);
|
|
|
|
|
unsigned long Rec_GetAllFieldsInCurrCrs (MYSQL_RES **mysql_res);
|
|
|
|
|
void Rec_CreateRecordField (void);
|
|
|
|
|
void Rec_ReqRemField (void);
|
|
|
|
|
long Rec_GetFieldCod (void);
|
|
|
|
|
unsigned Rec_CountNumRecordsInCurrCrsWithField (long FieldCod);
|
|
|
|
|
void Rec_AskConfirmRemFieldWithRecords (unsigned NumRecords);
|
|
|
|
|
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);
|
|
|
|
|
void Rec_ListRecordsInvs (void);
|
2015-03-05 01:55:46 +01:00
|
|
|
|
void Rec_GetUsrAndShowRecordOneStdCrs (void);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Rec_ListRecordsStdsCrs (void);
|
2015-03-05 01:55:46 +01:00
|
|
|
|
void Rec_GetUsrAndShowRecordOneTchCrs (void);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Rec_ListRecordsTchsCrs (void);
|
|
|
|
|
void Rec_ShowLinkToPrintPreviewOfRecords (void);
|
|
|
|
|
void Rec_UpdateAndShowMyCrsRecord (void);
|
|
|
|
|
void Rec_UpdateAndShowOtherCrsRecord (void);
|
|
|
|
|
void Rec_ShowCrsRecord (Rec_RecordViewType_t TypeOfView,struct UsrData *UsrDat);
|
|
|
|
|
unsigned long Rec_GetFieldFromCrsRecord (long UsrCod,long FieldCod,MYSQL_RES **mysql_res);
|
|
|
|
|
void Rec_GetFieldsCrsRecordFromForm (void);
|
|
|
|
|
void Rec_UpdateCrsRecord (long UsrCod);
|
|
|
|
|
void Rec_RemoveFieldsCrsRecordInCrs (long UsrCod,struct Course *Crs,Cns_QuietOrVerbose_t QuietOrVerbose);
|
|
|
|
|
void Rec_RemoveFieldsCrsRecordAll (long UsrCod,Cns_QuietOrVerbose_t QuietOrVerbose);
|
|
|
|
|
void Rec_AllocMemFieldsRecordsCrs (void);
|
|
|
|
|
void Rec_FreeMemFieldsRecordsCrs (void);
|
|
|
|
|
|
|
|
|
|
void Rec_ShowFormSignUpWithMyCommonRecord (void);
|
|
|
|
|
void Rec_ShowFormMyCommRecord (void);
|
|
|
|
|
void Rec_ShowFormOtherNewCommonRecord (struct UsrData *UsrDat);
|
|
|
|
|
void Rec_ShowMyCommonRecordUpd (void);
|
|
|
|
|
void Rec_ShowCommonRecordUnmodifiable (struct UsrData *UsrDat);
|
2015-03-05 21:42:02 +01:00
|
|
|
|
void Rec_ShowSharedUsrRecord (Rec_RecordViewType_t TypeOfView,
|
|
|
|
|
struct UsrData *UsrDat);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
void Rec_UpdateMyRecord (void);
|
|
|
|
|
Rol_Role_t Rec_GetRoleFromRecordForm (void);
|
|
|
|
|
void Rec_GetUsrNameFromRecordForm (struct UsrData *UsrDat);
|
|
|
|
|
void Rec_GetUsrExtraDataFromRecordForm (struct UsrData *UsrDat);
|
|
|
|
|
|
|
|
|
|
void Rec_ShowFormMyInsCtrDpt (void);
|
|
|
|
|
void Rec_ChgCountryOfMyInstitution (void);
|
|
|
|
|
void Rec_UpdateMyInstitution (void);
|
|
|
|
|
void Rec_UpdateMyCentre (void);
|
|
|
|
|
void Rec_UpdateMyDepartment (void);
|
|
|
|
|
void Rec_UpdateMyOffice (void);
|
|
|
|
|
void Rec_UpdateMyOfficePhone (void);
|
|
|
|
|
|
|
|
|
|
#endif
|