diff --git a/icon/gamepad.svg b/icon/gamepad.svg new file mode 100644 index 00000000..29750646 --- /dev/null +++ b/icon/gamepad.svg @@ -0,0 +1 @@ + diff --git a/swad_account.c b/swad_account.c index 9bd5abee..cbecd41a 100644 --- a/swad_account.c +++ b/swad_account.c @@ -36,6 +36,7 @@ #include "swad_database.h" #include "swad_duplicate.h" #include "swad_enrolment.h" +#include "swad_exam_print.h" #include "swad_follow.h" #include "swad_form.h" #include "swad_forum.h" @@ -43,6 +44,7 @@ #include "swad_HTML.h" #include "swad_ID.h" #include "swad_language.h" +#include "swad_match.h" #include "swad_message.h" #include "swad_nickname.h" #include "swad_notification.h" @@ -1081,8 +1083,10 @@ void Acc_CompletelyEliminateAccount (struct UsrData *UsrDat, Ale_ShowAlert (Ale_SUCCESS,Txt_Briefcase_of_THE_USER_X_has_been_removed, UsrDat->FullName); - /***** Remove test results made by user in all courses *****/ + /***** Remove test, exams and matches made by user in all courses *****/ TstPrn_RemovePrintsMadeByUsrInAllCrss (UsrDat->UsrCod); + ExaPrn_RemovePrintsMadeByUsrInAllCrss (UsrDat->UsrCod); + Mch_RemoveMatchesMadeByUsrInAllCrss (UsrDat->UsrCod); /***** Remove user's notifications *****/ Ntf_RemoveUsrNtfs (UsrDat->UsrCod); diff --git a/swad_action.c b/swad_action.c index 42ac5f3d..ef1ab65a 100644 --- a/swad_action.c +++ b/swad_action.c @@ -684,10 +684,10 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = [ActRcvCfgTst ] = { 454,-1,TabUnk,ActReqTst ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstCfg_ReceiveConfigTst ,NULL}, [ActReqSeeMyTstRes ] = {1083,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,TstPrn_SelDatesToSeeMyPrints ,NULL}, - [ActSeeMyTstRes ] = {1084,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstPrn_ShowMyPrints ,NULL}, + [ActSeeMyTstResCrs ] = {1084,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstPrn_ShowMyPrints ,NULL}, [ActSeeOneTstResMe ] = {1085,-1,TabUnk,ActReqTst ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstPrn_ShowOnePrint ,NULL}, [ActReqSeeUsrTstRes ] = {1080,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Dat_SetIniEndDates ,TstPrn_SelUsrsToViewUsrsPrints ,NULL}, - [ActSeeUsrTstRes ] = {1081,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstPrn_GetUsrsAndShowPrints ,NULL}, + [ActSeeUsrTstResCrs ] = {1081,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstPrn_GetUsrsAndShowPrints ,NULL}, [ActSeeOneTstResOth ] = {1082,-1,TabUnk,ActReqTst ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,TstPrn_ShowOnePrint ,NULL}, [ActSeeExa ] = {1849,-1,TabUnk,ActSeeAllExa ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_SeeOneExam ,NULL}, @@ -732,11 +732,13 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = [ActSeeMyExaResExa ] = {1868,-1,TabUnk,ActSeeAllExa ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowMyResultsInExa ,NULL}, [ActSeeMyExaResSes ] = {1869,-1,TabUnk,ActSeeAllExa ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowMyResultsInSes ,NULL}, [ActSeeOneExaResMe ] = {1870,-1,TabUnk,ActSeeAllExa ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowOneExaResult ,NULL}, - [ActReqSeeAllExaRes ] = {1871,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_SelUsrsToViewResults ,NULL}, - [ActSeeAllExaResCrs ] = {1872,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowAllResultsInCrs ,NULL}, - [ActSeeAllExaResExa ] = {1873,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowAllResultsInExa ,NULL}, - [ActSeeAllExaResSes ] = {1874,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowAllResultsInSes ,NULL}, + + [ActReqSeeUsrExaRes ] = {1871,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_SelUsrsToViewResults ,NULL}, + [ActSeeUsrExaResCrs ] = {1872,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowAllResultsInCrs ,NULL}, + [ActSeeUsrExaResExa ] = {1873,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowAllResultsInExa ,NULL}, + [ActSeeUsrExaResSes ] = {1874,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowAllResultsInSes ,NULL}, [ActSeeOneExaResOth ] = {1875,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaRes_ShowOneExaResult ,NULL}, + [ActChgVisExaRes ] = {1876,-1,TabUnk,ActSeeAllExa ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaSes_ToggleVisResultsSesUsr ,NULL}, [ActSeeGam ] = {1650,-1,TabUnk,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_SeeOneGame ,NULL}, @@ -765,10 +767,10 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = [ActSeeMyMchResMch ] = {1812,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowMyMchResultsInMch ,NULL}, [ActSeeOneMchResMe ] = {1797,-1,TabUnk,ActSeeAllGam ,0x208,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowOneMchResult ,NULL}, - [ActReqSeeAllMchRes ] = {1798,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_SelUsrsToViewMchResults ,NULL}, - [ActSeeAllMchResCrs ] = {1799,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowAllMchResultsInCrs ,NULL}, - [ActSeeAllMchResGam ] = {1811,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowAllMchResultsInGam ,NULL}, - [ActSeeAllMchResMch ] = {1813,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowAllMchResultsInMch ,NULL}, + [ActReqSeeUsrMchRes ] = {1798,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_SelUsrsToViewMchResults ,NULL}, + [ActSeeUsrMchResCrs ] = {1799,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowAllMchResultsInCrs ,NULL}, + [ActSeeUsrMchResGam ] = {1811,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowAllMchResultsInGam ,NULL}, + [ActSeeUsrMchResMch ] = {1813,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowAllMchResultsInMch ,NULL}, [ActSeeOneMchResOth ] = {1800,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,MchRes_ShowOneMchResult ,NULL}, [ActChgVisResMchUsr ] = {1801,-1,TabUnk,ActSeeAllGam ,0x230,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Mch_ToggleVisResultsMchUsr ,NULL}, @@ -2887,10 +2889,10 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un ActSeeDocCrs, // #1078 ActSeeMrkCrs, // #1079 ActReqSeeUsrTstRes, // #1080 - ActSeeUsrTstRes, // #1081 + ActSeeUsrTstResCrs, // #1081 ActSeeOneTstResOth, // #1082 ActReqSeeMyTstRes, // #1083 - ActSeeMyTstRes, // #1084 + ActSeeMyTstResCrs, // #1084 ActSeeOneTstResMe, // #1085 ActReqDatSeeMrkCrs, // #1086 ActReqDatSeeMrkGrp, // #1087 @@ -3604,8 +3606,8 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un -1, // #1795 ActSeeMyMchResCrs, // #1796 ActSeeOneMchResMe, // #1797 - ActReqSeeAllMchRes, // #1798 - ActSeeAllMchResCrs, // #1799 + ActReqSeeUsrMchRes, // #1798 + ActSeeUsrMchResCrs, // #1799 ActSeeOneMchResOth, // #1800 ActChgVisResMchUsr, // #1801 ActChgNumColMch, // #1802 @@ -3617,9 +3619,9 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un ActSeeMchAnsQstStd, // #1808 ActRemMchAnsQstStd, // #1809 ActSeeMyMchResGam, // #1810 - ActSeeAllMchResGam, // #1811 + ActSeeUsrMchResGam, // #1811 ActSeeMyMchResMch, // #1812 - ActSeeAllMchResMch, // #1813 + ActSeeUsrMchResMch, // #1813 ActMchCntDwn, // #1814 ActChgCtrLatCfg, // #1815 ActChgCtrLgtCfg, // #1816 @@ -3677,10 +3679,10 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un ActSeeMyExaResExa, // #1868 ActSeeMyExaResSes, // #1869 ActSeeOneExaResMe, // #1870 - ActReqSeeAllExaRes, // #1871 - ActSeeAllExaResCrs, // #1872 - ActSeeAllExaResExa, // #1873 - ActSeeAllExaResSes, // #1874 + ActReqSeeUsrExaRes, // #1871 + ActSeeUsrExaResCrs, // #1872 + ActSeeUsrExaResExa, // #1873 + ActSeeUsrExaResSes, // #1874 ActSeeOneExaResOth, // #1875 ActChgVisExaRes, // #1876 ActFrmNewExa, // #1877 diff --git a/swad_action.h b/swad_action.h index 8d700a98..aabfee0d 100644 --- a/swad_action.h +++ b/swad_action.h @@ -650,10 +650,10 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to #define ActRcvCfgTst (ActChgCrsTT1stDay + 126) #define ActReqSeeMyTstRes (ActChgCrsTT1stDay + 127) -#define ActSeeMyTstRes (ActChgCrsTT1stDay + 128) +#define ActSeeMyTstResCrs (ActChgCrsTT1stDay + 128) #define ActSeeOneTstResMe (ActChgCrsTT1stDay + 129) #define ActReqSeeUsrTstRes (ActChgCrsTT1stDay + 130) -#define ActSeeUsrTstRes (ActChgCrsTT1stDay + 131) +#define ActSeeUsrTstResCrs (ActChgCrsTT1stDay + 131) #define ActSeeOneTstResOth (ActChgCrsTT1stDay + 132) #define ActSeeExa (ActChgCrsTT1stDay + 133) @@ -697,10 +697,10 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to #define ActSeeMyExaResExa (ActChgCrsTT1stDay + 166) #define ActSeeMyExaResSes (ActChgCrsTT1stDay + 167) #define ActSeeOneExaResMe (ActChgCrsTT1stDay + 168) -#define ActReqSeeAllExaRes (ActChgCrsTT1stDay + 169) -#define ActSeeAllExaResCrs (ActChgCrsTT1stDay + 170) -#define ActSeeAllExaResExa (ActChgCrsTT1stDay + 171) -#define ActSeeAllExaResSes (ActChgCrsTT1stDay + 172) +#define ActReqSeeUsrExaRes (ActChgCrsTT1stDay + 169) +#define ActSeeUsrExaResCrs (ActChgCrsTT1stDay + 170) +#define ActSeeUsrExaResExa (ActChgCrsTT1stDay + 171) +#define ActSeeUsrExaResSes (ActChgCrsTT1stDay + 172) #define ActSeeOneExaResOth (ActChgCrsTT1stDay + 173) #define ActChgVisExaRes (ActChgCrsTT1stDay + 174) @@ -729,10 +729,10 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to #define ActSeeMyMchResMch (ActChgCrsTT1stDay + 195) #define ActSeeOneMchResMe (ActChgCrsTT1stDay + 196) -#define ActReqSeeAllMchRes (ActChgCrsTT1stDay + 197) -#define ActSeeAllMchResCrs (ActChgCrsTT1stDay + 198) -#define ActSeeAllMchResGam (ActChgCrsTT1stDay + 199) -#define ActSeeAllMchResMch (ActChgCrsTT1stDay + 200) +#define ActReqSeeUsrMchRes (ActChgCrsTT1stDay + 197) +#define ActSeeUsrMchResCrs (ActChgCrsTT1stDay + 198) +#define ActSeeUsrMchResGam (ActChgCrsTT1stDay + 199) +#define ActSeeUsrMchResMch (ActChgCrsTT1stDay + 200) #define ActSeeOneMchResOth (ActChgCrsTT1stDay + 201) #define ActChgVisResMchUsr (ActChgCrsTT1stDay + 202) diff --git a/swad_changelog.h b/swad_changelog.h index f1c36105..fea9da84 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -557,10 +557,16 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.237 (2020-05-18)" +#define Log_PLATFORM_VERSION "SWAD 19.238 (2020-05-18)" #define CSS_FILE "swad19.230.1.css" #define JS_FILE "swad19.236.4.js" /* + Version 19.238: May 18, 2020 Fix exam-related details. + Removal of exams. (301565 lines) + Copy the following 2 icons to icon public directory: +sudo cp icon/file-signature.svg /var/www/html/swad/icon/ +sudo cp icon/gamepad.svg /var/www/html/swad/icon/ + Version 19.237: May 18, 2020 Figures about exams. (301325 lines) Version 19.236.4: May 18, 2020 Fixed minor bug in dates. (301244 lines) Version 19.236.3: May 18, 2020 Number of players in a match now is calculated as number of users who have result, even in blank. (301243 lines) diff --git a/swad_course.c b/swad_course.c index e8c8fce6..d2b9105b 100644 --- a/swad_course.c +++ b/swad_course.c @@ -1982,16 +1982,16 @@ static void Crs_EmptyCourseCompletely (long CrsCod) /***** Remove all the threads and posts in forums of the course *****/ For_RemoveForums (Hie_CRS,CrsCod); - /***** Remove games of the course *****/ - Gam_RemoveGamesCrs (CrsCod); - - /***** Remove surveys of the course *****/ + /***** Remove all surveys in the course *****/ Svy_RemoveSurveys (Hie_CRS,CrsCod); - /***** Remove all test exams made in the course *****/ - TstPrn_RemoveCrsPrints (CrsCod); + /***** Remove all games in the course *****/ + Gam_RemoveCrsGames (CrsCod); - /***** Remove all tests questions in the course *****/ + /***** Remove all exams in the course *****/ + Exa_RemoveCrsExams (CrsCod); + + /***** Remove all tests in the course *****/ Tst_RemoveCrsTests (CrsCod); /***** Remove groups in the course *****/ diff --git a/swad_enrolment.c b/swad_enrolment.c index 9ed06eab..b6bc55d4 100644 --- a/swad_enrolment.c +++ b/swad_enrolment.c @@ -37,6 +37,7 @@ #include "swad_database.h" #include "swad_duplicate.h" #include "swad_enrolment.h" +#include "swad_exam_print.h" #include "swad_form.h" #include "swad_global.h" #include "swad_HTML.h" @@ -4117,8 +4118,10 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat, /* Remove works zone in course */ Brw_RemoveUsrWorksInCrs (UsrDat,Crs); - /* Remove user's matches in course */ - Mch_RemoveUsrFromMatchTablesInCrs (UsrDat->UsrCod,Crs->CrsCod); + /* Remove tests, exams and matches results made by user in course */ + TstPrn_RemovePrintsMadeByUsrInCrs (UsrDat->UsrCod,Crs->CrsCod); + ExaPrn_RemovePrintsMadeByUsrInCrs (UsrDat->UsrCod,Crs->CrsCod); + Mch_RemoveMatchesMadeByUsrInCrs (UsrDat->UsrCod,Crs->CrsCod); } /***** Remove fields of this user in its course record *****/ @@ -4127,9 +4130,6 @@ static void Enr_EffectivelyRemUsrFromCrs (struct UsrData *UsrDat, /***** Remove some information about files in course and groups *****/ Brw_RemoveSomeInfoAboutCrsUsrFilesFromDB (UsrDat->UsrCod,Crs->CrsCod); - /***** Remove test results made by user in course *****/ - TstPrn_RemovePrintsMadeByUsrInCrs (UsrDat->UsrCod,Crs->CrsCod); - /***** Set all the notifications for this user in this course as removed, except notifications about new messages *****/ Ntf_MarkNotifInCrsAsRemoved (UsrDat->UsrCod,Crs->CrsCod); diff --git a/swad_exam.c b/swad_exam.c index 0a5380ca..df01f410 100644 --- a/swad_exam.c +++ b/swad_exam.c @@ -36,6 +36,7 @@ #include "swad_database.h" #include "swad_exam.h" +#include "swad_exam_print.h" #include "swad_exam_result.h" #include "swad_exam_session.h" #include "swad_exam_set.h" @@ -133,6 +134,9 @@ static Exa_Order_t Exa_GetParamOrder (void); 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 void Exa_ReceiveExamFieldsFromForm (struct Exa_Exam *Exam, @@ -351,7 +355,7 @@ static void Exa_PutIconsListExams (void *Exams) case Rol_NET: case Rol_TCH: case Rol_SYS_ADM: - Ico_PutContextualIconToShowResults (ActReqSeeAllExaRes,NULL, + Ico_PutContextualIconToShowResults (ActReqSeeUsrExaRes,NULL, NULL,NULL); break; default: @@ -654,7 +658,7 @@ static void Exa_PutIconToShowResultsOfExam (void *Exams) case Rol_NET: case Rol_TCH: case Rol_SYS_ADM: - Ico_PutContextualIconToShowResults (ActSeeAllExaResExa,ExaRes_RESULTS_BOX_ID, + Ico_PutContextualIconToShowResults (ActSeeUsrExaResExa,ExaRes_RESULTS_BOX_ID, Exa_PutParams,Exams); break; default: @@ -1062,7 +1066,7 @@ void Exa_FreeListExams (struct Exa_Exams *Exams) } /*****************************************************************************/ -/********************** Get exam text from database ************************/ +/********************** Get exam text from database **************************/ /*****************************************************************************/ void Exa_GetExamTxtFromDB (long ExaCod,char Txt[Cns_MAX_BYTES_TEXT + 1]) @@ -1095,7 +1099,7 @@ void Exa_GetExamTxtFromDB (long ExaCod,char Txt[Cns_MAX_BYTES_TEXT + 1]) } /*****************************************************************************/ -/*************** Ask for confirmation of removing of an exam ******************/ +/*************** Ask for confirmation of removing of an exam *****************/ /*****************************************************************************/ void Exa_AskRemExam (void) @@ -1136,7 +1140,7 @@ void Exa_AskRemExam (void) } /*****************************************************************************/ -/******************************* Remove an exam *******************************/ +/******************************* Remove an exam ******************************/ /*****************************************************************************/ void Exa_RemoveExam (void) @@ -1205,12 +1209,29 @@ static void Exa_RemoveExamFromAllTables (long ExaCod) /******************** Remove all the exams of a course ***********************/ /*****************************************************************************/ -void Exa_RemoveExamsCrs (long CrsCod) +void Exa_RemoveCrsExams (long CrsCod) { - /***** Remove all sessions in this course *****/ + /***** Remove all exams prints made in the course *****/ + ExaPrn_RemoveCrsPrints (CrsCod); + + /***** Remove all sessions in the course *****/ ExaSes_RemoveSessionInCourseFromAllTables (CrsCod); - /***** Remove the questions in exams *****/ + /***** Remove media associated to test questions in the course *****/ + Exa_RemoveAllMedFilesFromStemOfAllQstsInCrs (CrsCod); + Exa_RemoveAllMedFilesFromAnsOfAllQstsInCrs (CrsCod); + + /***** Remove the answers in set of questions *****/ + DB_QueryDELETE ("can not remove answers in course exams", + "DELETE FROM exa_set_answers" + " USING exa_exams,exa_sets,exa_set_questions,exa_set_answers" + " WHERE exa_exams.CrsCod=%ld" + " AND exa_exams.ExaCod=exa_sets.ExaCod", + " AND exa_sets.SetCod=exa_set_questions.SetCod" + " AND exa_set_questions.QstCod=exa_set_answers.QstCod", + CrsCod); + + /***** Remove the questions in set of questions *****/ DB_QueryDELETE ("can not remove questions in course exams", "DELETE FROM exa_set_questions" " USING exa_exams,exa_sets,exa_set_questions" @@ -1219,7 +1240,7 @@ void Exa_RemoveExamsCrs (long CrsCod) " AND exa_sets.SetCod=exa_set_questions.SetCod", CrsCod); - /***** Remove the sets in exams *****/ + /***** Remove the sets of questions in exams *****/ DB_QueryDELETE ("can not remove sets in course exams", "DELETE FROM exa_sets" " USING exa_exams,exa_sets" @@ -1234,6 +1255,57 @@ void Exa_RemoveExamsCrs (long CrsCod) CrsCod); } +/*****************************************************************************/ +/** Remove all media associated to stems of all exam questions in a course ***/ +/*****************************************************************************/ + +static void Exa_RemoveAllMedFilesFromStemOfAllQstsInCrs (long CrsCod) + { + MYSQL_RES *mysql_res; + unsigned NumMedia; + + /***** Get media codes associated to stems of exam questions from database *****/ + NumMedia = + (unsigned) DB_QuerySELECT (&mysql_res,"can not get media", + "SELECT exa_set_questions.MedCod" // row[0] + " FROM exa_sets,exa_set_questions" + " WHERE exa_sets.CrsCod=%ld" + " AND exa_sets.SetCod=exa_set_questions.SetCod", + CrsCod); + + /***** Go over result removing media files *****/ + Med_RemoveMediaFromAllRows (NumMedia,mysql_res); + + /***** Free structure that stores the query result *****/ + DB_FreeMySQLResult (&mysql_res); + } + +/*****************************************************************************/ +/* Remove media associated to all answers of all exam questions in a course **/ +/*****************************************************************************/ + +static void Exa_RemoveAllMedFilesFromAnsOfAllQstsInCrs (long CrsCod) + { + MYSQL_RES *mysql_res; + unsigned NumMedia; + + /***** Get names of media files associated to answers of exam questions from database *****/ + NumMedia = + (unsigned) DB_QuerySELECT (&mysql_res,"can not get media", + "SELECT exa_set_answers.MedCod" // row[0] + " FROM exa_sets,exa_set_questions,exa_set_answers" + " WHERE exa_sets.CrsCod=%ld" + " AND exa_sets.SetCod=exa_set_questions.SetCod", + " AND exa_set_questions.QstCod=exa_set_answers.QstCod", + CrsCod); + + /***** Go over result removing media files *****/ + Med_RemoveMediaFromAllRows (NumMedia,mysql_res); + + /***** Free structure that stores the query result *****/ + DB_FreeMySQLResult (&mysql_res); + } + /*****************************************************************************/ /******************************** Hide an exam ******************************/ /*****************************************************************************/ diff --git a/swad_exam.h b/swad_exam.h index 59a89328..b19db3d1 100644 --- a/swad_exam.h +++ b/swad_exam.h @@ -72,7 +72,7 @@ void Exa_GetExamTxtFromDB (long ExaCod,char Txt[Cns_MAX_BYTES_TEXT + 1]); void Exa_AskRemExam (void); void Exa_RemoveExam (void); -void Exa_RemoveExamsCrs (long CrsCod); +void Exa_RemoveCrsExams (long CrsCod); void Exa_HideExam (void); void Exa_UnhideExam (void); diff --git a/swad_exam_print.c b/swad_exam_print.c index a43bd314..a6949040 100644 --- a/swad_exam_print.c +++ b/swad_exam_print.c @@ -1403,32 +1403,63 @@ static void ExaPrn_UpdatePrintInDB (const struct ExaPrn_Print *Print) } /*****************************************************************************/ -/********************** Receive answer to an exam print **********************/ +/********************** Remove exam prints made by a user ********************/ /*****************************************************************************/ -void ExaPrn_EndPrintAnswer (void) +void ExaPrn_RemovePrintsMadeByUsrInAllCrss (long UsrCod) { - Ale_ShowAlert (Ale_INFO,"Terminar de contestar el examen."); - - + /***** Remove exam prints questions for the given user *****/ + DB_QueryDELETE ("can not remove exam prints made by a user", + "DELETE FROM exa_print_questions" + " USING exa_prints,exa_print_questions" + " WHERE exa_prints.UsrCod=%ld" + " AND exa_prints.PrnCod=exa_print_questions.PrnCod", + UsrCod); + /***** Remove exam prints made by the given user *****/ + DB_QueryDELETE ("can not remove exam prints made by a user", + "DELETE FROM exa_prints" + " WHERE UsrCod=%ld", + UsrCod); } /*****************************************************************************/ -/***************** Write parameter with code of exam print *******************/ +/*************** Remove exam prints made by a user in a course ***************/ /*****************************************************************************/ -// static void ExaPrn_PutParamPrnCod (long ExaCod) -// { -// Par_PutHiddenParamLong (NULL,"PrnCod",ExaCod); -// } +void ExaPrn_RemovePrintsMadeByUsrInCrs (long UsrCod,long CrsCod) + { + /***** Remove questions of exams prints made by the given user in the given course *****/ + DB_QueryDELETE ("can not remove exams prints made by a user in a course", + "DELETE FROM exa_print_questions" + " USING exa_prints,exa_print_questions" + " WHERE exa_prints.CrsCod=%ld AND exa_prints.UsrCod=%ld" + " AND exa_prints.ExaCod=exa_print_questions.ExaCod", + CrsCod,UsrCod); + + /***** Remove exams prints made by the given user in the given course *****/ + DB_QueryDELETE ("can not remove exams prints made by a user in a course", + "DELETE FROM exa_prints" + " WHERE CrsCod=%ld AND UsrCod=%ld", + CrsCod,UsrCod); + } /*****************************************************************************/ -/***************** Get parameter with code of exam print *********************/ +/****************** Remove all exams prints made in a course *****************/ /*****************************************************************************/ -// static long ExaPrn_GetParamPrnCod (void) -// { -// /***** Get code of exam print *****/ -// return Par_GetParToLong ("PrnCod"); -// } +void ExaPrn_RemoveCrsPrints (long CrsCod) + { + /***** Remove questions of exams prints made in the course *****/ + DB_QueryDELETE ("can not remove exams prints made in a course", + "DELETE FROM exa_print_questions" + " USING exa_prints,exa_print_questions" + " WHERE exa_prints.CrsCod=%ld" + " AND exa_prints.ExaCod=exa_print_questions.ExaCod", + CrsCod); + + /***** Remove exam prints made in the course *****/ + DB_QueryDELETE ("can not remove exams prints made in a course", + "DELETE FROM exa_prints WHERE CrsCod=%ld", + CrsCod); + } diff --git a/swad_exam_print.h b/swad_exam_print.h index 65d97163..f6770b53 100644 --- a/swad_exam_print.h +++ b/swad_exam_print.h @@ -66,6 +66,8 @@ void ExaPrn_ReceivePrintAnswer (void); void ExaPrn_ComputeAnswerScore (struct TstPrn_PrintedQuestion *PrintedQuestion, struct Tst_Question *Question); -void ExaPrn_EndPrintAnswer (void); +void ExaPrn_RemovePrintsMadeByUsrInAllCrss (long UsrCod); +void ExaPrn_RemovePrintsMadeByUsrInCrs (long UsrCod,long CrsCod); +void ExaPrn_RemoveCrsPrints (long CrsCod); #endif diff --git a/swad_exam_result.c b/swad_exam_result.c index 4cba80bf..4d166590 100644 --- a/swad_exam_result.c +++ b/swad_exam_result.c @@ -81,7 +81,7 @@ static void ExaRes_ListMyResultsInCrs (struct Exa_Exams *Exams); static void ExaRes_ListMyResultsInExa (struct Exa_Exams *Exams,long ExaCod); static void ExaRes_ListMyResultsInSes (struct Exa_Exams *Exams,long SesCod); -static void ExaRes_PutFormToSelUsrsToViewResults (void *Exams); +static void ExaRes_PutFormToSelUsrsToViewResults (__attribute__((unused)) void *Args); static void ExaRes_ShowAllResultsInSelectedExams (void *Exams); static void ExaRes_ListAllResultsInSelectedExams (struct Exa_Exams *Exams); static void ExaRes_ListAllResultsInExa (struct Exa_Exams *Exams,long ExaCod); @@ -269,29 +269,23 @@ static void ExaRes_ListMyResultsInSes (struct Exa_Exams *Exams,long SesCod) void ExaRes_SelUsrsToViewResults (void) { - struct Exa_Exams Exams; - - /***** Reset exams context *****/ - Exa_ResetExams (&Exams); - /***** Put form to select users *****/ - ExaRes_PutFormToSelUsrsToViewResults (&Exams); + ExaRes_PutFormToSelUsrsToViewResults (NULL); } -static void ExaRes_PutFormToSelUsrsToViewResults (void *Exams) +static void ExaRes_PutFormToSelUsrsToViewResults (__attribute__((unused)) void *Args) { extern const char *Hlp_ASSESSMENT_Exams_results; extern const char *Txt_Results; - extern const char *Txt_View_matches_results; + extern const char *Txt_View_results; - if (Exams) // Not used - Usr_PutFormToSelectUsrsToGoToAct (&Gbl.Usrs.Selected, - ActSeeAllExaResCrs, - NULL,NULL, - Txt_Results, - Hlp_ASSESSMENT_Exams_results, - Txt_View_matches_results, - false); // Do not put form with date range + Usr_PutFormToSelectUsrsToGoToAct (&Gbl.Usrs.Selected, + ActSeeUsrExaResCrs, + NULL,NULL, + Txt_Results, + Hlp_ASSESSMENT_Exams_results, + Txt_View_results, + false); // Do not put form with date range } /*****************************************************************************/ @@ -308,7 +302,7 @@ void ExaRes_ShowAllResultsInCrs (void) /***** Get users and show their sessions results *****/ Usr_GetSelectedUsrsAndGoToAct (&Gbl.Usrs.Selected, ExaRes_ShowAllResultsInSelectedExams,&Exams, - ExaRes_PutFormToSelUsrsToViewResults,&Exams); + ExaRes_PutFormToSelUsrsToViewResults,NULL); } /*****************************************************************************/ @@ -593,7 +587,6 @@ static void ExaRes_ShowResultsEnd (void) static void ExaRes_ListExamsToSelect (struct Exa_Exams *Exams) { - extern const char *Hlp_ASSESSMENT_Exams_results; extern const char *The_ClassFormLinkInBoxBold[The_NUM_THEMES]; extern const char *Txt_Exams; extern const char *Txt_Exam; @@ -608,7 +601,7 @@ static void ExaRes_ListExamsToSelect (struct Exa_Exams *Exams) /***** Begin box *****/ Box_BoxBegin (NULL,Txt_Exams, NULL,NULL, - Hlp_ASSESSMENT_Exams_results,Box_CLOSABLE); + NULL,Box_CLOSABLE); /***** Begin form to update the results depending on the exams selected *****/ diff --git a/swad_exam_session.c b/swad_exam_session.c index 00b1de96..4300e5c1 100644 --- a/swad_exam_session.c +++ b/swad_exam_session.c @@ -107,7 +107,6 @@ static void ExaSes_GetSessionDataFromRow (MYSQL_RES *mysql_res, static void ExaSes_RemoveSessionFromAllTables (long SesCod); static void ExaSes_RemoveSessionFromTable (long SesCod,const char *TableName); static void ExaSes_RemoveSessionsInExamFromTable (long ExaCod,const char *TableName); -static void ExaSes_RemoveSessionInCourseFromTable (long CrsCod,const char *TableName); static void ExaSes_RemoveUsrSesResultsInCrs (long UsrCod,long CrsCod,const char *TableName); static void ExaSes_PutFormSession (const struct ExaSes_Session *Session); @@ -763,7 +762,7 @@ static void ExaSes_ListOneOrMoreSessionsResultTch (struct Exa_Exams *Exams, Exams->SesCod = Session->SesCod; /* Show exam session results */ - Lay_PutContextualLinkOnlyIcon (ActSeeAllExaResSes,ExaRes_RESULTS_BOX_ID, + Lay_PutContextualLinkOnlyIcon (ActSeeUsrExaResSes,ExaRes_RESULTS_BOX_ID, ExaSes_PutParamsEdit,Exams, "trophy.svg", Txt_Results); @@ -1012,10 +1011,16 @@ static void ExaSes_RemoveSessionsInExamFromTable (long ExaCod,const char *TableN void ExaSes_RemoveSessionInCourseFromAllTables (long CrsCod) { - /***** Remove sessions from secondary tables *****/ - ExaSes_RemoveSessionInCourseFromTable (CrsCod,"exa_groups"); + /***** Remove sessions from table of sessions groups *****/ + DB_QueryDELETE ("can not remove sessions of a course", + "DELETE FROM exa_groups" + " USING exa_exams,exa_sessions,exa_groups" + " WHERE exa_exams.CrsCod=%ld" + " AND exa_exams.ExaCod=exa_sessions.ExaCod" + " AND exa_sessions.SesCod=exa_groups.SesCod", + CrsCod); - /***** Remove sessions from main table *****/ + /***** Remove sessions from exam sessions table *****/ DB_QueryDELETE ("can not remove sessions of a course", "DELETE FROM exa_sessions" " USING exa_exams,exa_sessions" @@ -1024,21 +1029,6 @@ void ExaSes_RemoveSessionInCourseFromAllTables (long CrsCod) CrsCod); } -static void ExaSes_RemoveSessionInCourseFromTable (long CrsCod,const char *TableName) - { - /***** Remove sessions in course from secondary table *****/ - DB_QueryDELETE ("can not remove sessions of a course from table", - "DELETE FROM %s" - " USING exa_exams,exa_sessions,%s" - " WHERE exa_exams.CrsCod=%ld" - " AND exa_exams.ExaCod=exa_sessions.ExaCod" - " AND exa_sessions.SesCod=%s.SesCod", - TableName, - TableName, - CrsCod, - TableName); - } - /*****************************************************************************/ /************* Remove user from secondary exam session tables ****************/ /*****************************************************************************/ @@ -1204,9 +1194,9 @@ long ExaSes_GetParamSesCod (void) static void ExaSes_PutFormSession (const struct ExaSes_Session *Session) { extern const char *Hlp_ASSESSMENT_Exams_sessions; - extern const char *Txt_New_event; + extern const char *Txt_New_session; extern const char *Txt_Title; - extern const char *Txt_Create_event; + extern const char *Txt_Create_session; extern const char *Txt_Save_changes; static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] = { @@ -1226,7 +1216,7 @@ static void ExaSes_PutFormSession (const struct ExaSes_Session *Session) ExaSes_PutParamSesCod (Session->SesCod); /***** Begin box and table *****/ - Box_BoxTableBegin (NULL,ItsANewSession ? Txt_New_event : + Box_BoxTableBegin (NULL,ItsANewSession ? Txt_New_session : Session->Title, NULL,NULL, Hlp_ASSESSMENT_Exams_sessions,Box_NOT_CLOSABLE,2); @@ -1256,7 +1246,7 @@ static void ExaSes_PutFormSession (const struct ExaSes_Session *Session) /***** End table, send button and end box *****/ if (ItsANewSession) - Box_BoxTableWithButtonEnd (Btn_CREATE_BUTTON,Txt_Create_event); + Box_BoxTableWithButtonEnd (Btn_CREATE_BUTTON,Txt_Create_session); else Box_BoxTableWithButtonEnd (Btn_CONFIRM_BUTTON,Txt_Save_changes); @@ -1336,12 +1326,12 @@ static void ExaSes_ShowLstGrpsToCreateSession (long SesCod) void ExaSes_PutButtonNewSession (struct Exa_Exams *Exams,long ExaCod) { - extern const char *Txt_New_event; + extern const char *Txt_New_session; Exams->ExaCod = ExaCod; Frm_StartFormAnchor (ActReqNewExaSes,ExaSes_NEW_SESSION_SECTION_ID); Exa_PutParams (Exams); - Btn_PutConfirmButton (Txt_New_event); + Btn_PutConfirmButton (Txt_New_session); Frm_EndForm (); } diff --git a/swad_exam_set.c b/swad_exam_set.c index 4b36505b..821268af 100644 --- a/swad_exam_set.c +++ b/swad_exam_set.c @@ -131,6 +131,9 @@ static void ExaSet_FreeListsSelectedQuestions (struct Exa_Exams *Exams); static void ExaSet_CopyQstFromBankToExamSet (struct ExaSet_Set *Set,long QstCod); +static void ExaSet_RemoveMediaFromStemOfQst (long SetCod,long QstCod); +static void ExaSet_RemoveMediaFromAllAnsOfQst (long SetCod,long QstCod); + static void ExaSet_GetAndCheckParameters (struct Exa_Exams *Exams, struct Exa_Exam *Exam, struct ExaSet_Set *Set); @@ -1997,6 +2000,10 @@ void ExaSet_RemoveQstFromSet (void) /***** Get question index *****/ QstCod = ExaSet_GetParamQstCod (); + /***** Remove media associated to question *****/ + ExaSet_RemoveMediaFromStemOfQst (Set.SetCod,QstCod); + ExaSet_RemoveMediaFromAllAnsOfQst (Set.SetCod,QstCod); + /***** Remove the question from set *****/ /* Remove the question itself */ DB_QueryDELETE ("can not remove a question from a set", @@ -2015,6 +2022,55 @@ void ExaSet_RemoveQstFromSet (void) false); // It's not a new exam } +/*****************************************************************************/ +/************ Remove media associated to stem of a test question *************/ +/*****************************************************************************/ + +static void ExaSet_RemoveMediaFromStemOfQst (long SetCod,long QstCod) + { + MYSQL_RES *mysql_res; + unsigned NumMedia; + + /***** Get media code associated to stem of test question from database *****/ + NumMedia = + (unsigned) DB_QuerySELECT (&mysql_res,"can not get media", + "SELECT MedCod" // row[0] + " FROM exa_set_questions," + " WHERE QstCod=%ld" + " AND SetCod=%ld", // Extra check + QstCod,SetCod); + + /***** Go over result removing media *****/ + Med_RemoveMediaFromAllRows (NumMedia,mysql_res); + } + +/*****************************************************************************/ +/****** Remove all media associated to all answers of an exam question *******/ +/*****************************************************************************/ + +static void ExaSet_RemoveMediaFromAllAnsOfQst (long SetCod,long QstCod) + { + MYSQL_RES *mysql_res; + unsigned NumMedia; + + /***** Get media codes associated to answers of test question from database *****/ + NumMedia = + (unsigned) DB_QuerySELECT (&mysql_res,"can not get media", + "SELECT exa_set_answers.MedCod" // row[0] + " FROM exa_set_answers,exa_set_questions," + " WHERE exa_set_answers.QstCod=%ld" + " AND exa_set_answers.QstCod=exa_set_questions.QstCod" + " AND exa_set_questions.SetCod=%ld" // Extra check + " AND exa_set_questions.QstCod=%ld", // Extra check + QstCod,SetCod,QstCod); + + /***** Go over result removing media *****/ + Med_RemoveMediaFromAllRows (NumMedia,mysql_res); + + /***** Free structure that stores the query result *****/ + DB_FreeMySQLResult (&mysql_res); + } + /*****************************************************************************/ /************************** Get and check parameters *************************/ /*****************************************************************************/ diff --git a/swad_game.c b/swad_game.c index d26532be..b3aa4837 100644 --- a/swad_game.c +++ b/swad_game.c @@ -379,7 +379,7 @@ static void Gam_PutIconsListGames (void *Games) case Rol_NET: case Rol_TCH: case Rol_SYS_ADM: - Ico_PutContextualIconToShowResults (ActReqSeeAllMchRes,NULL, + Ico_PutContextualIconToShowResults (ActReqSeeUsrMchRes,NULL, NULL,NULL); break; default: @@ -682,7 +682,7 @@ static void Gam_PutIconToShowResultsOfGame (void *Games) case Rol_NET: case Rol_TCH: case Rol_SYS_ADM: - Ico_PutContextualIconToShowResults (ActSeeAllMchResGam,MchRes_RESULTS_BOX_ID, + Ico_PutContextualIconToShowResults (ActSeeUsrMchResGam,MchRes_RESULTS_BOX_ID, Gam_PutParams,Games); break; default: @@ -1222,10 +1222,10 @@ static void Gam_RemoveGameFromAllTables (long GamCod) /******************** Remove all the games of a course ***********************/ /*****************************************************************************/ -void Gam_RemoveGamesCrs (long CrsCod) +void Gam_RemoveCrsGames (long CrsCod) { /***** Remove all matches in this course *****/ - Mch_RemoveMatchInCourseFromAllTables (CrsCod); + Mch_RemoveMatchesInCourseFromAllTables (CrsCod); /***** Remove the questions in games *****/ DB_QueryDELETE ("can not remove questions in course games", diff --git a/swad_game.h b/swad_game.h index a46776ea..4f3c2916 100644 --- a/swad_game.h +++ b/swad_game.h @@ -126,7 +126,7 @@ void Gam_FreeListGames (struct Gam_Games *Games); void Gam_AskRemGame (void); void Gam_RemoveGame (void); -void Gam_RemoveGamesCrs (long CrsCod); +void Gam_RemoveCrsGames (long CrsCod); void Gam_HideGame (void); void Gam_UnhideGame (void); diff --git a/swad_help_URL.c b/swad_help_URL.c index 23abdaef..d5ca4cc1 100644 --- a/swad_help_URL.c +++ b/swad_help_URL.c @@ -1306,6 +1306,69 @@ const char *Hlp_ASSESSMENT_Projects_add_user = "ASSESSMENT.Projects.en#add-user"; #endif +const char *Hlp_ASSESSMENT_Questions_editing_questions = +#if L==1 + "ASSESSMENT.Questions.es#editar-preguntas"; +#elif L==2 + "ASSESSMENT.Questions.en#editing-questions"; +#elif L==3 + "ASSESSMENT.Questions.en#editing-questions"; +#elif L==4 + "ASSESSMENT.Questions.es#editar-preguntas"; +#elif L==5 + "ASSESSMENT.Questions.en#editing-questions"; +#elif L==6 + "ASSESSMENT.Questions.es#editar-preguntas"; +#elif L==7 + "ASSESSMENT.Questions.en#editing-questions"; +#elif L==8 + "ASSESSMENT.Questions.en#editing-questions"; +#elif L==9 + "ASSESSMENT.Questions.en#editing-questions"; +#endif + +const char *Hlp_ASSESSMENT_Questions_writing_a_question = +#if L==1 + "ASSESSMENT.Questions.es#escribir-una-pregunta"; +#elif L==2 + "ASSESSMENT.Questions.en#writing-a-question"; +#elif L==3 + "ASSESSMENT.Questions.en#writing-a-question"; +#elif L==4 + "ASSESSMENT.Questions.es#escribir-una-pregunta"; +#elif L==5 + "ASSESSMENT.Questions.en#writing-a-question"; +#elif L==6 + "ASSESSMENT.Questions.es#escribir-una-pregunta"; +#elif L==7 + "ASSESSMENT.Questions.en#writing-a-question"; +#elif L==8 + "ASSESSMENT.Questions.en#writing-a-question"; +#elif L==9 + "ASSESSMENT.Questions.en#writing-a-question"; +#endif + +const char *Hlp_ASSESSMENT_Questions_editing_tags = +#if L==1 + "ASSESSMENT.Questions.es#editar-descriptores"; +#elif L==2 + "ASSESSMENT.Questions.en#editing-tags"; +#elif L==3 + "ASSESSMENT.Questions.en#editing-tags"; +#elif L==4 + "ASSESSMENT.Questions.es#editar-descriptores"; +#elif L==5 + "ASSESSMENT.Questions.en#editing-tags"; +#elif L==6 + "ASSESSMENT.Questions.es#editar-descriptores"; +#elif L==7 + "ASSESSMENT.Questions.en#editing-tags"; +#elif L==8 + "ASSESSMENT.Questions.en#editing-tags"; +#elif L==9 + "ASSESSMENT.Questions.en#editing-tags"; +#endif + const char *Hlp_ASSESSMENT_Tests = #if L==1 "ASSESSMENT.Tests.es"; @@ -1327,48 +1390,6 @@ const char *Hlp_ASSESSMENT_Tests = "ASSESSMENT.Tests.en"; #endif -const char *Hlp_ASSESSMENT_Tests_editing_questions = -#if L==1 - "ASSESSMENT.Tests.es#editar-preguntas"; -#elif L==2 - "ASSESSMENT.Tests.en#editing-questions"; -#elif L==3 - "ASSESSMENT.Tests.en#editing-questions"; -#elif L==4 - "ASSESSMENT.Tests.es#editar-preguntas"; -#elif L==5 - "ASSESSMENT.Tests.en#editing-questions"; -#elif L==6 - "ASSESSMENT.Tests.es#editar-preguntas"; -#elif L==7 - "ASSESSMENT.Tests.en#editing-questions"; -#elif L==8 - "ASSESSMENT.Tests.en#editing-questions"; -#elif L==9 - "ASSESSMENT.Tests.en#editing-questions"; -#endif - -const char *Hlp_ASSESSMENT_Tests_writing_a_question = -#if L==1 - "ASSESSMENT.Tests.es#escribir-una-pregunta"; -#elif L==2 - "ASSESSMENT.Tests.en#writing-a-question"; -#elif L==3 - "ASSESSMENT.Tests.en#writing-a-question"; -#elif L==4 - "ASSESSMENT.Tests.es#escribir-una-pregunta"; -#elif L==5 - "ASSESSMENT.Tests.en#writing-a-question"; -#elif L==6 - "ASSESSMENT.Tests.es#escribir-una-pregunta"; -#elif L==7 - "ASSESSMENT.Tests.en#writing-a-question"; -#elif L==8 - "ASSESSMENT.Tests.en#writing-a-question"; -#elif L==9 - "ASSESSMENT.Tests.en#writing-a-question"; -#endif - const char *Hlp_ASSESSMENT_Tests_configuring_tests = #if L==1 "ASSESSMENT.Tests.es#configurar-test"; @@ -1476,23 +1497,23 @@ const char *Hlp_ASSESSMENT_Exams_question_sets = const char *Hlp_ASSESSMENT_Exams_sessions = #if L==1 - "ASSESSMENT.Exams.es#eventos"; + "ASSESSMENT.Exams.es#sesiones"; #elif L==2 - "ASSESSMENT.Exams.en#events"; + "ASSESSMENT.Exams.en#sessions"; #elif L==3 - "ASSESSMENT.Exams.en#events"; + "ASSESSMENT.Exams.en#sessions"; #elif L==4 - "ASSESSMENT.Exams.es#eventos"; + "ASSESSMENT.Exams.es#sesiones"; #elif L==5 - "ASSESSMENT.Exams.en#events"; + "ASSESSMENT.Exams.en#sessions"; #elif L==6 - "ASSESSMENT.Exams.es#eventos"; + "ASSESSMENT.Exams.es#sesiones"; #elif L==7 - "ASSESSMENT.Exams.en#events"; + "ASSESSMENT.Exams.en#sessions"; #elif L==8 - "ASSESSMENT.Exams.en#events"; + "ASSESSMENT.Exams.en#sessions"; #elif L==9 - "ASSESSMENT.Exams.en#events"; + "ASSESSMENT.Exams.en#sessions"; #endif const char *Hlp_ASSESSMENT_Exams_new_exam = diff --git a/swad_match.c b/swad_match.c index c8f6cc83..b4de61c3 100644 --- a/swad_match.c +++ b/swad_match.c @@ -135,8 +135,9 @@ static Mch_Showing_t Mch_GetShowingFromStr (const char *Str); static void Mch_RemoveMatchFromAllTables (long MchCod); static void Mch_RemoveMatchFromTable (long MchCod,const char *TableName); static void Mch_RemoveMatchesInGameFromTable (long GamCod,const char *TableName); -static void Mch_RemoveMatchInCourseFromTable (long CrsCod,const char *TableName); -static void Mch_RemoveUsrMchResultsInCrs (long UsrCod,long CrsCod,const char *TableName); +static void Mch_RemoveMatchesInCourseFromTable (long CrsCod,const char *TableName); +static void Mch_RemoveMatchesMadeByUsrFromTable (long UsrCod,const char *TableName); +static void Mch_RemoveMatchesMadeByUsrInCrsFromTable (long UsrCod,long CrsCod,const char *TableName); static void Mch_PutParamsPlay (void *MchCod); static void Mch_PutParamMchCod (long MchCod); @@ -860,7 +861,7 @@ static void Mch_ListOneOrMoreMatchesResultTch (struct Gam_Games *Games, Games->MchCod = Match->MchCod; /* Show match results */ - Lay_PutContextualLinkOnlyIcon (ActSeeAllMchResMch,MchRes_RESULTS_BOX_ID, + Lay_PutContextualLinkOnlyIcon (ActSeeUsrMchResMch,MchRes_RESULTS_BOX_ID, Mch_PutParamsEdit,Games, "trophy.svg", Txt_Results); @@ -1171,16 +1172,16 @@ static void Mch_RemoveMatchesInGameFromTable (long GamCod,const char *TableName) /******************* Remove match in course from all tables ******************/ /*****************************************************************************/ -void Mch_RemoveMatchInCourseFromAllTables (long CrsCod) +void Mch_RemoveMatchesInCourseFromAllTables (long CrsCod) { /***** Remove matches from secondary tables *****/ - Mch_RemoveMatchInCourseFromTable (CrsCod,"mch_players"); - Mch_RemoveMatchInCourseFromTable (CrsCod,"mch_playing"); - Mch_RemoveMatchInCourseFromTable (CrsCod,"mch_results"); - Mch_RemoveMatchInCourseFromTable (CrsCod,"mch_answers"); - Mch_RemoveMatchInCourseFromTable (CrsCod,"mch_times"); - Mch_RemoveMatchInCourseFromTable (CrsCod,"mch_groups"); - Mch_RemoveMatchInCourseFromTable (CrsCod,"mch_indexes"); + Mch_RemoveMatchesInCourseFromTable (CrsCod,"mch_players"); + Mch_RemoveMatchesInCourseFromTable (CrsCod,"mch_playing"); + Mch_RemoveMatchesInCourseFromTable (CrsCod,"mch_results"); + Mch_RemoveMatchesInCourseFromTable (CrsCod,"mch_answers"); + Mch_RemoveMatchesInCourseFromTable (CrsCod,"mch_times"); + Mch_RemoveMatchesInCourseFromTable (CrsCod,"mch_groups"); + Mch_RemoveMatchesInCourseFromTable (CrsCod,"mch_indexes"); /***** Remove matches from main table *****/ DB_QueryDELETE ("can not remove matches of a course", @@ -1191,7 +1192,7 @@ void Mch_RemoveMatchInCourseFromAllTables (long CrsCod) CrsCod); } -static void Mch_RemoveMatchInCourseFromTable (long CrsCod,const char *TableName) +static void Mch_RemoveMatchesInCourseFromTable (long CrsCod,const char *TableName) { /***** Remove matches in course from secondary table *****/ DB_QueryDELETE ("can not remove matches of a course from table", @@ -1207,18 +1208,40 @@ static void Mch_RemoveMatchInCourseFromTable (long CrsCod,const char *TableName) } /*****************************************************************************/ -/***************** Remove user from secondary match tables *******************/ +/*************** Remove matches made by user in all courses ******************/ /*****************************************************************************/ -void Mch_RemoveUsrFromMatchTablesInCrs (long UsrCod,long CrsCod) +void Mch_RemoveMatchesMadeByUsrInAllCrss (long UsrCod) { /***** Remove student from secondary tables *****/ - Mch_RemoveUsrMchResultsInCrs (UsrCod,CrsCod,"mch_players"); - Mch_RemoveUsrMchResultsInCrs (UsrCod,CrsCod,"mch_results"); - Mch_RemoveUsrMchResultsInCrs (UsrCod,CrsCod,"mch_answers"); + Mch_RemoveMatchesMadeByUsrFromTable (UsrCod,"mch_players"); + Mch_RemoveMatchesMadeByUsrFromTable (UsrCod,"mch_results"); + Mch_RemoveMatchesMadeByUsrFromTable (UsrCod,"mch_answers"); } -static void Mch_RemoveUsrMchResultsInCrs (long UsrCod,long CrsCod,const char *TableName) +static void Mch_RemoveMatchesMadeByUsrFromTable (long UsrCod,const char *TableName) + { + /***** Remove matches in course from secondary table *****/ + DB_QueryDELETE ("can not remove matches of a user from table", + "DELETE FROM %s" + " WHERE UsrCod=%ld", + TableName, + UsrCod); + } + +/*****************************************************************************/ +/***************** Remove matches made by user in a course *******************/ +/*****************************************************************************/ + +void Mch_RemoveMatchesMadeByUsrInCrs (long UsrCod,long CrsCod) + { + /***** Remove student from secondary tables *****/ + Mch_RemoveMatchesMadeByUsrInCrsFromTable (UsrCod,CrsCod,"mch_players"); + Mch_RemoveMatchesMadeByUsrInCrsFromTable (UsrCod,CrsCod,"mch_results"); + Mch_RemoveMatchesMadeByUsrInCrsFromTable (UsrCod,CrsCod,"mch_answers"); + } + +static void Mch_RemoveMatchesMadeByUsrInCrsFromTable (long UsrCod,long CrsCod,const char *TableName) { /***** Remove matches in course from secondary table *****/ DB_QueryDELETE ("can not remove matches of a user from table", diff --git a/swad_match.h b/swad_match.h index 531cebf1..686c71f4 100644 --- a/swad_match.h +++ b/swad_match.h @@ -98,8 +98,9 @@ void Mch_RequestRemoveMatch (void); void Mch_RemoveMatch (void); void Mch_RemoveMatchesInGameFromAllTables (long GamCod); -void Mch_RemoveMatchInCourseFromAllTables (long CrsCod); -void Mch_RemoveUsrFromMatchTablesInCrs (long UsrCod,long CrsCod); +void Mch_RemoveMatchesInCourseFromAllTables (long CrsCod); +void Mch_RemoveMatchesMadeByUsrInAllCrss (long UsrCod); +void Mch_RemoveMatchesMadeByUsrInCrs (long UsrCod,long CrsCod); void Mch_PutParamsEdit (void *Games); void Mch_GetAndCheckParameters (struct Gam_Games *Games, diff --git a/swad_match_result.c b/swad_match_result.c index 9eeb9754..95f4fe42 100644 --- a/swad_match_result.c +++ b/swad_match_result.c @@ -398,15 +398,15 @@ static void MchRes_PutFormToSelUsrsToViewMchResults (void *Games) { extern const char *Hlp_ASSESSMENT_Games_results; extern const char *Txt_Results; - extern const char *Txt_View_matches_results; + extern const char *Txt_View_results; if (Games) // Not used Usr_PutFormToSelectUsrsToGoToAct (&Gbl.Usrs.Selected, - ActSeeAllMchResCrs, + ActSeeUsrMchResCrs, NULL,NULL, Txt_Results, Hlp_ASSESSMENT_Games_results, - Txt_View_matches_results, + Txt_View_results, false); // Do not put form with date range } @@ -634,7 +634,6 @@ static void MchRes_ShowResultsEnd (void) static void MchRes_ListGamesToSelect (struct Gam_Games *Games) { - extern const char *Hlp_ASSESSMENT_Games_results; extern const char *The_ClassFormLinkInBoxBold[The_NUM_THEMES]; extern const char *Txt_Games; extern const char *Txt_Game; @@ -649,7 +648,7 @@ static void MchRes_ListGamesToSelect (struct Gam_Games *Games) /***** Begin box *****/ Box_BoxBegin (NULL,Txt_Games, NULL,NULL, - Hlp_ASSESSMENT_Games_results,Box_CLOSABLE); + NULL,Box_CLOSABLE); /***** Begin form to update the results depending on the games selected *****/ @@ -1472,4 +1471,3 @@ static bool MchRes_CheckIfICanViewScore (bool ICanViewResult,unsigned Visibility return false; } } - diff --git a/swad_record.c b/swad_record.c index edd863ed..6eeaf2c4 100644 --- a/swad_record.c +++ b/swad_record.c @@ -2428,7 +2428,9 @@ static void Rec_PutIconsCommands (__attribute__((unused)) void *Args) extern const char *Txt_Administer_user; extern const char *Txt_Write_a_message; extern const char *Txt_View_homework; - extern const char *Txt_View_test_results; + extern const char *Txt_View_tests; + extern const char *Txt_View_exams; + extern const char *Txt_View_games; extern const char *Txt_View_attendance; extern const char *Txt_Following_unfollow; extern const char *Txt_Follow; @@ -2519,19 +2521,45 @@ static void Rec_PutIconsCommands (__attribute__((unused)) void *Args) { if (Gbl.Record.UsrDat->Roles.InCurrentCrs.Role == Rol_STD) // He/she is a student in current course { - /***** Button to view student's test exams *****/ + /***** Buttons to view student's test, exam and match results *****/ if (Usr_CheckIfICanViewTstExaMchResult (Gbl.Record.UsrDat)) { if (ItsMe) - Lay_PutContextualLinkOnlyIcon (ActSeeMyTstRes,NULL, + { + /* My test results in course */ + Lay_PutContextualLinkOnlyIcon (ActSeeMyTstResCrs,NULL, Rec_PutParamsMyTsts,NULL, "check.svg", - Txt_View_test_results); + Txt_View_tests); + /* My exam results in course */ + Lay_PutContextualLinkOnlyIcon (ActSeeMyExaResCrs,NULL, + Rec_PutParamsMyTsts,NULL, + "file-signature.svg", + Txt_View_exams); + /* My match results in course */ + Lay_PutContextualLinkOnlyIcon (ActSeeMyMchResCrs,NULL, + Rec_PutParamsMyTsts,NULL, + "gamepad.svg", + Txt_View_games); + } else // Not me - Lay_PutContextualLinkOnlyIcon (ActSeeUsrTstRes,NULL, + { + /* User's test results in course */ + Lay_PutContextualLinkOnlyIcon (ActSeeUsrTstResCrs,NULL, Rec_PutParamsStdTsts,NULL, "check.svg", - Txt_View_test_results); + Txt_View_tests); + /* User's exam results in course */ + Lay_PutContextualLinkOnlyIcon (ActSeeUsrExaResCrs,NULL, + Rec_PutParamsStdTsts,NULL, + "file-signature.svg", + Txt_View_exams); + /* User's match results in course */ + Lay_PutContextualLinkOnlyIcon (ActSeeUsrMchResCrs,NULL, + Rec_PutParamsStdTsts,NULL, + "gamepad.svg", + Txt_View_games); + } } /***** Button to view student's assignments and works *****/ diff --git a/swad_survey.c b/swad_survey.c index 189dbfc9..4f980dc0 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -460,7 +460,7 @@ static void Svy_ShowOneSurvey (struct Svy_Surveys *Surveys, extern const char *Txt_Course; extern const char *Txt_Users; extern const char *Txt_Answer_survey; - extern const char *Txt_View_survey_results; + extern const char *Txt_View_results; char *Anchor = NULL; static unsigned UniqueId = 0; char *Id; @@ -616,7 +616,7 @@ static void Svy_ShowOneSurvey (struct Svy_Surveys *Surveys, WhichGroups = Grp_GetParamWhichGroups (); Grp_PutParamWhichGroups (&WhichGroups); Pag_PutHiddenParamPagNum (Pag_SURVEYS,Surveys->CurrentPage); - Btn_PutConfirmButtonInline (Txt_View_survey_results); + Btn_PutConfirmButtonInline (Txt_View_results); Frm_EndForm (); HTM_DIV_End (); diff --git a/swad_tag.c b/swad_tag.c index 0293fe5d..07c6cda9 100644 --- a/swad_tag.c +++ b/swad_tag.c @@ -542,7 +542,7 @@ void Tag_ShowFormSelTags (const struct Tag_Tags *Tags, void Tag_ShowFormEditTags (void) { - extern const char *Hlp_ASSESSMENT_Tests_configuring_tests; + extern const char *Hlp_ASSESSMENT_Questions_editing_tags; extern const char *Txt_No_test_questions; extern const char *Txt_Tags; MYSQL_RES *mysql_res; @@ -557,7 +557,7 @@ void Tag_ShowFormEditTags (void) /***** Begin box and table *****/ Box_BoxTableBegin (NULL,Txt_Tags, NULL,NULL, - Hlp_ASSESSMENT_Tests_configuring_tests,Box_NOT_CLOSABLE,2); + Hlp_ASSESSMENT_Questions_editing_tags,Box_NOT_CLOSABLE,2); /***** Show tags *****/ for (NumTag = 0; diff --git a/swad_test.c b/swad_test.c index 53e117ab..3aa1e719 100644 --- a/swad_test.c +++ b/swad_test.c @@ -242,8 +242,10 @@ static void Tst_InsertAnswersIntoDB (struct Tst_Question *Question); static void Tst_RemAnsFromQst (long QstCod); -static void Tst_RemoveAllMedFilesFromStemOfAllQstsInCrs (long CrsCod); +static void Tst_RemoveMediaFromStemOfQst (long CrsCod,long QstCod); static void Tst_RemoveMediaFromAllAnsOfQst (long CrsCod,long QstCod); + +static void Tst_RemoveAllMedFilesFromStemOfAllQstsInCrs (long CrsCod); static void Tst_RemoveAllMedFilesFromAnsOfAllQstsInCrs (long CrsCod); static unsigned Tst_GetNumTstQuestions (Hie_Level_t Scope,Tst_AnswerType_t AnsType,struct Tst_Stats *Stats); @@ -1160,7 +1162,7 @@ void Tst_RequestEditTests (void) static void Tst_ShowFormRequestEditTests (struct Tst_Test *Test) { - extern const char *Hlp_ASSESSMENT_Tests_editing_questions; + extern const char *Hlp_ASSESSMENT_Questions_editing_questions; extern const char *Txt_No_test_questions; extern const char *Txt_Question_bank; extern const char *Txt_Show_questions; @@ -1174,7 +1176,7 @@ static void Tst_ShowFormRequestEditTests (struct Tst_Test *Test) /***** Begin box *****/ Box_BoxBegin (NULL,Txt_Question_bank, Tst_PutIconsRequestBankQsts,NULL, - Hlp_ASSESSMENT_Tests_editing_questions,Box_NOT_CLOSABLE); + Hlp_ASSESSMENT_Questions_editing_questions,Box_NOT_CLOSABLE); /***** Get tags already present in the table of questions *****/ if ((Test->Tags.Num = Tag_GetAllTagsFromCurrentCrs (&mysql_res))) @@ -3628,7 +3630,7 @@ void Tst_ShowFormEditOneQst (void) static void Tst_PutFormEditOneQst (struct Tst_Question *Question) { - extern const char *Hlp_ASSESSMENT_Tests_writing_a_question; + extern const char *Hlp_ASSESSMENT_Questions_writing_a_question; extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Question_code_X; extern const char *Txt_New_question; @@ -3670,13 +3672,13 @@ static void Tst_PutFormEditOneQst (struct Tst_Question *Question) { Box_BoxBegin (NULL,Str_BuildStringLong (Txt_Question_code_X,Question->QstCod), Tst_PutIconToRemoveOneQst,&Question->QstCod, - Hlp_ASSESSMENT_Tests_writing_a_question,Box_NOT_CLOSABLE); + Hlp_ASSESSMENT_Questions_writing_a_question,Box_NOT_CLOSABLE); Str_FreeString (); } else Box_BoxBegin (NULL,Txt_New_question, NULL,NULL, - Hlp_ASSESSMENT_Tests_writing_a_question,Box_NOT_CLOSABLE); + Hlp_ASSESSMENT_Questions_writing_a_question,Box_NOT_CLOSABLE); /***** Begin form *****/ Frm_StartForm (ActRcvTstQst); @@ -5339,17 +5341,10 @@ void Tst_RemoveOneQst (void) static void Tst_RemoveOneQstFromDB (long CrsCod,long QstCod) { - long MedCod; - /***** Remove media associated to question *****/ - /* Remove media associated to answers */ + Tst_RemoveMediaFromStemOfQst (CrsCod,QstCod); Tst_RemoveMediaFromAllAnsOfQst (CrsCod,QstCod); - /* Remove media associated to stem */ - MedCod = Tst_GetMedCodFromDB (CrsCod,QstCod, - -1L); // Get current media code associated to stem - Med_RemoveMedia (MedCod); - /***** Remove the question from all the tables *****/ /* Remove answers and tags from this test question */ Tst_RemAnsFromQst (QstCod); @@ -5633,6 +5628,9 @@ void Tst_UpdateQstScoreInDB (struct TstPrn_PrintedQuestion *PrintedQuestion) void Tst_RemoveCrsTests (long CrsCod) { + /***** Remove all test exam prints made in the course *****/ + TstPrn_RemoveCrsPrints (CrsCod); + /***** Remove test configuration of the course *****/ DB_QueryDELETE ("can not remove configuration of tests of a course", "DELETE FROM tst_config WHERE CrsCod=%ld", @@ -5653,17 +5651,18 @@ void Tst_RemoveCrsTests (long CrsCod) "DELETE FROM tst_tags WHERE CrsCod=%ld", CrsCod); + /***** Remove media associated to test questions in the course *****/ + Tst_RemoveAllMedFilesFromStemOfAllQstsInCrs (CrsCod); + Tst_RemoveAllMedFilesFromAnsOfAllQstsInCrs (CrsCod); + /***** Remove test answers in the course *****/ DB_QueryDELETE ("can not remove answers of tests of a course", - "DELETE FROM tst_answers USING tst_questions,tst_answers" + "DELETE FROM tst_answers" + " USING tst_questions,tst_answers" " WHERE tst_questions.CrsCod=%ld" " AND tst_questions.QstCod=tst_answers.QstCod", CrsCod); - /***** Remove media associated to test questions in the course *****/ - Tst_RemoveAllMedFilesFromAnsOfAllQstsInCrs (CrsCod); - Tst_RemoveAllMedFilesFromStemOfAllQstsInCrs (CrsCod); - /***** Remove test questions in the course *****/ DB_QueryDELETE ("can not remove test questions of a course", "DELETE FROM tst_questions WHERE CrsCod=%ld", @@ -5683,23 +5682,24 @@ static void Tst_RemAnsFromQst (long QstCod) } /*****************************************************************************/ -/** Remove all media associated to stems of all test questions in a course ***/ +/************ Remove media associated to stem of a test question *************/ /*****************************************************************************/ -static void Tst_RemoveAllMedFilesFromStemOfAllQstsInCrs (long CrsCod) +static void Tst_RemoveMediaFromStemOfQst (long CrsCod,long QstCod) { MYSQL_RES *mysql_res; unsigned NumMedia; - /***** Get media codes associated to stems of test questions from database *****/ + /***** Get media code associated to stem of test question from database *****/ NumMedia = (unsigned) DB_QuerySELECT (&mysql_res,"can not get media", "SELECT MedCod" // row[0] " FROM tst_questions" - " WHERE CrsCod=%ld", - CrsCod); + " WHERE QstCod=%ld" + " AND CrsCod=%ld", // Extra check + QstCod,CrsCod); - /***** Go over result removing media files *****/ + /***** Go over result removing media *****/ Med_RemoveMediaFromAllRows (NumMedia,mysql_res); /***** Free structure that stores the query result *****/ @@ -5719,12 +5719,12 @@ static void Tst_RemoveMediaFromAllAnsOfQst (long CrsCod,long QstCod) NumMedia = (unsigned) DB_QuerySELECT (&mysql_res,"can not get media", "SELECT tst_answers.MedCod" // row[0] - " FROM tst_questions,tst_answers" - " WHERE tst_questions.CrsCod=%ld" // Extra check - " AND tst_questions.QstCod=%ld" // Extra check - " AND tst_questions.QstCod=tst_answers.QstCod" - " AND tst_answers.QstCod=%ld", - CrsCod,QstCod,QstCod); + " FROM tst_answers,tst_questions" + " WHERE tst_answers.QstCod=%ld", + " AND tst_answers.QstCod=tst_questions.QstCod" + " AND tst_questions.CrsCod=%ld" // Extra check + " AND tst_questions.QstCod=%ld", // Extra check + QstCod,CrsCod,QstCod); /***** Go over result removing media *****/ Med_RemoveMediaFromAllRows (NumMedia,mysql_res); @@ -5733,6 +5733,30 @@ static void Tst_RemoveMediaFromAllAnsOfQst (long CrsCod,long QstCod) DB_FreeMySQLResult (&mysql_res); } +/*****************************************************************************/ +/** Remove all media associated to stems of all test questions in a course ***/ +/*****************************************************************************/ + +static void Tst_RemoveAllMedFilesFromStemOfAllQstsInCrs (long CrsCod) + { + MYSQL_RES *mysql_res; + unsigned NumMedia; + + /***** Get media codes associated to stems of test questions from database *****/ + NumMedia = + (unsigned) DB_QuerySELECT (&mysql_res,"can not get media", + "SELECT MedCod" // row[0] + " FROM tst_questions" + " WHERE CrsCod=%ld", + CrsCod); + + /***** Go over result removing media files *****/ + Med_RemoveMediaFromAllRows (NumMedia,mysql_res); + + /***** Free structure that stores the query result *****/ + DB_FreeMySQLResult (&mysql_res); + } + /*****************************************************************************/ /* Remove media associated to all answers of all test questions in a course **/ /*****************************************************************************/ diff --git a/swad_test_print.c b/swad_test_print.c index a9fa9d8b..9cdb8eb4 100644 --- a/swad_test_print.c +++ b/swad_test_print.c @@ -1394,14 +1394,14 @@ static void TstPrn_PutFormToSelectUsrsToViewUsrsPrints (__attribute__((unused)) { extern const char *Hlp_ASSESSMENT_Tests_results; extern const char *Txt_Results; - extern const char *Txt_View_test_results; + extern const char *Txt_View_results; Usr_PutFormToSelectUsrsToGoToAct (&Gbl.Usrs.Selected, - ActSeeUsrTstRes, + ActSeeUsrTstResCrs, NULL,NULL, Txt_Results, Hlp_ASSESSMENT_Tests_results, - Txt_View_test_results, + Txt_View_results, true); // Put form with date range } @@ -1413,7 +1413,7 @@ void TstPrn_SelDatesToSeeMyPrints (void) { extern const char *Hlp_ASSESSMENT_Tests_results; extern const char *Txt_Results; - extern const char *Txt_View_test_results; + extern const char *Txt_View_results; static const Dat_SetHMS SetHMS[Dat_NUM_START_END_TIME] = { [Dat_START_TIME] = Dat_HMS_DO_NOT_SET, @@ -1421,7 +1421,7 @@ void TstPrn_SelDatesToSeeMyPrints (void) }; /***** Begin form *****/ - Frm_StartForm (ActSeeMyTstRes); + Frm_StartForm (ActSeeMyTstResCrs); /***** Begin box and table *****/ Box_BoxTableBegin (NULL,Txt_Results, @@ -1430,7 +1430,7 @@ void TstPrn_SelDatesToSeeMyPrints (void) Dat_PutFormStartEndClientLocalDateTimesWithYesterdayToday (SetHMS); /***** End table, send button and end box *****/ - Box_BoxTableWithButtonEnd (Btn_CONFIRM_BUTTON,Txt_View_test_results); + Box_BoxTableWithButtonEnd (Btn_CONFIRM_BUTTON,Txt_View_results); /***** End form *****/ Frm_EndForm (); @@ -1734,7 +1734,7 @@ static void TstPrn_ShowUsrPrints (struct UsrData *UsrDat) HTM_TD_Begin ("class=\"RT COLOR%u\"",Gbl.RowEvenOdd); if (ICanView.Exam) { - Frm_StartForm (Gbl.Action.Act == ActSeeMyTstRes ? ActSeeOneTstResMe : + Frm_StartForm (Gbl.Action.Act == ActSeeMyTstResCrs ? ActSeeOneTstResMe : ActSeeOneTstResOth); TstPrn_PutParamPrnCod (Print.PrnCod); Ico_PutIconLink ("tasks.svg",Txt_View_test); @@ -2287,12 +2287,12 @@ void TstPrn_GetPrintQuestionsFromDB (struct TstPrn_Print *Print) } /*****************************************************************************/ -/********************** Remove test exams made by a user *********************/ +/******************* Remove test exam prints made by a user ******************/ /*****************************************************************************/ void TstPrn_RemovePrintsMadeByUsrInAllCrss (long UsrCod) { - /***** Remove test exams made by the specified user *****/ + /***** Remove test prints questions for the given user *****/ DB_QueryDELETE ("can not remove test exams made by a user", "DELETE FROM tst_exam_questions" " USING tst_exams,tst_exam_questions" @@ -2300,6 +2300,7 @@ void TstPrn_RemovePrintsMadeByUsrInAllCrss (long UsrCod) " AND tst_exams.ExaCod=tst_exam_questions.ExaCod", UsrCod); + /***** Remove test prints made by the given user *****/ DB_QueryDELETE ("can not remove test exams made by a user", "DELETE FROM tst_exams" " WHERE UsrCod=%ld", @@ -2307,7 +2308,7 @@ void TstPrn_RemovePrintsMadeByUsrInAllCrss (long UsrCod) } /*****************************************************************************/ -/*************** Remove test exams made by a user in a course ****************/ +/************ Remove test exam prints made by a user in a course *************/ /*****************************************************************************/ void TstPrn_RemovePrintsMadeByUsrInCrs (long UsrCod,long CrsCod) @@ -2327,7 +2328,7 @@ void TstPrn_RemovePrintsMadeByUsrInCrs (long UsrCod,long CrsCod) } /*****************************************************************************/ -/******************* Remove all test exams made in a course ******************/ +/**************** Remove all test exam prints made in a course ***************/ /*****************************************************************************/ void TstPrn_RemoveCrsPrints (long CrsCod) diff --git a/swad_text.c b/swad_text.c index da0864e0..910ea5ee 100644 --- a/swad_text.c +++ b/swad_text.c @@ -6341,6 +6341,27 @@ const char *Txt_Create_set_of_questions = "Criar conjunto de perguntas"; #endif +const char *Txt_Create_session = +#if L==1 // ca + "Crear sessió"; +#elif L==2 // de + "Sitzung erstellen"; +#elif L==3 // en + "Create session"; +#elif L==4 // es + "Crear sesión"; +#elif L==5 // fr + "Créer session"; +#elif L==6 // gn + "Crear sesión"; // Okoteve traducción +#elif L==7 // it + "Crea sessione"; +#elif L==8 // pl + "Utwórz sesji"; +#elif L==9 // pt + "Criar sessão"; +#endif + const char *Txt_Create_survey = #if L==1 // ca "Crear enquesta"; @@ -55815,6 +55836,27 @@ const char *Txt_View_exam = "Ver exame"; #endif +const char *Txt_View_exams = +#if L==1 // ca + "Veure exàmens"; +#elif L==2 // de + "Anzeigen Prüfung"; +#elif L==3 // en + "View exams"; +#elif L==4 // es + "Ver exámenes"; +#elif L==5 // fr + "Voir examens"; +#elif L==6 // gn + "Ver exámenes"; // Okoteve traducción +#elif L==7 // it + "Vedi esame"; +#elif L==8 // pl + "Zobacz egzaminów"; +#elif L==9 // pt + "Ver exames"; +#endif + const char *Txt_View_game = #if L==1 // ca "Veure joc"; @@ -55836,6 +55878,27 @@ const char *Txt_View_game = "Ver jogo"; #endif +const char *Txt_View_games = +#if L==1 // ca + "Veure jocs"; +#elif L==2 // de + "Anzeigen Spiele"; +#elif L==3 // en + "View games"; +#elif L==4 // es + "Ver juegos"; +#elif L==5 // fr + "Voir jeux"; +#elif L==6 // gn + "Ver juegos"; // Okoteve traducción +#elif L==7 // it + "Vedi giochi"; +#elif L==8 // pl + "Zobacz gier"; +#elif L==9 // pt + "Ver jogos"; +#endif + const char *Txt_View_in_a_new_window = #if L==1 // ca "Mostrar en una finestra nova"; @@ -55857,27 +55920,6 @@ const char *Txt_View_in_a_new_window = "Ver em uma nova janela"; #endif -const char *Txt_View_matches_results = -#if L==1 // ca - "Veure resultats de partides"; -#elif L==2 // de - "Siehe Spielergebnisse"; -#elif L==3 // en - "View matches results"; -#elif L==4 // es - "Ver resultados de partidas"; -#elif L==5 // fr - "Voir résultats de matchs"; -#elif L==6 // gn - "Ver resultados de partidas"; // Okoteve traducción -#elif L==7 // it - "Vedi risultati delle partite"; -#elif L==8 // pl - "Zobacz wyniki mecze"; -#elif L==9 // pt - "Ver resultados de partidas"; -#endif - const char *Txt_View_my_answer = #if L==1 // ca "Veure la meva resposta"; @@ -55999,7 +56041,7 @@ const char *Txt_View_results = #elif L==7 // it "Vedi risultati"; #elif L==8 // pl - "Wyświetl wyniki ankiety"; + "Pokaż wyniki"; #elif L==9 // pt "Ver resultados"; #endif @@ -56025,27 +56067,6 @@ const char *Txt_View_survey = "Ver inquérito"; #endif -const char *Txt_View_survey_results = -#if L==1 // ca - "Veure resultats"; -#elif L==2 // de - "Anzeigen Ergebnisse"; -#elif L==3 // en - "View survey results"; -#elif L==4 // es - "Ver resultados"; -#elif L==5 // fr - "Voir résultats"; -#elif L==6 // gn - "Ver resultados"; // Okoteve traducción -#elif L==7 // it - "Vedi risultati"; -#elif L==8 // pl - "Wyświetl wyniki ankiety"; -#elif L==9 // pt - "Ver resultados"; -#endif - const char *Txt_View_test = #if L==1 // ca "Veure test"; @@ -56067,25 +56088,25 @@ const char *Txt_View_test = "Ver teste"; #endif -const char *Txt_View_test_results = +const char *Txt_View_tests = #if L==1 // ca - "Veure resultats de tests"; + "Veure tests"; #elif L==2 // de - "Siehe Testergebnisse"; + "Siehe Tests"; #elif L==3 // en - "View test results"; + "View tests"; #elif L==4 // es - "Ver resultados de test"; + "Ver test"; #elif L==5 // fr - "Voir résultats de tests"; + "Voir tests"; #elif L==6 // gn - "Ver resultados de test"; // Okoteve traducción + "Ver test"; // Okoteve traducción #elif L==7 // it - "Vedi risultati dei test"; + "Vedi test"; #elif L==8 // pl - "Zobacz wyniki testów"; + "Wiadomości test"; #elif L==9 // pt - "Ver resultados de testes"; + "Ver testes"; #endif const char *Txt_View_homework = diff --git a/swad_text_action.c b/swad_text_action.c index d4c9b19c..1f810e52 100644 --- a/swad_text_action.c +++ b/swad_text_action.c @@ -10163,7 +10163,7 @@ const char *Txt_Actions[Act_NUM_ACTIONS] = "" // Precisa de tradução #endif , - [ActSeeMyTstRes] = + [ActSeeMyTstResCrs] = #if L==1 // ca "" // Necessita traducció #elif L==2 // de @@ -10226,7 +10226,7 @@ const char *Txt_Actions[Act_NUM_ACTIONS] = "" // Precisa de tradução #endif , - [ActSeeUsrTstRes] = + [ActSeeUsrTstResCrs] = #if L==1 // ca "" // Necessita traducció #elif L==2 // de @@ -11024,7 +11024,7 @@ const char *Txt_Actions[Act_NUM_ACTIONS] = "" // Precisa de tradução #endif , - [ActReqSeeAllExaRes] = + [ActReqSeeUsrExaRes] = #if L==1 // ca "" // Necessita traducció #elif L==2 // de @@ -11045,7 +11045,7 @@ const char *Txt_Actions[Act_NUM_ACTIONS] = "" // Precisa de tradução #endif , - [ActSeeAllExaResCrs] = + [ActSeeUsrExaResCrs] = #if L==1 // ca "" // Necessita traducció #elif L==2 // de @@ -11066,7 +11066,7 @@ const char *Txt_Actions[Act_NUM_ACTIONS] = "" // Precisa de tradução #endif , - [ActSeeAllExaResExa] = + [ActSeeUsrExaResExa] = #if L==1 // ca "" // Necessita traducció #elif L==2 // de @@ -11087,7 +11087,7 @@ const char *Txt_Actions[Act_NUM_ACTIONS] = "" // Precisa de tradução #endif , - [ActSeeAllExaResSes] = + [ActSeeUsrExaResSes] = #if L==1 // ca "" // Necessita traducció #elif L==2 // de @@ -11612,7 +11612,7 @@ const char *Txt_Actions[Act_NUM_ACTIONS] = "" // Precisa de tradução #endif , - [ActReqSeeAllMchRes] = + [ActReqSeeUsrMchRes] = #if L==1 // ca "" // Necessita traducció #elif L==2 // de @@ -11633,7 +11633,7 @@ const char *Txt_Actions[Act_NUM_ACTIONS] = "" // Precisa de tradução #endif , - [ActSeeAllMchResCrs] = + [ActSeeUsrMchResCrs] = #if L==1 // ca "" // Necessita traducció #elif L==2 // de @@ -11654,7 +11654,7 @@ const char *Txt_Actions[Act_NUM_ACTIONS] = "" // Precisa de tradução #endif , - [ActSeeAllMchResGam] = + [ActSeeUsrMchResGam] = #if L==1 // ca "" // Necessita traducció #elif L==2 // de @@ -11675,7 +11675,7 @@ const char *Txt_Actions[Act_NUM_ACTIONS] = "" // Precisa de tradução #endif , - [ActSeeAllMchResMch] = + [ActSeeUsrMchResMch] = #if L==1 // ca "" // Necessita traducció #elif L==2 // de