diff --git a/swad_assignment.c b/swad_assignment.c index dd0190208..93f308a12 100644 --- a/swad_assignment.c +++ b/swad_assignment.c @@ -637,7 +637,7 @@ void Asg_GetListAssignments (void) Asg_FreeListAssignments (); /***** Get list of assignments from database *****/ - if (Gbl.Crs.Grps.WhichGrps == Grp_ONLY_MY_GROUPS) + if (Gbl.Crs.Grps.WhichGrps == Grp_MY_GROUPS) NumRows = DB_QuerySELECT (&mysql_res,"can not get assignments", "SELECT AsgCod" " FROM assignments" diff --git a/swad_attendance.c b/swad_attendance.c index a93ed4442..68972622a 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -628,7 +628,7 @@ static void Att_GetListAttEvents (Att_OrderNewestOldest_t OrderNewestOldest) Att_FreeListAttEvents (); /***** Get list of attendance events from database *****/ - if (Gbl.Crs.Grps.WhichGrps == Grp_ONLY_MY_GROUPS) + if (Gbl.Crs.Grps.WhichGrps == Grp_MY_GROUPS) NumRows = DB_QuerySELECT (&mysql_res,"can not get attendance events", "SELECT AttCod" " FROM att_events" @@ -1943,7 +1943,7 @@ static void Att_ListAttStudents (struct AttendanceEvent *Att) /***** Form to select groups *****/ Grp_ShowFormToSelectSeveralGroups (Att_PutParamSelectedAttCod, - Grp_ONLY_MY_GROUPS); + Grp_MY_GROUPS); /***** Start section with user list *****/ Lay_StartSection (Usr_USER_LIST_SECTION_ID); diff --git a/swad_changelog.h b/swad_changelog.h index 3c14d9656..495ffe623 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -471,11 +471,14 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.18.2 (2019-09-28)" +#define Log_PLATFORM_VERSION "SWAD 19.19 (2019-09-29)" #define CSS_FILE "swad19.15.css" #define JS_FILE "swad19.15.js" /* - Version 19.18.2: Sep 28, 2019 Code refactoring. (246585 lines) + Version 19.19.1: Sep 29, 2019 Students will not see matches for groups to which they don't belong. + Version 19.19: Sep 29, 2019 Selections of my groups/all groups in listing of matches. + Removed column with number of match. (246596 lines) + Version 19.18.2: Sep 28, 2019 Code refactoring related to errors. (246585 lines) Version 19.18.1: Sep 28, 2019 Students will not see hidden games. (246571 lines) Version 19.18: Sep 28, 2019 New module swad_match_result for match results. (246540 lines) Version 19.17.3: Sep 28, 2019 Code refactoring removing matches and games. (246446 lines) diff --git a/swad_game.c b/swad_game.c index 8fb47fb7b..840a36e91 100644 --- a/swad_game.c +++ b/swad_game.c @@ -99,6 +99,8 @@ static void Gam_WriteAuthor (struct Game *Game); static void Gam_PutFormsToRemEditOneGame (const struct Game *Game, const char *Anchor); + +static long Gam_GetParams (void); static void Gam_PutHiddenParamOrder (void); static void Gam_GetParamOrder (void); @@ -140,9 +142,7 @@ static bool Gam_GetNumMchsGameAndCheckIfEditable (struct Game *Game); void Gam_SeeAllGames (void) { /***** Get parameters *****/ - Gam_GetParamOrder (); - Grp_GetParamWhichGrps (); - Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_GAMES); + Gam_GetParams (); // Return value ignored /***** Show all games *****/ Gam_ListAllGames (); @@ -353,12 +353,7 @@ void Gam_SeeOneGame (void) struct Game Game; /***** Get parameters *****/ - Gam_GetParamOrder (); - Grp_GetParamWhichGrps (); - Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_GAMES); - - /***** Get game code *****/ - if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L) + if ((Game.GamCod = Gam_GetParams ()) == -1L) Lay_ShowErrorAndExit ("Code of game is missing."); /***** Show game *****/ @@ -454,9 +449,10 @@ void Gam_ShowOneGame (long GamCod, fprintf (Gbl.F.Out,"\">"); /* Game title */ + Gam_CurrentGamCod = GamCod; Lay_StartArticle (Anchor); Frm_StartForm (ActSeeGam); - Gam_PutParamGameCod (GamCod); + Gam_PutParams (); Frm_LinkFormSubmit (Txt_View_game, Game.Status.Visible ? "ASG_TITLE" : "ASG_TITLE_LIGHT",NULL); @@ -587,18 +583,33 @@ static void Gam_PutFormsToRemEditOneGame (const struct Game *Game, } /*****************************************************************************/ -/******************** Params used to edit/play a game ************************/ +/*********************** Params used to edit a game **************************/ /*****************************************************************************/ void Gam_PutParams (void) { if (Gam_CurrentGamCod > 0) Gam_PutParamGameCod (Gam_CurrentGamCod); - Gam_PutHiddenParamOrder (); + Grp_PutParamWhichGrps (); Pag_PutHiddenParamPagNum (Pag_GAMES,Gbl.Games.CurrentPage); } +/*****************************************************************************/ +/******************* Get parameters used to edit a game **********************/ +/*****************************************************************************/ + +static long Gam_GetParams (void) + { + /***** Get other parameters *****/ + Gam_GetParamOrder (); + Grp_GetParamWhichGrps (); + Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_GAMES); + + /***** Get game code *****/ + return Gam_GetParamGameCod (); + } + /*****************************************************************************/ /****** Put a hidden parameter with the type of order in list of games *******/ /*****************************************************************************/ @@ -927,12 +938,7 @@ void Gam_AskRemGame (void) struct Game Game; /***** Get parameters *****/ - Gam_GetParamOrder (); - Grp_GetParamWhichGrps (); - Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_GAMES); - - /***** Get game code *****/ - if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L) + if ((Game.GamCod = Gam_GetParams ()) == -1L) Lay_ShowErrorAndExit ("Code of game is missing."); /***** Get data of the game from database *****/ @@ -1032,8 +1038,8 @@ void Gam_HideGame (void) { struct Game Game; - /***** Get game code *****/ - if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L) + /***** Get parameters *****/ + if ((Game.GamCod = Gam_GetParams ()) == -1L) Lay_ShowErrorAndExit ("Code of game is missing."); /***** Get data of the game from database *****/ @@ -1058,8 +1064,8 @@ void Gam_UnhideGame (void) { struct Game Game; - /***** Get game code *****/ - if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L) + /***** Get parameters *****/ + if ((Game.GamCod = Gam_GetParams ()) == -1L) Lay_ShowErrorAndExit ("Code of game is missing."); /***** Get data of the game from database *****/ @@ -1111,12 +1117,7 @@ void Gam_RequestCreatOrEditGame (void) char Txt[Cns_MAX_BYTES_TEXT + 1]; /***** Get parameters *****/ - Gam_GetParamOrder (); - Grp_GetParamWhichGrps (); - Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_GAMES); - - /***** Get the code of the game *****/ - Game.GamCod = Gam_GetParamGameCod (); + Game.GamCod = Gam_GetParams (); /***** Check if game has matches *****/ if (Gam_GetNumMchsGameAndCheckIfEditable (&Game)) @@ -1362,20 +1363,16 @@ void Gam_RequestNewQuestion (void) { struct Game Game; - /***** Get game code *****/ - if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L) + /***** Get parameters *****/ + if ((Game.GamCod = Gam_GetParams ()) == -1L) Lay_ShowErrorAndExit ("Code of game is missing."); /***** Check if game has matches *****/ if (Gam_GetNumMchsGameAndCheckIfEditable (&Game)) { - /***** Get other parameters *****/ - Gam_GetParamOrder (); - Grp_GetParamWhichGrps (); - Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_GAMES); - /***** Show form to create a new question in this game *****/ - Tst_ShowFormAskSelectTstsForGame (Game.GamCod); + Gam_CurrentGamCod = Game.GamCod; + Tst_ShowFormAskSelectTstsForGame (); } /***** Show current game *****/ @@ -1393,14 +1390,17 @@ void Gam_ListTstQuestionsToSelect (void) { struct Game Game; - /***** Get game code *****/ - if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L) + /***** Get parameters *****/ + if ((Game.GamCod = Gam_GetParams ()) == -1L) Lay_ShowErrorAndExit ("Code of game is missing."); /***** Check if game has matches *****/ if (Gam_GetNumMchsGameAndCheckIfEditable (&Game)) + { /***** List several test questions for selection *****/ - Tst_ListQuestionsToSelect (Game.GamCod); + Gam_CurrentGamCod = Game.GamCod; + Tst_ListQuestionsToSelect (); + } } /*****************************************************************************/ @@ -1713,8 +1713,9 @@ static void Gam_ListOneOrMoreQuestionsForEdition (long GamCod,unsigned NumQsts, "",Gbl.RowEvenOdd); /* Put icon to remove the question */ + Gam_CurrentGamCod = GamCod; Frm_StartForm (ActReqRemGamQst); - Gam_PutParamGameCod (GamCod); + Gam_PutParams (); Gam_PutParamQstInd (QstInd); Ico_PutIconRemove (); Frm_EndForm (); @@ -1846,8 +1847,8 @@ void Gam_AddTstQuestionsToGame (void) long QstCod; unsigned MaxQstInd; - /***** Get game code *****/ - if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L) + /***** Get parameters *****/ + if ((Game.GamCod = Gam_GetParams ()) == -1L) Lay_ShowErrorAndExit ("Code of game is missing."); /***** Check if game has matches *****/ @@ -1957,7 +1958,7 @@ static unsigned Gam_CountNumQuestionsInList (void) static void Gam_PutParamsOneQst (void) { - Gam_PutParamGameCod (Gam_CurrentGamCod); + Gam_PutParams (); Gam_PutParamQstInd (Gam_CurrentQstInd); } @@ -1972,8 +1973,8 @@ void Gam_RequestRemoveQst (void) struct Game Game; unsigned QstInd; - /***** Get game code *****/ - if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L) + /***** Get parameters *****/ + if ((Game.GamCod = Gam_GetParams ()) == -1L) Lay_ShowErrorAndExit ("Code of game is missing."); /***** Check if game has matches *****/ @@ -2008,8 +2009,8 @@ void Gam_RemoveQst (void) struct Game Game; unsigned QstInd; - /***** Get game code *****/ - if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L) + /***** Get parameters *****/ + if ((Game.GamCod = Gam_GetParams ()) == -1L) Lay_ShowErrorAndExit ("Code of game is missing."); /***** Check if game has matches *****/ @@ -2066,8 +2067,8 @@ void Gam_MoveUpQst (void) unsigned QstIndTop; unsigned QstIndBottom; - /***** Get game code *****/ - if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L) + /***** Get parameters *****/ + if ((Game.GamCod = Gam_GetParams ()) == -1L) Lay_ShowErrorAndExit ("Code of game is missing."); /***** Check if game has matches *****/ @@ -2115,8 +2116,8 @@ void Gam_MoveDownQst (void) unsigned QstIndBottom; unsigned MaxQstInd; // 0 if no questions - /***** Get game code *****/ - if ((Game.GamCod = Gam_GetParamGameCod ()) == -1L) + /***** Get parameters *****/ + if ((Game.GamCod = Gam_GetParams ()) == -1L) Lay_ShowErrorAndExit ("Code of game is missing."); /***** Check if game has matches *****/ @@ -2230,6 +2231,21 @@ static bool Gam_GetNumMchsGameAndCheckIfEditable (struct Game *Game) return true; // It has no matches ==> it's editable } +/*****************************************************************************/ +/********************* Put button to create a new match **********************/ +/*****************************************************************************/ + +void Gam_PutButtonNewMatch (long GamCod) + { + extern const char *Txt_New_match; + + Gam_CurrentGamCod = GamCod; + Frm_StartFormAnchor (ActReqNewMchTch,Mch_NEW_MATCH_SECTION_ID); + Gam_PutParams (); + Btn_PutConfirmButton (Txt_New_match); + Frm_EndForm (); + } + /*****************************************************************************/ /************* Request the creation of a new match as a teacher **************/ /*****************************************************************************/ @@ -2239,12 +2255,7 @@ void Gam_RequestNewMatchTch (void) long GamCod; /***** Get parameters *****/ - Gam_GetParamOrder (); - Grp_GetParamWhichGrps (); - Gbl.Games.CurrentPage = Pag_GetParamPagNum (Pag_GAMES); - - /***** Get game code *****/ - if ((GamCod = Gam_GetParamGameCod ()) == -1L) + if ((GamCod = Gam_GetParams ()) == -1L) Lay_ShowErrorAndExit ("Code of game is missing."); /***** Show game *****/ diff --git a/swad_game.h b/swad_game.h index fecbe7916..27c30083c 100644 --- a/swad_game.h +++ b/swad_game.h @@ -83,7 +83,9 @@ void Gam_ShowOneGame (long GamCod, bool PutFormNewMatch); void Gam_PutHiddenParamGameOrder (void); void Gam_RequestCreatOrEditGame (void); + void Gam_PutParams (void); + void Gam_GetListGames (void); void Gam_GetDataOfGameByCod (struct Game *Gam); void Gam_GetDataOfGameByFolder (struct Game *Gam); @@ -121,6 +123,7 @@ void Gam_RemoveQst (void); void Gam_MoveUpQst (void); void Gam_MoveDownQst (void); +void Gam_PutButtonNewMatch (long GamCod); void Gam_RequestNewMatchTch (void); unsigned Gam_GetNumCoursesWithGames (Hie_Level_t Scope); diff --git a/swad_group.c b/swad_group.c index b1c1691b9..fe8d163da 100644 --- a/swad_group.c +++ b/swad_group.c @@ -4997,7 +4997,7 @@ void Grp_PutParamWhichGrps (void) void Grp_PutParamWhichGrpsOnlyMyGrps (void) { - Par_PutHiddenParamUnsigned ("WhichGrps",(unsigned) Grp_ONLY_MY_GROUPS); + Par_PutHiddenParamUnsigned ("WhichGrps",(unsigned) Grp_MY_GROUPS); } void Grp_PutParamWhichGrpsAllGrps (void) @@ -5014,24 +5014,29 @@ void Grp_ShowFormToSelWhichGrps (Act_Action_t Action,void (*FuncParams) (void)) extern const char *Txt_GROUP_WHICH_GROUPS[2]; Grp_WhichGroups_t WhichGrps; + /***** Start setting selector *****/ Set_StartOneSettingSelector (); - for (WhichGrps = Grp_ONLY_MY_GROUPS; + + /***** Put icons to select which groups *****/ + for (WhichGrps = Grp_MY_GROUPS; WhichGrps <= Grp_ALL_GROUPS; WhichGrps++) { fprintf (Gbl.F.Out,"
", WhichGrps == Gbl.Crs.Grps.WhichGrps ? "PREF_ON" : - "PREF_OFF"); + "PREF_OFF"); Frm_StartForm (Action); Par_PutHiddenParamUnsigned ("WhichGrps",(unsigned) WhichGrps); if (FuncParams) // Extra parameters depending on the action FuncParams (); - Ico_PutSettingIconLink (WhichGrps == Grp_ONLY_MY_GROUPS ? "mysitemap.png" : + Ico_PutSettingIconLink (WhichGrps == Grp_MY_GROUPS ? "mysitemap.png" : "sitemap.svg", Txt_GROUP_WHICH_GROUPS[WhichGrps]); Frm_EndForm (); fprintf (Gbl.F.Out,"
"); } + + /***** End setting selector *****/ Set_EndOneSettingSelector (); } @@ -5050,31 +5055,37 @@ void Grp_GetParamWhichGrps (void) /* Set default */ switch (Gbl.Action.Act) { - case ActSeeCrsTT: - case ActPrnCrsTT: - case ActChgCrsTT1stDay: - case ActSeeAsg: - case ActSeeAllSvy: - case ActSeeAtt: - WhichGroupsDefault = Gbl.Usrs.Me.IBelongToCurrentCrs ? Grp_ONLY_MY_GROUPS : // If I belong to this course ==> see only my groups - Grp_ALL_GROUPS; // If I don't belong to this course ==> see all groups + case ActSeeCrsTT: // Show course timetable + case ActPrnCrsTT: // Print course timetable + case ActChgCrsTT1stDay:// Change first day of week in course timetable + case ActSeeAsg: // List assignments + case ActSeeGam: // List games + case ActSeeAllSvy: // List surveys + case ActSeeAtt: // List attendance + /* + If I belong to this course ==> see only my groups + If I don't belong to this course ==> see all groups + */ + WhichGroupsDefault = Gbl.Usrs.Me.IBelongToCurrentCrs ? Grp_MY_GROUPS : + Grp_ALL_GROUPS; break; - case ActSeeMyTT: - case ActPrnMyTT: - case ActChgMyTT1stDay: - WhichGroupsDefault = Grp_ONLY_MY_GROUPS; // By default, see only my groups + case ActSeeMyTT: // Show my timetable + case ActPrnMyTT: // Print my timetable + case ActChgMyTT1stDay: // Change first day of week in my timetable + /* By default, show only my groups */ + WhichGroupsDefault = Grp_MY_GROUPS; break; - default: // Control never should enter here + default: // Control never should enter here WhichGroupsDefault = Grp_WHICH_GROUPS_DEFAULT; break; } /* Get parameter */ Gbl.Crs.Grps.WhichGrps = (Grp_WhichGroups_t) - Par_GetParToUnsignedLong ("WhichGrps", - 0, - Grp_NUM_WHICH_GROUPS - 1, - (unsigned long) WhichGroupsDefault); + Par_GetParToUnsignedLong ("WhichGrps", + 0, + Grp_NUM_WHICH_GROUPS - 1, + (unsigned long) WhichGroupsDefault); AlreadyGot = true; } diff --git a/swad_group.h b/swad_group.h index 28f2ac329..10f46d6ca 100644 --- a/swad_group.h +++ b/swad_group.h @@ -127,7 +127,7 @@ struct ListGrpsAlreadySelec #define Grp_NUM_WHICH_GROUPS 2 typedef enum { - Grp_ONLY_MY_GROUPS, + Grp_MY_GROUPS, Grp_ALL_GROUPS, } Grp_WhichGroups_t; #define Grp_WHICH_GROUPS_DEFAULT Grp_ALL_GROUPS diff --git a/swad_match.c b/swad_match.c index ea02f7856..001b73a4c 100644 --- a/swad_match.c +++ b/swad_match.c @@ -97,7 +97,8 @@ const char *MatchSecondaryTables[] = "mch_indexes", // indexes associated to matches // "mch_matches" // the matches themselves, this table is treated separately }; -#define Mch_NUM_SECONDARY_TABLES (sizeof (MatchSecondaryTables) / sizeof (MatchSecondaryTables[0])) +#define Mch_NUM_SECONDARY_TABLES (sizeof (MatchSecondaryTables) / \ + sizeof (MatchSecondaryTables[0])) /*****************************************************************************/ /***************************** Private variables *****************************/ @@ -116,7 +117,6 @@ static void Mch_ListOneOrMoreMatches (struct Game *Game, MYSQL_RES *mysql_res); static void Mch_ListOneOrMoreMatchesHeading (void); static void Mch_ListOneOrMoreMatchesIcons (const struct Match *Match); -static void Mch_ListOneOrMoreMatchesNumMatch (unsigned NumMatch); static void Mch_ListOneOrMoreMatchesAuthor (const struct Match *Match); static void Mch_ListOneOrMoreMatchesTimes (const struct Match *Match,unsigned UniqueId); static void Mch_ListOneOrMoreMatchesTitleGrps (const struct Match *Match); @@ -134,9 +134,7 @@ 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_PutParamCurrentMchCod (void); - -static void Mch_PutButtonNewMatch (long GamCod); +static void Mch_PutParams (void); static void Mch_PutFormNewMatch (struct Game *Game); static void Mch_ShowLstGrpsToCreateMatch (void); @@ -220,7 +218,7 @@ void Mch_ListMatches (struct Game *Game,bool PutFormNewMatch) /***** Get data of matches from database *****/ /* Fill subquery for game */ - if (Gbl.Crs.Grps.WhichGrps == Grp_ONLY_MY_GROUPS) + if (Gbl.Crs.Grps.WhichGrps == Grp_MY_GROUPS) { if (asprintf (&SubQuery," AND" "(MchCod NOT IN" @@ -265,6 +263,14 @@ void Mch_ListMatches (struct Game *Game,bool PutFormNewMatch) Box_StartBox (NULL,Txt_Matches,Mch_PutIconToPlayNewMatch, Hlp_ASSESSMENT_Games_matches,Box_NOT_CLOSABLE); + /***** Select whether show only my groups or all groups *****/ + if (Gbl.Crs.Grps.NumGrps) + { + Set_StartSettingsHead (); + Grp_ShowFormToSelWhichGrps (ActSeeGam,Gam_PutParams); + Set_EndSettingsHead (); + } + if (NumMatches) /***** Show the table with the matches *****/ Mch_ListOneOrMoreMatches (Game,NumMatches,mysql_res); @@ -281,7 +287,7 @@ void Mch_ListMatches (struct Game *Game,bool PutFormNewMatch) if (PutFormNewMatch) Mch_PutFormNewMatch (Game); // Form to fill in data and start playing a new match else - Mch_PutButtonNewMatch (Game->GamCod); // Button to create a new match + Gam_PutButtonNewMatch (Game->GamCod); // Button to create a new match break; default: break; @@ -350,14 +356,14 @@ void Mch_GetDataOfMatchByCod (struct Match *Match) } /*****************************************************************************/ -/***************** Put icon to add a new questions to game *******************/ +/********************* Put icon to create a new match ************************/ /*****************************************************************************/ static void Mch_PutIconToPlayNewMatch (void) { extern const char *Txt_New_match; - /***** Put form to create a new question *****/ + /***** Put form to create a new match *****/ Ico_PutContextualIconToAdd (ActReqNewMchTch,Mch_NEW_MATCH_SECTION_ID,Gam_PutParams, Txt_New_match); } @@ -394,9 +400,6 @@ static void Mch_ListOneOrMoreMatches (struct Game *Game, /* Icons */ Mch_ListOneOrMoreMatchesIcons (&Match); - /* Number of match **/ - Mch_ListOneOrMoreMatchesNumMatch (NumMatch); - /* Match player */ Mch_ListOneOrMoreMatchesAuthor (&Match); @@ -428,7 +431,6 @@ static void Mch_ListOneOrMoreMatches (struct Game *Game, static void Mch_ListOneOrMoreMatchesHeading (void) { - extern const char *Txt_No_INDEX; extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS]; extern const char *Txt_START_END_TIME[Dat_NUM_START_END_TIME]; extern const char *Txt_Match; @@ -438,9 +440,6 @@ static void Mch_ListOneOrMoreMatchesHeading (void) fprintf (Gbl.F.Out,"" "" - "" - "%s" - "" "" "%s" "" @@ -463,7 +462,6 @@ static void Mch_ListOneOrMoreMatchesHeading (void) "%s" "" "", - Txt_No_INDEX, Txt_ROLES_SINGUL_Abc[Rol_TCH][Usr_SEX_UNKNOWN], Txt_START_END_TIME[Gam_ORDER_BY_START_DATE], Txt_START_END_TIME[Gam_ORDER_BY_END_DATE], @@ -481,25 +479,16 @@ static void Mch_ListOneOrMoreMatchesIcons (const struct Match *Match) { fprintf (Gbl.F.Out,"",Gbl.RowEvenOdd); - /* Put icon to remove the match */ + /***** Put icon to remove the match *****/ + Mch_CurrentMchCod = Match->MchCod; Frm_StartForm (ActReqRemMchTch); - Mch_PutParamMchCod (Match->MchCod); + Mch_PutParams (); Ico_PutIconRemove (); Frm_EndForm (); fprintf (Gbl.F.Out,""); } -/*****************************************************************************/ -/********************* Put a column for number of match **********************/ -/*****************************************************************************/ - -static void Mch_ListOneOrMoreMatchesNumMatch (unsigned NumMatch) - { - fprintf (Gbl.F.Out,"%u", - Gbl.RowEvenOdd,NumMatch + 1); - } - /*****************************************************************************/ /************* Put a column for teacher who created the match ****************/ /*****************************************************************************/ @@ -660,7 +649,7 @@ static void Mch_ListOneOrMoreMatchesStatus (const struct Match *Match,unsigned N /* Icon to play as student */ Mch_CurrentMchCod = Match->MchCod; Lay_PutContextualLinkOnlyIcon (ActPlyMchStd,NULL, - Mch_PutParamCurrentMchCod, + Mch_PutParams, Match->Status.QstInd < Mch_AFTER_LAST_QUESTION ? "play.svg" : "flag-checkered.svg", Txt_Play); @@ -674,7 +663,7 @@ static void Mch_ListOneOrMoreMatchesStatus (const struct Match *Match,unsigned N /* Icon to resume */ Mch_CurrentMchCod = Match->MchCod; Lay_PutContextualLinkOnlyIcon (ActResMchTch,NULL, - Mch_PutParamCurrentMchCod, + Mch_PutParams, Match->Status.QstInd < Mch_AFTER_LAST_QUESTION ? "play.svg" : "flag-checkered.svg", Txt_Resume); @@ -721,7 +710,7 @@ static void Mch_ListOneOrMoreMatchesResult (const struct Match *Match) /* Match result visible or hidden? */ Mch_CurrentMchCod = Match->MchCod; Lay_PutContextualLinkOnlyIcon (ActChgVisResMchUsr,NULL, - Mch_PutParamCurrentMchCod, + Mch_PutParams, Match->Status.ShowUsrResults ? "eye.svg" : "eye-slash.svg", Match->Status.ShowUsrResults ? Txt_Visible_result : @@ -878,7 +867,7 @@ void Mch_RequestRemoveMatchTch (void) /***** Show question and button to remove question *****/ Mch_CurrentMchCod = Match.MchCod; - Ale_ShowAlertAndButton (ActRemMchTch,NULL,NULL,Mch_PutParamCurrentMchCod, + Ale_ShowAlertAndButton (ActRemMchTch,NULL,NULL,Mch_PutParams, Btn_REMOVE_BUTTON,Txt_Remove_match, Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_match_X, Match.Title); @@ -1044,13 +1033,14 @@ static void Mch_RemoveMatchInCourseFromTable (long CrsCod,const char *TableName) } /*****************************************************************************/ -/***************** Put parameter with current match code *********************/ +/*********************** Params used to edit a match *************************/ /*****************************************************************************/ -static void Mch_PutParamCurrentMchCod (void) +static void Mch_PutParams (void) { if (Mch_CurrentMchCod > 0) Mch_PutParamMchCod (Mch_CurrentMchCod); + Grp_PutParamWhichGrps (); } /*****************************************************************************/ @@ -1072,20 +1062,6 @@ long Mch_GetParamMchCod (void) return Par_GetParToLong ("MchCod"); } -/*****************************************************************************/ -/********************* Put button to create a new match **********************/ -/*****************************************************************************/ - -static void Mch_PutButtonNewMatch (long GamCod) - { - extern const char *Txt_New_match; - - Frm_StartFormAnchor (ActReqNewMchTch,Mch_NEW_MATCH_SECTION_ID); - Gam_PutParamGameCod (GamCod); - Btn_PutConfirmButton (Txt_New_match); - Frm_EndForm (); - } - /*****************************************************************************/ /****** Put a big button to play match (start a new match) as a teacher ******/ /*****************************************************************************/ diff --git a/swad_match_result.c b/swad_match_result.c index 2cdb0d5d2..b9a575f82 100644 --- a/swad_match_result.c +++ b/swad_match_result.c @@ -194,7 +194,7 @@ void Mch_SelUsrsToViewUsrsMchResults (void) /***** Show form to select the groups *****/ Grp_ShowFormToSelectSeveralGroups (NULL, - Grp_ONLY_MY_GROUPS); + Grp_MY_GROUPS); /***** Start section with user list *****/ Lay_StartSection (Usr_USER_LIST_SECTION_ID); diff --git a/swad_message.c b/swad_message.c index b542af60e..87ca908f5 100644 --- a/swad_message.c +++ b/swad_message.c @@ -242,7 +242,7 @@ static void Msg_PutFormMsgUsrs (char Content[Cns_MAX_BYTES_LONG_TEXT + 1]) { /***** Form to select groups *****/ Grp_ShowFormToSelectSeveralGroups (Msg_PutParamsWriteMsg, - Grp_ONLY_MY_GROUPS); + Grp_MY_GROUPS); /***** Start section with user list *****/ Lay_StartSection (Usr_USER_LIST_SECTION_ID); diff --git a/swad_statistic.c b/swad_statistic.c index 63f9002b9..c98d11475 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -351,7 +351,7 @@ void Sta_AskShowCrsHits (void) /***** Show form to select the groups *****/ Grp_ShowFormToSelectSeveralGroups (NULL, - Grp_ONLY_MY_GROUPS); + Grp_MY_GROUPS); /***** Start section with user list *****/ Lay_StartSection (Usr_USER_LIST_SECTION_ID); diff --git a/swad_survey.c b/swad_survey.c index 15316bc98..5eb257dda 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -113,6 +113,8 @@ static void Svy_PutFormsToRemEditOneSvy (const struct Survey *Svy, const char *Anchor); static void Svy_PutParams (void); +static void Svy_GetListSurveys (void); + static void Svy_SetAllowedAndHiddenScopes (unsigned *ScopesAllowed, unsigned *HiddenAllowed); @@ -847,7 +849,7 @@ static void Svy_PutParams (void) /*********************** Get list of all the surveys *************************/ /*****************************************************************************/ -void Svy_GetListSurveys (void) +static void Svy_GetListSurveys (void) { char *SubQuery[Hie_NUM_LEVELS]; static const char *OrderBySubQuery[Svy_NUM_ORDERS] = @@ -904,7 +906,7 @@ void Svy_GetListSurveys (void) /* Fill subquery for course */ if (ScopesAllowed & 1 << Hie_CRS) { - if (Gbl.Crs.Grps.WhichGrps == Grp_ONLY_MY_GROUPS) + if (Gbl.Crs.Grps.WhichGrps == Grp_MY_GROUPS) { if (asprintf (&SubQuery[Hie_CRS],"%s(" "Scope='%s' AND Cod=%ld%s" @@ -1695,6 +1697,11 @@ void Svy_HideSurvey (void) /***** Initialize question to zero *****/ Svy_InitQst (&SvyQst); + /***** Get parameters *****/ + Svy_GetParamSvyOrder (); + Grp_GetParamWhichGrps (); + Gbl.Svys.CurrentPage = Pag_GetParamPagNum (Pag_SURVEYS); + /***** Get survey code *****/ if ((Svy.SvyCod = Svy_GetParamSvyCod ()) == -1L) Lay_ShowErrorAndExit ("Code of survey is missing."); @@ -1725,6 +1732,11 @@ void Svy_UnhideSurvey (void) /***** Initialize question to zero *****/ Svy_InitQst (&SvyQst); + /***** Get parameters *****/ + Svy_GetParamSvyOrder (); + Grp_GetParamWhichGrps (); + Gbl.Svys.CurrentPage = Pag_GetParamPagNum (Pag_SURVEYS); + /***** Get survey code *****/ if ((Svy.SvyCod = Svy_GetParamSvyCod ()) == -1L) Lay_ShowErrorAndExit ("Code of survey is missing."); diff --git a/swad_survey.h b/swad_survey.h index 4ac9375a4..7613777b5 100644 --- a/swad_survey.h +++ b/swad_survey.h @@ -91,7 +91,6 @@ void Svy_SeeAllSurveys (void); void Svy_SeeOneSurvey (void); void Svy_PutHiddenParamSvyOrder (void); void Svy_RequestCreatOrEditSvy (void); -void Svy_GetListSurveys (void); void Svy_GetDataOfSurveyByCod (struct Survey *Svy); void Svy_GetDataOfSurveyByFolder (struct Survey *Svy); void Svy_FreeListSurveys (void); diff --git a/swad_test.c b/swad_test.c index 4afe8aae2..993a9052f 100644 --- a/swad_test.c +++ b/swad_test.c @@ -189,8 +189,7 @@ static unsigned long Tst_GetQuestionsForTest (MYSQL_RES **mysql_res); static void Tst_ListOneQstToEdit (void); static void Tst_ListOneOrMoreQuestionsForEdition (unsigned long NumRows, MYSQL_RES *mysql_res); -static void Tst_ListOneOrMoreQuestionsForSelection (long GamCod, - unsigned long NumRows, +static void Tst_ListOneOrMoreQuestionsForSelection (unsigned long NumRows, MYSQL_RES *mysql_res); static void Tst_WriteAnswersTestToAnswer (unsigned NumQst,long QstCod,bool Shuffle); @@ -1336,7 +1335,7 @@ void Tst_ShowFormAskEditTsts (void) /************** Show form select test questions for a game *******************/ /*****************************************************************************/ -void Tst_ShowFormAskSelectTstsForGame (long GamCod) +void Tst_ShowFormAskSelectTstsForGame (void) { extern const char *Hlp_ASSESSMENT_Tests; extern const char *Txt_No_test_questions; @@ -1353,7 +1352,7 @@ void Tst_ShowFormAskSelectTstsForGame (long GamCod) if ((NumRows = Tst_GetAllTagsFromCurrentCrs (&mysql_res))) { Frm_StartForm (ActGamLstTstQst); - Gam_PutParamGameCod (GamCod); + Gam_PutParams (); Tbl_StartTable (2); @@ -2413,7 +2412,7 @@ void Tst_ListQuestionsToEdit (void) /**************** List several test questions for selection ******************/ /*****************************************************************************/ -void Tst_ListQuestionsToSelect (long GamCod) +void Tst_ListQuestionsToSelect (void) { MYSQL_RES *mysql_res; unsigned long NumRows; @@ -2423,14 +2422,14 @@ void Tst_ListQuestionsToSelect (long GamCod) { if ((NumRows = Tst_GetQuestions (&mysql_res)) != 0) // Query database /* Show the table with the questions */ - Tst_ListOneOrMoreQuestionsForSelection (GamCod,NumRows,mysql_res); + Tst_ListOneOrMoreQuestionsForSelection (NumRows,mysql_res); /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); } else /* Show the form again */ - Tst_ShowFormAskSelectTstsForGame (GamCod); + Tst_ShowFormAskSelectTstsForGame (); /***** Free memory used by the list of tags *****/ Tst_FreeTagsList (); @@ -3050,8 +3049,7 @@ static void Tst_ListOneOrMoreQuestionsForEdition (unsigned long NumRows, /****************** List for edition one or more test questions **************/ /*****************************************************************************/ -static void Tst_ListOneOrMoreQuestionsForSelection (long GamCod, - unsigned long NumRows, +static void Tst_ListOneOrMoreQuestionsForSelection (unsigned long NumRows, MYSQL_RES *mysql_res) { extern const char *Hlp_ASSESSMENT_Tests; @@ -3077,7 +3075,7 @@ static void Tst_ListOneOrMoreQuestionsForSelection (long GamCod, /***** Start form *****/ Frm_StartForm (ActAddTstQstToGam); - Gam_PutParamGameCod (GamCod); + Gam_PutParams (); /***** Write the heading *****/ Tbl_StartTableWideMargin (2); @@ -7436,7 +7434,7 @@ void Tst_SelUsrsToViewUsrsTstResults (void) /***** Show form to select the groups *****/ Grp_ShowFormToSelectSeveralGroups (NULL, - Grp_ONLY_MY_GROUPS); + Grp_MY_GROUPS); /***** Start section with user list *****/ Lay_StartSection (Usr_USER_LIST_SECTION_ID); diff --git a/swad_test.h b/swad_test.h index 5cb70b536..267aa6a04 100644 --- a/swad_test.h +++ b/swad_test.h @@ -148,9 +148,9 @@ void Tst_WriteQstStem (const char *Stem,const char *ClassStem); void Tst_WriteQstFeedback (const char *Feedback,const char *ClassFeedback); void Tst_ShowFormAskEditTsts (void); -void Tst_ShowFormAskSelectTstsForGame (long GamCod); +void Tst_ShowFormAskSelectTstsForGame (void); void Tst_ListQuestionsToEdit (void); -void Tst_ListQuestionsToSelect (long GamCod); +void Tst_ListQuestionsToSelect (void); bool Tst_GetOneQuestionByCod (long QstCod,MYSQL_RES **mysql_res); void Tst_WriteParamEditQst (void); unsigned Tst_GetNumAnswersQst (long QstCod); diff --git a/swad_timetable.c b/swad_timetable.c index 6d1368761..8ad7cae0e 100644 --- a/swad_timetable.c +++ b/swad_timetable.c @@ -234,7 +234,7 @@ static void TT_ShowTimeTableGrpsSelected (void) fprintf (Gbl.F.Out,"
"); switch (Gbl.Crs.Grps.WhichGrps) { - case Grp_ONLY_MY_GROUPS: + case Grp_MY_GROUPS: fprintf (Gbl.F.Out,Txt_Groups_OF_A_USER, Gbl.Usrs.Me.UsrDat.FullName); break; @@ -683,7 +683,7 @@ static void TT_FillTimeTableFromDB (long UsrCod) case TT_MY_TIMETABLE: switch (Gbl.Crs.Grps.WhichGrps) { - case Grp_ONLY_MY_GROUPS: + case Grp_MY_GROUPS: NumRows = DB_QuerySELECT (&mysql_res,"can not get timetable", "SELECT timetable_crs.Weekday," "TIME_TO_SEC(timetable_crs.StartTime) AS S," diff --git a/swad_user.c b/swad_user.c index 44b5b03bb..d8b55cc89 100644 --- a/swad_user.c +++ b/swad_user.c @@ -6194,7 +6194,7 @@ void Usr_PutFormToSelectUsrsToGoToAct (Act_Action_t NextAction,void (*FuncParams /***** Show form to select the groups *****/ Grp_ShowFormToSelectSeveralGroups (FuncParams, - Grp_ONLY_MY_GROUPS); + Grp_MY_GROUPS); /***** Start section with user list *****/ Lay_StartSection (Usr_USER_LIST_SECTION_ID); @@ -8002,7 +8002,7 @@ void Usr_SeeStudents (void) /***** Form to select groups *****/ if (Gbl.Scope.Current == Hie_CRS) Grp_ShowFormToSelectSeveralGroups (Sco_PutParamCurrentScope, - Grp_ONLY_MY_GROUPS); + Grp_MY_GROUPS); /***** Start section with user list *****/ Lay_StartSection (Usr_USER_LIST_SECTION_ID); @@ -8176,7 +8176,7 @@ void Usr_SeeTeachers (void) /***** Form to select groups *****/ if (Gbl.Scope.Current == Hie_CRS) Grp_ShowFormToSelectSeveralGroups (Sco_PutParamCurrentScope, - Grp_ONLY_MY_GROUPS); + Grp_MY_GROUPS); /***** Start section with user list *****/ Lay_StartSection (Usr_USER_LIST_SECTION_ID);