mirror of https://github.com/acanas/swad-core.git
Version 20.93: Jun 17, 2021 Code refactoring.
This commit is contained in:
parent
59a34f37fe
commit
3c7089216b
|
@ -2169,7 +2169,7 @@ int swad__getGroups (struct soap *soap,
|
|||
(int) MaxStudents;
|
||||
|
||||
/* Get number of current students */
|
||||
getGroupsOut->groupsArray.__ptr[NumRow].numStudents = (int) Grp_CountNumUsrsInGrp (Rol_STD,GrpCod);
|
||||
getGroupsOut->groupsArray.__ptr[NumRow].numStudents = (int) Grp_DB_CountNumUsrsInGrp (Rol_STD,GrpCod);
|
||||
|
||||
/* Get whether group is open ('Y') or closed ('N') (row[5]) */
|
||||
getGroupsOut->groupsArray.__ptr[NumRow].open = (row[5][0] == 'Y') ? 1 :
|
||||
|
@ -2343,7 +2343,7 @@ int swad__sendMyGroups (struct soap *soap,
|
|||
(int) MaxStudents;
|
||||
|
||||
/* Get number of current students */
|
||||
SendMyGroupsOut->groupsArray.__ptr[NumRow].numStudents = (int) Grp_CountNumUsrsInGrp (Rol_STD,GrpCod);
|
||||
SendMyGroupsOut->groupsArray.__ptr[NumRow].numStudents = (int) Grp_DB_CountNumUsrsInGrp (Rol_STD,GrpCod);
|
||||
|
||||
/* Get whether group is open ('Y') or closed ('N') (row[5]) */
|
||||
SendMyGroupsOut->groupsArray.__ptr[NumRow].open = (row[5][0] == 'Y') ? 1 :
|
||||
|
@ -2846,7 +2846,7 @@ static void API_GetLstGrpsSel (const char *Groups)
|
|||
{
|
||||
Str_GetNextStringUntilComma (&Ptr,LongStr,Cns_MAX_DECIMAL_DIGITS_LONG);
|
||||
Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrp] = Str_ConvertStrCodToLongCod (LongStr);
|
||||
if (Grp_CheckIfGroupBelongsToCourse (Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrp],Gbl.Hierarchy.Crs.CrsCod))
|
||||
if (Grp_DB_CheckIfGrpBelongsToCrs (Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrp],Gbl.Hierarchy.Crs.CrsCod))
|
||||
NumGrp++;
|
||||
}
|
||||
Gbl.Crs.Grps.LstGrpsSel.NumGrps = NumGrp; // Update number of groups
|
||||
|
@ -2902,7 +2902,7 @@ int swad__getAttendanceUsers (struct soap *soap,
|
|||
"Requester must be a teacher");
|
||||
|
||||
/***** Query list of attendance users *****/
|
||||
if (Grp_CheckIfAssociatedToGrps ("att_groups","AttCod",Event.AttCod))
|
||||
if (Grp_DB_CheckIfAssociatedToGrps ("att_groups","AttCod",Event.AttCod))
|
||||
// Event for one or more groups
|
||||
// Subquery: list of users in groups of this attendance event...
|
||||
// ...who have no entry in attendance list of users
|
||||
|
|
|
@ -1264,7 +1264,7 @@ static void Asg_ShowLstGrpsToEditAssignment (long AsgCod)
|
|||
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"id=\"WholeCrs\" value=\"Y\"%s"
|
||||
" onclick=\"uncheckChildren(this,'GrpCods')\"",
|
||||
Grp_CheckIfAssociatedToGrps ("asg_groups","AsgCod",AsgCod) ? "" :
|
||||
Grp_DB_CheckIfAssociatedToGrps ("asg_groups","AsgCod",AsgCod) ? "" :
|
||||
" checked=\"checked\"");
|
||||
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
||||
HTM_LABEL_End ();
|
||||
|
|
|
@ -1157,7 +1157,7 @@ static void Att_ShowLstGrpsToEditAttEvent (long AttCod)
|
|||
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"id=\"WholeCrs\" value=\"Y\"%s"
|
||||
" onclick=\"uncheckChildren(this,'GrpCods')\"",
|
||||
Grp_CheckIfAssociatedToGrps ("att_groups","AttCod",AttCod) ? "" :
|
||||
Grp_DB_CheckIfAssociatedToGrps ("att_groups","AttCod",AttCod) ? "" :
|
||||
" checked=\"checked\"");
|
||||
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
||||
HTM_LABEL_End ();
|
||||
|
|
|
@ -602,14 +602,15 @@ 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 20.92 (2021-06-11)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 20.93 (2021-06-17)"
|
||||
#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 20.92: Jun 09, 2021 New modules swad_admin and swad_admin_database for administrators. (313381 lines)
|
||||
Version 20.93: Jun 17, 2021 Code refactoring. (313382 lines)
|
||||
Version 20.92: Jun 11, 2021 New modules swad_admin and swad_admin_database for administrators. (313381 lines)
|
||||
Version 20.91.3: Jun 11, 2021 Queries moved to module swad_enrolment_database. (313173 lines)
|
||||
Version 20.91.2: Jun 11, 2021 Queries moved to module swad_enrolment_database. (313143 lines)
|
||||
Version 20.91.1: Jun 10, 2021 Queries moved to module swad_enrolment_database. (313145 lines)
|
||||
|
|
26
swad_exam.c
26
swad_exam.c
|
@ -139,7 +139,7 @@ static void Exa_RemoveExamFromAllTables (long ExaCod);
|
|||
static void Exa_RemoveAllMedFilesFromStemOfAllQstsInCrs (long CrsCod);
|
||||
static void Exa_RemoveAllMedFilesFromAnsOfAllQstsInCrs (long CrsCod);
|
||||
|
||||
static bool Exa_CheckIfSimilarExamExists (const struct Exa_Exam *Exam);
|
||||
static bool Exa_DB_CheckIfSimilarExamExists (const struct Exa_Exam *Exam);
|
||||
|
||||
static void Exa_ReceiveExamFieldsFromForm (struct Exa_Exam *Exam,
|
||||
char Txt[Cns_MAX_BYTES_TEXT + 1]);
|
||||
|
@ -619,7 +619,7 @@ static void Exa_ShowOneExam (struct Exa_Exams *Exams,
|
|||
HTM_TD_Begin ("colspan=\"2\" class=\"LT\"");
|
||||
else
|
||||
HTM_TD_Begin ("colspan=\"2\" class=\"LT COLOR%u\"",Gbl.RowEvenOdd);
|
||||
Exa_GetExamTxtFromDB (Exam->ExaCod,Txt);
|
||||
Exa_DB_GetExamTxt (Exam->ExaCod,Txt);
|
||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
||||
Txt,Cns_MAX_BYTES_TEXT,false); // Convert from HTML to rigorous HTML
|
||||
Str_InsertLinks (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
||||
|
@ -994,10 +994,10 @@ void Exa_GetDataOfExamByCod (struct Exa_Exam *Exam)
|
|||
Str_Copy (Exam->Title,row[6],sizeof (Exam->Title) - 1);
|
||||
|
||||
/* Get number of sets */
|
||||
Exam->NumSets = ExaSet_GetNumSetsExam (Exam->ExaCod);
|
||||
Exam->NumSets = Exa_DB_GetNumSetsExam (Exam->ExaCod);
|
||||
|
||||
/* Get number of questions */
|
||||
Exam->NumQsts = ExaSet_GetNumQstsExam (Exam->ExaCod);
|
||||
Exam->NumQsts = Exa_DB_GetNumQstsExam (Exam->ExaCod);
|
||||
|
||||
/* Get number of sessions */
|
||||
Exam->NumSess = ExaSes_GetNumSessionsInExam (Exam->ExaCod);
|
||||
|
@ -1062,7 +1062,7 @@ void Exa_FreeListExams (struct Exa_Exams *Exams)
|
|||
/********************** Get exam text from database **************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Exa_GetExamTxtFromDB (long ExaCod,char Txt[Cns_MAX_BYTES_TEXT + 1])
|
||||
void Exa_DB_GetExamTxt (long ExaCod,char Txt[Cns_MAX_BYTES_TEXT + 1])
|
||||
{
|
||||
/***** Get text of exam from database *****/
|
||||
DB_QuerySELECTString (Txt,Cns_MAX_BYTES_TEXT,"can not get exam text",
|
||||
|
@ -1157,7 +1157,7 @@ void Exa_RemoveExam (void)
|
|||
static void Exa_RemoveExamFromAllTables (long ExaCod)
|
||||
{
|
||||
/***** Remove all sessions in this exam *****/
|
||||
ExaSes_RemoveSessionsInExamFromAllTables (ExaCod);
|
||||
Exa_DB_RemoveSessionsInExamFromAllTables (ExaCod);
|
||||
|
||||
/***** Remove exam questions *****/
|
||||
DB_QueryDELETE ("can not remove exam questions",
|
||||
|
@ -1191,7 +1191,7 @@ void Exa_RemoveCrsExams (long CrsCod)
|
|||
ExaPrn_RemoveCrsPrints (CrsCod);
|
||||
|
||||
/***** Remove all sessions in the course *****/
|
||||
ExaSes_RemoveSessionInCourseFromAllTables (CrsCod);
|
||||
Exa_DB_RemoveSessionInCourseFromAllTables (CrsCod);
|
||||
|
||||
/***** Remove media associated to test questions in the course *****/
|
||||
Exa_RemoveAllMedFilesFromStemOfAllQstsInCrs (CrsCod);
|
||||
|
@ -1375,7 +1375,7 @@ void Exa_UnhideExam (void)
|
|||
/******************* Check if the title of an exam exists *******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static bool Exa_CheckIfSimilarExamExists (const struct Exa_Exam *Exam)
|
||||
static bool Exa_DB_CheckIfSimilarExamExists (const struct Exa_Exam *Exam)
|
||||
{
|
||||
/***** Get number of exams with a field value from database *****/
|
||||
return (DB_QueryCOUNT ("can not get similar exams",
|
||||
|
@ -1444,7 +1444,7 @@ void Exa_PutFormsOneExam (struct Exa_Exams *Exams,
|
|||
if (ItsANewExam)
|
||||
Txt[0] = '\0';
|
||||
else
|
||||
Exa_GetExamTxtFromDB (Exam->ExaCod,Txt);
|
||||
Exa_DB_GetExamTxt (Exam->ExaCod,Txt);
|
||||
|
||||
/***** Put form to create/edit an exam *****/
|
||||
Exa_PutFormEditionExam (Exams,Exam,Txt,ItsANewExam);
|
||||
|
@ -1653,7 +1653,7 @@ static bool Exa_CheckExamFieldsReceivedFromForm (const struct Exa_Exam *Exam)
|
|||
if (Exam->Title[0]) // If there's an exam title
|
||||
{
|
||||
/* If title of exam was in database... */
|
||||
if (Exa_CheckIfSimilarExamExists (Exam))
|
||||
if (Exa_DB_CheckIfSimilarExamExists (Exam))
|
||||
{
|
||||
NewExamIsCorrect = false;
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_Already_existed_an_exam_with_the_title_X,
|
||||
|
@ -1749,7 +1749,7 @@ bool Exa_CheckIfEditable (const struct Exa_Exam *Exam)
|
|||
/*****************************************************************************/
|
||||
// Returns the number of courses with exams in this location
|
||||
|
||||
unsigned Exa_GetNumCoursesWithExams (HieLvl_Level_t Scope)
|
||||
unsigned Exa_DB_GetNumCoursesWithExams (HieLvl_Level_t Scope)
|
||||
{
|
||||
/***** Get number of courses with exams from database *****/
|
||||
switch (Scope)
|
||||
|
@ -1819,7 +1819,7 @@ unsigned Exa_GetNumCoursesWithExams (HieLvl_Level_t Scope)
|
|||
/*****************************************************************************/
|
||||
// Returns the number of exams in this location
|
||||
|
||||
unsigned Exa_GetNumExams (HieLvl_Level_t Scope)
|
||||
unsigned Exa_DB_GetNumExams (HieLvl_Level_t Scope)
|
||||
{
|
||||
/***** Get number of exams from database *****/
|
||||
switch (Scope)
|
||||
|
@ -1888,7 +1888,7 @@ unsigned Exa_GetNumExams (HieLvl_Level_t Scope)
|
|||
/************* Get average number of questions per course exam ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
double Exa_GetNumQstsPerCrsExam (HieLvl_Level_t Scope)
|
||||
double Exa_DB_GetNumQstsPerCrsExam (HieLvl_Level_t Scope)
|
||||
{
|
||||
/***** Get number of questions per exam from database *****/
|
||||
switch (Scope)
|
||||
|
|
|
@ -68,7 +68,7 @@ void Exa_GetDataOfExamByCod (struct Exa_Exam *Exam);
|
|||
void Exa_GetDataOfExamByFolder (struct Exa_Exam *Exam);
|
||||
void Exa_FreeListExams (struct Exa_Exams *Exams);
|
||||
|
||||
void Exa_GetExamTxtFromDB (long ExaCod,char Txt[Cns_MAX_BYTES_TEXT + 1]);
|
||||
void Exa_DB_GetExamTxt (long ExaCod,char Txt[Cns_MAX_BYTES_TEXT + 1]);
|
||||
|
||||
void Exa_AskRemExam (void);
|
||||
void Exa_RemoveExam (void);
|
||||
|
@ -91,8 +91,8 @@ void Exa_ReceiveFormExam (void);
|
|||
|
||||
bool Exa_CheckIfEditable (const struct Exa_Exam *Exam);
|
||||
|
||||
unsigned Exa_GetNumCoursesWithExams (HieLvl_Level_t Scope);
|
||||
unsigned Exa_GetNumExams (HieLvl_Level_t Scope);
|
||||
double Exa_GetNumQstsPerCrsExam (HieLvl_Level_t Scope);
|
||||
unsigned Exa_DB_GetNumCoursesWithExams (HieLvl_Level_t Scope);
|
||||
unsigned Exa_DB_GetNumExams (HieLvl_Level_t Scope);
|
||||
double Exa_DB_GetNumQstsPerCrsExam (HieLvl_Level_t Scope);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -341,7 +341,6 @@ void ExaLog_ShowExamLog (const struct ExaPrn_Print *Print)
|
|||
|
||||
/***** Write heading *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"RB",Txt_Click);
|
||||
HTM_TH (1,1,"LB",Txt_Date_and_time);
|
||||
HTM_TH (1,1,"LB",Txt_Action);
|
||||
|
@ -350,7 +349,6 @@ void ExaLog_ShowExamLog (const struct ExaPrn_Print *Print)
|
|||
HTM_TH (1,1,"LB",Txt_IP);
|
||||
HTM_TH (1,1,"LB",Txt_Session);
|
||||
HTM_TH (1,1,"LB",Txt_Web_browser);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Write clicks *****/
|
||||
|
|
|
@ -146,9 +146,9 @@ static void ExaPrn_GetAnswerFromDB (struct ExaPrn_Print *Print,long QstCod,
|
|||
static void ExaPrn_StoreOneQstOfPrintInDB (const struct ExaPrn_Print *Print,
|
||||
unsigned QstInd);
|
||||
|
||||
static void ExaPrn_GetNumQstsNotBlank (struct ExaPrn_Print *Print);
|
||||
static void ExaPrn_ComputeTotalScoreOfPrint (struct ExaPrn_Print *Print);
|
||||
static void ExaPrn_UpdatePrintInDB (const struct ExaPrn_Print *Print);
|
||||
static unsigned Exa_DB_GetNumQstsNotBlankInPrint (long PrnCod);
|
||||
static double Exa_DB_ComputeTotalScoreOfPrint (long PrnCod);
|
||||
static void Exa_DB_UpdatePrint (const struct ExaPrn_Print *Print);
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************************** Reset exam print *******************************/
|
||||
|
@ -688,16 +688,11 @@ static void ExaPrn_ShowExamPrintToFillIt (struct Exa_Exams *Exams,
|
|||
|
||||
|
||||
/***** Show user and time *****/
|
||||
/* Begin table */
|
||||
HTM_TABLE_BeginWideMarginPadding (10);
|
||||
|
||||
/* User */
|
||||
ExaRes_ShowExamResultUser (&Gbl.Usrs.Me.UsrDat);
|
||||
|
||||
/* End table */
|
||||
HTM_TABLE_End ();
|
||||
|
||||
/* Exam description */
|
||||
/***** Exam description *****/
|
||||
ExaPrn_GetAndWriteDescription (Exam->ExaCod);
|
||||
|
||||
if (Print->NumQsts.All)
|
||||
|
@ -721,7 +716,7 @@ static void ExaPrn_GetAndWriteDescription (long ExaCod)
|
|||
char Txt[Cns_MAX_BYTES_TEXT + 1];
|
||||
|
||||
/***** Get description from database *****/
|
||||
Exa_GetExamTxtFromDB (ExaCod,Txt);
|
||||
Exa_DB_GetExamTxt (ExaCod,Txt);
|
||||
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML, // Convert from HTML to rigorous HTML
|
||||
Txt,Cns_MAX_BYTES_TEXT,false);
|
||||
Str_InsertLinks (Txt,Cns_MAX_BYTES_TEXT,60); // Insert links
|
||||
|
@ -1110,9 +1105,9 @@ void ExaPrn_ReceivePrintAnswer (void)
|
|||
ExaPrn_ComputeScoreAndStoreQuestionOfPrint (&Print,QstInd);
|
||||
|
||||
/* Update exam print in database */
|
||||
ExaPrn_GetNumQstsNotBlank (&Print);
|
||||
ExaPrn_ComputeTotalScoreOfPrint (&Print);
|
||||
ExaPrn_UpdatePrintInDB (&Print);
|
||||
Print.NumQsts.NotBlank = Exa_DB_GetNumQstsNotBlankInPrint (Print.PrnCod);
|
||||
Print.Score.All = Exa_DB_ComputeTotalScoreOfPrint (Print.PrnCod);
|
||||
Exa_DB_UpdatePrint (&Print);
|
||||
|
||||
/***** Show table with questions to answer *****/
|
||||
ExaPrn_ShowTableWithQstsToFill (&Exams,&Print);
|
||||
|
@ -1485,37 +1480,35 @@ static void ExaPrn_StoreOneQstOfPrintInDB (const struct ExaPrn_Print *Print,
|
|||
/************ Get number of questions not blank in an exam print *************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void ExaPrn_GetNumQstsNotBlank (struct ExaPrn_Print *Print)
|
||||
static unsigned Exa_DB_GetNumQstsNotBlankInPrint (long PrnCod)
|
||||
{
|
||||
/***** Count number of questions not blank in exam print in database *****/
|
||||
Print->NumQsts.NotBlank = (unsigned)
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get number of questions not blank",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM exa_print_questions"
|
||||
" WHERE PrnCod=%ld"
|
||||
" AND Answers<>''",
|
||||
Print->PrnCod);
|
||||
PrnCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************** Compute score of questions of an exam print ***************/
|
||||
/************* Compute total score of questions of an exam print *************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void ExaPrn_ComputeTotalScoreOfPrint (struct ExaPrn_Print *Print)
|
||||
static double Exa_DB_ComputeTotalScoreOfPrint (long PrnCod)
|
||||
{
|
||||
/***** Compute total score of exam print *****/
|
||||
Print->Score.All = DB_QuerySELECTDouble ("can not get score of exam print",
|
||||
return DB_QuerySELECTDouble ("can not get score of exam print",
|
||||
"SELECT SUM(Score)"
|
||||
" FROM exa_print_questions"
|
||||
" WHERE PrnCod=%ld",
|
||||
Print->PrnCod);
|
||||
PrnCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************** Update exam print in database ************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void ExaPrn_UpdatePrintInDB (const struct ExaPrn_Print *Print)
|
||||
static void Exa_DB_UpdatePrint (const struct ExaPrn_Print *Print)
|
||||
{
|
||||
/***** Update exam print in database *****/
|
||||
Str_SetDecimalPointToUS (); // To print the floating point as a dot
|
||||
|
|
|
@ -576,8 +576,10 @@ static void ExaRes_ShowResultsBegin (struct Exa_Exams *Exams,
|
|||
{
|
||||
extern const char *Hlp_ASSESSMENT_Exams_results;
|
||||
|
||||
/***** Begin box *****/
|
||||
/***** Begin section *****/
|
||||
HTM_SECTION_Begin (ExaRes_RESULTS_BOX_ID);
|
||||
|
||||
/***** Begin box *****/
|
||||
Box_BoxBegin ("100%",Title,
|
||||
NULL,NULL,
|
||||
Hlp_ASSESSMENT_Exams_results,Box_NOT_CLOSABLE);
|
||||
|
@ -586,19 +588,25 @@ static void ExaRes_ShowResultsBegin (struct Exa_Exams *Exams,
|
|||
if (ListExamsToSelect)
|
||||
ExaRes_ListExamsToSelect (Exams);
|
||||
|
||||
/***** Begin session results table *****/
|
||||
/***** Begin session results section *****/
|
||||
HTM_SECTION_Begin (ExaRes_RESULTS_TABLE_ID);
|
||||
|
||||
/* Begin session results table */
|
||||
HTM_TABLE_BeginWidePadding (5);
|
||||
}
|
||||
|
||||
static void ExaRes_ShowResultsEnd (void)
|
||||
{
|
||||
/***** End session results table *****/
|
||||
/* End session results table */
|
||||
HTM_TABLE_End ();
|
||||
|
||||
/***** End session results section *****/
|
||||
HTM_SECTION_End ();
|
||||
|
||||
/***** End box *****/
|
||||
Box_BoxEnd ();
|
||||
|
||||
/***** End section *****/
|
||||
HTM_SECTION_End ();
|
||||
}
|
||||
|
||||
|
@ -635,10 +643,8 @@ static void ExaRes_ListExamsToSelect (struct Exa_Exams *Exams)
|
|||
|
||||
/***** Heading row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,2,NULL,NULL);
|
||||
HTM_TH (1,1,"LM",Txt_Exam);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** List the sessions *****/
|
||||
|
@ -721,7 +727,6 @@ static void ExaRes_ShowHeaderResults (Usr_MeOrOther_t MeOrOther)
|
|||
|
||||
/***** First row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (3,2,"CT LINE_BOTTOM",Txt_User[MeOrOther == Usr_ME ? Gbl.Usrs.Me.UsrDat.Sex :
|
||||
Usr_SEX_UNKNOWN]);
|
||||
HTM_TH (3,1,"LT LINE_BOTTOM",Txt_START_END_TIME[Dat_START_TIME]);
|
||||
|
@ -732,12 +737,10 @@ static void ExaRes_ShowHeaderResults (Usr_MeOrOther_t MeOrOther)
|
|||
HTM_TH (1,2,"CT LINE_LEFT",Txt_Score);
|
||||
HTM_TH (3,1,"RT LINE_BOTTOM LINE_LEFT",Txt_Grade);
|
||||
HTM_TH (3,1,"LINE_BOTTOM LINE_LEFT",NULL);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Second row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (2,1,"RT LINE_BOTTOM LINE_LEFT",Txt_total);
|
||||
HTM_TH (2,1,"RT LINE_BOTTOM",Txt_QUESTIONS_valid);
|
||||
HTM_TH (2,1,"RT LINE_BOTTOM",Txt_QUESTIONS_invalid);
|
||||
|
@ -746,12 +749,10 @@ static void ExaRes_ShowHeaderResults (Usr_MeOrOther_t MeOrOther)
|
|||
HTM_TH (1,1,"RT",Txt_ANSWERS_blank);
|
||||
HTM_TH (1,1,"RT LINE_LEFT",Txt_total);
|
||||
HTM_TH (1,1,"RT",Txt_average);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Third row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"RT LINE_BOTTOM LINE_LEFT","{<em>p<sub>i</sub></em>=1}");
|
||||
HTM_TH (1,1,"RT LINE_BOTTOM","{-1≤<em>p<sub>i</sub></em><0}");
|
||||
HTM_TH (1,1,"RT LINE_BOTTOM","{<em>p<sub>i</sub></em>=0}");
|
||||
|
@ -759,7 +760,6 @@ static void ExaRes_ShowHeaderResults (Usr_MeOrOther_t MeOrOther)
|
|||
HTM_TH (1,1,"RT LINE_BOTTOM","{<em>p<sub>i</sub></em>=0}");
|
||||
HTM_TH (1,1,"RT LINE_BOTTOM LINE_LEFT","<em>Σp<sub>i</sub></em>");
|
||||
HTM_TH (1,1,"RT LINE_BOTTOM","-1≤<em style=\"text-decoration:overline;\">p</em>≤1");
|
||||
|
||||
HTM_TR_End ();
|
||||
}
|
||||
|
||||
|
@ -1448,6 +1448,8 @@ static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam,
|
|||
Box_BoxBegin (NULL,Session->Title,
|
||||
NULL,NULL,
|
||||
Hlp_ASSESSMENT_Exams_results,Box_NOT_CLOSABLE);
|
||||
|
||||
/***** Header *****/
|
||||
Lay_WriteHeaderClassPhoto (false,false,
|
||||
Gbl.Hierarchy.Ins.InsCod,
|
||||
Gbl.Hierarchy.Deg.DegCod,
|
||||
|
@ -1465,25 +1467,25 @@ static void ExaRes_ShowExamResult (const struct Exa_Exam *Exam,
|
|||
/***** Begin table *****/
|
||||
HTM_TABLE_BeginWideMarginPadding (10);
|
||||
|
||||
/***** User *****/
|
||||
/* User */
|
||||
ExaRes_ShowExamResultUser (UsrDat);
|
||||
|
||||
/***** Start/end time (for user in this exam print) *****/
|
||||
/* Start/end time (for user in this exam print) */
|
||||
ExaRes_ShowExamResultTime (Print);
|
||||
|
||||
/***** Number of questions *****/
|
||||
/* Number of questions */
|
||||
ExaRes_ShowExamResultNumQsts (Print,ICanView);
|
||||
|
||||
/***** Number of answers *****/
|
||||
/* Number of answers */
|
||||
ExaRes_ShowExamResultNumAnss (Print,ICanView);
|
||||
|
||||
/***** Score *****/
|
||||
/* Score */
|
||||
ExaRes_ShowExamResultScore (Print,ICanView);
|
||||
|
||||
/***** Grade *****/
|
||||
/* Grade */
|
||||
ExaRes_ShowExamResultGrade (Exam,Print,ICanView);
|
||||
|
||||
/***** Write answers and solutions *****/
|
||||
/* Answers and solutions */
|
||||
if (ICanView->Result)
|
||||
ExaRes_ShowExamAnswers (UsrDat,Print,Visibility);
|
||||
|
||||
|
|
|
@ -107,8 +107,8 @@ static void ExaSes_ListOneOrMoreSessionsResultTch (struct Exa_Exams *Exams,
|
|||
static void ExaSes_GetSessionDataFromRow (MYSQL_RES *mysql_res,
|
||||
struct ExaSes_Session *Session);
|
||||
|
||||
static void ExaSes_RemoveSessionFromAllTables (long SesCod);
|
||||
static void ExaSes_RemoveUsrSesResultsInCrs (long UsrCod,long CrsCod,const char *TableName);
|
||||
static void Exa_DB_RemoveSessionFromAllTables (long SesCod);
|
||||
static void Exa_DB_RemoveUsrSesResultsInCrs (long UsrCod,long CrsCod,const char *TableName);
|
||||
|
||||
static void ExaSes_PutFormSession (const struct ExaSes_Session *Session);
|
||||
static void ExaSes_ShowLstGrpsToCreateSession (long SesCod);
|
||||
|
@ -116,8 +116,8 @@ static void ExaSes_ShowLstGrpsToCreateSession (long SesCod);
|
|||
static void ExaSes_CreateSession (struct ExaSes_Session *Session);
|
||||
static void ExaSes_UpdateSession (struct ExaSes_Session *Session);
|
||||
|
||||
static void ExaSes_CreateGrps (long SesCod);
|
||||
static void ExaSes_RemoveGroups (long SesCod);
|
||||
static void Exa_DB_CreateGrpsAssociatedToExamSession (long SesCod,const struct ListCodGrps *LstGrpsSel);
|
||||
static void Exa_DB_RemoveGrpsAssociatedToExamSession (long SesCod);
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Reset exam session ****************************/
|
||||
|
@ -385,8 +385,10 @@ static void ExaSes_ListOneOrMoreSessions (struct Exa_Exams *Exams,
|
|||
/***** Reset session *****/
|
||||
ExaSes_ResetSession (&Session);
|
||||
|
||||
/***** Write the heading *****/
|
||||
/***** Begin table with sessions *****/
|
||||
HTM_TABLE_BeginWidePadding (2);
|
||||
|
||||
/***** Write the heading *****/
|
||||
ExaSes_ListOneOrMoreSessionsHeading (ICanEditSessions);
|
||||
|
||||
/***** Write rows *****/
|
||||
|
@ -443,7 +445,7 @@ static void ExaSes_ListOneOrMoreSessions (struct Exa_Exams *Exams,
|
|||
}
|
||||
}
|
||||
|
||||
/***** End table *****/
|
||||
/***** End table with sessions *****/
|
||||
HTM_TABLE_End ();
|
||||
}
|
||||
|
||||
|
@ -533,12 +535,12 @@ static void ExaSes_ListOneOrMoreSessionsIcons (struct Exa_Exams *Exams,
|
|||
const struct ExaSes_Session *Session,
|
||||
const char *Anchor)
|
||||
{
|
||||
/***** Begin cell *****/
|
||||
HTM_TD_Begin ("class=\"BT%u\"",Gbl.RowEvenOdd);
|
||||
|
||||
Exams->ExaCod = Session->ExaCod;
|
||||
Exams->SesCod = Session->SesCod;
|
||||
|
||||
/***** Begin cell *****/
|
||||
HTM_TD_Begin ("class=\"BT%u\"",Gbl.RowEvenOdd);
|
||||
|
||||
/***** Icon to remove the exam session *****/
|
||||
Ico_PutContextualIconToRemove (ActReqRemExaSes,NULL,
|
||||
ExaSes_PutParamsEdit,Exams);
|
||||
|
@ -960,7 +962,7 @@ void ExaSes_RemoveSession (void)
|
|||
Err_NoPermissionExit ();
|
||||
|
||||
/***** Remove the exam session from all database tables *****/
|
||||
ExaSes_RemoveSessionFromAllTables (Session.SesCod);
|
||||
Exa_DB_RemoveSessionFromAllTables (Session.SesCod);
|
||||
|
||||
/***** Write message *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Session_X_removed,
|
||||
|
@ -978,7 +980,7 @@ void ExaSes_RemoveSession (void)
|
|||
/******************* Remove exam session from all tables *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void ExaSes_RemoveSessionFromAllTables (long SesCod)
|
||||
static void Exa_DB_RemoveSessionFromAllTables (long SesCod)
|
||||
{
|
||||
/* To delete orphan exam prints:
|
||||
// DELETE FROM exa_print_questions WHERE PrnCod IN (SELECT PrnCod FROM exa_prints WHERE SesCod NOT IN (SELECT SesCod FROM exa_sessions));
|
||||
|
@ -1017,7 +1019,7 @@ static void ExaSes_RemoveSessionFromAllTables (long SesCod)
|
|||
/**************** Remove exam session in exam from all tables ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void ExaSes_RemoveSessionsInExamFromAllTables (long ExaCod)
|
||||
void Exa_DB_RemoveSessionsInExamFromAllTables (long ExaCod)
|
||||
{
|
||||
/***** Remove exam prints in this session *****/
|
||||
/*
|
||||
|
@ -1060,7 +1062,7 @@ void ExaSes_RemoveSessionsInExamFromAllTables (long ExaCod)
|
|||
/*************** Remove exam session in course from all tables ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void ExaSes_RemoveSessionInCourseFromAllTables (long CrsCod)
|
||||
void Exa_DB_RemoveSessionInCourseFromAllTables (long CrsCod)
|
||||
{
|
||||
/***** Remove exam prints in this course *****/
|
||||
/*
|
||||
|
@ -1112,13 +1114,13 @@ void ExaSes_RemoveSessionInCourseFromAllTables (long CrsCod)
|
|||
/************* Remove user from secondary exam session tables ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void ExaSes_RemoveUsrFromSessionTablesInCrs (long UsrCod,long CrsCod)
|
||||
void Exa_DB_RemoveUsrFromSessionTablesInCrs (long UsrCod,long CrsCod)
|
||||
{
|
||||
/***** Remove student from secondary tables *****/
|
||||
ExaSes_RemoveUsrSesResultsInCrs (UsrCod,CrsCod,"exa_prints");
|
||||
Exa_DB_RemoveUsrSesResultsInCrs (UsrCod,CrsCod,"exa_prints");
|
||||
}
|
||||
|
||||
static void ExaSes_RemoveUsrSesResultsInCrs (long UsrCod,long CrsCod,const char *TableName)
|
||||
static void Exa_DB_RemoveUsrSesResultsInCrs (long UsrCod,long CrsCod,const char *TableName)
|
||||
{
|
||||
/***** Remove sessions in course from secondary table *****/
|
||||
DB_QueryDELETE ("can not remove sessions of a user from table",
|
||||
|
@ -1386,7 +1388,7 @@ static void ExaSes_ShowLstGrpsToCreateSession (long SesCod)
|
|||
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"id=\"WholeCrs\" value=\"Y\"%s"
|
||||
" onclick=\"uncheckChildren(this,'GrpCods')\"",
|
||||
Grp_CheckIfAssociatedToGrps ("exa_groups","SesCod",SesCod) ? "" :
|
||||
Grp_DB_CheckIfAssociatedToGrps ("exa_groups","SesCod",SesCod) ? "" :
|
||||
" checked=\"checked\"");
|
||||
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
||||
HTM_LABEL_End ();
|
||||
|
@ -1599,7 +1601,7 @@ static void ExaSes_CreateSession (struct ExaSes_Session *Session)
|
|||
|
||||
/***** Create groups associated to the exam session *****/
|
||||
if (Gbl.Crs.Grps.LstGrpsSel.NumGrps)
|
||||
ExaSes_CreateGrps (Session->SesCod);
|
||||
Exa_DB_CreateGrpsAssociatedToExamSession (Session->SesCod,&Gbl.Crs.Grps.LstGrpsSel);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1633,22 +1635,22 @@ static void ExaSes_UpdateSession (struct ExaSes_Session *Session)
|
|||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
|
||||
/***** Update groups associated to the exam session *****/
|
||||
ExaSes_RemoveGroups (Session->SesCod); // Remove all groups associated to this session
|
||||
Exa_DB_RemoveGrpsAssociatedToExamSession (Session->SesCod); // Remove all groups associated to this session
|
||||
if (Gbl.Crs.Grps.LstGrpsSel.NumGrps)
|
||||
ExaSes_CreateGrps (Session->SesCod); // Associate new groups
|
||||
Exa_DB_CreateGrpsAssociatedToExamSession (Session->SesCod,&Gbl.Crs.Grps.LstGrpsSel); // Associate new groups
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************** Create groups associated to an exam session *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void ExaSes_CreateGrps (long SesCod)
|
||||
static void Exa_DB_CreateGrpsAssociatedToExamSession (long SesCod,const struct ListCodGrps *LstGrpsSel)
|
||||
{
|
||||
unsigned NumGrpSel;
|
||||
|
||||
/***** Create groups associated to the exam session *****/
|
||||
for (NumGrpSel = 0;
|
||||
NumGrpSel < Gbl.Crs.Grps.LstGrpsSel.NumGrps;
|
||||
NumGrpSel < LstGrpsSel->NumGrps;
|
||||
NumGrpSel++)
|
||||
/* Create group */
|
||||
DB_QueryINSERT ("can not associate a group to an exam session",
|
||||
|
@ -1657,14 +1659,14 @@ static void ExaSes_CreateGrps (long SesCod)
|
|||
" VALUES"
|
||||
" (%ld,%ld)",
|
||||
SesCod,
|
||||
Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]);
|
||||
LstGrpsSel->GrpCods[NumGrpSel]);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Remove all groups from one session *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void ExaSes_RemoveGroups (long SesCod)
|
||||
static void Exa_DB_RemoveGrpsAssociatedToExamSession (long SesCod)
|
||||
{
|
||||
/***** Remove all groups from one session *****/
|
||||
DB_QueryDELETE ("can not remove groups associated to a session",
|
||||
|
@ -1677,7 +1679,7 @@ static void ExaSes_RemoveGroups (long SesCod)
|
|||
/******************** Remove one group from all sessions *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void ExaSes_RemoveGroup (long GrpCod)
|
||||
void Exa_DB_RemoveGrpAssociatedToExamSessions (long GrpCod)
|
||||
{
|
||||
/***** Remove group from all the sessions *****/
|
||||
DB_QueryDELETE ("can not remove group"
|
||||
|
@ -1691,7 +1693,7 @@ void ExaSes_RemoveGroup (long GrpCod)
|
|||
/**************** Remove groups of one type from all sessions ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void ExaSes_RemoveGroupsOfType (long GrpTypCod)
|
||||
void Exa_DB_RemoveGroupsOfTypeAssociatedToExamSessions (long GrpTypCod)
|
||||
{
|
||||
/***** Remove group from all the sessions *****/
|
||||
DB_QueryDELETE ("can not remove groups of a type"
|
||||
|
|
|
@ -61,9 +61,9 @@ void ExaSes_ToggleVisResultsSesUsr (void);
|
|||
void ExaSes_RequestRemoveSession (void);
|
||||
void ExaSes_RemoveSession (void);
|
||||
|
||||
void ExaSes_RemoveSessionsInExamFromAllTables (long ExaCod);
|
||||
void ExaSes_RemoveSessionInCourseFromAllTables (long CrsCod);
|
||||
void ExaSes_RemoveUsrFromSessionTablesInCrs (long UsrCod,long CrsCod);
|
||||
void Exa_DB_RemoveSessionsInExamFromAllTables (long ExaCod);
|
||||
void Exa_DB_RemoveSessionInCourseFromAllTables (long CrsCod);
|
||||
void Exa_DB_RemoveUsrFromSessionTablesInCrs (long UsrCod,long CrsCod);
|
||||
|
||||
void ExaSes_HideSession (void);
|
||||
void ExaSes_UnhideSession (void);
|
||||
|
@ -79,8 +79,8 @@ void ExaSes_PutButtonNewSession (struct Exa_Exams *Exams,long ExaCod);
|
|||
void ExaSes_RequestCreatOrEditSession (void);
|
||||
void ExaSes_ReceiveFormSession (void);
|
||||
|
||||
void ExaSes_RemoveGroup (long GrpCod);
|
||||
void ExaSes_RemoveGroupsOfType (long GrpTypCod);
|
||||
void Exa_DB_RemoveGrpAssociatedToExamSessions (long GrpCod);
|
||||
void Exa_DB_RemoveGroupsOfTypeAssociatedToExamSessions (long GrpTypCod);
|
||||
|
||||
unsigned ExaSes_GetNumSessionsInExam (long ExaCod);
|
||||
unsigned ExaSes_GetNumOpenSessionsInExam (long ExaCod);
|
||||
|
|
|
@ -81,9 +81,9 @@ extern struct Globals Gbl;
|
|||
|
||||
static void ExaSet_PutParamsOneQst (void *Exams);
|
||||
|
||||
static unsigned ExaSet_GetNumQstsInSet (long SetCod);
|
||||
static unsigned Exa_DB_GetNumQstsInSet (long SetCod);
|
||||
|
||||
static bool ExaSet_CheckIfSimilarSetExists (const struct ExaSet_Set *Set,
|
||||
static bool Exa_DB_CheckIfSimilarSetExists (const struct ExaSet_Set *Set,
|
||||
const char Title[ExaSet_MAX_BYTES_TITLE + 1]);
|
||||
|
||||
static void ExaSet_PutFormNewSet (struct Exa_Exams *Exams,
|
||||
|
@ -96,9 +96,9 @@ static bool ExaSet_CheckSetTitleReceivedFromForm (const struct ExaSet_Set *Set,
|
|||
|
||||
static void ExaSet_CreateSet (struct ExaSet_Set *Set);
|
||||
static void ExaSet_UpdateSet (const struct ExaSet_Set *Set);
|
||||
static void ExaSet_UpdateSetTitleDB (const struct ExaSet_Set *Set,
|
||||
static void Exa_DB_UpdateSetTitle (const struct ExaSet_Set *Set,
|
||||
const char NewTitle[ExaSet_MAX_BYTES_TITLE + 1]);
|
||||
static void ExaSet_UpdateNumQstsToExamDB (const struct ExaSet_Set *Set,
|
||||
static void Exa_DB_UpdateNumQstsToExam (const struct ExaSet_Set *Set,
|
||||
unsigned NumQstsToPrint);
|
||||
|
||||
static void ExaSet_PutParamSetCod (long SetCod);
|
||||
|
@ -106,10 +106,10 @@ static void ExaSet_PutParamSetCod (long SetCod);
|
|||
static unsigned ExaSet_GetSetIndFromSetCod (long ExaCod,long SetCod);
|
||||
static long ExaSet_GetSetCodFromSetInd (long ExaCod,unsigned SetInd);
|
||||
|
||||
static unsigned ExaSet_GetMaxSetIndexInExam (long ExaCod);
|
||||
static unsigned Exa_DB_GetMaxSetIndexInExam (long ExaCod);
|
||||
|
||||
static unsigned ExaSet_GetPrevSetIndexInExam (long ExaCod,unsigned SetInd);
|
||||
static unsigned ExaSet_GetNextSetIndexInExam (long ExaCod,unsigned SetInd);
|
||||
static unsigned Exa_DB_GetPrevSetIndexInExam (long ExaCod,unsigned SetInd);
|
||||
static unsigned Exa_DB_GetNextSetIndexInExam (long ExaCod,unsigned SetInd);
|
||||
|
||||
static void ExaSet_ListSetQuestions (struct Exa_Exams *Exams,
|
||||
const struct Exa_Exam *Exam,
|
||||
|
@ -189,7 +189,7 @@ long ExaSet_GetParamSetCod (void)
|
|||
/********************* Get number of questions in a set **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static unsigned ExaSet_GetNumQstsInSet (long SetCod)
|
||||
static unsigned Exa_DB_GetNumQstsInSet (long SetCod)
|
||||
{
|
||||
/***** Get number of questions in set from database *****/
|
||||
return (unsigned)
|
||||
|
@ -266,7 +266,7 @@ void ExaSet_GetDataOfSetByCod (struct ExaSet_Set *Set)
|
|||
/************** Check if the title of a set of questions exists **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static bool ExaSet_CheckIfSimilarSetExists (const struct ExaSet_Set *Set,
|
||||
static bool Exa_DB_CheckIfSimilarSetExists (const struct ExaSet_Set *Set,
|
||||
const char Title[ExaSet_MAX_BYTES_TITLE + 1])
|
||||
{
|
||||
/***** Get number of set of questions with a field value from database *****/
|
||||
|
@ -427,7 +427,7 @@ static bool ExaSet_CheckSetTitleReceivedFromForm (const struct ExaSet_Set *Set,
|
|||
if (strcmp (Set->Title,NewTitle)) // Different titles
|
||||
{
|
||||
/* If title of set was in database... */
|
||||
if (ExaSet_CheckIfSimilarSetExists (Set,NewTitle))
|
||||
if (Exa_DB_CheckIfSimilarSetExists (Set,NewTitle))
|
||||
{
|
||||
NewTitleIsCorrect = false;
|
||||
Ale_ShowAlert (Ale_WARNING,Txt_Already_existed_a_set_of_questions_in_this_exam_with_the_title_X,
|
||||
|
@ -478,7 +478,7 @@ void ExaSet_ChangeSetTitle (void)
|
|||
if (ExaSet_CheckSetTitleReceivedFromForm (&Set,NewTitle))
|
||||
{
|
||||
/* Update the table changing old title by new title */
|
||||
ExaSet_UpdateSetTitleDB (&Set,NewTitle);
|
||||
Exa_DB_UpdateSetTitle (&Set,NewTitle);
|
||||
|
||||
/* Update title */
|
||||
Str_Copy (Set.Title,NewTitle,sizeof (Set.Title) - 1);
|
||||
|
@ -525,7 +525,7 @@ void ExaSet_ChangeNumQstsToExam (void)
|
|||
if (NumQstsToPrint != Set.NumQstsToPrint)
|
||||
{
|
||||
/* Update the table changing old number by new number */
|
||||
ExaSet_UpdateNumQstsToExamDB (&Set,NumQstsToPrint);
|
||||
Exa_DB_UpdateNumQstsToExam (&Set,NumQstsToPrint);
|
||||
|
||||
/* Update title */
|
||||
Set.NumQstsToPrint = NumQstsToPrint;
|
||||
|
@ -546,7 +546,7 @@ static void ExaSet_CreateSet (struct ExaSet_Set *Set)
|
|||
unsigned MaxSetInd;
|
||||
|
||||
/***** Get maximum set index *****/
|
||||
MaxSetInd = ExaSet_GetMaxSetIndexInExam (Set->ExaCod);
|
||||
MaxSetInd = Exa_DB_GetMaxSetIndexInExam (Set->ExaCod);
|
||||
|
||||
/***** Create a new exam *****/
|
||||
Set->SetCod =
|
||||
|
@ -595,7 +595,7 @@ static void ExaSet_UpdateSet (const struct ExaSet_Set *Set)
|
|||
/************************ Update set title in database ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void ExaSet_UpdateSetTitleDB (const struct ExaSet_Set *Set,
|
||||
static void Exa_DB_UpdateSetTitle (const struct ExaSet_Set *Set,
|
||||
const char NewTitle[ExaSet_MAX_BYTES_TITLE + 1])
|
||||
{
|
||||
/***** Update set of questions changing old title by new title *****/
|
||||
|
@ -613,7 +613,7 @@ static void ExaSet_UpdateSetTitleDB (const struct ExaSet_Set *Set,
|
|||
/****** Update number of questions to appear in exam print in database *******/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void ExaSet_UpdateNumQstsToExamDB (const struct ExaSet_Set *Set,
|
||||
static void Exa_DB_UpdateNumQstsToExam (const struct ExaSet_Set *Set,
|
||||
unsigned NumQstsToPrint)
|
||||
{
|
||||
/***** Update set of questions changing old number by new number *****/
|
||||
|
@ -631,7 +631,7 @@ static void ExaSet_UpdateNumQstsToExamDB (const struct ExaSet_Set *Set,
|
|||
/******************* Get number of questions of an exam *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned ExaSet_GetNumSetsExam (long ExaCod)
|
||||
unsigned Exa_DB_GetNumSetsExam (long ExaCod)
|
||||
{
|
||||
/***** Get number of sets in an exam from database *****/
|
||||
return (unsigned)
|
||||
|
@ -646,7 +646,7 @@ unsigned ExaSet_GetNumSetsExam (long ExaCod)
|
|||
/******************* Get number of questions of an exam *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned ExaSet_GetNumQstsExam (long ExaCod)
|
||||
unsigned Exa_DB_GetNumQstsExam (long ExaCod)
|
||||
{
|
||||
/***** Get total number of questions to appear in exam print *****/
|
||||
return DB_QuerySELECTUnsigned ("can not get number of questions in an exam print",
|
||||
|
@ -688,7 +688,7 @@ void ExaSet_RequestCreatOrEditSet (void)
|
|||
/***** Get exam data from database *****/
|
||||
Exa_GetDataOfExamByCod (&Exam);
|
||||
Exams.ExaCod = Exam.ExaCod;
|
||||
Exa_GetExamTxtFromDB (Exam.ExaCod,Txt);
|
||||
Exa_DB_GetExamTxt (Exam.ExaCod,Txt);
|
||||
|
||||
/***** Get set data *****/
|
||||
if (ItsANewSet)
|
||||
|
@ -828,7 +828,7 @@ static long ExaSet_GetSetCodFromSetInd (long ExaCod,unsigned SetInd)
|
|||
// Question index can be 1, 2, 3...
|
||||
// Return 0 if no questions
|
||||
|
||||
static unsigned ExaSet_GetMaxSetIndexInExam (long ExaCod)
|
||||
static unsigned Exa_DB_GetMaxSetIndexInExam (long ExaCod)
|
||||
{
|
||||
/***** Get maximum set index in an exam from database *****/
|
||||
return DB_QuerySELECTUnsigned ("can not get max set index",
|
||||
|
@ -844,7 +844,7 @@ static unsigned ExaSet_GetMaxSetIndexInExam (long ExaCod)
|
|||
// Input set index can be 1, 2, 3... n-1
|
||||
// Return set index will be 1, 2, 3... n if previous set exists, or 0 if no previous set
|
||||
|
||||
static unsigned ExaSet_GetPrevSetIndexInExam (long ExaCod,unsigned SetInd)
|
||||
static unsigned Exa_DB_GetPrevSetIndexInExam (long ExaCod,unsigned SetInd)
|
||||
{
|
||||
/***** Get previous set index in an exam from database *****/
|
||||
// Although indexes are always continuous...
|
||||
|
@ -864,7 +864,7 @@ static unsigned ExaSet_GetPrevSetIndexInExam (long ExaCod,unsigned SetInd)
|
|||
// Input set index can be 0, 1, 2, 3... n-1
|
||||
// Return set index will be 1, 2, 3... n if next set exists, or big number if no next set
|
||||
|
||||
static unsigned ExaSet_GetNextSetIndexInExam (long ExaCod,unsigned SetInd)
|
||||
static unsigned Exa_DB_GetNextSetIndexInExam (long ExaCod,unsigned SetInd)
|
||||
{
|
||||
/***** Get next set index in an exam from database *****/
|
||||
// Although indexes are always continuous...
|
||||
|
@ -895,7 +895,7 @@ void ExaSet_ListExamSets (struct Exa_Exams *Exams,
|
|||
bool ICanEditSets = Exa_CheckIfEditable (Exam);
|
||||
|
||||
/***** Get maximum set index *****/
|
||||
MaxSetInd = ExaSet_GetMaxSetIndexInExam (Exam->ExaCod);
|
||||
MaxSetInd = Exa_DB_GetMaxSetIndexInExam (Exam->ExaCod);
|
||||
|
||||
/***** Get data of set of questions from database *****/
|
||||
NumSets = (unsigned)
|
||||
|
@ -1007,8 +1007,10 @@ static void ExaSet_ListOneOrMoreSetsForEdition (struct Exa_Exams *Exams,
|
|||
if (!NumSets)
|
||||
return;
|
||||
|
||||
/***** Write the heading *****/
|
||||
/***** Begin table *****/
|
||||
HTM_TABLE_BeginWideMarginPadding (5);
|
||||
|
||||
/***** Write the heading *****/
|
||||
ExaSet_PutTableHeadingForSets ();
|
||||
|
||||
/***** Write rows *****/
|
||||
|
@ -1120,7 +1122,7 @@ static void ExaSet_ListOneOrMoreSetsForEdition (struct Exa_Exams *Exams,
|
|||
/***** Current number of questions in set *****/
|
||||
HTM_TD_Begin ("class=\"RT COLOR%u\"",Gbl.RowEvenOdd);
|
||||
HTM_SPAN_Begin ("class=\"EXA_SET_NUM_QSTS\"");
|
||||
HTM_Unsigned (ExaSet_GetNumQstsInSet (Set.SetCod));
|
||||
HTM_Unsigned (Exa_DB_GetNumQstsInSet (Set.SetCod));
|
||||
HTM_SPAN_End ();
|
||||
HTM_TD_End ();
|
||||
|
||||
|
@ -1239,8 +1241,10 @@ static void ExaSet_ListOneOrMoreQuestionsForEdition (struct Exa_Exams *Exams,
|
|||
[Tst_VALID_QUESTION ] = Txt_Valid_question,
|
||||
};
|
||||
|
||||
/***** Write the heading *****/
|
||||
/***** Begin table *****/
|
||||
HTM_TABLE_BeginWideMarginPadding (5);
|
||||
|
||||
/***** Write the heading *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH_Empty (1);
|
||||
|
@ -1286,6 +1290,7 @@ static void ExaSet_ListOneOrMoreQuestionsForEdition (struct Exa_Exams *Exams,
|
|||
ExaSet_PutParamsOneQst,Exams,
|
||||
Icon[Question.Validity],
|
||||
Title[Question.Validity]);
|
||||
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** List question *****/
|
||||
|
@ -1862,7 +1867,7 @@ void ExaSet_MoveUpSet (void)
|
|||
if (SetIndBottom > 1)
|
||||
{
|
||||
/* Indexes of sets to be exchanged */
|
||||
SetIndTop = ExaSet_GetPrevSetIndexInExam (Exam.ExaCod,SetIndBottom);
|
||||
SetIndTop = Exa_DB_GetPrevSetIndexInExam (Exam.ExaCod,SetIndBottom);
|
||||
if (SetIndTop == 0)
|
||||
Err_ShowErrorAndExit ("Wrong set index.");
|
||||
|
||||
|
@ -1907,13 +1912,13 @@ void ExaSet_MoveDownSet (void)
|
|||
SetIndTop = ExaSet_GetSetIndFromSetCod (Exam.ExaCod,Set.SetCod);
|
||||
|
||||
/***** Get maximum set index *****/
|
||||
MaxSetInd = ExaSet_GetMaxSetIndexInExam (Exam.ExaCod);
|
||||
MaxSetInd = Exa_DB_GetMaxSetIndexInExam (Exam.ExaCod);
|
||||
|
||||
/***** Move down set *****/
|
||||
if (SetIndTop < MaxSetInd)
|
||||
{
|
||||
/* Indexes of sets to be exchanged */
|
||||
SetIndBottom = ExaSet_GetNextSetIndexInExam (Exam.ExaCod,SetIndTop);
|
||||
SetIndBottom = Exa_DB_GetNextSetIndexInExam (Exam.ExaCod,SetIndTop);
|
||||
if (SetIndBottom == ExaSet_AFTER_LAST_SET)
|
||||
Err_ShowErrorAndExit ("Wrong set index.");
|
||||
|
||||
|
|
|
@ -48,8 +48,8 @@ void ExaSet_ReceiveFormSet (void);
|
|||
void ExaSet_ChangeSetTitle (void);
|
||||
void ExaSet_ChangeNumQstsToExam (void);
|
||||
|
||||
unsigned ExaSet_GetNumSetsExam (long ExaCod);
|
||||
unsigned ExaSet_GetNumQstsExam (long ExaCod);
|
||||
unsigned Exa_DB_GetNumSetsExam (long ExaCod);
|
||||
unsigned Exa_DB_GetNumQstsExam (long ExaCod);
|
||||
|
||||
void ExaSet_RequestCreatOrEditSet (void);
|
||||
void ExaSet_ReqSelectQstsToAddToSet (void);
|
||||
|
|
194
swad_figure.c
194
swad_figure.c
|
@ -203,7 +203,6 @@ static void Fig_GetAndShowNumUsrsPerIconSet (void);
|
|||
static void Fig_GetAndShowNumUsrsPerMenu (void);
|
||||
static void Fig_GetAndShowNumUsrsPerTheme (void);
|
||||
static void Fig_GetAndShowNumUsrsPerSideColumns (void);
|
||||
unsigned Fig_GetNumUsrsWhoChoseAnOption (const char *SubQuery);
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Show use of the platform *************************/
|
||||
|
@ -247,6 +246,7 @@ static void Fig_ReqShowFigure (Fig_FigureType_t SelectedFigureType)
|
|||
Sco_GetScope ("ScopeFig");
|
||||
Sco_PutSelectorScope ("ScopeFig",HTM_DONT_SUBMIT_ON_CHANGE);
|
||||
HTM_LABEL_End ();
|
||||
|
||||
HTM_BR ();
|
||||
|
||||
/***** Type of statistic *****/
|
||||
|
@ -402,19 +402,19 @@ static void Fig_GetAndShowUsersStats (void)
|
|||
|
||||
/***** Write heading *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"RM",Txt_Users);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_users);
|
||||
HTM_TH (1,1,"RM",Txt_Average_number_of_courses_to_which_a_user_belongs);
|
||||
HTM_TH (1,1,"RM",Txt_Average_number_of_users_belonging_to_a_course);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Figures *****/
|
||||
Fig_GetAndShowNumUsrsInCrss (Rol_STD); // Students
|
||||
Fig_GetAndShowNumUsrsInCrss (Rol_NET); // Non-editing teachers
|
||||
Fig_GetAndShowNumUsrsInCrss (Rol_TCH); // Teachers
|
||||
Fig_GetAndShowNumUsrsInCrss (Rol_UNK); // Any user in courses
|
||||
|
||||
/***** Separator *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
HTM_TH (1,4,"SEPAR_ROW",NULL);
|
||||
HTM_TR_End ();
|
||||
|
@ -525,7 +525,6 @@ static void Fig_GetAndShowUsersRanking (void)
|
|||
|
||||
/***** Write heading *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"CM",Txt_Clicks);
|
||||
HTM_TH (1,1,"CM",Txt_Clicks_per_day);
|
||||
HTM_TH (1,1,"CM",Txt_Timeline);
|
||||
|
@ -533,7 +532,6 @@ static void Fig_GetAndShowUsersRanking (void)
|
|||
HTM_TH (1,1,"CM",Txt_Downloads);
|
||||
HTM_TH (1,1,"CM",Txt_Forums);
|
||||
HTM_TH (1,1,"CM",Txt_Messages);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Rankings *****/
|
||||
|
@ -1506,12 +1504,9 @@ static void Fig_ShowInss (MYSQL_RES **mysql_res,unsigned NumInss,
|
|||
case Usr_LIST_AS_LISTING:
|
||||
/***** Draw institutions as a list *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH_Empty (1);
|
||||
|
||||
HTM_TH (1,1,"LM",Txt_Institution);
|
||||
HTM_TH (1,1,"RM",TxtFigure);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
for (NumIns = 1, NumOrder = 1, NumberLastRow = 0;
|
||||
|
@ -2645,7 +2640,6 @@ static void Fig_WriteStatsExpTreesTableHead1 (void)
|
|||
extern const char *Txt_Size;
|
||||
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"LM",Txt_File_zones);
|
||||
HTM_TH (1,1,"RM",Txt_Courses);
|
||||
HTM_TH (1,1,"RM",Txt_Groups);
|
||||
|
@ -2654,7 +2648,6 @@ static void Fig_WriteStatsExpTreesTableHead1 (void)
|
|||
HTM_TH (1,1,"RM",Txt_Folders);
|
||||
HTM_TH (1,1,"RM",Txt_Files);
|
||||
HTM_TH (1,1,"RM",Txt_Size);
|
||||
|
||||
HTM_TR_End ();
|
||||
}
|
||||
|
||||
|
@ -2924,11 +2917,9 @@ static void Fig_GetAndShowOERsStats (void)
|
|||
|
||||
/***** Write table heading *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"LM",Txt_License);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_private_files);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_public_files);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
for (License = (Brw_License_t) 0;
|
||||
|
@ -3136,11 +3127,9 @@ static void Fig_GetAndShowCourseProgramStats (void) // TODO: Change function fro
|
|||
|
||||
/***** Write table heading *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_BR_program_items);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_BR_courses_with_BR_program_items);
|
||||
HTM_TH (1,1,"RM",Txt_Average_number_BR_of_items_BR_per_course);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Write number of assignments *****/
|
||||
|
@ -3194,12 +3183,10 @@ static void Fig_GetAndShowAssignmentsStats (void)
|
|||
|
||||
/***** Write table heading *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_BR_assignments);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_BR_courses_with_BR_assignments);
|
||||
HTM_TH (1,1,"RM",Txt_Average_number_BR_of_ASSIG_BR_per_course);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_BR_notifications);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Write number of assignments *****/
|
||||
|
@ -3255,11 +3242,9 @@ static void Fig_GetAndShowProjectsStats (void)
|
|||
|
||||
/***** Write table heading *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_BR_projects);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_BR_courses_with_BR_projects);
|
||||
HTM_TH (1,1,"RM",Txt_Average_number_BR_of_projects_BR_per_course);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Write number of projects *****/
|
||||
|
@ -3312,7 +3297,6 @@ static void Fig_GetAndShowTestsStats (void)
|
|||
|
||||
/***** Write table heading *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"LM",Txt_Type_of_BR_answers);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_BR_courses_BR_with_test_BR_questions);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_BR_courses_with_BR_exportable_BR_test_BR_questions);
|
||||
|
@ -3322,7 +3306,6 @@ static void Fig_GetAndShowTestsStats (void)
|
|||
HTM_TH (1,1,"RM",Txt_Average_BR_number_of_BR_times_that_BR_questions_BR_have_been_BR_responded_BR_per_course);
|
||||
HTM_TH (1,1,"RM",Txt_Average_BR_number_of_BR_times_that_BR_a_question_BR_has_been_BR_responded);
|
||||
HTM_TH (1,1,"RM",Txt_Average_BR_score_BR_per_question);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
for (AnsType = (Tst_AnswerType_t) 0;
|
||||
|
@ -3446,8 +3429,8 @@ static void Fig_GetAndShowExamsStats (void)
|
|||
double NumExamsPerCourse = 0.0;
|
||||
|
||||
/***** Get the number of exams from this location *****/
|
||||
if ((NumExams = Exa_GetNumExams (Gbl.Scope.Current)))
|
||||
if ((NumCoursesWithExams = Exa_GetNumCoursesWithExams (Gbl.Scope.Current)) != 0)
|
||||
if ((NumExams = Exa_DB_GetNumExams (Gbl.Scope.Current)))
|
||||
if ((NumCoursesWithExams = Exa_DB_GetNumCoursesWithExams (Gbl.Scope.Current)) != 0)
|
||||
NumExamsPerCourse = (double) NumExams / (double) NumCoursesWithExams;
|
||||
|
||||
/***** Begin box and table *****/
|
||||
|
@ -3457,11 +3440,9 @@ static void Fig_GetAndShowExamsStats (void)
|
|||
|
||||
/***** Write table heading *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_BR_exams);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_BR_courses_with_BR_exams);
|
||||
HTM_TH (1,1,"RM",Txt_Average_number_BR_of_exams_BR_per_course);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Write number of exams *****/
|
||||
|
@ -3512,11 +3493,9 @@ static void Fig_GetAndShowGamesStats (void)
|
|||
|
||||
/***** Write table heading *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_BR_games);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_BR_courses_with_BR_games);
|
||||
HTM_TH (1,1,"RM",Txt_Average_number_BR_of_games_BR_per_course);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Write number of games *****/
|
||||
|
@ -3570,13 +3549,11 @@ static void Fig_GetAndShowTimelineActivityStats (void)
|
|||
|
||||
/***** Heading row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"LM",Txt_Type);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_posts);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_users);
|
||||
HTM_TH (1,1,"RM",Txt_PERCENT_of_users);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_posts_BR_per_user);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Get total number of users *****/
|
||||
|
@ -3913,11 +3890,9 @@ static void Fig_GetAndShowFollowStats (void)
|
|||
|
||||
/***** Heading row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"LM",Txt_Users);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_users);
|
||||
HTM_TH (1,1,"RM",Txt_PERCENT_of_users);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Get total number of users *****/
|
||||
|
@ -4214,7 +4189,6 @@ static void Fig_GetAndShowForumStats (void)
|
|||
|
||||
/***** Write table heading *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH_Begin (1,1,"BT");
|
||||
Ico_PutIcon ("comments.svg",Txt_Scope,"ICO16x16");
|
||||
HTM_TH_End ();
|
||||
|
@ -4226,7 +4200,6 @@ static void Fig_GetAndShowForumStats (void)
|
|||
HTM_TH (1,1,"RT",Txt_Number_of_threads_BR_per_forum);
|
||||
HTM_TH (1,1,"RT",Txt_Number_of_posts_BR_per_thread);
|
||||
HTM_TH (1,1,"RT",Txt_Number_of_posts_BR_per_forum);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Write a row for each type of forum *****/
|
||||
|
@ -4396,8 +4369,8 @@ static void Fig_WriteForumTitleAndStats (For_ForumType_t ForumType,
|
|||
char *ForumName;
|
||||
|
||||
/***** Compute number of forums, number of threads and number of posts *****/
|
||||
NumForums = For_GetNumTotalForumsOfType (ForumType,CtyCod,InsCod,CtrCod,DegCod,CrsCod);
|
||||
NumThreads = For_GetNumTotalThrsInForumsOfType (ForumType,CtyCod,InsCod,CtrCod,DegCod,CrsCod);
|
||||
NumForums = For_DB_GetNumTotalForumsOfType (ForumType,CtyCod,InsCod,CtrCod,DegCod,CrsCod);
|
||||
NumThreads = For_DB_GetNumTotalThrsInForumsOfType (ForumType,CtyCod,InsCod,CtrCod,DegCod,CrsCod);
|
||||
NumPosts = For_GetNumTotalPstsInForumsOfType (ForumType,CtyCod,InsCod,CtrCod,DegCod,CrsCod,&NumUsrsToBeNotifiedByEMail);
|
||||
|
||||
/***** Compute number of threads per forum, number of posts per forum and number of posts per thread *****/
|
||||
|
@ -4558,13 +4531,11 @@ static void Fig_GetAndShowNumUsrsPerNotifyEvent (void)
|
|||
|
||||
/***** Heading row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"LM",Txt_Event);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_users);
|
||||
HTM_TH (1,1,"RM",Txt_PERCENT_of_users);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_events);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_emails);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Get total number of users *****/
|
||||
|
@ -4573,7 +4544,7 @@ static void Fig_GetAndShowNumUsrsPerNotifyEvent (void)
|
|||
/***** Get total number of users who want to be
|
||||
notified by email on some event, from database *****/
|
||||
NumUsrsTotalWhoWantToBeNotifiedByEMailAboutSomeEvent =
|
||||
Fig_GetNumUsrsWhoChoseAnOption ("usr_data.EmailNtfEvents<>0");
|
||||
Usr_DB_GetNumUsrsWhoChoseAnOption ("usr_data.EmailNtfEvents<>0");
|
||||
|
||||
/***** For each notify event... *****/
|
||||
for (NotifyEvent = (Ntf_NotifyEvent_t) 1;
|
||||
|
@ -4584,7 +4555,7 @@ static void Fig_GetAndShowNumUsrsPerNotifyEvent (void)
|
|||
if (asprintf (&SubQuery,"((usr_data.EmailNtfEvents & %u)<>0)",
|
||||
(1 << NotifyEvent)) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
NumUsrs[NotifyEvent] = Fig_GetNumUsrsWhoChoseAnOption (SubQuery);
|
||||
NumUsrs[NotifyEvent] = Usr_DB_GetNumUsrsWhoChoseAnOption (SubQuery);
|
||||
free (SubQuery);
|
||||
|
||||
/* Get number of notifications by email from database */
|
||||
|
@ -4802,13 +4773,11 @@ static void Fig_GetAndShowNoticesStats (void)
|
|||
|
||||
/***** Write table heading *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"RM",Txt_NOTICE_Active_BR_notices);
|
||||
HTM_TH (1,1,"RM",Txt_NOTICE_Obsolete_BR_notices);
|
||||
HTM_TH (1,1,"RM",Txt_NOTICE_Deleted_BR_notices);
|
||||
HTM_TH (1,1,"RM",Txt_Total);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_BR_notifications);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Write number of notices *****/
|
||||
|
@ -4874,13 +4843,11 @@ static void Fig_GetAndShowMsgsStats (void)
|
|||
|
||||
/***** Write table heading *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"LM",Txt_Messages);
|
||||
HTM_TH (1,1,"RM",Txt_MSGS_Not_deleted);
|
||||
HTM_TH (1,1,"RM",Txt_MSGS_Deleted);
|
||||
HTM_TH (1,1,"RM",Txt_Total);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_BR_notifications);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Write number of messages *****/
|
||||
|
@ -4960,12 +4927,10 @@ static void Fig_GetAndShowAgendasStats (void)
|
|||
|
||||
/***** Heading row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_events);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_users);
|
||||
HTM_TH (1,1,"RM",Txt_PERCENT_of_users);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_events_per_user);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Number of agenda events *****/
|
||||
|
@ -5041,13 +5006,11 @@ static void Fig_GetAndShowSurveysStats (void)
|
|||
|
||||
/***** Write table heading *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_BR_surveys);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_BR_courses_with_BR_surveys);
|
||||
HTM_TH (1,1,"RM",Txt_Average_number_BR_of_surveys_BR_per_course);
|
||||
HTM_TH (1,1,"RM",Txt_Average_number_BR_of_questions_BR_per_survey);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_BR_notifications);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** Write number of surveys *****/
|
||||
|
@ -5132,11 +5095,9 @@ static void Fig_GetAndShowNumUsrsPerPrivacyForAnObject (const char *TxtObject,
|
|||
|
||||
/***** Heading row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"LM",TxtObject);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_users);
|
||||
HTM_TH (1,1,"RM",Txt_PERCENT_of_users);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** For each privacy option... *****/
|
||||
|
@ -5149,7 +5110,7 @@ static void Fig_GetAndShowNumUsrsPerPrivacyForAnObject (const char *TxtObject,
|
|||
if (asprintf (&SubQuery,"usr_data.%s='%s'",
|
||||
FieldName,Pri_VisibilityDB[Visibility]) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
NumUsrs[Visibility] = Fig_GetNumUsrsWhoChoseAnOption (SubQuery);
|
||||
NumUsrs[Visibility] = Usr_DB_GetNumUsrsWhoChoseAnOption (SubQuery);
|
||||
free (SubQuery);
|
||||
|
||||
/* Update total number of users */
|
||||
|
@ -5221,11 +5182,9 @@ static void Fig_GetAndShowNumUsrsPerCookies (void)
|
|||
|
||||
/***** Heading row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"LM",Txt_Cookies);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_users);
|
||||
HTM_TH (1,1,"RM",Txt_PERCENT_of_users);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** For each option... *****/
|
||||
|
@ -5237,7 +5196,7 @@ static void Fig_GetAndShowNumUsrsPerCookies (void)
|
|||
if (asprintf (&SubQuery,"usr_data.ThirdPartyCookies='%c'",
|
||||
AcceptedInDB[i]) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
NumUsrs[i] = Fig_GetNumUsrsWhoChoseAnOption (SubQuery);
|
||||
NumUsrs[i] = Usr_DB_GetNumUsrsWhoChoseAnOption (SubQuery);
|
||||
free (SubQuery);
|
||||
|
||||
/* Update total number of users */
|
||||
|
@ -5297,11 +5256,9 @@ static void Fig_GetAndShowNumUsrsPerLanguage (void)
|
|||
|
||||
/***** Heading row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"LM",Txt_Language);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_users);
|
||||
HTM_TH (1,1,"RM",Txt_PERCENT_of_users);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** For each language... *****/
|
||||
|
@ -5313,7 +5270,7 @@ static void Fig_GetAndShowNumUsrsPerLanguage (void)
|
|||
if (asprintf (&SubQuery,"usr_data.Language='%s'",
|
||||
Lan_STR_LANG_ID[Lan]) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
NumUsrs[Lan] = Fig_GetNumUsrsWhoChoseAnOption (SubQuery);
|
||||
NumUsrs[Lan] = Usr_DB_GetNumUsrsWhoChoseAnOption (SubQuery);
|
||||
free (SubQuery);
|
||||
|
||||
/* Update total number of users */
|
||||
|
@ -5375,11 +5332,9 @@ static void Fig_GetAndShowNumUsrsPerFirstDayOfWeek (void)
|
|||
|
||||
/***** Heading row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"LM",Txt_Calendar);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_users);
|
||||
HTM_TH (1,1,"RM",Txt_PERCENT_of_users);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** For each day... *****/
|
||||
|
@ -5392,7 +5347,7 @@ static void Fig_GetAndShowNumUsrsPerFirstDayOfWeek (void)
|
|||
if (asprintf (&SubQuery,"usr_data.FirstDayOfWeek=%u",
|
||||
(unsigned) FirstDayOfWeek) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
NumUsrs[FirstDayOfWeek] = Fig_GetNumUsrsWhoChoseAnOption (SubQuery);
|
||||
NumUsrs[FirstDayOfWeek] = Usr_DB_GetNumUsrsWhoChoseAnOption (SubQuery);
|
||||
free (SubQuery);
|
||||
|
||||
/* Update total number of users */
|
||||
|
@ -5459,11 +5414,9 @@ static void Fig_GetAndShowNumUsrsPerDateFormat (void)
|
|||
|
||||
/***** Heading row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"LM",Txt_Format);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_users);
|
||||
HTM_TH (1,1,"RM",Txt_PERCENT_of_users);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** For each format... *****/
|
||||
|
@ -5475,7 +5428,7 @@ static void Fig_GetAndShowNumUsrsPerDateFormat (void)
|
|||
if (asprintf (&SubQuery,"usr_data.DateFormat=%u",
|
||||
(unsigned) Format) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
NumUsrs[Format] = Fig_GetNumUsrsWhoChoseAnOption (SubQuery);
|
||||
NumUsrs[Format] = Usr_DB_GetNumUsrsWhoChoseAnOption (SubQuery);
|
||||
free (SubQuery);
|
||||
|
||||
/* Update total number of users */
|
||||
|
@ -5537,11 +5490,9 @@ static void Fig_GetAndShowNumUsrsPerIconSet (void)
|
|||
|
||||
/***** Heading row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"LM",Txt_Icons);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_users);
|
||||
HTM_TH (1,1,"RM",Txt_PERCENT_of_users);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** For each icon set... *****/
|
||||
|
@ -5553,7 +5504,7 @@ static void Fig_GetAndShowNumUsrsPerIconSet (void)
|
|||
if (asprintf (&SubQuery,"usr_data.IconSet='%s'",
|
||||
Ico_IconSetId[IconSet]) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
NumUsrs[IconSet] = Fig_GetNumUsrsWhoChoseAnOption (SubQuery);
|
||||
NumUsrs[IconSet] = Usr_DB_GetNumUsrsWhoChoseAnOption (SubQuery);
|
||||
free (SubQuery);
|
||||
|
||||
/* Update total number of users */
|
||||
|
@ -5618,11 +5569,9 @@ static void Fig_GetAndShowNumUsrsPerMenu (void)
|
|||
|
||||
/***** Heading row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"LM",Txt_Menu);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_users);
|
||||
HTM_TH (1,1,"RM",Txt_PERCENT_of_users);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** For each menu... *****/
|
||||
|
@ -5634,7 +5583,7 @@ static void Fig_GetAndShowNumUsrsPerMenu (void)
|
|||
if (asprintf (&SubQuery,"usr_data.Menu=%u",
|
||||
(unsigned) Menu) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
NumUsrs[Menu] = Fig_GetNumUsrsWhoChoseAnOption (SubQuery);
|
||||
NumUsrs[Menu] = Usr_DB_GetNumUsrsWhoChoseAnOption (SubQuery);
|
||||
free (SubQuery);
|
||||
|
||||
/* Update total number of users */
|
||||
|
@ -5695,11 +5644,9 @@ static void Fig_GetAndShowNumUsrsPerTheme (void)
|
|||
|
||||
/***** Heading row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"LM",Txt_Theme_SKIN);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_users);
|
||||
HTM_TH (1,1,"RM",Txt_PERCENT_of_users);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** For each theme... *****/
|
||||
|
@ -5711,7 +5658,7 @@ static void Fig_GetAndShowNumUsrsPerTheme (void)
|
|||
if (asprintf (&SubQuery,"usr_data.Theme='%s'",
|
||||
The_ThemeId[Theme]) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
NumUsrs[Theme] = Fig_GetNumUsrsWhoChoseAnOption (SubQuery);
|
||||
NumUsrs[Theme] = Usr_DB_GetNumUsrsWhoChoseAnOption (SubQuery);
|
||||
free (SubQuery);
|
||||
|
||||
/* Update total number of users */
|
||||
|
@ -5776,11 +5723,9 @@ static void Fig_GetAndShowNumUsrsPerSideColumns (void)
|
|||
|
||||
/***** Heading row *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"CM",Txt_Columns);
|
||||
HTM_TH (1,1,"RM",Txt_Number_of_users);
|
||||
HTM_TH (1,1,"RM",Txt_PERCENT_of_users);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** For each language... *****/
|
||||
|
@ -5792,7 +5737,7 @@ static void Fig_GetAndShowNumUsrsPerSideColumns (void)
|
|||
if (asprintf (&SubQuery,"usr_data.SideCols=%u",
|
||||
SideCols) < 0)
|
||||
Err_NotEnoughMemoryExit ();
|
||||
NumUsrs[SideCols] = Fig_GetNumUsrsWhoChoseAnOption (SubQuery);
|
||||
NumUsrs[SideCols] = Usr_DB_GetNumUsrsWhoChoseAnOption (SubQuery);
|
||||
free (SubQuery);
|
||||
|
||||
/* Update total number of users */
|
||||
|
@ -5831,106 +5776,3 @@ static void Fig_GetAndShowNumUsrsPerSideColumns (void)
|
|||
/***** End table and box *****/
|
||||
Box_BoxTableEnd ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************** Get number of users who have chosen an option ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Fig_GetNumUsrsWhoChoseAnOption (const char *SubQuery)
|
||||
{
|
||||
unsigned NumUsrs;
|
||||
|
||||
/***** Get the number of users who have chosen
|
||||
this privacy option from database *****/
|
||||
switch (Gbl.Scope.Current)
|
||||
{
|
||||
case HieLvl_SYS:
|
||||
NumUsrs = (unsigned)
|
||||
DB_QueryCOUNT ("can not get the number of users who have chosen an option",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM usr_data WHERE %s",
|
||||
SubQuery);
|
||||
break;
|
||||
case HieLvl_CTY:
|
||||
NumUsrs = (unsigned)
|
||||
DB_QueryCOUNT ("can not get the number of users who have chosen an option",
|
||||
"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_users,"
|
||||
"usr_data"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||
" AND crs_users.UsrCod=usr_data.UsrCod"
|
||||
" AND %s",
|
||||
Gbl.Hierarchy.Cty.CtyCod,SubQuery);
|
||||
break;
|
||||
case HieLvl_INS:
|
||||
NumUsrs = (unsigned)
|
||||
DB_QueryCOUNT ("can not get the number of users who have chosen an option",
|
||||
"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_users,"
|
||||
"usr_data"
|
||||
" WHERE ctr_centers.InsCod=%ld"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||
" AND crs_users.UsrCod=usr_data.UsrCod"
|
||||
" AND %s",
|
||||
Gbl.Hierarchy.Ins.InsCod,SubQuery);
|
||||
break;
|
||||
case HieLvl_CTR:
|
||||
NumUsrs = (unsigned)
|
||||
DB_QueryCOUNT ("can not get the number of users who have chosen an option",
|
||||
"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_users,"
|
||||
"usr_data"
|
||||
" WHERE deg_degrees.CtrCod=%ld"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||
" AND crs_users.UsrCod=usr_data.UsrCod"
|
||||
" AND %s",
|
||||
Gbl.Hierarchy.Ctr.CtrCod,SubQuery);
|
||||
break;
|
||||
case HieLvl_DEG:
|
||||
NumUsrs = (unsigned)
|
||||
DB_QueryCOUNT ("can not get the number of users who have chosen an option",
|
||||
"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM crs_courses,"
|
||||
"crs_users,"
|
||||
"usr_data"
|
||||
" WHERE crs_courses.DegCod=%ld"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||
" AND crs_users.UsrCod=usr_data.UsrCod"
|
||||
" AND %s",
|
||||
Gbl.Hierarchy.Deg.DegCod,SubQuery);
|
||||
break;
|
||||
case HieLvl_CRS:
|
||||
NumUsrs = (unsigned)
|
||||
DB_QueryCOUNT ("can not get the number of users who have chosen an option",
|
||||
"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM crs_users,"
|
||||
"usr_data"
|
||||
" WHERE crs_users.CrsCod=%ld"
|
||||
" AND crs_users.UsrCod=usr_data.UsrCod"
|
||||
" AND %s",
|
||||
Gbl.Hierarchy.Crs.CrsCod,SubQuery);
|
||||
break;
|
||||
default:
|
||||
Err_WrongScopeExit ();
|
||||
NumUsrs = 0; // Not reached. Initialized to avoid warning.
|
||||
break;
|
||||
}
|
||||
|
||||
return NumUsrs;
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
#include "swad_profile.h"
|
||||
#include "swad_project.h"
|
||||
#include "swad_role.h"
|
||||
#include "swad_setting.h"
|
||||
#include "swad_string.h"
|
||||
#include "swad_timeline.h"
|
||||
#include "swad_timeline_note.h"
|
||||
|
@ -1291,7 +1292,6 @@ static void Brw_PutIconShowFigure (__attribute__((unused)) void *Args);
|
|||
static void Brw_PutButtonToShowEdit (void);
|
||||
static void Brw_WriteTopBeforeShowingFileBrowser (void);
|
||||
static void Brw_UpdateLastAccess (void);
|
||||
static void Brw_UpdateGrpLastAccZone (const char *FieldNameDB,long GrpCod);
|
||||
static void Brw_WriteSubtitleOfFileBrowser (void);
|
||||
static void Brw_InitHiddenLevels (void);
|
||||
static void Brw_ShowAndStoreSizeOfFileTree (void);
|
||||
|
@ -1386,8 +1386,8 @@ static bool Brw_GetIfExpandedTree (const char Path[PATH_MAX + 1]);
|
|||
static long Brw_GetCodForExpandedFolders (void);
|
||||
static long Brw_GetWorksUsrCodForExpandedFolders (void);
|
||||
|
||||
static void Brw_RemoveExpiredClipboards (void);
|
||||
static void Brw_RemoveAffectedClipboards (Brw_FileBrowser_t FileBrowser,
|
||||
static void Brw_DB_RemoveExpiredClipboards (void);
|
||||
static void Brw_DB_RemoveAffectedClipboards (Brw_FileBrowser_t FileBrowser,
|
||||
long MyUsrCod,long WorksUsrCod);
|
||||
static void Brw_PasteClipboard (void);
|
||||
static unsigned Brw_NumLevelsInPath (const char Path[PATH_MAX + 1]);
|
||||
|
@ -1415,7 +1415,7 @@ static void Brw_WriteSmallLinkToDownloadFile (const char *URL,
|
|||
static bool Brw_GetParamPublicFile (void);
|
||||
static Brw_License_t Brw_GetParLicense (void);
|
||||
static void Brw_GetFileViewsFromLoggedUsrs (struct FileMetadata *FileMetadata);
|
||||
static void Brw_GetFileViewsFromNonLoggedUsrs (struct FileMetadata *FileMetadata);
|
||||
static unsigned Brw_DB_GetFileViewsFromNonLoggedUsrs (long FilCod);
|
||||
static unsigned Brw_GetFileViewsFromMe (long FilCod);
|
||||
static void Brw_UpdateFileViews (unsigned NumViews,long FilCod);
|
||||
static bool Brw_GetIfFolderHasPublicFiles (const char Path[PATH_MAX + 1]);
|
||||
|
@ -2863,8 +2863,8 @@ bool Brw_UpdateFoldersAssigmentsIfExistForAllUsrs (const char *OldFolderName,con
|
|||
else // Success
|
||||
{
|
||||
/* Remove affected clipboards */
|
||||
Brw_RemoveAffectedClipboards (Brw_ADMI_ASG_USR,UsrCod,-1L);
|
||||
Brw_RemoveAffectedClipboards (Brw_ADMI_ASG_CRS,-1L,UsrCod);
|
||||
Brw_DB_RemoveAffectedClipboards (Brw_ADMI_ASG_USR,UsrCod,-1L);
|
||||
Brw_DB_RemoveAffectedClipboards (Brw_ADMI_ASG_CRS,-1L,UsrCod);
|
||||
|
||||
/* Rename affected expanded folders */
|
||||
snprintf (OldPath,sizeof (OldPath),"%s/%s",
|
||||
|
@ -3218,21 +3218,23 @@ static void Brw_ShowFileBrowsersAsgWrkCrs (void)
|
|||
|
||||
/***** Show a row with the data of the owner of the works *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
Brw_ShowDataOwnerAsgWrk (&Gbl.Usrs.Other.UsrDat);
|
||||
|
||||
HTM_TD_Begin ("class=\"LT\"");
|
||||
|
||||
/***** Show the tree with the assignments *****/
|
||||
/* Show the tree with the assignments */
|
||||
Gbl.FileBrowser.Type = Brw_ADMI_ASG_CRS;
|
||||
Brw_InitializeFileBrowser ();
|
||||
Brw_ShowFileBrowser ();
|
||||
|
||||
/***** Show the tree with the works *****/
|
||||
/* Show the tree with the works */
|
||||
Gbl.FileBrowser.Type = Brw_ADMI_WRK_CRS;
|
||||
Brw_InitializeFileBrowser ();
|
||||
Brw_ShowFileBrowser ();
|
||||
|
||||
HTM_TD_End ();
|
||||
|
||||
HTM_TR_End ();
|
||||
}
|
||||
}
|
||||
|
@ -3332,7 +3334,8 @@ static void Brw_FormToChangeCrsGrpZone (void)
|
|||
"value=\"%ld\"%s",
|
||||
GrpDat.GrpCod,
|
||||
(IsGroupZone &&
|
||||
GrpDat.GrpCod == Gbl.Crs.Grps.GrpCod) ? " checked=\"checked\"" : "");
|
||||
GrpDat.GrpCod == Gbl.Crs.Grps.GrpCod) ? " checked=\"checked\"" :
|
||||
"");
|
||||
HTM_TxtF ("%s %s",GrpDat.GrpTypName,GrpDat.GrpName);
|
||||
HTM_LABEL_End ();
|
||||
HTM_LI_End ();
|
||||
|
@ -3677,6 +3680,7 @@ static void Brw_ShowFileBrowser (void)
|
|||
snprintf (FileBrowserSectionId,sizeof (FileBrowserSectionId),
|
||||
"file_browser_%u",Gbl.FileBrowser.Id);
|
||||
HTM_SECTION_Begin (FileBrowserSectionId);
|
||||
|
||||
Box_BoxBegin ("100%",Brw_TitleOfFileBrowser[Gbl.FileBrowser.Type],
|
||||
Brw_PutIconsFileBrowser,NULL,
|
||||
Brw_HelpOfFileBrowser[Gbl.FileBrowser.Type],Box_NOT_CLOSABLE);
|
||||
|
@ -3710,6 +3714,7 @@ static void Brw_ShowFileBrowser (void)
|
|||
|
||||
/***** End box *****/
|
||||
Box_BoxEnd ();
|
||||
|
||||
HTM_SECTION_End ();
|
||||
}
|
||||
|
||||
|
@ -3858,7 +3863,7 @@ static void Brw_UpdateLastAccess (void)
|
|||
if (Gbl.Action.Act == ActChgToSeeDocCrs ||
|
||||
Gbl.Action.Act == ActChgToAdmDocCrs ||
|
||||
Gbl.Action.Act == ActChgToAdmTch) // Update group of last access to a documents/teachers zone only when user changes zone
|
||||
Brw_UpdateGrpLastAccZone ("LastDowGrpCod",-1L);
|
||||
Set_DB_UpdateGrpLastAccZone ("LastDowGrpCod",-1L);
|
||||
break;
|
||||
case Brw_SHOW_DOC_GRP:
|
||||
case Brw_ADMI_DOC_GRP:
|
||||
|
@ -3866,50 +3871,33 @@ static void Brw_UpdateLastAccess (void)
|
|||
if (Gbl.Action.Act == ActChgToSeeDocCrs ||
|
||||
Gbl.Action.Act == ActChgToAdmDocCrs ||
|
||||
Gbl.Action.Act == ActChgToAdmTch) // Update group of last access to a documents/teachers zone only when user changes zone
|
||||
Brw_UpdateGrpLastAccZone ("LastDowGrpCod",Gbl.Crs.Grps.GrpCod);
|
||||
Set_DB_UpdateGrpLastAccZone ("LastDowGrpCod",Gbl.Crs.Grps.GrpCod);
|
||||
break;
|
||||
case Brw_ADMI_SHR_CRS:
|
||||
if (Gbl.Action.Act == ActChgToAdmSha) // Update group of last access to a shared files zone only when user changes zone
|
||||
Brw_UpdateGrpLastAccZone ("LastComGrpCod",-1L);
|
||||
Set_DB_UpdateGrpLastAccZone ("LastComGrpCod",-1L);
|
||||
break;
|
||||
case Brw_ADMI_SHR_GRP:
|
||||
if (Gbl.Action.Act == ActChgToAdmSha) // Update group of last access to a shared files zone only when user changes zone
|
||||
Brw_UpdateGrpLastAccZone ("LastComGrpCod",Gbl.Crs.Grps.GrpCod);
|
||||
Set_DB_UpdateGrpLastAccZone ("LastComGrpCod",Gbl.Crs.Grps.GrpCod);
|
||||
break;
|
||||
case Brw_SHOW_MRK_CRS:
|
||||
case Brw_ADMI_MRK_CRS:
|
||||
if (Gbl.Action.Act == ActChgToSeeMrk ||
|
||||
Gbl.Action.Act == ActChgToAdmMrk) // Update group of last access to a marks zone only when user changes zone
|
||||
Brw_UpdateGrpLastAccZone ("LastAssGrpCod",-1L);
|
||||
Set_DB_UpdateGrpLastAccZone ("LastAssGrpCod",-1L);
|
||||
break;
|
||||
case Brw_SHOW_MRK_GRP:
|
||||
case Brw_ADMI_MRK_GRP:
|
||||
if (Gbl.Action.Act == ActChgToSeeMrk ||
|
||||
Gbl.Action.Act == ActChgToAdmMrk) // Update group of last access to a marks zone only when user changes zone
|
||||
Brw_UpdateGrpLastAccZone ("LastAssGrpCod",Gbl.Crs.Grps.GrpCod);
|
||||
Set_DB_UpdateGrpLastAccZone ("LastAssGrpCod",Gbl.Crs.Grps.GrpCod);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********** Update the group of my last access to a common zone *************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Brw_UpdateGrpLastAccZone (const char *FieldNameDB,long GrpCod)
|
||||
{
|
||||
/***** Update the group of my last access to a common zone *****/
|
||||
DB_QueryUPDATE ("can not update the group of the last access to a file browser",
|
||||
"UPDATE crs_user_settings"
|
||||
" SET %s=%ld"
|
||||
" WHERE UsrCod=%ld"
|
||||
" AND CrsCod=%ld",
|
||||
FieldNameDB,GrpCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********************** Write title of a file browser ***********************/
|
||||
/*****************************************************************************/
|
||||
|
@ -5300,7 +5288,7 @@ static long Brw_GetGrpLastAccZone (const char *FieldNameDB)
|
|||
|
||||
/***** Check if group exists (it's possible that this group has been removed after my last access to it) *****/
|
||||
if (GrpCod >= 0)
|
||||
if (Grp_CheckIfGroupExists (GrpCod))
|
||||
if (Grp_DB_CheckIfGroupExists (GrpCod))
|
||||
/* Check if I belong to this group (it's possible that I have been removed from this group after my last access to it) */
|
||||
if (Grp_GetIfIBelongToGrp (GrpCod))
|
||||
return GrpCod;
|
||||
|
@ -5653,7 +5641,7 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,const char *RowId,
|
|||
}
|
||||
|
||||
/***** Indentation depending on level, icon, and file/folder name *****/
|
||||
/* Start column */
|
||||
/* Begin column */
|
||||
HTM_TD_Begin ("class=\"NO_BR LM COLOR%u\" style=\"width:99%%;\"",Gbl.RowEvenOdd);
|
||||
|
||||
HTM_TABLE_Begin (NULL);
|
||||
|
@ -5688,9 +5676,10 @@ static bool Brw_WriteRowFileBrowser (unsigned Level,const char *RowId,
|
|||
/* File or folder name */
|
||||
Brw_WriteFileName (Level,FileMetadata.IsPublic);
|
||||
|
||||
/* End column */
|
||||
HTM_TR_End ();
|
||||
HTM_TABLE_End ();
|
||||
|
||||
/* End column */
|
||||
HTM_TD_End ();
|
||||
|
||||
if (AdminMarks)
|
||||
|
@ -6046,7 +6035,7 @@ static void Brw_PutIconFolder (unsigned Level,
|
|||
{
|
||||
bool ICanCreate;
|
||||
|
||||
/***** Start cell *****/
|
||||
/***** Begin cell *****/
|
||||
HTM_TD_Begin ("class=\"BM%u\"",Gbl.RowEvenOdd);
|
||||
|
||||
/***** Put icon to create a new file or folder *****/
|
||||
|
@ -6119,13 +6108,8 @@ static void Brw_PutIconFolderWithoutPlus (const char *FileBrowserId,const char *
|
|||
extern const char *Txt_Folder;
|
||||
|
||||
/***** Begin container *****/
|
||||
if (Hidden)
|
||||
HTM_DIV_Begin ("id=\"folder_%s_%s_%s\" style=\"display:none;\"",
|
||||
Open ? "open" :
|
||||
"closed",
|
||||
FileBrowserId,RowId);
|
||||
else
|
||||
HTM_DIV_Begin ("id=\"folder_%s_%s_%s\"",
|
||||
HTM_DIV_Begin (Hidden ? "id=\"folder_%s_%s_%s\" style=\"display:none;\"" :
|
||||
"id=\"folder_%s_%s_%s\"",
|
||||
Open ? "open" :
|
||||
"closed",
|
||||
FileBrowserId,RowId);
|
||||
|
@ -6147,13 +6131,8 @@ static void Brw_PutIconFolderWithPlus (const char *FileBrowserId,const char *Row
|
|||
bool Open,bool Hidden)
|
||||
{
|
||||
/***** Begin container *****/
|
||||
if (Hidden)
|
||||
HTM_DIV_Begin ("id=\"folder_%s_%s_%s\" style=\"display:none;\"",
|
||||
Open ? "open" :
|
||||
"closed",
|
||||
FileBrowserId,RowId);
|
||||
else
|
||||
HTM_DIV_Begin ("id=\"folder_%s_%s_%s\"",
|
||||
HTM_DIV_Begin (Hidden ? "id=\"folder_%s_%s_%s\" style=\"display:none;\"" :
|
||||
"id=\"folder_%s_%s_%s\"",
|
||||
Open ? "open" :
|
||||
"closed",
|
||||
FileBrowserId,RowId);
|
||||
|
@ -6308,11 +6287,8 @@ static void Brw_WriteFileName (unsigned Level,bool IsPublic)
|
|||
ICanEditFileOrFolder = Brw_GetIfICanEditFileOrFolder ();
|
||||
|
||||
/***** Start cell *****/
|
||||
if (Gbl.FileBrowser.Clipboard.IsThisFile)
|
||||
HTM_TD_Begin ("class=\"%s LM LIGHT_GREEN\" style=\"width:99%%;\"",
|
||||
Gbl.FileBrowser.TxtStyle);
|
||||
else
|
||||
HTM_TD_Begin ("class=\"%s LM\" style=\"width:99%%;\"",
|
||||
HTM_TD_Begin (Gbl.FileBrowser.Clipboard.IsThisFile ? "class=\"%s LM LIGHT_GREEN\" style=\"width:99%%;\"" :
|
||||
"class=\"%s LM\" style=\"width:99%%;\"",
|
||||
Gbl.FileBrowser.TxtStyle);
|
||||
|
||||
HTM_DIV_Begin ("class=\"FILENAME\"");
|
||||
|
@ -6342,10 +6318,12 @@ static void Brw_WriteFileName (unsigned Level,bool IsPublic)
|
|||
(Gbl.FileBrowser.Type == Brw_ADMI_ASG_USR ||
|
||||
Gbl.FileBrowser.Type == Brw_ADMI_ASG_CRS))
|
||||
HTM_SPAN_Begin ("title=\"%s\"",Gbl.FileBrowser.Asg.Title);
|
||||
|
||||
HTM_STRONG_Begin ();
|
||||
HTM_Txt (FileNameToShow);
|
||||
HTM_STRONG_End ();
|
||||
HTM_NBSP ();
|
||||
|
||||
if ((Level == 1) &&
|
||||
(Gbl.FileBrowser.Type == Brw_ADMI_ASG_USR ||
|
||||
Gbl.FileBrowser.Type == Brw_ADMI_ASG_CRS))
|
||||
|
@ -6359,11 +6337,8 @@ static void Brw_WriteFileName (unsigned Level,bool IsPublic)
|
|||
}
|
||||
else // File or link
|
||||
{
|
||||
if (Gbl.FileBrowser.Clipboard.IsThisFile)
|
||||
HTM_TD_Begin ("class=\"%s LM LIGHT_GREEN\" style=\"width:99%%;\"",
|
||||
Gbl.FileBrowser.TxtStyle);
|
||||
else
|
||||
HTM_TD_Begin ("class=\"%s LM\" style=\"width:99%%;\"",
|
||||
HTM_TD_Begin (Gbl.FileBrowser.Clipboard.IsThisFile ? "class=\"%s LM LIGHT_GREEN\" style=\"width:99%%;\"" :
|
||||
"class=\"%s LM\" style=\"width:99%%;\"",
|
||||
Gbl.FileBrowser.TxtStyle);
|
||||
|
||||
HTM_NBSP ();
|
||||
|
@ -6381,6 +6356,7 @@ static void Brw_WriteFileName (unsigned Level,bool IsPublic)
|
|||
HTM_Txt (FileNameToShow);
|
||||
HTM_BUTTON_End ();
|
||||
free (Class);
|
||||
|
||||
Frm_EndForm ();
|
||||
|
||||
/* Put icon to make public/private file */
|
||||
|
@ -6554,6 +6530,7 @@ static void Brw_WriteFileOrFolderPublisher (unsigned Level,long UsrCod)
|
|||
}
|
||||
|
||||
HTM_TD_Begin ("class=\"BM%u\"",Gbl.RowEvenOdd);
|
||||
|
||||
if (ShowUsr)
|
||||
/***** Show photo *****/
|
||||
Pho_ShowUsrPhotoIfAllowed (&UsrDat,"PHOTO15x20B",Pho_ZOOM,false);
|
||||
|
@ -6642,7 +6619,7 @@ void Brw_RemFileFromTree (void)
|
|||
Gbl.FileBrowser.FilFolLnk.Full);
|
||||
|
||||
/* Remove affected clipboards */
|
||||
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Brw_DB_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
|
||||
|
@ -6695,7 +6672,7 @@ void Brw_RemFolderFromTree (void)
|
|||
else
|
||||
{
|
||||
/* Remove affected clipboards */
|
||||
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Brw_DB_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
|
||||
|
@ -6757,8 +6734,9 @@ void Brw_RemSubtreeInFileBrowser (void)
|
|||
Brw_RemoveChildrenOfFolderFromDB (Gbl.FileBrowser.FilFolLnk.Full);
|
||||
|
||||
/* Remove affected clipboards */
|
||||
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
Brw_DB_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
|
||||
/* Remove affected expanded folders */
|
||||
Brw_RemoveAffectedExpandedFolders (Gbl.FileBrowser.FilFolLnk.Full);
|
||||
|
@ -6810,7 +6788,7 @@ void Brw_CopyFromFileBrowser (void)
|
|||
Brw_GetParAndInitFileBrowser ();
|
||||
|
||||
/***** Remove old clipboards (from all users) *****/
|
||||
Brw_RemoveExpiredClipboards (); // Someone must do this work. Let's do it whenever a user click in a copy button
|
||||
Brw_DB_RemoveExpiredClipboards (); // Someone must do this work. Let's do it whenever a user click in a copy button
|
||||
|
||||
/***** Put the path in the clipboard *****/
|
||||
if (Brw_GetMyClipboard ())
|
||||
|
@ -7733,7 +7711,7 @@ static long Brw_GetWorksUsrCodForExpandedFolders (void)
|
|||
/************* Remove expired expanded folders (from all users) **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Brw_RemoveExpiredExpandedFolders (void)
|
||||
void Brw_DB_RemoveExpiredExpandedFolders (void)
|
||||
{
|
||||
/***** Remove all expired clipboards *****/
|
||||
DB_QueryDELETE ("can not remove old expanded folders",
|
||||
|
@ -7746,7 +7724,7 @@ void Brw_RemoveExpiredExpandedFolders (void)
|
|||
/****************** Remove expired clipboards (from all users) ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Brw_RemoveExpiredClipboards (void)
|
||||
static void Brw_DB_RemoveExpiredClipboards (void)
|
||||
{
|
||||
/***** Remove all expired clipboards *****/
|
||||
DB_QueryDELETE ("can not remove old paths from clipboard",
|
||||
|
@ -7759,7 +7737,7 @@ static void Brw_RemoveExpiredClipboards (void)
|
|||
/********* Remove clipboards with paths from a course or from a user *********/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Brw_RemoveAffectedClipboards (Brw_FileBrowser_t FileBrowser,
|
||||
static void Brw_DB_RemoveAffectedClipboards (Brw_FileBrowser_t FileBrowser,
|
||||
long MyUsrCod,long WorksUsrCod)
|
||||
{
|
||||
/***** Remove clipboards associated to a file browser
|
||||
|
@ -7887,8 +7865,9 @@ void Brw_PasteIntoFileBrowser (void)
|
|||
Brw_PasteClipboard ();
|
||||
|
||||
/***** Remove the affected clipboards *****/
|
||||
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
Brw_DB_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
}
|
||||
else
|
||||
/***** Write message ******/
|
||||
|
@ -8092,7 +8071,7 @@ static void Brw_PasteClipboard (void)
|
|||
Brw_GetFileMetadataByCod (&FileMetadata);
|
||||
|
||||
/* Notify only is destination folder is visible */
|
||||
if (!Brw_CheckIfFileOrFolderIsHidden (&FileMetadata))
|
||||
if (!Brw_DB_CheckIfFileOrFolderIsHidden (&FileMetadata))
|
||||
switch (Gbl.FileBrowser.Type)
|
||||
{
|
||||
case Brw_ADMI_DOC_CRS:
|
||||
|
@ -8445,10 +8424,12 @@ static void Brw_PutFormToCreateAFolder (const char FileNameToShow[NAME_MAX + 1])
|
|||
Box_BoxBegin (NULL,Txt_Create_folder,
|
||||
NULL,NULL,
|
||||
NULL,Box_NOT_CLOSABLE);
|
||||
|
||||
/* Alert */
|
||||
Ale_ShowAlert (Ale_INFO,Txt_You_can_create_a_new_folder_inside_the_folder_X,
|
||||
FileNameToShow);
|
||||
|
||||
/***** Folder *****/
|
||||
/* Folder */
|
||||
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
||||
HTM_TxtColonNBSP (Txt_Folder);
|
||||
HTM_INPUT_TEXT ("NewFolderName",Brw_MAX_CHARS_FOLDER,"",
|
||||
|
@ -8549,12 +8530,15 @@ static void Brw_PutFormToUploadOneFileClassic (const char *FileNameToShow)
|
|||
/***** Form to upload one files using the classic way *****/
|
||||
Frm_BeginForm (Brw_ActUploadFileClassic[Gbl.FileBrowser.Type]);
|
||||
Brw_PutImplicitParamsFileBrowser (&Gbl.FileBrowser.FilFolLnk);
|
||||
|
||||
/* File */
|
||||
HTM_INPUT_FILE (Fil_NAME_OF_PARAM_FILENAME_ORG,"*",
|
||||
HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
NULL);
|
||||
|
||||
/* Button to send */
|
||||
Btn_PutCreateButton (Txt_Upload_file);
|
||||
|
||||
Frm_EndForm ();
|
||||
|
||||
/***** End box *****/
|
||||
|
@ -8620,6 +8604,7 @@ static void Brw_PutFormToCreateALink (const char *FileNameToShow)
|
|||
|
||||
/***** URL *****/
|
||||
HTM_TABLE_Begin (NULL);
|
||||
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
/* Label */
|
||||
|
@ -8650,6 +8635,7 @@ static void Brw_PutFormToCreateALink (const char *FileNameToShow)
|
|||
HTM_TD_End ();
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
HTM_TABLE_End ();
|
||||
|
||||
/***** Send button and end box *****/
|
||||
|
@ -8706,7 +8692,7 @@ void Brw_RecFolderFileBrowser (void)
|
|||
else
|
||||
{
|
||||
/* Remove affected clipboards */
|
||||
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Brw_DB_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
|
||||
|
@ -8834,7 +8820,7 @@ void Brw_RenFolderFileBrowser (void)
|
|||
NewPathInTree);
|
||||
|
||||
/* Remove affected clipboards */
|
||||
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Brw_DB_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
|
||||
|
@ -9016,7 +9002,7 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
|
|||
else
|
||||
{
|
||||
/* Remove affected clipboards */
|
||||
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Brw_DB_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
|
||||
|
@ -9055,7 +9041,7 @@ static bool Brw_RcvFileInFileBrw (Brw_UploadType_t UploadType)
|
|||
Mrk_AddMarksToDB (FileMetadata.FilCod,&Marks);
|
||||
|
||||
/* Notify new file */
|
||||
if (!Brw_CheckIfFileOrFolderIsHidden (&FileMetadata))
|
||||
if (!Brw_DB_CheckIfFileOrFolderIsHidden (&FileMetadata))
|
||||
switch (Gbl.FileBrowser.Type)
|
||||
{
|
||||
case Brw_ADMI_DOC_CRS:
|
||||
|
@ -9199,7 +9185,7 @@ void Brw_RecLinkFileBrowser (void)
|
|||
else
|
||||
{
|
||||
/* Remove affected clipboards */
|
||||
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Brw_DB_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
|
||||
|
@ -9227,7 +9213,7 @@ void Brw_RecLinkFileBrowser (void)
|
|||
Brw_GetFileMetadataByCod (&FileMetadata);
|
||||
|
||||
/* Notify new file */
|
||||
if (!Brw_CheckIfFileOrFolderIsHidden (&FileMetadata))
|
||||
if (!Brw_DB_CheckIfFileOrFolderIsHidden (&FileMetadata))
|
||||
switch (Gbl.FileBrowser.Type)
|
||||
{
|
||||
case Brw_ADMI_DOC_CRS:
|
||||
|
@ -9344,7 +9330,7 @@ void Brw_SetDocumentAsVisible (void)
|
|||
Brw_ChangeFileOrFolderHiddenInDB (Gbl.FileBrowser.FilFolLnk.Full,false);
|
||||
|
||||
/***** Remove the affected clipboards *****/
|
||||
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Brw_DB_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
|
||||
|
@ -9368,7 +9354,7 @@ void Brw_SetDocumentAsHidden (void)
|
|||
Brw_ChangeFileOrFolderHiddenInDB (Gbl.FileBrowser.FilFolLnk.Full,true);
|
||||
|
||||
/***** Remove the affected clipboards *****/
|
||||
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Brw_DB_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
|
||||
|
@ -9420,7 +9406,7 @@ bool Brw_CheckIfFileOrFolderIsSetAsHiddenInDB (Brw_FileType_t FileType,const cha
|
|||
/******** Check if a file / folder from the documents zone is hidden *********/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Brw_CheckIfFileOrFolderIsHidden (struct FileMetadata *FileMetadata)
|
||||
bool Brw_DB_CheckIfFileOrFolderIsHidden (struct FileMetadata *FileMetadata)
|
||||
{
|
||||
/***** Get if a file or folder is under a hidden folder from database *****/
|
||||
/*
|
||||
|
@ -9507,20 +9493,20 @@ void Brw_ShowFileMetadata (void)
|
|||
{
|
||||
case Brw_SHOW_DOC_INS:
|
||||
if (Gbl.Usrs.Me.Role.Logged < Rol_INS_ADM)
|
||||
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||
ICanView = !Brw_DB_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||
break;
|
||||
case Brw_SHOW_DOC_CTR:
|
||||
if (Gbl.Usrs.Me.Role.Logged < Rol_CTR_ADM)
|
||||
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||
ICanView = !Brw_DB_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||
break;
|
||||
case Brw_SHOW_DOC_DEG:
|
||||
if (Gbl.Usrs.Me.Role.Logged < Rol_DEG_ADM)
|
||||
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||
ICanView = !Brw_DB_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||
break;
|
||||
case Brw_SHOW_DOC_CRS:
|
||||
case Brw_SHOW_DOC_GRP:
|
||||
if (Gbl.Usrs.Me.Role.Logged < Rol_TCH)
|
||||
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||
ICanView = !Brw_DB_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -9907,20 +9893,20 @@ void Brw_DownloadFile (void)
|
|||
{
|
||||
case Brw_SHOW_DOC_INS:
|
||||
if (Gbl.Usrs.Me.Role.Logged < Rol_INS_ADM)
|
||||
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||
ICanView = !Brw_DB_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||
break;
|
||||
case Brw_SHOW_DOC_CTR:
|
||||
if (Gbl.Usrs.Me.Role.Logged < Rol_CTR_ADM)
|
||||
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||
ICanView = !Brw_DB_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||
break;
|
||||
case Brw_SHOW_DOC_DEG:
|
||||
if (Gbl.Usrs.Me.Role.Logged < Rol_DEG_ADM)
|
||||
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||
ICanView = !Brw_DB_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||
break;
|
||||
case Brw_SHOW_DOC_CRS:
|
||||
case Brw_SHOW_DOC_GRP:
|
||||
if (Gbl.Usrs.Me.Role.Logged < Rol_TCH)
|
||||
ICanView = !Brw_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||
ICanView = !Brw_DB_CheckIfFileOrFolderIsHidden (&FileMetadata);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -10113,6 +10099,7 @@ static void Brw_WriteBigLinkToDownloadFile (const char *URL,
|
|||
/* Form to see marks */
|
||||
Frm_BeginForm (Gbl.FileBrowser.Type == Brw_SHOW_MRK_CRS ? ActSeeMyMrkCrs :
|
||||
ActSeeMyMrkGrp);
|
||||
|
||||
Str_Copy (Gbl.FileBrowser.FilFolLnk.Path,FileMetadata->FilFolLnk.Path,
|
||||
sizeof (Gbl.FileBrowser.FilFolLnk.Path) - 1);
|
||||
Str_Copy (Gbl.FileBrowser.FilFolLnk.Name,FileMetadata->FilFolLnk.Name,
|
||||
|
@ -10120,15 +10107,19 @@ static void Brw_WriteBigLinkToDownloadFile (const char *URL,
|
|||
Gbl.FileBrowser.FilFolLnk.Type = FileMetadata->FilFolLnk.Type;
|
||||
Brw_PutImplicitParamsFileBrowser (&Gbl.FileBrowser.FilFolLnk);
|
||||
|
||||
/* Link begin */
|
||||
/* Begin link */
|
||||
HTM_BUTTON_SUBMIT_Begin (Txt_Check_marks_in_the_file,"BT_LINK FILENAME_TXT",NULL);
|
||||
|
||||
Brw_PutIconFile (FileMetadata->FilFolLnk.Type,FileMetadata->FilFolLnk.Name,
|
||||
"ICO40x40",false);
|
||||
|
||||
/* Name of the file of marks, link end and form end */
|
||||
HTM_TxtF (" %s ",FileNameToShow);
|
||||
Ico_PutIcon ("grades32x32.gif",Txt_Check_marks_in_the_file,"ICO40x40");
|
||||
|
||||
/* End link */
|
||||
HTM_BUTTON_End ();
|
||||
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else
|
||||
|
@ -10171,14 +10162,16 @@ static void Brw_WriteSmallLinkToDownloadFile (const char *URL,
|
|||
Gbl.FileBrowser.FilFolLnk.Type = FileMetadata->FilFolLnk.Type;
|
||||
Brw_PutImplicitParamsFileBrowser (&Gbl.FileBrowser.FilFolLnk);
|
||||
|
||||
/* Link begin */
|
||||
/* Begin link */
|
||||
HTM_BUTTON_SUBMIT_Begin (Txt_Check_marks_in_the_file,"BT_LINK DAT",NULL);
|
||||
|
||||
/* Name of the file of marks */
|
||||
HTM_Txt (FileNameToShow);
|
||||
|
||||
/* Link end and form end */
|
||||
/* End link */
|
||||
HTM_BUTTON_End ();
|
||||
|
||||
/* End form */
|
||||
Frm_EndForm ();
|
||||
}
|
||||
else
|
||||
|
@ -10304,7 +10297,7 @@ void Brw_ChgFileMetadata (void)
|
|||
Brw_ChangeFilePublicInDB (&FileMetadata,PublicFileAfterEdition,License);
|
||||
|
||||
/***** Remove the affected clipboards *****/
|
||||
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Brw_DB_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
|
||||
|
@ -10738,7 +10731,7 @@ void Brw_GetAndUpdateFileViews (struct FileMetadata *FileMetadata)
|
|||
Brw_GetFileViewsFromLoggedUsrs (FileMetadata);
|
||||
|
||||
/***** Get file views from non logged users *****/
|
||||
Brw_GetFileViewsFromNonLoggedUsrs (FileMetadata);
|
||||
FileMetadata->NumPublicViews = Brw_DB_GetFileViewsFromNonLoggedUsrs (FileMetadata->FilCod);
|
||||
|
||||
/***** Get number of my views *****/
|
||||
if (Gbl.Usrs.Me.Logged)
|
||||
|
@ -10779,7 +10772,7 @@ void Brw_UpdateMyFileViews (long FilCod)
|
|||
/******************** Get number of file views from a user *******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Brw_GetNumFileViewsUsr (long UsrCod)
|
||||
unsigned Brw_DB_GetNumFileViewsUsr (long UsrCod)
|
||||
{
|
||||
/***** Get number of filw views *****/
|
||||
return DB_QuerySELECTUnsigned ("can not get number of file views",
|
||||
|
@ -10835,22 +10828,18 @@ static void Brw_GetFileViewsFromLoggedUsrs (struct FileMetadata *FileMetadata)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Get file views from non logged users *********************/
|
||||
/******************** Get number of public views of a file *******************/
|
||||
/*****************************************************************************/
|
||||
/*
|
||||
Input: FileMetadata->FilCod
|
||||
Output: FileMetadata->NumPublicViews
|
||||
*/
|
||||
static void Brw_GetFileViewsFromNonLoggedUsrs (struct FileMetadata *FileMetadata)
|
||||
|
||||
static unsigned Brw_DB_GetFileViewsFromNonLoggedUsrs (long FilCod)
|
||||
{
|
||||
/***** Get number of public views *****/
|
||||
FileMetadata->NumPublicViews =
|
||||
return
|
||||
DB_QuerySELECTUnsigned ("can not get number of public views of a file",
|
||||
"SELECT SUM(NumViews)"
|
||||
" FROM brw_views"
|
||||
" WHERE FilCod=%ld"
|
||||
" AND UsrCod<=0",
|
||||
FileMetadata->FilCod);
|
||||
FilCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -10937,7 +10926,7 @@ static bool Brw_GetIfFolderHasPublicFiles (const char Path[PATH_MAX + 1])
|
|||
/*********************** Get number of files from a user *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Brw_GetNumFilesUsr (long UsrCod)
|
||||
unsigned Brw_DB_GetNumFilesUsr (long UsrCod)
|
||||
{
|
||||
/***** Get current number of files published by a user from database *****/
|
||||
return (unsigned)
|
||||
|
@ -10955,7 +10944,7 @@ unsigned Brw_GetNumFilesUsr (long UsrCod)
|
|||
/******************* Get number of public files from a user ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Brw_GetNumPublicFilesUsr (long UsrCod)
|
||||
unsigned Brw_DB_GetNumPublicFilesUsr (long UsrCod)
|
||||
{
|
||||
/***** Get current number of public files published by a user from database *****/
|
||||
return (unsigned)
|
||||
|
@ -11735,7 +11724,7 @@ void Brw_RemoveZonesOfGroupsOfType (long GrpTypCod)
|
|||
long GrpCod;
|
||||
|
||||
/***** Query database *****/
|
||||
NumGrps = Grp_GetGrpsOfType (GrpTypCod,&mysql_res);
|
||||
NumGrps = Grp_DB_GetGrpsOfType (GrpTypCod,&mysql_res);
|
||||
for (NumGrp = 0;
|
||||
NumGrp < NumGrps;
|
||||
NumGrp++)
|
||||
|
@ -11920,7 +11909,6 @@ void Brw_ListDocsFound (MYSQL_RES **mysql_res,unsigned NumDocs,
|
|||
|
||||
/***** Write heading *****/
|
||||
HTM_TR_Begin (NULL);
|
||||
|
||||
HTM_TH (1,1,"BM",NULL);
|
||||
HTM_TH (1,1,"LM",Txt_Institution);
|
||||
HTM_TH (1,1,"LM",Txt_Center);
|
||||
|
@ -11928,7 +11916,6 @@ void Brw_ListDocsFound (MYSQL_RES **mysql_res,unsigned NumDocs,
|
|||
HTM_TH (1,1,"LM",Txt_Course);
|
||||
HTM_TH (1,1,"LM",Txt_File_zone);
|
||||
HTM_TH (1,1,"LM",Txt_Document);
|
||||
|
||||
HTM_TR_End ();
|
||||
|
||||
/***** List documents found *****/
|
||||
|
@ -12013,7 +12000,7 @@ static void Brw_WriteRowDocData (unsigned *NumDocsNotHidden,MYSQL_ROW row)
|
|||
FileMetadata.FilCod = Str_ConvertStrCodToLongCod (row[0]);
|
||||
Brw_GetFileMetadataByCod (&FileMetadata);
|
||||
|
||||
if (!Brw_CheckIfFileOrFolderIsHidden (&FileMetadata))
|
||||
if (!Brw_DB_CheckIfFileOrFolderIsHidden (&FileMetadata))
|
||||
{
|
||||
/***** Get institution code (row[2]) *****/
|
||||
InsCod = Str_ConvertStrCodToLongCod (row[2]);
|
||||
|
@ -12355,7 +12342,7 @@ static void Brw_RemoveOldFilesInBrowser (unsigned Months,struct Brw_NumObjects *
|
|||
if (Removed->NumFiles ||
|
||||
Removed->NumLinks ||
|
||||
Removed->NumFolds) // If anything has been changed
|
||||
Brw_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Brw_DB_RemoveAffectedClipboards (Gbl.FileBrowser.Type,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod);
|
||||
}
|
||||
|
|
|
@ -217,7 +217,7 @@ void Brw_RecLinkFileBrowser (void);
|
|||
void Brw_SetDocumentAsVisible (void);
|
||||
void Brw_SetDocumentAsHidden (void);
|
||||
bool Brw_CheckIfFileOrFolderIsSetAsHiddenInDB (Brw_FileType_t FileType,const char *Path);
|
||||
bool Brw_CheckIfFileOrFolderIsHidden (struct FileMetadata *FileMetadata);
|
||||
bool Brw_DB_CheckIfFileOrFolderIsHidden (struct FileMetadata *FileMetadata);
|
||||
void Brw_ShowFileMetadata (void);
|
||||
void Brw_DownloadFile (void);
|
||||
void Brw_GetLinkToDownloadFile (const char *PathInTree,const char *FileName,char *URL);
|
||||
|
@ -228,9 +228,9 @@ void Brw_GetFileMetadataByCod (struct FileMetadata *FileMetadata);
|
|||
bool Brw_GetFileTypeSizeAndDate (struct FileMetadata *FileMetadata);
|
||||
void Brw_GetAndUpdateFileViews (struct FileMetadata *FileMetadata);
|
||||
void Brw_UpdateMyFileViews (long FilCod);
|
||||
unsigned Brw_GetNumFileViewsUsr (long UsrCod);
|
||||
unsigned Brw_GetNumFilesUsr (long UsrCod);
|
||||
unsigned Brw_GetNumPublicFilesUsr (long UsrCod);
|
||||
unsigned Brw_DB_GetNumFileViewsUsr (long UsrCod);
|
||||
unsigned Brw_DB_GetNumFilesUsr (long UsrCod);
|
||||
unsigned Brw_DB_GetNumPublicFilesUsr (long UsrCod);
|
||||
|
||||
long Brw_GetCodForFiles (void);
|
||||
void Brw_GetCrsGrpFromFileMetadata (Brw_FileBrowser_t FileBrowser,long Cod,
|
||||
|
@ -246,7 +246,7 @@ long Brw_AddPathToDB (long PublisherUsrCod,Brw_FileType_t FileType,
|
|||
|
||||
bool Brw_CheckIfICanViewProjectFiles (long PrjCod);
|
||||
|
||||
void Brw_RemoveExpiredExpandedFolders (void);
|
||||
void Brw_DB_RemoveExpiredExpandedFolders (void);
|
||||
|
||||
void Brw_CalcSizeOfDir (char *Path);
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ extern struct Globals Gbl;
|
|||
/****************************** Private prototypes ***************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Fir_BanIP (void);
|
||||
static void Fir_DB_BanIP (void);
|
||||
|
||||
static void Fir_WriteHTML (const char *Title,const char *H1);
|
||||
|
||||
|
@ -67,7 +67,7 @@ static void Fir_WriteHTML (const char *Title,const char *H1);
|
|||
/************************** Log access into firewall *************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Fir_LogAccess (void)
|
||||
void Fir_DB_LogAccess (void)
|
||||
{
|
||||
/***** Log access in firewall recent log *****/
|
||||
DB_QueryINSERT ("can not log access into firewall_log",
|
||||
|
@ -82,7 +82,7 @@ void Fir_LogAccess (void)
|
|||
/********************** Remove old clicks from firewall **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Fir_PurgeFirewall (void)
|
||||
void Fir_DB_PurgeFirewall (void)
|
||||
{
|
||||
/***** Remove old clicks *****/
|
||||
DB_QueryDELETE ("can not purge firewall log",
|
||||
|
@ -150,7 +150,7 @@ void Fir_CheckFirewallAndExitIfTooManyRequests (void)
|
|||
if (NumClicks > Fw_MAX_CLICKS_IN_INTERVAL)
|
||||
{
|
||||
/* Ban this IP */
|
||||
Fir_BanIP ();
|
||||
Fir_DB_BanIP ();
|
||||
|
||||
/* Return status 429 Too Many Requests */
|
||||
fprintf (stdout,"Content-Type: text/html; charset=windows-1252\n"
|
||||
|
@ -169,7 +169,7 @@ void Fir_CheckFirewallAndExitIfTooManyRequests (void)
|
|||
/********************************* Ban an IP *********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Fir_BanIP (void)
|
||||
static void Fir_DB_BanIP (void)
|
||||
{
|
||||
/***** Insert IP into table of banned IPs *****/
|
||||
DB_QueryINSERT ("can not ban IP",
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Fir_LogAccess (void);
|
||||
void Fir_PurgeFirewall (void);
|
||||
void Fir_DB_LogAccess (void);
|
||||
void Fir_DB_PurgeFirewall (void);
|
||||
|
||||
void Fir_CheckFirewallAndExitIfBanned (void);
|
||||
void Fir_CheckFirewallAndExitIfTooManyRequests (void);
|
||||
|
|
138
swad_forum.c
138
swad_forum.c
|
@ -298,11 +298,11 @@ static const unsigned PermissionThreadDeletion[For_NUM_TYPES_FORUM] =
|
|||
/***************************** Private prototypes ***************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static bool For_GetIfForumPstExists (long PstCod);
|
||||
static bool For_DB_GetIfForumPstExists (long PstCod);
|
||||
|
||||
static bool For_GetIfPstIsEnabled (long PstCod);
|
||||
static void For_DeletePstFromDisabledPstTable (long PstCod);
|
||||
static void For_InsertPstIntoBannedPstTable (long PstCod);
|
||||
static bool For_DB_GetIfPstIsEnabled (long PstCod);
|
||||
static void For_DB_RemovePstFromDisabledPstTable (long PstCod);
|
||||
static void For_DB_InsertPstIntoBannedPstTable (long PstCod);
|
||||
|
||||
static long For_InsertForumPst (long ThrCod,long UsrCod,
|
||||
const char *Subject,const char *Content,
|
||||
|
@ -310,24 +310,24 @@ static long For_InsertForumPst (long ThrCod,long UsrCod,
|
|||
static bool For_RemoveForumPst (long PstCod,long MedCod);
|
||||
static unsigned For_NumPstsInThrWithPstCod (long PstCod,long *ThrCod);
|
||||
|
||||
static long For_InsertForumThread (const struct For_Forums *Forums,
|
||||
static long For_DB_InsertForumThread (const struct For_Forums *Forums,
|
||||
long FirstPstCod);
|
||||
static void For_RemoveThreadOnly (long ThrCod);
|
||||
static void For_RemoveThreadAndItsPsts (long ThrCod);
|
||||
static void For_GetThrSubject (long ThrCod,char Subject[Cns_MAX_BYTES_SUBJECT + 1]);
|
||||
|
||||
static void For_UpdateThrFirstAndLastPst (long ThrCod,long FirstPstCod,long LastPstCod);
|
||||
static void For_UpdateThrLastPst (long ThrCod,long LastPstCod);
|
||||
static void For_DB_UpdateThrFirstAndLastPst (long ThrCod,long FirstPstCod,long LastPstCod);
|
||||
static void For_DB_UpdateThrLastPst (long ThrCod,long LastPstCod);
|
||||
static long For_GetLastPstCod (long ThrCod);
|
||||
|
||||
static void For_UpdateThrReadTime (long ThrCod,
|
||||
static void For_DB_UpdateThrReadTime (long ThrCod,
|
||||
time_t CreatTimeUTCOfTheMostRecentPostRead);
|
||||
static unsigned For_GetNumOfReadersOfThr (long ThrCod);
|
||||
static unsigned For_GetNumOfWritersInThr (long ThrCod);
|
||||
static unsigned For_GetNumPstsInThr (long ThrCod);
|
||||
static unsigned For_GetNumMyPstInThr (long ThrCod);
|
||||
static unsigned For_DB_GetNumOfReadersOfThr (long ThrCod);
|
||||
static unsigned For_DB_GetNumOfWritersInThr (long ThrCod);
|
||||
static unsigned For_DB_GetNumPstsInThr (long ThrCod);
|
||||
static unsigned For_DB_GetNumMyPstInThr (long ThrCod);
|
||||
static time_t For_GetThrReadTime (long ThrCod);
|
||||
static void For_DeleteThrFromReadThrs (long ThrCod);
|
||||
static void For_DB_RemoveThrFromReadThrs (long ThrCod);
|
||||
static void For_ShowPostsOfAThread (struct For_Forums *Forums,
|
||||
Ale_AlertType_t AlertType,const char *Message);
|
||||
static void For_PutIconNewPost (void *Forums);
|
||||
|
@ -381,7 +381,7 @@ static unsigned For_GetNumThrsWithNewPstsInForum (const struct For_Forum *Forum,
|
|||
static unsigned For_GetNumOfThreadsInForumNewerThan (const struct For_Forum *Forum,
|
||||
const char *Time);
|
||||
static unsigned For_GetNumOfUnreadPostsInThr (long ThrCod,unsigned NumPostsInThr);
|
||||
static unsigned For_GetNumOfPostsInThrNewerThan (long ThrCod,const char *Time);
|
||||
static unsigned For_DB_GetNumOfPostsInThrNewerThan (long ThrCod,const char *Time);
|
||||
|
||||
static void For_WriteNumberOfThrs (unsigned NumThrs);
|
||||
static void For_ShowForumThreadsHighlightingOneThread (struct For_Forums *Forums,
|
||||
|
@ -452,7 +452,7 @@ void For_EnablePost (void)
|
|||
For_GetParamsForums (&Forums);
|
||||
|
||||
/***** Delete post from table of disabled posts *****/
|
||||
For_DeletePstFromDisabledPstTable (Forums.PstCod);
|
||||
For_DB_RemovePstFromDisabledPstTable (Forums.PstCod);
|
||||
|
||||
/***** Show forum list again *****/
|
||||
For_ShowForumList (&Forums);
|
||||
|
@ -477,10 +477,10 @@ void For_DisablePost (void)
|
|||
For_GetParamsForums (&Forums);
|
||||
|
||||
/***** Check if post really exists, if it has not been removed *****/
|
||||
if (For_GetIfForumPstExists (Forums.PstCod))
|
||||
if (For_DB_GetIfForumPstExists (Forums.PstCod))
|
||||
{
|
||||
/***** Insert post into table of banned posts *****/
|
||||
For_InsertPstIntoBannedPstTable (Forums.PstCod);
|
||||
For_DB_InsertPstIntoBannedPstTable (Forums.PstCod);
|
||||
|
||||
/***** Show forum list again *****/
|
||||
For_ShowForumList (&Forums);
|
||||
|
@ -499,7 +499,7 @@ void For_DisablePost (void)
|
|||
/******************** Get if a forum post exists in database *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static bool For_GetIfForumPstExists (long PstCod)
|
||||
static bool For_DB_GetIfForumPstExists (long PstCod)
|
||||
{
|
||||
/***** Get if a forum post exists from database *****/
|
||||
return (DB_QueryCOUNT ("can not check if a post of a forum already existed",
|
||||
|
@ -513,24 +513,25 @@ static bool For_GetIfForumPstExists (long PstCod)
|
|||
/*********************** Get if a forum post is enabled **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static bool For_GetIfPstIsEnabled (long PstCod)
|
||||
static bool For_DB_GetIfPstIsEnabled (long PstCod)
|
||||
{
|
||||
if (PstCod > 0)
|
||||
/***** Trivial check: post code should be > 0 *****/
|
||||
if (PstCod <= 0)
|
||||
return false;
|
||||
|
||||
/***** Get if post is disabled from database *****/
|
||||
return (DB_QueryCOUNT ("can not check if a post of a forum is disabled",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM for_disabled"
|
||||
" WHERE PstCod=%ld",
|
||||
PstCod) == 0); // Post is enabled if it does not appear in table of disabled posts
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Delete post from table of disabled posts *****************/
|
||||
/****************** Remove post from table of disabled posts *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void For_DeletePstFromDisabledPstTable (long PstCod)
|
||||
static void For_DB_RemovePstFromDisabledPstTable (long PstCod)
|
||||
{
|
||||
/***** Remove post from disabled posts table *****/
|
||||
DB_QueryDELETE ("can not unban a post of a forum",
|
||||
|
@ -543,7 +544,7 @@ static void For_DeletePstFromDisabledPstTable (long PstCod)
|
|||
/****************** Insert post into table of banned posts *******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void For_InsertPstIntoBannedPstTable (long PstCod)
|
||||
static void For_DB_InsertPstIntoBannedPstTable (long PstCod)
|
||||
{
|
||||
/***** Remove post from banned posts table *****/
|
||||
DB_QueryREPLACE ("can not ban a post of a forum",
|
||||
|
@ -612,11 +613,11 @@ static bool For_RemoveForumPst (long PstCod,long MedCod)
|
|||
PstCod);
|
||||
|
||||
/***** Delete the post from the table of disabled forum posts *****/
|
||||
For_DeletePstFromDisabledPstTable (PstCod);
|
||||
For_DB_RemovePstFromDisabledPstTable (PstCod);
|
||||
|
||||
/***** Update the last post of the thread *****/
|
||||
if (!ThreadDeleted)
|
||||
For_UpdateThrLastPst (ThrCod,For_GetLastPstCod (ThrCod));
|
||||
For_DB_UpdateThrLastPst (ThrCod,For_GetLastPstCod (ThrCod));
|
||||
|
||||
return ThreadDeleted;
|
||||
}
|
||||
|
@ -667,7 +668,7 @@ static unsigned For_NumPstsInThrWithPstCod (long PstCod,long *ThrCod)
|
|||
/*****************************************************************************/
|
||||
// Returns the code of the new inserted thread
|
||||
|
||||
static long For_InsertForumThread (const struct For_Forums *Forums,
|
||||
static long For_DB_InsertForumThread (const struct For_Forums *Forums,
|
||||
long FirstPstCod)
|
||||
{
|
||||
/***** Insert new thread in the database *****/
|
||||
|
@ -690,7 +691,7 @@ static long For_InsertForumThread (const struct For_Forums *Forums,
|
|||
static void For_RemoveThreadOnly (long ThrCod)
|
||||
{
|
||||
/***** Indicate that this thread has not been read by anyone *****/
|
||||
For_DeleteThrFromReadThrs (ThrCod);
|
||||
For_DB_RemoveThrFromReadThrs (ThrCod);
|
||||
|
||||
/***** Remove thread code from thread clipboard *****/
|
||||
For_DB_RemoveThrCodFromThrClipboard (ThrCod);
|
||||
|
@ -798,7 +799,7 @@ void For_GetForumTypeAndLocationOfAPost (long PstCod,struct For_Forum *Forum)
|
|||
/********* Modify the codes of the first and last posts of a thread **********/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void For_UpdateThrFirstAndLastPst (long ThrCod,long FirstPstCod,long LastPstCod)
|
||||
static void For_DB_UpdateThrFirstAndLastPst (long ThrCod,long FirstPstCod,long LastPstCod)
|
||||
{
|
||||
/***** Update the code of the first and last posts of a thread *****/
|
||||
DB_QueryUPDATE ("can not update a thread of a forum",
|
||||
|
@ -815,7 +816,7 @@ static void For_UpdateThrFirstAndLastPst (long ThrCod,long FirstPstCod,long Last
|
|||
/************** Modify the code of the last post of a thread *****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void For_UpdateThrLastPst (long ThrCod,long LastPstCod)
|
||||
static void For_DB_UpdateThrLastPst (long ThrCod,long LastPstCod)
|
||||
{
|
||||
/***** Update the code of the last post of a thread *****/
|
||||
DB_QueryUPDATE ("can not update a thread of a forum",
|
||||
|
@ -858,7 +859,7 @@ static long For_GetLastPstCod (long ThrCod)
|
|||
// Note that database is not updated with the current time,
|
||||
// but with the creation time of the most recent post in this thread read by me.
|
||||
|
||||
static void For_UpdateThrReadTime (long ThrCod,
|
||||
static void For_DB_UpdateThrReadTime (long ThrCod,
|
||||
time_t CreatTimeUTCOfTheMostRecentPostRead)
|
||||
{
|
||||
/***** Insert or replace pair ThrCod-UsrCod in for_read *****/
|
||||
|
@ -877,7 +878,7 @@ static void For_UpdateThrReadTime (long ThrCod,
|
|||
/**************** Get number of users that have read a thread ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static unsigned For_GetNumOfReadersOfThr (long ThrCod)
|
||||
static unsigned For_DB_GetNumOfReadersOfThr (long ThrCod)
|
||||
{
|
||||
/***** Get number of distinct readers of a thread from database *****/
|
||||
return (unsigned)
|
||||
|
@ -892,7 +893,7 @@ static unsigned For_GetNumOfReadersOfThr (long ThrCod)
|
|||
/********** Get number of users that have write posts in a thread ************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static unsigned For_GetNumOfWritersInThr (long ThrCod)
|
||||
static unsigned For_DB_GetNumOfWritersInThr (long ThrCod)
|
||||
{
|
||||
/***** Get number of distinct writers in a thread from database *****/
|
||||
return DB_QueryCOUNT ("can not get the number of writers in a thread of a forum",
|
||||
|
@ -906,7 +907,7 @@ static unsigned For_GetNumOfWritersInThr (long ThrCod)
|
|||
/********************** Get number of posts in a thread **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static unsigned For_GetNumPstsInThr (long ThrCod)
|
||||
static unsigned For_DB_GetNumPstsInThr (long ThrCod)
|
||||
{
|
||||
/***** Get number of posts in a thread from database *****/
|
||||
return (unsigned)
|
||||
|
@ -921,7 +922,7 @@ static unsigned For_GetNumPstsInThr (long ThrCod)
|
|||
/************** Get whether there are posts of mine in a thread **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static unsigned For_GetNumMyPstInThr (long ThrCod)
|
||||
static unsigned For_DB_GetNumMyPstInThr (long ThrCod)
|
||||
{
|
||||
/***** Get if I have write posts in a thread from database *****/
|
||||
return (unsigned)
|
||||
|
@ -938,7 +939,7 @@ static unsigned For_GetNumMyPstInThr (long ThrCod)
|
|||
/*********************** Get number of posts from a user *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned For_GetNumPostsUsr (long UsrCod)
|
||||
unsigned For_DB_GetNumPostsUsr (long UsrCod)
|
||||
{
|
||||
/***** Get number of posts from a user from database *****/
|
||||
return DB_QueryCOUNT ("can not get number of forum posts from a user",
|
||||
|
@ -982,12 +983,12 @@ static time_t For_GetThrReadTime (long ThrCod)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Delete thread read status for a thread ****************/
|
||||
/********************* Remove thread read status for a thread ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void For_DeleteThrFromReadThrs (long ThrCod)
|
||||
static void For_DB_RemoveThrFromReadThrs (long ThrCod)
|
||||
{
|
||||
/***** Delete pairs ThrCod-UsrCod in for_read for a thread *****/
|
||||
/***** Remove pairs ThrCod-UsrCod in for_read for a thread *****/
|
||||
DB_QueryDELETE ("can not remove the status of reading"
|
||||
" of a thread of a forum",
|
||||
"DELETE FROM for_read"
|
||||
|
@ -1046,6 +1047,7 @@ static void For_ShowPostsOfAThread (struct For_Forums *Forums,
|
|||
|
||||
/***** Show alert after action *****/
|
||||
HTM_SECTION_Begin (For_FORUM_POSTS_SECTION_ID);
|
||||
|
||||
Ale_ShowAlerts (For_FORUM_POSTS_SECTION_ID); // Possible pending alerts
|
||||
if (Message)
|
||||
if (Message[0])
|
||||
|
@ -1138,8 +1140,7 @@ static void For_ShowPostsOfAThread (struct For_Forums *Forums,
|
|||
Note that database is not updated with the current time,
|
||||
but with the creation time of the most recent post
|
||||
in this page of threads. */
|
||||
For_UpdateThrReadTime (Thread.ThrCod,
|
||||
CreatTimeUTC);
|
||||
For_DB_UpdateThrReadTime (Thread.ThrCod,CreatTimeUTC);
|
||||
|
||||
/* Show post */
|
||||
For_ShowAForumPost (Forums,NumPst,
|
||||
|
@ -1182,6 +1183,7 @@ static void For_ShowPostsOfAThread (struct For_Forums *Forums,
|
|||
|
||||
/***** End box *****/
|
||||
Box_BoxEnd ();
|
||||
|
||||
HTM_SECTION_End ();
|
||||
}
|
||||
|
||||
|
@ -1245,7 +1247,7 @@ static void For_ShowAForumPost (struct For_Forums *Forums,
|
|||
Med_MediaConstructor (&Media);
|
||||
|
||||
/***** Check if post is enabled *****/
|
||||
Enabled = For_GetIfPstIsEnabled (Forums->PstCod);
|
||||
Enabled = For_DB_GetIfPstIsEnabled (Forums->PstCod);
|
||||
|
||||
/***** Get data of post *****/
|
||||
For_GetPstData (Forums->PstCod,&UsrDat.UsrCod,&CreatTimeUTC,
|
||||
|
@ -1813,6 +1815,7 @@ static void For_PutFormWhichForums (const struct For_Forums *Forums)
|
|||
HTM_LABEL_End ();
|
||||
HTM_LI_End ();
|
||||
}
|
||||
|
||||
HTM_UL_End ();
|
||||
HTM_DIV_End ();
|
||||
Frm_EndForm ();
|
||||
|
@ -2128,6 +2131,7 @@ static void For_WriteLinkToForum (const struct For_Forums *Forums,
|
|||
|
||||
HTM_BUTTON_SUBMIT_Begin (Act_GetActionText (For_ActionsSeeFor[Forum->Type]),
|
||||
Class,NULL);
|
||||
|
||||
For_SetForumName (Forum,ForumName,Gbl.Prefs.Language,true);
|
||||
switch (Forum->Type)
|
||||
{
|
||||
|
@ -2166,6 +2170,7 @@ static void For_WriteLinkToForum (const struct For_Forums *Forums,
|
|||
|
||||
/***** End row *****/
|
||||
HTM_BUTTON_End ();
|
||||
|
||||
Frm_EndForm ();
|
||||
|
||||
/***** Put link to register students *****/
|
||||
|
@ -2369,7 +2374,7 @@ static unsigned For_GetNumOfUnreadPostsInThr (long ThrCod,unsigned NumPostsInThr
|
|||
{
|
||||
/***** Get the number of posts in thread with a modify time > newest read time for me (row[0]) *****/
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
NumUnreadPosts = For_GetNumOfPostsInThrNewerThan (ThrCod,row[0]);
|
||||
NumUnreadPosts = For_DB_GetNumOfPostsInThrNewerThan (ThrCod,row[0]);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -2382,7 +2387,7 @@ static unsigned For_GetNumOfUnreadPostsInThr (long ThrCod,unsigned NumPostsInThr
|
|||
/**** Get number of posts in thread with a modify time > a specified time ****/
|
||||
/*****************************************************************************/
|
||||
|
||||
static unsigned For_GetNumOfPostsInThrNewerThan (long ThrCod,const char *Time)
|
||||
static unsigned For_DB_GetNumOfPostsInThrNewerThan (long ThrCod,const char *Time)
|
||||
{
|
||||
/***** Get the number of posts in thread with a modify time > a specified time from database *****/
|
||||
return (unsigned)
|
||||
|
@ -2520,6 +2525,7 @@ static void For_ShowForumThreadsHighlightingOneThread (struct For_Forums *Forums
|
|||
|
||||
/***** Show alert after action *****/
|
||||
HTM_SECTION_Begin (For_FORUM_THREADS_SECTION_ID);
|
||||
|
||||
if (Message)
|
||||
if (Message[0])
|
||||
Ale_ShowAlert (AlertType,Message);
|
||||
|
@ -2597,6 +2603,7 @@ static void For_ShowForumThreadsHighlightingOneThread (struct For_Forums *Forums
|
|||
|
||||
/***** End box with threads of this forum ****/
|
||||
Box_BoxEnd ();
|
||||
|
||||
HTM_SECTION_End ();
|
||||
}
|
||||
|
||||
|
@ -2631,8 +2638,12 @@ static void For_PutAllHiddenParamsNewThread (void *Forums)
|
|||
/********************** Get number of forums of a type ***********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned For_GetNumTotalForumsOfType (For_ForumType_t ForumType,
|
||||
long CtyCod,long InsCod,long CtrCod,long DegCod,long CrsCod)
|
||||
unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
|
||||
long CtyCod,
|
||||
long InsCod,
|
||||
long CtrCod,
|
||||
long DegCod,
|
||||
long CrsCod)
|
||||
{
|
||||
/***** Get number of forums of a type from database *****/
|
||||
switch (ForumType)
|
||||
|
@ -2881,8 +2892,12 @@ unsigned For_GetNumTotalForumsOfType (For_ForumType_t ForumType,
|
|||
/*********** Get total number of threads in forums of this type **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned For_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
|
||||
long CtyCod,long InsCod,long CtrCod,long DegCod,long CrsCod)
|
||||
unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
|
||||
long CtyCod,
|
||||
long InsCod,
|
||||
long CtrCod,
|
||||
long DegCod,
|
||||
long CrsCod)
|
||||
{
|
||||
/***** Get total number of threads in forums of this type from database *****/
|
||||
switch (ForumType)
|
||||
|
@ -3160,7 +3175,11 @@ static unsigned For_GetNumThrsInForum (const struct For_Forum *Forum)
|
|||
/*****************************************************************************/
|
||||
|
||||
unsigned For_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
|
||||
long CtyCod,long InsCod,long CtrCod,long DegCod,long CrsCod,
|
||||
long CtyCod,
|
||||
long InsCod,
|
||||
long CtrCod,
|
||||
long DegCod,
|
||||
long CrsCod,
|
||||
unsigned *NumUsrsToBeNotifiedByEMail)
|
||||
{
|
||||
MYSQL_RES *mysql_res;
|
||||
|
@ -3718,23 +3737,23 @@ static void For_GetThreadData (struct For_Thread *Thr)
|
|||
for (Order = Dat_START_TIME;
|
||||
Order <= Dat_END_TIME;
|
||||
Order++)
|
||||
Thr->Enabled[Order] = For_GetIfPstIsEnabled (Thr->PstCod[Order]);
|
||||
Thr->Enabled[Order] = For_DB_GetIfPstIsEnabled (Thr->PstCod[Order]);
|
||||
// Thr->Enabled[Order] = true;
|
||||
|
||||
/***** Get number of posts in this thread *****/
|
||||
Thr->NumPosts = For_GetNumPstsInThr (Thr->ThrCod);
|
||||
Thr->NumPosts = For_DB_GetNumPstsInThr (Thr->ThrCod);
|
||||
|
||||
/***** Get number of unread (by me) posts in this thread *****/
|
||||
Thr->NumUnreadPosts = For_GetNumOfUnreadPostsInThr (Thr->ThrCod,Thr->NumPosts);
|
||||
|
||||
/***** Get number of posts that I have written in this thread *****/
|
||||
Thr->NumMyPosts = For_GetNumMyPstInThr (Thr->ThrCod);
|
||||
Thr->NumMyPosts = For_DB_GetNumMyPstInThr (Thr->ThrCod);
|
||||
|
||||
/***** Get number of users who have write posts in this thread *****/
|
||||
Thr->NumWriters = For_GetNumOfWritersInThr (Thr->ThrCod);
|
||||
Thr->NumWriters = For_DB_GetNumOfWritersInThr (Thr->ThrCod);
|
||||
|
||||
/***** Get number of users who have read this thread *****/
|
||||
Thr->NumReaders = For_GetNumOfReadersOfThr (Thr->ThrCod);
|
||||
Thr->NumReaders = For_DB_GetNumOfReadersOfThr (Thr->ThrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -4159,20 +4178,20 @@ void For_ReceiveForumPost (void)
|
|||
Subject,Content,&Media);
|
||||
|
||||
/***** Modify last message of the thread *****/
|
||||
For_UpdateThrLastPst (Forums.Thread.Current,PstCod);
|
||||
For_DB_UpdateThrLastPst (Forums.Thread.Current,PstCod);
|
||||
}
|
||||
else // This post is the first of a new thread
|
||||
{
|
||||
/***** Create new thread with unknown first and last message codes *****/
|
||||
Forums.Thread.Current =
|
||||
Forums.Thread.Selected = For_InsertForumThread (&Forums,-1L);
|
||||
Forums.Thread.Selected = For_DB_InsertForumThread (&Forums,-1L);
|
||||
|
||||
/***** Create first (and last) message of the thread *****/
|
||||
PstCod = For_InsertForumPst (Forums.Thread.Current,Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Subject,Content,&Media);
|
||||
|
||||
/***** Update first and last posts of new thread *****/
|
||||
For_UpdateThrFirstAndLastPst (Forums.Thread.Current,PstCod,PstCod);
|
||||
For_DB_UpdateThrFirstAndLastPst (Forums.Thread.Current,PstCod,PstCod);
|
||||
}
|
||||
|
||||
/***** Free media *****/
|
||||
|
@ -4266,7 +4285,7 @@ void For_RemovePost (void)
|
|||
|
||||
/***** Check if I can remove the post *****/
|
||||
/* Check if the message really exists, if it has not been removed */
|
||||
if (!For_GetIfForumPstExists (Forums.PstCod))
|
||||
if (!For_DB_GetIfForumPstExists (Forums.PstCod))
|
||||
Err_WrongPostExit ();
|
||||
|
||||
/* Check if I am the author of the message */
|
||||
|
@ -4549,6 +4568,7 @@ static bool For_DB_CheckIfThrBelongsToForum (long ThrCod,const struct For_Forum
|
|||
sprintf (SubQuery," AND for_threads.Location=%ld",Forum->Location);
|
||||
else
|
||||
SubQuery[0] = '\0';
|
||||
|
||||
return (DB_QueryCOUNT ("can not get if a thread belong to current forum",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM for_threads"
|
||||
|
|
24
swad_forum.h
24
swad_forum.h
|
@ -122,7 +122,7 @@ void For_DisablePost (void);
|
|||
|
||||
void For_GetForumTypeAndLocationOfAPost (long PstCod,struct For_Forum *Forum);
|
||||
|
||||
unsigned For_GetNumPostsUsr (long UsrCod);
|
||||
unsigned For_DB_GetNumPostsUsr (long UsrCod);
|
||||
void For_DB_RemoveUsrFromReadThrs (long UsrCod);
|
||||
|
||||
void For_GetSummaryAndContentForumPst (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
||||
|
@ -142,12 +142,24 @@ void For_SetForumName (const struct For_Forum *Forum,
|
|||
Lan_Language_t Language,bool UseHTMLEntities);
|
||||
|
||||
void For_ShowForumTheads (void);
|
||||
unsigned For_GetNumTotalForumsOfType (For_ForumType_t ForumType,
|
||||
long CtyCod,long InsCod,long CtrCod,long DegCod,long CrsCod);
|
||||
unsigned For_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
|
||||
long CtyCod,long InsCod,long CtrCod,long DegCod,long CrsCod);
|
||||
unsigned For_DB_GetNumTotalForumsOfType (For_ForumType_t ForumType,
|
||||
long CtyCod,
|
||||
long InsCod,
|
||||
long CtrCod,
|
||||
long DegCod,
|
||||
long CrsCod);
|
||||
unsigned For_DB_GetNumTotalThrsInForumsOfType (For_ForumType_t ForumType,
|
||||
long CtyCod,
|
||||
long InsCod,
|
||||
long CtrCod,
|
||||
long DegCod,
|
||||
long CrsCod);
|
||||
unsigned For_GetNumTotalPstsInForumsOfType (For_ForumType_t ForumType,
|
||||
long CtyCod,long InsCod,long CtrCod,long DegCod,long CrsCod,
|
||||
long CtyCod,
|
||||
long InsCod,
|
||||
long CtrCod,
|
||||
long DegCod,
|
||||
long CrsCod,
|
||||
unsigned *NumUsrsToBeNotifiedByEMail);
|
||||
|
||||
void For_ShowThreadPosts (void);
|
||||
|
|
173
swad_group.c
173
swad_group.c
|
@ -107,13 +107,13 @@ static void Grp_PutIconToCreateNewGroup (void);
|
|||
|
||||
static void Grp_PutCheckboxAllGrps (Grp_WhichGroups_t GroupsSelectableByStdsOrNETs);
|
||||
|
||||
static void Grp_LockTables (void);
|
||||
static void Grp_UnlockTables (void);
|
||||
static void Grp_DB_LockTables (void);
|
||||
static void Grp_DB_UnlockTables (void);
|
||||
|
||||
static void Grp_ConstructorListGrpAlreadySelec (struct ListGrpsAlreadySelec **AlreadyExistsGroupOfType);
|
||||
static void Grp_DestructorListGrpAlreadySelec (struct ListGrpsAlreadySelec **AlreadyExistsGroupOfType);
|
||||
static void Grp_RemoveUsrFromGroup (long UsrCod,long GrpCod);
|
||||
static void Grp_AddUsrToGroup (struct UsrData *UsrDat,long GrpCod);
|
||||
static void Grp_DB_AddUsrToGroup (struct UsrData *UsrDat,long GrpCod);
|
||||
|
||||
static void Grp_ListGroupTypesForEdition (void);
|
||||
static void Grp_PutIconsEditingGroupTypes (__attribute__((unused)) void *Args);
|
||||
|
@ -123,7 +123,7 @@ static void Grp_WriteHeadingGroupTypes (void);
|
|||
|
||||
static void Grp_ListGroupsForEdition (const struct Roo_Rooms *Rooms);
|
||||
static void Grp_WriteHeadingGroups (void);
|
||||
static bool Grp_CheckIfAssociatedToGrp (const char *Table,const char *Field,
|
||||
static bool Grp_DB_CheckIfAssociatedToGrp (const char *Table,const char *Field,
|
||||
long Cod,long GrpCod);
|
||||
static void Grp_PutIconToEditGroups (__attribute__((unused)) void *Args);
|
||||
|
||||
|
@ -137,20 +137,20 @@ static void Grp_WriteGrpHead (struct GroupType *GrpTyp);
|
|||
static void Grp_WriteRowGrp (struct Group *Grp,bool Highlight);
|
||||
static void Grp_PutFormToCreateGroupType (void);
|
||||
static void Grp_PutFormToCreateGroup (const struct Roo_Rooms *Rooms);
|
||||
static unsigned Grp_CountNumGrpsInThisCrsOfType (long GrpTypCod);
|
||||
static unsigned Grp_DB_CountNumGrpsInThisCrsOfType (long GrpTypCod);
|
||||
static void Grp_GetDataOfGroupTypeByCod (struct GroupType *GrpTyp);
|
||||
static bool Grp_GetMultipleEnrolmentOfAGroupType (long GrpTypCod);
|
||||
static long Grp_GetTypeOfGroupOfAGroup (long GrpCod);
|
||||
static unsigned Grp_CountNumUsrsInNoGrpsOfType (Rol_Role_t Role,long GrpTypCod);
|
||||
static bool Grp_CheckIfIBelongToGrpsOfType (long GrpTypCod);
|
||||
static long Grp_DB_GetTypeOfGroupOfAGroup (long GrpCod);
|
||||
static unsigned Grp_DB_CountNumUsrsInNoGrpsOfType (Rol_Role_t Role,long GrpTypCod);
|
||||
static bool Grp_DB_CheckIfIBelongToGrpsOfType (long GrpTypCod);
|
||||
static void Grp_GetLstCodGrpsUsrBelongs (long CrsCod,long GrpTypCod,long UsrCod,
|
||||
struct ListCodGrps *LstGrps);
|
||||
static bool Grp_CheckIfGrpIsInList (long GrpCod,struct ListCodGrps *LstGrps);
|
||||
static bool Grp_CheckIfOpenTimeInTheFuture (time_t OpenTimeUTC);
|
||||
static bool Grp_CheckIfGroupTypeNameExists (const char *GrpTypName,long GrpTypCod);
|
||||
static bool Grp_CheckIfGroupNameExists (long GrpTypCod,const char *GrpName,long GrpCod);
|
||||
static void Grp_CreateGroupType (void);
|
||||
static void Grp_CreateGroup (void);
|
||||
static bool Grp_DB_CheckIfGroupTypeNameExists (const char *GrpTypName,long GrpTypCod);
|
||||
static bool Grp_DB_CheckIfGroupNameExists (long GrpTypCod,const char *GrpName,long GrpCod);
|
||||
static long Grp_DB_CreateGroupType (const struct GroupType *GrpTyp);
|
||||
static void Grp_DB_CreateGroup (void);
|
||||
|
||||
static void Grp_AskConfirmRemGrpTypWithGrps (unsigned NumGrps);
|
||||
static void Grp_AskConfirmRemGrp (void);
|
||||
|
@ -784,7 +784,7 @@ bool Grp_ChangeMyGrpsAtomically (struct ListCodGrps *LstGrpsIWant)
|
|||
bool ChangesMade = false;
|
||||
|
||||
/***** Lock tables to make the inscription atomic *****/
|
||||
Grp_LockTables ();
|
||||
Grp_DB_LockTables ();
|
||||
|
||||
/***** Get list of groups types and groups in this course *****/
|
||||
Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS);
|
||||
|
@ -892,7 +892,7 @@ bool Grp_ChangeMyGrpsAtomically (struct ListCodGrps *LstGrpsIWant)
|
|||
if (LstGrpsIWant->GrpCods[NumGrpIWant] == LstGrpsIBelong.GrpCods[NumGrpIBelong])
|
||||
RegisterMeInThisGrp = false;
|
||||
if (RegisterMeInThisGrp)
|
||||
Grp_AddUsrToGroup (&Gbl.Usrs.Me.UsrDat,LstGrpsIWant->GrpCods[NumGrpIWant]);
|
||||
Grp_DB_AddUsrToGroup (&Gbl.Usrs.Me.UsrDat,LstGrpsIWant->GrpCods[NumGrpIWant]);
|
||||
}
|
||||
|
||||
ChangesMade = true;
|
||||
|
@ -902,7 +902,7 @@ bool Grp_ChangeMyGrpsAtomically (struct ListCodGrps *LstGrpsIWant)
|
|||
Grp_FreeListCodGrp (&LstGrpsIBelong);
|
||||
|
||||
/***** Unlock tables after changes in my groups *****/
|
||||
Grp_UnlockTables ();
|
||||
Grp_DB_UnlockTables ();
|
||||
|
||||
/***** Free list of groups types and groups in this course *****/
|
||||
Grp_FreeListGrpTypesAndGrps ();
|
||||
|
@ -924,7 +924,7 @@ void Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants)
|
|||
|
||||
/***** Lock tables to make the inscription atomic *****/
|
||||
if (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs == Rol_STD)
|
||||
Grp_LockTables ();
|
||||
Grp_DB_LockTables ();
|
||||
|
||||
/***** Get list of groups types and groups in this course *****/
|
||||
Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS);
|
||||
|
@ -958,7 +958,7 @@ void Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants)
|
|||
if (LstGrpsUsrWants->GrpCods[NumGrpUsrWants] == LstGrpsUsrBelongs.GrpCods[NumGrpUsrBelongs])
|
||||
RegisterUsrInThisGrp = false;
|
||||
if (RegisterUsrInThisGrp)
|
||||
Grp_AddUsrToGroup (&Gbl.Usrs.Other.UsrDat,LstGrpsUsrWants->GrpCods[NumGrpUsrWants]);
|
||||
Grp_DB_AddUsrToGroup (&Gbl.Usrs.Other.UsrDat,LstGrpsUsrWants->GrpCods[NumGrpUsrWants]);
|
||||
}
|
||||
|
||||
/***** Free memory with the list of groups which user belonged to *****/
|
||||
|
@ -966,7 +966,7 @@ void Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants)
|
|||
|
||||
/***** Unlock tables after changes in groups *****/
|
||||
if (Gbl.Usrs.Other.UsrDat.Roles.InCurrentCrs == Rol_STD)
|
||||
Grp_UnlockTables ();
|
||||
Grp_DB_UnlockTables ();
|
||||
|
||||
/***** Free list of groups types and groups in this course *****/
|
||||
Grp_FreeListGrpTypesAndGrps ();
|
||||
|
@ -976,7 +976,7 @@ void Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants)
|
|||
/*********** Lock tables to make the registration in groups atomic ***********/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Grp_LockTables (void)
|
||||
static void Grp_DB_LockTables (void)
|
||||
{
|
||||
DB_Query ("can not lock tables to change user's groups",
|
||||
"LOCK TABLES "
|
||||
|
@ -993,7 +993,7 @@ static void Grp_LockTables (void)
|
|||
/*********** Unlock tables after changes in registration in groups ***********/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Grp_UnlockTables (void)
|
||||
static void Grp_DB_UnlockTables (void)
|
||||
{
|
||||
Gbl.DB.LockedTables = false; // Set to false before the following unlock...
|
||||
// ...to not retry the unlock if error in unlocking
|
||||
|
@ -1030,7 +1030,7 @@ bool Grp_CheckIfSelectionGrpsSingleEnrolmentIsValid (Rol_Role_t Role,struct List
|
|||
SelectionValid && NumCodGrp < LstGrps->NumGrps;
|
||||
NumCodGrp++)
|
||||
{
|
||||
GrpTypCod = Grp_GetTypeOfGroupOfAGroup (LstGrps->GrpCods[NumCodGrp]);
|
||||
GrpTypCod = Grp_DB_GetTypeOfGroupOfAGroup (LstGrps->GrpCods[NumCodGrp]);
|
||||
MultipleEnrolment = Grp_GetMultipleEnrolmentOfAGroupType (GrpTypCod);
|
||||
|
||||
if (!MultipleEnrolment)
|
||||
|
@ -1151,7 +1151,7 @@ void Grp_RegisterUsrIntoGroups (struct UsrData *UsrDat,struct ListCodGrps *LstGr
|
|||
|
||||
if (!AlreadyRegisteredInGrp) // If the user does not belong to the selected group
|
||||
{
|
||||
Grp_AddUsrToGroup (UsrDat,LstGrps->GrpCods[NumGrpSel]);
|
||||
Grp_DB_AddUsrToGroup (UsrDat,LstGrps->GrpCods[NumGrpSel]);
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_THE_USER_X_has_been_enroled_in_the_group_of_type_Y_Z,
|
||||
UsrDat->FullName,Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypName,
|
||||
Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].LstGrps[NumGrpThisType].GrpName);
|
||||
|
@ -1289,7 +1289,7 @@ static void Grp_RemoveUsrFromGroup (long UsrCod,long GrpCod)
|
|||
/*********************** Register a user in a group **************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Grp_AddUsrToGroup (struct UsrData *UsrDat,long GrpCod)
|
||||
static void Grp_DB_AddUsrToGroup (struct UsrData *UsrDat,long GrpCod)
|
||||
{
|
||||
/***** Register in group *****/
|
||||
DB_QueryINSERT ("can not add a user to a group",
|
||||
|
@ -1318,8 +1318,10 @@ static void Grp_ListGroupTypesForEdition (void)
|
|||
unsigned UniqueId;
|
||||
char Id[32];
|
||||
|
||||
/***** Write heading *****/
|
||||
/***** Begin table *****/
|
||||
HTM_TABLE_BeginWidePadding (2);
|
||||
|
||||
/***** Write heading *****/
|
||||
Grp_WriteHeadingGroupTypes ();
|
||||
|
||||
/***** List group types with forms for edition *****/
|
||||
|
@ -1504,8 +1506,10 @@ static void Grp_ListGroupsForEdition (const struct Roo_Rooms *Rooms)
|
|||
Rol_Role_t Role;
|
||||
char StrMaxStudents[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
|
||||
|
||||
/***** Write heading *****/
|
||||
/***** Begin table *****/
|
||||
HTM_TABLE_BeginWidePadding (2);
|
||||
|
||||
/***** Write heading *****/
|
||||
Grp_WriteHeadingGroups ();
|
||||
|
||||
/***** List the groups *****/
|
||||
|
@ -1730,7 +1734,7 @@ void Grp_ListGrpsToEditAsgAttSvyEvtMch (struct GroupType *GrpTyp,
|
|||
IBelongToThisGroup = Grp_CheckIfGrpIsInList (Grp->GrpCod,&LstGrpsIBelong);
|
||||
|
||||
if (Cod > 0) // Cod == -1L means new item, assignment, event, survey, exam event or match
|
||||
AssociatedToGrp = Grp_CheckIfAssociatedToGrp (AssociationsToGrps[WhichIsAssociatedToGrp].Table,
|
||||
AssociatedToGrp = Grp_DB_CheckIfAssociatedToGrp (AssociationsToGrps[WhichIsAssociatedToGrp].Table,
|
||||
AssociationsToGrps[WhichIsAssociatedToGrp].Field,
|
||||
Cod,Grp->GrpCod);
|
||||
else
|
||||
|
@ -1763,12 +1767,11 @@ void Grp_ListGrpsToEditAsgAttSvyEvtMch (struct GroupType *GrpTyp,
|
|||
Grp_FreeListCodGrp (&LstGrpsIBelong);
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/************ Check if an assignment is associated to a group ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static bool Grp_CheckIfAssociatedToGrp (const char *Table,const char *Field,
|
||||
static bool Grp_DB_CheckIfAssociatedToGrp (const char *Table,const char *Field,
|
||||
long Cod,long GrpCod)
|
||||
{
|
||||
/***** Get if an assignment, attendance event, survey, exam event or match
|
||||
|
@ -1789,7 +1792,7 @@ static bool Grp_CheckIfAssociatedToGrp (const char *Table,const char *Field,
|
|||
/*** is associated to any group ***/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Grp_CheckIfAssociatedToGrps (const char *Table,const char *Field,long Cod)
|
||||
bool Grp_DB_CheckIfAssociatedToGrps (const char *Table,const char *Field,long Cod)
|
||||
{
|
||||
/***** Trivial check *****/
|
||||
if (Cod <= 0) // Assignment, attendance event, survey, exam event or match code
|
||||
|
@ -1938,7 +1941,7 @@ static void Grp_ShowWarningToStdsToChangeGrps (void)
|
|||
// If there are groups of this type...
|
||||
if (GrpTyp->NumGrps)
|
||||
// If I don't belong to any group
|
||||
if (!Grp_CheckIfIBelongToGrpsOfType (GrpTyp->GrpTypCod)) // Fast check (not necesary, but avoid slow check)
|
||||
if (!Grp_DB_CheckIfIBelongToGrpsOfType (GrpTyp->GrpTypCod)) // Fast check (not necesary, but avoid slow check)
|
||||
// If there is any group of this type available
|
||||
if (Grp_GetIfAvailableGrpTyp (GrpTyp->GrpTypCod)) // Slow check
|
||||
{
|
||||
|
@ -2373,7 +2376,7 @@ static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp,
|
|||
Role--)
|
||||
{
|
||||
HTM_TD_Begin ("class=\"DAT CM\"");
|
||||
HTM_Unsigned (Grp_CountNumUsrsInNoGrpsOfType (Role,GrpTyp->GrpTypCod));
|
||||
HTM_Unsigned (Grp_DB_CountNumUsrsInNoGrpsOfType (Role,GrpTyp->GrpTypCod));
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
|
@ -2463,20 +2466,16 @@ static void Grp_WriteRowGrp (struct Group *Grp,bool Highlight)
|
|||
HTM_TD_End ();
|
||||
|
||||
/***** Group name *****/
|
||||
if (Highlight)
|
||||
HTM_TD_Begin ("class=\"LM LIGHT_BLUE\"");
|
||||
else
|
||||
HTM_TD_Begin ("class=\"LM\"");
|
||||
HTM_TD_Begin (Highlight ? "class=\"LM LIGHT_BLUE\"" :
|
||||
"class=\"LM\"");
|
||||
HTM_LABEL_Begin ("for=\"Grp%ld\" class=\"DAT\"",Grp->GrpCod);
|
||||
HTM_Txt (Grp->GrpName);
|
||||
HTM_LABEL_End ();
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Room *****/
|
||||
if (Highlight)
|
||||
HTM_TD_Begin ("class=\"DAT LM LIGHT_BLUE\"");
|
||||
else
|
||||
HTM_TD_Begin ("class=\"DAT LM\"");
|
||||
HTM_TD_Begin (Highlight ? "class=\"DAT LM LIGHT_BLUE\"" :
|
||||
"class=\"DAT LM\"");
|
||||
HTM_Txt (Grp->Room.ShrtName);
|
||||
HTM_TD_End ();
|
||||
|
||||
|
@ -2485,28 +2484,22 @@ static void Grp_WriteRowGrp (struct Group *Grp,bool Highlight)
|
|||
Role >= Rol_STD;
|
||||
Role--)
|
||||
{
|
||||
if (Highlight)
|
||||
HTM_TD_Begin ("class=\"DAT CM LIGHT_BLUE\"");
|
||||
else
|
||||
HTM_TD_Begin ("class=\"DAT CM\"");
|
||||
HTM_TD_Begin (Highlight ? "class=\"DAT CM LIGHT_BLUE\"" :
|
||||
"class=\"DAT CM\"");
|
||||
HTM_Int (Grp->NumUsrs[Role]);
|
||||
HTM_TD_End ();
|
||||
}
|
||||
|
||||
/***** Max. number of students in this group *****/
|
||||
if (Highlight)
|
||||
HTM_TD_Begin ("class=\"DAT CM LIGHT_BLUE\"");
|
||||
else
|
||||
HTM_TD_Begin ("class=\"DAT CM\"");
|
||||
HTM_TD_Begin (Highlight ? "class=\"DAT CM LIGHT_BLUE\"" :
|
||||
"class=\"DAT CM\"");
|
||||
Grp_WriteMaxStds (StrMaxStudents,Grp->MaxStudents);
|
||||
HTM_TxtF ("%s ",StrMaxStudents);
|
||||
HTM_TD_End ();
|
||||
|
||||
/***** Vacants in this group *****/
|
||||
if (Highlight)
|
||||
HTM_TD_Begin ("class=\"DAT CM LIGHT_BLUE\"");
|
||||
else
|
||||
HTM_TD_Begin ("class=\"DAT CM\"");
|
||||
HTM_TD_Begin (Highlight ? "class=\"DAT CM LIGHT_BLUE\"" :
|
||||
"class=\"DAT CM\"");
|
||||
if (Grp->MaxStudents <= Grp_MAX_STUDENTS_IN_A_GROUP)
|
||||
{
|
||||
Vacant = (int) Grp->MaxStudents - (int) Grp->NumUsrs[Rol_STD];
|
||||
|
@ -2531,8 +2524,10 @@ static void Grp_PutFormToCreateGroupType (void)
|
|||
extern const char *Txt_The_groups_will_not_automatically_open;
|
||||
extern const char *Txt_Create_type_of_group;
|
||||
|
||||
/***** Begin form *****/
|
||||
/***** Begin section *****/
|
||||
HTM_SECTION_Begin (Grp_NEW_GROUP_TYPE_SECTION_ID);
|
||||
|
||||
/***** Begin form *****/
|
||||
Frm_StartFormAnchor (ActNewGrpTyp,Grp_GROUP_TYPES_SECTION_ID);
|
||||
|
||||
/***** Begin box *****/
|
||||
|
@ -2622,6 +2617,8 @@ static void Grp_PutFormToCreateGroupType (void)
|
|||
|
||||
/***** End form *****/
|
||||
Frm_EndForm ();
|
||||
|
||||
/***** End section *****/
|
||||
HTM_SECTION_End ();
|
||||
}
|
||||
|
||||
|
@ -2642,8 +2639,10 @@ static void Grp_PutFormToCreateGroup (const struct Roo_Rooms *Rooms)
|
|||
Rol_Role_t Role;
|
||||
char StrMaxStudents[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
|
||||
|
||||
/***** Begin form *****/
|
||||
/***** Begin section *****/
|
||||
HTM_SECTION_Begin (Grp_NEW_GROUP_SECTION_ID);
|
||||
|
||||
/***** Begin form *****/
|
||||
Frm_StartFormAnchor (ActNewGrp,Grp_GROUPS_SECTION_ID);
|
||||
|
||||
/***** Begin box and table *****/
|
||||
|
@ -2747,6 +2746,8 @@ static void Grp_PutFormToCreateGroup (const struct Roo_Rooms *Rooms)
|
|||
|
||||
/***** End form *****/
|
||||
Frm_EndForm ();
|
||||
|
||||
/***** End section *****/
|
||||
HTM_SECTION_End ();
|
||||
}
|
||||
|
||||
|
@ -2871,7 +2872,6 @@ void Grp_GetListGrpTypesInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes)
|
|||
|
||||
/* Initialize pointer to the list of groups of this type */
|
||||
Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].LstGrps = NULL;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2955,7 +2955,7 @@ void Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes)
|
|||
if (GrpTyp->NumGrps) // If there are groups of this type...
|
||||
{
|
||||
/***** Query database *****/
|
||||
GrpTyp->NumGrps = Grp_GetGrpsOfType (GrpTyp->GrpTypCod,&mysql_res);
|
||||
GrpTyp->NumGrps = Grp_DB_GetGrpsOfType (GrpTyp->GrpTypCod,&mysql_res);
|
||||
if (GrpTyp->NumGrps > 0) // Groups found...
|
||||
{
|
||||
/***** Create list with groups of this type *****/
|
||||
|
@ -2994,7 +2994,7 @@ void Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes)
|
|||
for (Role = Rol_TCH;
|
||||
Role >= Rol_STD;
|
||||
Role--)
|
||||
Grp->NumUsrs[Role] = Grp_CountNumUsrsInGrp (Role,Grp->GrpCod);
|
||||
Grp->NumUsrs[Role] = Grp_DB_CountNumUsrsInGrp (Role,Grp->GrpCod);
|
||||
|
||||
/* Get maximum number of students in group (row[4]) */
|
||||
Grp->MaxStudents = Grp_ConvertToNumMaxStdsGrp (row[4]);
|
||||
|
@ -3051,7 +3051,7 @@ void Grp_FreeListGrpTypesAndGrps (void)
|
|||
/*********** Query the number of groups that hay in this course **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Grp_CountNumGrpsInCurrentCrs (void)
|
||||
unsigned Grp_DB_CountNumGrpsInCurrentCrs (void)
|
||||
{
|
||||
/***** Get number of group in current course from database *****/
|
||||
return (unsigned)
|
||||
|
@ -3068,7 +3068,7 @@ unsigned Grp_CountNumGrpsInCurrentCrs (void)
|
|||
/****************** Count number of groups in a group type *******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static unsigned Grp_CountNumGrpsInThisCrsOfType (long GrpTypCod)
|
||||
static unsigned Grp_DB_CountNumGrpsInThisCrsOfType (long GrpTypCod)
|
||||
{
|
||||
/***** Get number of groups of a type from database *****/
|
||||
return (unsigned)
|
||||
|
@ -3083,7 +3083,7 @@ static unsigned Grp_CountNumGrpsInThisCrsOfType (long GrpTypCod)
|
|||
/******************** Get groups of a type in this course ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Grp_GetGrpsOfType (long GrpTypCod,MYSQL_RES **mysql_res)
|
||||
unsigned Grp_DB_GetGrpsOfType (long GrpTypCod,MYSQL_RES **mysql_res)
|
||||
{
|
||||
/***** Get groups of a type from database *****/
|
||||
// Don't use INNER JOIN because there are groups without assigned room
|
||||
|
@ -3245,10 +3245,9 @@ void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat)
|
|||
/* Get maximum number of students (row[7]) */
|
||||
GrpDat->MaxStudents = Grp_ConvertToNumMaxStdsGrp (row[7]);
|
||||
|
||||
/* Get whether group is open or closed (row[8]) */
|
||||
/* Get whether group is open or closed (row[8]),
|
||||
and whether group has file zones (row[9]) */
|
||||
GrpDat->Open = (row[8][0] == 'Y');
|
||||
|
||||
/* Get whether group has file zones (row[9]) */
|
||||
GrpDat->FileZones = (row[9][0] == 'Y');
|
||||
}
|
||||
|
||||
|
@ -3261,7 +3260,7 @@ void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat)
|
|||
/********************** Get the type of group of a group *********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static long Grp_GetTypeOfGroupOfAGroup (long GrpCod)
|
||||
static long Grp_DB_GetTypeOfGroupOfAGroup (long GrpCod)
|
||||
{
|
||||
long GrpTypCod;
|
||||
|
||||
|
@ -3281,7 +3280,7 @@ static long Grp_GetTypeOfGroupOfAGroup (long GrpCod)
|
|||
/******************** Check if a group exists in database ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Grp_CheckIfGroupExists (long GrpCod)
|
||||
bool Grp_DB_CheckIfGroupExists (long GrpCod)
|
||||
{
|
||||
/***** Get if a group exists from database *****/
|
||||
return (DB_QueryCOUNT ("can not check if a group exists",
|
||||
|
@ -3295,7 +3294,7 @@ bool Grp_CheckIfGroupExists (long GrpCod)
|
|||
/******************* Check if a group belongs to a course ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
bool Grp_CheckIfGroupBelongsToCourse (long GrpCod,long CrsCod)
|
||||
bool Grp_DB_CheckIfGrpBelongsToCrs (long GrpCod,long CrsCod)
|
||||
{
|
||||
/***** Get if a group exists from database *****/
|
||||
return (DB_QueryCOUNT ("can not check if a group belongs to a course",
|
||||
|
@ -3312,7 +3311,7 @@ bool Grp_CheckIfGroupBelongsToCourse (long GrpCod,long CrsCod)
|
|||
/********************* Count number of users in a group **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Grp_CountNumUsrsInGrp (Rol_Role_t Role,long GrpCod)
|
||||
unsigned Grp_DB_CountNumUsrsInGrp (Rol_Role_t Role,long GrpCod)
|
||||
{
|
||||
/***** Get number of students in a group from database *****/
|
||||
return (unsigned)
|
||||
|
@ -3336,7 +3335,7 @@ unsigned Grp_CountNumUsrsInGrp (Rol_Role_t Role,long GrpCod)
|
|||
/*** Count # of users of current course not belonging to groups of a type ****/
|
||||
/*****************************************************************************/
|
||||
|
||||
static unsigned Grp_CountNumUsrsInNoGrpsOfType (Rol_Role_t Role,long GrpTypCod)
|
||||
static unsigned Grp_DB_CountNumUsrsInNoGrpsOfType (Rol_Role_t Role,long GrpTypCod)
|
||||
{
|
||||
/***** Get number of users not belonging to groups of a type ******/
|
||||
return (unsigned)
|
||||
|
@ -3361,7 +3360,7 @@ static unsigned Grp_CountNumUsrsInNoGrpsOfType (Rol_Role_t Role,long GrpTypCod)
|
|||
/********* Check if I belong to any groups of a given type I belong **********/
|
||||
/*****************************************************************************/
|
||||
|
||||
static bool Grp_CheckIfIBelongToGrpsOfType (long GrpTypCod)
|
||||
static bool Grp_DB_CheckIfIBelongToGrpsOfType (long GrpTypCod)
|
||||
{
|
||||
/***** Get a group which I belong to from database *****/
|
||||
return (DB_QueryCOUNT ("can not check if you belong to a group type",
|
||||
|
@ -3795,7 +3794,7 @@ void Grp_ReceiveFormNewGrpTyp (void)
|
|||
if (Gbl.Crs.Grps.GrpTyp.GrpTypName[0]) // If there's a group type name
|
||||
{
|
||||
/***** If name of group type was in database... *****/
|
||||
if (Grp_CheckIfGroupTypeNameExists (Gbl.Crs.Grps.GrpTyp.GrpTypName,-1L))
|
||||
if (Grp_DB_CheckIfGroupTypeNameExists (Gbl.Crs.Grps.GrpTyp.GrpTypName,-1L))
|
||||
{
|
||||
AlertType = Ale_WARNING;
|
||||
snprintf (AlertTxt,sizeof (AlertTxt),
|
||||
|
@ -3804,7 +3803,7 @@ void Grp_ReceiveFormNewGrpTyp (void)
|
|||
}
|
||||
else // Add new group type to database
|
||||
{
|
||||
Grp_CreateGroupType ();
|
||||
Gbl.Crs.Grps.GrpTyp.GrpTypCod = Grp_DB_CreateGroupType (&Gbl.Crs.Grps.GrpTyp);
|
||||
|
||||
AlertType = Ale_SUCCESS;
|
||||
snprintf (AlertTxt,sizeof (AlertTxt),
|
||||
|
@ -3870,7 +3869,7 @@ void Grp_ReceiveFormNewGrp (void)
|
|||
if (Gbl.Crs.Grps.GrpName[0]) // If there's a group name
|
||||
{
|
||||
/***** If name of group was in database... *****/
|
||||
if (Grp_CheckIfGroupNameExists (Gbl.Crs.Grps.GrpTyp.GrpTypCod,Gbl.Crs.Grps.GrpName,-1L))
|
||||
if (Grp_DB_CheckIfGroupNameExists (Gbl.Crs.Grps.GrpTyp.GrpTypCod,Gbl.Crs.Grps.GrpName,-1L))
|
||||
{
|
||||
AlertType = Ale_WARNING;
|
||||
snprintf (AlertTxt,sizeof (AlertTxt),
|
||||
|
@ -3879,7 +3878,7 @@ void Grp_ReceiveFormNewGrp (void)
|
|||
}
|
||||
else // Add new group to database
|
||||
{
|
||||
Grp_CreateGroup ();
|
||||
Grp_DB_CreateGroup ();
|
||||
|
||||
/* Write success message */
|
||||
AlertType = Ale_SUCCESS;
|
||||
|
@ -3911,7 +3910,7 @@ void Grp_ReceiveFormNewGrp (void)
|
|||
/******************* Check if name of group type exists **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static bool Grp_CheckIfGroupTypeNameExists (const char *GrpTypName,long GrpTypCod)
|
||||
static bool Grp_DB_CheckIfGroupTypeNameExists (const char *GrpTypName,long GrpTypCod)
|
||||
{
|
||||
/***** Get number of group types with a name from database *****/
|
||||
return (DB_QueryCOUNT ("can not check if the name of type of group"
|
||||
|
@ -3928,7 +3927,7 @@ static bool Grp_CheckIfGroupTypeNameExists (const char *GrpTypName,long GrpTypCo
|
|||
/************************ Check if name of group exists **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static bool Grp_CheckIfGroupNameExists (long GrpTypCod,const char *GrpName,long GrpCod)
|
||||
static bool Grp_DB_CheckIfGroupNameExists (long GrpTypCod,const char *GrpName,long GrpCod)
|
||||
{
|
||||
/***** Get number of groups with a type and a name from database *****/
|
||||
return (DB_QueryCOUNT ("can not check if the name of group already existed",
|
||||
|
@ -3944,10 +3943,10 @@ static bool Grp_CheckIfGroupNameExists (long GrpTypCod,const char *GrpName,long
|
|||
/************************** Create a new group type **************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Grp_CreateGroupType (void)
|
||||
static long Grp_DB_CreateGroupType (const struct GroupType *GrpTyp)
|
||||
{
|
||||
/***** Create a new group type *****/
|
||||
Gbl.Crs.Grps.GrpTyp.GrpTypCod =
|
||||
return
|
||||
DB_QueryINSERTandReturnCode ("can not create type of group",
|
||||
"INSERT INTO grp_types"
|
||||
" (CrsCod,GrpTypName,"
|
||||
|
@ -3956,21 +3955,21 @@ static void Grp_CreateGroupType (void)
|
|||
" (%ld,'%s',"
|
||||
"'%c','%c','%c',FROM_UNIXTIME(%ld))",
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
Gbl.Crs.Grps.GrpTyp.GrpTypName,
|
||||
Gbl.Crs.Grps.GrpTyp.MandatoryEnrolment ? 'Y' :
|
||||
GrpTyp->GrpTypName,
|
||||
GrpTyp->MandatoryEnrolment ? 'Y' :
|
||||
'N',
|
||||
Gbl.Crs.Grps.GrpTyp.MultipleEnrolment ? 'Y' :
|
||||
GrpTyp->MultipleEnrolment ? 'Y' :
|
||||
'N',
|
||||
Gbl.Crs.Grps.GrpTyp.MustBeOpened ? 'Y' :
|
||||
GrpTyp->MustBeOpened ? 'Y' :
|
||||
'N',
|
||||
(long) Gbl.Crs.Grps.GrpTyp.OpenTimeUTC);
|
||||
(long) GrpTyp->OpenTimeUTC);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Create a new group ****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Grp_CreateGroup (void)
|
||||
static void Grp_DB_CreateGroup (void)
|
||||
{
|
||||
/***** Create a new group *****/
|
||||
DB_QueryINSERT ("can not create group",
|
||||
|
@ -3997,7 +3996,7 @@ void Grp_ReqRemGroupType (void)
|
|||
Err_WrongGrpTypExit ();
|
||||
|
||||
/***** Check if this group type has groups *****/
|
||||
if ((NumGrps = Grp_CountNumGrpsInThisCrsOfType (Gbl.Crs.Grps.GrpTyp.GrpTypCod))) // Group type has groups ==> Ask for confirmation
|
||||
if ((NumGrps = Grp_DB_CountNumGrpsInThisCrsOfType (Gbl.Crs.Grps.GrpTyp.GrpTypCod))) // Group type has groups ==> Ask for confirmation
|
||||
Grp_AskConfirmRemGrpTypWithGrps (NumGrps);
|
||||
else // Group type has no groups ==> remove directly
|
||||
Grp_RemoveGroupTypeCompletely ();
|
||||
|
@ -4070,7 +4069,7 @@ static void Grp_AskConfirmRemGrp (void)
|
|||
Grp_GetDataOfGroupByCod (&GrpDat);
|
||||
|
||||
/***** Count number of students in group *****/
|
||||
NumStds = Grp_CountNumUsrsInGrp (Rol_STD,Gbl.Crs.Grps.GrpCod);
|
||||
NumStds = Grp_DB_CountNumUsrsInGrp (Rol_STD,Gbl.Crs.Grps.GrpCod);
|
||||
|
||||
/***** Show the form to edit group types again *****/
|
||||
Grp_ReqEditGroupsInternal0 ();
|
||||
|
@ -4420,7 +4419,7 @@ void Grp_ChangeGroupType (void)
|
|||
Grp_GetDataOfGroupByCod (&GrpDat);
|
||||
|
||||
/***** If group was in database... *****/
|
||||
if (Grp_CheckIfGroupNameExists (NewGrpTypCod,GrpDat.GrpName,-1L))
|
||||
if (Grp_DB_CheckIfGroupNameExists (NewGrpTypCod,GrpDat.GrpName,-1L))
|
||||
{
|
||||
/* Create warning message */
|
||||
AlertType = Ale_WARNING;
|
||||
|
@ -4776,7 +4775,7 @@ void Grp_RenameGroupType (void)
|
|||
if (strcmp (Gbl.Crs.Grps.GrpTyp.GrpTypName,NewNameGrpTyp)) // Different names
|
||||
{
|
||||
/***** If group type was in database... *****/
|
||||
if (Grp_CheckIfGroupTypeNameExists (NewNameGrpTyp,Gbl.Crs.Grps.GrpTyp.GrpTypCod))
|
||||
if (Grp_DB_CheckIfGroupTypeNameExists (NewNameGrpTyp,Gbl.Crs.Grps.GrpTyp.GrpTypCod))
|
||||
{
|
||||
AlertType = Ale_WARNING;
|
||||
snprintf (AlertTxt,sizeof (AlertTxt),
|
||||
|
@ -4862,7 +4861,7 @@ void Grp_RenameGroup (void)
|
|||
if (strcmp (GrpDat.GrpName,NewNameGrp)) // Different names
|
||||
{
|
||||
/***** If group was in database... *****/
|
||||
if (Grp_CheckIfGroupNameExists (GrpDat.GrpTypCod,NewNameGrp,Gbl.Crs.Grps.GrpCod))
|
||||
if (Grp_DB_CheckIfGroupNameExists (GrpDat.GrpTypCod,NewNameGrp,Gbl.Crs.Grps.GrpCod))
|
||||
{
|
||||
AlertType = Ale_WARNING;
|
||||
snprintf (AlertTxt,sizeof (AlertTxt),
|
||||
|
|
12
swad_group.h
12
swad_group.h
|
@ -184,7 +184,7 @@ void Grp_ListGrpsToEditAsgAttSvyEvtMch (struct GroupType *GrpTyp,
|
|||
Grp_WhichIsAssociatedToGrp_t WhichIsAssociatedToGrp,
|
||||
long Cod);
|
||||
|
||||
bool Grp_CheckIfAssociatedToGrps (const char *Table,const char *Field,long Cod);
|
||||
bool Grp_DB_CheckIfAssociatedToGrps (const char *Table,const char *Field,long Cod);
|
||||
void Grp_ReqRegisterInGrps (void);
|
||||
void Grp_ShowLstGrpsToChgMyGrps (void);
|
||||
void Grp_ShowLstGrpsToChgOtherUsrsGrps (long UsrCod);
|
||||
|
@ -193,12 +193,12 @@ void Grp_GetListGrpTypesInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes);
|
|||
void Grp_FreeListGrpTypesAndGrps (void);
|
||||
void Grp_OpenGroupsAutomatically (void);
|
||||
void Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes);
|
||||
unsigned Grp_CountNumGrpsInCurrentCrs (void);
|
||||
unsigned Grp_GetGrpsOfType (long GrpTypCod,MYSQL_RES **mysql_res);
|
||||
unsigned Grp_DB_CountNumGrpsInCurrentCrs (void);
|
||||
unsigned Grp_DB_GetGrpsOfType (long GrpTypCod,MYSQL_RES **mysql_res);
|
||||
void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat);
|
||||
bool Grp_CheckIfGroupExists (long GrpCod);
|
||||
bool Grp_CheckIfGroupBelongsToCourse (long GrpCod,long CrsCod);
|
||||
unsigned Grp_CountNumUsrsInGrp (Rol_Role_t Role,long GrpCod);
|
||||
bool Grp_DB_CheckIfGroupExists (long GrpCod);
|
||||
bool Grp_DB_CheckIfGrpBelongsToCrs (long GrpCod,long CrsCod);
|
||||
unsigned Grp_DB_CountNumUsrsInGrp (Rol_Role_t Role,long GrpCod);
|
||||
|
||||
void Grp_FlushCacheIBelongToGrp (void);
|
||||
bool Grp_GetIfIBelongToGrp (long GrpCod);
|
||||
|
|
|
@ -617,7 +617,7 @@ void Hie_InitHierarchy (void)
|
|||
|
||||
/***** Count number of groups in current course
|
||||
(used in some actions) *****/
|
||||
Gbl.Crs.Grps.NumGrps = Grp_CountNumGrpsInCurrentCrs ();
|
||||
Gbl.Crs.Grps.NumGrps = Grp_DB_CountNumGrpsInCurrentCrs ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1451,7 +1451,7 @@ void Ind_ComputeAndStoreIndicatorsCrs (long CrsCod,int NumIndicatorsFromDB,
|
|||
IndicatorsCrs->NumIndicators++;
|
||||
|
||||
/***** Indicator #3: information about online tutoring *****/
|
||||
IndicatorsCrs->NumThreads = For_GetNumTotalThrsInForumsOfType (For_FORUM_COURSE_USRS,-1L,-1L,-1L,-1L,CrsCod);
|
||||
IndicatorsCrs->NumThreads = For_DB_GetNumTotalThrsInForumsOfType (For_FORUM_COURSE_USRS,-1L,-1L,-1L,-1L,CrsCod);
|
||||
IndicatorsCrs->NumPosts = For_GetNumTotalPstsInForumsOfType (For_FORUM_COURSE_USRS,-1L,-1L,-1L,-1L,CrsCod,&(IndicatorsCrs->NumUsrsToBeNotifiedByEMail));
|
||||
IndicatorsCrs->NumMsgsSentByTchs = Msg_GetNumMsgsSentByTchsCrs (CrsCod);
|
||||
IndicatorsCrs->ThereIsOnlineTutoring = (IndicatorsCrs->NumThreads != 0) ||
|
||||
|
|
|
@ -1436,11 +1436,11 @@ void Lay_RefreshNotifsAndConnected (void)
|
|||
if (!(Gbl.PID % 11))
|
||||
Ntf_SendPendingNotifByEMailToAllUsrs (); // Send pending notifications by email
|
||||
else if (!(Gbl.PID % 19))
|
||||
Fir_PurgeFirewall (); // Remove old clicks from firewall
|
||||
Fir_DB_PurgeFirewall (); // Remove old clicks from firewall
|
||||
else if (!(Gbl.PID % 23))
|
||||
Fil_RemoveOldTmpFiles (Cfg_PATH_FILE_BROWSER_TMP_PUBLIC ,Cfg_TIME_TO_DELETE_BROWSER_TMP_FILES ,false); // Remove the oldest temporary public directories used for downloading
|
||||
else if (!(Gbl.PID % 101))
|
||||
Brw_RemoveExpiredExpandedFolders (); // Remove old expanded folders (from all users)
|
||||
Brw_DB_RemoveExpiredExpandedFolders (); // Remove old expanded folders (from all users)
|
||||
else if (!(Gbl.PID % 103))
|
||||
Set_RemoveOldSettingsFromIP (); // Remove old settings from IP
|
||||
else if (!(Gbl.PID % 107))
|
||||
|
|
|
@ -117,7 +117,7 @@ int main (void)
|
|||
|
||||
/***** Mitigate DoS attacks *****/
|
||||
Fir_CheckFirewallAndExitIfBanned ();
|
||||
Fir_LogAccess ();
|
||||
Fir_DB_LogAccess ();
|
||||
Fir_CheckFirewallAndExitIfTooManyRequests ();
|
||||
|
||||
Hie_InitHierarchy ();
|
||||
|
|
|
@ -614,7 +614,7 @@ void Mrk_ShowMyMarks (void)
|
|||
/* Select a random student from the course */
|
||||
if (Gbl.Crs.Grps.GrpCod > 0) // Group zone
|
||||
{
|
||||
if (Grp_CountNumUsrsInGrp (Rol_STD,Gbl.Crs.Grps.GrpCod)) // If there are students in this group
|
||||
if (Grp_DB_CountNumUsrsInGrp (Rol_STD,Gbl.Crs.Grps.GrpCod)) // If there are students in this group
|
||||
{
|
||||
Gbl.Usrs.Other.UsrDat.UsrCod = Usr_GetRamdomStdFromGrp (Gbl.Crs.Grps.GrpCod);
|
||||
UsrDat = &Gbl.Usrs.Other.UsrDat;
|
||||
|
|
|
@ -1594,7 +1594,7 @@ static void Mch_ShowLstGrpsToEditMatch (long MchCod)
|
|||
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"id=\"WholeCrs\" value=\"Y\"%s"
|
||||
" onclick=\"uncheckChildren(this,'GrpCods')\"",
|
||||
Grp_CheckIfAssociatedToGrps ("mch_groups","MchCod",MchCod) ? "" :
|
||||
Grp_DB_CheckIfAssociatedToGrps ("mch_groups","MchCod",MchCod) ? "" :
|
||||
" checked=\"checked\"");
|
||||
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
||||
HTM_LABEL_End ();
|
||||
|
|
|
@ -578,8 +578,8 @@ static void Prf_ShowNumFilesCurrentlyPublished (const struct UsrData *UsrDat)
|
|||
unsigned NumPublicFiles;
|
||||
|
||||
/***** Number of files currently published *****/
|
||||
if ((NumFiles = Brw_GetNumFilesUsr (UsrDat->UsrCod)))
|
||||
NumPublicFiles = Brw_GetNumPublicFilesUsr (UsrDat->UsrCod);
|
||||
if ((NumFiles = Brw_DB_GetNumFilesUsr (UsrDat->UsrCod)))
|
||||
NumPublicFiles = Brw_DB_GetNumPublicFilesUsr (UsrDat->UsrCod);
|
||||
else
|
||||
NumPublicFiles = 0;
|
||||
|
||||
|
@ -1177,7 +1177,7 @@ static void Prf_GetNumFileViewsAndStoreAsUsrFigure (long UsrCod)
|
|||
Prf_ResetUsrFigures (&UsrFigures);
|
||||
|
||||
/***** Get number of file views from database *****/
|
||||
UsrFigures.NumFileViews = (long) Brw_GetNumFileViewsUsr (UsrCod);
|
||||
UsrFigures.NumFileViews = (long) Brw_DB_GetNumFileViewsUsr (UsrCod);
|
||||
|
||||
/***** Update number of file views in user's figures *****/
|
||||
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
||||
|
@ -1206,7 +1206,7 @@ static void Prf_GetNumForumPostsAndStoreAsUsrFigure (long UsrCod)
|
|||
Prf_ResetUsrFigures (&UsrFigures);
|
||||
|
||||
/***** Get number of forum posts from database *****/
|
||||
UsrFigures.NumForPst = For_GetNumPostsUsr (UsrCod);
|
||||
UsrFigures.NumForPst = For_DB_GetNumPostsUsr (UsrCod);
|
||||
|
||||
/***** Update number of forum posts in user's figures *****/
|
||||
if (Prf_CheckIfUsrFiguresExists (UsrCod))
|
||||
|
|
|
@ -655,8 +655,8 @@ static void Rep_WriteSectionUsrFigures (const struct Rep_Report *Report)
|
|||
fprintf (Gbl.F.Rep,"</li>");
|
||||
|
||||
/***** Number of files currently published *****/
|
||||
if ((NumFiles = Brw_GetNumFilesUsr (Gbl.Usrs.Me.UsrDat.UsrCod)))
|
||||
NumPublicFiles = Brw_GetNumPublicFilesUsr (Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
if ((NumFiles = Brw_DB_GetNumFilesUsr (Gbl.Usrs.Me.UsrDat.UsrCod)))
|
||||
NumPublicFiles = Brw_DB_GetNumPublicFilesUsr (Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
else
|
||||
NumPublicFiles = 0;
|
||||
fprintf (Gbl.F.Rep,"<li>"
|
||||
|
|
|
@ -428,6 +428,22 @@ void Set_DB_InsertUsrInCrsSettings (long UsrCod,long CrsCod)
|
|||
'N');
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******** Update the group of my last access to a file browser zone **********/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Set_DB_UpdateGrpLastAccZone (const char *FieldNameDB,long GrpCod)
|
||||
{
|
||||
DB_QueryUPDATE ("can not update the group of the last access to a file browser",
|
||||
"UPDATE crs_user_settings"
|
||||
" SET %s=%ld"
|
||||
" WHERE UsrCod=%ld"
|
||||
" AND CrsCod=%ld",
|
||||
FieldNameDB,GrpCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Remove a user from a courses setting *********************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -59,6 +59,9 @@ void Set_BeginOneSettingSelector (void);
|
|||
void Set_EndOneSettingSelector (void);
|
||||
|
||||
void Set_DB_InsertUsrInCrsSettings (long UsrCod,long CrsCod);
|
||||
|
||||
void Set_DB_UpdateGrpLastAccZone (const char *FieldNameDB,long GrpCod);
|
||||
|
||||
void Set_DB_RemUsrFromCrsSettings (long UsrCod,long CrsCod);
|
||||
void Set_DB_RemUsrFromAllCrssSettings (long UsrCod);
|
||||
void Set_DB_RemAllUsrsFromCrsSettings (long CrsCod);
|
||||
|
|
|
@ -2155,7 +2155,7 @@ static void Svy_ShowLstGrpsToEditSurvey (long SvyCod)
|
|||
HTM_LABEL_Begin (NULL);
|
||||
HTM_INPUT_CHECKBOX ("WholeCrs",HTM_DONT_SUBMIT_ON_CHANGE,
|
||||
"id=\"WholeCrs\" value=\"Y\"%s onclick=\"uncheckChildren(this,'GrpCods')\"",
|
||||
Grp_CheckIfAssociatedToGrps ("svy_groups","SvyCod",SvyCod) ? "" :
|
||||
Grp_DB_CheckIfAssociatedToGrps ("svy_groups","SvyCod",SvyCod) ? "" :
|
||||
" checked=\"checked\"");
|
||||
HTM_TxtF ("%s %s",Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName);
|
||||
HTM_LABEL_End ();
|
||||
|
|
92
swad_user.c
92
swad_user.c
|
@ -10386,3 +10386,95 @@ unsigned Usr_DB_GetOldUsrs (MYSQL_RES **mysql_res,time_t SecondsWithoutAccess)
|
|||
" FROM crs_users)",
|
||||
(unsigned long long) SecondsWithoutAccess);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************** Get number of users who have chosen an option ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Usr_DB_GetNumUsrsWhoChoseAnOption (const char *SubQuery)
|
||||
{
|
||||
switch (Gbl.Scope.Current)
|
||||
{
|
||||
case HieLvl_SYS:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get the number of users who have chosen an option",
|
||||
"SELECT COUNT(*)"
|
||||
" FROM usr_data WHERE %s",
|
||||
SubQuery);
|
||||
case HieLvl_CTY:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get the number of users who have chosen an option",
|
||||
"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM ins_instits,"
|
||||
"ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_users,"
|
||||
"usr_data"
|
||||
" WHERE ins_instits.CtyCod=%ld"
|
||||
" AND ins_instits.InsCod=ctr_centers.InsCod"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||
" AND crs_users.UsrCod=usr_data.UsrCod"
|
||||
" AND %s",
|
||||
Gbl.Hierarchy.Cty.CtyCod,SubQuery);
|
||||
case HieLvl_INS:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get the number of users who have chosen an option",
|
||||
"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM ctr_centers,"
|
||||
"deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_users,"
|
||||
"usr_data"
|
||||
" WHERE ctr_centers.InsCod=%ld"
|
||||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||
" AND crs_users.UsrCod=usr_data.UsrCod"
|
||||
" AND %s",
|
||||
Gbl.Hierarchy.Ins.InsCod,SubQuery);
|
||||
case HieLvl_CTR:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get the number of users who have chosen an option",
|
||||
"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM deg_degrees,"
|
||||
"crs_courses,"
|
||||
"crs_users,"
|
||||
"usr_data"
|
||||
" WHERE deg_degrees.CtrCod=%ld"
|
||||
" AND deg_degrees.DegCod=crs_courses.DegCod"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||
" AND crs_users.UsrCod=usr_data.UsrCod"
|
||||
" AND %s",
|
||||
Gbl.Hierarchy.Ctr.CtrCod,SubQuery);
|
||||
case HieLvl_DEG:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get the number of users who have chosen an option",
|
||||
"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM crs_courses,"
|
||||
"crs_users,"
|
||||
"usr_data"
|
||||
" WHERE crs_courses.DegCod=%ld"
|
||||
" AND crs_courses.CrsCod=crs_users.CrsCod"
|
||||
" AND crs_users.UsrCod=usr_data.UsrCod"
|
||||
" AND %s",
|
||||
Gbl.Hierarchy.Deg.DegCod,SubQuery);
|
||||
case HieLvl_CRS:
|
||||
return (unsigned)
|
||||
DB_QueryCOUNT ("can not get the number of users who have chosen an option",
|
||||
"SELECT COUNT(DISTINCT usr_data.UsrCod)"
|
||||
" FROM crs_users,"
|
||||
"usr_data"
|
||||
" WHERE crs_users.CrsCod=%ld"
|
||||
" AND crs_users.UsrCod=usr_data.UsrCod"
|
||||
" AND %s",
|
||||
Gbl.Hierarchy.Crs.CrsCod,SubQuery);
|
||||
default:
|
||||
Err_WrongScopeExit ();
|
||||
return 0; // Not reached
|
||||
}
|
||||
|
||||
return 0; // Not reached
|
||||
}
|
||||
|
|
|
@ -554,4 +554,6 @@ Usr_Who_t Usr_GetHiddenParamWho (void);
|
|||
|
||||
unsigned Usr_DB_GetOldUsrs (MYSQL_RES **mysql_res,time_t SecondsWithoutAccess);
|
||||
|
||||
unsigned Usr_DB_GetNumUsrsWhoChoseAnOption (const char *SubQuery);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue