mirror of https://github.com/acanas/swad-core.git
Version 21.30.1: Oct 13, 2021 Queries moved to module swad_record_database.
This commit is contained in:
parent
fa8ea3bf3b
commit
e0768dc58c
|
@ -980,7 +980,7 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat,
|
|||
Brw_RemoveUsrWorksInAllCrss (UsrDat); // Make this before of removing the user from the courses
|
||||
|
||||
/***** Remove the fields of course record in all courses *****/
|
||||
Rec_DB_RemoveFieldsCrsRecordAll (UsrDat->UsrCod);
|
||||
Rec_DB_RemoveAllFieldContentsFromUsrRecords (UsrDat->UsrCod);
|
||||
|
||||
/***** Remove user from all his/her projects *****/
|
||||
Prj_RemoveUsrFromProjects (UsrDat->UsrCod);
|
||||
|
|
|
@ -602,13 +602,14 @@ TODO: FIX BUG, URGENT! En las fechas como par
|
|||
|
||||
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 21.30 (2021-10-12)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 21.30.1 (2021-10-13)"
|
||||
#define CSS_FILE "swad20.45.css"
|
||||
#define JS_FILE "swad20.69.1.js"
|
||||
/*
|
||||
TODO: Rename CENTRE to CENTER in help wiki.
|
||||
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
||||
|
||||
Version 21.30.1: Oct 13, 2021 Queries moved to module swad_record_database. (319411 lines)
|
||||
Version 21.30: Oct 12, 2021 New module swad_record_database for database queries related to records. (319400 lines)
|
||||
Version 21.29: Oct 11, 2021 New module swad_project_database for database queries related to projects. (319208 lines)
|
||||
Version 21.28.1: Oct 10, 2021 Code refactoring in projects. (318975 lines)
|
||||
|
|
|
@ -1802,10 +1802,10 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
|
|||
|
||||
/***** Remove course cards of the course *****/
|
||||
/* Remove content of course cards */
|
||||
Rec_DB_RemoveCrsRecordContents (CrsCod);
|
||||
Rec_DB_RemoveAllFieldContentsInCrs (CrsCod);
|
||||
|
||||
/* Remove definition of fields in course cards */
|
||||
Rec_DB_RemoveCrsRecordFields (CrsCod);
|
||||
Rec_DB_RemoveAllFieldsInCrs (CrsCod);
|
||||
|
||||
/***** Remove information related to files in course,
|
||||
including groups and projects,
|
||||
|
|
|
@ -3225,7 +3225,7 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat,
|
|||
}
|
||||
|
||||
/***** Remove fields of this user in its course record *****/
|
||||
Rec_DB_RemoveFieldsCrsRecordInCrs (UsrDat->UsrCod,Crs->CrsCod);
|
||||
Rec_DB_RemoveAllFieldContentsFromUsrRecordInCrs (UsrDat->UsrCod,Crs->CrsCod);
|
||||
|
||||
/***** Remove some information about files in course and groups *****/
|
||||
Brw_DB_RemoveSomeInfoAboutCrsUsrFiles (UsrDat->UsrCod,Crs->CrsCod);
|
||||
|
|
101
swad_record.c
101
swad_record.c
|
@ -88,8 +88,6 @@ extern struct Globals Gbl;
|
|||
|
||||
static void Rec_WriteHeadingRecordFields (void);
|
||||
|
||||
static unsigned Rec_DB_GetAllFieldsInCurrCrs (MYSQL_RES **mysql_res);
|
||||
|
||||
static void Rec_PutParamFieldCod (void *FieldCod);
|
||||
static void Rec_GetFieldByCod (long FieldCod,char Name[Rec_MAX_BYTES_NAME_FIELD + 1],
|
||||
unsigned *NumLines,Rec_VisibilityRecordFields_t *Visibility);
|
||||
|
@ -206,20 +204,8 @@ void Rec_GetListRecordFieldsInCurrentCrs (void)
|
|||
if (++Gbl.Crs.Records.LstFields.NestedCalls > 1) // If the list is already created, don't do anything
|
||||
return;
|
||||
|
||||
/***** Get fields of records in a course from database *****/
|
||||
Gbl.Crs.Records.LstFields.Num = (unsigned)
|
||||
DB_QuerySELECT (&mysql_res,"can not get fields of records in a course",
|
||||
"SELECT FieldCod," // row[0]
|
||||
"FieldName," // row[1]
|
||||
"NumLines," // row[2]
|
||||
"Visibility" // row[3]
|
||||
" FROM crs_record_fields"
|
||||
" WHERE CrsCod=%ld"
|
||||
" ORDER BY FieldName",
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
|
||||
/***** Get the fields of records *****/
|
||||
if (Gbl.Crs.Records.LstFields.Num)
|
||||
if ((Gbl.Crs.Records.LstFields.Num = Rec_DB_GetAllFieldsInCrs (&mysql_res,Gbl.Hierarchy.Crs.CrsCod)))
|
||||
{
|
||||
/***** Create a list of fields *****/
|
||||
if ((Gbl.Crs.Records.LstFields.Lst = calloc (Gbl.Crs.Records.LstFields.Num,
|
||||
|
@ -498,13 +484,12 @@ bool Rec_CheckIfRecordFieldIsRepeated (const char *FieldName)
|
|||
unsigned NumRow;
|
||||
|
||||
/* Query database */
|
||||
if ((NumRows = Rec_DB_GetAllFieldsInCurrCrs (&mysql_res)) > 0) // If se han encontrado groups...
|
||||
/* Compare with all the tipos of group from the database */
|
||||
if ((NumRows = Rec_DB_GetAllFieldsInCrs (&mysql_res,Gbl.Hierarchy.Crs.CrsCod)) > 0) // If fields found...
|
||||
for (NumRow = 0;
|
||||
NumRow < NumRows;
|
||||
NumRow++)
|
||||
{
|
||||
/* Get next type of group */
|
||||
/* Get next field */
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
/* The name of the field is in row[1] */
|
||||
|
@ -521,24 +506,6 @@ bool Rec_CheckIfRecordFieldIsRepeated (const char *FieldName)
|
|||
return FieldIsRepeated;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******* Get the fields of records already present in current course *********/
|
||||
/*****************************************************************************/
|
||||
|
||||
static unsigned Rec_DB_GetAllFieldsInCurrCrs (MYSQL_RES **mysql_res)
|
||||
{
|
||||
/***** Get fields of records in current course from database *****/
|
||||
return DB_QuerySELECT (mysql_res,"can not get fields of records"
|
||||
" in a course",
|
||||
"SELECT FieldCod," // row[0]
|
||||
"FieldName," // row[1]
|
||||
"Visibility" // row[2]
|
||||
" FROM crs_record_fields"
|
||||
" WHERE CrsCod=%ld"
|
||||
" ORDER BY FieldName",
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Create a field of record **************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -548,15 +515,7 @@ void Rec_CreateRecordField (void)
|
|||
extern const char *Txt_Created_new_record_field_X;
|
||||
|
||||
/***** Create the new field *****/
|
||||
DB_QueryINSERT ("can not create field of record",
|
||||
"INSERT INTO crs_record_fields"
|
||||
" (CrsCod,FieldName,NumLines,Visibility)"
|
||||
" VALUES"
|
||||
" (%ld,'%s',%u,%u)",
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
Gbl.Crs.Records.Field.Name,
|
||||
Gbl.Crs.Records.Field.NumLines,
|
||||
(unsigned) Gbl.Crs.Records.Field.Visibility);
|
||||
Rec_DB_CreateField (Gbl.Hierarchy.Crs.CrsCod,&Gbl.Crs.Records.Field);
|
||||
|
||||
/***** Write message of success *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Created_new_record_field_X,
|
||||
|
@ -576,7 +535,7 @@ void Rec_ReqRemField (void)
|
|||
Err_WrongRecordFieldExit ();
|
||||
|
||||
/***** Check if exists any record with that field filled *****/
|
||||
if ((NumRecords = Rec_DB_CountNumRecordsInCurrCrsWithField (Gbl.Crs.Records.Field.FieldCod))) // There are records with that field filled
|
||||
if ((NumRecords = Rec_DB_CountNumRecordsWithFieldContent (Gbl.Crs.Records.Field.FieldCod))) // There are records with that field filled
|
||||
Rec_AskConfirmRemFieldWithRecords (NumRecords);
|
||||
else // There are no records with that field filled
|
||||
Rec_RemoveFieldFromDB ();
|
||||
|
@ -592,22 +551,6 @@ long Rec_GetFieldCod (void)
|
|||
return Par_GetParToLong ("FieldCod");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************** Get the number of records with a field filled ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Rec_DB_CountNumRecordsInCurrCrsWithField (long FieldCod)
|
||||
{
|
||||
/***** Get number of cards with a given field in a course from database *****/
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of records"
|
||||
" with a given field not empty in a course",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM crs_records"
|
||||
" WHERE FieldCod=%ld",
|
||||
FieldCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******* Request confirmation for the removing of a field with records *******/
|
||||
/*****************************************************************************/
|
||||
|
@ -650,16 +593,10 @@ void Rec_RemoveFieldFromDB (void)
|
|||
&Gbl.Crs.Records.Field.Visibility);
|
||||
|
||||
/***** Remove field from all records *****/
|
||||
DB_QueryDELETE ("can not remove field from all students' records",
|
||||
"DELETE FROM crs_records"
|
||||
" WHERE FieldCod=%ld",
|
||||
Gbl.Crs.Records.Field.FieldCod);
|
||||
Rec_DB_RemoveFieldContentFromAllUsrsRecords (Gbl.Crs.Records.Field.FieldCod);
|
||||
|
||||
/***** Remove the field *****/
|
||||
DB_QueryDELETE ("can not remove field of record",
|
||||
"DELETE FROM crs_record_fields"
|
||||
" WHERE FieldCod=%ld",
|
||||
Gbl.Crs.Records.Field.FieldCod);
|
||||
Rec_DB_RemoveField (Gbl.Crs.Records.Field.FieldCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Record_field_X_removed,
|
||||
|
@ -766,7 +703,7 @@ void Rec_RenameField (void)
|
|||
else
|
||||
{
|
||||
/* Update the table of fields changing then old name by the new one */
|
||||
Rec_DB_UpdateCrsRecordFieldName (Gbl.Crs.Records.Field.FieldCod,NewFieldName);
|
||||
Rec_DB_UpdateFieldName (Gbl.Crs.Records.Field.FieldCod,NewFieldName);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_The_record_field_X_has_been_renamed_as_Y,
|
||||
|
@ -819,7 +756,7 @@ void Rec_ChangeLinesField (void)
|
|||
else
|
||||
{
|
||||
/***** Update of the table of fields changing the old number of lines by the new one *****/
|
||||
Rec_DB_UpdateCrsRecordFieldNumLines (Gbl.Crs.Records.Field.FieldCod,NewNumLines);
|
||||
Rec_DB_UpdateFieldNumLines (Gbl.Crs.Records.Field.FieldCod,NewNumLines);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_From_now_on_the_number_of_editing_lines_of_the_field_X_is_Y,
|
||||
|
@ -864,7 +801,7 @@ void Rec_ChangeVisibilityField (void)
|
|||
else
|
||||
{
|
||||
/***** Update the table of fields changing the old visibility by the new *****/
|
||||
Rec_DB_UpdateCrsRecordFieldVisibility (Gbl.Crs.Records.Field.FieldCod,NewVisibility);
|
||||
Rec_DB_UpdateFieldVisibility (Gbl.Crs.Records.Field.FieldCod,NewVisibility);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_RECORD_FIELD_VISIBILITY_MSG[NewVisibility],
|
||||
|
@ -1791,9 +1728,9 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
|
|||
HTM_TD_End ();
|
||||
|
||||
/* Get the text of the field */
|
||||
if (Rec_DB_GetFieldFromCrsRecord (&mysql_res,
|
||||
Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod,
|
||||
UsrDat->UsrCod))
|
||||
if (Rec_DB_GetFieldTxtFromUsrRecord (&mysql_res,
|
||||
Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod,
|
||||
UsrDat->UsrCod))
|
||||
{
|
||||
ThisFieldHasText = true;
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
@ -1886,25 +1823,25 @@ void Rec_UpdateCrsRecord (long UsrCod)
|
|||
if (Rec_CheckIfICanEditField (Gbl.Crs.Records.LstFields.Lst[NumField].Visibility))
|
||||
{
|
||||
/***** Check if already exists this field for this user in database *****/
|
||||
FieldAlreadyExists = (Rec_DB_GetFieldFromCrsRecord (&mysql_res,
|
||||
Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod,
|
||||
UsrCod) != 0);
|
||||
FieldAlreadyExists = (Rec_DB_GetFieldTxtFromUsrRecord (&mysql_res,
|
||||
Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod,
|
||||
UsrCod) != 0);
|
||||
DB_FreeMySQLResult (&mysql_res);
|
||||
if (FieldAlreadyExists)
|
||||
{
|
||||
if (Gbl.Crs.Records.LstFields.Lst[NumField].Text[0])
|
||||
/***** Update text of the field of course record *****/
|
||||
Rec_DB_UpdateCrsRecordField (Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod,
|
||||
Rec_DB_UpdateFieldTxt (Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod,
|
||||
UsrCod,
|
||||
Gbl.Crs.Records.LstFields.Lst[NumField].Text);
|
||||
else
|
||||
/***** Remove text of the field of course record *****/
|
||||
Rec_DB_RemoveCrsRecordField (Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod,
|
||||
Rec_DB_RemoveFieldContentFromUsrRecord (Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod,
|
||||
UsrCod);
|
||||
}
|
||||
else if (Gbl.Crs.Records.LstFields.Lst[NumField].Text[0])
|
||||
/***** Insert text field of course record *****/
|
||||
Rec_DB_CreateCrsRecordField (Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod,
|
||||
Rec_DB_CreateFieldContent (Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod,
|
||||
UsrCod,
|
||||
Gbl.Crs.Records.LstFields.Lst[NumField].Text);
|
||||
}
|
||||
|
|
|
@ -126,7 +126,6 @@ bool Rec_CheckIfRecordFieldIsRepeated (const char *FieldName);
|
|||
void Rec_CreateRecordField (void);
|
||||
void Rec_ReqRemField (void);
|
||||
long Rec_GetFieldCod (void);
|
||||
unsigned Rec_DB_CountNumRecordsInCurrCrsWithField (long FieldCod);
|
||||
void Rec_AskConfirmRemFieldWithRecords (unsigned NumRecords);
|
||||
void Rec_RemoveFieldFromDB (void);
|
||||
void Rec_RemoveField (void);
|
||||
|
|
|
@ -76,11 +76,28 @@
|
|||
/***************************** Private prototypes ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Create a field of record **************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Rec_DB_CreateField (long CrsCod,const struct RecordField *Field)
|
||||
{
|
||||
DB_QueryINSERT ("can not create field of record",
|
||||
"INSERT INTO crs_record_fields"
|
||||
" (CrsCod,FieldName,NumLines,Visibility)"
|
||||
" VALUES"
|
||||
" (%ld,'%s',%u,%u)",
|
||||
CrsCod,
|
||||
Field->Name,
|
||||
Field->NumLines,
|
||||
(unsigned) Field->Visibility);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Insert text field of course record ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Rec_DB_CreateCrsRecordField (long FieldCod,long UsrCod,const char *Text)
|
||||
void Rec_DB_CreateFieldContent (long FieldCod,long UsrCod,const char *Text)
|
||||
{
|
||||
DB_QueryINSERT ("can not create field of record",
|
||||
"INSERT INTO crs_records"
|
||||
|
@ -96,7 +113,7 @@ void Rec_DB_CreateCrsRecordField (long FieldCod,long UsrCod,const char *Text)
|
|||
/********************* Update text field of course record ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Rec_DB_UpdateCrsRecordField (long FieldCod,long UsrCod,const char *Text)
|
||||
void Rec_DB_UpdateFieldTxt (long FieldCod,long UsrCod,const char *Text)
|
||||
{
|
||||
DB_QueryUPDATE ("can not update field of record",
|
||||
"UPDATE crs_records"
|
||||
|
@ -112,7 +129,7 @@ void Rec_DB_UpdateCrsRecordField (long FieldCod,long UsrCod,const char *Text)
|
|||
/******** Update course record field changing the old name by the new ********/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Rec_DB_UpdateCrsRecordFieldName (long FieldCod,const char NewFieldName[Rec_MAX_BYTES_NAME_FIELD + 1])
|
||||
void Rec_DB_UpdateFieldName (long FieldCod,const char NewFieldName[Rec_MAX_BYTES_NAME_FIELD + 1])
|
||||
{
|
||||
DB_QueryUPDATE ("can not update name of field of record",
|
||||
"UPDATE crs_record_fields"
|
||||
|
@ -126,7 +143,7 @@ void Rec_DB_UpdateCrsRecordFieldName (long FieldCod,const char NewFieldName[Rec_
|
|||
/*** Update course record field changing the old number of lines by the new **/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Rec_DB_UpdateCrsRecordFieldNumLines (long FieldCod,unsigned NewNumLines)
|
||||
void Rec_DB_UpdateFieldNumLines (long FieldCod,unsigned NewNumLines)
|
||||
{
|
||||
DB_QueryUPDATE ("can not update the number of lines of a record field",
|
||||
"UPDATE crs_record_fields"
|
||||
|
@ -140,7 +157,7 @@ void Rec_DB_UpdateCrsRecordFieldNumLines (long FieldCod,unsigned NewNumLines)
|
|||
/***** Update course record field changing the old visibility by the new *****/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Rec_DB_UpdateCrsRecordFieldVisibility (long FieldCod,Rec_VisibilityRecordFields_t NewVisibility)
|
||||
void Rec_DB_UpdateFieldVisibility (long FieldCod,Rec_VisibilityRecordFields_t NewVisibility)
|
||||
{
|
||||
DB_QueryUPDATE ("can not update the visibility of a record field",
|
||||
"UPDATE crs_record_fields"
|
||||
|
@ -150,6 +167,39 @@ void Rec_DB_UpdateCrsRecordFieldVisibility (long FieldCod,Rec_VisibilityRecordFi
|
|||
FieldCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************** Get the number of records with a field filled ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Rec_DB_CountNumRecordsWithFieldContent (long FieldCod)
|
||||
{
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of records with a given field not empty",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM crs_records"
|
||||
" WHERE FieldCod=%ld",
|
||||
FieldCod);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/******* Get the fields of records already present in current course *********/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Rec_DB_GetAllFieldsInCrs (MYSQL_RES **mysql_res,long CrsCod)
|
||||
{
|
||||
return (unsigned)
|
||||
DB_QuerySELECT (mysql_res,"can not get fields of records in a course",
|
||||
"SELECT FieldCod," // row[0]
|
||||
"FieldName," // row[1]
|
||||
"NumLines," // row[2]
|
||||
"Visibility" // row[3]
|
||||
" FROM crs_record_fields"
|
||||
" WHERE CrsCod=%ld"
|
||||
" ORDER BY FieldName",
|
||||
CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************** Get the data of a field of records from its code *************/
|
||||
/*****************************************************************************/
|
||||
|
@ -172,8 +222,8 @@ unsigned Rec_DB_GetFieldByCod (MYSQL_RES **mysql_res,long CrsCod,long FieldCod)
|
|||
/************** Get the text of a field of a record of course ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Rec_DB_GetFieldFromCrsRecord (MYSQL_RES **mysql_res,
|
||||
long FieldCod,long UsrCod)
|
||||
unsigned Rec_DB_GetFieldTxtFromUsrRecord (MYSQL_RES **mysql_res,
|
||||
long FieldCod,long UsrCod)
|
||||
{
|
||||
return (unsigned)
|
||||
DB_QuerySELECT (mysql_res,"can not get the text"
|
||||
|
@ -186,11 +236,23 @@ unsigned Rec_DB_GetFieldFromCrsRecord (MYSQL_RES **mysql_res,
|
|||
UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Remove field from all students' records *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Rec_DB_RemoveFieldContentFromAllUsrsRecords (long FieldCod)
|
||||
{
|
||||
DB_QueryDELETE ("can not remove field from all students' records",
|
||||
"DELETE FROM crs_records"
|
||||
" WHERE FieldCod=%ld",
|
||||
FieldCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Remove text of field of course record *******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Rec_DB_RemoveCrsRecordField (long FieldCod,long UsrCod)
|
||||
void Rec_DB_RemoveFieldContentFromUsrRecord (long FieldCod,long UsrCod)
|
||||
{
|
||||
DB_QueryDELETE ("can not remove field of record",
|
||||
"DELETE FROM crs_records"
|
||||
|
@ -204,7 +266,7 @@ void Rec_DB_RemoveCrsRecordField (long FieldCod,long UsrCod)
|
|||
/************ Remove fields of record of a user in current course ************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Rec_DB_RemoveFieldsCrsRecordInCrs (long UsrCod,long CrsCod)
|
||||
void Rec_DB_RemoveAllFieldContentsFromUsrRecordInCrs (long UsrCod,long CrsCod)
|
||||
{
|
||||
DB_QueryDELETE ("can not remove user's record in a course",
|
||||
"DELETE FROM crs_records"
|
||||
|
@ -221,7 +283,7 @@ void Rec_DB_RemoveFieldsCrsRecordInCrs (long UsrCod,long CrsCod)
|
|||
/************* Remove fields of record of a user in all courses **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Rec_DB_RemoveFieldsCrsRecordAll (long UsrCod)
|
||||
void Rec_DB_RemoveAllFieldContentsFromUsrRecords (long UsrCod)
|
||||
{
|
||||
DB_QueryDELETE ("can not remove user's records in all courses",
|
||||
"DELETE FROM crs_records"
|
||||
|
@ -233,7 +295,7 @@ void Rec_DB_RemoveFieldsCrsRecordAll (long UsrCod)
|
|||
/******************** Remove content of course record cards ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Rec_DB_RemoveCrsRecordContents (long CrsCod)
|
||||
void Rec_DB_RemoveAllFieldContentsInCrs (long CrsCod)
|
||||
{
|
||||
DB_QueryDELETE ("can not remove content of cards in a course",
|
||||
"DELETE FROM crs_records"
|
||||
|
@ -244,11 +306,23 @@ void Rec_DB_RemoveCrsRecordContents (long CrsCod)
|
|||
CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************************** Remove record field *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Rec_DB_RemoveField (long FieldCod)
|
||||
{
|
||||
DB_QueryDELETE ("can not remove field of record",
|
||||
"DELETE FROM crs_record_fields"
|
||||
" WHERE FieldCod=%ld",
|
||||
FieldCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************ Remove definition of fields in course record cards *************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Rec_DB_RemoveCrsRecordFields (long CrsCod)
|
||||
void Rec_DB_RemoveAllFieldsInCrs (long CrsCod)
|
||||
{
|
||||
DB_QueryDELETE ("can not remove fields of cards in a course",
|
||||
"DELETE FROM crs_record_fields"
|
||||
|
|
|
@ -44,20 +44,25 @@
|
|||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Rec_DB_CreateCrsRecordField (long FieldCod,long UsrCod,const char *Text);
|
||||
void Rec_DB_UpdateCrsRecordField (long FieldCod,long UsrCod,const char *Text);
|
||||
void Rec_DB_UpdateCrsRecordFieldName (long FieldCod,const char NewFieldName[Rec_MAX_BYTES_NAME_FIELD + 1]);
|
||||
void Rec_DB_UpdateCrsRecordFieldNumLines (long FieldCod,unsigned NewNumLines);
|
||||
void Rec_DB_UpdateCrsRecordFieldVisibility (long FieldCod,Rec_VisibilityRecordFields_t NewVisibility);
|
||||
void Rec_DB_CreateField (long CrsCod,const struct RecordField *Field);
|
||||
void Rec_DB_CreateFieldContent (long FieldCod,long UsrCod,const char *Text);
|
||||
void Rec_DB_UpdateFieldTxt (long FieldCod,long UsrCod,const char *Text);
|
||||
void Rec_DB_UpdateFieldName (long FieldCod,const char NewFieldName[Rec_MAX_BYTES_NAME_FIELD + 1]);
|
||||
void Rec_DB_UpdateFieldNumLines (long FieldCod,unsigned NewNumLines);
|
||||
void Rec_DB_UpdateFieldVisibility (long FieldCod,Rec_VisibilityRecordFields_t NewVisibility);
|
||||
|
||||
unsigned Rec_DB_CountNumRecordsWithFieldContent (long FieldCod);
|
||||
unsigned Rec_DB_GetAllFieldsInCrs (MYSQL_RES **mysql_res,long CrsCod);
|
||||
unsigned Rec_DB_GetFieldByCod (MYSQL_RES **mysql_res,long CrsCod,long FieldCod);
|
||||
unsigned Rec_DB_GetFieldFromCrsRecord (MYSQL_RES **mysql_res,
|
||||
long FieldCod,long UsrCod);
|
||||
unsigned Rec_DB_GetFieldTxtFromUsrRecord (MYSQL_RES **mysql_res,
|
||||
long FieldCod,long UsrCod);
|
||||
|
||||
void Rec_DB_RemoveCrsRecordField (long FieldCod,long UsrCod);
|
||||
void Rec_DB_RemoveFieldsCrsRecordInCrs (long UsrCod,long CrsCod);
|
||||
void Rec_DB_RemoveFieldsCrsRecordAll (long UsrCod);
|
||||
void Rec_DB_RemoveCrsRecordContents (long CrsCod);
|
||||
void Rec_DB_RemoveCrsRecordFields (long CrsCod);
|
||||
void Rec_DB_RemoveFieldContentFromAllUsrsRecords (long FieldCod);
|
||||
void Rec_DB_RemoveFieldContentFromUsrRecord (long FieldCod,long UsrCod);
|
||||
void Rec_DB_RemoveAllFieldContentsFromUsrRecordInCrs (long UsrCod,long CrsCod);
|
||||
void Rec_DB_RemoveAllFieldContentsFromUsrRecords (long UsrCod);
|
||||
void Rec_DB_RemoveAllFieldContentsInCrs (long CrsCod);
|
||||
void Rec_DB_RemoveField (long FieldCod);
|
||||
void Rec_DB_RemoveAllFieldsInCrs (long CrsCod);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -3915,9 +3915,9 @@ static void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames)
|
|||
NumField++)
|
||||
{
|
||||
/* Get the text of the field */
|
||||
if (Rec_DB_GetFieldFromCrsRecord (&mysql_res,
|
||||
Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod,
|
||||
UsrDat->UsrCod))
|
||||
if (Rec_DB_GetFieldTxtFromUsrRecord (&mysql_res,
|
||||
Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod,
|
||||
UsrDat->UsrCod))
|
||||
{
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
Str_Copy (Text,row[0],sizeof (Text) - 1);
|
||||
|
|
Loading…
Reference in New Issue