diff --git a/swad_QR.c b/swad_QR.c index acf1e6d8..767bca55 100644 --- a/swad_QR.c +++ b/swad_QR.c @@ -155,7 +155,7 @@ void QR_ExamAnnnouncement (void) " style=\"width:250px; height:250px;\" />" "", 300,300, - Cfg_URL_SWAD_CGI,Gbl.Hierarchy.Crs.Crs.CrsCod,Act_GetActCod (ActSeeAllExaAnn), + Cfg_URL_SWAD_CGI,Gbl.Hierarchy.Crs.CrsCod,Act_GetActCod (ActSeeAllExaAnn), Txt_Link_to_announcement_of_exam, Txt_Link_to_announcement_of_exam); } diff --git a/swad_RSS.c b/swad_RSS.c index 49e9f7b8..d7a52f23 100644 --- a/swad_RSS.c +++ b/swad_RSS.c @@ -261,7 +261,7 @@ static void RSS_WriteExamAnnouncements (FILE *FileRSS,struct Course *Crs) " FROM exam_announcements" " WHERE CrsCod=%ld AND Status=%u AND ExamDate>=NOW()" " ORDER BY T", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, (unsigned) Exa_VISIBLE_EXAM_ANNOUNCEMENT); /***** Write items with notices *****/ diff --git a/swad_action.c b/swad_action.c index 180ebeff..9c27c615 100644 --- a/swad_action.c +++ b/swad_action.c @@ -5364,7 +5364,7 @@ void Act_AdjustCurrentAction (void) /***** Check if it is mandatory to read any information about course *****/ if (Gbl.Action.Act == ActMnu) // Do the following check sometimes, for example when the user changes the current tab - Gbl.Hierarchy.Crs.Info.ShowMsgMustBeRead = Inf_GetIfIMustReadAnyCrsInfoInThisCrs (); + Gbl.Crs.Info.ShowMsgMustBeRead = Inf_GetIfIMustReadAnyCrsInfoInThisCrs (); break; case Rol_NET: break; diff --git a/swad_agenda.c b/swad_agenda.c index 71e39bfb..5f18b947 100644 --- a/swad_agenda.c +++ b/swad_agenda.c @@ -1791,7 +1791,7 @@ unsigned Agd_GetNumUsrsWithEvents (Hie_Level_t Scope) " FROM crs_usr,agendas" " WHERE crs_usr.CrsCod=%ld" " AND crs_usr.UsrCod=agendas.UsrCod", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); break; default: Lay_WrongScopeExit (); @@ -1877,7 +1877,7 @@ unsigned Agd_GetNumEvents (Hie_Level_t Scope) " FROM crs_usr,agendas" " WHERE crs_usr.CrsCod=%ld" " AND crs_usr.UsrCod=agendas.UsrCod", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); break; default: Lay_WrongScopeExit (); diff --git a/swad_assignment.c b/swad_assignment.c index a746bd19..cbca5ac7 100644 --- a/swad_assignment.c +++ b/swad_assignment.c @@ -145,7 +145,7 @@ static void Asg_ShowAllAssignments (void) Hlp_ASSESSMENT_Assignments,Box_NOT_CLOSABLE); /***** Select whether show only my groups or all groups *****/ - if (Gbl.Hierarchy.Crs.Grps.NumGrps) + if (Gbl.Crs.Grps.NumGrps) { Set_StartSettingsHead (); Grp_ShowFormToSelWhichGrps (ActSeeAsg,Asg_ParamsWhichGroupsToShow); @@ -319,7 +319,7 @@ void Asg_PrintOneAssignment (void) Lay_WriteHeaderClassPhoto (true,false, Gbl.Hierarchy.Ins.InsCod, Gbl.Hierarchy.Deg.DegCod, - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); /***** Table head *****/ Tbl_StartTableWideMargin (2); @@ -442,7 +442,7 @@ static void Asg_ShowOneAssignment (long AsgCod,bool PrintView) fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd); fprintf (Gbl.F.Out,"\">"); - if (Gbl.Hierarchy.Crs.Grps.NumGrps) + if (Gbl.Crs.Grps.NumGrps) Asg_GetAndWriteNamesOfGrpsAssociatedToAsg (&Asg); fprintf (Gbl.F.Out,"
%s
" @@ -456,7 +456,7 @@ static void Asg_ShowOneAssignment (long AsgCod,bool PrintView) /***** Mark possible notification as seen *****/ Ntf_MarkNotifAsSeen (Ntf_EVENT_ASSIGNMENT, - AsgCod,Gbl.Hierarchy.Crs.Crs.CrsCod, + AsgCod,Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod); } @@ -610,7 +610,7 @@ void Asg_GetListAssignments (void) Asg_FreeListAssignments (); /***** Get list of assignments from database *****/ - if (Gbl.Hierarchy.Crs.Grps.WhichGrps == Grp_ONLY_MY_GROUPS) + if (Gbl.Crs.Grps.WhichGrps == Grp_ONLY_MY_GROUPS) NumRows = DB_QuerySELECT (&mysql_res,"can not get assignments", "SELECT AsgCod" " FROM assignments" @@ -619,17 +619,17 @@ void Asg_GetListAssignments (void) " AsgCod IN (SELECT asg_grp.AsgCod FROM asg_grp,crs_grp_usr" " WHERE crs_grp_usr.UsrCod=%ld AND asg_grp.GrpCod=crs_grp_usr.GrpCod))" " ORDER BY %s", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, HiddenSubQuery[Gbl.Usrs.Me.Role.Logged], Gbl.Usrs.Me.UsrDat.UsrCod, OrderBySubQuery[Gbl.Asgs.SelectedOrder]); - else // Gbl.Hierarchy.Crs.Grps.WhichGrps == Grp_ALL_GROUPS + else // Gbl.Crs.Grps.WhichGrps == Grp_ALL_GROUPS NumRows = DB_QuerySELECT (&mysql_res,"can not get assignments", "SELECT AsgCod" " FROM assignments" " WHERE CrsCod=%ld%s" " ORDER BY %s", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, HiddenSubQuery[Gbl.Usrs.Me.Role.Logged], OrderBySubQuery[Gbl.Asgs.SelectedOrder]); @@ -681,7 +681,7 @@ void Asg_GetDataOfAssignmentByCod (struct Assignment *Asg) "Title,Folder" " FROM assignments" " WHERE AsgCod=%ld AND CrsCod=%ld", - Asg->AsgCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + Asg->AsgCod,Gbl.Hierarchy.Crs.CrsCod); /***** Get data of assignment *****/ Asg_GetDataOfAssignment (Asg,&mysql_res,NumRows); @@ -714,7 +714,7 @@ void Asg_GetDataOfAssignmentByFolder (struct Assignment *Asg) "Title,Folder" " FROM assignments" " WHERE CrsCod=%ld AND Folder='%s'", - Gbl.Hierarchy.Crs.Crs.CrsCod,Asg->Folder); + Gbl.Hierarchy.Crs.CrsCod,Asg->Folder); /***** Get data of assignment *****/ Asg_GetDataOfAssignment (Asg,&mysql_res,NumRows); @@ -831,7 +831,7 @@ static void Asg_GetAssignmentTxtFromDB (long AsgCod,char Txt[Cns_MAX_BYTES_TEXT NumRows = DB_QuerySELECT (&mysql_res,"can not get assignment text", "SELECT Txt FROM assignments" " WHERE AsgCod=%ld AND CrsCod=%ld", - AsgCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + AsgCod,Gbl.Hierarchy.Crs.CrsCod); /***** The result of the query must have one row or none *****/ if (NumRows == 1) @@ -976,7 +976,7 @@ void Asg_RemoveAssignment (void) /***** Remove assignment *****/ DB_QueryDELETE ("can not remove assignment", "DELETE FROM assignments WHERE AsgCod=%ld AND CrsCod=%ld", - Asg.AsgCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + Asg.AsgCod,Gbl.Hierarchy.Crs.CrsCod); /***** Mark possible notifications as removed *****/ Ntf_MarkNotifAsRemoved (Ntf_EVENT_ASSIGNMENT,Asg.AsgCod); @@ -1009,7 +1009,7 @@ void Asg_HideAssignment (void) DB_QueryUPDATE ("can not hide assignment", "UPDATE assignments SET Hidden='Y'" " WHERE AsgCod=%ld AND CrsCod=%ld", - Asg.AsgCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + Asg.AsgCod,Gbl.Hierarchy.Crs.CrsCod); /***** Write message to show the change made *****/ Ale_ShowAlert (Ale_SUCCESS,Txt_Assignment_X_is_now_hidden, @@ -1039,7 +1039,7 @@ void Asg_ShowAssignment (void) DB_QueryUPDATE ("can not show assignment", "UPDATE assignments SET Hidden='N'" " WHERE AsgCod=%ld AND CrsCod=%ld", - Asg.AsgCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + Asg.AsgCod,Gbl.Hierarchy.Crs.CrsCod); /***** Write message to show the change made *****/ Ale_ShowAlert (Ale_SUCCESS,Txt_Assignment_X_is_now_visible, @@ -1060,7 +1060,7 @@ static bool Asg_CheckIfSimilarAssignmentExists (const char *Field,const char *Va "SELECT COUNT(*) FROM assignments" " WHERE CrsCod=%ld" " AND %s='%s' AND AsgCod<>%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Field,Value,AsgCod) != 0); } @@ -1220,7 +1220,7 @@ static void Asg_ShowLstGrpsToEditAssignment (long AsgCod) /***** Get list of groups types and groups in this course *****/ Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS); - if (Gbl.Hierarchy.Crs.Grps.GrpTypes.Num) + if (Gbl.Crs.Grps.GrpTypes.Num) { /***** Start box and table *****/ fprintf (Gbl.F.Out,"" @@ -1245,14 +1245,14 @@ static void Asg_ShowLstGrpsToEditAssignment (long AsgCod) "" "" "", - Txt_The_whole_course,Gbl.Hierarchy.Crs.Crs.ShrtName); + Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName); /***** List the groups for each group type *****/ for (NumGrpTyp = 0; - NumGrpTyp < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num; + NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num; NumGrpTyp++) - if (Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) - Grp_ListGrpsToEditAsgAttSvyGam (&Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp], + if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) + Grp_ListGrpsToEditAsgAttSvyGam (&Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp], AsgCod,Grp_ASSIGNMENT); /***** End table and box *****/ @@ -1443,7 +1443,7 @@ static void Asg_CreateAssignment (struct Assignment *Asg,const char *Txt) " VALUES" " (%ld,%ld,FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld)," "'%s','%s','%s')", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod, Asg->TimeUTC[Dat_START_TIME], Asg->TimeUTC[Dat_END_TIME ], @@ -1452,7 +1452,7 @@ static void Asg_CreateAssignment (struct Assignment *Asg,const char *Txt) Txt); /***** Create groups *****/ - if (Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps) + if (Gbl.Crs.Grps.LstGrpsSel.NumGrps) Asg_CreateGrps (Asg->AsgCod); } @@ -1474,14 +1474,14 @@ static void Asg_UpdateAssignment (struct Assignment *Asg,const char *Txt) Asg->Title, Asg->Folder, Txt, - Asg->AsgCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + Asg->AsgCod,Gbl.Hierarchy.Crs.CrsCod); /***** Update groups *****/ /* Remove old groups */ Asg_RemoveAllTheGrpsAssociatedToAnAssignment (Asg->AsgCod); /* Create new groups */ - if (Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps) + if (Gbl.Crs.Grps.LstGrpsSel.NumGrps) Asg_CreateGrps (Asg->AsgCod); } @@ -1562,7 +1562,7 @@ static void Asg_CreateGrps (long AsgCod) /***** Create groups of the assignment *****/ for (NumGrpSel = 0; - NumGrpSel < Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps; + NumGrpSel < Gbl.Crs.Grps.LstGrpsSel.NumGrps; NumGrpSel++) /* Create group */ DB_QueryINSERT ("can not associate a group to an assignment", @@ -1571,7 +1571,7 @@ static void Asg_CreateGrps (long AsgCod) " VALUES" " (%ld,%ld)", AsgCod, - Gbl.Hierarchy.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]); + Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]); } /*****************************************************************************/ @@ -1632,7 +1632,7 @@ static void Asg_GetAndWriteNamesOfGrpsAssociatedToAsg (struct Assignment *Asg) } else fprintf (Gbl.F.Out,"%s %s", - Txt_The_whole_course,Gbl.Hierarchy.Crs.Crs.ShrtName); + Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName); fprintf (Gbl.F.Out,""); @@ -1781,7 +1781,7 @@ unsigned Asg_GetNumCoursesWithAssignments (Hie_Level_t Scope) "SELECT COUNT(DISTINCT CrsCod)" " FROM assignments" " WHERE CrsCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); break; default: Lay_WrongScopeExit (); @@ -1863,7 +1863,7 @@ unsigned Asg_GetNumAssignments (Hie_Level_t Scope,unsigned *NumNotif) "SELECT COUNT(*),SUM(NumNotif)" " FROM assignments" " WHERE CrsCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); break; default: Lay_WrongScopeExit (); diff --git a/swad_attendance.c b/swad_attendance.c index 9dccafc5..cf5654e6 100644 --- a/swad_attendance.c +++ b/swad_attendance.c @@ -226,7 +226,7 @@ static void Att_ShowAllAttEvents (void) Hlp_USERS_Attendance,Box_NOT_CLOSABLE); /***** Select whether show only my groups or all groups *****/ - if (Gbl.Hierarchy.Crs.Grps.NumGrps) + if (Gbl.Crs.Grps.NumGrps) { Set_StartSettingsHead (); Grp_ShowFormToSelWhichGrps (ActSeeAtt,Att_ParamsWhichGroupsToShow); @@ -478,7 +478,7 @@ static void Att_ShowOneAttEvent (struct AttendanceEvent *Att,bool ShowOnlyThisAt fprintf (Gbl.F.Out," COLOR%u",Gbl.RowEvenOdd); fprintf (Gbl.F.Out,"\">"); - if (Gbl.Hierarchy.Crs.Grps.NumGrps) + if (Gbl.Crs.Grps.NumGrps) Att_GetAndWriteNamesOfGrpsAssociatedToAttEvent (Att); fprintf (Gbl.F.Out,"
%s
", @@ -629,7 +629,7 @@ static void Att_GetListAttEvents (Att_OrderNewestOldest_t OrderNewestOldest) Att_FreeListAttEvents (); /***** Get list of attendance events from database *****/ - if (Gbl.Hierarchy.Crs.Grps.WhichGrps == Grp_ONLY_MY_GROUPS) + if (Gbl.Crs.Grps.WhichGrps == Grp_ONLY_MY_GROUPS) NumRows = DB_QuerySELECT (&mysql_res,"can not get attendance events", "SELECT AttCod" " FROM att_events" @@ -639,17 +639,17 @@ static void Att_GetListAttEvents (Att_OrderNewestOldest_t OrderNewestOldest) " WHERE crs_grp_usr.UsrCod=%ld" " AND att_grp.GrpCod=crs_grp_usr.GrpCod))" " ORDER BY %s", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, HiddenSubQuery[Gbl.Usrs.Me.Role.Logged], Gbl.Usrs.Me.UsrDat.UsrCod, OrderBySubQuery[Gbl.AttEvents.SelectedOrder][OrderNewestOldest]); - else // Gbl.Hierarchy.Crs.Grps.WhichGrps == Grp_ALL_GROUPS + else // Gbl.Crs.Grps.WhichGrps == Grp_ALL_GROUPS NumRows = DB_QuerySELECT (&mysql_res,"can not get attendance events", "SELECT AttCod" " FROM att_events" " WHERE CrsCod=%ld%s" " ORDER BY %s", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, HiddenSubQuery[Gbl.Usrs.Me.Role.Logged], OrderBySubQuery[Gbl.AttEvents.SelectedOrder][OrderNewestOldest]); @@ -689,7 +689,7 @@ static void Att_GetDataOfAttEventByCodAndCheckCrs (struct AttendanceEvent *Att) { if (Att_GetDataOfAttEventByCod (Att)) { - if (Att->CrsCod != Gbl.Hierarchy.Crs.Crs.CrsCod) + if (Att->CrsCod != Gbl.Hierarchy.Crs.CrsCod) Lay_ShowErrorAndExit ("Attendance event does not belong to current course."); } else // Attendance event not found @@ -821,7 +821,7 @@ static void Att_GetAttEventDescriptionFromDB (long AttCod,char Description[Cns_M NumRows = DB_QuerySELECT (&mysql_res,"can not get attendance event text", "SELECT Txt FROM att_events" " WHERE AttCod=%ld AND CrsCod=%ld", - AttCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + AttCod,Gbl.Hierarchy.Crs.CrsCod); /***** The result of the query must have one row or none *****/ if (NumRows == 1) @@ -966,7 +966,7 @@ void Att_HideAttEvent (void) DB_QueryUPDATE ("can not hide attendance event", "UPDATE att_events SET Hidden='Y'" " WHERE AttCod=%ld AND CrsCod=%ld", - Att.AttCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + Att.AttCod,Gbl.Hierarchy.Crs.CrsCod); /***** Write message to show the change made *****/ Ale_ShowAlert (Ale_SUCCESS,Txt_Event_X_is_now_hidden, @@ -996,7 +996,7 @@ void Att_ShowAttEvent (void) DB_QueryUPDATE ("can not show attendance event", "UPDATE att_events SET Hidden='N'" " WHERE AttCod=%ld AND CrsCod=%ld", - Att.AttCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + Att.AttCod,Gbl.Hierarchy.Crs.CrsCod); /***** Write message to show the change made *****/ Ale_ShowAlert (Ale_SUCCESS,Txt_Event_X_is_now_visible, @@ -1018,7 +1018,7 @@ static bool Att_CheckIfSimilarAttEventExists (const char *Field,const char *Valu "SELECT COUNT(*) FROM att_events" " WHERE CrsCod=%ld" " AND %s='%s' AND AttCod<>%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Field,Value,AttCod) != 0); } @@ -1061,7 +1061,7 @@ void Att_RequestCreatOrEditAttEvent (void) Att_ResetAttendanceEvent (&Att); /* Initialize some fields */ - Att.CrsCod = Gbl.Hierarchy.Crs.Crs.CrsCod; + Att.CrsCod = Gbl.Hierarchy.Crs.CrsCod; Att.UsrCod = Gbl.Usrs.Me.UsrDat.UsrCod; Att.TimeUTC[Att_START_TIME] = Gbl.StartExecutionTimeUTC; Att.TimeUTC[Att_END_TIME ] = Gbl.StartExecutionTimeUTC + (2 * 60 * 60); // +2 hours @@ -1187,7 +1187,7 @@ static void Att_ShowLstGrpsToEditAttEvent (long AttCod) /***** Get list of groups types and groups in this course *****/ Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS); - if (Gbl.Hierarchy.Crs.Grps.GrpTypes.Num) + if (Gbl.Crs.Grps.GrpTypes.Num) { /***** Start box and table *****/ fprintf (Gbl.F.Out,"" @@ -1211,14 +1211,14 @@ static void Att_ShowLstGrpsToEditAttEvent (long AttCod) "" "" "", - Txt_The_whole_course,Gbl.Hierarchy.Crs.Crs.ShrtName); + Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName); /***** List the groups for each group type *****/ for (NumGrpTyp = 0; - NumGrpTyp < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num; + NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num; NumGrpTyp++) - if (Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) - Grp_ListGrpsToEditAsgAttSvyGam (&Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp], + if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) + Grp_ListGrpsToEditAsgAttSvyGam (&Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp], AttCod,Grp_ATT_EVENT); /***** End table and box *****/ @@ -1343,7 +1343,7 @@ void Att_CreateAttEvent (struct AttendanceEvent *Att,const char *Description) " VALUES" " (%ld,'%c',%ld," "FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld),'%c','%s','%s')", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Att->Hidden ? 'Y' : 'N', Gbl.Usrs.Me.UsrDat.UsrCod, @@ -1355,7 +1355,7 @@ void Att_CreateAttEvent (struct AttendanceEvent *Att,const char *Description) Description); /***** Create groups *****/ - if (Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps) + if (Gbl.Crs.Grps.LstGrpsSel.NumGrps) Att_CreateGrps (Att->AttCod); } @@ -1381,14 +1381,14 @@ void Att_UpdateAttEvent (struct AttendanceEvent *Att,const char *Description) 'N', Att->Title, Description, - Att->AttCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + Att->AttCod,Gbl.Hierarchy.Crs.CrsCod); /***** Update groups *****/ /* Remove old groups */ Att_RemoveAllTheGrpsAssociatedToAnAttEvent (Att->AttCod); /* Create new groups */ - if (Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps) + if (Gbl.Crs.Grps.LstGrpsSel.NumGrps) Att_CreateGrps (Att->AttCod); } @@ -1470,7 +1470,7 @@ static void Att_CreateGrps (long AttCod) /***** Create groups of the attendance event *****/ for (NumGrpSel = 0; - NumGrpSel < Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps; + NumGrpSel < Gbl.Crs.Grps.LstGrpsSel.NumGrps; NumGrpSel++) /* Create group */ DB_QueryINSERT ("can not associate a group to an attendance event", @@ -1479,7 +1479,7 @@ static void Att_CreateGrps (long AttCod) " VALUES" " (%ld,%ld)", AttCod, - Gbl.Hierarchy.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]); + Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]); } /*****************************************************************************/ @@ -1550,7 +1550,7 @@ static void Att_GetAndWriteNamesOfGrpsAssociatedToAttEvent (struct AttendanceEve } else fprintf (Gbl.F.Out,"%s %s", - Txt_The_whole_course,Gbl.Hierarchy.Crs.Crs.ShrtName); + Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName); fprintf (Gbl.F.Out,""); @@ -1605,7 +1605,7 @@ static void Att_RemoveAttEventFromCurrentCrs (long AttCod) DB_QueryDELETE ("can not remove attendance event", "DELETE FROM att_events" " WHERE AttCod=%ld AND CrsCod=%ld", - AttCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + AttCod,Gbl.Hierarchy.Crs.CrsCod); } /*****************************************************************************/ @@ -1707,7 +1707,7 @@ unsigned Att_GetNumCoursesWithAttEvents (Hie_Level_t Scope) "SELECT COUNT(DISTINCT CrsCod)" " FROM att_events" " WHERE CrsCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); break; default: Lay_WrongScopeExit (); @@ -1778,7 +1778,7 @@ unsigned Att_GetNumAttEvents (Hie_Level_t Scope,unsigned *NumNotif) "SELECT COUNT(*),SUM(NumNotif)" " FROM att_events" " WHERE CrsCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); break; default: Lay_WrongScopeExit (); @@ -2211,7 +2211,7 @@ static void Att_PutParamsCodGrps (long AttCod) unsigned NumGrps; /***** Get groups associated to an attendance event from database *****/ - if (Gbl.Hierarchy.Crs.Grps.NumGrps) + if (Gbl.Crs.Grps.NumGrps) NumGrps = (unsigned) DB_QuerySELECT (&mysql_res,"can not get groups of an attendance event", "SELECT GrpCod FROM att_grp" " WHERE att_grp.AttCod=%ld", @@ -2245,7 +2245,7 @@ static void Att_PutParamsCodGrps (long AttCod) Par_PutHiddenParamChar ("AllGroups",'Y'); /***** Free structure that stores the query result *****/ - if (Gbl.Hierarchy.Crs.Grps.NumGrps) + if (Gbl.Crs.Grps.NumGrps) DB_FreeMySQLResult (&mysql_res); } @@ -3020,7 +3020,7 @@ static void Att_GetListSelectedAttCods (char **StrAttCodsSelected) else // No events selected { /***** Set which events will be marked as selected by default *****/ - if (!Gbl.Hierarchy.Crs.Grps.NumGrps || // Course has no groups + if (!Gbl.Crs.Grps.NumGrps || // Course has no groups Gbl.Usrs.ClassPhoto.AllGroups) // All groups selected /* Set all events as selected */ for (NumAttEvent = 0; @@ -3058,10 +3058,10 @@ static void Att_GetListSelectedAttCods (char **StrAttCodsSelected) if ((GrpCodInThisEvent = Str_ConvertStrCodToLongCod (row[0])) > 0) /* Check if this group is selected */ for (NumGrpSel = 0; - NumGrpSel < Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps && + NumGrpSel < Gbl.Crs.Grps.LstGrpsSel.NumGrps && !Gbl.AttEvents.Lst[NumAttEvent].Selected; NumGrpSel++) - if (Gbl.Hierarchy.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel] == GrpCodInThisEvent) + if (Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel] == GrpCodInThisEvent) Gbl.AttEvents.Lst[NumAttEvent].Selected = true; } else // This event is not associated to groups diff --git a/swad_calendar.c b/swad_calendar.c index ad9b1f1e..67b212a4 100644 --- a/swad_calendar.c +++ b/swad_calendar.c @@ -265,7 +265,7 @@ static void Cal_DrawCalendar (Act_Action_t ActionSeeCalendar, Lay_WriteHeaderClassPhoto (PrintView,false, Gbl.Hierarchy.Ins.InsCod, Gbl.Hierarchy.Deg.DegCod, - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); /***** Preference selector to change first day of week *****/ if (!PrintView) diff --git a/swad_centre.c b/swad_centre.c index 80aac377..ee5d3391 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -424,13 +424,13 @@ static void Ctr_Configuration (bool PrintView) " onchange=\"document.getElementById('%s').submit();\">", Gbl.Form.Id); for (NumIns = 0; - NumIns < Gbl.Inss.Num; + NumIns < Gbl.Hierarchy.Cty.Inss.Num; NumIns++) fprintf (Gbl.F.Out,"", - Gbl.Inss.Lst[NumIns].InsCod, - Gbl.Inss.Lst[NumIns].InsCod == Gbl.Hierarchy.Ins.InsCod ? " selected=\"selected\"" : + Gbl.Hierarchy.Cty.Inss.Lst[NumIns].InsCod, + Gbl.Hierarchy.Cty.Inss.Lst[NumIns].InsCod == Gbl.Hierarchy.Ins.InsCod ? " selected=\"selected\"" : "", - Gbl.Inss.Lst[NumIns].ShrtName); + Gbl.Hierarchy.Cty.Inss.Lst[NumIns].ShrtName); fprintf (Gbl.F.Out,""); Frm_EndForm (); @@ -801,7 +801,7 @@ static void Ctr_ListCentres (void) Box_StartBox (NULL,Gbl.Title,Ctr_PutIconsListingCentres, Hlp_INSTITUTION_Centres,Box_NOT_CLOSABLE); - if (Gbl.Ctrs.Num) // There are centres in the current institution + if (Gbl.Hierarchy.Ins.Ctrs.Num) // There are centres in the current institution { /***** Start table *****/ Tbl_StartTableWideMargin (2); @@ -809,9 +809,9 @@ static void Ctr_ListCentres (void) /***** Write all the centres and their nuber of teachers *****/ for (NumCtr = 0; - NumCtr < Gbl.Ctrs.Num; + NumCtr < Gbl.Hierarchy.Ins.Ctrs.Num; NumCtr++) - Ctr_ListOneCentreForSeeing (&(Gbl.Ctrs.Lst[NumCtr]),NumCtr + 1); + Ctr_ListOneCentreForSeeing (&(Gbl.Hierarchy.Ins.Ctrs.Lst[NumCtr]),NumCtr + 1); /***** End table *****/ Tbl_EndTable (); @@ -823,7 +823,7 @@ static void Ctr_ListCentres (void) if (Ctr_CheckIfICanCreateCentres ()) { Frm_StartForm (ActEdiCtr); - Btn_PutConfirmButton (Gbl.Ctrs.Num ? Txt_Create_another_centre : + Btn_PutConfirmButton (Gbl.Hierarchy.Ins.Ctrs.Num ? Txt_Create_another_centre : Txt_Create_centre); Frm_EndForm (); } @@ -965,7 +965,7 @@ static void Ctr_ListOneCentreForSeeing (struct Centre *Ctr,unsigned NumCtr) static void Ctr_GetParamCtrOrder (void) { - Gbl.Ctrs.SelectedOrder = (Ctr_Order_t) + Gbl.Hierarchy.Ins.Ctrs.SelectedOrder = (Ctr_Order_t) Par_GetParToUnsignedLong ("Order", 0, Ctr_NUM_ORDERS - 1, @@ -986,7 +986,7 @@ void Ctr_EditCentres (void) Plc_GetListPlaces (); /***** Get list of centres *****/ - Gbl.Ctrs.SelectedOrder = Ctr_ORDER_BY_CENTRE; + Gbl.Hierarchy.Ins.Ctrs.SelectedOrder = Ctr_ORDER_BY_CENTRE; Ctr_GetListCentres (Gbl.Hierarchy.Ins.InsCod); /***** Write menu to select country and institution *****/ @@ -1003,7 +1003,7 @@ void Ctr_EditCentres (void) Ctr_PutFormToCreateCentre (); /***** List current centres *****/ - if (Gbl.Ctrs.Num) + if (Gbl.Hierarchy.Ins.Ctrs.Num) Ctr_ListCentresForEdition (); /***** End box *****/ @@ -1081,23 +1081,23 @@ void Ctr_GetListCentres (long InsCod) " ORDER BY %s", InsCod, InsCod, - OrderBySubQuery[Gbl.Ctrs.SelectedOrder]); + OrderBySubQuery[Gbl.Hierarchy.Ins.Ctrs.SelectedOrder]); if (NumRows) // Centres found... { // NumRows should be equal to Deg->NumCourses - Gbl.Ctrs.Num = (unsigned) NumRows; + Gbl.Hierarchy.Ins.Ctrs.Num = (unsigned) NumRows; /***** Create list with courses in degree *****/ - if ((Gbl.Ctrs.Lst = (struct Centre *) calloc (NumRows,sizeof (struct Centre))) == NULL) + if ((Gbl.Hierarchy.Ins.Ctrs.Lst = (struct Centre *) calloc (NumRows,sizeof (struct Centre))) == NULL) Lay_NotEnoughMemoryExit (); /***** Get the centres *****/ for (NumCtr = 0; - NumCtr < Gbl.Ctrs.Num; + NumCtr < Gbl.Hierarchy.Ins.Ctrs.Num; NumCtr++) { - Ctr = &(Gbl.Ctrs.Lst[NumCtr]); + Ctr = &(Gbl.Hierarchy.Ins.Ctrs.Lst[NumCtr]); /* Get next centre */ row = mysql_fetch_row (mysql_res); @@ -1146,7 +1146,7 @@ void Ctr_GetListCentres (long InsCod) } } else - Gbl.Ctrs.Num = 0; + Gbl.Hierarchy.Ins.Ctrs.Num = 0; /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); @@ -1370,12 +1370,12 @@ static void Ctr_FreePhotoAttribution (char **PhotoAttribution) void Ctr_FreeListCentres (void) { - if (Gbl.Ctrs.Lst) + if (Gbl.Hierarchy.Ins.Ctrs.Lst) { /***** Free memory used by the list of courses in degree *****/ - free ((void *) Gbl.Ctrs.Lst); - Gbl.Ctrs.Lst = NULL; - Gbl.Ctrs.Num = 0; + free ((void *) Gbl.Hierarchy.Ins.Ctrs.Lst); + Gbl.Hierarchy.Ins.Ctrs.Lst = NULL; + Gbl.Hierarchy.Ins.Ctrs.Num = 0; } } @@ -1470,10 +1470,10 @@ static void Ctr_ListCentresForEdition (void) /***** Write all the centres *****/ for (NumCtr = 0; - NumCtr < Gbl.Ctrs.Num; + NumCtr < Gbl.Hierarchy.Ins.Ctrs.Num; NumCtr++) { - Ctr = &Gbl.Ctrs.Lst[NumCtr]; + Ctr = &Gbl.Hierarchy.Ins.Ctrs.Lst[NumCtr]; ICanEdit = Ctr_CheckIfICanEditACentre (Ctr); @@ -2610,13 +2610,13 @@ static void Ctr_PutHeadCentresForSeeing (bool OrderSelectable) Frm_StartForm (ActSeeCtr); Par_PutHiddenParamUnsigned ("Order",(unsigned) Order); Frm_LinkFormSubmit (Txt_CENTRES_HELP_ORDER[Order],"TIT_TBL",NULL); - if (Order == Gbl.Ctrs.SelectedOrder) + if (Order == Gbl.Hierarchy.Ins.Ctrs.SelectedOrder) fprintf (Gbl.F.Out,""); } fprintf (Gbl.F.Out,"%s",Txt_CENTRES_ORDER[Order]); if (OrderSelectable) { - if (Order == Gbl.Ctrs.SelectedOrder) + if (Order == Gbl.Hierarchy.Ins.Ctrs.SelectedOrder) fprintf (Gbl.F.Out,""); fprintf (Gbl.F.Out,""); Frm_EndForm (); diff --git a/swad_changelog.h b/swad_changelog.h index b548a894..d9e73378 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -464,10 +464,11 @@ En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 18.94.2 (2019-04-03)" +#define Log_PLATFORM_VERSION "SWAD 18.95 (2019-04-03)" #define CSS_FILE "swad18.92.css" #define JS_FILE "swad18.92.js" /* + Version 18.95: Apr 03, 2019 Code refactoring related to hierarchy. (241575 lines) Version 18.94.2: Apr 03, 2019 Remember last role even if last access is old. (241531 lines) Version 18.94.1: Apr 03, 2019 Remember last action and role after login only if last access is recent. (241526 lines) Version 18.94: Apr 03, 2019 Code refactoring related to hierarchy. (241513 lines) diff --git a/swad_connected.c b/swad_connected.c index b4c74236..39b1bcd3 100644 --- a/swad_connected.c +++ b/swad_connected.c @@ -308,7 +308,7 @@ void Con_ShowConnectedUsrsBelongingToCurrentCrs (void) struct ConnectedUsrs Usrs; /***** Trivial check *****/ - if (Gbl.Hierarchy.Crs.Crs.CrsCod <= 0) // No course selected + if (Gbl.Hierarchy.Crs.CrsCod <= 0) // No course selected return; /***** Start container *****/ @@ -320,7 +320,7 @@ void Con_ShowConnectedUsrsBelongingToCurrentCrs (void) // the list of connected users // is dynamically updated via AJAX Frm_LinkFormSubmitUnique (Txt_Connected_users,"CONNECTED_TXT"); - Str_Copy (CourseName,Gbl.Hierarchy.Crs.Crs.ShrtName, + Str_Copy (CourseName,Gbl.Hierarchy.Crs.ShrtName, Hie_MAX_BYTES_SHRT_NAME); Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_UNK,&Usrs); fprintf (Gbl.F.Out,"%u %s %s" @@ -439,7 +439,7 @@ void Con_UpdateMeInConnectedList (void) " (%ld,%u,%ld,NOW())", Gbl.Usrs.Me.UsrDat.UsrCod, (unsigned) Gbl.Usrs.Me.Role.Logged, - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); } /*****************************************************************************/ @@ -567,7 +567,7 @@ static void Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Role_t " WHERE crs_usr.CrsCod=%ld" " AND crs_usr.UsrCod=connected.UsrCod" " AND connected.UsrCod=usr_data.UsrCod", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); break; default: Lay_WrongScopeExit (); @@ -678,7 +678,7 @@ static void Con_GetNumConnectedUsrsWithARoleBelongingCurrentLocation (Rol_Role_t " AND crs_usr.Role=%u" " AND crs_usr.UsrCod=connected.UsrCod" " AND connected.UsrCod=usr_data.UsrCod", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, (unsigned) Role); break; default: @@ -737,7 +737,7 @@ static void Con_ComputeConnectedUsrsWithARoleCurrentCrsOneByOne (Rol_Role_t Role " WHERE crs_usr.CrsCod=%ld AND crs_usr.Role=%u" " AND crs_usr.UsrCod=connected.UsrCod" " ORDER BY Dif", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, (unsigned) Role); Gbl.Usrs.Connected.NumUsrs += (unsigned) NumRows; Gbl.Usrs.Connected.NumUsrsToList += (unsigned) NumRows; @@ -756,7 +756,7 @@ static void Con_ComputeConnectedUsrsWithARoleCurrentCrsOneByOne (Rol_Role_t Role /* Get course code (row[1]) */ Gbl.Usrs.Connected.Lst[NumUsr].ThisCrs = (Str_ConvertStrCodToLongCod (row[1]) == - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); /* Compute elapsed time from last access */ if (sscanf (row[2],"%ld",&Gbl.Usrs.Connected.Lst[NumUsr].TimeDiff) != 1) @@ -998,7 +998,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R " AND crs_usr.Role=%u" " AND crs_usr.UsrCod=connected.UsrCod" " ORDER BY Dif", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, (unsigned) Role); break; default: @@ -1028,7 +1028,7 @@ static void Con_ShowConnectedUsrsCurrentLocationOneByOneOnMainZone (Rol_Role_t R { /* Get course code (row[1]) */ ThisCrs = (Str_ConvertStrCodToLongCod (row[1]) == - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); /* Compute time from last access */ if (sscanf (row[2],"%ld",&TimeDiff) != 1) diff --git a/swad_country.c b/swad_country.c index 3f913184..dd528261 100644 --- a/swad_country.c +++ b/swad_country.c @@ -532,9 +532,9 @@ void Cty_ListCountries2 (void) /***** Write all the countries and their number of users and institutions *****/ for (NumCty = 0; - NumCty < Gbl.Ctys.Num; + NumCty < Gbl.Hierarchy.Sys.Ctys.Num; NumCty++) - Cty_ListOneCountryForSeeing (&Gbl.Ctys.Lst[NumCty],NumCty + 1); + Cty_ListOneCountryForSeeing (&Gbl.Hierarchy.Sys.Ctys.Lst[NumCty],NumCty + 1); /***** Separation row *****/ fprintf (Gbl.F.Out,"" @@ -654,13 +654,13 @@ static void Cty_PutHeadCountriesForSeeing (bool OrderSelectable) Frm_StartForm (ActSeeCty); Par_PutHiddenParamUnsigned ("Order",(unsigned) Order); Frm_LinkFormSubmit (Txt_COUNTRIES_HELP_ORDER[Order],"TIT_TBL",NULL); - if (Order == Gbl.Ctys.SelectedOrder) + if (Order == Gbl.Hierarchy.Sys.Ctys.SelectedOrder) fprintf (Gbl.F.Out,""); } fprintf (Gbl.F.Out,"%s",Txt_COUNTRIES_ORDER[Order]); if (OrderSelectable) { - if (Order == Gbl.Ctys.SelectedOrder) + if (Order == Gbl.Hierarchy.Sys.Ctys.SelectedOrder) fprintf (Gbl.F.Out,""); fprintf (Gbl.F.Out,""); Frm_EndForm (); @@ -738,7 +738,7 @@ static void Cty_ListOneCountryForSeeing (struct Country *Cty,unsigned NumCty) "" "", BgColor,Cty->NumUsrsWhoClaimToBelongToCty, - BgColor,Cty->NumInss, + BgColor,Cty->Inss.Num, BgColor,Cty->NumCtrs, BgColor,Cty->NumDegs, BgColor,Cty->NumCrss, @@ -902,17 +902,17 @@ void Cty_WriteScriptGoogleGeochart (void) /***** Write all the countries and their number of users and institutions *****/ for (NumCty = 0; - NumCty < Gbl.Ctys.Num; + NumCty < Gbl.Hierarchy.Sys.Ctys.Num; NumCty++) - if (Gbl.Ctys.Lst[NumCty].NumUsrsWhoClaimToBelongToCty) + if (Gbl.Hierarchy.Sys.Ctys.Lst[NumCty].NumUsrsWhoClaimToBelongToCty) { /* Write data of this country */ fprintf (Gbl.F.Out," ['%s', %u, %u],\n", - Gbl.Ctys.Lst[NumCty].Alpha2, - Gbl.Ctys.Lst[NumCty].NumUsrsWhoClaimToBelongToCty, - Gbl.Ctys.Lst[NumCty].NumInss); - if (Gbl.Ctys.Lst[NumCty].NumUsrsWhoClaimToBelongToCty > MaxUsrsInCountry) - MaxUsrsInCountry = Gbl.Ctys.Lst[NumCty].NumUsrsWhoClaimToBelongToCty; + Gbl.Hierarchy.Sys.Ctys.Lst[NumCty].Alpha2, + Gbl.Hierarchy.Sys.Ctys.Lst[NumCty].NumUsrsWhoClaimToBelongToCty, + Gbl.Hierarchy.Sys.Ctys.Lst[NumCty].Inss.Num); + if (Gbl.Hierarchy.Sys.Ctys.Lst[NumCty].NumUsrsWhoClaimToBelongToCty > MaxUsrsInCountry) + MaxUsrsInCountry = Gbl.Hierarchy.Sys.Ctys.Lst[NumCty].NumUsrsWhoClaimToBelongToCty; NumCtysWithUsrs++; } @@ -938,7 +938,7 @@ void Cty_WriteScriptGoogleGeochart (void) static void Cty_GetParamCtyOrder (void) { - Gbl.Ctys.SelectedOrder = (Cty_Order_t) + Gbl.Hierarchy.Sys.Ctys.SelectedOrder = (Cty_Order_t) Par_GetParToUnsignedLong ("Order", 0, Cty_NUM_ORDERS - 1, @@ -955,7 +955,7 @@ void Cty_EditCountries (void) extern const char *Txt_Countries; /***** Get list of countries *****/ - Gbl.Ctys.SelectedOrder = Cty_ORDER_BY_COUNTRY; + Gbl.Hierarchy.Sys.Ctys.SelectedOrder = Cty_ORDER_BY_COUNTRY; Cty_GetListCountries (Cty_GET_EXTRA_DATA); /***** Write menu to select country *****/ @@ -969,7 +969,7 @@ void Cty_EditCountries (void) Cty_PutFormToCreateCountry (); /***** Forms to edit current countries *****/ - if (Gbl.Ctys.Num) + if (Gbl.Hierarchy.Sys.Ctys.Num) Cty_ListCountriesForEdition (); /***** End box *****/ @@ -1070,7 +1070,7 @@ void Cty_GetListCountries (Cty_GetExtraData_t GetExtraData) Cty_MAX_BYTES_SUBQUERY_CTYS); } - switch (Gbl.Ctys.SelectedOrder) + switch (Gbl.Hierarchy.Sys.Ctys.SelectedOrder) { case Cty_ORDER_BY_COUNTRY: if (asprintf (&OrderBySubQuery,"Name_%s", @@ -1107,18 +1107,18 @@ void Cty_GetListCountries (Cty_GetExtraData_t GetExtraData) if (NumRows) // Countries found... { - Gbl.Ctys.Num = (unsigned) NumRows; + Gbl.Hierarchy.Sys.Ctys.Num = (unsigned) NumRows; /***** Create list with countries *****/ - if ((Gbl.Ctys.Lst = (struct Country *) calloc (NumRows,sizeof (struct Country))) == NULL) + if ((Gbl.Hierarchy.Sys.Ctys.Lst = (struct Country *) calloc (NumRows,sizeof (struct Country))) == NULL) Lay_NotEnoughMemoryExit (); /***** Get the countries *****/ for (NumCty = 0; - NumCty < Gbl.Ctys.Num; + NumCty < Gbl.Hierarchy.Sys.Ctys.Num; NumCty++) { - Cty = &(Gbl.Ctys.Lst[NumCty]); + Cty = &(Gbl.Hierarchy.Sys.Ctys.Lst[NumCty]); /* Get next country */ row = mysql_fetch_row (mysql_res); @@ -1142,7 +1142,7 @@ void Cty_GetListCountries (Cty_GetExtraData_t GetExtraData) Cty->WWW[Lan][0] = '\0'; } Cty->NumUsrsWhoClaimToBelongToCty = 0; - Cty->NumInss = Cty->NumCtrs = Cty->NumDegs = Cty->NumCrss = 0; + Cty->Inss.Num = Cty->NumCtrs = Cty->NumDegs = Cty->NumCrss = 0; Cty->NumUsrs = 0; /* Get the name of the country in current language */ @@ -1167,7 +1167,7 @@ void Cty_GetListCountries (Cty_GetExtraData_t GetExtraData) Cty->NumUsrsWhoClaimToBelongToCty = 0; /* Get number of institutions in this country */ - Cty->NumInss = Ins_GetNumInssInCty (Cty->CtyCod); + Cty->Inss.Num = Ins_GetNumInssInCty (Cty->CtyCod); /* Get number of centres in this country */ Cty->NumCtrs = Ctr_GetNumCtrsInCty (Cty->CtyCod); @@ -1185,7 +1185,7 @@ void Cty_GetListCountries (Cty_GetExtraData_t GetExtraData) } } else - Gbl.Ctys.Num = 0; + Gbl.Hierarchy.Sys.Ctys.Num = 0; /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); @@ -1313,7 +1313,7 @@ bool Cty_GetDataOfCountryByCod (struct Country *Cty,Cty_GetExtraData_t GetExtraD Cty->WWW[Lan][0] = '\0'; } Cty->NumUsrsWhoClaimToBelongToCty = 0; - Cty->NumInss = Cty->NumCtrs = Cty->NumDegs = Cty->NumCrss = 0; + Cty->Inss.Num = Cty->NumCtrs = Cty->NumDegs = Cty->NumCrss = 0; Cty->NumUsrs = 0; /***** Check if country code is correct *****/ @@ -1433,7 +1433,7 @@ bool Cty_GetDataOfCountryByCod (struct Country *Cty,Cty_GetExtraData_t GetExtraD Cty->NumUsrs = Usr_GetNumUsrsInCrssOfCty (Rol_UNK,Cty->CtyCod); // Here Rol_UNK means "all users" /* Get number of institutions in this country */ - Cty->NumInss = Ins_GetNumInssInCty (Cty->CtyCod); + Cty->Inss.Num = Ins_GetNumInssInCty (Cty->CtyCod); break; } @@ -1558,12 +1558,12 @@ static void Cty_FreeMapAttribution (char **MapAttribution) void Cty_FreeListCountries (void) { - if (Gbl.Ctys.Lst) + if (Gbl.Hierarchy.Sys.Ctys.Lst) { /***** Free memory used by the list of courses in institution *****/ - free ((void *) Gbl.Ctys.Lst); - Gbl.Ctys.Lst = NULL; - Gbl.Ctys.Num = 0; + free ((void *) Gbl.Hierarchy.Sys.Ctys.Lst); + Gbl.Hierarchy.Sys.Ctys.Lst = NULL; + Gbl.Hierarchy.Sys.Ctys.Num = 0; } } @@ -1584,16 +1584,16 @@ static void Cty_ListCountriesForEdition (void) /***** Write all the countries *****/ for (NumCty = 0; - NumCty < Gbl.Ctys.Num; + NumCty < Gbl.Hierarchy.Sys.Ctys.Num; NumCty++) { - Cty = &Gbl.Ctys.Lst[NumCty]; + Cty = &Gbl.Hierarchy.Sys.Ctys.Lst[NumCty]; /* Put icon to remove country */ fprintf (Gbl.F.Out,"" "", 1 + Lan_NUM_LANGUAGES); - if (Cty->NumInss || + if (Cty->Inss.Num || Cty->NumUsrsWhoClaimToBelongToCty || Cty->NumUsrs) // Country has institutions or users ==> deletion forbidden Ico_PutIconRemovalNotAllowed (); @@ -1633,7 +1633,7 @@ static void Cty_ListCountriesForEdition (void) "%u" "" "", - 1 + Lan_NUM_LANGUAGES,Cty->NumInss); + 1 + Lan_NUM_LANGUAGES,Cty->Inss.Num); /* Country name in several languages */ for (Lan = (Lan_Language_t) 1; @@ -1737,7 +1737,7 @@ void Cty_RemoveCountry (void) Cty_GetDataOfCountryByCod (&Cty,Cty_GET_EXTRA_DATA); /***** Check if this country has users *****/ - if (Cty.NumInss || + if (Cty.Inss.Num || Cty.NumUsrsWhoClaimToBelongToCty || Cty.NumUsrs) // Country has institutions or users ==> don't remove Ale_ShowAlert (Ale_WARNING,Txt_You_can_not_remove_a_country_with_institutions_or_users); diff --git a/swad_country.h b/swad_country.h index b540f62d..591708cb 100644 --- a/swad_country.h +++ b/swad_country.h @@ -32,6 +32,7 @@ #include "swad_action.h" #include "swad_hierarchy.h" +#include "swad_institution.h" #include "swad_language.h" #include "swad_role_type.h" @@ -50,12 +51,17 @@ struct Country char Alpha2[2 + 1]; char Name[1 + Lan_NUM_LANGUAGES][Cty_MAX_BYTES_NAME + 1]; char WWW [1 + Lan_NUM_LANGUAGES][Cns_MAX_BYTES_WWW + 1]; - unsigned NumUsrsWhoClaimToBelongToCty; - unsigned NumInss; + struct + { + unsigned Num; // Number of institutions in this country + struct Instit *Lst; // List of institutions in this country + Ins_Order_t SelectedOrder; + } Inss; unsigned NumCtrs; unsigned NumDegs; unsigned NumCrss; - unsigned NumUsrs; // Number of users in courses of the institution + unsigned NumUsrs; // Number of users in courses of the institution + unsigned NumUsrsWhoClaimToBelongToCty; }; #define Cty_NUM_ORDERS 2 diff --git a/swad_course.c b/swad_course.c index bd36d3e6..4de9848e 100644 --- a/swad_course.c +++ b/swad_course.c @@ -188,7 +188,7 @@ static void Crs_Configuration (bool PrintView) bool PutLink; /***** Trivial check *****/ - if (Gbl.Hierarchy.Crs.Crs.CrsCod <= 0) // No course selected + if (Gbl.Hierarchy.Crs.CrsCod <= 0) // No course selected return; /***** Messages and links above the box *****/ @@ -226,7 +226,7 @@ static void Crs_Configuration (bool PrintView) fprintf (Gbl.F.Out,""); fprintf (Gbl.F.Out,"
%s" "", - Gbl.Hierarchy.Crs.Crs.FullName); + Gbl.Hierarchy.Crs.FullName); /***** Start table *****/ Tbl_StartTableWide (2); @@ -293,12 +293,12 @@ static void Crs_Configuration (bool PrintView) " class=\"INPUT_FULL_NAME\"" " onchange=\"document.getElementById('%s').submit();\" />", Hie_MAX_CHARS_FULL_NAME, - Gbl.Hierarchy.Crs.Crs.FullName, + Gbl.Hierarchy.Crs.FullName, Gbl.Form.Id); Frm_EndForm (); } else // I can not edit course full name - fprintf (Gbl.F.Out,"%s",Gbl.Hierarchy.Crs.Crs.FullName); + fprintf (Gbl.F.Out,"%s",Gbl.Hierarchy.Crs.FullName); fprintf (Gbl.F.Out,"" ""); @@ -322,12 +322,12 @@ static void Crs_Configuration (bool PrintView) " class=\"INPUT_SHORT_NAME\"" " onchange=\"document.getElementById('%s').submit();\" />", Hie_MAX_CHARS_SHRT_NAME, - Gbl.Hierarchy.Crs.Crs.ShrtName, + Gbl.Hierarchy.Crs.ShrtName, Gbl.Form.Id); Frm_EndForm (); } else // I can not edit course short name - fprintf (Gbl.F.Out,"%s",Gbl.Hierarchy.Crs.Crs.ShrtName); + fprintf (Gbl.F.Out,"%s",Gbl.Hierarchy.Crs.ShrtName); fprintf (Gbl.F.Out,"" ""); @@ -351,7 +351,7 @@ static void Crs_Configuration (bool PrintView) Year++) fprintf (Gbl.F.Out,"", Year, - Year == Gbl.Hierarchy.Crs.Crs.Year ? " selected=\"selected\"" : + Year == Gbl.Hierarchy.Crs.Year ? " selected=\"selected\"" : "", Txt_YEAR_OF_DEGREE[Year]); fprintf (Gbl.F.Out,""); @@ -359,7 +359,7 @@ static void Crs_Configuration (bool PrintView) } else fprintf (Gbl.F.Out,"%s", - Gbl.Hierarchy.Crs.Crs.Year ? Txt_YEAR_OF_DEGREE[Gbl.Hierarchy.Crs.Crs.Year] : + Gbl.Hierarchy.Crs.Year ? Txt_YEAR_OF_DEGREE[Gbl.Hierarchy.Crs.Year] : Txt_Not_applicable); fprintf (Gbl.F.Out,"" ""); @@ -383,12 +383,12 @@ static void Crs_Configuration (bool PrintView) " onchange=\"document.getElementById('%s').submit();\" />", Crs_MAX_CHARS_INSTITUTIONAL_CRS_COD, Crs_MAX_CHARS_INSTITUTIONAL_CRS_COD, - Gbl.Hierarchy.Crs.Crs.InstitutionalCrsCod, + Gbl.Hierarchy.Crs.InstitutionalCrsCod, Gbl.Form.Id); Frm_EndForm (); } else - fprintf (Gbl.F.Out,"%s",Gbl.Hierarchy.Crs.Crs.InstitutionalCrsCod); + fprintf (Gbl.F.Out,"%s",Gbl.Hierarchy.Crs.InstitutionalCrsCod); fprintf (Gbl.F.Out,"" ""); @@ -403,7 +403,7 @@ static void Crs_Configuration (bool PrintView) "", The_ClassFormInBox[Gbl.Prefs.Theme], Txt_Internal_code, - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); } /***** Link to the course *****/ @@ -420,10 +420,10 @@ static void Crs_Configuration (bool PrintView) Txt_Shortcut, Cfg_URL_SWAD_CGI, Lan_STR_LANG_ID[Gbl.Prefs.Language], - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Cfg_URL_SWAD_CGI, Lan_STR_LANG_ID[Gbl.Prefs.Language], - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); if (PrintView) { @@ -435,7 +435,7 @@ static void Crs_Configuration (bool PrintView) "", The_ClassFormInBox[Gbl.Prefs.Theme], Txt_QR_code); - QR_LinkTo (250,"crs",Gbl.Hierarchy.Crs.Crs.CrsCod); + QR_LinkTo (250,"crs",Gbl.Hierarchy.Crs.CrsCod); fprintf (Gbl.F.Out,"" ""); } @@ -447,8 +447,8 @@ static void Crs_Configuration (bool PrintView) Crs_ShowNumUsrsInCrs (Rol_STD); /***** Indicators *****/ - NumIndicatorsFromDB = Ind_GetNumIndicatorsCrsFromDB (Gbl.Hierarchy.Crs.Crs.CrsCod); - Ind_ComputeAndStoreIndicatorsCrs (Gbl.Hierarchy.Crs.Crs.CrsCod, + NumIndicatorsFromDB = Ind_GetNumIndicatorsCrsFromDB (Gbl.Hierarchy.Crs.CrsCod); + Ind_ComputeAndStoreIndicatorsCrs (Gbl.Hierarchy.Crs.CrsCod, NumIndicatorsFromDB,&Indicators); fprintf (Gbl.F.Out,"" "" @@ -511,7 +511,7 @@ static void Crs_ShowNumUsrsInCrs (Rol_Role_t Role) "", The_ClassFormInBox[Gbl.Prefs.Theme], Txt_ROLES_PLURAL_Abc[Role][Usr_SEX_UNKNOWN], - Gbl.Hierarchy.Crs.Crs.NumUsrs[Role]); + Gbl.Hierarchy.Crs.NumUsrs[Role]); } /*****************************************************************************/ @@ -741,7 +741,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void) /***** Write link to course *****/ Highlight = (Gbl.Hierarchy.Level == Hie_CRS && - Gbl.Hierarchy.Crs.Crs.CrsCod == Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod == Crs.CrsCod); fprintf (Gbl.F.Out,"
  • ", Highlight ? ClassHighlight : ClassNormal); @@ -912,7 +912,7 @@ void Crs_WriteSelectorOfCourse (void) fprintf (Gbl.F.Out," disabled=\"disabled\""); fprintf (Gbl.F.Out,">" "", Txt_Course); @@ -942,7 +942,7 @@ void Crs_WriteSelectorOfCourse (void) /* Write option */ fprintf (Gbl.F.Out,"",row[1]); } @@ -1017,7 +1017,7 @@ static void Crs_GetListCoursesInCurrentDegree (Crs_WhatCourses_t WhatCourses) if (NumCrss) // Courses found... { /***** Create list with courses in degree *****/ - if ((Gbl.Hierarchy.Deg.LstCrss = (struct Course *) calloc ((size_t) NumCrss, + if ((Gbl.Hierarchy.Deg.Crss.Lst = (struct Course *) calloc ((size_t) NumCrss, sizeof (struct Course))) == NULL) Lay_NotEnoughMemoryExit (); @@ -1026,7 +1026,7 @@ static void Crs_GetListCoursesInCurrentDegree (Crs_WhatCourses_t WhatCourses) NumCrs < NumCrss; NumCrs++) { - Crs = &(Gbl.Hierarchy.Deg.LstCrss[NumCrs]); + Crs = &(Gbl.Hierarchy.Deg.Crss.Lst[NumCrs]); /* Get next course */ row = mysql_fetch_row (mysql_res); @@ -1034,7 +1034,7 @@ static void Crs_GetListCoursesInCurrentDegree (Crs_WhatCourses_t WhatCourses) } } - Gbl.Hierarchy.Deg.NumCrss = NumCrss; + Gbl.Hierarchy.Deg.Crss.Num = NumCrss; /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); @@ -1046,11 +1046,11 @@ static void Crs_GetListCoursesInCurrentDegree (Crs_WhatCourses_t WhatCourses) void Crs_FreeListCoursesInDegree (struct Degree *Deg) { - if (Deg->LstCrss) + if (Deg->Crss.Lst) { /***** Free memory used by the list of courses in degree *****/ - free ((void *) Deg->LstCrss); - Deg->LstCrss = NULL; + free ((void *) Deg->Crss.Lst); + Deg->Crss.Lst = NULL; } } @@ -1082,7 +1082,7 @@ void Crs_WriteSelectorMyCoursesInBreadcrumb (void) Gbl.Form.Id); /***** Write an option when no course selected *****/ - if (Gbl.Hierarchy.Crs.Crs.CrsCod <= 0) // No course selected + if (Gbl.Hierarchy.Crs.CrsCod <= 0) // No course selected fprintf (Gbl.F.Out,"",CrsShortName); } @@ -1128,8 +1128,8 @@ void Crs_WriteSelectorMyCoursesInBreadcrumb (void) " disabled=\"disabled\" selected=\"selected\">" "%s" "", - Gbl.Hierarchy.Crs.Crs.CrsCod, - Gbl.Hierarchy.Crs.Crs.ShrtName); + Gbl.Hierarchy.Crs.CrsCod, + Gbl.Hierarchy.Crs.ShrtName); /***** End form *****/ fprintf (Gbl.F.Out,""); @@ -1156,7 +1156,7 @@ static void Crs_ListCourses (void) Box_StartBox (NULL,Gbl.Title,Crs_PutIconsListCourses, Hlp_DEGREE_Courses,Box_NOT_CLOSABLE); - if (Gbl.Hierarchy.Deg.NumCrss) // There are courses in the current degree + if (Gbl.Hierarchy.Deg.Crss.Num) // There are courses in the current degree { /***** Start table *****/ Tbl_StartTableWideMargin (2); @@ -1180,7 +1180,7 @@ static void Crs_ListCourses (void) if (Crs_CheckIfICanCreateCourses ()) { Frm_StartForm (ActEdiCrs); - Btn_PutConfirmButton (Gbl.Hierarchy.Deg.NumCrss ? Txt_Create_another_course : + Btn_PutConfirmButton (Gbl.Hierarchy.Deg.Crss.Num ? Txt_Create_another_course : Txt_Create_course); Frm_EndForm (); } @@ -1244,10 +1244,10 @@ static bool Crs_ListCoursesOfAYearForSeeing (unsigned Year) /***** Write all the courses of this year *****/ for (NumCrs = 0; - NumCrs < Gbl.Hierarchy.Deg.NumCrss; + NumCrs < Gbl.Hierarchy.Deg.Crss.Num; NumCrs++) { - Crs = &(Gbl.Hierarchy.Deg.LstCrss[NumCrs]); + Crs = &(Gbl.Hierarchy.Deg.Crss.Lst[NumCrs]); if (Crs->Year == Year) // The year of the course is this? { ThisYearHasCourses = true; @@ -1363,7 +1363,7 @@ void Crs_EditCourses (void) Crs_PutFormToCreateCourse (); /***** Forms to edit current courses *****/ - if (Gbl.Hierarchy.Deg.NumCrss) + if (Gbl.Hierarchy.Deg.Crss.Num) Crs_ListCoursesForEdition (); /***** End box *****/ @@ -1446,10 +1446,10 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year) /***** List courses of a given year *****/ for (NumCrs = 0; - NumCrs < Gbl.Hierarchy.Deg.NumCrss; + NumCrs < Gbl.Hierarchy.Deg.Crss.Num; NumCrs++) { - Crs = &(Gbl.Hierarchy.Deg.LstCrss[NumCrs]); + Crs = &(Gbl.Hierarchy.Deg.Crss.Lst[NumCrs]); if (Crs->Year == Year) { ICanEdit = Crs_CheckIfICanEdit (Crs); @@ -1699,7 +1699,7 @@ static void Crs_PutFormToCreateCourse (void) " class=\"INPUT_INS_CODE\" />" "", Crs_MAX_CHARS_INSTITUTIONAL_CRS_COD, - Gbl.Degs.EditingCrs.InstitutionalCrsCod); + Gbl.Crss.EditingCrs.InstitutionalCrsCod); /***** Year *****/ fprintf (Gbl.F.Out,"" @@ -1709,7 +1709,7 @@ static void Crs_PutFormToCreateCourse (void) Year++) fprintf (Gbl.F.Out,"", Year, - Year == Gbl.Degs.EditingCrs.Year ? " selected=\"selected\"" : + Year == Gbl.Crss.EditingCrs.Year ? " selected=\"selected\"" : "", Txt_YEAR_OF_DEGREE[Year]); fprintf (Gbl.F.Out,"" @@ -1722,7 +1722,7 @@ static void Crs_PutFormToCreateCourse (void) " class=\"INPUT_SHORT_NAME\"" " required=\"required\" />" "", - Hie_MAX_CHARS_SHRT_NAME,Gbl.Degs.EditingCrs.ShrtName); + Hie_MAX_CHARS_SHRT_NAME,Gbl.Crss.EditingCrs.ShrtName); /***** Course full name *****/ fprintf (Gbl.F.Out,"" @@ -1731,7 +1731,7 @@ static void Crs_PutFormToCreateCourse (void) " class=\"INPUT_FULL_NAME\"" " required=\"required\" />" "", - Hie_MAX_CHARS_FULL_NAME,Gbl.Degs.EditingCrs.FullName); + Hie_MAX_CHARS_FULL_NAME,Gbl.Crss.EditingCrs.FullName); /***** Current number of teachers in this course *****/ fprintf (Gbl.F.Out,"" @@ -1884,29 +1884,29 @@ static void Crs_RecFormRequestOrCreateCrs (unsigned Status) /***** Get parameters from form *****/ /* Set course degree */ - Deg.DegCod = Gbl.Degs.EditingCrs.DegCod = Gbl.Hierarchy.Deg.DegCod; + Deg.DegCod = Gbl.Crss.EditingCrs.DegCod = Gbl.Hierarchy.Deg.DegCod; /* Get parameters of the new course */ - Crs_GetParamsNewCourse (&Gbl.Degs.EditingCrs); + Crs_GetParamsNewCourse (&Gbl.Crss.EditingCrs); /***** Check if year is correct *****/ Deg_GetDataOfDegreeByCod (&Deg); - if (Gbl.Degs.EditingCrs.Year <= Deg_MAX_YEARS_PER_DEGREE) // If year is valid + if (Gbl.Crss.EditingCrs.Year <= Deg_MAX_YEARS_PER_DEGREE) // If year is valid { - if (Gbl.Degs.EditingCrs.ShrtName[0] && - Gbl.Degs.EditingCrs.FullName[0]) // If there's a course name + if (Gbl.Crss.EditingCrs.ShrtName[0] && + Gbl.Crss.EditingCrs.FullName[0]) // If there's a course name { /***** If name of course was in database... *****/ - if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.Degs.EditingCrs.ShrtName,-1L, - Gbl.Degs.EditingCrs.DegCod,Gbl.Degs.EditingCrs.Year)) + if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.Crss.EditingCrs.ShrtName,-1L, + Gbl.Crss.EditingCrs.DegCod,Gbl.Crss.EditingCrs.Year)) Ale_CreateAlert (Ale_WARNING,NULL, Txt_The_course_X_already_exists, - Gbl.Degs.EditingCrs.ShrtName); - else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.Degs.EditingCrs.FullName,-1L, - Gbl.Degs.EditingCrs.DegCod,Gbl.Degs.EditingCrs.Year)) + Gbl.Crss.EditingCrs.ShrtName); + else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.Crss.EditingCrs.FullName,-1L, + Gbl.Crss.EditingCrs.DegCod,Gbl.Crss.EditingCrs.Year)) Ale_CreateAlert (Ale_WARNING,NULL, Txt_The_course_X_already_exists, - Gbl.Degs.EditingCrs.FullName); + Gbl.Crss.EditingCrs.FullName); else // Add new requested course to database Crs_CreateCourse (Status); } @@ -1917,7 +1917,7 @@ static void Crs_RecFormRequestOrCreateCrs (unsigned Status) else // Year not valid Ale_CreateAlert (Ale_WARNING,NULL, Txt_The_year_X_is_not_allowed, - Gbl.Degs.EditingCrs.Year); + Gbl.Crss.EditingCrs.Year); } /*****************************************************************************/ @@ -1946,14 +1946,14 @@ static void Crs_GetParamsNewCourse (struct Course *Crs) /*****************************************************************************/ /************* Add a new requested course to pending requests ****************/ /*****************************************************************************/ -// Gbl.Degs.EditingCrs must hold the course beeing edited +// Gbl.Crss.EditingCrs must hold the course beeing edited static void Crs_CreateCourse (unsigned Status) { extern const char *Txt_Created_new_course_X; /***** Insert new course into pending requests *****/ - Gbl.Degs.EditingCrs.CrsCod = + Gbl.Crss.EditingCrs.CrsCod = DB_QueryINSERTandReturnCode ("can not create a new course", "INSERT INTO courses" " (DegCod,Year,InsCrsCod,Status,RequesterUsrCod," @@ -1961,17 +1961,17 @@ static void Crs_CreateCourse (unsigned Status) " VALUES" " (%ld,%u,'%s',%u,%ld," "'%s','%s')", - Gbl.Degs.EditingCrs.DegCod,Gbl.Degs.EditingCrs.Year, - Gbl.Degs.EditingCrs.InstitutionalCrsCod, + Gbl.Crss.EditingCrs.DegCod,Gbl.Crss.EditingCrs.Year, + Gbl.Crss.EditingCrs.InstitutionalCrsCod, Status, Gbl.Usrs.Me.UsrDat.UsrCod, - Gbl.Degs.EditingCrs.ShrtName, - Gbl.Degs.EditingCrs.FullName); + Gbl.Crss.EditingCrs.ShrtName, + Gbl.Crss.EditingCrs.FullName); /***** Create success message *****/ Ale_CreateAlert (Ale_SUCCESS,NULL, Txt_Created_new_course_X, - Gbl.Degs.EditingCrs.FullName); + Gbl.Crss.EditingCrs.FullName); } /*****************************************************************************/ @@ -2323,19 +2323,19 @@ void Crs_ChangeInsCrsCodInConfig (void) Par_GetParToText ("InsCrsCod",NewInstitutionalCrsCod,Crs_MAX_BYTES_INSTITUTIONAL_CRS_COD); /***** Change the institutional course code *****/ - if (strcmp (NewInstitutionalCrsCod,Gbl.Hierarchy.Crs.Crs.InstitutionalCrsCod)) + if (strcmp (NewInstitutionalCrsCod,Gbl.Hierarchy.Crs.InstitutionalCrsCod)) { - Crs_UpdateInstitutionalCrsCod (&Gbl.Hierarchy.Crs.Crs,NewInstitutionalCrsCod); + Crs_UpdateInstitutionalCrsCod (&Gbl.Hierarchy.Crs,NewInstitutionalCrsCod); Ale_CreateAlert (Ale_SUCCESS,NULL, Txt_The_institutional_code_of_the_course_X_has_changed_to_Y, - Gbl.Hierarchy.Crs.Crs.ShrtName, + Gbl.Hierarchy.Crs.ShrtName, NewInstitutionalCrsCod); } else // The same institutional code Ale_CreateAlert (Ale_INFO,NULL, Txt_The_institutional_code_of_the_course_X_has_not_changed, - Gbl.Hierarchy.Crs.Crs.ShrtName); + Gbl.Hierarchy.Crs.ShrtName); } /*****************************************************************************/ @@ -2350,29 +2350,29 @@ void Crs_ChangeInsCrsCod (void) /***** Get parameters from form *****/ /* Get course code */ - Gbl.Degs.EditingCrs.CrsCod = Crs_GetAndCheckParamOtherCrsCod (1); + Gbl.Crss.EditingCrs.CrsCod = Crs_GetAndCheckParamOtherCrsCod (1); /* Get institutional code */ Par_GetParToText ("InsCrsCod",NewInstitutionalCrsCod,Crs_MAX_BYTES_INSTITUTIONAL_CRS_COD); /* Get data of the course */ - Crs_GetDataOfCourseByCod (&Gbl.Degs.EditingCrs); + Crs_GetDataOfCourseByCod (&Gbl.Crss.EditingCrs); - if (Crs_CheckIfICanEdit (&Gbl.Degs.EditingCrs)) + if (Crs_CheckIfICanEdit (&Gbl.Crss.EditingCrs)) { /***** Change the institutional course code *****/ - if (strcmp (NewInstitutionalCrsCod,Gbl.Degs.EditingCrs.InstitutionalCrsCod)) + if (strcmp (NewInstitutionalCrsCod,Gbl.Crss.EditingCrs.InstitutionalCrsCod)) { - Crs_UpdateInstitutionalCrsCod (&Gbl.Degs.EditingCrs,NewInstitutionalCrsCod); + Crs_UpdateInstitutionalCrsCod (&Gbl.Crss.EditingCrs,NewInstitutionalCrsCod); Ale_CreateAlert (Ale_SUCCESS,NULL, Txt_The_institutional_code_of_the_course_X_has_changed_to_Y, - Gbl.Degs.EditingCrs.ShrtName, + Gbl.Crss.EditingCrs.ShrtName, NewInstitutionalCrsCod); } else // The same institutional code Ale_CreateAlert (Ale_INFO,NULL, Txt_The_institutional_code_of_the_course_X_has_not_changed, - Gbl.Degs.EditingCrs.ShrtName); + Gbl.Crss.EditingCrs.ShrtName); } else Lay_NoPermissionExit (); @@ -2393,31 +2393,31 @@ void Crs_ChangeCrsDegInConfig (void) NewDeg.DegCod = Deg_GetAndCheckParamOtherDegCod (1); /***** Check if degree has changed *****/ - if (NewDeg.DegCod != Gbl.Hierarchy.Crs.Crs.DegCod) + if (NewDeg.DegCod != Gbl.Hierarchy.Crs.DegCod) { /***** Get data of new degree *****/ Deg_GetDataOfDegreeByCod (&NewDeg); /***** If name of course was in database in the new degree... *****/ - if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.Hierarchy.Crs.Crs.ShrtName,-1L, - NewDeg.DegCod,Gbl.Hierarchy.Crs.Crs.Year)) + if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.Hierarchy.Crs.ShrtName,-1L, + NewDeg.DegCod,Gbl.Hierarchy.Crs.Year)) Ale_CreateAlert (Ale_WARNING,NULL, Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z, - Txt_YEAR_OF_DEGREE[Gbl.Hierarchy.Crs.Crs.Year], + Txt_YEAR_OF_DEGREE[Gbl.Hierarchy.Crs.Year], NewDeg.FullName, - Gbl.Hierarchy.Crs.Crs.ShrtName); - else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.Hierarchy.Crs.Crs.FullName,-1L, - NewDeg.DegCod,Gbl.Hierarchy.Crs.Crs.Year)) + Gbl.Hierarchy.Crs.ShrtName); + else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.Hierarchy.Crs.FullName,-1L, + NewDeg.DegCod,Gbl.Hierarchy.Crs.Year)) Ale_CreateAlert (Ale_WARNING,NULL, Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z, - Txt_YEAR_OF_DEGREE[Gbl.Hierarchy.Crs.Crs.Year], + Txt_YEAR_OF_DEGREE[Gbl.Hierarchy.Crs.Year], NewDeg.FullName, - Gbl.Hierarchy.Crs.Crs.FullName); + Gbl.Hierarchy.Crs.FullName); else // Update degree in database { /***** Update degree in table of courses *****/ - Crs_UpdateCrsDegDB (Gbl.Hierarchy.Crs.Crs.CrsCod,NewDeg.DegCod); - Gbl.Hierarchy.Crs.Crs.DegCod = + Crs_UpdateCrsDegDB (Gbl.Hierarchy.Crs.CrsCod,NewDeg.DegCod); + Gbl.Hierarchy.Crs.DegCod = Gbl.Hierarchy.Deg.DegCod = NewDeg.DegCod; /***** Initialize again current course, degree, centre... *****/ @@ -2426,7 +2426,7 @@ void Crs_ChangeCrsDegInConfig (void) /***** Create alert to show the change made *****/ Ale_CreateAlert (Ale_SUCCESS,NULL, Txt_The_course_X_has_been_moved_to_the_degree_Y, - Gbl.Hierarchy.Crs.Crs.FullName, + Gbl.Hierarchy.Crs.FullName, Gbl.Hierarchy.Deg.FullName); } } @@ -2477,27 +2477,27 @@ void Crs_ChangeCrsYearInConfig (void) if (NewYear <= Deg_MAX_YEARS_PER_DEGREE) // If year is valid { /***** If name of course was in database in the new year... *****/ - if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.Hierarchy.Crs.Crs.ShrtName,-1L, - Gbl.Hierarchy.Crs.Crs.DegCod,NewYear)) + if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.Hierarchy.Crs.ShrtName,-1L, + Gbl.Hierarchy.Crs.DegCod,NewYear)) Ale_CreateAlert (Ale_WARNING,NULL, Txt_The_course_X_already_exists_in_year_Y, - Gbl.Hierarchy.Crs.Crs.ShrtName, + Gbl.Hierarchy.Crs.ShrtName, Txt_YEAR_OF_DEGREE[NewYear]); - else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.Hierarchy.Crs.Crs.FullName,-1L, - Gbl.Hierarchy.Crs.Crs.DegCod,NewYear)) + else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.Hierarchy.Crs.FullName,-1L, + Gbl.Hierarchy.Crs.DegCod,NewYear)) Ale_CreateAlert (Ale_WARNING,NULL, Txt_The_course_X_already_exists_in_year_Y, - Gbl.Hierarchy.Crs.Crs.FullName, + Gbl.Hierarchy.Crs.FullName, Txt_YEAR_OF_DEGREE[NewYear]); else // Update year in database { /***** Update year in table of courses *****/ - Crs_UpdateCrsYear (&Gbl.Hierarchy.Crs.Crs,NewYear); + Crs_UpdateCrsYear (&Gbl.Hierarchy.Crs,NewYear); /***** Create alert to show the change made *****/ Ale_CreateAlert (Ale_SUCCESS,NULL, Txt_The_year_of_the_course_X_has_changed, - Gbl.Hierarchy.Crs.Crs.ShrtName); + Gbl.Hierarchy.Crs.ShrtName); } } else // Year not valid @@ -2522,43 +2522,43 @@ void Crs_ChangeCrsYear (void) /***** Get parameters from form *****/ /* Get course code */ - Gbl.Degs.EditingCrs.CrsCod = Crs_GetAndCheckParamOtherCrsCod (1); + Gbl.Crss.EditingCrs.CrsCod = Crs_GetAndCheckParamOtherCrsCod (1); /* Get parameter with year */ Par_GetParToText ("OthCrsYear",YearStr,2); NewYear = Deg_ConvStrToYear (YearStr); - Crs_GetDataOfCourseByCod (&Gbl.Degs.EditingCrs); + Crs_GetDataOfCourseByCod (&Gbl.Crss.EditingCrs); - if (Crs_CheckIfICanEdit (&Gbl.Degs.EditingCrs)) + if (Crs_CheckIfICanEdit (&Gbl.Crss.EditingCrs)) { - Deg.DegCod = Gbl.Degs.EditingCrs.DegCod; + Deg.DegCod = Gbl.Crss.EditingCrs.DegCod; Deg_GetDataOfDegreeByCod (&Deg); if (NewYear <= Deg_MAX_YEARS_PER_DEGREE) // If year is valid { /***** If name of course was in database in the new year... *****/ - if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.Degs.EditingCrs.ShrtName,-1L, - Gbl.Degs.EditingCrs.DegCod,NewYear)) + if (Crs_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.Crss.EditingCrs.ShrtName,-1L, + Gbl.Crss.EditingCrs.DegCod,NewYear)) Ale_CreateAlert (Ale_WARNING,NULL, Txt_The_course_X_already_exists_in_year_Y, - Gbl.Degs.EditingCrs.ShrtName, + Gbl.Crss.EditingCrs.ShrtName, Txt_YEAR_OF_DEGREE[NewYear]); - else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.Degs.EditingCrs.FullName,-1L, - Gbl.Degs.EditingCrs.DegCod,NewYear)) + else if (Crs_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.Crss.EditingCrs.FullName,-1L, + Gbl.Crss.EditingCrs.DegCod,NewYear)) Ale_CreateAlert (Ale_WARNING,NULL, Txt_The_course_X_already_exists_in_year_Y, - Gbl.Degs.EditingCrs.FullName, + Gbl.Crss.EditingCrs.FullName, Txt_YEAR_OF_DEGREE[NewYear]); else // Update year in database { /***** Update year in table of courses *****/ - Crs_UpdateCrsYear (&Gbl.Degs.EditingCrs,NewYear); + Crs_UpdateCrsYear (&Gbl.Crss.EditingCrs,NewYear); /***** Create message to show the change made *****/ Ale_CreateAlert (Ale_SUCCESS,NULL, Txt_The_year_of_the_course_X_has_changed, - Gbl.Degs.EditingCrs.ShrtName); + Gbl.Crss.EditingCrs.ShrtName); } } else // Year not valid @@ -2608,13 +2608,13 @@ void Crs_UpdateInstitutionalCrsCod (struct Course *Crs,const char *NewInstitutio void Crs_RenameCourseShort (void) { - Gbl.Degs.EditingCrs.CrsCod = Crs_GetAndCheckParamOtherCrsCod (1); - Crs_RenameCourse (&Gbl.Degs.EditingCrs,Cns_SHRT_NAME); + Gbl.Crss.EditingCrs.CrsCod = Crs_GetAndCheckParamOtherCrsCod (1); + Crs_RenameCourse (&Gbl.Crss.EditingCrs,Cns_SHRT_NAME); } void Crs_RenameCourseShortInConfig (void) { - Crs_RenameCourse (&Gbl.Hierarchy.Crs.Crs,Cns_SHRT_NAME); + Crs_RenameCourse (&Gbl.Hierarchy.Crs,Cns_SHRT_NAME); } /*****************************************************************************/ @@ -2623,13 +2623,13 @@ void Crs_RenameCourseShortInConfig (void) void Crs_RenameCourseFull (void) { - Gbl.Degs.EditingCrs.CrsCod = Crs_GetAndCheckParamOtherCrsCod (1); - Crs_RenameCourse (&Gbl.Degs.EditingCrs,Cns_FULL_NAME); + Gbl.Crss.EditingCrs.CrsCod = Crs_GetAndCheckParamOtherCrsCod (1); + Crs_RenameCourse (&Gbl.Crss.EditingCrs,Cns_FULL_NAME); } void Crs_RenameCourseFullInConfig (void) { - Crs_RenameCourse (&Gbl.Hierarchy.Crs.Crs,Cns_FULL_NAME); + Crs_RenameCourse (&Gbl.Hierarchy.Crs,Cns_FULL_NAME); } /*****************************************************************************/ @@ -2755,7 +2755,7 @@ void Crs_ChangeCrsStatus (void) /***** Get parameters from form *****/ /* Get course code */ - Gbl.Degs.EditingCrs.CrsCod = Crs_GetAndCheckParamOtherCrsCod (1); + Gbl.Crss.EditingCrs.CrsCod = Crs_GetAndCheckParamOtherCrsCod (1); /* Get parameter with status */ Status = (Crs_Status_t) @@ -2769,18 +2769,18 @@ void Crs_ChangeCrsStatus (void) Status = Crs_GetStatusBitsFromStatusTxt (StatusTxt); // New status /***** Get data of course *****/ - Crs_GetDataOfCourseByCod (&Gbl.Degs.EditingCrs); + Crs_GetDataOfCourseByCod (&Gbl.Crss.EditingCrs); /***** Update status in table of courses *****/ DB_QueryUPDATE ("can not update the status of a course", "UPDATE courses SET Status=%u WHERE CrsCod=%ld", - (unsigned) Status,Gbl.Degs.EditingCrs.CrsCod); - Gbl.Degs.EditingCrs.Status = Status; + (unsigned) Status,Gbl.Crss.EditingCrs.CrsCod); + Gbl.Crss.EditingCrs.Status = Status; /***** Create alert to show the change made *****/ Ale_CreateAlert (Ale_SUCCESS,NULL, Txt_The_status_of_the_course_X_has_changed, - Gbl.Degs.EditingCrs.ShrtName); + Gbl.Crss.EditingCrs.ShrtName); } /*****************************************************************************/ @@ -2808,15 +2808,15 @@ void Crs_ContEditAfterChgCrs (void) break; case Rol_USR: PutButtonToRequestRegistration = !Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Me.UsrDat.UsrCod, - Gbl.Degs.EditingCrs.CrsCod, + Gbl.Crss.EditingCrs.CrsCod, false); break; case Rol_STD: case Rol_NET: case Rol_TCH: - if (Gbl.Degs.EditingCrs.CrsCod != Gbl.Hierarchy.Crs.Crs.CrsCod) + if (Gbl.Crss.EditingCrs.CrsCod != Gbl.Hierarchy.Crs.CrsCod) PutButtonToRequestRegistration = !Usr_CheckIfUsrBelongsToCrs (Gbl.Usrs.Me.UsrDat.UsrCod, - Gbl.Degs.EditingCrs.CrsCod, + Gbl.Crss.EditingCrs.CrsCod, false); break; default: @@ -2840,21 +2840,21 @@ void Crs_ContEditAfterChgCrs (void) /*****************************************************************************/ /************************ Put button to go to course *************************/ /*****************************************************************************/ -// Gbl.Degs.EditingCrs is the course that is beeing edited -// Gbl.Hierarchy.Crs.Crs. is the current course +// Gbl.Crss.EditingCrs is the course that is beeing edited +// Gbl.Hierarchy.Crs. is the current course static void Crs_PutButtonToGoToCrs (void) { extern const char *Txt_Go_to_X; // If the course being edited is different to the current one... - if (Gbl.Degs.EditingCrs.CrsCod != Gbl.Hierarchy.Crs.Crs.CrsCod) + if (Gbl.Crss.EditingCrs.CrsCod != Gbl.Hierarchy.Crs.CrsCod) { Frm_StartForm (ActSeeCrsInf); - Crs_PutParamCrsCod (Gbl.Degs.EditingCrs.CrsCod); + Crs_PutParamCrsCod (Gbl.Crss.EditingCrs.CrsCod); snprintf (Gbl.Title,sizeof (Gbl.Title), Txt_Go_to_X, - Gbl.Degs.EditingCrs.ShrtName); + Gbl.Crss.EditingCrs.ShrtName); Btn_PutConfirmButton (Gbl.Title); Frm_EndForm (); } @@ -2863,8 +2863,8 @@ static void Crs_PutButtonToGoToCrs (void) /*****************************************************************************/ /************************ Put button to go to course *************************/ /*****************************************************************************/ -// Gbl.Degs.EditingCrs is the course that is beeing edited -// Gbl.Hierarchy.Crs.Crs. is the current course +// Gbl.Crss.EditingCrs is the course that is beeing edited +// Gbl.Hierarchy.Crs. is the current course static void Crs_PutButtonToRegisterInCrs (void) { @@ -2872,11 +2872,11 @@ static void Crs_PutButtonToRegisterInCrs (void) Frm_StartForm (ActReqSignUp); // If the course beeing edited is different to the current one... - if (Gbl.Degs.EditingCrs.CrsCod != Gbl.Hierarchy.Crs.Crs.CrsCod) - Crs_PutParamCrsCod (Gbl.Degs.EditingCrs.CrsCod); + if (Gbl.Crss.EditingCrs.CrsCod != Gbl.Hierarchy.Crs.CrsCod) + Crs_PutParamCrsCod (Gbl.Crss.EditingCrs.CrsCod); snprintf (Gbl.Title,sizeof (Gbl.Title), Txt_Register_me_in_X, - Gbl.Degs.EditingCrs.ShrtName); + Gbl.Crss.EditingCrs.ShrtName); Btn_PutCreateButton (Gbl.Title); Frm_EndForm (); } @@ -3227,7 +3227,7 @@ static void Crs_WriteRowCrsData (unsigned NumCrs,MYSQL_ROW row,bool WriteColumnA Style = "DAT"; StyleNoBR = "DAT_NOBR"; } - BgColor = (CrsCod == Gbl.Hierarchy.Crs.Crs.CrsCod) ? "LIGHT_BLUE" : + BgColor = (CrsCod == Gbl.Hierarchy.Crs.CrsCod) ? "LIGHT_BLUE" : Gbl.ColorRows[RowEvenOdd]; /***** Start row *****/ @@ -3317,7 +3317,7 @@ void Crs_UpdateCrsLast (void) DB_QueryUPDATE ("can not update last access to current course", "REPLACE INTO crs_last (CrsCod,LastTime)" " VALUES (%ld,NOW())", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); } /*****************************************************************************/ diff --git a/swad_degree.c b/swad_degree.c index 4df37146..6cf8d327 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -357,13 +357,13 @@ static void Deg_Configuration (bool PrintView) " onchange=\"document.getElementById('%s').submit();\">", Gbl.Form.Id); for (NumCtr = 0; - NumCtr < Gbl.Ctrs.Num; + NumCtr < Gbl.Hierarchy.Ins.Ctrs.Num; NumCtr++) fprintf (Gbl.F.Out,"", - Gbl.Ctrs.Lst[NumCtr].CtrCod, - Gbl.Ctrs.Lst[NumCtr].CtrCod == Gbl.Hierarchy.Ctr.CtrCod ? " selected=\"selected\"" : + Gbl.Hierarchy.Ins.Ctrs.Lst[NumCtr].CtrCod, + Gbl.Hierarchy.Ins.Ctrs.Lst[NumCtr].CtrCod == Gbl.Hierarchy.Ctr.CtrCod ? " selected=\"selected\"" : "", - Gbl.Ctrs.Lst[NumCtr].ShrtName); + Gbl.Hierarchy.Ins.Ctrs.Lst[NumCtr].ShrtName); fprintf (Gbl.F.Out,""); Frm_EndForm (); @@ -784,10 +784,10 @@ static void Deg_ListDegreesForEdition (void) " onchange=\"document.getElementById('%s').submit();\">", Gbl.Form.Id); for (NumDegTyp = 0; - NumDegTyp < Gbl.Degs.DegTypes.Num; + NumDegTyp < Gbl.DegTypes.Num; NumDegTyp++) { - DegTyp = &Gbl.Degs.DegTypes.Lst[NumDegTyp]; + DegTyp = &Gbl.DegTypes.Lst[NumDegTyp]; fprintf (Gbl.F.Out,"", DegTyp->DegTypCod, (DegTyp->DegTypCod == Deg->DegTypCod) ? " selected=\"selected\"" : @@ -799,10 +799,10 @@ static void Deg_ListDegreesForEdition (void) } else for (NumDegTyp = 0; - NumDegTyp < Gbl.Degs.DegTypes.Num; + NumDegTyp < Gbl.DegTypes.Num; NumDegTyp++) - if (Gbl.Degs.DegTypes.Lst[NumDegTyp].DegTypCod == Deg->DegTypCod) - fprintf (Gbl.F.Out,"%s",Gbl.Degs.DegTypes.Lst[NumDegTyp].DegTypName); + if (Gbl.DegTypes.Lst[NumDegTyp].DegTypCod == Deg->DegTypCod) + fprintf (Gbl.F.Out,"%s",Gbl.DegTypes.Lst[NumDegTyp].DegTypName); fprintf (Gbl.F.Out,""); /* Degree WWW */ @@ -995,10 +995,10 @@ static void Deg_PutFormToCreateDegree (void) fprintf (Gbl.F.Out,"" ""); @@ -204,7 +204,7 @@ static void DT_ListDegreeTypes (Act_Action_t NextAction,DT_Order_t SelectedOrder return; } - if (Gbl.Degs.DegTypes.Num) + if (Gbl.DegTypes.Num) { /***** Write heading *****/ Tbl_StartTableWideMargin (2); @@ -223,7 +223,7 @@ static void DT_ListDegreeTypes (Act_Action_t NextAction,DT_Order_t SelectedOrder if (DT_CheckIfICanCreateDegreeTypes ()) { Frm_StartForm (ActEdiDegTyp); - Btn_PutConfirmButton (Gbl.Degs.DegTypes.Num ? Txt_Create_another_type_of_degree : + Btn_PutConfirmButton (Gbl.DegTypes.Num ? Txt_Create_another_type_of_degree : Txt_Create_type_of_degree); Frm_EndForm (); } @@ -252,7 +252,7 @@ void DT_EditDegreeTypes (void) DT_PutFormToCreateDegreeType (); /***** Forms to edit current degree types *****/ - if (Gbl.Degs.DegTypes.Num) + if (Gbl.DegTypes.Num) DT_ListDegreeTypesForEdition (); /***** End box *****/ @@ -303,12 +303,12 @@ static void DT_ListDegreeTypesForSeeing (void) /***** List degree types with forms for edition *****/ for (NumDegTyp = 0; - NumDegTyp < Gbl.Degs.DegTypes.Num; + NumDegTyp < Gbl.DegTypes.Num; NumDegTyp++) { - BgColor = (Gbl.Degs.DegTypes.Lst[NumDegTyp].DegTypCod == - Gbl.Hierarchy.DegTyp.DegTypCod) ? "LIGHT_BLUE" : - Gbl.ColorRows[Gbl.RowEvenOdd]; + BgColor = (Gbl.DegTypes.Lst[NumDegTyp].DegTypCod == + Gbl.Hierarchy.Deg.DegTypCod) ? "LIGHT_BLUE" : + Gbl.ColorRows[Gbl.RowEvenOdd]; /* Number of degree type in this list */ fprintf (Gbl.F.Out,"" @@ -321,14 +321,14 @@ static void DT_ListDegreeTypesForSeeing (void) fprintf (Gbl.F.Out,"" "%s" "", - BgColor,Gbl.Degs.DegTypes.Lst[NumDegTyp].DegTypName); + BgColor,Gbl.DegTypes.Lst[NumDegTyp].DegTypName); /* Number of degrees of this type */ fprintf (Gbl.F.Out,"" "%u" "" "", - BgColor,Gbl.Degs.DegTypes.Lst[NumDegTyp].NumDegs); + BgColor,Gbl.DegTypes.Lst[NumDegTyp].NumDegs); Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd; } @@ -376,18 +376,18 @@ static void DT_ListDegreeTypesForEdition (void) /***** List degree types with forms for edition *****/ for (NumDegTyp = 0; - NumDegTyp < Gbl.Degs.DegTypes.Num; + NumDegTyp < Gbl.DegTypes.Num; NumDegTyp++) { /* Put icon to remove degree type */ fprintf (Gbl.F.Out,"" ""); - if (Gbl.Degs.DegTypes.Lst[NumDegTyp].NumDegs) // Degree type has degrees => deletion forbidden + if (Gbl.DegTypes.Lst[NumDegTyp].NumDegs) // Degree type has degrees => deletion forbidden Ico_PutIconRemovalNotAllowed (); else { Frm_StartForm (ActRemDegTyp); - DT_PutParamOtherDegTypCod (Gbl.Degs.DegTypes.Lst[NumDegTyp].DegTypCod); + DT_PutParamOtherDegTypCod (Gbl.DegTypes.Lst[NumDegTyp].DegTypCod); Ico_PutIconRemove (); Frm_EndForm (); } @@ -397,17 +397,17 @@ static void DT_ListDegreeTypesForEdition (void) "" "%ld" "", - Gbl.Degs.DegTypes.Lst[NumDegTyp].DegTypCod); + Gbl.DegTypes.Lst[NumDegTyp].DegTypCod); /* Name of degree type */ fprintf (Gbl.F.Out,""); Frm_StartForm (ActRenDegTyp); - DT_PutParamOtherDegTypCod (Gbl.Degs.DegTypes.Lst[NumDegTyp].DegTypCod); + DT_PutParamOtherDegTypCod (Gbl.DegTypes.Lst[NumDegTyp].DegTypCod); fprintf (Gbl.F.Out,"", Deg_MAX_CHARS_DEGREE_TYPE_NAME, - Gbl.Degs.DegTypes.Lst[NumDegTyp].DegTypName, + Gbl.DegTypes.Lst[NumDegTyp].DegTypName, Gbl.Form.Id); Frm_EndForm (); fprintf (Gbl.F.Out,""); @@ -417,7 +417,7 @@ static void DT_ListDegreeTypesForEdition (void) "%u" "" "", - Gbl.Degs.DegTypes.Lst[NumDegTyp].NumDegs); + Gbl.DegTypes.Lst[NumDegTyp].NumDegs); } /***** End table *****/ @@ -465,7 +465,7 @@ void DT_PutFormToCreateDegreeType (void) " size=\"25\" maxlength=\"%u\" value=\"%s\"" " required=\"required\" />" "", - Deg_MAX_CHARS_DEGREE_TYPE_NAME,Gbl.Degs.EditingDegTyp.DegTypName); + Deg_MAX_CHARS_DEGREE_TYPE_NAME,Gbl.DegTypes.EditingDegTyp.DegTypName); /***** Number of degrees of this degree type ****/ fprintf (Gbl.F.Out,"" @@ -590,7 +590,7 @@ void DT_GetListDegreeTypes (Hie_Level_t Scope,DT_Order_t Order) all degree types with degrees union with all degree types without any degree */ - Gbl.Degs.DegTypes.Num = (unsigned) DB_QuerySELECT (&mysql_res,"can not get types of degree", + Gbl.DegTypes.Num = (unsigned) DB_QuerySELECT (&mysql_res,"can not get types of degree", "(SELECT deg_types.DegTypCod,deg_types.DegTypName," "COUNT(degrees.DegCod) AS NumDegs" " FROM degrees,deg_types" @@ -606,7 +606,7 @@ void DT_GetListDegreeTypes (Hie_Level_t Scope,DT_Order_t Order) break; case Hie_CTY: /* Get only degree types with degrees in the current country */ - Gbl.Degs.DegTypes.Num = (unsigned) DB_QuerySELECT (&mysql_res,"can not get types of degree", + Gbl.DegTypes.Num = (unsigned) DB_QuerySELECT (&mysql_res,"can not get types of degree", "SELECT deg_types.DegTypCod,deg_types.DegTypName," "COUNT(degrees.DegCod) AS NumDegs" " FROM institutions,centres,degrees,deg_types" @@ -621,7 +621,7 @@ void DT_GetListDegreeTypes (Hie_Level_t Scope,DT_Order_t Order) break; case Hie_INS: /* Get only degree types with degrees in the current institution */ - Gbl.Degs.DegTypes.Num = (unsigned) DB_QuerySELECT (&mysql_res,"can not get types of degree", + Gbl.DegTypes.Num = (unsigned) DB_QuerySELECT (&mysql_res,"can not get types of degree", "SELECT deg_types.DegTypCod,deg_types.DegTypName," "COUNT(degrees.DegCod) AS NumDegs" " FROM centres,degrees,deg_types" @@ -635,7 +635,7 @@ void DT_GetListDegreeTypes (Hie_Level_t Scope,DT_Order_t Order) break; case Hie_CTR: /* Get only degree types with degrees in the current centre */ - Gbl.Degs.DegTypes.Num = (unsigned) DB_QuerySELECT (&mysql_res,"can not get types of degree", + Gbl.DegTypes.Num = (unsigned) DB_QuerySELECT (&mysql_res,"can not get types of degree", "SELECT deg_types.DegTypCod,deg_types.DegTypName," "COUNT(degrees.DegCod) AS NumDegs" " FROM degrees,deg_types" @@ -649,7 +649,7 @@ void DT_GetListDegreeTypes (Hie_Level_t Scope,DT_Order_t Order) case Hie_DEG: case Hie_CRS: /* Get only degree types with degrees in the current degree */ - Gbl.Degs.DegTypes.Num = (unsigned) DB_QuerySELECT (&mysql_res,"can not get types of degree", + Gbl.DegTypes.Num = (unsigned) DB_QuerySELECT (&mysql_res,"can not get types of degree", "SELECT deg_types.DegTypCod,deg_types.DegTypName," "COUNT(degrees.DegCod) AS NumDegs" " FROM degrees,deg_types" @@ -666,32 +666,32 @@ void DT_GetListDegreeTypes (Hie_Level_t Scope,DT_Order_t Order) } /***** Get degree types *****/ - if (Gbl.Degs.DegTypes.Num) + if (Gbl.DegTypes.Num) { /***** Create a list of degree types *****/ - if ((Gbl.Degs.DegTypes.Lst = (struct DegreeType *) - calloc (Gbl.Degs.DegTypes.Num, + if ((Gbl.DegTypes.Lst = (struct DegreeType *) + calloc (Gbl.DegTypes.Num, sizeof (struct DegreeType))) == NULL) Lay_NotEnoughMemoryExit (); /***** Get degree types *****/ for (NumRow = 0; - NumRow < Gbl.Degs.DegTypes.Num; + NumRow < Gbl.DegTypes.Num; NumRow++) { /* Get next degree type */ row = mysql_fetch_row (mysql_res); /* Get degree type code (row[0]) */ - if ((Gbl.Degs.DegTypes.Lst[NumRow].DegTypCod = Str_ConvertStrCodToLongCod (row[0])) < 0) + if ((Gbl.DegTypes.Lst[NumRow].DegTypCod = Str_ConvertStrCodToLongCod (row[0])) < 0) Lay_ShowErrorAndExit ("Wrong code of type of degree."); /* Get degree type name (row[1]) */ - Str_Copy (Gbl.Degs.DegTypes.Lst[NumRow].DegTypName,row[1], + Str_Copy (Gbl.DegTypes.Lst[NumRow].DegTypName,row[1], Deg_MAX_BYTES_DEGREE_TYPE_NAME); /* Number of degrees of this type (row[2]) */ - if (sscanf (row[2],"%u",&Gbl.Degs.DegTypes.Lst[NumRow].NumDegs) != 1) + if (sscanf (row[2],"%u",&Gbl.DegTypes.Lst[NumRow].NumDegs) != 1) Lay_ShowErrorAndExit ("Error when getting number of degrees of a type"); } } @@ -707,11 +707,11 @@ void DT_GetListDegreeTypes (Hie_Level_t Scope,DT_Order_t Order) void DT_FreeListDegreeTypes (void) { /***** Free memory used by the list of degree types *****/ - if (Gbl.Degs.DegTypes.Lst) + if (Gbl.DegTypes.Lst) { - free ((void *) Gbl.Degs.DegTypes.Lst); - Gbl.Degs.DegTypes.Lst = NULL; - Gbl.Degs.DegTypes.Num = 0; + free ((void *) Gbl.DegTypes.Lst); + Gbl.DegTypes.Lst = NULL; + Gbl.DegTypes.Num = 0; } } @@ -725,7 +725,7 @@ void DT_RecFormNewDegreeType (void) extern const char *Txt_You_must_specify_the_name_of_the_new_type_of_degree; struct DegreeType *DegTyp; - DegTyp = &Gbl.Degs.EditingDegTyp; + DegTyp = &Gbl.DegTypes.EditingDegTyp; /***** Get parameters from form *****/ /* Get the name of degree type */ @@ -927,7 +927,7 @@ void DT_RenameDegreeType (void) struct DegreeType *DegTyp; char NewNameDegTyp[Deg_MAX_BYTES_DEGREE_TYPE_NAME + 1]; - DegTyp = &Gbl.Degs.EditingDegTyp; + DegTyp = &Gbl.DegTypes.EditingDegTyp; /***** Get parameters from form *****/ /* Get the code of the degree type */ @@ -1024,6 +1024,6 @@ void DT_ChangeDegreeType (void) Deg_ShowAlertAndButtonToGoToDeg (); /***** Show the form again *****/ - Gbl.Degs.EditingDegTyp.DegTypCod = NewDegTypCod; + Gbl.DegTypes.EditingDegTyp.DegTypCod = NewDegTypCod; Deg_EditDegrees (); } diff --git a/swad_department.c b/swad_department.c index 780b532a..c2fc0c48 100644 --- a/swad_department.c +++ b/swad_department.c @@ -509,13 +509,13 @@ static void Dpt_ListDepartmentsForEdition (void) fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%s",Txt_Another_institution); for (NumIns = 0; - NumIns < Gbl.Inss.Num; + NumIns < Gbl.Hierarchy.Cty.Inss.Num; NumIns++) fprintf (Gbl.F.Out,"", - Gbl.Inss.Lst[NumIns].InsCod, - Gbl.Inss.Lst[NumIns].InsCod == Dpt->InsCod ? " selected=\"selected\"" : + Gbl.Hierarchy.Cty.Inss.Lst[NumIns].InsCod, + Gbl.Hierarchy.Cty.Inss.Lst[NumIns].InsCod == Dpt->InsCod ? " selected=\"selected\"" : "", - Gbl.Inss.Lst[NumIns].ShrtName); + Gbl.Hierarchy.Cty.Inss.Lst[NumIns].ShrtName); fprintf (Gbl.F.Out,""); Frm_EndForm (); fprintf (Gbl.F.Out,""); @@ -876,13 +876,13 @@ static void Dpt_PutFormToCreateDepartment (void) fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%s",Txt_Another_institution); for (NumIns = 0; - NumIns < Gbl.Inss.Num; + NumIns < Gbl.Hierarchy.Cty.Inss.Num; NumIns++) fprintf (Gbl.F.Out,"", - Gbl.Inss.Lst[NumIns].InsCod, - Gbl.Inss.Lst[NumIns].InsCod == Dpt->InsCod ? " selected=\"selected\"" : + Gbl.Hierarchy.Cty.Inss.Lst[NumIns].InsCod, + Gbl.Hierarchy.Cty.Inss.Lst[NumIns].InsCod == Dpt->InsCod ? " selected=\"selected\"" : "", - Gbl.Inss.Lst[NumIns].ShrtName); + Gbl.Hierarchy.Cty.Inss.Lst[NumIns].ShrtName); fprintf (Gbl.F.Out,"" ""); diff --git a/swad_enrolment.c b/swad_enrolment.c index fb2fcd05..3faffd0a 100644 --- a/swad_enrolment.c +++ b/swad_enrolment.c @@ -181,7 +181,7 @@ void Enr_CheckStdsAndPutButtonToRegisterStdsInCurrentCrs (void) { /***** Put link to register students *****/ if (Gbl.Usrs.Me.Role.Logged == Rol_TCH) // Course selected and I am logged as teacher - if (!Gbl.Hierarchy.Crs.Crs.NumUsrs[Rol_STD]) // No students in course + if (!Gbl.Hierarchy.Crs.NumUsrs[Rol_STD]) // No students in course Usr_ShowWarningNoUsersFound (Rol_STD); } @@ -238,7 +238,7 @@ void Enr_ModifyRoleInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole) DB_QueryUPDATE ("can not modify user's role in course", "UPDATE crs_usr SET Role=%u" " WHERE CrsCod=%ld AND UsrCod=%ld", - (unsigned) NewRole,Gbl.Hierarchy.Crs.Crs.CrsCod,UsrDat->UsrCod); + (unsigned) NewRole,Gbl.Hierarchy.Crs.CrsCod,UsrDat->UsrCod); /***** Flush caches *****/ Usr_FlushCachesUsr (); @@ -289,7 +289,7 @@ void Enr_RegisterUsrInCurrentCrs (struct UsrData *UsrDat,Rol_Role_t NewRole, "-1,-1,-1," "0,FROM_UNIXTIME(%ld),0," "'%s',%u,'%c')", - Gbl.Hierarchy.Crs.Crs.CrsCod,UsrDat->UsrCod,(unsigned) NewRole, + Gbl.Hierarchy.Crs.CrsCod,UsrDat->UsrCod,(unsigned) NewRole, KeepOrSetAccepted == Enr_SET_ACCEPTED_TO_TRUE ? 'Y' : 'N', (long) (time_t) 0, // The user never accessed to tests in this course @@ -342,7 +342,7 @@ static void Enr_NotifyAfterEnrolment (struct UsrData *UsrDat,Rol_Role_t NewRole) } /***** Remove possible enrolment request ******/ - Enr_RemoveEnrolmentRequest (Gbl.Hierarchy.Crs.Crs.CrsCod,UsrDat->UsrCod); + Enr_RemoveEnrolmentRequest (Gbl.Hierarchy.Crs.CrsCod,UsrDat->UsrCod); /***** Remove old enrolment notifications before inserting the new one ******/ Ntf_MarkNotifToOneUsrAsRemoved (Ntf_EVENT_ENROLMENT_STD,-1,UsrDat->UsrCod); @@ -410,7 +410,7 @@ void Enr_ReqAcceptRegisterInCrs (void) /***** Show message *****/ Ale_ShowAlert (Ale_INFO,Txt_A_teacher_or_administrator_has_enroled_you_as_X_into_the_course_Y, Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role][Gbl.Usrs.Me.UsrDat.Sex], - Gbl.Hierarchy.Crs.Crs.FullName); + Gbl.Hierarchy.Crs.FullName); /***** Send button to accept register in the current course *****/ switch (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role) @@ -468,7 +468,7 @@ void Enr_ReqAcceptRegisterInCrs (void) Lay_ShowErrorAndExit ("Wrong role."); break; } - Ntf_MarkNotifAsSeen (NotifyEvent,-1L,Gbl.Hierarchy.Crs.Crs.CrsCod, + Ntf_MarkNotifAsSeen (NotifyEvent,-1L,Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod); } @@ -675,7 +675,7 @@ static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role) Enr_PutLinkToAdminOneUsr (ActReqMdfOneStd); /* Put link to remove all the students in the current course */ - if (Gbl.Hierarchy.Crs.Crs.NumUsrs[Rol_STD]) // This course has students + if (Gbl.Hierarchy.Crs.NumUsrs[Rol_STD]) // This course has students Enr_PutLinkToRemAllStdsThisCrs (); break; case Rol_NET: @@ -749,7 +749,7 @@ static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role) Txt_Step_3_Optionally_select_groups); if (Gbl.Hierarchy.Level == Hie_CRS) // Course selected { - if (Gbl.Hierarchy.Crs.Grps.NumGrps) // This course has groups? + if (Gbl.Crs.Grps.NumGrps) // This course has groups? { Ale_ShowAlert (Ale_INFO,Txt_Select_the_groups_in_from_which_you_want_to_register_remove_users_); Grp_ShowLstGrpsToChgOtherUsrsGrps (-1L); @@ -757,7 +757,7 @@ static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role) else /* Write help message */ Ale_ShowAlert (Ale_INFO,Txt_No_groups_have_been_created_in_the_course_X_Therefore_, - Gbl.Hierarchy.Crs.Crs.FullName); + Gbl.Hierarchy.Crs.FullName); } /***** Step 4: Confirm register / remove students *****/ @@ -1150,7 +1150,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role) /***** Get groups to which register/remove users *****/ LstGrps.NumGrps = 0; - if (Gbl.Hierarchy.Crs.Grps.NumGrps) // This course has groups? + if (Gbl.Crs.Grps.NumGrps) // This course has groups? { /***** Get list of groups types and groups in current course *****/ Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS); @@ -1289,7 +1289,7 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role) } else { - if (Gbl.Hierarchy.Crs.Grps.NumGrps) // If there are groups in the course + if (Gbl.Crs.Grps.NumGrps) // If there are groups in the course { if (LstGrps.NumGrps) // If the teacher has selected groups { @@ -1298,14 +1298,14 @@ static void Enr_ReceiveFormUsrsCrs (Rol_Role_t Role) } else // The teacher has not selected groups { - Enr_EffectivelyRemUsrFromCrs (&UsrDat,&Gbl.Hierarchy.Crs.Crs, + Enr_EffectivelyRemUsrFromCrs (&UsrDat,&Gbl.Hierarchy.Crs, Enr_DO_NOT_REMOVE_WORKS,Cns_QUIET); // Remove user from the course NumUsrsRemoved++; } } else // No groups { - Enr_EffectivelyRemUsrFromCrs (&UsrDat,&Gbl.Hierarchy.Crs.Crs, + Enr_EffectivelyRemUsrFromCrs (&UsrDat,&Gbl.Hierarchy.Crs, Enr_DO_NOT_REMOVE_WORKS,Cns_QUIET); // Remove user from the course NumUsrsRemoved++; } @@ -1607,7 +1607,7 @@ static void Enr_PutActionModifyOneUsr (bool *OptionChecked, Txt_Modify_user_in_the_course_X) : (ItsMe ? Txt_Register_me_in_X : Txt_Register_USER_in_the_course_X), - Gbl.Hierarchy.Crs.Crs.ShrtName); + Gbl.Hierarchy.Crs.ShrtName); Enr_EndRegRemOneUsrAction (); } @@ -1681,7 +1681,7 @@ static void Enr_PutActionRemUsrFromCrs (bool *OptionChecked,bool ItsMe) fprintf (Gbl.F.Out, ItsMe ? Txt_Remove_me_from_THE_COURSE_X : Txt_Remove_USER_from_THE_COURSE_X, - Gbl.Hierarchy.Crs.Crs.ShrtName); + Gbl.Hierarchy.Crs.ShrtName); Enr_EndRegRemOneUsrAction (); } @@ -1822,7 +1822,7 @@ static void Enr_RegisterUsr (struct UsrData *UsrDat,Rol_Role_t RegRemRole, Enr_SET_ACCEPTED_TO_FALSE); /***** Register user in the selected groups *****/ - if (Gbl.Hierarchy.Crs.Grps.NumGrps) // If there are groups in the course + if (Gbl.Crs.Grps.NumGrps) // If there are groups in the course Grp_RegisterUsrIntoGroups (UsrDat,LstGrps); } @@ -1857,13 +1857,13 @@ void Enr_AskRemAllStdsThisCrs (void) Box_StartBox (NULL,Txt_Remove_all_students,NULL, Hlp_USERS_Administration_remove_all_students,Box_NOT_CLOSABLE); - if (Gbl.Hierarchy.Crs.Crs.NumUsrs[Rol_STD]) + if (Gbl.Hierarchy.Crs.NumUsrs[Rol_STD]) { /***** Show question and button to remove students *****/ /* Start alert */ Ale_ShowAlertAndButton1 (Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_X_students_from_the_course_Y_, - Gbl.Hierarchy.Crs.Crs.NumUsrs[Rol_STD], - Gbl.Hierarchy.Crs.Crs.FullName); + Gbl.Hierarchy.Crs.NumUsrs[Rol_STD], + Gbl.Hierarchy.Crs.FullName); /* Show form to request confirmation */ Frm_StartForm (ActRemAllStdCrs); @@ -1875,7 +1875,7 @@ void Enr_AskRemAllStdsThisCrs (void) /* End alert */ Ale_ShowAlertAndButton2 (ActUnk,NULL,NULL,NULL,Btn_NO_BUTTON,NULL); } - else // Gbl.Hierarchy.Crs.Crs.NumUsrs[Rol_STD] == 0 + else // Gbl.Hierarchy.Crs.NumUsrs[Rol_STD] == 0 /***** Show warning indicating no students found *****/ Usr_ShowWarningNoUsersFound (Rol_STD); @@ -1894,9 +1894,9 @@ void Enr_RemAllStdsThisCrs (void) if (Pwd_GetConfirmationOnDangerousAction ()) { - if ((NumStdsInCrs = Enr_RemAllStdsInCrs (&Gbl.Hierarchy.Crs.Crs))) + if ((NumStdsInCrs = Enr_RemAllStdsInCrs (&Gbl.Hierarchy.Crs))) Ale_ShowAlert (Ale_SUCCESS,Txt_The_X_students_who_belonged_to_the_course_Y_have_been_removed_from_it, - NumStdsInCrs,Gbl.Hierarchy.Crs.Crs.FullName); + NumStdsInCrs,Gbl.Hierarchy.Crs.FullName); else // NumStdsInCrs == 0 /***** Show warning indicating no students found *****/ Usr_ShowWarningNoUsersFound (Rol_STD); @@ -1947,7 +1947,7 @@ void Enr_ReqSignUpInCrs (void) if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role >= Rol_STD) Ale_ShowAlert (Ale_WARNING,Txt_You_were_already_enroled_as_X_in_the_course_Y, Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role][Gbl.Usrs.Me.UsrDat.Sex], - Gbl.Hierarchy.Crs.Crs.FullName); + Gbl.Hierarchy.Crs.FullName); else if (Gbl.Usrs.Me.Role.Logged == Rol_GST || Gbl.Usrs.Me.Role.Logged == Rol_USR) /***** Show form to modify only the user's role or the user's data *****/ @@ -1974,7 +1974,7 @@ void Enr_SignUpInCrs (void) if (Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role >= Rol_STD) Ale_ShowAlert (Ale_WARNING,Txt_You_were_already_enroled_as_X_in_the_course_Y, Txt_ROLES_SINGUL_abc[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role][Gbl.Usrs.Me.UsrDat.Sex], - Gbl.Hierarchy.Crs.Crs.FullName); + Gbl.Hierarchy.Crs.FullName); else { /***** Get new role from record form *****/ @@ -1994,7 +1994,7 @@ void Enr_SignUpInCrs (void) if (DB_QuerySELECT (&mysql_res,"can not get enrolment request", "SELECT ReqCod FROM crs_usr_requests" " WHERE CrsCod=%ld AND UsrCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod)) { row = mysql_fetch_row (mysql_res); @@ -2011,7 +2011,7 @@ void Enr_SignUpInCrs (void) " WHERE ReqCod=%ld AND CrsCod=%ld AND UsrCod=%ld", (unsigned) RoleFromForm, ReqCod, - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod); else // No request in database for this user in this course ReqCod = @@ -2020,19 +2020,19 @@ void Enr_SignUpInCrs (void) " (CrsCod,UsrCod,Role,RequestTime)" " VALUES" " (%ld,%ld,%u,NOW())", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod, (unsigned) RoleFromForm); /***** Show confirmation message *****/ Ale_ShowAlert (Ale_SUCCESS,Txt_Your_request_for_enrolment_as_X_in_the_course_Y_has_been_accepted_for_processing, Txt_ROLES_SINGUL_abc[RoleFromForm][Gbl.Usrs.Me.UsrDat.Sex], - Gbl.Hierarchy.Crs.Crs.FullName); + Gbl.Hierarchy.Crs.FullName); /***** Notify teachers or admins by email about the new enrolment request *****/ // If this course has teachers ==> send notification to teachers // If this course has no teachers and I want to be a teacher ==> send notification to administrators or superusers - if (Gbl.Hierarchy.Crs.Crs.NumUsrs[Rol_TCH] || + if (Gbl.Hierarchy.Crs.NumUsrs[Rol_TCH] || RoleFromForm == Rol_TCH) Ntf_StoreNotifyEventsToAllUsrs (Ntf_EVENT_ENROLMENT_REQUEST,ReqCod); } @@ -2114,11 +2114,11 @@ void Enr_AskIfRejectSignUp (void) { /* User already belongs to this course */ Ale_ShowAlert (Ale_WARNING,Txt_THE_USER_X_is_already_enroled_in_the_course_Y, - Gbl.Usrs.Other.UsrDat.FullName,Gbl.Hierarchy.Crs.Crs.FullName); + Gbl.Usrs.Other.UsrDat.FullName,Gbl.Hierarchy.Crs.FullName); Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat); /* Remove inscription request because it has not sense */ - Enr_RemoveEnrolmentRequest (Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Usrs.Other.UsrDat.UsrCod); + Enr_RemoveEnrolmentRequest (Gbl.Hierarchy.Crs.CrsCod,Gbl.Usrs.Other.UsrDat.UsrCod); } else // User does not belong to this course { @@ -2132,7 +2132,7 @@ void Enr_AskIfRejectSignUp (void) Ale_ShowAlertAndButton1 (Ale_QUESTION,Txt_Do_you_really_want_to_reject_the_enrolment_request_, Gbl.Usrs.Other.UsrDat.FullName, Txt_ROLES_SINGUL_abc[Role][Gbl.Usrs.Other.UsrDat.Sex], - Gbl.Hierarchy.Crs.Crs.FullName); + Gbl.Hierarchy.Crs.FullName); /* Show user's record */ Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat); @@ -2168,12 +2168,12 @@ void Enr_RejectSignUp (void) { /* User already belongs to this course */ Ale_ShowAlert (Ale_WARNING,Txt_THE_USER_X_is_already_enroled_in_the_course_Y, - Gbl.Usrs.Other.UsrDat.FullName,Gbl.Hierarchy.Crs.Crs.FullName); + Gbl.Usrs.Other.UsrDat.FullName,Gbl.Hierarchy.Crs.FullName); Rec_ShowSharedRecordUnmodifiable (&Gbl.Usrs.Other.UsrDat); } /* Remove inscription request */ - Enr_RemoveEnrolmentRequest (Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Usrs.Other.UsrDat.UsrCod); + Enr_RemoveEnrolmentRequest (Gbl.Hierarchy.Crs.CrsCod,Gbl.Usrs.Other.UsrDat.UsrCod); /* Confirmation message */ Ale_ShowAlert (Ale_SUCCESS,Txt_Enrolment_of_X_rejected, @@ -2774,7 +2774,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected) " WHERE CrsCod=%ld" " AND ((1<0" " ORDER BY RequestTime DESC", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, RolesSelected); break; default: @@ -2945,7 +2945,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected) /***** Mark possible notification as seen *****/ Ntf_MarkNotifAsSeen (Ntf_EVENT_ENROLMENT_REQUEST, - ReqCod,Gbl.Hierarchy.Crs.Crs.CrsCod, + ReqCod,Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod); } else // User does not exists or user already belongs to course ==> remove pair from crs_usr_requests table @@ -3302,10 +3302,10 @@ static void Enr_ShowFormToEditOtherUsr (void) Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat); if (Gbl.Usrs.Other.UsrDat.Accepted) Ale_ShowAlert (Ale_INFO,Txt_THE_USER_X_is_already_enroled_in_the_course_Y, - Gbl.Usrs.Other.UsrDat.FullName,Gbl.Hierarchy.Crs.Crs.FullName); + Gbl.Usrs.Other.UsrDat.FullName,Gbl.Hierarchy.Crs.FullName); else // Enrolment not yet accepted Ale_ShowAlert (Ale_INFO,Txt_THE_USER_X_is_in_the_course_Y_but_has_not_yet_accepted_the_enrolment, - Gbl.Usrs.Other.UsrDat.FullName,Gbl.Hierarchy.Crs.Crs.FullName); + Gbl.Usrs.Other.UsrDat.FullName,Gbl.Hierarchy.Crs.FullName); Rec_ShowOtherSharedRecordEditable (); } @@ -3313,7 +3313,7 @@ static void Enr_ShowFormToEditOtherUsr (void) { Ale_ShowAlert (Ale_INFO,Txt_THE_USER_X_exists_in_Y_but_is_not_enroled_in_the_course_Z, Gbl.Usrs.Other.UsrDat.FullName, - Cfg_PLATFORM_SHORT_NAME,Gbl.Hierarchy.Crs.Crs.FullName); + Cfg_PLATFORM_SHORT_NAME,Gbl.Hierarchy.Crs.FullName); Rec_ShowOtherSharedRecordEditable (); } @@ -3458,7 +3458,7 @@ void Enr_RemUsrFromCrs1 (void) if (Usr_GetParamOtherUsrCodEncryptedAndGetUsrData ()) { if (Enr_CheckIfICanRemUsrFromCrs ()) - Enr_EffectivelyRemUsrFromCrs (&Gbl.Usrs.Other.UsrDat,&Gbl.Hierarchy.Crs.Crs, + Enr_EffectivelyRemUsrFromCrs (&Gbl.Usrs.Other.UsrDat,&Gbl.Hierarchy.Crs, Enr_REMOVE_WORKS,Cns_VERBOSE); else Ale_CreateAlertUserNotFoundOrYouDoNotHavePermission (); @@ -3696,7 +3696,7 @@ void Enr_AcceptRegisterMeInCrs (void) /***** Confirmation message *****/ Ale_ShowAlert (Ale_SUCCESS,Txt_You_have_confirmed_your_enrolment_in_the_course_X, - Gbl.Hierarchy.Crs.Crs.FullName); + Gbl.Hierarchy.Crs.FullName); } /*****************************************************************************/ @@ -3745,7 +3745,7 @@ void Enr_CreateNewUsr1 (void) Ale_CreateAlert (Ale_SUCCESS,NULL, Txt_The_role_of_THE_USER_X_in_the_course_Y_has_changed_from_A_to_B, Gbl.Usrs.Other.UsrDat.FullName, - Gbl.Hierarchy.Crs.Crs.FullName, + Gbl.Hierarchy.Crs.FullName, Txt_ROLES_SINGUL_abc[OldRole][Gbl.Usrs.Other.UsrDat.Sex], Txt_ROLES_SINGUL_abc[NewRole][Gbl.Usrs.Other.UsrDat.Sex]); } @@ -3760,11 +3760,11 @@ void Enr_CreateNewUsr1 (void) Ale_CreateAlert (Ale_SUCCESS,NULL, Txt_THE_USER_X_has_been_enroled_in_the_course_Y, Gbl.Usrs.Other.UsrDat.FullName, - Gbl.Hierarchy.Crs.Crs.FullName); + Gbl.Hierarchy.Crs.FullName); } /***** Change user's groups *****/ - if (Gbl.Hierarchy.Crs.Grps.NumGrps) // This course has groups? + if (Gbl.Crs.Grps.NumGrps) // This course has groups? Grp_ChangeOtherUsrGrps (); } @@ -3864,7 +3864,7 @@ void Enr_ModifyUsr1 (void) Ale_CreateAlert (Ale_SUCCESS,NULL, Txt_The_role_of_THE_USER_X_in_the_course_Y_has_changed_from_A_to_B, Gbl.Usrs.Other.UsrDat.FullName, - Gbl.Hierarchy.Crs.Crs.FullName, + Gbl.Hierarchy.Crs.FullName, Txt_ROLES_SINGUL_abc[OldRole][Gbl.Usrs.Other.UsrDat.Sex], Txt_ROLES_SINGUL_abc[NewRole][Gbl.Usrs.Other.UsrDat.Sex]); } @@ -3879,11 +3879,11 @@ void Enr_ModifyUsr1 (void) Ale_CreateAlert (Ale_SUCCESS,NULL, Txt_THE_USER_X_has_been_enroled_in_the_course_Y, Gbl.Usrs.Other.UsrDat.FullName, - Gbl.Hierarchy.Crs.Crs.FullName); + Gbl.Hierarchy.Crs.FullName); } /***** Change user's groups *****/ - if (Gbl.Hierarchy.Crs.Grps.NumGrps) // This course has groups? + if (Gbl.Crs.Grps.NumGrps) // This course has groups? { if (ItsMe) Grp_ChangeMyGrps (Cns_QUIET); @@ -4035,7 +4035,7 @@ void Enr_AcceptUsrInCrs (long UsrCod) DB_QueryUPDATE ("can not confirm user's enrolment", "UPDATE crs_usr SET Accepted='Y'" " WHERE CrsCod=%ld AND UsrCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod,UsrCod); + Gbl.Hierarchy.Crs.CrsCod,UsrCod); } /*****************************************************************************/ @@ -4059,7 +4059,7 @@ static void Enr_AskIfRemoveUsrFromCrs (struct UsrData *UsrDat) /* Start alert */ Ale_ShowAlertAndButton1 (Ale_QUESTION,ItsMe ? Txt_Do_you_really_want_to_be_removed_from_the_course_X : Txt_Do_you_really_want_to_remove_the_following_user_from_the_course_X, - Gbl.Hierarchy.Crs.Crs.FullName); + Gbl.Hierarchy.Crs.FullName); /* Show user's record */ Rec_ShowSharedRecordUnmodifiable (UsrDat); diff --git a/swad_exam.c b/swad_exam.c index 411c060a..679792cb 100644 --- a/swad_exam.c +++ b/swad_exam.c @@ -132,7 +132,7 @@ static long Exa_GetParamsExamAnnouncement (void) Par_GetParToText ("CrsName",Gbl.ExamAnns.ExaDat.CrsFullName,Hie_MAX_BYTES_FULL_NAME); // If the parameter is not present or is empty, initialize the string to the full name of the current course if (!Gbl.ExamAnns.ExaDat.CrsFullName[0]) - Str_Copy (Gbl.ExamAnns.ExaDat.CrsFullName,Gbl.Hierarchy.Crs.Crs.FullName, + Str_Copy (Gbl.ExamAnns.ExaDat.CrsFullName,Gbl.Hierarchy.Crs.FullName, Hie_MAX_BYTES_FULL_NAME); /***** Get the year *****/ @@ -140,7 +140,7 @@ static long Exa_GetParamsExamAnnouncement (void) Par_GetParToUnsignedLong ("Year", 0, // N.A. Deg_MAX_YEARS_PER_DEGREE, - (unsigned long) Gbl.Hierarchy.Crs.Crs.Year); + (unsigned long) Gbl.Hierarchy.Crs.Year); /***** Get the type of exam announcement *****/ Par_GetParToText ("ExamSession",Gbl.ExamAnns.ExaDat.Session,Exa_MAX_BYTES_SESSION); @@ -321,7 +321,7 @@ void Exa_ReceiveExamAnnouncement2 (void) TL_StoreAndPublishNote (TL_NOTE_EXAM_ANNOUNCEMENT,Gbl.ExamAnns.HighlightExaCod,&SocPub); /***** Update RSS of current course *****/ - RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs.Crs); + RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs); /***** Show exam announcements *****/ Exa_ListExamAnnouncementsEdit (); @@ -417,7 +417,7 @@ void Exa_RemoveExamAnnouncement1 (void) "UPDATE exam_announcements SET Status=%u" " WHERE ExaCod=%ld AND CrsCod=%ld", (unsigned) Exa_DELETED_EXAM_ANNOUNCEMENT, - ExaCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + ExaCod,Gbl.Hierarchy.Crs.CrsCod); /***** Mark possible notifications as removed *****/ Ntf_MarkNotifAsRemoved (Ntf_EVENT_EXAM_ANNOUNCEMENT,ExaCod); @@ -426,7 +426,7 @@ void Exa_RemoveExamAnnouncement1 (void) TL_MarkNoteAsUnavailableUsingNoteTypeAndCod (TL_NOTE_EXAM_ANNOUNCEMENT,ExaCod); /***** Update RSS of current course *****/ - RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs.Crs); + RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs); } void Exa_RemoveExamAnnouncement2 (void) @@ -461,7 +461,7 @@ void Exa_HideExamAnnouncement (void) "UPDATE exam_announcements SET Status=%u" " WHERE ExaCod=%ld AND CrsCod=%ld", (unsigned) Exa_HIDDEN_EXAM_ANNOUNCEMENT, - ExaCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + ExaCod,Gbl.Hierarchy.Crs.CrsCod); /***** Set exam to be highlighted *****/ Gbl.ExamAnns.HighlightExaCod = ExaCod; @@ -494,7 +494,7 @@ void Exa_UnhideExamAnnouncement (void) "UPDATE exam_announcements SET Status=%u" " WHERE ExaCod=%ld AND CrsCod=%ld", (unsigned) Exa_VISIBLE_EXAM_ANNOUNCEMENT, - ExaCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + ExaCod,Gbl.Hierarchy.Crs.CrsCod); /***** Set exam to be highlighted *****/ Gbl.ExamAnns.HighlightExaCod = ExaCod; @@ -517,7 +517,7 @@ void Exa_ListExamAnnouncementsSee (void) /***** Mark possible notifications as seen *****/ Ntf_MarkNotifAsSeen (Ntf_EVENT_EXAM_ANNOUNCEMENT, - -1L,Gbl.Hierarchy.Crs.Crs.CrsCod, + -1L,Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod); } @@ -587,7 +587,7 @@ static void Exa_ListExamAnnouncements (Exa_TypeViewExamAnnouncement_t TypeViewEx " FROM exam_announcements" " WHERE CrsCod=%ld AND %s" " ORDER BY ExamDate DESC", - Gbl.Hierarchy.Crs.Crs.CrsCod,SubQueryStatus); + Gbl.Hierarchy.Crs.CrsCod,SubQueryStatus); /***** Start box *****/ Box_StartBox (NULL,Txt_Announcements_of_exams, @@ -598,7 +598,7 @@ static void Exa_ListExamAnnouncements (Exa_TypeViewExamAnnouncement_t TypeViewEx /***** The result of the query may be empty *****/ if (!NumExaAnns) Ale_ShowAlert (Ale_INFO,Txt_No_announcements_of_exams_of_X, - Gbl.Hierarchy.Crs.Crs.FullName); + Gbl.Hierarchy.Crs.FullName); /***** List the existing exam announcements *****/ for (NumExaAnn = 0; @@ -690,7 +690,7 @@ static long Exa_AddExamAnnouncementToDB (void) "(%ld,%u,0,'%s',%u,'%s'," "NOW(),'%04u-%02u-%02u %02u:%02u:00','%02u:%02u:00','%s'," "'%s','%s','%s','%s','%s','%s')", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, (unsigned) Exa_VISIBLE_EXAM_ANNOUNCEMENT, Gbl.ExamAnns.ExaDat.CrsFullName, Gbl.ExamAnns.ExaDat.Year, @@ -770,7 +770,7 @@ void Exa_CreateListDatesOfExamAnnouncements (void) " FROM exam_announcements" " WHERE CrsCod=%ld AND Status=%u" " ORDER BY ExamDate DESC", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, (unsigned) Exa_VISIBLE_EXAM_ANNOUNCEMENT); /***** The result of the query may be empty *****/ diff --git a/swad_figure.c b/swad_figure.c index 775c4b79..0ba766c0 100644 --- a/swad_figure.c +++ b/swad_figure.c @@ -906,7 +906,7 @@ static void Fig_GetAndShowHierarchyWithUsrs (Rol_Role_t Role) break; case Hie_CRS: sprintf (SubQuery,"crs_usr.CrsCod=%ld AND ", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); NumCtysWithUsrs = Cty_GetNumCtysWithUsrs (Role,SubQuery); NumInssWithUsrs = Ins_GetNumInssWithUsrs (Role,SubQuery); NumCtrsWithUsrs = Ctr_GetNumCtrsWithUsrs (Role,SubQuery); @@ -2349,14 +2349,14 @@ static void Fig_GetSizeOfFileZoneFromDB (Hie_Level_t Scope, " AND crs_grp.GrpCod=file_browser_size.Cod" " AND file_browser_size.FileBrowser IN (%u,%u,%u,%u)" ") AS sizes", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, (unsigned) Brw_ADMI_DOC_CRS, (unsigned) Brw_ADMI_TCH_CRS, (unsigned) Brw_ADMI_SHR_CRS, (unsigned) Brw_ADMI_ASG_USR, (unsigned) Brw_ADMI_WRK_USR, (unsigned) Brw_ADMI_MRK_CRS, - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, (unsigned) Brw_ADMI_DOC_GRP, (unsigned) Brw_ADMI_TCH_GRP, (unsigned) Brw_ADMI_SHR_GRP, @@ -2376,7 +2376,7 @@ static void Fig_GetSizeOfFileZoneFromDB (Hie_Level_t Scope, "SUM(TotalSize)" " FROM file_browser_size" " WHERE Cod=%ld AND FileBrowser=%u", - Gbl.Hierarchy.Crs.Crs.CrsCod,(unsigned) FileBrowser); + Gbl.Hierarchy.Crs.CrsCod,(unsigned) FileBrowser); break; case Brw_ADMI_DOC_GRP: case Brw_ADMI_TCH_GRP: @@ -2395,7 +2395,7 @@ static void Fig_GetSizeOfFileZoneFromDB (Hie_Level_t Scope, " AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod" " AND crs_grp.GrpCod=file_browser_size.Cod" " AND file_browser_size.FileBrowser=%u", - Gbl.Hierarchy.Crs.Crs.CrsCod,(unsigned) FileBrowser); + Gbl.Hierarchy.Crs.CrsCod,(unsigned) FileBrowser); break; case Brw_ADMI_ASG_USR: case Brw_ADMI_WRK_USR: @@ -2409,7 +2409,7 @@ static void Fig_GetSizeOfFileZoneFromDB (Hie_Level_t Scope, "SUM(TotalSize)" " FROM file_browser_size" " WHERE Cod=%ld AND FileBrowser=%u", - Gbl.Hierarchy.Crs.Crs.CrsCod,(unsigned) FileBrowser); + Gbl.Hierarchy.Crs.CrsCod,(unsigned) FileBrowser); break; case Brw_ADMI_BRF_USR: DB_QuerySELECT (&mysql_res,"can not get size of a file browser", @@ -2424,7 +2424,7 @@ static void Fig_GetSizeOfFileZoneFromDB (Hie_Level_t Scope, " WHERE crs_usr.CrsCod=%ld" " AND crs_usr.UsrCod=file_browser_size.ZoneUsrCod" " AND file_browser_size.FileBrowser=%u", - Gbl.Hierarchy.Crs.Crs.CrsCod,(unsigned) FileBrowser); + Gbl.Hierarchy.Crs.CrsCod,(unsigned) FileBrowser); break; default: Lay_ShowErrorAndExit ("Wrong file browser."); @@ -2944,7 +2944,7 @@ static void Fig_GetNumberOfOERsFromDB (Hie_Level_t Scope,Brw_License_t License,u " AND FileBrowser IN (%u,%u)" " AND License=%u" " GROUP BY Public", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, (unsigned) Brw_ADMI_DOC_CRS, (unsigned) Brw_ADMI_SHR_CRS, (unsigned) License); @@ -3468,7 +3468,7 @@ static void Fig_GetAndShowSocialActivityStats (void) " WHERE crs_usr.CrsCod=%ld" " AND crs_usr.UsrCod=social_notes.UsrCod" " AND social_notes.NoteType=%u", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, (unsigned) NoteType); break; default: @@ -3587,7 +3587,7 @@ static void Fig_GetAndShowSocialActivityStats (void) " FROM crs_usr,social_notes" " WHERE crs_usr.CrsCod=%ld" " AND crs_usr.UsrCod=social_notes.UsrCod", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); break; default: Lay_WrongScopeExit (); @@ -3780,7 +3780,7 @@ static void Fig_GetAndShowFollowStats (void) " WHERE crs_usr.CrsCod=%ld" " AND crs_usr.UsrCod=usr_follow.%s", FieldDB[Fol], - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, FieldDB[Fol]); break; default: @@ -3902,7 +3902,7 @@ static void Fig_GetAndShowFollowStats (void) " AND crs_usr.UsrCod=usr_follow.%s" " GROUP BY %s) AS F", FieldDB[Fol], - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, FieldDB[Fol], FieldDB[1 - Fol]); break; @@ -4062,8 +4062,8 @@ static void Fig_GetAndShowForumStats (void) Fig_ShowStatOfAForumType (For_FORUM_COURSE_TCHS,-1L,-1L,-1L,Gbl.Hierarchy.Deg.DegCod,-1L,&FiguresForum); break; case Hie_CRS: - Fig_ShowStatOfAForumType (For_FORUM_COURSE_USRS,-1L,-1L,-1L,-1L,Gbl.Hierarchy.Crs.Crs.CrsCod,&FiguresForum); - Fig_ShowStatOfAForumType (For_FORUM_COURSE_TCHS,-1L,-1L,-1L,-1L,Gbl.Hierarchy.Crs.Crs.CrsCod,&FiguresForum); + Fig_ShowStatOfAForumType (For_FORUM_COURSE_USRS,-1L,-1L,-1L,-1L,Gbl.Hierarchy.Crs.CrsCod,&FiguresForum); + Fig_ShowStatOfAForumType (For_FORUM_COURSE_TCHS,-1L,-1L,-1L,-1L,Gbl.Hierarchy.Crs.CrsCod,&FiguresForum); break; default: Lay_WrongScopeExit (); @@ -4431,7 +4431,7 @@ static void Fig_GetAndShowNumUsrsPerNotifyEvent (void) " FROM sta_notif" " WHERE CrsCod=%ld" " AND NotifyEvent=%u", - Gbl.Hierarchy.Crs.Crs.CrsCod,(unsigned) NotifyEvent); + Gbl.Hierarchy.Crs.CrsCod,(unsigned) NotifyEvent); break; default: Lay_WrongScopeExit (); @@ -5657,7 +5657,7 @@ unsigned Fig_GetNumUsrsWhoChoseAnOption (const char *SubQuery) " WHERE crs_usr.CrsCod=%ld" " AND crs_usr.UsrCod=usr_data.UsrCod" " AND %s", - Gbl.Hierarchy.Crs.Crs.CrsCod,SubQuery); + Gbl.Hierarchy.Crs.CrsCod,SubQuery); break; default: Lay_WrongScopeExit (); diff --git a/swad_file_browser.c b/swad_file_browser.c index dceeb44d..b4111537 100644 --- a/swad_file_browser.c +++ b/swad_file_browser.c @@ -1414,7 +1414,7 @@ static int Brw_RemoveFolderFromDiskAndDB (const char Path[PATH_MAX + 1], void Brw_GetParAndInitFileBrowser (void) { /***** If a group is selected, get its data *****/ - if ((Gbl.Hierarchy.Crs.Grps.GrpCod = Brw_GetGrpSettings ()) > 0) + if ((Gbl.Crs.Grps.GrpCod = Brw_GetGrpSettings ()) > 0) Brw_GetDataCurrentGrp (); /***** Get type of file browser *****/ @@ -1601,7 +1601,7 @@ void Brw_GetParAndInitFileBrowser (void) case ActSeeAdmDocCrsGrp: // Access to a documents zone from menu case ActChgToSeeDocCrs: // Access to see a documents zone /* Set file browser type acording to last group accessed */ - Gbl.FileBrowser.Type = (Gbl.Hierarchy.Crs.Grps.GrpCod > 0) ? Brw_SHOW_DOC_GRP : + Gbl.FileBrowser.Type = (Gbl.Crs.Grps.GrpCod > 0) ? Brw_SHOW_DOC_GRP : Brw_SHOW_DOC_CRS; break; case ActSeeDocCrs: @@ -1622,7 +1622,7 @@ void Brw_GetParAndInitFileBrowser (void) break; case ActChgToAdmDocCrs: // Access to admin a documents zone /* Set file browser type acording to last group accessed */ - Gbl.FileBrowser.Type = (Gbl.Hierarchy.Crs.Grps.GrpCod > 0) ? Brw_ADMI_DOC_GRP : + Gbl.FileBrowser.Type = (Gbl.Crs.Grps.GrpCod > 0) ? Brw_ADMI_DOC_GRP : Brw_ADMI_DOC_CRS; break; case ActAdmDocCrs: @@ -1676,7 +1676,7 @@ void Brw_GetParAndInitFileBrowser (void) case ActAdmTchCrsGrp: case ActChgToAdmTch: // Access to a teachers zone from menu /* Set file browser type acording to last group accessed */ - Gbl.FileBrowser.Type = (Gbl.Hierarchy.Crs.Grps.GrpCod > 0) ? Brw_ADMI_TCH_GRP : + Gbl.FileBrowser.Type = (Gbl.Crs.Grps.GrpCod > 0) ? Brw_ADMI_TCH_GRP : Brw_ADMI_TCH_CRS; break; case ActAdmTchCrs: @@ -1726,7 +1726,7 @@ void Brw_GetParAndInitFileBrowser (void) case ActAdmShaCrsGrp: case ActChgToAdmSha: // Access to a shared zone from menu /* Set file browser type acording to last group accessed */ - Gbl.FileBrowser.Type = (Gbl.Hierarchy.Crs.Grps.GrpCod > 0) ? Brw_ADMI_SHR_GRP : + Gbl.FileBrowser.Type = (Gbl.Crs.Grps.GrpCod > 0) ? Brw_ADMI_SHR_GRP : Brw_ADMI_SHR_CRS; break; case ActAdmShaCrs: @@ -1916,12 +1916,12 @@ void Brw_GetParAndInitFileBrowser (void) { case Rol_STD: case Rol_NET: - Gbl.FileBrowser.Type = (Gbl.Hierarchy.Crs.Grps.GrpCod > 0) ? Brw_SHOW_MRK_GRP : + Gbl.FileBrowser.Type = (Gbl.Crs.Grps.GrpCod > 0) ? Brw_SHOW_MRK_GRP : Brw_SHOW_MRK_CRS; break; case Rol_TCH: case Rol_SYS_ADM: - Gbl.FileBrowser.Type = (Gbl.Hierarchy.Crs.Grps.GrpCod > 0) ? Brw_ADMI_MRK_GRP : + Gbl.FileBrowser.Type = (Gbl.Crs.Grps.GrpCod > 0) ? Brw_ADMI_MRK_GRP : Brw_ADMI_MRK_CRS; break; default: @@ -1931,7 +1931,7 @@ void Brw_GetParAndInitFileBrowser (void) break; case ActChgToSeeMrk: // Access to see a marks zone /* Set file browser type acording to last group accessed */ - Gbl.FileBrowser.Type = (Gbl.Hierarchy.Crs.Grps.GrpCod > 0) ? Brw_SHOW_MRK_GRP : + Gbl.FileBrowser.Type = (Gbl.Crs.Grps.GrpCod > 0) ? Brw_SHOW_MRK_GRP : Brw_SHOW_MRK_CRS; break; case ActSeeMrkCrs: @@ -1950,7 +1950,7 @@ void Brw_GetParAndInitFileBrowser (void) break; case ActChgToAdmMrk: // Access to admin a marks zone /* Set file browser type acording to last group accessed */ - Gbl.FileBrowser.Type = (Gbl.Hierarchy.Crs.Grps.GrpCod > 0) ? Brw_ADMI_MRK_GRP : + Gbl.FileBrowser.Type = (Gbl.Crs.Grps.GrpCod > 0) ? Brw_ADMI_MRK_GRP : Brw_ADMI_MRK_CRS; break; case ActAdmMrkCrs: @@ -2184,9 +2184,9 @@ static void Brw_GetDataCurrentGrp (void) { struct GroupData GrpDat; - if (Gbl.Hierarchy.Crs.Grps.GrpCod > 0) + if (Gbl.Crs.Grps.GrpCod > 0) { - GrpDat.GrpCod = Gbl.Hierarchy.Crs.Grps.GrpCod; + GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod; Grp_GetDataOfGroupByCod (&GrpDat); switch (Gbl.Action.Act) @@ -2214,34 +2214,34 @@ static void Brw_GetDataCurrentGrp (void) and check if I belongs to the selected group *****/ if (GrpDat.FileZones) { - if (!Grp_GetIfIBelongToGrp (Gbl.Hierarchy.Crs.Grps.GrpCod)) - Gbl.Hierarchy.Crs.Grps.GrpCod = -1L; // Go to course zone + if (!Grp_GetIfIBelongToGrp (Gbl.Crs.Grps.GrpCod)) + Gbl.Crs.Grps.GrpCod = -1L; // Go to course zone } else - Gbl.Hierarchy.Crs.Grps.GrpCod = -1L; // Go to course zone + Gbl.Crs.Grps.GrpCod = -1L; // Go to course zone break; default: /***** For security, check if group file zones are enabled, and check if I belongs to the selected group *****/ if (!GrpDat.FileZones) Lay_ShowErrorAndExit ("The group has no file zones."); - else if (!Grp_GetIfIBelongToGrp (Gbl.Hierarchy.Crs.Grps.GrpCod)) + else if (!Grp_GetIfIBelongToGrp (Gbl.Crs.Grps.GrpCod)) Lay_ShowErrorAndExit ("You don't have access to the group."); break; } /***** Get data of the current group *****/ - if (Gbl.Hierarchy.Crs.Grps.GrpCod > 0) + if (Gbl.Crs.Grps.GrpCod > 0) { - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod = GrpDat.GrpTypCod; - Str_Copy (Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypName,GrpDat.GrpTypName, + Gbl.Crs.Grps.GrpTyp.GrpTypCod = GrpDat.GrpTypCod; + Str_Copy (Gbl.Crs.Grps.GrpTyp.GrpTypName,GrpDat.GrpTypName, Grp_MAX_BYTES_GROUP_TYPE_NAME); - Str_Copy (Gbl.Hierarchy.Crs.Grps.GrpName,GrpDat.GrpName, + Str_Copy (Gbl.Crs.Grps.GrpName,GrpDat.GrpName, Grp_MAX_BYTES_GROUP_NAME); - Gbl.Hierarchy.Crs.Grps.MaxStudents = GrpDat.MaxStudents; - Gbl.Hierarchy.Crs.Grps.Open = GrpDat.Open; - Gbl.Hierarchy.Crs.Grps.FileZones = GrpDat.FileZones; - Gbl.Hierarchy.Crs.Grps.GrpTyp.MultipleEnrolment = GrpDat.MultipleEnrolment; + Gbl.Crs.Grps.MaxStudents = GrpDat.MaxStudents; + Gbl.Crs.Grps.Open = GrpDat.Open; + Gbl.Crs.Grps.FileZones = GrpDat.FileZones; + Gbl.Crs.Grps.GrpTyp.MultipleEnrolment = GrpDat.MultipleEnrolment; } } } @@ -2275,7 +2275,7 @@ void Brw_PutParamsFileBrowser (Act_Action_t NextAction, { if (Brw_GetIfGroupFileBrowser ()) // This file browser needs specify a group /***** Group code *****/ - Grp_PutParamGrpCod (Gbl.Hierarchy.Crs.Grps.GrpCod); + Grp_PutParamGrpCod (Gbl.Crs.Grps.GrpCod); else if (Brw_GetIfProjectFileBrowser ()) // This file browser needs specify a project /***** Project code *****/ Prj_PutParamPrjCod (Gbl.Prjs.PrjCod); @@ -2487,7 +2487,7 @@ static void Brw_SetPathFileBrowser (void) case Brw_ADMI_MRK_CRS: /* Create path to the current course */ Str_Copy (Gbl.FileBrowser.Priv.PathAboveRootFolder, - Gbl.Hierarchy.Crs.PathPriv, + Gbl.Crs.PathPriv, PATH_MAX); break; case Brw_SHOW_DOC_GRP: @@ -2499,14 +2499,14 @@ static void Brw_SetPathFileBrowser (void) /* Create a directory for groups inside the current course */ snprintf (Path,sizeof (Path), "%s/%s", - Gbl.Hierarchy.Crs.PathPriv,Cfg_FOLDER_GRP); + Gbl.Crs.PathPriv,Cfg_FOLDER_GRP); Fil_CreateDirIfNotExists (Path); /* Create path to this group */ snprintf (Path,sizeof (Path), "%s/%s/%ld", - Gbl.Hierarchy.Crs.PathPriv,Cfg_FOLDER_GRP, - Gbl.Hierarchy.Crs.Grps.GrpCod); + Gbl.Crs.PathPriv,Cfg_FOLDER_GRP, + Gbl.Crs.Grps.GrpCod); Str_Copy (Gbl.FileBrowser.Priv.PathAboveRootFolder, Path, PATH_MAX); @@ -2516,21 +2516,21 @@ static void Brw_SetPathFileBrowser (void) /* Create a directory for me inside the current course */ snprintf (Path,sizeof (Path), "%s/%s", - Gbl.Hierarchy.Crs.PathPriv,Cfg_FOLDER_USR); + Gbl.Crs.PathPriv,Cfg_FOLDER_USR); Fil_CreateDirIfNotExists (Path); /* Create a directory for all users whose codes end in my-user-code mod 100 */ snprintf (Path,sizeof (Path), "%s/%s/%02u", - Gbl.Hierarchy.Crs.PathPriv,Cfg_FOLDER_USR, + Gbl.Crs.PathPriv,Cfg_FOLDER_USR, (unsigned) (Gbl.Usrs.Me.UsrDat.UsrCod % 100)); Fil_CreateDirIfNotExists (Path); /* Create path to me */ snprintf (Path,sizeof (Path), "%s/%s/%02u/%ld", - Gbl.Hierarchy.Crs.PathPriv,Cfg_FOLDER_USR, + Gbl.Crs.PathPriv,Cfg_FOLDER_USR, (unsigned) (Gbl.Usrs.Me.UsrDat.UsrCod % 100), Gbl.Usrs.Me.UsrDat.UsrCod); Str_Copy (Gbl.FileBrowser.Priv.PathAboveRootFolder, @@ -2544,21 +2544,21 @@ static void Brw_SetPathFileBrowser (void) /* Create a directory for this user inside the current course */ snprintf (Path,sizeof (Path), "%s/%s", - Gbl.Hierarchy.Crs.PathPriv,Cfg_FOLDER_USR); + Gbl.Crs.PathPriv,Cfg_FOLDER_USR); Fil_CreateDirIfNotExists (Path); /* Create a directory for all users whose codes end in user-code mod 100 */ snprintf (Path,sizeof (Path), "%s/%s/%02u", - Gbl.Hierarchy.Crs.PathPriv,Cfg_FOLDER_USR, + Gbl.Crs.PathPriv,Cfg_FOLDER_USR, (unsigned) (Gbl.Usrs.Other.UsrDat.UsrCod % 100)); Fil_CreateDirIfNotExists (Path); /* Create path to user */ snprintf (Path,sizeof (Path), "%s/%s/%02u/%ld", - Gbl.Hierarchy.Crs.PathPriv,Cfg_FOLDER_USR, + Gbl.Crs.PathPriv,Cfg_FOLDER_USR, (unsigned) (Gbl.Usrs.Other.UsrDat.UsrCod % 100), Gbl.Usrs.Other.UsrDat.UsrCod); Str_Copy (Gbl.FileBrowser.Priv.PathAboveRootFolder, @@ -2571,21 +2571,21 @@ static void Brw_SetPathFileBrowser (void) /* Create a directory for projects inside the current course */ snprintf (Path,sizeof (Path), "%s/%s", - Gbl.Hierarchy.Crs.PathPriv,Cfg_FOLDER_PRJ); + Gbl.Crs.PathPriv,Cfg_FOLDER_PRJ); Fil_CreateDirIfNotExists (Path); /* Create a directory for all projects which codes end in project-code mod 100 */ snprintf (Path,sizeof (Path), "%s/%s/%02u", - Gbl.Hierarchy.Crs.PathPriv,Cfg_FOLDER_PRJ, + Gbl.Crs.PathPriv,Cfg_FOLDER_PRJ, (unsigned) (Gbl.Prjs.PrjCod % 100)); Fil_CreateDirIfNotExists (Path); /* Create path to the current project */ snprintf (Path,sizeof (Path), "%s/%s/%02u/%ld", - Gbl.Hierarchy.Crs.PathPriv,Cfg_FOLDER_PRJ, + Gbl.Crs.PathPriv,Cfg_FOLDER_PRJ, (unsigned) (Gbl.Prjs.PrjCod % 100), Gbl.Prjs.PrjCod); Str_Copy (Gbl.FileBrowser.Priv.PathAboveRootFolder, @@ -2643,7 +2643,7 @@ bool Brw_CheckIfExistsFolderAssigmentForAnyUsr (const char *FolderName) " from current course", "SELECT UsrCod FROM crs_usr" " WHERE CrsCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); /***** Check folders *****/ for (NumUsr = 0; @@ -2657,7 +2657,7 @@ bool Brw_CheckIfExistsFolderAssigmentForAnyUsr (const char *FolderName) /* Check if folder exists */ snprintf (PathFolder,sizeof (PathFolder), "%s/usr/%02u/%ld/%s/%s", - Gbl.Hierarchy.Crs.PathPriv, + Gbl.Crs.PathPriv, (unsigned) (UsrCod % 100), UsrCod, // User's code Brw_INTERNAL_NAME_ROOT_FOLDER_ASSIGNMENTS, @@ -2696,7 +2696,7 @@ static void Brw_CreateFoldersAssignmentsIfNotExist (long ZoneUsrCod) " AsgCod IN (SELECT asg_grp.AsgCod FROM asg_grp,crs_grp_usr" " WHERE crs_grp_usr.UsrCod=%ld" " AND asg_grp.GrpCod=crs_grp_usr.GrpCod))", - Gbl.Hierarchy.Crs.Crs.CrsCod,ZoneUsrCod); + Gbl.Hierarchy.Crs.CrsCod,ZoneUsrCod); /***** Create one folder for each assignment *****/ for (NumRow = 0; @@ -2749,7 +2749,7 @@ bool Brw_UpdateFoldersAssigmentsIfExistForAllUsrs (const char *OldFolderName,con " from current course", "SELECT UsrCod FROM crs_usr" " WHERE CrsCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); /***** Check if there exist folders with the new name *****/ for (NumUsr = 0; @@ -2763,14 +2763,14 @@ bool Brw_UpdateFoldersAssigmentsIfExistForAllUsrs (const char *OldFolderName,con /* Rename folder if exists */ snprintf (PathOldFolder,sizeof (PathOldFolder), "%s/usr/%02u/%ld/%s/%s", - Gbl.Hierarchy.Crs.PathPriv, + Gbl.Crs.PathPriv, (unsigned) (UsrCod % 100), UsrCod, // User's code Brw_INTERNAL_NAME_ROOT_FOLDER_ASSIGNMENTS, OldFolderName); snprintf (PathNewFolder,sizeof (PathNewFolder), "%s/usr/%02u/%ld/%s/%s", - Gbl.Hierarchy.Crs.PathPriv, + Gbl.Crs.PathPriv, (unsigned) (UsrCod % 100), UsrCod, // User's code Brw_INTERNAL_NAME_ROOT_FOLDER_ASSIGNMENTS, @@ -2795,7 +2795,7 @@ bool Brw_UpdateFoldersAssigmentsIfExistForAllUsrs (const char *OldFolderName,con /* Rename folder if exists */ snprintf (PathOldFolder,sizeof (PathOldFolder), "%s/usr/%02u/%ld/%s/%s", - Gbl.Hierarchy.Crs.PathPriv, + Gbl.Crs.PathPriv, (unsigned) (UsrCod % 100), UsrCod, // User's code Brw_INTERNAL_NAME_ROOT_FOLDER_ASSIGNMENTS, @@ -2804,7 +2804,7 @@ bool Brw_UpdateFoldersAssigmentsIfExistForAllUsrs (const char *OldFolderName,con { snprintf (PathNewFolder,sizeof (PathNewFolder), "%s/usr/%02u/%ld/%s/%s", - Gbl.Hierarchy.Crs.PathPriv, + Gbl.Crs.PathPriv, (unsigned) (UsrCod % 100), UsrCod, // User's code Brw_INTERNAL_NAME_ROOT_FOLDER_ASSIGNMENTS, @@ -2874,7 +2874,7 @@ void Brw_RemoveFoldersAssignmentsIfExistForAllUsrs (const char *FolderName) " from current course", "SELECT UsrCod FROM crs_usr" " WHERE CrsCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); /***** Remove folders *****/ for (NumUsr = 0; @@ -2888,7 +2888,7 @@ void Brw_RemoveFoldersAssignmentsIfExistForAllUsrs (const char *FolderName) /* Remove tree if exists */ snprintf (PathFolder,sizeof (PathFolder), "%s/usr/%02u/%ld/%s/%s", - Gbl.Hierarchy.Crs.PathPriv, + Gbl.Crs.PathPriv, (unsigned) (UsrCod % 100), UsrCod, // User's code Brw_INTERNAL_NAME_ROOT_FOLDER_ASSIGNMENTS, @@ -3309,7 +3309,7 @@ static void Brw_FormToChangeCrsGrpZone (void) Gbl.FileBrowser.Type == Brw_ADMI_MRK_GRP; /***** Get list of groups to show *****/ - if (Gbl.Hierarchy.Crs.Grps.NumGrps) // This course has groups? + if (Gbl.Crs.Grps.NumGrps) // This course has groups? /* Get list of group with file zones which I belong to */ Grp_GetLstCodGrpsWithFileZonesIBelong (&LstMyGrps); @@ -3333,10 +3333,10 @@ static void Brw_FormToChangeCrsGrpZone (void) "" "
  • ", Gbl.Form.Id, - Gbl.Hierarchy.Crs.Crs.FullName); + Gbl.Hierarchy.Crs.FullName); /***** List my groups for unique selection *****/ - if (Gbl.Hierarchy.Crs.Grps.NumGrps) // This course has groups? + if (Gbl.Crs.Grps.NumGrps) // This course has groups? { for (NumGrp = 0; NumGrp < LstMyGrps.NumGrps; @@ -3355,13 +3355,13 @@ static void Brw_FormToChangeCrsGrpZone (void) "" "" "", - Txt_The_whole_course,Gbl.Hierarchy.Crs.Crs.ShrtName); + Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName); /***** List the groups for each group type *****/ for (NumGrpTyp = 0; - NumGrpTyp < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num; + NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num; NumGrpTyp++) - if (Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) - Grp_ListGrpsToEditAsgAttSvyGam (&Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp], + if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) + Grp_ListGrpsToEditAsgAttSvyGam (&Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp], GamCod,Grp_SURVEY); /***** End table and box *****/ @@ -2092,7 +2092,7 @@ void Gam_RecFormGame (void) Gbl.Usrs.Me.Role.Logged != Rol_TCH) Lay_ShowErrorAndExit ("Wrong game scope."); NewGame.Scope = Hie_CRS; - NewGame.Cod = Gbl.Hierarchy.Crs.Crs.CrsCod; + NewGame.Cod = Gbl.Hierarchy.Crs.CrsCod; break; default: Lay_WrongScopeExit (); @@ -2182,7 +2182,7 @@ static void Gam_CreateGame (struct Game *Game,const char *Txt) Txt); /***** Create groups *****/ - if (Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps) + if (Gbl.Crs.Grps.LstGrpsSel.NumGrps) Gam_CreateGrps (Game->GamCod); /***** Write success message *****/ @@ -2219,7 +2219,7 @@ static void Gam_UpdateGame (struct Game *Game,const char *Txt) Gam_RemoveAllTheGrpsAssociatedToAndGame (Game->GamCod); /* Create new groups */ - if (Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps) + if (Gbl.Crs.Grps.LstGrpsSel.NumGrps) Gam_CreateGrps (Game->GamCod); /***** Write success message *****/ @@ -2302,7 +2302,7 @@ static void Gam_CreateGrps (long GamCod) /***** Create groups of the game *****/ for (NumGrpSel = 0; - NumGrpSel < Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps; + NumGrpSel < Gbl.Crs.Grps.LstGrpsSel.NumGrps; NumGrpSel++) /* Create group */ DB_QueryINSERT ("can not associate a group to a game", @@ -2310,7 +2310,7 @@ static void Gam_CreateGrps (long GamCod) " (GamCod,GrpCod)" " VALUES" " (%ld,%ld)", - GamCod,Gbl.Hierarchy.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]); + GamCod,Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]); } /*****************************************************************************/ @@ -2371,7 +2371,7 @@ static void Gam_GetAndWriteNamesOfGrpsAssociatedToGame (struct Game *Game) } else fprintf (Gbl.F.Out,"%s %s", - Txt_The_whole_course,Gbl.Hierarchy.Crs.Crs.ShrtName); + Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName); fprintf (Gbl.F.Out,""); @@ -3847,7 +3847,7 @@ unsigned Gam_GetNumCoursesWithGames (Hie_Level_t Scope) " FROM games" " WHERE Scope='%s' AND Cod=%ld", Sco_GetDBStrFromScope (Hie_CRS), - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); break; default: Lay_WrongScopeExit (); @@ -3939,7 +3939,7 @@ unsigned Gam_GetNumGames (Hie_Level_t Scope) " WHERE games.Scope='%s'" " AND CrsCod=%ld", Sco_GetDBStrFromScope (Hie_CRS), - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); break; default: Lay_WrongScopeExit (); @@ -4046,7 +4046,7 @@ float Gam_GetNumQstsPerCrsGame (Hie_Level_t Scope) " WHERE games.Scope='%s' AND games.Cod=%ld" " AND games.GamCod=gam_questions.GamCod" " GROUP BY gam_questions.GamCod) AS NumQstsTable", - Sco_GetDBStrFromScope (Hie_CRS),Gbl.Hierarchy.Crs.Crs.CrsCod); + Sco_GetDBStrFromScope (Hie_CRS),Gbl.Hierarchy.Crs.CrsCod); break; default: Lay_WrongScopeExit (); diff --git a/swad_global.c b/swad_global.c index db31bfdf..057f36bb 100644 --- a/swad_global.c +++ b/swad_global.c @@ -218,7 +218,7 @@ void Gbl_InitializeGlobals (void) Gbl.Hierarchy.Ins.ShrtName[0] = '\0'; Gbl.Hierarchy.Ins.FullName[0] = '\0'; Gbl.Hierarchy.Ins.WWW[0] = '\0'; - Gbl.Hierarchy.Ins.NumCtrs = Gbl.Hierarchy.Ins.NumDpts = Gbl.Hierarchy.Ins.NumDegs = 0; + Gbl.Hierarchy.Ins.Ctrs.Num = Gbl.Hierarchy.Ins.NumDpts = Gbl.Hierarchy.Ins.NumDegs = 0; Gbl.Hierarchy.Ins.NumUsrs = 0; Gbl.Hierarchy.Ctr.ShrtName[0] = '\0'; @@ -226,39 +226,37 @@ void Gbl_InitializeGlobals (void) Gbl.Hierarchy.Ctr.Degs.Num = 0; Gbl.Hierarchy.Ctr.Degs.Lst = NULL; - Gbl.Hierarchy.DegTyp.DegTypName[0] = '\0'; - Gbl.Hierarchy.Deg.ShrtName[0] = Gbl.Hierarchy.Deg.FullName[0] = '\0'; Gbl.Classrooms.EditingCla.Capacity = Cla_UNLIMITED_CAPACITY; - Gbl.Hierarchy.Crs.Crs.ShrtName[0] = Gbl.Hierarchy.Crs.Crs.FullName[0] = '\0'; - Gbl.Hierarchy.Crs.Info.ShowMsgMustBeRead = 0; - Gbl.Hierarchy.Crs.Notices.HighlightNotCod = -1L; // No notice highlighted + Gbl.Hierarchy.Crs.ShrtName[0] = Gbl.Hierarchy.Crs.FullName[0] = '\0'; + Gbl.Crs.Info.ShowMsgMustBeRead = 0; + Gbl.Crs.Notices.HighlightNotCod = -1L; // No notice highlighted - Gbl.Inss.Num = 0; - Gbl.Inss.Lst = NULL; - Gbl.Inss.SelectedOrder = Ins_ORDER_DEFAULT; + Gbl.Hierarchy.Cty.Inss.Num = 0; + Gbl.Hierarchy.Cty.Inss.Lst = NULL; + Gbl.Hierarchy.Cty.Inss.SelectedOrder = Ins_ORDER_DEFAULT; Gbl.Inss.EditingIns.InsCod = -1L; Gbl.Inss.EditingIns.CtyCod = -1L; Gbl.Inss.EditingIns.ShrtName[0] = '\0'; Gbl.Inss.EditingIns.FullName[0] = '\0'; Gbl.Inss.EditingIns.WWW[0] = '\0'; - Gbl.Inss.EditingIns.NumCtrs = Gbl.Inss.EditingIns.NumDpts = Gbl.Inss.EditingIns.NumDegs = 0; + Gbl.Inss.EditingIns.Ctrs.Num = Gbl.Inss.EditingIns.NumDpts = Gbl.Inss.EditingIns.NumDegs = 0; Gbl.Inss.EditingIns.NumUsrs = 0; - Gbl.Ctys.Num = 0; - Gbl.Ctys.Lst = NULL; - Gbl.Ctys.SelectedOrder = Cty_ORDER_DEFAULT; + Gbl.Hierarchy.Sys.Ctys.Num = 0; + Gbl.Hierarchy.Sys.Ctys.Lst = NULL; + Gbl.Hierarchy.Sys.Ctys.SelectedOrder = Cty_ORDER_DEFAULT; Gbl.Ctys.EditingCty.CtyCod = -1L; for (Lan = (Lan_Language_t) 1; Lan <= Lan_NUM_LANGUAGES; Lan++) Gbl.Ctys.EditingCty.Name[Lan][0] = '\0'; - Gbl.Ctrs.Num = 0; - Gbl.Ctrs.Lst = NULL; - Gbl.Ctrs.SelectedOrder = Ctr_ORDER_DEFAULT; + Gbl.Hierarchy.Ins.Ctrs.Num = 0; + Gbl.Hierarchy.Ins.Ctrs.Lst = NULL; + Gbl.Hierarchy.Ins.Ctrs.SelectedOrder = Ctr_ORDER_DEFAULT; Gbl.Ctrs.EditingCtr.CtrCod = -1L; Gbl.Ctrs.EditingCtr.InsCod = -1L; Gbl.Ctrs.EditingCtr.CtrCod = -1L; @@ -293,52 +291,52 @@ void Gbl_InitializeGlobals (void) Gbl.Hlds.EditingHld.StartDate.Day = Gbl.Hlds.EditingHld.EndDate.Day = Gbl.Now.Date.Day; Gbl.Hlds.EditingHld.Name[0] = '\0'; - Gbl.Degs.DegTypes.Num = 0; - Gbl.Degs.DegTypes.Lst = NULL; + Gbl.DegTypes.Num = 0; + Gbl.DegTypes.Lst = NULL; - Gbl.Degs.EditingDegTyp.DegTypCod = -1L; - Gbl.Degs.EditingDegTyp.DegTypName[0] = '\0'; + Gbl.DegTypes.EditingDegTyp.DegTypCod = -1L; + Gbl.DegTypes.EditingDegTyp.DegTypName[0] = '\0'; Gbl.Degs.EditingDeg.DegCod = -1L; Gbl.Degs.EditingDeg.ShrtName[0] = '\0'; Gbl.Degs.EditingDeg.FullName[0] = '\0'; Gbl.Degs.EditingDeg.WWW[0] = '\0'; - Gbl.Degs.EditingDeg.LstCrss = NULL; + Gbl.Degs.EditingDeg.Crss.Lst = NULL; - Gbl.Degs.EditingCrs.CrsCod = -1L; - Gbl.Degs.EditingCrs.DegCod = -1L; - Gbl.Degs.EditingCrs.Year = 0; - Gbl.Degs.EditingCrs.ShrtName[0] = '\0'; - Gbl.Degs.EditingCrs.FullName[0] = '\0'; + Gbl.Crss.EditingCrs.CrsCod = -1L; + Gbl.Crss.EditingCrs.DegCod = -1L; + Gbl.Crss.EditingCrs.Year = 0; + Gbl.Crss.EditingCrs.ShrtName[0] = '\0'; + Gbl.Crss.EditingCrs.FullName[0] = '\0'; - Gbl.Hierarchy.Crs.Grps.NumGrps = 0; - Gbl.Hierarchy.Crs.Grps.WhichGrps = Grp_WHICH_GROUPS_DEFAULT; - Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes = NULL; - Gbl.Hierarchy.Crs.Grps.GrpTypes.Num = 0; - Gbl.Hierarchy.Crs.Grps.GrpTypes.NestedCalls = 0; - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypName[0] = '\0'; - Gbl.Hierarchy.Crs.Grps.GrpTyp.MandatoryEnrolment = true; - Gbl.Hierarchy.Crs.Grps.GrpTyp.MultipleEnrolment = false; - Gbl.Hierarchy.Crs.Grps.GrpTyp.MustBeOpened = false; - Gbl.Hierarchy.Crs.Grps.GrpTyp.OpenTimeUTC = (time_t) 0; - Gbl.Hierarchy.Crs.Grps.GrpCod = -1L; // -1L stands for the whole course - Gbl.Hierarchy.Crs.Grps.GrpName[0] = '\0'; - Gbl.Hierarchy.Crs.Grps.ClaCod = -1L; // -1L stands for no classroom assigned - Gbl.Hierarchy.Crs.Grps.MaxStudents = Grp_NUM_STUDENTS_NOT_LIMITED; - Gbl.Hierarchy.Crs.Grps.Open = false; - Gbl.Hierarchy.Crs.Grps.LstGrpsSel.GrpCods = NULL; - Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps = 0; - Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NestedCalls = 0; + Gbl.Crs.Grps.NumGrps = 0; + Gbl.Crs.Grps.WhichGrps = Grp_WHICH_GROUPS_DEFAULT; + Gbl.Crs.Grps.GrpTypes.LstGrpTypes = NULL; + Gbl.Crs.Grps.GrpTypes.Num = 0; + Gbl.Crs.Grps.GrpTypes.NestedCalls = 0; + Gbl.Crs.Grps.GrpTyp.GrpTypName[0] = '\0'; + Gbl.Crs.Grps.GrpTyp.MandatoryEnrolment = true; + Gbl.Crs.Grps.GrpTyp.MultipleEnrolment = false; + Gbl.Crs.Grps.GrpTyp.MustBeOpened = false; + Gbl.Crs.Grps.GrpTyp.OpenTimeUTC = (time_t) 0; + Gbl.Crs.Grps.GrpCod = -1L; // -1L stands for the whole course + Gbl.Crs.Grps.GrpName[0] = '\0'; + Gbl.Crs.Grps.ClaCod = -1L; // -1L stands for no classroom assigned + Gbl.Crs.Grps.MaxStudents = Grp_NUM_STUDENTS_NOT_LIMITED; + Gbl.Crs.Grps.Open = false; + Gbl.Crs.Grps.LstGrpsSel.GrpCods = NULL; + Gbl.Crs.Grps.LstGrpsSel.NumGrps = 0; + Gbl.Crs.Grps.LstGrpsSel.NestedCalls = 0; Gbl.Usrs.ClassPhoto.AllGroups = true; - Gbl.Hierarchy.Crs.Records.Field.Name[0] = '\0'; - Gbl.Hierarchy.Crs.Records.Field.NumLines = Rec_MIN_LINES_IN_EDITION_FIELD; - Gbl.Hierarchy.Crs.Records.Field.Visibility = Rec_HIDDEN_FIELD; + Gbl.Crs.Records.Field.Name[0] = '\0'; + Gbl.Crs.Records.Field.NumLines = Rec_MIN_LINES_IN_EDITION_FIELD; + Gbl.Crs.Records.Field.Visibility = Rec_HIDDEN_FIELD; - Gbl.Hierarchy.Crs.Records.LstFields.Lst = NULL; - Gbl.Hierarchy.Crs.Records.LstFields.Num = 0; - Gbl.Hierarchy.Crs.Records.LstFields.NestedCalls = 0; + Gbl.Crs.Records.LstFields.Lst = NULL; + Gbl.Crs.Records.LstFields.Num = 0; + Gbl.Crs.Records.LstFields.NestedCalls = 0; Gbl.Syllabus.EditionIsActive = false; Gbl.Syllabus.WhichSyllabus = Syl_DEFAULT_WHICH_SYLLABUS; diff --git a/swad_global.h b/swad_global.h index 63127f6c..45aa97f2 100644 --- a/swad_global.h +++ b/swad_global.h @@ -75,6 +75,7 @@ #include "swad_session.h" #include "swad_survey.h" #include "swad_syllabus.h" +#include "swad_system.h" #include "swad_test.h" #include "swad_timeline.h" #include "swad_timetable.h" @@ -204,60 +205,65 @@ struct Globals } HTMLOutput; struct { - unsigned Num; // Number of institutions - struct Instit *Lst; // List of institutions + struct Country EditingCty; + } Ctys; + struct + { struct Instit EditingIns; - Ins_Order_t SelectedOrder; } Inss; struct { - unsigned Num; // Number of centres - struct Centre *Lst; // List of centres struct Centre EditingCtr; - Ctr_Order_t SelectedOrder; } Ctrs; struct { - unsigned Num; // Number of countries - struct Country *Lst; // List of countries - struct Country EditingCty; - Cty_Order_t SelectedOrder; - } Ctys; + struct Degree EditingDeg; + } Degs; + struct + { + struct Course EditingCrs; + } Crss; + struct + { + unsigned Num; // Number of degree types + struct DegreeType *Lst; // List of degree types + struct DegreeType EditingDegTyp; + } DegTypes; struct { unsigned Num; // Number of departments struct Department *Lst; // List of departments - struct Department EditingDpt; Dpt_Order_t SelectedOrder; + struct Department EditingDpt; } Dpts; struct { unsigned Num; // Number of places struct Place *Lst; // List of places - struct Place EditingPlc; Plc_Order_t SelectedOrder; + struct Place EditingPlc; } Plcs; struct { unsigned Num; // Number of classrooms struct Classroom *Lst; // List of classrooms - struct Classroom EditingCla; Cla_Order_t SelectedOrder; + struct Classroom EditingCla; } Classrooms; struct { bool LstIsRead; // Is the list already read from database, or it needs to be read? unsigned Num; // Number of holidays struct Holiday *Lst; // List of holidays - struct Holiday EditingHld; Hld_Order_t SelectedOrder; + struct Holiday EditingHld; } Hlds; struct { unsigned Num; // Number of mail domains struct Mail *Lst; // List of mail domains - struct Mail EditingMai; Mai_DomainsOrder_t SelectedOrder; + struct Mail EditingMai; } Mails; struct { @@ -272,17 +278,6 @@ struct Globals struct Link *Lst; // List of institutional links struct Link EditingLnk; } Links; - struct - { - struct - { - unsigned Num; // Number of degree types - struct DegreeType *Lst; // List of degree types - } DegTypes; - struct DegreeType EditingDegTyp; - struct Degree EditingDeg; - struct Course EditingCrs; - } Degs; struct { Sch_WhatToSearch_t WhatToSearch; @@ -454,50 +449,50 @@ struct Globals { Hie_Level_t Level; // Current level in the hierarchy: system, country, institution, centre, degree or course long Cod; // Code of the current country, institution, centre, degree or course - struct Country Cty; - struct Instit Ins; - struct DegreeType DegTyp; - struct Centre Ctr; - struct Degree Deg; + struct System Sys; // Top level of the hierarchy (system or platform) + struct Country Cty; // Current country + struct Instit Ins; // Current institution + struct Centre Ctr; // Current centre + struct Degree Deg; // Current degree + struct Course Crs; // Current course. Aditional info about course is stored in Gbl.Crs. + } Hierarchy; + struct + { + char PathPriv[PATH_MAX + 1]; // Absolute path to the private directory of the course + char PathRelPubl[PATH_MAX + 1]; // Relative path to the public directory of the course + char PathURLPubl[PATH_MAX + 1]; // Abolute URL to the public part of the course struct { - struct Course Crs; - char PathPriv[PATH_MAX + 1]; // Absolute path to the private directory of the course - char PathRelPubl[PATH_MAX + 1]; // Relative path to the public directory of the course - char PathURLPubl[PATH_MAX + 1]; // Abolute URL to the public part of the course - struct - { - unsigned NumGrps; - struct GroupTypes GrpTypes; - struct GroupType GrpTyp; - long GrpCod; // Group to be edited, removed... - char GrpName[Grp_MAX_BYTES_GROUP_NAME + 1]; - long ClaCod; - unsigned MaxStudents; - bool Open; - bool FileZones; - struct ListCodGrps LstGrpsSel; - Grp_WhichGroups_t WhichGrps; // Show my groups or all groups - } Grps; - struct - { - Inf_InfoType_t Type; - char URL[Cns_MAX_BYTES_WWW + 1]; - bool MustBeRead[Inf_NUM_INFO_TYPES]; // Students must read info? - bool ShowMsgMustBeRead; - } Info; - struct - { - struct RecordField Field; - struct LstRecordFields LstFields; - } Records; - struct - { - long NotCod; // Notice to be edited, removed... used as parameter - long HighlightNotCod; // Notice code of a notice to be highlighted - } Notices; - } Crs; - } Hierarchy; + unsigned NumGrps; + struct GroupTypes GrpTypes; + struct GroupType GrpTyp; + long GrpCod; // Group to be edited, removed... + char GrpName[Grp_MAX_BYTES_GROUP_NAME + 1]; + long ClaCod; + unsigned MaxStudents; + bool Open; + bool FileZones; + struct ListCodGrps LstGrpsSel; + Grp_WhichGroups_t WhichGrps; // Show my groups or all groups + } Grps; + struct + { + Inf_InfoType_t Type; + char URL[Cns_MAX_BYTES_WWW + 1]; + bool MustBeRead[Inf_NUM_INFO_TYPES]; // Students must read info? + bool ShowMsgMustBeRead; + } Info; + struct + { + struct RecordField Field; + struct LstRecordFields LstFields; + } Records; + struct + { + long NotCod; // Notice to be edited, removed... used as parameter + long HighlightNotCod; // Notice code of a notice to be highlighted + } Notices; + } Crs; struct { char PathDir[PATH_MAX + 1]; diff --git a/swad_group.c b/swad_group.c index a55ce7e6..8442079e 100644 --- a/swad_group.c +++ b/swad_group.c @@ -171,14 +171,14 @@ void Grp_WriteNamesOfSelectedGrps (void) /***** Show the selected groups *****/ fprintf (Gbl.F.Out,"%s: ", - (Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps == 1) ? + (Gbl.Crs.Grps.LstGrpsSel.NumGrps == 1) ? Txt_Group : Txt_Groups); for (NumGrpSel = 0; - NumGrpSel < Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps; + NumGrpSel < Gbl.Crs.Grps.LstGrpsSel.NumGrps; NumGrpSel++) { - if ((GrpCod = Gbl.Hierarchy.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]) >= 0) + if ((GrpCod = Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]) >= 0) { GrpDat.GrpCod = GrpCod; Grp_GetDataOfGroupByCod (&GrpDat); @@ -187,19 +187,19 @@ void Grp_WriteNamesOfSelectedGrps (void) } else // GrpCod < 0 ==> students not belonging to any group of type (-GrpCod) { - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod = -GrpCod; - Grp_GetDataOfGroupTypeByCod (&Gbl.Hierarchy.Crs.Grps.GrpTyp); + Gbl.Crs.Grps.GrpTyp.GrpTypCod = -GrpCod; + Grp_GetDataOfGroupTypeByCod (&Gbl.Crs.Grps.GrpTyp); fprintf (Gbl.F.Out,"%s (%s)", - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypName, + Gbl.Crs.Grps.GrpTyp.GrpTypName, Txt_users_with_no_group); } - if (Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps >= 2) + if (Gbl.Crs.Grps.LstGrpsSel.NumGrps >= 2) { - if (NumGrpSel == Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps-2) + if (NumGrpSel == Gbl.Crs.Grps.LstGrpsSel.NumGrps-2) fprintf (Gbl.F.Out," %s ",Txt_and); - if (Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps >= 3) - if (NumGrpSel < Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps-2) + if (Gbl.Crs.Grps.LstGrpsSel.NumGrps >= 3) + if (NumGrpSel < Gbl.Crs.Grps.LstGrpsSel.NumGrps-2) fprintf (Gbl.F.Out,", "); } } @@ -264,7 +264,7 @@ static void Grp_ReqEditGroupsInternal2 (Ale_AlertType_t AlertTypeGroups, Ale_ShowAlert (AlertTypeGroups,AlertTextGroups); /***** Put form to edit groups *****/ - if (Gbl.Hierarchy.Crs.Grps.GrpTypes.Num) // If there are group types... + if (Gbl.Crs.Grps.GrpTypes.Num) // If there are group types... Grp_EditGroups (); /***** End groups section *****/ @@ -295,11 +295,11 @@ static void Grp_EditGroupTypes (void) Grp_PutFormToCreateGroupType (); /***** Forms to edit current group types *****/ - if (Gbl.Hierarchy.Crs.Grps.GrpTypes.Num) // Group types found... + if (Gbl.Crs.Grps.GrpTypes.Num) // Group types found... Grp_ListGroupTypesForEdition (); else // No group types found in this course Ale_ShowAlert (Ale_INFO,Txt_There_are_no_types_of_group_in_the_course_X, - Gbl.Hierarchy.Crs.Crs.ShrtName); + Gbl.Hierarchy.Crs.ShrtName); /***** End box *****/ Box_EndBox (); @@ -323,11 +323,11 @@ static void Grp_EditGroups (void) Grp_PutFormToCreateGroup (); /***** Forms to edit current groups *****/ - if (Gbl.Hierarchy.Crs.Grps.GrpTypes.NumGrpsTotal) // If there are groups... + if (Gbl.Crs.Grps.GrpTypes.NumGrpsTotal) // If there are groups... Grp_ListGroupsForEdition (); else // There are group types, but there aren't groups Ale_ShowAlert (Ale_INFO,Txt_No_groups_have_been_created_in_the_course_X, - Gbl.Hierarchy.Crs.Crs.ShrtName); + Gbl.Hierarchy.Crs.ShrtName); /***** End box *****/ Box_EndBox (); @@ -369,7 +369,7 @@ void Grp_ShowFormToSelectSeveralGroups (Act_Action_t NextAction, unsigned NumGrpTyp; bool ICanEdit; - if (Gbl.Hierarchy.Crs.Grps.NumGrps) + if (Gbl.Crs.Grps.NumGrps) { ICanEdit = !Gbl.Form.Inside && (Gbl.Usrs.Me.Role.Logged == Rol_TCH || @@ -397,10 +397,10 @@ void Grp_ShowFormToSelectSeveralGroups (Act_Action_t NextAction, /***** List the groups for each group type *****/ Tbl_StartTableWide (2); for (NumGrpTyp = 0; - NumGrpTyp < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num; + NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num; NumGrpTyp++) - if (Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) - Grp_ListGrpsForMultipleSelection (&Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp], + if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) + Grp_ListGrpsForMultipleSelection (&Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp], GroupsSelectableByStdsOrNETs); Tbl_EndTable (); @@ -487,16 +487,16 @@ void Grp_PutParamsCodGrps (void) /***** Write the parameter with the list of group codes to show *****/ if (!Gbl.Usrs.ClassPhoto.AllGroups && - Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps) + Gbl.Crs.Grps.LstGrpsSel.NumGrps) { fprintf (Gbl.F.Out,""); } @@ -511,7 +511,7 @@ void Grp_GetParCodsSeveralGrpsToShowUsrs (void) struct ListCodGrps LstGrpsIBelong; unsigned NumGrp; - if (++Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NestedCalls > 1) // If list is created yet, there's nothing to do + if (++Gbl.Crs.Grps.LstGrpsSel.NestedCalls > 1) // If list is created yet, there's nothing to do return; /***** Get boolean parameter that indicates if all groups must be listed *****/ @@ -520,26 +520,26 @@ void Grp_GetParCodsSeveralGrpsToShowUsrs (void) /***** Get parameter with list of groups selected *****/ Grp_GetParCodsSeveralGrps (); - if (Gbl.Hierarchy.Crs.Grps.NumGrps && // This course has groups and... - !Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps) // ...I haven't selected any group + if (Gbl.Crs.Grps.NumGrps && // This course has groups and... + !Gbl.Crs.Grps.LstGrpsSel.NumGrps) // ...I haven't selected any group { /***** I I haven't selected any group, show by default the groups I belong to *****/ /* Get list of groups of all types in current course I belong to */ - Grp_GetLstCodGrpsUsrBelongs (Gbl.Hierarchy.Crs.Crs.CrsCod,-1L, + Grp_GetLstCodGrpsUsrBelongs (Gbl.Hierarchy.Crs.CrsCod,-1L, Gbl.Usrs.Me.UsrDat.UsrCod,&LstGrpsIBelong); if (LstGrpsIBelong.NumGrps) { /* Allocate space for list of selected groups */ - if ((Gbl.Hierarchy.Crs.Grps.LstGrpsSel.GrpCods = (long *) calloc (LstGrpsIBelong.NumGrps,sizeof (long))) == NULL) + if ((Gbl.Crs.Grps.LstGrpsSel.GrpCods = (long *) calloc (LstGrpsIBelong.NumGrps,sizeof (long))) == NULL) Lay_NotEnoughMemoryExit (); /* Fill list of selected groups with list of groups I belong to */ for (NumGrp = 0; NumGrp < LstGrpsIBelong.NumGrps; NumGrp++) - Gbl.Hierarchy.Crs.Grps.LstGrpsSel.GrpCods[NumGrp] = LstGrpsIBelong.GrpCods[NumGrp]; - Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps = LstGrpsIBelong.NumGrps; + Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrp] = LstGrpsIBelong.GrpCods[NumGrp]; + Gbl.Crs.Grps.LstGrpsSel.NumGrps = LstGrpsIBelong.NumGrps; } /* Free list of groups I belong to */ @@ -547,7 +547,7 @@ void Grp_GetParCodsSeveralGrpsToShowUsrs (void) } /***** If no groups selected ==> show all groups *****/ - if (!Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps) + if (!Gbl.Crs.Grps.LstGrpsSel.NumGrps) Gbl.Usrs.ClassPhoto.AllGroups = true; } @@ -561,12 +561,12 @@ void Grp_GetParCodsSeveralGrps (void) const char *Ptr; char LongStr[1 + 10 + 1]; unsigned NumGrp; - unsigned long MaxSizeLstGrpCods = ((1 + 10 + 1) * Gbl.Hierarchy.Crs.Grps.NumGrps) - 1; + unsigned long MaxSizeLstGrpCods = ((1 + 10 + 1) * Gbl.Crs.Grps.NumGrps) - 1; /***** Reset number of groups selected *****/ - Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps = 0; + Gbl.Crs.Grps.LstGrpsSel.NumGrps = 0; - if (Gbl.Hierarchy.Crs.Grps.NumGrps) // If course has groups + if (Gbl.Crs.Grps.NumGrps) // If course has groups { /***** Allocate memory for the list of group codes selected *****/ if ((ParamLstCodGrps = (char *) malloc (MaxSizeLstGrpCods + 1)) == NULL) @@ -582,19 +582,19 @@ void Grp_GetParCodsSeveralGrps (void) *Ptr; NumGrp++) Par_GetNextStrUntilSeparParamMult (&Ptr,LongStr,1 + 10); - Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps = NumGrp; + Gbl.Crs.Grps.LstGrpsSel.NumGrps = NumGrp; - if (Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps) // If I have selected groups... + if (Gbl.Crs.Grps.LstGrpsSel.NumGrps) // If I have selected groups... { /***** Create a list of groups selected from LstCodGrps *****/ - if ((Gbl.Hierarchy.Crs.Grps.LstGrpsSel.GrpCods = (long *) calloc (Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps,sizeof (long))) == NULL) + if ((Gbl.Crs.Grps.LstGrpsSel.GrpCods = (long *) calloc (Gbl.Crs.Grps.LstGrpsSel.NumGrps,sizeof (long))) == NULL) Lay_NotEnoughMemoryExit (); for (Ptr = ParamLstCodGrps, NumGrp = 0; *Ptr; NumGrp++) { Par_GetNextStrUntilSeparParamMult (&Ptr,LongStr,1 + 10); - Gbl.Hierarchy.Crs.Grps.LstGrpsSel.GrpCods[NumGrp] = Str_ConvertStrCodToLongCod (LongStr); + Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrp] = Str_ConvertStrCodToLongCod (LongStr); } } } @@ -610,13 +610,13 @@ void Grp_GetParCodsSeveralGrps (void) void Grp_FreeListCodSelectedGrps (void) { - if (Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NestedCalls > 0) - if (--Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NestedCalls == 0) - if (Gbl.Hierarchy.Crs.Grps.LstGrpsSel.GrpCods) + if (Gbl.Crs.Grps.LstGrpsSel.NestedCalls > 0) + if (--Gbl.Crs.Grps.LstGrpsSel.NestedCalls == 0) + if (Gbl.Crs.Grps.LstGrpsSel.GrpCods) { - free ((void *) Gbl.Hierarchy.Crs.Grps.LstGrpsSel.GrpCods); - Gbl.Hierarchy.Crs.Grps.LstGrpsSel.GrpCods = NULL; - Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps = 0; + free ((void *) Gbl.Crs.Grps.LstGrpsSel.GrpCods); + Gbl.Crs.Grps.LstGrpsSel.GrpCods = NULL; + Gbl.Crs.Grps.LstGrpsSel.NumGrps = 0; } } @@ -764,7 +764,7 @@ bool Grp_ChangeMyGrpsAtomically (struct ListCodGrps *LstGrpsIWant) Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS); /***** Query in the database the group codes which I belong to *****/ - Grp_GetLstCodGrpsUsrBelongs (Gbl.Hierarchy.Crs.Crs.CrsCod,-1L, + Grp_GetLstCodGrpsUsrBelongs (Gbl.Hierarchy.Crs.CrsCod,-1L, Gbl.Usrs.Me.UsrDat.UsrCod,&LstGrpsIBelong); if (Gbl.Usrs.Me.Role.Logged == Rol_STD) @@ -782,10 +782,10 @@ bool Grp_ChangeMyGrpsAtomically (struct ListCodGrps *LstGrpsIWant) if (RemoveMeFromThisGrp) /* Check if the group is closed */ for (NumGrpTyp = 0; - NumGrpTyp < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num && !ITryToLeaveAClosedGroup; + NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num && !ITryToLeaveAClosedGroup; NumGrpTyp++) { - GrpTyp = &Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp]; + GrpTyp = &Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp]; for (NumGrpThisType = 0; NumGrpThisType < GrpTyp->NumGrps && !ITryToLeaveAClosedGroup; NumGrpThisType++) @@ -812,12 +812,12 @@ bool Grp_ChangeMyGrpsAtomically (struct ListCodGrps *LstGrpsIWant) if (RegisterMeInThisGrp) /* Check if the group is closed or full */ for (NumGrpTyp = 0; - NumGrpTyp < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num && + NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num && !ITryToRegisterInAClosedGroup && !ITryToRegisterInFullGroup; NumGrpTyp++) { - GrpTyp = &Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp]; + GrpTyp = &Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp]; for (NumGrpThisType = 0; NumGrpThisType < GrpTyp->NumGrps && !ITryToRegisterInAClosedGroup && @@ -904,7 +904,7 @@ void Grp_ChangeGrpsOtherUsrAtomically (struct ListCodGrps *LstGrpsUsrWants) Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS); /***** Query in the database the group codes which user belongs to *****/ - Grp_GetLstCodGrpsUsrBelongs (Gbl.Hierarchy.Crs.Crs.CrsCod,-1L, + Grp_GetLstCodGrpsUsrBelongs (Gbl.Hierarchy.Crs.CrsCod,-1L, Gbl.Usrs.Other.UsrDat.UsrCod,&LstGrpsUsrBelongs); /***** Go across the list of groups user belongs to, removing those groups that are not present in the list of groups user wants to belong to *****/ @@ -1008,7 +1008,7 @@ bool Grp_CheckIfSelectionGrpsSingleEnrolmentIsValid (Rol_Role_t Role,struct List if (!MultipleEnrolment) for (NumGrpTyp = 0; - NumGrpTyp < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num; + NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num; NumGrpTyp++) if (GrpTypCod == AlreadyExistsGroupOfType[NumGrpTyp].GrpTypCod) { @@ -1041,15 +1041,15 @@ static void Grp_ConstructorListGrpAlreadySelec (struct ListGrpsAlreadySelec **Al unsigned NumGrpTyp; /***** Allocate memory to a list of booleanos that indica if already se ha selected a group of cada type *****/ - if ((*AlreadyExistsGroupOfType = (struct ListGrpsAlreadySelec *) calloc (Gbl.Hierarchy.Crs.Grps.GrpTypes.Num,sizeof (struct ListGrpsAlreadySelec))) == NULL) + if ((*AlreadyExistsGroupOfType = (struct ListGrpsAlreadySelec *) calloc (Gbl.Crs.Grps.GrpTypes.Num,sizeof (struct ListGrpsAlreadySelec))) == NULL) Lay_NotEnoughMemoryExit (); /***** Initialize the list *****/ for (NumGrpTyp = 0; - NumGrpTyp < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num; + NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num; NumGrpTyp++) { - (*AlreadyExistsGroupOfType)[NumGrpTyp].GrpTypCod = Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod; + (*AlreadyExistsGroupOfType)[NumGrpTyp].GrpTypCod = Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod; (*AlreadyExistsGroupOfType)[NumGrpTyp].AlreadySelected = false; } } @@ -1082,15 +1082,15 @@ void Grp_RegisterUsrIntoGroups (struct UsrData *UsrDat,struct ListCodGrps *LstGr /***** For each existing type of group in the course... *****/ for (NumGrpTyp = 0; - NumGrpTyp < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num; + NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num; NumGrpTyp++) { - MultipleEnrolment = Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MultipleEnrolment; + MultipleEnrolment = Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MultipleEnrolment; /***** Query in the database the group codes of any group of this type the student belongs to *****/ LstGrpsHeBelongs.NumGrps = 0; // Initialized to avoid bug reported by Coverity LstGrpsHeBelongs.GrpCods = NULL; // Initialized to avoid bug reported by Coverity - Grp_GetLstCodGrpsUsrBelongs (Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod, + Grp_GetLstCodGrpsUsrBelongs (Gbl.Hierarchy.Crs.CrsCod,Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod, UsrDat->UsrCod,&LstGrpsHeBelongs); /***** For each group selected by me... *****/ @@ -1100,9 +1100,9 @@ void Grp_RegisterUsrIntoGroups (struct UsrData *UsrDat,struct ListCodGrps *LstGr { /* Check if the selected group is of this type */ for (NumGrpThisType = 0; - NumGrpThisType < Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps; + NumGrpThisType < Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps; NumGrpThisType++) - if (LstGrps->GrpCods[NumGrpSel] == Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].LstGrps[NumGrpThisType].GrpCod) + if (LstGrps->GrpCods[NumGrpSel] == Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].LstGrps[NumGrpThisType].GrpCod) { // The selected group is of this type AlreadyRegisteredInGrp = false; @@ -1118,15 +1118,15 @@ void Grp_RegisterUsrIntoGroups (struct UsrData *UsrDat,struct ListCodGrps *LstGr remove user from the group to which he belongs */ Grp_RemoveUsrFromGroup (UsrDat->UsrCod,LstGrpsHeBelongs.GrpCods[NumGrpHeBelongs]); Ale_ShowAlert (Ale_SUCCESS,Txt_THE_USER_X_has_been_removed_from_the_group_of_type_Y_to_which_it_belonged, - UsrDat->FullName,Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypName); + UsrDat->FullName,Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypName); } if (!AlreadyRegisteredInGrp) // If the user does not belong to the selected group { Grp_AddUsrToGroup (UsrDat,LstGrps->GrpCods[NumGrpSel]); Ale_ShowAlert (Ale_SUCCESS,Txt_THE_USER_X_has_been_enroled_in_the_group_of_type_Y_Z, - UsrDat->FullName,Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypName, - Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].LstGrps[NumGrpThisType].GrpName); + UsrDat->FullName,Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypName, + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].LstGrps[NumGrpThisType].GrpName); } break; // Once we know the type of a selected group, it's not necessary to check the rest of types @@ -1154,7 +1154,7 @@ unsigned Grp_RemoveUsrFromGroups (struct UsrData *UsrDat,struct ListCodGrps *Lst unsigned NumGrpsHeIsRemoved = 0; /***** Query in the database the group codes of any group the user belongs to *****/ - Grp_GetLstCodGrpsUsrBelongs (Gbl.Hierarchy.Crs.Crs.CrsCod,-1L, + Grp_GetLstCodGrpsUsrBelongs (Gbl.Hierarchy.Crs.CrsCod,-1L, UsrDat->UsrCod,&LstGrpsHeBelongs); /***** For each group selected by me... *****/ @@ -1289,14 +1289,14 @@ static void Grp_ListGroupTypesForEdition (void) /***** List group types with forms for edition *****/ for (NumGrpTyp = 0, UniqueId=1; - NumGrpTyp < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num; + NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num; NumGrpTyp++, UniqueId++) { /* Put icon to remove group type */ fprintf (Gbl.F.Out,"" ""); Frm_StartFormAnchor (ActReqRemGrpTyp,Grp_GROUP_TYPES_SECTION_ID); - Grp_PutParamGrpTypCod (Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod); + Grp_PutParamGrpTypCod (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod); Ico_PutIconRemove (); Frm_EndForm (); fprintf (Gbl.F.Out,""); @@ -1304,12 +1304,12 @@ static void Grp_ListGroupTypesForEdition (void) /* Name of group type */ fprintf (Gbl.F.Out,""); Frm_StartFormAnchor (ActRenGrpTyp,Grp_GROUP_TYPES_SECTION_ID); - Grp_PutParamGrpTypCod (Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod); + Grp_PutParamGrpTypCod (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod); fprintf (Gbl.F.Out,"", Grp_MAX_CHARS_GROUP_TYPE_NAME, - Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypName, + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypName, Gbl.Form.Id); Frm_EndForm (); fprintf (Gbl.F.Out,""); @@ -1317,18 +1317,18 @@ static void Grp_ListGroupTypesForEdition (void) /* Is it mandatory to register in any group? */ fprintf (Gbl.F.Out,""); Frm_StartFormAnchor (ActChgMdtGrpTyp,Grp_GROUP_TYPES_SECTION_ID); - Grp_PutParamGrpTypCod (Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod); + Grp_PutParamGrpTypCod (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod); fprintf (Gbl.F.Out,"", @@ -1339,18 +1339,18 @@ static void Grp_ListGroupTypesForEdition (void) /* Is it possible to register in multiple groups? */ fprintf (Gbl.F.Out,""); Frm_StartFormAnchor (ActChgMulGrpTyp,Grp_GROUP_TYPES_SECTION_ID); - Grp_PutParamGrpTypCod (Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod); + Grp_PutParamGrpTypCod (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod); fprintf (Gbl.F.Out,"", @@ -1361,7 +1361,7 @@ static void Grp_ListGroupTypesForEdition (void) /* Open time */ fprintf (Gbl.F.Out,""); Frm_StartFormAnchor (ActChgTimGrpTyp,Grp_GROUP_TYPES_SECTION_ID); - Grp_PutParamGrpTypCod (Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod); + Grp_PutParamGrpTypCod (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod); Tbl_StartTableCenter (2); fprintf (Gbl.F.Out,"" "" @@ -1371,18 +1371,18 @@ static void Grp_ListGroupTypesForEdition (void) "" "", Cfg_URL_ICON_PUBLIC, - Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MustBeOpened ? Txt_The_groups_will_automatically_open : + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MustBeOpened ? Txt_The_groups_will_automatically_open : Txt_The_groups_will_not_automatically_open, - Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MustBeOpened ? Txt_The_groups_will_automatically_open : + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MustBeOpened ? Txt_The_groups_will_automatically_open : Txt_The_groups_will_not_automatically_open, - Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MustBeOpened ? "" : + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MustBeOpened ? "" : "ICO_HIDDEN "); snprintf (Id,sizeof (Id), "open_time_%u", UniqueId); Dat_WriteFormClientLocalDateTimeFromTimeUTC (Id, "Open", - Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].OpenTimeUTC, + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].OpenTimeUTC, Gbl.Now.Date.Year, Gbl.Now.Date.Year + 1, Dat_FORM_SECONDS_ON, @@ -1399,7 +1399,7 @@ static void Grp_ListGroupTypesForEdition (void) "%u" "" "", - Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps); + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps); } /***** End table *****/ @@ -1498,10 +1498,10 @@ static void Grp_ListGroupsForEdition (void) /***** List the groups *****/ for (NumGrpTyp = 0; - NumGrpTyp < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num; + NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num; NumGrpTyp++) { - GrpTyp = &Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp]; + GrpTyp = &Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp]; for (NumGrpThisType = 0; NumGrpThisType < GrpTyp->NumGrps; NumGrpThisType++) @@ -1560,10 +1560,10 @@ static void Grp_ListGroupsForEdition (void) /* Options for group types */ for (NumTipGrpAux = 0; - NumTipGrpAux < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num; + NumTipGrpAux < Gbl.Crs.Grps.GrpTypes.Num; NumTipGrpAux++) { - GrpTypAux = &Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumTipGrpAux]; + GrpTypAux = &Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumTipGrpAux]; fprintf (Gbl.F.Out,"", - Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypName); + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypName); } /* End selector */ @@ -2680,7 +2680,7 @@ static void Grp_PutFormToCreateGroup (void) " size=\"20\" maxlength=\"%u\" value=\"%s\"" " required=\"required\" />" "", - Grp_MAX_CHARS_GROUP_NAME,Gbl.Hierarchy.Crs.Grps.GrpName); + Grp_MAX_CHARS_GROUP_NAME,Gbl.Crs.Grps.GrpName); /***** Classroom *****/ /* Start selector */ @@ -2689,14 +2689,14 @@ static void Grp_PutFormToCreateGroup (void) /* Option for no assigned classroom */ fprintf (Gbl.F.Out,"", Txt_No_assigned_classroom); /* Option for another classroom */ fprintf (Gbl.F.Out,"", Txt_Another_classroom); @@ -2708,7 +2708,7 @@ static void Grp_PutFormToCreateGroup (void) { fprintf (Gbl.F.Out,"", Gbl.Classrooms.Lst[NumCla].ShrtName); @@ -2730,7 +2730,7 @@ static void Grp_PutFormToCreateGroup (void) fprintf (Gbl.F.Out,"" "" "" ""); @@ -2753,7 +2753,7 @@ void Grp_GetListGrpTypesInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes) MYSQL_ROW row; unsigned long NumGrpTyp; - if (++Gbl.Hierarchy.Crs.Grps.GrpTypes.NestedCalls > 1) // If list is created yet, there's nothing to do + if (++Gbl.Crs.Grps.GrpTypes.NestedCalls > 1) // If list is created yet, there's nothing to do return; /***** Open groups of this course that must be opened @@ -2765,7 +2765,7 @@ void Grp_GetListGrpTypesInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes) switch (WhichGroupTypes) { case Grp_ONLY_GROUP_TYPES_WITH_GROUPS: - Gbl.Hierarchy.Crs.Grps.GrpTypes.Num = + Gbl.Crs.Grps.GrpTypes.Num = (unsigned) DB_QuerySELECT (&mysql_res,"can not get types of group" " of a course", "SELECT crs_grp_types.GrpTypCod,crs_grp_types.GrpTypName," @@ -2778,10 +2778,10 @@ void Grp_GetListGrpTypesInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes) " AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod" " GROUP BY crs_grp_types.GrpTypCod" " ORDER BY crs_grp_types.GrpTypName", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); break; case Grp_ALL_GROUP_TYPES: - Gbl.Hierarchy.Crs.Grps.GrpTypes.Num = + Gbl.Crs.Grps.GrpTypes.Num = (unsigned) DB_QuerySELECT (&mysql_res,"can not get types of group" " of a course", "(SELECT crs_grp_types.GrpTypCod,crs_grp_types.GrpTypName AS GrpTypName," @@ -2802,58 +2802,58 @@ void Grp_GetListGrpTypesInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes) " FROM crs_grp_types WHERE CrsCod=%ld" " AND GrpTypCod NOT IN (SELECT GrpTypCod FROM crs_grp))" " ORDER BY GrpTypName", - Gbl.Hierarchy.Crs.Crs.CrsCod, - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod); break; } /***** Get group types *****/ - Gbl.Hierarchy.Crs.Grps.GrpTypes.NumGrpsTotal = 0; + Gbl.Crs.Grps.GrpTypes.NumGrpsTotal = 0; - if (Gbl.Hierarchy.Crs.Grps.GrpTypes.Num) + if (Gbl.Crs.Grps.GrpTypes.Num) { /***** Create a list of group types *****/ - if ((Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes = (struct GroupType *) calloc (Gbl.Hierarchy.Crs.Grps.GrpTypes.Num,sizeof (struct GroupType))) == NULL) + if ((Gbl.Crs.Grps.GrpTypes.LstGrpTypes = (struct GroupType *) calloc (Gbl.Crs.Grps.GrpTypes.Num,sizeof (struct GroupType))) == NULL) Lay_NotEnoughMemoryExit (); /***** Get group types *****/ for (NumGrpTyp = 0; - NumGrpTyp < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num; + NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num; NumGrpTyp++) { /* Get next group type */ row = mysql_fetch_row (mysql_res); /* Get group type code (row[0]) */ - if ((Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod = Str_ConvertStrCodToLongCod (row[0])) < 0) + if ((Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod = Str_ConvertStrCodToLongCod (row[0])) < 0) Lay_ShowErrorAndExit ("Wrong type of group."); /* Get group type name (row[1]) */ - Str_Copy (Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypName,row[1], + Str_Copy (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypName,row[1], Grp_MAX_BYTES_GROUP_TYPE_NAME); /* Is it mandatory to register in any groups of this type? (row[2]) */ - Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MandatoryEnrolment = (row[2][0] == 'Y'); + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MandatoryEnrolment = (row[2][0] == 'Y'); /* Is it possible to register in multiple groups of this type? (row[3]) */ - Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MultipleEnrolment = (row[3][0] == 'Y'); + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MultipleEnrolment = (row[3][0] == 'Y'); /* Groups of this type must be opened? (row[4]) */ - Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MustBeOpened = (row[4][0] == 'Y'); + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MustBeOpened = (row[4][0] == 'Y'); /* Get open time (row[5] holds the open time UTC) */ - Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].OpenTimeUTC = Dat_GetUNIXTimeFromStr (row[5]); - Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MustBeOpened &= Grp_CheckIfOpenTimeInTheFuture (Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].OpenTimeUTC); + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].OpenTimeUTC = Dat_GetUNIXTimeFromStr (row[5]); + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].MustBeOpened &= Grp_CheckIfOpenTimeInTheFuture (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].OpenTimeUTC); /* Number of groups of this type (row[6]) */ - if (sscanf (row[6],"%u",&Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) != 1) + if (sscanf (row[6],"%u",&Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) != 1) Lay_ShowErrorAndExit ("Wrong number of groups of a type."); /* Add number of groups to total number of groups */ - Gbl.Hierarchy.Crs.Grps.GrpTypes.NumGrpsTotal += Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps; + Gbl.Crs.Grps.GrpTypes.NumGrpsTotal += Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps; /* Initialize pointer to the list of groups of this type */ - Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].LstGrps = NULL; + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].LstGrps = NULL; } } @@ -2881,7 +2881,7 @@ void Grp_OpenGroupsAutomatically (void) "SELECT GrpTypCod FROM crs_grp_types" " WHERE CrsCod=%ld AND MustBeOpened='Y'" " AND OpenTime<=NOW()", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); for (NumGrpTyp = 0; NumGrpTyp < NumGrpTypes; @@ -2931,10 +2931,10 @@ void Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes) /***** Then we get the list of groups for each group type *****/ for (NumGrpTyp = 0; - NumGrpTyp < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num; + NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num; NumGrpTyp++) { - GrpTyp = &Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp]; + GrpTyp = &Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp]; if (GrpTyp->NumGrps) // If there are groups of this type... { /***** Query database *****/ @@ -3010,16 +3010,16 @@ void Grp_FreeListGrpTypesAndGrps (void) unsigned NumGrpTyp; struct GroupType *GrpTyp; - if (Gbl.Hierarchy.Crs.Grps.GrpTypes.NestedCalls > 0) - if (--Gbl.Hierarchy.Crs.Grps.GrpTypes.NestedCalls == 0) - if (Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes) + if (Gbl.Crs.Grps.GrpTypes.NestedCalls > 0) + if (--Gbl.Crs.Grps.GrpTypes.NestedCalls == 0) + if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes) { /***** Free memory used for each list of groups (one list for each group type) *****/ for (NumGrpTyp = 0; - NumGrpTyp < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num; + NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num; NumGrpTyp++) { - GrpTyp = &Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp]; + GrpTyp = &Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp]; if (GrpTyp->LstGrps) { free ((void *) GrpTyp->LstGrps); @@ -3029,9 +3029,9 @@ void Grp_FreeListGrpTypesAndGrps (void) } /***** Free memory used by the list of group types *****/ - free ((void *) Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes); - Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes = NULL; - Gbl.Hierarchy.Crs.Grps.GrpTypes.Num = 0; + free ((void *) Gbl.Crs.Grps.GrpTypes.LstGrpTypes); + Gbl.Crs.Grps.GrpTypes.LstGrpTypes = NULL; + Gbl.Crs.Grps.GrpTypes.Num = 0; } } @@ -3047,7 +3047,7 @@ unsigned Grp_CountNumGrpsInCurrentCrs (void) "SELECT COUNT(*) FROM crs_grp_types,crs_grp" " WHERE crs_grp_types.CrsCod=%ld" " AND crs_grp_types.GrpTypCod=crs_grp.GrpTypCod", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); } /*****************************************************************************/ @@ -3108,7 +3108,7 @@ static void Grp_GetDataOfGroupTypeByCod (struct GroupType *GrpTyp) "UNIX_TIMESTAMP(OpenTime)" " FROM crs_grp_types" " WHERE CrsCod=%ld AND GrpTypCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod,GrpTyp->GrpTypCod); + Gbl.Hierarchy.Crs.CrsCod,GrpTyp->GrpTypCod); /***** Count number of rows in result *****/ if (NumRows != 1) @@ -3342,7 +3342,7 @@ static unsigned long Grp_CountNumUsrsInNoGrpsOfType (Rol_Role_t Role,long GrpTyp " FROM crs_grp,crs_grp_usr" " WHERE crs_grp.GrpTypCod=%ld" " AND crs_grp.GrpCod=crs_grp_usr.GrpCod)", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, (unsigned) Role,GrpTypCod); } @@ -3420,7 +3420,7 @@ bool Grp_CheckIfUsrSharesAnyOfMyGrpsInCurrentCrs (const struct UsrData *UsrDat) return false; /***** 3. Fast check: Is it a course selected? *****/ - if (Gbl.Hierarchy.Crs.Crs.CrsCod <= 0) + if (Gbl.Hierarchy.Crs.CrsCod <= 0) return false; /***** 4. Fast check: Do I belong to the current course? *****/ @@ -3446,7 +3446,7 @@ bool Grp_CheckIfUsrSharesAnyOfMyGrpsInCurrentCrs (const struct UsrData *UsrDat) } /***** 8. Fast check: Course has groups? *****/ - if (!Gbl.Hierarchy.Crs.Grps.NumGrps) + if (!Gbl.Crs.Grps.NumGrps) { Gbl.Cache.UsrSharesAnyOfMyGrpsInCurrentCrs.UsrCod = UsrDat->UsrCod; Gbl.Cache.UsrSharesAnyOfMyGrpsInCurrentCrs.Shares = true; @@ -3472,7 +3472,7 @@ bool Grp_CheckIfUsrSharesAnyOfMyGrpsInCurrentCrs (const struct UsrData *UsrDat) " AND crs_grp_types.CrsCod=%ld)", UsrDat->UsrCod, Gbl.Usrs.Me.UsrDat.UsrCod, - Gbl.Hierarchy.Crs.Crs.CrsCod) != 0); + Gbl.Hierarchy.Crs.CrsCod) != 0); return Gbl.Cache.UsrSharesAnyOfMyGrpsInCurrentCrs.Shares; } @@ -3497,7 +3497,7 @@ bool Grp_GetIfAvailableGrpTyp (long GrpTypCod) { if (asprintf (&SubQueryGrpTypes,"crs_grp_types.CrsCod=%ld" " AND crs_grp_types.Mandatory='Y'", - Gbl.Hierarchy.Crs.Crs.CrsCod) < 0) + Gbl.Hierarchy.Crs.CrsCod) < 0) Lay_NotEnoughMemoryExit (); } @@ -3559,7 +3559,7 @@ bool Grp_GetIfAvailableGrpTyp (long GrpTypCod) SubQueryGrpTypes,(unsigned) Rol_STD, SubQueryGrpTypes, - Gbl.Hierarchy.Crs.Crs.CrsCod,(unsigned) Rol_STD, + Gbl.Hierarchy.Crs.CrsCod,(unsigned) Rol_STD, SubQueryGrpTypes,Gbl.Usrs.Me.UsrDat.UsrCod); /***** Free allocated memory for subquery *****/ @@ -3601,7 +3601,7 @@ static void Grp_GetLstCodGrpsUsrBelongs (long CrsCod,long GrpTypCod, " AND crs_grp.GrpCod=crs_grp_usr.GrpCod" " AND crs_grp_usr.UsrCod=%ld" " ORDER BY crs_grp_types.GrpTypName,crs_grp.GrpName", - Gbl.Hierarchy.Crs.Crs.CrsCod,UsrCod); + Gbl.Hierarchy.Crs.CrsCod,UsrCod); else // Query only the groups of specified type in the course LstGrps->NumGrps = (unsigned) DB_QuerySELECT (&mysql_res,"can not get the groups" @@ -3614,7 +3614,7 @@ static void Grp_GetLstCodGrpsUsrBelongs (long CrsCod,long GrpTypCod, " AND crs_grp.GrpCod=crs_grp_usr.GrpCod" " AND crs_grp_usr.UsrCod=%ld" " ORDER BY crs_grp.GrpName", - Gbl.Hierarchy.Crs.Crs.CrsCod,GrpTypCod,UsrCod); + Gbl.Hierarchy.Crs.CrsCod,GrpTypCod,UsrCod); /***** Get the groups *****/ if (LstGrps->NumGrps) @@ -3660,7 +3660,7 @@ void Grp_GetLstCodGrpsWithFileZonesIBelong (struct ListCodGrps *LstGrps) " AND crs_grp.GrpCod=crs_grp_usr.GrpCod" " AND crs_grp_usr.UsrCod=%ld" " ORDER BY crs_grp_types.GrpTypName,crs_grp.GrpName", - Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod); + Gbl.Hierarchy.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod); /***** Get the groups *****/ if (LstGrps->NumGrps) @@ -3711,7 +3711,7 @@ void Grp_GetNamesGrpsStdBelongsTo (long GrpTypCod,long UsrCod,char *GroupNames) unsigned long NumRow; unsigned long NumRows; size_t MaxLength = (Grp_MAX_BYTES_GROUP_NAME + 2) * - Gbl.Hierarchy.Crs.Grps.GrpTypes.NumGrpsTotal; + Gbl.Crs.Grps.GrpTypes.NumGrpsTotal; /***** Get the names of groups which a user belongs to, from database *****/ NumRows = DB_QuerySELECT (&mysql_res,"can not get the names of groups" @@ -3759,28 +3759,28 @@ void Grp_RecFormNewGrpTyp (void) /***** Get parameters from form *****/ /* Get the name of group type */ - Par_GetParToText ("GrpTypName",Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypName, + Par_GetParToText ("GrpTypName",Gbl.Crs.Grps.GrpTyp.GrpTypName, Grp_MAX_BYTES_GROUP_TYPE_NAME); /* Get whether it is mandatory to regisrer in any group of this type */ - Gbl.Hierarchy.Crs.Grps.GrpTyp.MandatoryEnrolment = Par_GetParToBool ("MandatoryEnrolment"); + Gbl.Crs.Grps.GrpTyp.MandatoryEnrolment = Par_GetParToBool ("MandatoryEnrolment"); /* Get whether it is possible to register in multiple groups of this type */ - Gbl.Hierarchy.Crs.Grps.GrpTyp.MultipleEnrolment = Par_GetParToBool ("MultipleEnrolment"); + Gbl.Crs.Grps.GrpTyp.MultipleEnrolment = Par_GetParToBool ("MultipleEnrolment"); /* Get open time */ - Gbl.Hierarchy.Crs.Grps.GrpTyp.OpenTimeUTC = Dat_GetTimeUTCFromForm ("OpenTimeUTC"); - Gbl.Hierarchy.Crs.Grps.GrpTyp.MustBeOpened = Grp_CheckIfOpenTimeInTheFuture (Gbl.Hierarchy.Crs.Grps.GrpTyp.OpenTimeUTC); + Gbl.Crs.Grps.GrpTyp.OpenTimeUTC = Dat_GetTimeUTCFromForm ("OpenTimeUTC"); + Gbl.Crs.Grps.GrpTyp.MustBeOpened = Grp_CheckIfOpenTimeInTheFuture (Gbl.Crs.Grps.GrpTyp.OpenTimeUTC); - if (Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypName[0]) // If there's a group type name + if (Gbl.Crs.Grps.GrpTyp.GrpTypName[0]) // If there's a group type name { /***** If name of group type was in database... *****/ - if (Grp_CheckIfGroupTypeNameExists (Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypName,-1L)) + if (Grp_CheckIfGroupTypeNameExists (Gbl.Crs.Grps.GrpTyp.GrpTypName,-1L)) { AlertType = Ale_WARNING; snprintf (AlertTxt,sizeof (AlertTxt), Txt_The_type_of_group_X_already_exists, - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypName); + Gbl.Crs.Grps.GrpTyp.GrpTypName); } else // Add new group type to database { @@ -3789,7 +3789,7 @@ void Grp_RecFormNewGrpTyp (void) AlertType = Ale_SUCCESS; snprintf (AlertTxt,sizeof (AlertTxt), Txt_Created_new_type_of_group_X, - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypName); + Gbl.Crs.Grps.GrpTyp.GrpTypName); } } else // If there is not a group type name @@ -3831,31 +3831,31 @@ void Grp_RecFormNewGrp (void) char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME]; /***** Get parameters from form *****/ - if ((Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) > 0) // Group type valid + if ((Gbl.Crs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) > 0) // Group type valid { /* Get group name */ - Par_GetParToText ("GrpName",Gbl.Hierarchy.Crs.Grps.GrpName, + Par_GetParToText ("GrpName",Gbl.Crs.Grps.GrpName, Grp_MAX_BYTES_GROUP_NAME); /* Get classroom */ - Gbl.Hierarchy.Crs.Grps.ClaCod = Cla_GetParamClaCod (); + Gbl.Crs.Grps.ClaCod = Cla_GetParamClaCod (); /* Get maximum number of students */ - Gbl.Hierarchy.Crs.Grps.MaxStudents = (unsigned) + Gbl.Crs.Grps.MaxStudents = (unsigned) Par_GetParToUnsignedLong ("MaxStudents", 0, Grp_MAX_STUDENTS_IN_A_GROUP, Grp_NUM_STUDENTS_NOT_LIMITED); - if (Gbl.Hierarchy.Crs.Grps.GrpName[0]) // If there's a group name + if (Gbl.Crs.Grps.GrpName[0]) // If there's a group name { /***** If name of group was in database... *****/ - if (Grp_CheckIfGroupNameExists (Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod,Gbl.Hierarchy.Crs.Grps.GrpName,-1L)) + if (Grp_CheckIfGroupNameExists (Gbl.Crs.Grps.GrpTyp.GrpTypCod,Gbl.Crs.Grps.GrpName,-1L)) { AlertType = Ale_WARNING; snprintf (AlertTxt,sizeof (AlertTxt), Txt_The_group_X_already_exists, - Gbl.Hierarchy.Crs.Grps.GrpName); + Gbl.Crs.Grps.GrpName); } else // Add new group to database { @@ -3865,7 +3865,7 @@ void Grp_RecFormNewGrp (void) AlertType = Ale_SUCCESS; snprintf (AlertTxt,sizeof (AlertTxt), Txt_Created_new_group_X, - Gbl.Hierarchy.Crs.Grps.GrpName); + Gbl.Crs.Grps.GrpName); } } else // If there is not a group name @@ -3899,7 +3899,7 @@ static bool Grp_CheckIfGroupTypeNameExists (const char *GrpTypName,long GrpTypCo "SELECT COUNT(*) FROM crs_grp_types" " WHERE CrsCod=%ld AND GrpTypName='%s'" " AND GrpTypCod<>%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod,GrpTypName,GrpTypCod) != 0); + Gbl.Hierarchy.Crs.CrsCod,GrpTypName,GrpTypCod) != 0); } /*****************************************************************************/ @@ -3924,20 +3924,20 @@ static bool Grp_CheckIfGroupNameExists (long GrpTypCod,const char *GrpName,long static void Grp_CreateGroupType (void) { /***** Create a new group type *****/ - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod = + Gbl.Crs.Grps.GrpTyp.GrpTypCod = DB_QueryINSERTandReturnCode ("can not create type of group", "INSERT INTO crs_grp_types" " (CrsCod,GrpTypName,Mandatory,Multiple,MustBeOpened,OpenTime)" " VALUES" " (%ld,'%s','%c','%c','%c',FROM_UNIXTIME(%ld))", - Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypName, - Gbl.Hierarchy.Crs.Grps.GrpTyp.MandatoryEnrolment ? 'Y' : + Gbl.Hierarchy.Crs.CrsCod,Gbl.Crs.Grps.GrpTyp.GrpTypName, + Gbl.Crs.Grps.GrpTyp.MandatoryEnrolment ? 'Y' : 'N', - Gbl.Hierarchy.Crs.Grps.GrpTyp.MultipleEnrolment ? 'Y' : + Gbl.Crs.Grps.GrpTyp.MultipleEnrolment ? 'Y' : 'N', - Gbl.Hierarchy.Crs.Grps.GrpTyp.MustBeOpened ? 'Y' : + Gbl.Crs.Grps.GrpTyp.MustBeOpened ? 'Y' : 'N', - (long) Gbl.Hierarchy.Crs.Grps.GrpTyp.OpenTimeUTC); + (long) Gbl.Crs.Grps.GrpTyp.OpenTimeUTC); } /*****************************************************************************/ @@ -3952,10 +3952,10 @@ static void Grp_CreateGroup (void) " (GrpTypCod,GrpName,ClaCod,MaxStudents,Open,FileZones)" " VALUES" " (%ld,'%s',%ld,%u,'N','N')", - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod, - Gbl.Hierarchy.Crs.Grps.GrpName, - Gbl.Hierarchy.Crs.Grps.ClaCod, - Gbl.Hierarchy.Crs.Grps.MaxStudents); + Gbl.Crs.Grps.GrpTyp.GrpTypCod, + Gbl.Crs.Grps.GrpName, + Gbl.Crs.Grps.ClaCod, + Gbl.Crs.Grps.MaxStudents); } /*****************************************************************************/ @@ -3967,11 +3967,11 @@ void Grp_ReqRemGroupType (void) unsigned NumGrps; /***** Get the code of the group type *****/ - if ((Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) < 0) + if ((Gbl.Crs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) < 0) Lay_ShowErrorAndExit ("Code of group is missing."); /***** Check if this group type has groups *****/ - if ((NumGrps = Grp_CountNumGrpsInThisCrsOfType (Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod))) // Group type has groups ==> Ask for confirmation + if ((NumGrps = Grp_CountNumGrpsInThisCrsOfType (Gbl.Crs.Grps.GrpTyp.GrpTypCod))) // Group type has groups ==> Ask for confirmation Grp_AskConfirmRemGrpTypWithGrps (NumGrps); else // Group type has no groups ==> remove directly Grp_RemoveGroupTypeCompletely (); @@ -3984,7 +3984,7 @@ void Grp_ReqRemGroupType (void) void Grp_ReqRemGroup (void) { /***** Get group code *****/ - if ((Gbl.Hierarchy.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1L) + if ((Gbl.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1L) Lay_ShowErrorAndExit ("Code of group is missing."); /***** Confirm removing *****/ @@ -4002,7 +4002,7 @@ static void Grp_AskConfirmRemGrpTypWithGrps (unsigned NumGrps) extern const char *Txt_Remove_type_of_group; /***** Get data of the group type from database *****/ - Grp_GetDataOfGroupTypeByCod (&Gbl.Hierarchy.Crs.Grps.GrpTyp); + Grp_GetDataOfGroupTypeByCod (&Gbl.Crs.Grps.GrpTyp); /***** Start section to edit group types *****/ Grp_ReqEditGroupsInternal0 (); @@ -4013,13 +4013,13 @@ static void Grp_AskConfirmRemGrpTypWithGrps (unsigned NumGrps) Grp_PutParamRemGrpTyp, Btn_REMOVE_BUTTON,Txt_Remove_type_of_group, Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_type_of_group_X_1_group_, - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypName); + Gbl.Crs.Grps.GrpTyp.GrpTypName); else Ale_ShowAlertAndButton (ActRemGrpTyp,Grp_GROUP_TYPES_SECTION_ID,NULL, Grp_PutParamRemGrpTyp, Btn_REMOVE_BUTTON,Txt_Remove_type_of_group, Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_type_of_group_X_Y_groups_, - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypName,NumGrps); + Gbl.Crs.Grps.GrpTyp.GrpTypName,NumGrps); /***** Show the form to edit group types and groups again *****/ Grp_ReqEditGroupsInternal1 (Ale_INFO,NULL); @@ -4032,7 +4032,7 @@ static void Grp_AskConfirmRemGrpTypWithGrps (unsigned NumGrps) static void Grp_PutParamRemGrpTyp (void) { - Grp_PutParamGrpTypCod (Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod); + Grp_PutParamGrpTypCod (Gbl.Crs.Grps.GrpTyp.GrpTypCod); } /*****************************************************************************/ @@ -4049,11 +4049,11 @@ static void Grp_AskConfirmRemGrp (void) unsigned NumStds; /***** Get name of the group from database *****/ - GrpDat.GrpCod = Gbl.Hierarchy.Crs.Grps.GrpCod; + GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod; Grp_GetDataOfGroupByCod (&GrpDat); /***** Count number of students in group *****/ - NumStds = Grp_CountNumUsrsInGrp (Rol_STD,Gbl.Hierarchy.Crs.Grps.GrpCod); + NumStds = Grp_CountNumUsrsInGrp (Rol_STD,Gbl.Crs.Grps.GrpCod); /***** Show the form to edit group types again *****/ Grp_ReqEditGroupsInternal0 (); @@ -4089,7 +4089,7 @@ static void Grp_AskConfirmRemGrp (void) static void Grp_PutParamRemGrp (void) { - Grp_PutParamGrpCod (Gbl.Hierarchy.Crs.Grps.GrpCod); + Grp_PutParamGrpCod (Gbl.Crs.Grps.GrpCod); } /*****************************************************************************/ @@ -4099,7 +4099,7 @@ static void Grp_PutParamRemGrp (void) void Grp_RemoveGroupType (void) { /***** Get param with code of group type *****/ - if ((Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) < 0) + if ((Gbl.Crs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) < 0) Lay_ShowErrorAndExit ("Code of type of group is missing."); /***** Remove group type and its groups *****/ @@ -4113,7 +4113,7 @@ void Grp_RemoveGroupType (void) void Grp_RemoveGroup (void) { /***** Get param with group code *****/ - if ((Gbl.Hierarchy.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1L) + if ((Gbl.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1L) Lay_ShowErrorAndExit ("Code of group is missing."); /***** Remove group *****/ @@ -4130,47 +4130,47 @@ static void Grp_RemoveGroupTypeCompletely (void) char AlertTxt[256 + Grp_MAX_BYTES_GROUP_TYPE_NAME]; /***** Get name and type of the group from database *****/ - Grp_GetDataOfGroupTypeByCod (&Gbl.Hierarchy.Crs.Grps.GrpTyp); + Grp_GetDataOfGroupTypeByCod (&Gbl.Crs.Grps.GrpTyp); /***** Remove file zones of all the groups of this type *****/ - Brw_RemoveZonesOfGroupsOfType (Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod); + Brw_RemoveZonesOfGroupsOfType (Gbl.Crs.Grps.GrpTyp.GrpTypCod); /***** Remove the associations of assignments to groups of this type *****/ - Asg_RemoveGroupsOfType (Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod); + Asg_RemoveGroupsOfType (Gbl.Crs.Grps.GrpTyp.GrpTypCod); /***** Remove the associations of attendance events to groups of this type *****/ - Att_RemoveGroupsOfType (Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod); + Att_RemoveGroupsOfType (Gbl.Crs.Grps.GrpTyp.GrpTypCod); /***** Remove the associations of surveys to groups of this type *****/ - Svy_RemoveGroupsOfType (Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod); + Svy_RemoveGroupsOfType (Gbl.Crs.Grps.GrpTyp.GrpTypCod); /***** Change all groups of this type in course timetable *****/ DB_QueryUPDATE ("can not update all groups of a type in course timetable", "UPDATE timetable_crs SET GrpCod=-1" " WHERE GrpCod IN" " (SELECT GrpCod FROM crs_grp WHERE GrpTypCod=%ld)", - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod); + Gbl.Crs.Grps.GrpTyp.GrpTypCod); /***** Remove all the students in groups of this type *****/ DB_QueryDELETE ("can not remove users from all groups of a type", "DELETE FROM crs_grp_usr WHERE GrpCod IN" " (SELECT GrpCod FROM crs_grp WHERE GrpTypCod=%ld)", - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod); + Gbl.Crs.Grps.GrpTyp.GrpTypCod); /***** Remove all the groups of this type *****/ DB_QueryDELETE ("can not remove groups of a type", "DELETE FROM crs_grp WHERE GrpTypCod=%ld", - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod); + Gbl.Crs.Grps.GrpTyp.GrpTypCod); /***** Remove the group type *****/ DB_QueryDELETE ("can not remove a type of group", "DELETE FROM crs_grp_types WHERE GrpTypCod=%ld", - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod); + Gbl.Crs.Grps.GrpTyp.GrpTypCod); /***** Create message to show the change made *****/ snprintf (AlertTxt,sizeof (AlertTxt), Txt_Type_of_group_X_removed, - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypName); + Gbl.Crs.Grps.GrpTyp.GrpTypName); /***** Show the form again *****/ Grp_ReqEditGroupsInternal (Ale_SUCCESS,AlertTxt, @@ -4188,11 +4188,11 @@ static void Grp_RemoveGroupCompletely (void) char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME]; /***** Get name and type of the group from database *****/ - GrpDat.GrpCod = Gbl.Hierarchy.Crs.Grps.GrpCod; + GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod; Grp_GetDataOfGroupByCod (&GrpDat); /***** Remove file zones of this group *****/ - Brw_RemoveGrpZones (Gbl.Hierarchy.Crs.Crs.CrsCod,GrpDat.GrpCod); + Brw_RemoveGrpZones (Gbl.Hierarchy.Crs.CrsCod,GrpDat.GrpCod); /***** Remove this group from all the assignments *****/ Asg_RemoveGroup (GrpDat.GrpCod); @@ -4206,17 +4206,17 @@ static void Grp_RemoveGroupCompletely (void) /***** Change this group in course timetable *****/ DB_QueryUPDATE ("can not update a group in course timetable", "UPDATE timetable_crs SET GrpCod=-1 WHERE GrpCod=%ld", - Gbl.Hierarchy.Crs.Grps.GrpCod); + Gbl.Crs.Grps.GrpCod); /***** Remove all the students in this group *****/ DB_QueryDELETE ("can not remove users from a group", "DELETE FROM crs_grp_usr WHERE GrpCod=%ld", - Gbl.Hierarchy.Crs.Grps.GrpCod); + Gbl.Crs.Grps.GrpCod); /***** Remove the group *****/ DB_QueryDELETE ("can not remove a group", "DELETE FROM crs_grp WHERE GrpCod=%ld", - Gbl.Hierarchy.Crs.Grps.GrpCod); + Gbl.Crs.Grps.GrpCod); /***** Create message to show the change made *****/ snprintf (AlertTxt,sizeof (AlertTxt), @@ -4239,17 +4239,17 @@ void Grp_OpenGroup (void) char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME]; /***** Get group code *****/ - if ((Gbl.Hierarchy.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1) + if ((Gbl.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1) Lay_ShowErrorAndExit ("Code of group is missing."); /***** Get group data from database *****/ - GrpDat.GrpCod = Gbl.Hierarchy.Crs.Grps.GrpCod; + GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod; Grp_GetDataOfGroupByCod (&GrpDat); /***** Update the table of groups changing open/close status *****/ DB_QueryUPDATE ("can not open a group", "UPDATE crs_grp SET Open='Y' WHERE GrpCod=%ld", - Gbl.Hierarchy.Crs.Grps.GrpCod); + Gbl.Crs.Grps.GrpCod); /***** Create message to show the change made *****/ snprintf (AlertTxt,sizeof (AlertTxt), @@ -4257,7 +4257,7 @@ void Grp_OpenGroup (void) GrpDat.GrpName); /***** Show the form again *****/ - Gbl.Hierarchy.Crs.Grps.Open = true; + Gbl.Crs.Grps.Open = true; Grp_ReqEditGroupsInternal (Ale_INFO,NULL, Ale_SUCCESS,AlertTxt); } @@ -4273,17 +4273,17 @@ void Grp_CloseGroup (void) char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME]; /***** Get group code *****/ - if ((Gbl.Hierarchy.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1) + if ((Gbl.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1) Lay_ShowErrorAndExit ("Code of group is missing."); /***** Get group data from database *****/ - GrpDat.GrpCod = Gbl.Hierarchy.Crs.Grps.GrpCod; + GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod; Grp_GetDataOfGroupByCod (&GrpDat); /***** Update the table of groups changing open/close status *****/ DB_QueryUPDATE ("can not close a group", "UPDATE crs_grp SET Open='N' WHERE GrpCod=%ld", - Gbl.Hierarchy.Crs.Grps.GrpCod); + Gbl.Crs.Grps.GrpCod); /***** Create message to show the change made *****/ snprintf (AlertTxt,sizeof (AlertTxt), @@ -4291,7 +4291,7 @@ void Grp_CloseGroup (void) GrpDat.GrpName); /***** Show the form again *****/ - Gbl.Hierarchy.Crs.Grps.Open = false; + Gbl.Crs.Grps.Open = false; Grp_ReqEditGroupsInternal (Ale_INFO,NULL, Ale_SUCCESS,AlertTxt); } @@ -4307,17 +4307,17 @@ void Grp_EnableFileZonesGrp (void) char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME]; /***** Get group code *****/ - if ((Gbl.Hierarchy.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1) + if ((Gbl.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1) Lay_ShowErrorAndExit ("Code of group is missing."); /***** Get group data from database *****/ - GrpDat.GrpCod = Gbl.Hierarchy.Crs.Grps.GrpCod; + GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod; Grp_GetDataOfGroupByCod (&GrpDat); /***** Update the table of groups changing file zones status *****/ DB_QueryUPDATE ("can not enable file zones of a group", "UPDATE crs_grp SET FileZones='Y' WHERE GrpCod=%ld", - Gbl.Hierarchy.Crs.Grps.GrpCod); + Gbl.Crs.Grps.GrpCod); /***** Create message to show the change made *****/ snprintf (AlertTxt,sizeof (AlertTxt), @@ -4325,7 +4325,7 @@ void Grp_EnableFileZonesGrp (void) GrpDat.GrpName); /***** Show the form again *****/ - Gbl.Hierarchy.Crs.Grps.FileZones = true; + Gbl.Crs.Grps.FileZones = true; Grp_ReqEditGroupsInternal (Ale_INFO,NULL, Ale_SUCCESS,AlertTxt); } @@ -4341,17 +4341,17 @@ void Grp_DisableFileZonesGrp (void) char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME]; /***** Get group code *****/ - if ((Gbl.Hierarchy.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1) + if ((Gbl.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1) Lay_ShowErrorAndExit ("Code of group is missing."); /***** Get group data from database *****/ - GrpDat.GrpCod = Gbl.Hierarchy.Crs.Grps.GrpCod; + GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod; Grp_GetDataOfGroupByCod (&GrpDat); /***** Update the table of groups changing file zones status *****/ DB_QueryUPDATE ("can not disable file zones of a group", "UPDATE crs_grp SET FileZones='N' WHERE GrpCod=%ld", - Gbl.Hierarchy.Crs.Grps.GrpCod); + Gbl.Crs.Grps.GrpCod); /***** Create message to show the change made *****/ snprintf (AlertTxt,sizeof (AlertTxt), @@ -4359,7 +4359,7 @@ void Grp_DisableFileZonesGrp (void) GrpDat.GrpName); /***** Show the form again *****/ - Gbl.Hierarchy.Crs.Grps.FileZones = false; + Gbl.Crs.Grps.FileZones = false; Grp_ReqEditGroupsInternal (Ale_INFO,NULL, Ale_SUCCESS,AlertTxt); } @@ -4379,14 +4379,14 @@ void Grp_ChangeGroupType (void) /***** Get parameters from form *****/ /* Get group code */ - if ((Gbl.Hierarchy.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1L) + if ((Gbl.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1L) Lay_ShowErrorAndExit ("Code of group is missing."); /* Get the new group type */ NewGrpTypCod = Grp_GetParamGrpTypCod (); /* Get from the database the type and the name of the group */ - GrpDat.GrpCod = Gbl.Hierarchy.Crs.Grps.GrpCod; + GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod; Grp_GetDataOfGroupByCod (&GrpDat); /***** If group was in database... *****/ @@ -4403,7 +4403,7 @@ void Grp_ChangeGroupType (void) /* Update the table of groups changing old type by new type */ DB_QueryUPDATE ("can not update the type of a group", "UPDATE crs_grp SET GrpTypCod=%ld WHERE GrpCod=%ld", - NewGrpTypCod,Gbl.Hierarchy.Crs.Grps.GrpCod); + NewGrpTypCod,Gbl.Crs.Grps.GrpCod); /* Create message to show the change made */ AlertType = Ale_SUCCESS; @@ -4413,7 +4413,7 @@ void Grp_ChangeGroupType (void) } /***** Show the form again *****/ - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod = NewGrpTypCod; + Gbl.Crs.Grps.GrpTyp.GrpTypCod = NewGrpTypCod; Grp_ReqEditGroupsInternal (Ale_INFO,NULL, AlertType,AlertTxt); } @@ -4432,20 +4432,20 @@ void Grp_ChangeGroupClassroom (void) /***** Get parameters from form *****/ /* Get group code */ - if ((Gbl.Hierarchy.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1L) + if ((Gbl.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1L) Lay_ShowErrorAndExit ("Code of group is missing."); /* Get the new classroom */ NewClaCod = Cla_GetParamClaCod (); /* Get from the database the name of the group */ - GrpDat.GrpCod = Gbl.Hierarchy.Crs.Grps.GrpCod; + GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod; Grp_GetDataOfGroupByCod (&GrpDat); /***** Update the table of groups changing old classroom by new classroom *****/ DB_QueryUPDATE ("can not update the classroom of a group", "UPDATE crs_grp SET ClaCod=%ld WHERE GrpCod=%ld", - NewClaCod,Gbl.Hierarchy.Crs.Grps.GrpCod); + NewClaCod,Gbl.Crs.Grps.GrpCod); /* Create message to show the change made */ AlertType = Ale_SUCCESS; @@ -4454,7 +4454,7 @@ void Grp_ChangeGroupClassroom (void) GrpDat.GrpName); /***** Show the form again *****/ - Gbl.Hierarchy.Crs.Grps.ClaCod = NewClaCod; + Gbl.Crs.Grps.ClaCod = NewClaCod; Grp_ReqEditGroupsInternal (Ale_INFO,NULL, AlertType,AlertTxt); } @@ -4474,23 +4474,23 @@ void Grp_ChangeMandatGrpTyp (void) /***** Get parameters of the form *****/ /* Get the código of type of group */ - if ((Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) < 0) + if ((Gbl.Crs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) < 0) Lay_ShowErrorAndExit ("Code of type of group is missing."); /* Get the new type of enrolment (mandatory or voluntaria) of this type of group */ NewMandatoryEnrolment = Par_GetParToBool ("MandatoryEnrolment"); /* Get from the database the name of the type and the old type of enrolment */ - Grp_GetDataOfGroupTypeByCod (&Gbl.Hierarchy.Crs.Grps.GrpTyp); + Grp_GetDataOfGroupTypeByCod (&Gbl.Crs.Grps.GrpTyp); /***** Check if the old type of enrolment match the new (this happens when return is pressed without changes) *****/ - if (Gbl.Hierarchy.Crs.Grps.GrpTyp.MandatoryEnrolment == NewMandatoryEnrolment) + if (Gbl.Crs.Grps.GrpTyp.MandatoryEnrolment == NewMandatoryEnrolment) { AlertType = Ale_INFO; snprintf (AlertTxt,sizeof (AlertTxt), Txt_The_type_of_enrolment_of_the_type_of_group_X_has_not_changed, - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypName); + Gbl.Crs.Grps.GrpTyp.GrpTypName); } else { @@ -4499,18 +4499,18 @@ void Grp_ChangeMandatGrpTyp (void) "UPDATE crs_grp_types SET Mandatory='%c' WHERE GrpTypCod=%ld", NewMandatoryEnrolment ? 'Y' : 'N', - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod); + Gbl.Crs.Grps.GrpTyp.GrpTypCod); /***** Write message to show the change made *****/ AlertType = Ale_SUCCESS; snprintf (AlertTxt,sizeof (AlertTxt), NewMandatoryEnrolment ? Txt_The_enrolment_of_students_into_groups_of_type_X_is_now_mandatory : Txt_The_enrolment_of_students_into_groups_of_type_X_is_now_voluntary, - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypName); + Gbl.Crs.Grps.GrpTyp.GrpTypName); } /***** Show the form again *****/ - Gbl.Hierarchy.Crs.Grps.GrpTyp.MandatoryEnrolment = NewMandatoryEnrolment; + Gbl.Crs.Grps.GrpTyp.MandatoryEnrolment = NewMandatoryEnrolment; Grp_ReqEditGroupsInternal (AlertType,AlertTxt, Ale_INFO,NULL); } @@ -4530,23 +4530,23 @@ void Grp_ChangeMultiGrpTyp (void) /***** Get parameters from the form *****/ /* Get the code of type of group */ - if ((Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) < 0) + if ((Gbl.Crs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) < 0) Lay_ShowErrorAndExit ("Code of type of group is missing."); /* Get the new type of enrolment (single or multiple) of this type of group */ NewMultipleEnrolment = Par_GetParToBool ("MultipleEnrolment"); /* Get from the database the name of the type and the old type of enrolment */ - Grp_GetDataOfGroupTypeByCod (&Gbl.Hierarchy.Crs.Grps.GrpTyp); + Grp_GetDataOfGroupTypeByCod (&Gbl.Crs.Grps.GrpTyp); /***** Check if the old type of enrolment match the new one (this happends when return is pressed without changes) *****/ - if (Gbl.Hierarchy.Crs.Grps.GrpTyp.MultipleEnrolment == NewMultipleEnrolment) + if (Gbl.Crs.Grps.GrpTyp.MultipleEnrolment == NewMultipleEnrolment) { AlertType = Ale_INFO; snprintf (AlertTxt,sizeof (AlertTxt), Txt_The_type_of_enrolment_of_the_type_of_group_X_has_not_changed, - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypName); + Gbl.Crs.Grps.GrpTyp.GrpTypName); } else { @@ -4556,18 +4556,18 @@ void Grp_ChangeMultiGrpTyp (void) " WHERE GrpTypCod=%ld", NewMultipleEnrolment ? 'Y' : 'N', - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod); + Gbl.Crs.Grps.GrpTyp.GrpTypCod); /***** Write message to show the change made *****/ AlertType = Ale_SUCCESS; snprintf (AlertTxt,sizeof (AlertTxt), NewMultipleEnrolment ? Txt_Now_each_student_can_belong_to_multiple_groups_of_type_X : Txt_Now_each_student_can_only_belong_to_a_group_of_type_X, - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypName); + Gbl.Crs.Grps.GrpTyp.GrpTypName); } /***** Show the form again *****/ - Gbl.Hierarchy.Crs.Grps.GrpTyp.MultipleEnrolment = NewMultipleEnrolment; + Gbl.Crs.Grps.GrpTyp.MultipleEnrolment = NewMultipleEnrolment; Grp_ReqEditGroupsInternal (AlertType,AlertTxt, Ale_INFO,NULL); } @@ -4581,15 +4581,15 @@ void Grp_ChangeOpenTimeGrpTyp (void) extern const char *Txt_The_date_time_of_opening_of_groups_has_changed; /***** Get the code of type of group *****/ - if ((Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) < 0) + if ((Gbl.Crs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) < 0) Lay_ShowErrorAndExit ("Code of type of group is missing."); /***** Get from the database the data of this type of group *****/ - Grp_GetDataOfGroupTypeByCod (&Gbl.Hierarchy.Crs.Grps.GrpTyp); + Grp_GetDataOfGroupTypeByCod (&Gbl.Crs.Grps.GrpTyp); /***** Get open time *****/ - Gbl.Hierarchy.Crs.Grps.GrpTyp.OpenTimeUTC = Dat_GetTimeUTCFromForm ("OpenTimeUTC"); - Gbl.Hierarchy.Crs.Grps.GrpTyp.MustBeOpened = Grp_CheckIfOpenTimeInTheFuture (Gbl.Hierarchy.Crs.Grps.GrpTyp.OpenTimeUTC); + Gbl.Crs.Grps.GrpTyp.OpenTimeUTC = Dat_GetTimeUTCFromForm ("OpenTimeUTC"); + Gbl.Crs.Grps.GrpTyp.MustBeOpened = Grp_CheckIfOpenTimeInTheFuture (Gbl.Crs.Grps.GrpTyp.OpenTimeUTC); /***** Update the table of types of group changing the old open time of enrolment by the new *****/ @@ -4597,10 +4597,10 @@ void Grp_ChangeOpenTimeGrpTyp (void) "UPDATE crs_grp_types" " SET MustBeOpened='%c',OpenTime=FROM_UNIXTIME(%ld)" " WHERE GrpTypCod=%ld", - Gbl.Hierarchy.Crs.Grps.GrpTyp.MustBeOpened ? 'Y' : + Gbl.Crs.Grps.GrpTyp.MustBeOpened ? 'Y' : 'N', - (long) Gbl.Hierarchy.Crs.Grps.GrpTyp.OpenTimeUTC, - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod); + (long) Gbl.Crs.Grps.GrpTyp.OpenTimeUTC, + Gbl.Crs.Grps.GrpTyp.GrpTypCod); /***** Write message to show the change made *****/ Ale_ShowAlert (Ale_SUCCESS,Txt_The_date_time_of_opening_of_groups_has_changed); @@ -4626,7 +4626,7 @@ void Grp_ChangeMaxStdsGrp (void) /***** Get parameters of the form *****/ /* Get group code */ - if ((Gbl.Hierarchy.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1) + if ((Gbl.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1) Lay_ShowErrorAndExit ("Code of group is missing."); /* Get the new maximum number of students of the group */ @@ -4637,7 +4637,7 @@ void Grp_ChangeMaxStdsGrp (void) Grp_NUM_STUDENTS_NOT_LIMITED); /* Get from the database the type, name, and old maximum of students of the group */ - GrpDat.GrpCod = Gbl.Hierarchy.Crs.Grps.GrpCod; + GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod; Grp_GetDataOfGroupByCod (&GrpDat); /***** Check if the old maximum of students equals the new one @@ -4655,7 +4655,7 @@ void Grp_ChangeMaxStdsGrp (void) DB_QueryUPDATE ("can not update the maximum number of students" " in a group", "UPDATE crs_grp SET MaxStudents=%u WHERE GrpCod=%ld", - NewMaxStds,Gbl.Hierarchy.Crs.Grps.GrpCod); + NewMaxStds,Gbl.Crs.Grps.GrpCod); /***** Write message to show the change made *****/ AlertType = Ale_SUCCESS; @@ -4670,7 +4670,7 @@ void Grp_ChangeMaxStdsGrp (void) } /***** Show the form again *****/ - Gbl.Hierarchy.Crs.Grps.MaxStudents = NewMaxStds; + Gbl.Crs.Grps.MaxStudents = NewMaxStds; Grp_ReqEditGroupsInternal (Ale_INFO,NULL, AlertType,AlertTxt); } @@ -4716,14 +4716,14 @@ void Grp_RenameGroupType (void) /***** Get parameters from form *****/ /* Get the code of the group type */ - if ((Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) < 0) + if ((Gbl.Crs.Grps.GrpTyp.GrpTypCod = Grp_GetParamGrpTypCod ()) < 0) Lay_ShowErrorAndExit ("Code of type of group is missing."); /* Get the new name for the group type */ Par_GetParToText ("GrpTypName",NewNameGrpTyp,Grp_MAX_BYTES_GROUP_TYPE_NAME); /***** Get from the database the old name of the group type *****/ - Grp_GetDataOfGroupTypeByCod (&Gbl.Hierarchy.Crs.Grps.GrpTyp); + Grp_GetDataOfGroupTypeByCod (&Gbl.Crs.Grps.GrpTyp); /***** Check if new name is empty *****/ if (!NewNameGrpTyp[0]) @@ -4731,16 +4731,16 @@ void Grp_RenameGroupType (void) AlertType = Ale_WARNING; snprintf (AlertTxt,sizeof (AlertTxt), Txt_You_can_not_leave_the_name_of_the_type_of_group_X_empty, - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypName); + Gbl.Crs.Grps.GrpTyp.GrpTypName); } else { /***** Check if old and new names are the same (this happens when return is pressed without changes) *****/ - if (strcmp (Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypName,NewNameGrpTyp)) // Different names + if (strcmp (Gbl.Crs.Grps.GrpTyp.GrpTypName,NewNameGrpTyp)) // Different names { /***** If group type was in database... *****/ - if (Grp_CheckIfGroupTypeNameExists (NewNameGrpTyp,Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod)) + if (Grp_CheckIfGroupTypeNameExists (NewNameGrpTyp,Gbl.Crs.Grps.GrpTyp.GrpTypCod)) { AlertType = Ale_WARNING; snprintf (AlertTxt,sizeof (AlertTxt), @@ -4754,13 +4754,13 @@ void Grp_RenameGroupType (void) "UPDATE crs_grp_types SET GrpTypName='%s'" " WHERE GrpTypCod=%ld", NewNameGrpTyp, - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypCod); + Gbl.Crs.Grps.GrpTyp.GrpTypCod); /***** Write message to show the change made *****/ AlertType = Ale_SUCCESS; snprintf (AlertTxt,sizeof (AlertTxt), Txt_The_type_of_group_X_has_been_renamed_as_Y, - Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypName,NewNameGrpTyp); + Gbl.Crs.Grps.GrpTyp.GrpTypName,NewNameGrpTyp); } } else // The same name @@ -4773,7 +4773,7 @@ void Grp_RenameGroupType (void) } /***** Show the form again *****/ - Str_Copy (Gbl.Hierarchy.Crs.Grps.GrpTyp.GrpTypName,NewNameGrpTyp, + Str_Copy (Gbl.Crs.Grps.GrpTyp.GrpTypName,NewNameGrpTyp, Grp_MAX_BYTES_GROUP_TYPE_NAME); Grp_ReqEditGroupsInternal (AlertType,AlertTxt, Ale_INFO,NULL); @@ -4796,14 +4796,14 @@ void Grp_RenameGroup (void) /***** Get parameters from form *****/ /* Get the code of the group */ - if ((Gbl.Hierarchy.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1L) + if ((Gbl.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1L) Lay_ShowErrorAndExit ("Code of group is missing."); /* Get the new name for the group */ Par_GetParToText ("GrpName",NewNameGrp,Grp_MAX_BYTES_GROUP_NAME); /***** Get from the database the type and the old name of the group *****/ - GrpDat.GrpCod = Gbl.Hierarchy.Crs.Grps.GrpCod; + GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod; Grp_GetDataOfGroupByCod (&GrpDat); /***** Check if new name is empty *****/ @@ -4821,7 +4821,7 @@ void Grp_RenameGroup (void) if (strcmp (GrpDat.GrpName,NewNameGrp)) // Different names { /***** If group was in database... *****/ - if (Grp_CheckIfGroupNameExists (GrpDat.GrpTypCod,NewNameGrp,Gbl.Hierarchy.Crs.Grps.GrpCod)) + if (Grp_CheckIfGroupNameExists (GrpDat.GrpTypCod,NewNameGrp,Gbl.Crs.Grps.GrpCod)) { AlertType = Ale_WARNING; snprintf (AlertTxt,sizeof (AlertTxt), @@ -4833,7 +4833,7 @@ void Grp_RenameGroup (void) /* Update the table changing old name by new name */ DB_QueryUPDATE ("can not update the name of a group", "UPDATE crs_grp SET GrpName='%s' WHERE GrpCod=%ld", - NewNameGrp,Gbl.Hierarchy.Crs.Grps.GrpCod); + NewNameGrp,Gbl.Crs.Grps.GrpCod); /***** Write message to show the change made *****/ AlertType = Ale_SUCCESS; @@ -4852,7 +4852,7 @@ void Grp_RenameGroup (void) } /***** Show the form again *****/ - Str_Copy (Gbl.Hierarchy.Crs.Grps.GrpName,NewNameGrp, + Str_Copy (Gbl.Crs.Grps.GrpName,NewNameGrp, Grp_MAX_BYTES_GROUP_NAME); Grp_ReqEditGroupsInternal (Ale_INFO,NULL, AlertType,AlertTxt); @@ -4910,26 +4910,26 @@ void Grp_GetLstCodsGrpWanted (struct ListCodGrps *LstGrpsWanted) unsigned NumGrpWanted; /***** Allocate memory for the strings with group codes in each type *****/ - if ((LstStrCodGrps = (char **) calloc (Gbl.Hierarchy.Crs.Grps.GrpTypes.Num,sizeof (char *))) == NULL) + if ((LstStrCodGrps = (char **) calloc (Gbl.Crs.Grps.GrpTypes.Num,sizeof (char *))) == NULL) Lay_NotEnoughMemoryExit (); /***** Get lists with the groups that I want in each type in order to count the total number of groups selected *****/ for (NumGrpTyp = 0, LstGrpsWanted->NumGrps = 0; - NumGrpTyp < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num; + NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num; NumGrpTyp++) { /***** Allocate memory for the list of group codes of this type *****/ if ((LstStrCodGrps[NumGrpTyp] = (char *) malloc ((size_t) ((1 + 10 + 1) * - Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps))) == NULL) + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps))) == NULL) Lay_NotEnoughMemoryExit (); /***** Get the multiple parameter code of group of this type *****/ snprintf (Param,sizeof (Param), "GrpCod%ld", - Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod); + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod); Par_GetParMultiToText (Param,LstStrCodGrps[NumGrpTyp], - ((1 + 10 + 1) * Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) - 1); + ((1 + 10 + 1) * Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) - 1); if (LstStrCodGrps[NumGrpTyp][0]) { /***** Count the number of groups selected of this type of LstCodGrps[NumGrpTyp] *****/ @@ -4952,7 +4952,7 @@ void Grp_GetLstCodsGrpWanted (struct ListCodGrps *LstGrpsWanted) /***** Get the groups *****/ for (NumGrpTyp = 0, NumGrpWanted = 0; - NumGrpTyp < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num; + NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num; NumGrpTyp++) { /* Add the groups selected of this type to the complete list of groups selected */ @@ -5001,7 +5001,7 @@ void Grp_PutParamWhichGrps (void) { Grp_GetParamWhichGrps (); - Par_PutHiddenParamUnsigned ("WhichGrps",(unsigned) Gbl.Hierarchy.Crs.Grps.WhichGrps); + Par_PutHiddenParamUnsigned ("WhichGrps",(unsigned) Gbl.Crs.Grps.WhichGrps); } void Grp_PutParamWhichGrpsOnlyMyGrps (void) @@ -5029,7 +5029,7 @@ void Grp_ShowFormToSelWhichGrps (Act_Action_t Action,void (*FuncParams) ()) WhichGrps++) { fprintf (Gbl.F.Out,"
    ", - WhichGrps == Gbl.Hierarchy.Crs.Grps.WhichGrps ? "PREF_ON" : + WhichGrps == Gbl.Crs.Grps.WhichGrps ? "PREF_ON" : "PREF_OFF"); Frm_StartForm (Action); Par_PutHiddenParamUnsigned ("WhichGrps",(unsigned) WhichGrps); @@ -5079,7 +5079,7 @@ void Grp_GetParamWhichGrps (void) } /* Get parameter */ - Gbl.Hierarchy.Crs.Grps.WhichGrps = (Grp_WhichGroups_t) + Gbl.Crs.Grps.WhichGrps = (Grp_WhichGroups_t) Par_GetParToUnsignedLong ("WhichGrps", 0, Grp_NUM_WHICH_GROUPS - 1, diff --git a/swad_help.c b/swad_help.c index e595e6df..ce6a0060 100644 --- a/swad_help.c +++ b/swad_help.c @@ -144,7 +144,7 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void) /* Request my removing from this course */ snprintf (Gbl.Title,sizeof (Gbl.Title), Txt_Remove_me_from_THE_COURSE_X, - Gbl.Hierarchy.Crs.Crs.ShrtName); + Gbl.Hierarchy.Crs.ShrtName); Hlp_ShowRowHelpWhatWouldYouLikeToDo (Gbl.Title, ActionsRemoveMe[Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role], Btn_REMOVE_BUTTON,Txt_Remove_me); @@ -155,7 +155,7 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void) /* Request my registration in this course */ snprintf (Gbl.Title,sizeof (Gbl.Title), Txt_Register_me_in_X, - Gbl.Hierarchy.Crs.Crs.ShrtName); + Gbl.Hierarchy.Crs.ShrtName); Hlp_ShowRowHelpWhatWouldYouLikeToDo (Gbl.Title, ActReqSignUp, Btn_CREATE_BUTTON,Txt_Sign_up); @@ -165,13 +165,13 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void) if (Gbl.Usrs.Me.MyCrss.Num) // I am enroled in some courses { if (Gbl.Hierarchy.Level == Hie_CRS && // Course selected - !Gbl.Hierarchy.Crs.Crs.NumUsrs[Rol_STD] && // Current course has no students + !Gbl.Hierarchy.Crs.NumUsrs[Rol_STD] && // Current course has no students Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role == Rol_TCH) // I am a teacher in current course { /* Request students enrolment */ snprintf (Gbl.Title,sizeof (Gbl.Title), Txt_Register_students_in_COURSE_X, - Gbl.Hierarchy.Crs.Crs.ShrtName); + Gbl.Hierarchy.Crs.ShrtName); Hlp_ShowRowHelpWhatWouldYouLikeToDo (Gbl.Title, ActReqEnrSevStd, Btn_CREATE_BUTTON,Txt_Register_students); diff --git a/swad_hierarchy.c b/swad_hierarchy.c index 57a4bafa..5f4de061 100644 --- a/swad_hierarchy.c +++ b/swad_hierarchy.c @@ -432,12 +432,12 @@ void Hie_WriteBigNameCtyInsCtrDegCrs (void) "
    " "%s" // Short name "
    ", - (Gbl.Hierarchy.Level == Hie_CRS) ? Gbl.Hierarchy.Crs.Crs.FullName : + (Gbl.Hierarchy.Level == Hie_CRS) ? Gbl.Hierarchy.Crs.FullName : ((Gbl.Hierarchy.Level == Hie_DEG) ? Gbl.Hierarchy.Deg.FullName : ((Gbl.Hierarchy.Level == Hie_CTR) ? Gbl.Hierarchy.Ctr.FullName : ((Gbl.Hierarchy.Level == Hie_INS) ? Gbl.Hierarchy.Ins.FullName : Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]))), - (Gbl.Hierarchy.Level == Hie_CRS) ? Gbl.Hierarchy.Crs.Crs.ShrtName : + (Gbl.Hierarchy.Level == Hie_CRS) ? Gbl.Hierarchy.Crs.ShrtName : ((Gbl.Hierarchy.Level == Hie_DEG) ? Gbl.Hierarchy.Deg.ShrtName : ((Gbl.Hierarchy.Level == Hie_CTR) ? Gbl.Hierarchy.Ctr.ShrtName : ((Gbl.Hierarchy.Level == Hie_INS) ? Gbl.Hierarchy.Ins.ShrtName : @@ -483,7 +483,7 @@ void Hie_SetHierarchyFromUsrLastHierarchy (void) Gbl.Hierarchy.Deg.DegCod = Gbl.Usrs.Me.UsrLast.LastHie.Cod; break; case Hie_CRS: // Course - Gbl.Hierarchy.Crs.Crs.CrsCod = Gbl.Usrs.Me.UsrLast.LastHie.Cod; + Gbl.Hierarchy.Crs.CrsCod = Gbl.Usrs.Me.UsrLast.LastHie.Cod; break; default: break; @@ -500,10 +500,10 @@ void Hie_SetHierarchyFromUsrLastHierarchy (void) void Hie_InitHierarchy (void) { /***** If course code is available, get course data *****/ - if (Gbl.Hierarchy.Crs.Crs.CrsCod > 0) + if (Gbl.Hierarchy.Crs.CrsCod > 0) { - if (Crs_GetDataOfCourseByCod (&Gbl.Hierarchy.Crs.Crs)) // Course found - Gbl.Hierarchy.Deg.DegCod = Gbl.Hierarchy.Crs.Crs.DegCod; + if (Crs_GetDataOfCourseByCod (&Gbl.Hierarchy.Crs)) // Course found + Gbl.Hierarchy.Deg.DegCod = Gbl.Hierarchy.Crs.DegCod; else Hie_ResetHierarchy (); } @@ -513,13 +513,8 @@ void Hie_InitHierarchy (void) { if (Deg_GetDataOfDegreeByCod (&Gbl.Hierarchy.Deg)) // Degree found { - Gbl.Hierarchy.Ctr.CtrCod = Gbl.Hierarchy.Deg.CtrCod; - Gbl.Hierarchy.DegTyp.DegTypCod = Gbl.Hierarchy.Deg.DegTypCod; + Gbl.Hierarchy.Ctr.CtrCod = Gbl.Hierarchy.Deg.CtrCod; Gbl.Hierarchy.Ins.InsCod = Deg_GetInsCodOfDegreeByCod (Gbl.Hierarchy.Deg.DegCod); - - /***** Degree type is available, so get degree type data *****/ - if (!DT_GetDataOfDegreeTypeByCod (&Gbl.Hierarchy.DegTyp)) // Degree type not found - Hie_ResetHierarchy (); } else Hie_ResetHierarchy (); @@ -552,35 +547,35 @@ void Hie_InitHierarchy (void) /***** Set current hierarchy level and code depending on course code, degree code, etc. *****/ - if (Gbl.Hierarchy.Crs.Crs.CrsCod > 0) // Course selected + if (Gbl.Hierarchy.Crs.CrsCod > 0) // Course selected { Gbl.Hierarchy.Level = Hie_CRS; - Gbl.Hierarchy.Cod = Gbl.Hierarchy.Crs.Crs.CrsCod; + Gbl.Hierarchy.Cod = Gbl.Hierarchy.Crs.CrsCod; } else if (Gbl.Hierarchy.Deg.DegCod > 0) // Degree selected { Gbl.Hierarchy.Level = Hie_DEG; - Gbl.Hierarchy.Cod = Gbl.Hierarchy.Deg.DegCod; + Gbl.Hierarchy.Cod = Gbl.Hierarchy.Deg.DegCod; } else if (Gbl.Hierarchy.Ctr.CtrCod > 0) // Centre selected { Gbl.Hierarchy.Level = Hie_CTR; - Gbl.Hierarchy.Cod = Gbl.Hierarchy.Ctr.CtrCod; + Gbl.Hierarchy.Cod = Gbl.Hierarchy.Ctr.CtrCod; } else if (Gbl.Hierarchy.Ins.InsCod > 0) // Institution selected { Gbl.Hierarchy.Level = Hie_INS; - Gbl.Hierarchy.Cod = Gbl.Hierarchy.Ins.InsCod; + Gbl.Hierarchy.Cod = Gbl.Hierarchy.Ins.InsCod; } else if (Gbl.Hierarchy.Cty.CtyCod > 0) // Country selected { Gbl.Hierarchy.Level = Hie_CTY; - Gbl.Hierarchy.Cod = Gbl.Hierarchy.Cty.CtyCod; + Gbl.Hierarchy.Cod = Gbl.Hierarchy.Cty.CtyCod; } else { Gbl.Hierarchy.Level = Hie_SYS; - Gbl.Hierarchy.Cod = -1L; + Gbl.Hierarchy.Cod = -1L; } /***** Initialize default fields for edition to current values *****/ @@ -588,31 +583,31 @@ void Hie_InitHierarchy (void) Gbl.Ctrs.EditingCtr.InsCod = Gbl.Dpts.EditingDpt.InsCod = Gbl.Hierarchy.Ins.InsCod; Gbl.Degs.EditingDeg.CtrCod = Gbl.Hierarchy.Ctr.CtrCod; - Gbl.Degs.EditingDeg.DegTypCod = Gbl.Hierarchy.DegTyp.DegTypCod; + Gbl.Degs.EditingDeg.DegTypCod = Gbl.Hierarchy.Deg.DegTypCod; /***** Initialize paths *****/ - if (Gbl.Hierarchy.Crs.Crs.CrsCod > 0) + if (Gbl.Hierarchy.Level == Hie_CRS) // Course selected { /***** Paths of course directories *****/ - snprintf (Gbl.Hierarchy.Crs.PathPriv,sizeof (Gbl.Hierarchy.Crs.PathPriv), + snprintf (Gbl.Crs.PathPriv,sizeof (Gbl.Crs.PathPriv), "%s/%ld", - Cfg_PATH_CRS_PRIVATE,Gbl.Hierarchy.Crs.Crs.CrsCod); - snprintf (Gbl.Hierarchy.Crs.PathRelPubl,sizeof (Gbl.Hierarchy.Crs.PathRelPubl), + Cfg_PATH_CRS_PRIVATE,Gbl.Hierarchy.Crs.CrsCod); + snprintf (Gbl.Crs.PathRelPubl,sizeof (Gbl.Crs.PathRelPubl), "%s/%ld", - Cfg_PATH_CRS_PUBLIC,Gbl.Hierarchy.Crs.Crs.CrsCod); - snprintf (Gbl.Hierarchy.Crs.PathURLPubl,sizeof (Gbl.Hierarchy.Crs.PathURLPubl), + Cfg_PATH_CRS_PUBLIC,Gbl.Hierarchy.Crs.CrsCod); + snprintf (Gbl.Crs.PathURLPubl,sizeof (Gbl.Crs.PathURLPubl), "%s/%ld", - Cfg_URL_CRS_PUBLIC,Gbl.Hierarchy.Crs.Crs.CrsCod); + Cfg_URL_CRS_PUBLIC,Gbl.Hierarchy.Crs.CrsCod); /***** If any of the course directories does not exist, create it *****/ - if (!Fil_CheckIfPathExists (Gbl.Hierarchy.Crs.PathPriv)) - Fil_CreateDirIfNotExists (Gbl.Hierarchy.Crs.PathPriv); - if (!Fil_CheckIfPathExists (Gbl.Hierarchy.Crs.PathRelPubl)) - Fil_CreateDirIfNotExists (Gbl.Hierarchy.Crs.PathRelPubl); + if (!Fil_CheckIfPathExists (Gbl.Crs.PathPriv)) + Fil_CreateDirIfNotExists (Gbl.Crs.PathPriv); + if (!Fil_CheckIfPathExists (Gbl.Crs.PathRelPubl)) + Fil_CreateDirIfNotExists (Gbl.Crs.PathRelPubl); /***** Count number of groups in current course (used in some actions) *****/ - Gbl.Hierarchy.Crs.Grps.NumGrps = Grp_CountNumGrpsInCurrentCrs (); + Gbl.Crs.Grps.NumGrps = Grp_CountNumGrpsInCurrentCrs (); } } @@ -633,14 +628,11 @@ void Hie_ResetHierarchy (void) Gbl.Hierarchy.Ctr.InsCod = -1L; Gbl.Hierarchy.Ctr.PlcCod = -1L; - /***** Degree type *****/ - Gbl.Hierarchy.DegTyp.DegTypCod = -1L; - /***** Degree *****/ Gbl.Hierarchy.Deg.DegCod = -1L; /***** Course *****/ - Gbl.Hierarchy.Crs.Crs.CrsCod = -1L; + Gbl.Hierarchy.Crs.CrsCod = -1L; /***** Hierarchy level and code *****/ Gbl.Hierarchy.Level = Hie_UNK; diff --git a/swad_indicator.c b/swad_indicator.c index 847a4a4e..3f9396a8 100644 --- a/swad_indicator.c +++ b/swad_indicator.c @@ -509,8 +509,8 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res) " AND crs_usr.UsrCod=usr_data.UsrCod" " AND usr_data.DptCod=%ld" " ORDER BY degrees.FullName,courses.FullName", - Gbl.Hierarchy.Crs.Crs.CrsCod, - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, (unsigned) Rol_TCH, Gbl.Stat.DptCod); else @@ -521,7 +521,7 @@ static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res) " WHERE courses.CrsCod=%ld" " AND degrees.DegCod=courses.DegCod" " ORDER BY degrees.FullName,courses.FullName", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); break; default: Lay_WrongScopeExit (); diff --git a/swad_info.c b/swad_info.c index dba6a978..70919e60 100644 --- a/swad_info.c +++ b/swad_info.c @@ -360,14 +360,14 @@ void Inf_ShowInfo (void) }; /***** Set info type *****/ - Gbl.Hierarchy.Crs.Info.Type = Inf_AsignInfoType (); + Gbl.Crs.Info.Type = Inf_AsignInfoType (); /***** Get info source from database *****/ - Inf_GetAndCheckInfoSrcFromDB (Gbl.Hierarchy.Crs.Crs.CrsCod, - Gbl.Hierarchy.Crs.Info.Type, + Inf_GetAndCheckInfoSrcFromDB (Gbl.Hierarchy.Crs.CrsCod, + Gbl.Crs.Info.Type, &InfoSrc,&MustBeRead); - switch (Gbl.Hierarchy.Crs.Info.Type) + switch (Gbl.Crs.Info.Type) { case Inf_LECTURES: case Inf_PRACTICALS: @@ -410,7 +410,7 @@ void Inf_ShowInfo (void) ShowWarningNoInfo = true; break; case Inf_INFO_SRC_EDITOR: - switch (Gbl.Hierarchy.Crs.Info.Type) + switch (Gbl.Crs.Info.Type) { case Inf_LECTURES: case Inf_PRACTICALS: @@ -444,10 +444,10 @@ void Inf_ShowInfo (void) if (ShowWarningNoInfo) { - Box_StartBox ("100%",Txt_INFO_TITLE[Gbl.Hierarchy.Crs.Info.Type], + Box_StartBox ("100%",Txt_INFO_TITLE[Gbl.Crs.Info.Type], ICanEdit ? Inf_PutIconToEditInfo : NULL, - Help[Gbl.Hierarchy.Crs.Info.Type],Box_NOT_CLOSABLE); + Help[Gbl.Crs.Info.Type],Box_NOT_CLOSABLE); Ale_ShowAlert (Ale_INFO,Txt_No_information); if (ICanEdit) Inf_PutButtonToEditInfo (); @@ -463,7 +463,7 @@ static void Inf_PutButtonToEditInfo (void) { extern const char *Txt_Edit; - Frm_StartForm (Inf_ActionsEditInfo[Gbl.Hierarchy.Crs.Info.Type]); + Frm_StartForm (Inf_ActionsEditInfo[Gbl.Crs.Info.Type]); Btn_PutConfirmButton (Txt_Edit); Frm_EndForm (); } @@ -474,12 +474,12 @@ static void Inf_PutButtonToEditInfo (void) static void Inf_PutIconToViewInfo (void) { - Ico_PutContextualIconToView (Inf_ActionsSeeInfo[Gbl.Hierarchy.Crs.Info.Type],NULL); + Ico_PutContextualIconToView (Inf_ActionsSeeInfo[Gbl.Crs.Info.Type],NULL); } void Inf_PutIconToEditInfo (void) { - Ico_PutContextualIconToEdit (Inf_ActionsEditInfo[Gbl.Hierarchy.Crs.Info.Type],NULL); + Ico_PutContextualIconToEdit (Inf_ActionsEditInfo[Gbl.Crs.Info.Type],NULL); } /*****************************************************************************/ @@ -490,7 +490,7 @@ static void Inf_PutCheckboxForceStdsToReadInfo (bool MustBeRead,bool Disabled) { extern const char *Txt_Force_students_to_read_this_information; - Lay_PutContextualCheckbox (Inf_ActionsChangeForceReadInfo[Gbl.Hierarchy.Crs.Info.Type], + Lay_PutContextualCheckbox (Inf_ActionsChangeForceReadInfo[Gbl.Crs.Info.Type], NULL, "MustBeRead", MustBeRead,Disabled, @@ -507,7 +507,7 @@ static void Inf_PutCheckboxConfirmIHaveReadInfo (void) extern const char *Txt_I_have_read_this_information; bool IHaveRead = Inf_CheckIfIHaveReadInfo (); - Lay_PutContextualCheckbox (Inf_ActionsIHaveReadInfo[Gbl.Hierarchy.Crs.Info.Type], + Lay_PutContextualCheckbox (Inf_ActionsIHaveReadInfo[Gbl.Crs.Info.Type], NULL, "IHaveRead", IHaveRead,false, @@ -526,8 +526,8 @@ static bool Inf_CheckIfIHaveReadInfo (void) "SELECT COUNT(*) FROM crs_info_read" " WHERE UsrCod=%ld AND CrsCod=%ld AND InfoType='%s'", Gbl.Usrs.Me.UsrDat.UsrCod, - Gbl.Hierarchy.Crs.Crs.CrsCod, - Inf_NamesInDBForInfoType[Gbl.Hierarchy.Crs.Info.Type]) != 0); + Gbl.Hierarchy.Crs.CrsCod, + Inf_NamesInDBForInfoType[Gbl.Crs.Info.Type]) != 0); } /*****************************************************************************/ @@ -546,7 +546,7 @@ bool Inf_GetIfIMustReadAnyCrsInfoInThisCrs (void) for (InfoType = (Inf_InfoType_t) 0; InfoType < Inf_NUM_INFO_TYPES; InfoType++) - Gbl.Hierarchy.Crs.Info.MustBeRead[InfoType] = false; + Gbl.Crs.Info.MustBeRead[InfoType] = false; /***** Get info types where students must read info *****/ NumRows = DB_QuerySELECT (&mysql_res,"can not get if you must read" @@ -556,9 +556,9 @@ bool Inf_GetIfIMustReadAnyCrsInfoInThisCrs (void) " AND InfoType NOT IN" " (SELECT InfoType FROM crs_info_read" " WHERE UsrCod=%ld AND CrsCod=%ld)", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod, - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); /***** Set must-be-read to true for each rown in result *****/ for (NumRow = 0; @@ -570,7 +570,7 @@ bool Inf_GetIfIMustReadAnyCrsInfoInThisCrs (void) /* Get info type (row[0]) */ InfoType = Inf_ConvertFromStrDBToInfoType (row[0]); - Gbl.Hierarchy.Crs.Info.MustBeRead[InfoType] = true; + Gbl.Crs.Info.MustBeRead[InfoType] = true; } /***** Free structure that stores the query result *****/ @@ -604,7 +604,7 @@ void Inf_WriteMsgYouMustReadInfo (void) for (InfoType = (Inf_InfoType_t) 0; InfoType < Inf_NUM_INFO_TYPES; InfoType++) - if (Gbl.Hierarchy.Crs.Info.MustBeRead[InfoType]) + if (Gbl.Crs.Info.MustBeRead[InfoType]) { fprintf (Gbl.F.Out,"
  • "); Frm_StartForm (Inf_ActionsSeeInfo[InfoType]); @@ -634,7 +634,7 @@ void Inf_ChangeForceReadInfo (void) bool MustBeRead = Inf_GetMustBeReadFromForm (); /***** Set info type *****/ - Gbl.Hierarchy.Crs.Info.Type = Inf_AsignInfoType (); + Gbl.Crs.Info.Type = Inf_AsignInfoType (); /***** Set status (if info must be read or not) into database *****/ Inf_SetForceReadIntoDB (MustBeRead); @@ -659,7 +659,7 @@ void Inf_ChangeIHaveReadInfo (void) bool IHaveRead = Inf_GetIfIHaveReadFromForm (); /***** Set info type *****/ - Gbl.Hierarchy.Crs.Info.Type = Inf_AsignInfoType (); + Gbl.Crs.Info.Type = Inf_AsignInfoType (); /***** Set status (if I have read or not a information) into database *****/ Inf_SetIHaveReadIntoDB (IHaveRead); @@ -703,8 +703,8 @@ static void Inf_SetForceReadIntoDB (bool MustBeRead) " WHERE CrsCod=%ld AND InfoType='%s'", MustBeRead ? 'Y' : 'N', - Gbl.Hierarchy.Crs.Crs.CrsCod, - Inf_NamesInDBForInfoType[Gbl.Hierarchy.Crs.Info.Type]); + Gbl.Hierarchy.Crs.CrsCod, + Inf_NamesInDBForInfoType[Gbl.Crs.Info.Type]); } /*****************************************************************************/ @@ -721,16 +721,16 @@ static void Inf_SetIHaveReadIntoDB (bool IHaveRead) " VALUES" " (%ld,%ld,'%s')", Gbl.Usrs.Me.UsrDat.UsrCod, - Gbl.Hierarchy.Crs.Crs.CrsCod, - Inf_NamesInDBForInfoType[Gbl.Hierarchy.Crs.Info.Type]); + Gbl.Hierarchy.Crs.CrsCod, + Inf_NamesInDBForInfoType[Gbl.Crs.Info.Type]); else /***** Remove I have read course information *****/ DB_QueryDELETE ("can not set that I have not read course info", "DELETE FROM crs_info_read" " WHERE UsrCod=%ld AND CrsCod=%ld AND InfoType='%s'", Gbl.Usrs.Me.UsrDat.UsrCod, - Gbl.Hierarchy.Crs.Crs.CrsCod, - Inf_NamesInDBForInfoType[Gbl.Hierarchy.Crs.Info.Type]); + Gbl.Hierarchy.Crs.CrsCod, + Inf_NamesInDBForInfoType[Gbl.Crs.Info.Type]); } /*****************************************************************************/ @@ -795,7 +795,7 @@ static bool Inf_CheckAndShowPage (void) // and host the page in a private directory !!!!!!!!!!!!!!!!! /***** Build path of directory containing web page *****/ - Inf_BuildPathPage (Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Hierarchy.Crs.Info.Type,PathRelDirHTML); + Inf_BuildPathPage (Gbl.Hierarchy.Crs.CrsCod,Gbl.Crs.Info.Type,PathRelDirHTML); /***** Open file with web page *****/ /* 1. Check if index.html exists */ @@ -806,8 +806,8 @@ static bool Inf_CheckAndShowPage (void) { snprintf (URL,sizeof (URL), "%s/%ld/%s/index.html", - Cfg_URL_CRS_PUBLIC,Gbl.Hierarchy.Crs.Crs.CrsCod, - Inf_FileNamesForInfoType[Gbl.Hierarchy.Crs.Info.Type]); + Cfg_URL_CRS_PUBLIC,Gbl.Hierarchy.Crs.CrsCod, + Inf_FileNamesForInfoType[Gbl.Crs.Info.Type]); Inf_ShowPage (URL); return true; @@ -821,8 +821,8 @@ static bool Inf_CheckAndShowPage (void) { snprintf (URL,sizeof (URL), "%s/%ld/%s/index.htm", - Cfg_URL_CRS_PUBLIC,Gbl.Hierarchy.Crs.Crs.CrsCod, - Inf_FileNamesForInfoType[Gbl.Hierarchy.Crs.Info.Type]); + Cfg_URL_CRS_PUBLIC,Gbl.Hierarchy.Crs.CrsCod, + Inf_FileNamesForInfoType[Gbl.Crs.Info.Type]); Inf_ShowPage (URL); return true; @@ -860,7 +860,7 @@ int Inf_WritePageIntoHTMLBuffer (char **HTMLBuffer) *HTMLBuffer = NULL; /***** Build path of directory containing web page *****/ - Inf_BuildPathPage (Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Hierarchy.Crs.Info.Type,PathRelDirHTML); + Inf_BuildPathPage (Gbl.Hierarchy.Crs.CrsCod,Gbl.Crs.Info.Type,PathRelDirHTML); /***** Open file with web page *****/ /* 1. Check if index.html exists */ @@ -934,12 +934,12 @@ static bool Inf_CheckURL (long CrsCod,Inf_InfoType_t InfoType) /***** Check if file with URL exists *****/ if ((FileURL = fopen (PathFile,"rb"))) { - if (fgets (Gbl.Hierarchy.Crs.Info.URL,Cns_MAX_BYTES_WWW,FileURL) == NULL) - Gbl.Hierarchy.Crs.Info.URL[0] = '\0'; + if (fgets (Gbl.Crs.Info.URL,Cns_MAX_BYTES_WWW,FileURL) == NULL) + Gbl.Crs.Info.URL[0] = '\0'; /* File is not longer needed ==> close it */ fclose (FileURL); - if (Gbl.Hierarchy.Crs.Info.URL[0]) + if (Gbl.Crs.Info.URL[0]) return true; } @@ -957,19 +957,19 @@ static bool Inf_CheckAndShowURL (void) FILE *FileURL; /***** Build path to file containing URL *****/ - Inf_BuildPathURL (Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Hierarchy.Crs.Info.Type,PathFile); + Inf_BuildPathURL (Gbl.Hierarchy.Crs.CrsCod,Gbl.Crs.Info.Type,PathFile); /***** Check if file with URL exists *****/ if ((FileURL = fopen (PathFile,"rb"))) { - if (fgets (Gbl.Hierarchy.Crs.Info.URL,Cns_MAX_BYTES_WWW,FileURL) == NULL) - Gbl.Hierarchy.Crs.Info.URL[0] = '\0'; + if (fgets (Gbl.Crs.Info.URL,Cns_MAX_BYTES_WWW,FileURL) == NULL) + Gbl.Crs.Info.URL[0] = '\0'; /* File is not longer needed ==> close it */ fclose (FileURL); - if (Gbl.Hierarchy.Crs.Info.URL[0]) + if (Gbl.Crs.Info.URL[0]) { - Inf_ShowPage (Gbl.Hierarchy.Crs.Info.URL); + Inf_ShowPage (Gbl.Crs.Info.URL); return true; } } @@ -1004,7 +1004,7 @@ void Inf_WriteURLIntoTxtBuffer (char TxtBuffer[Cns_MAX_BYTES_WWW + 1]) TxtBuffer[0] = '\0'; /***** Build path to file containing URL *****/ - Inf_BuildPathURL (Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Hierarchy.Crs.Info.Type,PathFile); + Inf_BuildPathURL (Gbl.Hierarchy.Crs.CrsCod,Gbl.Crs.Info.Type,PathFile); /***** Check if file with URL exists *****/ if ((FileURL = fopen (PathFile,"rb"))) @@ -1040,10 +1040,10 @@ static void Inf_ShowPage (const char *URL) }; /***** Start box *****/ - Box_StartBox (NULL,Txt_INFO_TITLE[Gbl.Hierarchy.Crs.Info.Type], + Box_StartBox (NULL,Txt_INFO_TITLE[Gbl.Crs.Info.Type], ICanEdit ? Inf_PutIconToEditInfo : NULL, - Help[Gbl.Hierarchy.Crs.Info.Type],Box_NOT_CLOSABLE); + Help[Gbl.Crs.Info.Type],Box_NOT_CLOSABLE); /***** Link to view in a new window *****/ fprintf (Gbl.F.Out,"", @@ -1065,7 +1065,7 @@ void Inf_SetInfoSrc (void) Inf_InfoSrc_t InfoSrcSelected = Inf_GetInfoSrcFromForm (); /***** Set info type *****/ - Gbl.Hierarchy.Crs.Info.Type = Inf_AsignInfoType (); + Gbl.Crs.Info.Type = Inf_AsignInfoType (); /***** Set info source into database *****/ Inf_SetInfoSrcIntoDB (InfoSrcSelected); @@ -1101,11 +1101,11 @@ void Inf_FormsToSelSendInfo (void) }; /***** Set info type *****/ - Gbl.Hierarchy.Crs.Info.Type = Inf_AsignInfoType (); + Gbl.Crs.Info.Type = Inf_AsignInfoType (); /***** Get current info source from database *****/ - Inf_GetAndCheckInfoSrcFromDB (Gbl.Hierarchy.Crs.Crs.CrsCod, - Gbl.Hierarchy.Crs.Info.Type, + Inf_GetAndCheckInfoSrcFromDB (Gbl.Hierarchy.Crs.CrsCod, + Gbl.Crs.Info.Type, &InfoSrcSelected,&MustBeRead); /***** Check if info available *****/ @@ -1126,7 +1126,7 @@ void Inf_FormsToSelSendInfo (void) /***** Form to choice between alternatives *****/ /* Start box and table */ Box_StartBoxTable (NULL,Txt_Source_of_information,Inf_PutIconToViewInfo, - HelpEdit[Gbl.Hierarchy.Crs.Info.Type],Box_NOT_CLOSABLE,4); + HelpEdit[Gbl.Crs.Info.Type],Box_NOT_CLOSABLE,4); /* Options */ for (InfoSrc = (Inf_InfoSrc_t) 0; @@ -1139,7 +1139,7 @@ void Inf_FormsToSelSendInfo (void) if (InfoSrc == InfoSrcSelected) fprintf (Gbl.F.Out," LIGHT_BLUE"); fprintf (Gbl.F.Out,"\">"); - Frm_StartForm (Inf_ActionsSelecInfoSrc[Gbl.Hierarchy.Crs.Info.Type]); + Frm_StartForm (Inf_ActionsSelecInfoSrc[Gbl.Crs.Info.Type]); fprintf (Gbl.F.Out,"" @@ -1298,10 +1298,10 @@ void Inf_FormToSendURL (Inf_InfoSrc_t InfoSrc) FILE *FileURL; /***** Build path to file containing URL *****/ - Inf_BuildPathURL (Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Hierarchy.Crs.Info.Type,PathFile); + Inf_BuildPathURL (Gbl.Hierarchy.Crs.CrsCod,Gbl.Crs.Info.Type,PathFile); /***** Start form *****/ - Frm_StartForm (Inf_ActionsInfo[InfoSrc][Gbl.Hierarchy.Crs.Info.Type]); + Frm_StartForm (Inf_ActionsInfo[InfoSrc][Gbl.Crs.Info.Type]); /***** Link *****/ fprintf (Gbl.F.Out,"
    " @@ -1314,11 +1314,11 @@ void Inf_FormToSendURL (Inf_InfoSrc_t InfoSrc) fprintf (Gbl.F.Out,"http://"); else { - if (fgets (Gbl.Hierarchy.Crs.Info.URL,Cns_MAX_BYTES_WWW,FileURL) == NULL) - Gbl.Hierarchy.Crs.Info.URL[0] = '\0'; + if (fgets (Gbl.Crs.Info.URL,Cns_MAX_BYTES_WWW,FileURL) == NULL) + Gbl.Crs.Info.URL[0] = '\0'; /* File is not needed now. Close it */ fclose (FileURL); - fprintf (Gbl.F.Out,"%s",Gbl.Hierarchy.Crs.Info.URL); + fprintf (Gbl.F.Out,"%s",Gbl.Crs.Info.URL); } fprintf (Gbl.F.Out,"\" />" "" @@ -1478,8 +1478,8 @@ void Inf_SetInfoSrcIntoDB (Inf_InfoSrc_t InfoSrc) if (DB_QueryCOUNT ("can not get if info source is already stored in database", "SELECT COUNT(*) FROM crs_info_src" " WHERE CrsCod=%ld AND InfoType='%s'", - Gbl.Hierarchy.Crs.Crs.CrsCod, - Inf_NamesInDBForInfoType[Gbl.Hierarchy.Crs.Info.Type])) + Gbl.Hierarchy.Crs.CrsCod, + Inf_NamesInDBForInfoType[Gbl.Crs.Info.Type])) // Info is already stored in database, so update it { // Update info source if (InfoSrc == Inf_INFO_SRC_NONE) @@ -1487,15 +1487,15 @@ void Inf_SetInfoSrcIntoDB (Inf_InfoSrc_t InfoSrc) "UPDATE crs_info_src SET InfoSrc='%s',MustBeRead='N'" " WHERE CrsCod=%ld AND InfoType='%s'", Inf_NamesInDBForInfoSrc[Inf_INFO_SRC_NONE], - Gbl.Hierarchy.Crs.Crs.CrsCod, - Inf_NamesInDBForInfoType[Gbl.Hierarchy.Crs.Info.Type]); + Gbl.Hierarchy.Crs.CrsCod, + Inf_NamesInDBForInfoType[Gbl.Crs.Info.Type]); else // MustBeRead remains unchanged DB_QueryUPDATE ("can not update info source", "UPDATE crs_info_src SET InfoSrc='%s'" " WHERE CrsCod=%ld AND InfoType='%s'", Inf_NamesInDBForInfoSrc[InfoSrc], - Gbl.Hierarchy.Crs.Crs.CrsCod, - Inf_NamesInDBForInfoType[Gbl.Hierarchy.Crs.Info.Type]); + Gbl.Hierarchy.Crs.CrsCod, + Inf_NamesInDBForInfoType[Gbl.Crs.Info.Type]); } else // Info is not stored in database, so insert it DB_QueryINSERT ("can not insert info source", @@ -1503,8 +1503,8 @@ void Inf_SetInfoSrcIntoDB (Inf_InfoSrc_t InfoSrc) " (CrsCod,InfoType,InfoSrc,MustBeRead)" " VALUES" " (%ld,'%s','%s','N')", - Gbl.Hierarchy.Crs.Crs.CrsCod, - Inf_NamesInDBForInfoType[Gbl.Hierarchy.Crs.Info.Type], + Gbl.Hierarchy.Crs.CrsCod, + Inf_NamesInDBForInfoType[Gbl.Crs.Info.Type], Inf_NamesInDBForInfoSrc[InfoSrc]); } @@ -1686,8 +1686,8 @@ static void Inf_SetInfoTxtIntoDB (const char *InfoTxtHTML,const char *InfoTxtMD) " (CrsCod,InfoType,InfoTxtHTML,InfoTxtMD)" " VALUES" " (%ld,'%s','%s','%s')", - Gbl.Hierarchy.Crs.Crs.CrsCod, - Inf_NamesInDBForInfoType[Gbl.Hierarchy.Crs.Info.Type], + Gbl.Hierarchy.Crs.CrsCod, + Inf_NamesInDBForInfoType[Gbl.Crs.Info.Type], InfoTxtHTML,InfoTxtMD); } @@ -1780,20 +1780,20 @@ static bool Inf_CheckAndShowPlainTxt (void) }; /***** Get info text from database *****/ - Inf_GetInfoTxtFromDB (Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Hierarchy.Crs.Info.Type, + Inf_GetInfoTxtFromDB (Gbl.Hierarchy.Crs.CrsCod,Gbl.Crs.Info.Type, TxtHTML,NULL); if (TxtHTML[0]) { /***** Start box *****/ - Box_StartBox (NULL,Txt_INFO_TITLE[Gbl.Hierarchy.Crs.Info.Type], + Box_StartBox (NULL,Txt_INFO_TITLE[Gbl.Crs.Info.Type], ICanEdit ? Inf_PutIconToEditInfo : NULL, - Help[Gbl.Hierarchy.Crs.Info.Type],Box_NOT_CLOSABLE); + Help[Gbl.Crs.Info.Type],Box_NOT_CLOSABLE); - if (Gbl.Hierarchy.Crs.Info.Type == Inf_INTRODUCTION || - Gbl.Hierarchy.Crs.Info.Type == Inf_TEACHING_GUIDE) - Lay_WriteHeaderClassPhoto (false,false,Gbl.Hierarchy.Ins.InsCod,Gbl.Hierarchy.Deg.DegCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + if (Gbl.Crs.Info.Type == Inf_INTRODUCTION || + Gbl.Crs.Info.Type == Inf_TEACHING_GUIDE) + Lay_WriteHeaderClassPhoto (false,false,Gbl.Hierarchy.Ins.InsCod,Gbl.Hierarchy.Deg.DegCod,Gbl.Hierarchy.Crs.CrsCod); fprintf (Gbl.F.Out,"
    "); @@ -1864,20 +1864,20 @@ static bool Inf_CheckAndShowRichTxt (void) }; /***** Get info text from database *****/ - Inf_GetInfoTxtFromDB (Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Hierarchy.Crs.Info.Type, + Inf_GetInfoTxtFromDB (Gbl.Hierarchy.Crs.CrsCod,Gbl.Crs.Info.Type, TxtHTML,TxtMD); if (TxtMD[0]) { /***** Start box *****/ - Box_StartBox (NULL,Txt_INFO_TITLE[Gbl.Hierarchy.Crs.Info.Type], + Box_StartBox (NULL,Txt_INFO_TITLE[Gbl.Crs.Info.Type], ICanEdit ? Inf_PutIconToEditInfo : NULL, - Help[Gbl.Hierarchy.Crs.Info.Type],Box_NOT_CLOSABLE); + Help[Gbl.Crs.Info.Type],Box_NOT_CLOSABLE); - if (Gbl.Hierarchy.Crs.Info.Type == Inf_INTRODUCTION || - Gbl.Hierarchy.Crs.Info.Type == Inf_TEACHING_GUIDE) - Lay_WriteHeaderClassPhoto (false,false,Gbl.Hierarchy.Ins.InsCod,Gbl.Hierarchy.Deg.DegCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + if (Gbl.Crs.Info.Type == Inf_INTRODUCTION || + Gbl.Crs.Info.Type == Inf_TEACHING_GUIDE) + Lay_WriteHeaderClassPhoto (false,false,Gbl.Hierarchy.Ins.InsCod,Gbl.Hierarchy.Deg.DegCod,Gbl.Hierarchy.Crs.CrsCod); fprintf (Gbl.F.Out,"
    "); @@ -1969,7 +1969,7 @@ int Inf_WritePlainTextIntoHTMLBuffer (char **HTMLBuffer) *HTMLBuffer = NULL; /***** Get info text from database *****/ - Inf_GetInfoTxtFromDB (Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Hierarchy.Crs.Info.Type, + Inf_GetInfoTxtFromDB (Gbl.Hierarchy.Crs.CrsCod,Gbl.Crs.Info.Type, TxtHTML,NULL); if (TxtHTML[0]) @@ -1986,7 +1986,7 @@ int Inf_WritePlainTextIntoHTMLBuffer (char **HTMLBuffer) "Can not create temporary file"); /***** Write start of HTML code *****/ - Lay_StartHTMLFile (FileHTMLTmp,Txt_INFO_TITLE[Gbl.Hierarchy.Crs.Info.Type]); + Lay_StartHTMLFile (FileHTMLTmp,Txt_INFO_TITLE[Gbl.Crs.Info.Type]); fprintf (FileHTMLTmp,"\n" "
    \n"); @@ -2059,19 +2059,19 @@ void Inf_EditPlainTxtInfo (void) }; /***** Set info type *****/ - Gbl.Hierarchy.Crs.Info.Type = Inf_AsignInfoType (); + Gbl.Crs.Info.Type = Inf_AsignInfoType (); /***** Start form and box *****/ - Frm_StartForm (Inf_ActionsRcvPlaTxtInfo[Gbl.Hierarchy.Crs.Info.Type]); - Box_StartBox (NULL,Txt_INFO_TITLE[Gbl.Hierarchy.Crs.Info.Type],NULL, - HelpEdit[Gbl.Hierarchy.Crs.Info.Type],Box_NOT_CLOSABLE); + Frm_StartForm (Inf_ActionsRcvPlaTxtInfo[Gbl.Crs.Info.Type]); + Box_StartBox (NULL,Txt_INFO_TITLE[Gbl.Crs.Info.Type],NULL, + HelpEdit[Gbl.Crs.Info.Type],Box_NOT_CLOSABLE); - if (Gbl.Hierarchy.Crs.Info.Type == Inf_INTRODUCTION || - Gbl.Hierarchy.Crs.Info.Type == Inf_TEACHING_GUIDE) - Lay_WriteHeaderClassPhoto (false,false,Gbl.Hierarchy.Ins.InsCod,Gbl.Hierarchy.Deg.DegCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + if (Gbl.Crs.Info.Type == Inf_INTRODUCTION || + Gbl.Crs.Info.Type == Inf_TEACHING_GUIDE) + Lay_WriteHeaderClassPhoto (false,false,Gbl.Hierarchy.Ins.InsCod,Gbl.Hierarchy.Deg.DegCod,Gbl.Hierarchy.Crs.CrsCod); /***** Get info text from database *****/ - Inf_GetInfoTxtFromDB (Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Hierarchy.Crs.Info.Type, + Inf_GetInfoTxtFromDB (Gbl.Hierarchy.Crs.CrsCod,Gbl.Crs.Info.Type, TxtHTML,NULL); /***** Edition area *****/ @@ -2110,19 +2110,19 @@ void Inf_EditRichTxtInfo (void) }; /***** Set info type *****/ - Gbl.Hierarchy.Crs.Info.Type = Inf_AsignInfoType (); + Gbl.Crs.Info.Type = Inf_AsignInfoType (); /***** Start form and box *****/ - Frm_StartForm (Inf_ActionsRcvRchTxtInfo[Gbl.Hierarchy.Crs.Info.Type]); - Box_StartBox (NULL,Txt_INFO_TITLE[Gbl.Hierarchy.Crs.Info.Type],NULL, - HelpEdit[Gbl.Hierarchy.Crs.Info.Type],Box_NOT_CLOSABLE); + Frm_StartForm (Inf_ActionsRcvRchTxtInfo[Gbl.Crs.Info.Type]); + Box_StartBox (NULL,Txt_INFO_TITLE[Gbl.Crs.Info.Type],NULL, + HelpEdit[Gbl.Crs.Info.Type],Box_NOT_CLOSABLE); - if (Gbl.Hierarchy.Crs.Info.Type == Inf_INTRODUCTION || - Gbl.Hierarchy.Crs.Info.Type == Inf_TEACHING_GUIDE) - Lay_WriteHeaderClassPhoto (false,false,Gbl.Hierarchy.Ins.InsCod,Gbl.Hierarchy.Deg.DegCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + if (Gbl.Crs.Info.Type == Inf_INTRODUCTION || + Gbl.Crs.Info.Type == Inf_TEACHING_GUIDE) + Lay_WriteHeaderClassPhoto (false,false,Gbl.Hierarchy.Ins.InsCod,Gbl.Hierarchy.Deg.DegCod,Gbl.Hierarchy.Crs.CrsCod); /***** Get info text from database *****/ - Inf_GetInfoTxtFromDB (Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Hierarchy.Crs.Info.Type, + Inf_GetInfoTxtFromDB (Gbl.Hierarchy.Crs.CrsCod,Gbl.Crs.Info.Type, TxtHTML,NULL); /***** Edition area *****/ @@ -2149,7 +2149,7 @@ void Inf_RecAndChangePlainTxtInfo (void) char Txt_MarkdownFormat[Cns_MAX_BYTES_LONG_TEXT + 1]; /***** Set info type *****/ - Gbl.Hierarchy.Crs.Info.Type = Inf_AsignInfoType (); + Gbl.Crs.Info.Type = Inf_AsignInfoType (); /***** Get text with course information from form *****/ Par_GetParameter (Par_PARAM_SINGLE,"Txt",Txt_HTMLFormat, @@ -2185,7 +2185,7 @@ void Inf_RecAndChangeRichTxtInfo (void) char Txt_MarkdownFormat[Cns_MAX_BYTES_LONG_TEXT + 1]; /***** Set info type *****/ - Gbl.Hierarchy.Crs.Info.Type = Inf_AsignInfoType (); + Gbl.Crs.Info.Type = Inf_AsignInfoType (); /***** Get text with course information from form *****/ Par_GetParameter (Par_PARAM_SINGLE,"Txt",Txt_HTMLFormat, @@ -2223,26 +2223,26 @@ void Inf_ReceiveURLInfo (void) bool URLIsOK = false; /***** Set info type *****/ - Gbl.Hierarchy.Crs.Info.Type = Inf_AsignInfoType (); + Gbl.Crs.Info.Type = Inf_AsignInfoType (); /***** Get parameter with URL *****/ - Par_GetParToText ("InfoSrcURL",Gbl.Hierarchy.Crs.Info.URL,Cns_MAX_BYTES_WWW); + Par_GetParToText ("InfoSrcURL",Gbl.Crs.Info.URL,Cns_MAX_BYTES_WWW); /***** Build path to file containing URL *****/ - Inf_BuildPathURL (Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Hierarchy.Crs.Info.Type,PathFile); + Inf_BuildPathURL (Gbl.Hierarchy.Crs.CrsCod,Gbl.Crs.Info.Type,PathFile); /***** Open file with URL *****/ if ((FileURL = fopen (PathFile,"wb")) != NULL) { /***** Write URL *****/ - fprintf (FileURL,"%s",Gbl.Hierarchy.Crs.Info.URL); + fprintf (FileURL,"%s",Gbl.Crs.Info.URL); /***** Close file *****/ fclose (FileURL); /***** Write message *****/ Ale_ShowAlert (Ale_SUCCESS,Txt_The_URL_X_has_been_updated, - Gbl.Hierarchy.Crs.Info.URL); + Gbl.Crs.Info.URL); URLIsOK = true; } else @@ -2291,7 +2291,7 @@ void Inf_ReceivePagInfo (void) bool FileIsOK = false; /***** Set info type *****/ - Gbl.Hierarchy.Crs.Info.Type = Inf_AsignInfoType (); + Gbl.Crs.Info.Type = Inf_AsignInfoType (); /***** First of all, store in disk the file from stdin (really from Gbl.F.Tmp) *****/ Param = Fil_StartReceptionOfFile (Fil_NAME_OF_PARAM_FILENAME_ORG, @@ -2313,7 +2313,7 @@ void Inf_ReceivePagInfo (void) else { /***** Build path of directory containing web page *****/ - Inf_BuildPathPage (Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Hierarchy.Crs.Info.Type,PathRelDirHTML); + Inf_BuildPathPage (Gbl.Hierarchy.Crs.CrsCod,Gbl.Crs.Info.Type,PathRelDirHTML); /***** End the reception of the data *****/ if (Str_FileIs (SourceFileName,"html") || @@ -2338,8 +2338,8 @@ void Inf_ReceivePagInfo (void) Fil_CreateDirIfNotExists (PathRelDirHTML); snprintf (PathRelFileZIP,sizeof (PathRelFileZIP), "%s/%s.zip", - Gbl.Hierarchy.Crs.PathPriv, - Inf_FileNamesForInfoType[Gbl.Hierarchy.Crs.Info.Type]); + Gbl.Crs.PathPriv, + Inf_FileNamesForInfoType[Gbl.Crs.Info.Type]); if (Fil_EndReceptionOfFile (PathRelFileZIP,Param)) { diff --git a/swad_institution.c b/swad_institution.c index 552b666f..0be98950 100644 --- a/swad_institution.c +++ b/swad_institution.c @@ -372,13 +372,13 @@ static void Ins_Configuration (bool PrintView) " onchange=\"document.getElementById('%s').submit();\">", Gbl.Form.Id); for (NumCty = 0; - NumCty < Gbl.Ctys.Num; + NumCty < Gbl.Hierarchy.Sys.Ctys.Num; NumCty++) fprintf (Gbl.F.Out,"", - Gbl.Ctys.Lst[NumCty].CtyCod, - Gbl.Ctys.Lst[NumCty].CtyCod == Gbl.Hierarchy.Cty.CtyCod ? " selected=\"selected\"" : + Gbl.Hierarchy.Sys.Ctys.Lst[NumCty].CtyCod, + Gbl.Hierarchy.Sys.Ctys.Lst[NumCty].CtyCod == Gbl.Hierarchy.Cty.CtyCod ? " selected=\"selected\"" : "", - Gbl.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]); + Gbl.Hierarchy.Sys.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]); fprintf (Gbl.F.Out,""); Frm_EndForm (); @@ -695,7 +695,7 @@ static void Ins_ListInstitutions (void) Box_StartBox (NULL,Gbl.Title,Ins_PutIconsListingInstitutions, Hlp_COUNTRY_Institutions,Box_NOT_CLOSABLE); - if (Gbl.Inss.Num) // There are institutions in the current country + if (Gbl.Hierarchy.Cty.Inss.Num) // There are institutions in the current country { /***** Start table *****/ Tbl_StartTableWideMargin (2); @@ -703,9 +703,9 @@ static void Ins_ListInstitutions (void) /***** Write all the institutions and their nuber of users *****/ for (NumIns = 0; - NumIns < Gbl.Inss.Num; + NumIns < Gbl.Hierarchy.Cty.Inss.Num; NumIns++) - Ins_ListOneInstitutionForSeeing (&(Gbl.Inss.Lst[NumIns]),NumIns + 1); + Ins_ListOneInstitutionForSeeing (&(Gbl.Hierarchy.Cty.Inss.Lst[NumIns]),NumIns + 1); /***** End table *****/ Tbl_EndTable (); @@ -717,7 +717,7 @@ static void Ins_ListInstitutions (void) if (Ins_CheckIfICanCreateInstitutions ()) { Frm_StartForm (ActEdiIns); - Btn_PutConfirmButton (Gbl.Inss.Num ? Txt_Create_another_institution : + Btn_PutConfirmButton (Gbl.Hierarchy.Cty.Inss.Num ? Txt_Create_another_institution : Txt_Create_institution); Frm_EndForm (); } @@ -808,7 +808,7 @@ static void Ins_ListOneInstitutionForSeeing (struct Instit *Ins,unsigned NumIns) fprintf (Gbl.F.Out,"" "%u" "", - TxtClassNormal,BgColor,Ins->NumCtrs); + TxtClassNormal,BgColor,Ins->Ctrs.Num); /* Number of degrees in this institution */ fprintf (Gbl.F.Out,"" @@ -875,13 +875,13 @@ static void Ins_PutHeadInstitutionsForSeeing (bool OrderSelectable) Frm_StartForm (ActSeeIns); Par_PutHiddenParamUnsigned ("Order",(unsigned) Order); Frm_LinkFormSubmit (Txt_INSTITUTIONS_HELP_ORDER[Order],"TIT_TBL",NULL); - if (Order == Gbl.Inss.SelectedOrder) + if (Order == Gbl.Hierarchy.Cty.Inss.SelectedOrder) fprintf (Gbl.F.Out,""); } fprintf (Gbl.F.Out,"%s",Txt_INSTITUTIONS_ORDER[Order]); if (OrderSelectable) { - if (Order == Gbl.Inss.SelectedOrder) + if (Order == Gbl.Hierarchy.Cty.Inss.SelectedOrder) fprintf (Gbl.F.Out,""); fprintf (Gbl.F.Out,""); Frm_EndForm (); @@ -920,7 +920,7 @@ static void Ins_PutHeadInstitutionsForSeeing (bool OrderSelectable) static void Ins_GetParamInsOrder (void) { - Gbl.Inss.SelectedOrder = (Ins_Order_t) + Gbl.Hierarchy.Cty.Inss.SelectedOrder = (Ins_Order_t) Par_GetParToUnsignedLong ("Order", 0, Ins_NUM_ORDERS - 1, @@ -953,7 +953,7 @@ void Ins_EditInstitutions (void) Ins_PutFormToCreateInstitution (); /***** Forms to edit current institutions *****/ - if (Gbl.Inss.Num) + if (Gbl.Hierarchy.Cty.Inss.Num) Ins_ListInstitutionsForEdition (); /***** End box *****/ @@ -1037,25 +1037,25 @@ void Ins_GetListInstitutions (long CtyCod,Ins_GetExtraData_t GetExtraData) " (SELECT DISTINCT InsCod FROM usr_data))" " ORDER BY %s", CtyCod,CtyCod, - OrderBySubQuery[Gbl.Inss.SelectedOrder]); + OrderBySubQuery[Gbl.Hierarchy.Cty.Inss.SelectedOrder]); break; } if (NumRows) // Institutions found... { // NumRows should be equal to Deg->NumCourses - Gbl.Inss.Num = (unsigned) NumRows; + Gbl.Hierarchy.Cty.Inss.Num = (unsigned) NumRows; /***** Create list with institutions *****/ - if ((Gbl.Inss.Lst = (struct Instit *) calloc (NumRows,sizeof (struct Instit))) == NULL) + if ((Gbl.Hierarchy.Cty.Inss.Lst = (struct Instit *) calloc (NumRows,sizeof (struct Instit))) == NULL) Lay_NotEnoughMemoryExit (); /***** Get the institutions *****/ for (NumIns = 0; - NumIns < Gbl.Inss.Num; + NumIns < Gbl.Hierarchy.Cty.Inss.Num; NumIns++) { - Ins = &(Gbl.Inss.Lst[NumIns]); + Ins = &(Gbl.Hierarchy.Cty.Inss.Lst[NumIns]); /* Get next institution */ row = mysql_fetch_row (mysql_res); @@ -1091,7 +1091,7 @@ void Ins_GetListInstitutions (long CtyCod,Ins_GetExtraData_t GetExtraData) { case Ins_GET_BASIC_DATA: Ins->NumUsrsWhoClaimToBelongToIns = 0; - Ins->NumCtrs = Ins->NumDegs = Ins->NumCrss = Ins->NumDpts = 0; + Ins->Ctrs.Num = Ins->NumDegs = Ins->NumCrss = Ins->NumDpts = 0; Ins->NumUsrs = 0; break; case Ins_GET_EXTRA_DATA: @@ -1100,7 +1100,7 @@ void Ins_GetListInstitutions (long CtyCod,Ins_GetExtraData_t GetExtraData) Ins->NumUsrsWhoClaimToBelongToIns = 0; /* Get number of centres in this institution */ - Ins->NumCtrs = Ctr_GetNumCtrsInIns (Ins->InsCod); + Ins->Ctrs.Num = Ctr_GetNumCtrsInIns (Ins->InsCod); /* Get number of degrees in this institution */ Ins->NumDegs = Deg_GetNumDegsInIns (Ins->InsCod); @@ -1118,7 +1118,7 @@ void Ins_GetListInstitutions (long CtyCod,Ins_GetExtraData_t GetExtraData) } } else - Gbl.Inss.Num = 0; + Gbl.Hierarchy.Cty.Inss.Num = 0; /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); @@ -1161,7 +1161,7 @@ bool Ins_GetDataOfInstitutionByCod (struct Instit *Ins, Ins->FullName[0] = Ins->WWW[0] = '\0'; Ins->NumUsrsWhoClaimToBelongToIns = 0; - Ins->NumCtrs = Ins->NumDegs = Ins->NumCrss = Ins->NumDpts = 0; + Ins->Ctrs.Num = Ins->NumDegs = Ins->NumCrss = Ins->NumDpts = 0; Ins->NumUsrs = 0; /***** Check if institution code is correct *****/ @@ -1202,7 +1202,7 @@ bool Ins_GetDataOfInstitutionByCod (struct Instit *Ins, if (GetExtraData == Ins_GET_EXTRA_DATA) { /* Get number of centres in this institution */ - Ins->NumCtrs = Ctr_GetNumCtrsInIns (Ins->InsCod); + Ins->Ctrs.Num = Ctr_GetNumCtrsInIns (Ins->InsCod); /* Get number of departments in this institution */ Ins->NumDpts = Dpt_GetNumDptsInIns (Ins->InsCod); @@ -1359,12 +1359,12 @@ static void Ins_GetShrtNameAndCtyOfInstitution (struct Instit *Ins, void Ins_FreeListInstitutions (void) { - if (Gbl.Inss.Lst) + if (Gbl.Hierarchy.Cty.Inss.Lst) { /***** Free memory used by the list of institutions *****/ - free ((void *) Gbl.Inss.Lst); - Gbl.Inss.Lst = NULL; - Gbl.Inss.Num = 0; + free ((void *) Gbl.Hierarchy.Cty.Inss.Lst); + Gbl.Hierarchy.Cty.Inss.Lst = NULL; + Gbl.Hierarchy.Cty.Inss.Num = 0; } } @@ -1457,17 +1457,17 @@ static void Ins_ListInstitutionsForEdition (void) /***** Write all the institutions *****/ for (NumIns = 0; - NumIns < Gbl.Inss.Num; + NumIns < Gbl.Hierarchy.Cty.Inss.Num; NumIns++) { - Ins = &Gbl.Inss.Lst[NumIns]; + Ins = &Gbl.Hierarchy.Cty.Inss.Lst[NumIns]; ICanEdit = Ins_CheckIfICanEdit (Ins); /* Put icon to remove institution */ fprintf (Gbl.F.Out,"" ""); - if (Ins->NumCtrs || + if (Ins->Ctrs.Num || Ins->NumUsrsWhoClaimToBelongToIns || Ins->NumUsrs || // Institution has centres or users ==> deletion forbidden !ICanEdit) @@ -1571,7 +1571,7 @@ static void Ins_ListInstitutionsForEdition (void) fprintf (Gbl.F.Out,"" "%u" "", - Ins->NumCtrs); + Ins->Ctrs.Num); /* Number of users in courses of this institution */ fprintf (Gbl.F.Out,"" @@ -1731,7 +1731,7 @@ void Ins_RemoveInstitution (void) /***** Check if this institution has users *****/ if (!Ins_CheckIfICanEdit (&Ins)) Lay_NoPermissionExit (); - else if (Ins.NumCtrs || + else if (Ins.Ctrs.Num || Ins.NumUsrsWhoClaimToBelongToIns || Ins.NumUsrs) // Institution has centres or users ==> don't remove Ale_ShowAlert (Ale_WARNING,Txt_To_remove_an_institution_you_must_first_remove_all_centres_and_users_in_the_institution); diff --git a/swad_institution.h b/swad_institution.h index 50307e3d..c2dd46f2 100644 --- a/swad_institution.h +++ b/swad_institution.h @@ -27,6 +27,7 @@ /********************************** Headers **********************************/ /*****************************************************************************/ +#include "swad_centre.h" #include "swad_constant.h" #include "swad_role_type.h" @@ -64,12 +65,17 @@ struct Instit char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1]; char FullName[Hie_MAX_BYTES_FULL_NAME + 1]; char WWW[Cns_MAX_BYTES_WWW + 1]; - unsigned NumUsrsWhoClaimToBelongToIns; - unsigned NumCtrs; + struct + { + unsigned Num; // Number of centres + struct Centre *Lst; // List of centres + Ctr_Order_t SelectedOrder; + } Ctrs; unsigned NumDegs; unsigned NumCrss; unsigned NumDpts; unsigned NumUsrs; // Number of users in courses of this institution + unsigned NumUsrsWhoClaimToBelongToIns; }; #define Ins_NUM_ORDERS 2 diff --git a/swad_layout.c b/swad_layout.c index e70f50ca..61fe789d 100644 --- a/swad_layout.c +++ b/swad_layout.c @@ -332,7 +332,7 @@ void Lay_WriteStartOfPage (void) fprintf (Gbl.F.Out,"
    "); /* If it is mandatory to read any information about course */ - if (Gbl.Hierarchy.Crs.Info.ShowMsgMustBeRead) + if (Gbl.Crs.Info.ShowMsgMustBeRead) Inf_WriteMsgYouMustReadInfo (); /* Write title of the current action */ @@ -412,7 +412,7 @@ static void Lay_WritePageTitle (void) Gbl.Hierarchy.Deg.ShrtName); if (Gbl.Hierarchy.Level == Hie_CRS) fprintf (Gbl.F.Out," > %s", - Gbl.Hierarchy.Crs.Crs.ShrtName); + Gbl.Hierarchy.Crs.ShrtName); } else fprintf (Gbl.F.Out,"%s: %s", @@ -519,7 +519,7 @@ static void Lay_WriteScripts (void) fprintf (Gbl.F.Out,"];\n"); fprintf (Gbl.F.Out," var STR_EXAM = '"); - fprintf (Gbl.F.Out,Txt_Exam_of_X,Gbl.Hierarchy.Crs.Crs.FullName); + fprintf (Gbl.F.Out,Txt_Exam_of_X,Gbl.Hierarchy.Crs.FullName); fprintf (Gbl.F.Out,"';\n"); fprintf (Gbl.F.Out," var Hlds = [];\n"); @@ -775,7 +775,7 @@ static void Lay_WriteScriptParamsAJAX (void) "var RefreshParamCrsCod = \"crs=%ld\";\n" "\n", Gbl.Session.Id, - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); } /*****************************************************************************/ diff --git a/swad_mail.c b/swad_mail.c index 2ae1713a..b996609d 100644 --- a/swad_mail.c +++ b/swad_mail.c @@ -916,7 +916,7 @@ void Mai_ListEmails (void) Str_Concat (StrAddresses,UsrDat.Email, Mai_MAX_BYTES_STR_ADDR); fprintf (Gbl.F.Out,"%s", - UsrDat.Email,Gbl.Hierarchy.Crs.Crs.FullName,UsrDat.Email); + UsrDat.Email,Gbl.Hierarchy.Crs.FullName,UsrDat.Email); NumAcceptedStdsWithEmail++; } @@ -950,7 +950,7 @@ void Mai_ListEmails (void) "", Gbl.Usrs.Me.UsrDat.Email, - Gbl.Hierarchy.Crs.Crs.FullName, + Gbl.Hierarchy.Crs.FullName, Gbl.Usrs.Me.UsrDat.Email, StrAddresses, Txt_Create_email_message, diff --git a/swad_mark.c b/swad_mark.c index c7aceab5..fcec8d43 100644 --- a/swad_mark.c +++ b/swad_mark.c @@ -128,10 +128,10 @@ void Mrk_GetAndWriteNumRowsHeaderAndFooter (Brw_FileType_t FileType, fprintf (Gbl.F.Out,"", The_ClassFormInBoxNoWrap[Gbl.Prefs.Theme], Gbl.RowEvenOdd); - if (Gbl.Hierarchy.Crs.Grps.GrpCod > 0) // Group zone + if (Gbl.Crs.Grps.GrpCod > 0) // Group zone { Frm_StartForm (ActChgNumRowHeaGrp); - Grp_PutParamGrpCod (Gbl.Hierarchy.Crs.Grps.GrpCod); + Grp_PutParamGrpCod (Gbl.Crs.Grps.GrpCod); } else // Course zone Frm_StartForm (ActChgNumRowHeaCrs); @@ -155,10 +155,10 @@ void Mrk_GetAndWriteNumRowsHeaderAndFooter (Brw_FileType_t FileType, fprintf (Gbl.F.Out,"", The_ClassFormInBoxNoWrap[Gbl.Prefs.Theme], Gbl.RowEvenOdd); - if (Gbl.Hierarchy.Crs.Grps.GrpCod > 0) // Group zone + if (Gbl.Crs.Grps.GrpCod > 0) // Group zone { Frm_StartForm (ActChgNumRowFooGrp); - Grp_PutParamGrpCod (Gbl.Hierarchy.Crs.Grps.GrpCod); + Grp_PutParamGrpCod (Gbl.Crs.Grps.GrpCod); } else // Course zone Frm_StartForm (ActChgNumRowFooCrs); @@ -631,11 +631,11 @@ void Mrk_ShowMyMarks (void) else // If I am logged as non-editing teacher, teacher or admin { /* Select a random student from the course */ - if (Gbl.Hierarchy.Crs.Grps.GrpCod > 0) // Group zone + if (Gbl.Crs.Grps.GrpCod > 0) // Group zone { - if (Grp_CountNumUsrsInGrp (Rol_STD,Gbl.Hierarchy.Crs.Grps.GrpCod)) + if (Grp_CountNumUsrsInGrp (Rol_STD,Gbl.Crs.Grps.GrpCod)) { - Gbl.Usrs.Other.UsrDat.UsrCod = Usr_GetRamdomStdFromGrp (Gbl.Hierarchy.Crs.Grps.GrpCod); + Gbl.Usrs.Other.UsrDat.UsrCod = Usr_GetRamdomStdFromGrp (Gbl.Crs.Grps.GrpCod); UsrDat = &Gbl.Usrs.Other.UsrDat; } else @@ -643,9 +643,9 @@ void Mrk_ShowMyMarks (void) } else // Course zone { - if (Gbl.Hierarchy.Crs.Crs.NumUsrs[Rol_STD]) // If there are students in this course + if (Gbl.Hierarchy.Crs.NumUsrs[Rol_STD]) // If there are students in this course { - Gbl.Usrs.Other.UsrDat.UsrCod = Usr_GetRamdomStdFromCrs (Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Usrs.Other.UsrDat.UsrCod = Usr_GetRamdomStdFromCrs (Gbl.Hierarchy.Crs.CrsCod); UsrDat = &Gbl.Usrs.Other.UsrDat; } else diff --git a/swad_message.c b/swad_message.c index ab26f465..d27e5fb6 100644 --- a/swad_message.c +++ b/swad_message.c @@ -1300,7 +1300,7 @@ static long Msg_InsertNewMsg (const char *Subject,const char *Content, " VALUES" " (%ld,%ld,%ld,'N',NOW())", MsgCod, - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod); /***** Increment number of messages sent by me *****/ @@ -2138,7 +2138,7 @@ unsigned Msg_GetNumMsgsSent (Hie_Level_t Scope,Msg_Status_t MsgStatus) " FROM %s" " WHERE CrsCod=%ld", Table, - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); break; default: Lay_WrongScopeExit (); @@ -2238,7 +2238,7 @@ unsigned Msg_GetNumMsgsReceived (Hie_Level_t Scope,Msg_Status_t MsgStatus) " WHERE msg_snt.CrsCod=%ld" " AND msg_snt.MsgCod=%s.MsgCod", Table, - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Table); break; default: @@ -2374,8 +2374,8 @@ unsigned Msg_GetNumMsgsReceived (Hie_Level_t Scope,Msg_Status_t MsgStatus) " WHERE msg_snt.CrsCod=%ld" " AND msg_snt.MsgCod=msg_rcv_deleted.MsgCod" " AND msg_rcv_deleted.Notified='Y')", - Gbl.Hierarchy.Crs.Crs.CrsCod, - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod); break; default: Lay_WrongScopeExit (); @@ -3244,7 +3244,7 @@ bool Msg_WriteCrsOrgMsg (long CrsCod) if (Crs_GetDataOfCourseByCod (&Crs)) { ThereIsOrgCrs = true; - if ((FromThisCrs = (CrsCod == Gbl.Hierarchy.Crs.Crs.CrsCod))) // Message sent from current course + if ((FromThisCrs = (CrsCod == Gbl.Hierarchy.Crs.CrsCod))) // Message sent from current course fprintf (Gbl.F.Out,"
    " "(%s)" "
    ", diff --git a/swad_network.c b/swad_network.c index cfecb565..36239a6f 100644 --- a/swad_network.c +++ b/swad_network.c @@ -543,7 +543,7 @@ void Net_ShowWebAndSocialNetworksStats (void) " AND crs_usr.UsrCod=usr_webs.UsrCod" " GROUP BY usr_webs.Web" " ORDER BY N DESC,usr_webs.Web", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); break; default: Lay_WrongScopeExit (); diff --git a/swad_notice.c b/swad_notice.c index 693bb1c5..e1afe2d0 100644 --- a/swad_notice.c +++ b/swad_notice.c @@ -102,7 +102,7 @@ void Not_ShowFormNotice (void) /***** Help message *****/ Ale_ShowAlert (Ale_INFO,Txt_The_notice_will_appear_as_a_yellow_note_, - Gbl.Hierarchy.Crs.Crs.FullName); + Gbl.Hierarchy.Crs.FullName); /***** Start form *****/ Frm_StartForm (ActRcvNot); @@ -147,7 +147,7 @@ void Not_ReceiveNotice (void) NotCod = Not_InsertNoticeInDB (Content); /***** Update RSS of current course *****/ - RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs.Crs); + RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs); /***** Write message of success *****/ Ale_ShowAlert (Ale_SUCCESS,Txt_Notice_created); @@ -160,7 +160,7 @@ void Not_ReceiveNotice (void) TL_StoreAndPublishNote (TL_NOTE_NOTICE,NotCod,&SocPub); /***** Set notice to be highlighted *****/ - Gbl.Hierarchy.Crs.Notices.HighlightNotCod = NotCod; + Gbl.Crs.Notices.HighlightNotCod = NotCod; } /*****************************************************************************/ @@ -177,7 +177,7 @@ static long Not_InsertNoticeInDB (const char *Content) " (CrsCod,UsrCod,CreatTime,Content,Status)" " VALUES" " (%ld,%ld,NOW(),'%s',%u)", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod, Content,(unsigned) Not_ACTIVE_NOTICE); } @@ -217,7 +217,7 @@ void Not_ListFullNotices (void) { /***** Show all notices *****/ Not_ShowNotices (Not_LIST_FULL_NOTICES, - Gbl.Hierarchy.Crs.Notices.HighlightNotCod); // Highlight notice + Gbl.Crs.Notices.HighlightNotCod); // Highlight notice } /*****************************************************************************/ @@ -227,7 +227,7 @@ void Not_ListFullNotices (void) void Not_GetHighLightedNotCod (void) { /***** Get notice to be highlighted *****/ - Gbl.Hierarchy.Crs.Notices.HighlightNotCod = Not_GetParamNotCod (); + Gbl.Crs.Notices.HighlightNotCod = Not_GetParamNotCod (); } /*****************************************************************************/ @@ -246,13 +246,13 @@ void Not_HideActiveNotice (void) "UPDATE notices SET Status=%u" " WHERE NotCod=%ld AND CrsCod=%ld", (unsigned) Not_OBSOLETE_NOTICE, - NotCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + NotCod,Gbl.Hierarchy.Crs.CrsCod); /***** Update RSS of current course *****/ - RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs.Crs); + RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs); /***** Set notice to be highlighted *****/ - Gbl.Hierarchy.Crs.Notices.HighlightNotCod = NotCod; + Gbl.Crs.Notices.HighlightNotCod = NotCod; } /*****************************************************************************/ @@ -271,13 +271,13 @@ void Not_RevealHiddenNotice (void) "UPDATE notices SET Status=%u" " WHERE NotCod=%ld AND CrsCod=%ld", (unsigned) Not_ACTIVE_NOTICE, - NotCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + NotCod,Gbl.Hierarchy.Crs.CrsCod); /***** Update RSS of current course *****/ - RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs.Crs); + RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs); /***** Set notice to be highlighted *****/ - Gbl.Hierarchy.Crs.Notices.HighlightNotCod = NotCod; + Gbl.Crs.Notices.HighlightNotCod = NotCod; } /*****************************************************************************/ @@ -329,13 +329,13 @@ void Not_RemoveNotice (void) " SELECT NotCod,CrsCod,UsrCod,CreatTime,Content,NumNotif" " FROM notices" " WHERE NotCod=%ld AND CrsCod=%ld", - NotCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + NotCod,Gbl.Hierarchy.Crs.CrsCod); /* Remove notice */ DB_QueryDELETE ("can not remove notice", "DELETE FROM notices" " WHERE NotCod=%ld AND CrsCod=%ld", - NotCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + NotCod,Gbl.Hierarchy.Crs.CrsCod); /***** Mark possible notifications as removed *****/ Ntf_MarkNotifAsRemoved (Ntf_EVENT_NOTICE,NotCod); @@ -344,7 +344,7 @@ void Not_RemoveNotice (void) TL_MarkNoteAsUnavailableUsingNoteTypeAndCod (TL_NOTE_NOTICE,NotCod); /***** Update RSS of current course *****/ - RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs.Crs); + RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs); } /*****************************************************************************/ @@ -386,7 +386,7 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing,long HighlightNotCod) " FROM notices" " WHERE CrsCod=%ld AND Status=%u" " ORDER BY CreatTime DESC", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, (unsigned) Not_ACTIVE_NOTICE); break; case Not_LIST_FULL_NOTICES: @@ -399,7 +399,7 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing,long HighlightNotCod) " FROM notices" " WHERE CrsCod=%ld" " ORDER BY CreatTime DESC", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); break; } @@ -463,14 +463,14 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing,long HighlightNotCod) snprintf (PathRelRSSFile,sizeof (PathRelRSSFile), "%s/%ld/%s/%s", Cfg_PATH_CRS_PUBLIC, - Gbl.Hierarchy.Crs.Crs.CrsCod,Cfg_RSS_FOLDER,Cfg_RSS_FILE); + Gbl.Hierarchy.Crs.CrsCod,Cfg_RSS_FOLDER,Cfg_RSS_FILE); if (!Fil_CheckIfPathExists (PathRelRSSFile)) - RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs.Crs); + RSS_UpdateRSSFileForACrs (&Gbl.Hierarchy.Crs); /* Put a link to the RSS file */ fprintf (Gbl.F.Out,"
    " "" "\"RSS\" 0) // Course specified { - if (CrsCod != Gbl.Hierarchy.Crs.Crs.CrsCod) // Not the current course + if (CrsCod != Gbl.Hierarchy.Crs.CrsCod) // Not the current course Crs_PutParamCrsCod (CrsCod); // Go to another course } else if (DegCod > 0) // Degree specified @@ -942,7 +942,7 @@ void Ntf_MarkNotifAsSeen (Ntf_NotifyEvent_t NotifyEvent,long Cod,long CrsCod,lon "UPDATE notif SET Status=(Status | %u)" " WHERE ToUsrCod=%ld AND NotifyEvent=%u AND CrsCod=%ld", (unsigned) Ntf_STATUS_BIT_READ, - ToUsrCod,(unsigned) NotifyEvent,Gbl.Hierarchy.Crs.Crs.CrsCod); + ToUsrCod,(unsigned) NotifyEvent,Gbl.Hierarchy.Crs.CrsCod); else // Set all notifications of this type // for the user as seen DB_QueryUPDATE ("can not set notification(s) as seen", @@ -988,7 +988,7 @@ void Ntf_MarkNotifToOneUsrAsRemoved (Ntf_NotifyEvent_t NotifyEvent,long Cod,long " WHERE ToUsrCod=%ld AND NotifyEvent=%u AND CrsCod=%ld", (unsigned) Ntf_STATUS_BIT_REMOVED, ToUsrCod,(unsigned) NotifyEvent, - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); } /*****************************************************************************/ @@ -1195,7 +1195,7 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod) "SELECT UsrCod FROM crs_usr" " WHERE CrsCod=%ld" " AND UsrCod<>%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod); break; case Brw_ADMI_TCH_CRS: // Notify all teachers in course except me @@ -1205,7 +1205,7 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod) " WHERE CrsCod=%ld" " AND UsrCod<>%ld" " AND Role=%u", // Notify teachers only - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod, (unsigned) Rol_TCH); break; @@ -1217,7 +1217,7 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod) "SELECT UsrCod FROM crs_grp_usr" " WHERE crs_grp_usr.GrpCod=%ld" " AND crs_grp_usr.UsrCod<>%ld", - Gbl.Hierarchy.Crs.Grps.GrpCod, + Gbl.Crs.Grps.GrpCod, Gbl.Usrs.Me.UsrDat.UsrCod); break; case Brw_ADMI_TCH_GRP: // Notify all teachers in group except me @@ -1231,7 +1231,7 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod) " AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod" " AND crs_grp_types.CrsCod=crs_usr.CrsCod" " AND crs_usr.Role=%u", // Notify teachers only - Gbl.Hierarchy.Crs.Grps.GrpCod, + Gbl.Crs.Grps.GrpCod, Gbl.Usrs.Me.UsrDat.UsrCod, (unsigned) Rol_TCH); break; @@ -1267,7 +1267,7 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod) " to be notified", "SELECT UsrCod FROM crs_usr" " WHERE CrsCod=%ld AND UsrCod<>%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod); break; case Ntf_EVENT_ENROLMENT_STD: // This function should not be called in this case @@ -1275,7 +1275,7 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod) case Ntf_EVENT_ENROLMENT_TCH: // This function should not be called in this case return 0; case Ntf_EVENT_ENROLMENT_REQUEST: - if (Gbl.Hierarchy.Crs.Crs.NumUsrs[Rol_TCH]) + if (Gbl.Hierarchy.Crs.NumUsrs[Rol_TCH]) { // If this course has teachers ==> send notification to teachers NumRows = DB_QuerySELECT (&mysql_res,"can not get users" @@ -1284,7 +1284,7 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod) " WHERE CrsCod=%ld" " AND UsrCod<>%ld" " AND Role=%u", // Notify teachers only - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod, (unsigned) Rol_TCH); } @@ -1336,7 +1336,7 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod) " to be notified", "SELECT UsrCod FROM crs_usr" " WHERE CrsCod=%ld AND UsrCod<>%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod); break; case For_FORUM_COURSE_TCHS: @@ -1344,7 +1344,7 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod) " to be notified", "SELECT UsrCod FROM crs_usr" " WHERE CrsCod=%ld AND Role=%u AND UsrCod<>%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, (unsigned) Rol_TCH, Gbl.Usrs.Me.UsrDat.UsrCod); break; @@ -1481,7 +1481,7 @@ void Ntf_StoreNotifyEventToOneUser (Ntf_NotifyEvent_t NotifyEvent, InsCod = Gbl.Hierarchy.Ins.InsCod; CtrCod = Gbl.Hierarchy.Ctr.CtrCod; DegCod = Gbl.Hierarchy.Deg.DegCod; - CrsCod = Gbl.Hierarchy.Crs.Crs.CrsCod; + CrsCod = Gbl.Hierarchy.Crs.CrsCod; } /***** Store notify event *****/ diff --git a/swad_parameter.c b/swad_parameter.c index a57e3529..2c9f9ba6 100644 --- a/swad_parameter.c +++ b/swad_parameter.c @@ -665,7 +665,7 @@ void Par_GetMainParameters (void) Gbl.Hierarchy.Ins.InsCod = Gbl.Hierarchy.Ctr.CtrCod = Gbl.Hierarchy.Deg.DegCod = - Gbl.Hierarchy.Crs.Crs.CrsCod = -1L; + Gbl.Hierarchy.Crs.CrsCod = -1L; // First of all, get action, and session identifier. // So, if other parameters have been stored in the database, there will be no problems to get them. @@ -828,7 +828,7 @@ void Par_GetMainParameters (void) Gbl.Hierarchy.Ins.InsCod = Gbl.Hierarchy.Ctr.CtrCod = Gbl.Hierarchy.Deg.DegCod = - Gbl.Hierarchy.Crs.Crs.CrsCod = -1L; + Gbl.Hierarchy.Crs.CrsCod = -1L; } /***** Get institution if exists (from menu) *****/ @@ -838,7 +838,7 @@ void Par_GetMainParameters (void) Gbl.Hierarchy.Ins.InsCod = Str_ConvertStrCodToLongCod (LongStr); Gbl.Hierarchy.Ctr.CtrCod = Gbl.Hierarchy.Deg.DegCod = - Gbl.Hierarchy.Crs.Crs.CrsCod = -1L; + Gbl.Hierarchy.Crs.CrsCod = -1L; } /***** Get centre if exists (from menu) *****/ @@ -847,7 +847,7 @@ void Par_GetMainParameters (void) { Gbl.Hierarchy.Ctr.CtrCod = Str_ConvertStrCodToLongCod (LongStr); Gbl.Hierarchy.Deg.DegCod = - Gbl.Hierarchy.Crs.Crs.CrsCod = -1L; + Gbl.Hierarchy.Crs.CrsCod = -1L; } /***** Get numerical degree code if exists (from menu) *****/ @@ -855,13 +855,13 @@ void Par_GetMainParameters (void) if (LongStr[0]) // Parameter "deg" available { Gbl.Hierarchy.Deg.DegCod = Str_ConvertStrCodToLongCod (LongStr); - Gbl.Hierarchy.Crs.Crs.CrsCod = -1L; // Reset possible course from session + Gbl.Hierarchy.Crs.CrsCod = -1L; // Reset possible course from session } /***** Get numerical course code if exists (from menu) *****/ Par_GetParToText ("crs",LongStr,1 + 10); if (LongStr[0]) // Parameter "crs" available - Gbl.Hierarchy.Crs.Crs.CrsCod = Str_ConvertStrCodToLongCod (LongStr); // Overwrite CrsCod from session + Gbl.Hierarchy.Crs.CrsCod = Str_ConvertStrCodToLongCod (LongStr); // Overwrite CrsCod from session /***** Get tab to activate *****/ Gbl.Action.Tab = TabUnk; diff --git a/swad_profile.c b/swad_profile.c index 37a1f3f8..d068ab1b 100644 --- a/swad_profile.c +++ b/swad_profile.c @@ -308,7 +308,7 @@ bool Prf_ShowUserProfile (struct UsrData *UsrDat) { /* Get user's role in current course */ UsrDat->Roles.InCurrentCrs.Role = Rol_GetRoleUsrInCrs (UsrDat->UsrCod, - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); UsrDat->Roles.InCurrentCrs.Valid = true; /* Get if user has accepted enrolment in current course */ @@ -1512,7 +1512,7 @@ static void Prf_GetAndShowRankingFigure (const char *FieldName) " AND usr_figures.UsrCod NOT IN (SELECT UsrCod FROM usr_banned)" " ORDER BY usr_figures.%s DESC,usr_figures.UsrCod LIMIT 100", FieldName, - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, FieldName,FieldName); break; default: @@ -1694,7 +1694,7 @@ void Prf_GetAndShowRankingClicksPerDay (void) " AND usr_figures.FirstClickTime>FROM_UNIXTIME(0)" " AND usr_figures.UsrCod NOT IN (SELECT UsrCod FROM usr_banned)" " ORDER BY NumClicksPerDay DESC,usr_figures.UsrCod LIMIT 100", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); break; default: Lay_WrongScopeExit (); diff --git a/swad_project.c b/swad_project.c index 7a932e7e..dda008ad 100644 --- a/swad_project.c +++ b/swad_project.c @@ -882,7 +882,7 @@ void Prj_PrintOneProject (void) Lay_WriteHeaderClassPhoto (true,false, Gbl.Hierarchy.Ins.InsCod, Gbl.Hierarchy.Deg.DegCod, - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); /***** Table head *****/ Tbl_StartTableWideMargin (2); @@ -2368,7 +2368,7 @@ void Prj_GetListProjects (void) " AND projects.PrjCod=prj_usr.PrjCod" " AND prj_usr.UsrCod=%ld" " ORDER BY %s", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, PreNonSubQuery,HidVisSubQuery,DptCodSubQuery, Gbl.Usrs.Me.UsrDat.UsrCod, OrderBySubQuery[Gbl.Prjs.SelectedOrder]); @@ -2383,7 +2383,7 @@ void Prj_GetListProjects (void) " AND projects.PrjCod=prj_usr.PrjCod" " AND prj_usr.UsrCod=%ld" " ORDER BY %s", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, PreNonSubQuery,HidVisSubQuery,DptCodSubQuery, Gbl.Usrs.Me.UsrDat.UsrCod, OrderBySubQuery[Gbl.Prjs.SelectedOrder]); @@ -2401,7 +2401,7 @@ void Prj_GetListProjects (void) " WHERE projects.CrsCod=%ld" "%s%s%s" " ORDER BY %s", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, PreNonSubQuery,HidVisSubQuery,DptCodSubQuery, OrderBySubQuery[Gbl.Prjs.SelectedOrder]); break; @@ -2413,7 +2413,7 @@ void Prj_GetListProjects (void) " WHERE projects.CrsCod=%ld" "%s%s%s" " ORDER BY %s", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, PreNonSubQuery,HidVisSubQuery,DptCodSubQuery, OrderBySubQuery[Gbl.Prjs.SelectedOrder]); break; @@ -2519,7 +2519,7 @@ void Prj_GetDataOfProjectByCod (struct Project *Prj) " FROM projects" " WHERE PrjCod=%ld AND CrsCod=%ld", Prj->PrjCod, - Gbl.Hierarchy.Crs.Crs.CrsCod)) // Project found... + Gbl.Hierarchy.Crs.CrsCod)) // Project found... { /* Get row */ row = mysql_fetch_row (mysql_res); @@ -2723,7 +2723,7 @@ void Prj_RemoveProject (void) "DELETE FROM prj_usr USING projects,prj_usr" " WHERE projects.PrjCod=%ld AND projects.CrsCod=%ld" " AND projects.PrjCod=prj_usr.PrjCod", - Prj.PrjCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + Prj.PrjCod,Gbl.Hierarchy.Crs.CrsCod); /***** Flush cache *****/ Prj_FlushCacheMyRoleInProject (); @@ -2732,7 +2732,7 @@ void Prj_RemoveProject (void) DB_QueryDELETE ("can not remove project", "DELETE FROM projects" " WHERE PrjCod=%ld AND CrsCod=%ld", - Prj.PrjCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + Prj.PrjCod,Gbl.Hierarchy.Crs.CrsCod); /***** Remove information related to files in project *****/ Brw_RemovePrjFilesFromDB (Prj.PrjCod); @@ -2784,7 +2784,7 @@ void Prj_HideProject (void) DB_QueryUPDATE ("can not hide project", "UPDATE projects SET Hidden='Y'" " WHERE PrjCod=%ld AND CrsCod=%ld", - Prj.PrjCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + Prj.PrjCod,Gbl.Hierarchy.Crs.CrsCod); /***** Write message to show the change made *****/ Ale_ShowAlert (Ale_SUCCESS,Txt_Project_X_is_now_hidden, @@ -2826,7 +2826,7 @@ void Prj_ShowProject (void) DB_QueryUPDATE ("can not show project", "UPDATE projects SET Hidden='N'" " WHERE PrjCod=%ld AND CrsCod=%ld", - Prj.PrjCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + Prj.PrjCod,Gbl.Hierarchy.Crs.CrsCod); /***** Write message to show the change made *****/ Ale_ShowAlert (Ale_SUCCESS,Txt_Project_X_is_now_visible, @@ -3294,7 +3294,7 @@ static void Prj_CreateProject (struct Project *Prj) " (%ld,%ld,'%c','%c',%u,'%s'," "FROM_UNIXTIME(%ld),FROM_UNIXTIME(%ld)," "'%s','%s','%s','%s','%s')", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Prj->DptCod, Prj->Hidden == Prj_HIDDEN ? 'Y' : 'N', @@ -3361,7 +3361,7 @@ static void Prj_UpdateProject (struct Project *Prj) Prj->Knowledge, Prj->Materials, Prj->URL, - Prj->PrjCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + Prj->PrjCod,Gbl.Hierarchy.Crs.CrsCod); } /*****************************************************************************/ @@ -3473,7 +3473,7 @@ unsigned Prj_GetNumCoursesWithProjects (Hie_Level_t Scope) "SELECT COUNT(DISTINCT CrsCod)" " FROM projects" " WHERE CrsCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); break; default: Lay_WrongScopeExit (); @@ -3554,7 +3554,7 @@ unsigned Prj_GetNumProjects (Hie_Level_t Scope) "SELECT COUNT(*)" " FROM projects" " WHERE CrsCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); break; default: Lay_WrongScopeExit (); diff --git a/swad_record.c b/swad_record.c index 62ac13d5..ed0bc8e5 100644 --- a/swad_record.c +++ b/swad_record.c @@ -192,7 +192,7 @@ void Rec_ReqEditRecordFields (void) Rec_GetListRecordFieldsInCurrentCrs (); /***** List the current fields of records for edit them *****/ - if (Gbl.Hierarchy.Crs.Records.LstFields.Num) // Fields found... + if (Gbl.Crs.Records.LstFields.Num) // Fields found... { /* Start box and table */ Box_StartBoxTable (NULL,Txt_Record_fields,NULL, @@ -205,7 +205,7 @@ void Rec_ReqEditRecordFields (void) } else // No fields of records found for current course in the database Ale_ShowAlert (Ale_INFO,Txt_There_are_no_record_fields_in_the_course_X, - Gbl.Hierarchy.Crs.Crs.FullName); + Gbl.Hierarchy.Crs.FullName); /***** Put a form to create a new record field *****/ Rec_ShowFormCreateRecordField (); @@ -225,51 +225,51 @@ void Rec_GetListRecordFieldsInCurrentCrs (void) unsigned long NumRow; unsigned Vis; - if (++Gbl.Hierarchy.Crs.Records.LstFields.NestedCalls > 1) // If the list is already created, don't do anything + if (++Gbl.Crs.Records.LstFields.NestedCalls > 1) // If the list is already created, don't do anything return; /***** Get fields of records in a course from database *****/ - Gbl.Hierarchy.Crs.Records.LstFields.Num = + Gbl.Crs.Records.LstFields.Num = (unsigned) DB_QuerySELECT (&mysql_res,"can not get fields of records" " in a course", "SELECT FieldCod,FieldName,NumLines,Visibility" " FROM crs_record_fields" " WHERE CrsCod=%ld ORDER BY FieldName", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); /***** Get the fields of records *****/ - if (Gbl.Hierarchy.Crs.Records.LstFields.Num) + if (Gbl.Crs.Records.LstFields.Num) { /***** Create a list of fields *****/ - if ((Gbl.Hierarchy.Crs.Records.LstFields.Lst = (struct RecordField *) calloc (Gbl.Hierarchy.Crs.Records.LstFields.Num,sizeof (struct RecordField))) == NULL) + if ((Gbl.Crs.Records.LstFields.Lst = (struct RecordField *) calloc (Gbl.Crs.Records.LstFields.Num,sizeof (struct RecordField))) == NULL) Lay_NotEnoughMemoryExit (); /***** Get the fields *****/ for (NumRow = 0; - NumRow < Gbl.Hierarchy.Crs.Records.LstFields.Num; + NumRow < Gbl.Crs.Records.LstFields.Num; NumRow++) { /* Get next field */ row = mysql_fetch_row (mysql_res); /* Get the code of field (row[0]) */ - if ((Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumRow].FieldCod = Str_ConvertStrCodToLongCod (row[0])) < 0) + if ((Gbl.Crs.Records.LstFields.Lst[NumRow].FieldCod = Str_ConvertStrCodToLongCod (row[0])) < 0) Lay_ShowErrorAndExit ("Wrong code of field."); /* Name of the field (row[1]) */ - Str_Copy (Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumRow].Name,row[1], + Str_Copy (Gbl.Crs.Records.LstFields.Lst[NumRow].Name,row[1], Rec_MAX_BYTES_NAME_FIELD); /* Number of lines (row[2]) */ - Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumRow].NumLines = Rec_ConvertToNumLinesField (row[2]); + Gbl.Crs.Records.LstFields.Lst[NumRow].NumLines = Rec_ConvertToNumLinesField (row[2]); /* Visible or editable by students? (row[3]) */ if (sscanf (row[3],"%u",&Vis) != 1) Lay_ShowErrorAndExit ("Error when getting field of record in current course."); if (Vis < Rec_NUM_TYPES_VISIBILITY) - Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumRow].Visibility = (Rec_VisibilityRecordFields_t) Vis; + Gbl.Crs.Records.LstFields.Lst[NumRow].Visibility = (Rec_VisibilityRecordFields_t) Vis; else - Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumRow].Visibility = Rec_VISIBILITY_DEFAULT; + Gbl.Crs.Records.LstFields.Lst[NumRow].Visibility = Rec_VISIBILITY_DEFAULT; } } @@ -292,7 +292,7 @@ void Rec_ListFieldsRecordsForEdition (void) /***** List the fields *****/ for (NumField = 0; - NumField < Gbl.Hierarchy.Crs.Records.LstFields.Num; + NumField < Gbl.Crs.Records.LstFields.Num; NumField++) { fprintf (Gbl.F.Out,""); @@ -300,7 +300,7 @@ void Rec_ListFieldsRecordsForEdition (void) /* Write icon to remove the field */ fprintf (Gbl.F.Out,""); Frm_StartForm (ActReqRemFie); - Par_PutHiddenParamLong ("FieldCod",Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].FieldCod); + Par_PutHiddenParamLong ("FieldCod",Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod); Ico_PutIconRemove (); Frm_EndForm (); fprintf (Gbl.F.Out,""); @@ -308,12 +308,12 @@ void Rec_ListFieldsRecordsForEdition (void) /* Name of the field */ fprintf (Gbl.F.Out,""); Frm_StartForm (ActRenFie); - Par_PutHiddenParamLong ("FieldCod",Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].FieldCod); + Par_PutHiddenParamLong ("FieldCod",Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod); fprintf (Gbl.F.Out,"", Rec_MAX_CHARS_NAME_FIELD, - Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].Name, + Gbl.Crs.Records.LstFields.Lst[NumField].Name, Gbl.Form.Id); Frm_EndForm (); fprintf (Gbl.F.Out,""); @@ -321,11 +321,11 @@ void Rec_ListFieldsRecordsForEdition (void) /* Number of lines in the form */ fprintf (Gbl.F.Out,""); Frm_StartForm (ActChgRowFie); - Par_PutHiddenParamLong ("FieldCod",Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].FieldCod); + Par_PutHiddenParamLong ("FieldCod",Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod); fprintf (Gbl.F.Out,"", - Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].NumLines, + Gbl.Crs.Records.LstFields.Lst[NumField].NumLines, Gbl.Form.Id); Frm_EndForm (); fprintf (Gbl.F.Out,""); @@ -333,7 +333,7 @@ void Rec_ListFieldsRecordsForEdition (void) /* Visibility of a field */ fprintf (Gbl.F.Out,""); Frm_StartForm (ActChgVisFie); - Par_PutHiddenParamLong ("FieldCod",Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].FieldCod); + Par_PutHiddenParamLong ("FieldCod",Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod); fprintf (Gbl.F.Out,""); @@ -1886,15 +1886,15 @@ void Rec_GetFieldsCrsRecordFromForm (void) char FieldParamName[5 + 10 + 1]; for (NumField = 0; - NumField < Gbl.Hierarchy.Crs.Records.LstFields.Num; + NumField < Gbl.Crs.Records.LstFields.Num; NumField++) - if (Rec_CheckIfICanEditField (Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].Visibility)) + if (Rec_CheckIfICanEditField (Gbl.Crs.Records.LstFields.Lst[NumField].Visibility)) { /* Get text from the form */ snprintf (FieldParamName,sizeof (FieldParamName), "Field%ld", - Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].FieldCod); - Par_GetParToHTML (FieldParamName,Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].Text,Cns_MAX_BYTES_TEXT); + Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod); + Par_GetParToHTML (FieldParamName,Gbl.Crs.Records.LstFields.Lst[NumField].Text,Cns_MAX_BYTES_TEXT); } } @@ -1909,41 +1909,41 @@ void Rec_UpdateCrsRecord (long UsrCod) bool FieldAlreadyExists; for (NumField = 0; - NumField < Gbl.Hierarchy.Crs.Records.LstFields.Num; + NumField < Gbl.Crs.Records.LstFields.Num; NumField++) - if (Rec_CheckIfICanEditField (Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].Visibility)) + if (Rec_CheckIfICanEditField (Gbl.Crs.Records.LstFields.Lst[NumField].Visibility)) { /***** Check if already exists this field for this user in database *****/ - FieldAlreadyExists = (Rec_GetFieldFromCrsRecord (UsrCod,Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].FieldCod,&mysql_res) != 0); + FieldAlreadyExists = (Rec_GetFieldFromCrsRecord (UsrCod,Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod,&mysql_res) != 0); DB_FreeMySQLResult (&mysql_res); if (FieldAlreadyExists) { - if (Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].Text[0]) + if (Gbl.Crs.Records.LstFields.Lst[NumField].Text[0]) /***** Update text of the field of record course *****/ DB_QueryUPDATE ("can not update field of record", "UPDATE crs_records SET Txt='%s'" " WHERE UsrCod=%ld AND FieldCod=%ld", - Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].Text, + Gbl.Crs.Records.LstFields.Lst[NumField].Text, UsrCod, - Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].FieldCod); + Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod); else /***** Remove text of the field of record course *****/ DB_QueryDELETE ("can not remove field of record", "DELETE FROM crs_records" " WHERE UsrCod=%ld AND FieldCod=%ld", UsrCod, - Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].FieldCod); + Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod); } - else if (Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].Text[0]) + else if (Gbl.Crs.Records.LstFields.Lst[NumField].Text[0]) /***** Insert text field of record course *****/ DB_QueryINSERT ("can not create field of record", "INSERT INTO crs_records" " (FieldCod,UsrCod,Txt)" " VALUES" " (%ld,%ld,'%s')", - Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].FieldCod, + Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod, UsrCod, - Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].Text); + Gbl.Crs.Records.LstFields.Lst[NumField].Text); } } @@ -2000,11 +2000,11 @@ void Rec_AllocMemFieldsRecordsCrs (void) unsigned NumField; for (NumField = 0; - NumField < Gbl.Hierarchy.Crs.Records.LstFields.Num; + NumField < Gbl.Crs.Records.LstFields.Num; NumField++) - if (Rec_CheckIfICanEditField (Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].Visibility)) + if (Rec_CheckIfICanEditField (Gbl.Crs.Records.LstFields.Lst[NumField].Visibility)) /* Allocate memory for the texts of the fields */ - if ((Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].Text = (char *) malloc (Cns_MAX_BYTES_TEXT + 1)) == NULL) + if ((Gbl.Crs.Records.LstFields.Lst[NumField].Text = (char *) malloc (Cns_MAX_BYTES_TEXT + 1)) == NULL) Lay_NotEnoughMemoryExit (); } @@ -2017,14 +2017,14 @@ void Rec_FreeMemFieldsRecordsCrs (void) unsigned NumField; for (NumField = 0; - NumField < Gbl.Hierarchy.Crs.Records.LstFields.Num; + NumField < Gbl.Crs.Records.LstFields.Num; NumField++) - if (Rec_CheckIfICanEditField (Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].Visibility)) + if (Rec_CheckIfICanEditField (Gbl.Crs.Records.LstFields.Lst[NumField].Visibility)) /* Free memory of the text of the field */ - if (Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].Text) + if (Gbl.Crs.Records.LstFields.Lst[NumField].Text) { - free ((void *) Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].Text); - Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].Text = NULL; + free ((void *) Gbl.Crs.Records.LstFields.Lst[NumField].Text); + Gbl.Crs.Records.LstFields.Lst[NumField].Text = NULL; } } @@ -2409,14 +2409,14 @@ void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView, Frm_EndForm (); break; case Rec_SHA_OTHER_NEW_USR_FORM: - if (Gbl.Hierarchy.Crs.Grps.NumGrps) // This course has groups? + if (Gbl.Crs.Grps.NumGrps) // This course has groups? Grp_ShowLstGrpsToChgOtherUsrsGrps (UsrDat->UsrCod); Btn_PutConfirmButton (Txt_Register); Frm_EndForm (); break; case Rec_SHA_OTHER_EXISTING_USR_FORM: /***** Show list of groups to register/remove me/user *****/ - if (Gbl.Hierarchy.Crs.Grps.NumGrps) // This course has groups? + if (Gbl.Crs.Grps.NumGrps) // This course has groups? { if (ItsMe) { @@ -2908,7 +2908,7 @@ static void Rec_ShowRole (struct UsrData *UsrDat, { case Rec_SHA_SIGN_UP_IN_CRS_FORM: // I want to apply for enrolment /***** Set default role *****/ - if (UsrDat->UsrCod == Gbl.Hierarchy.Crs.Crs.RequesterUsrCod || // Creator of the course + if (UsrDat->UsrCod == Gbl.Hierarchy.Crs.RequesterUsrCod || // Creator of the course (UsrDat->Roles.InCrss & (1 << Rol_TCH))) // Teacher in other courses DefaultRoleInForm = Rol_TCH; // Request sign up as a teacher else if ((UsrDat->Roles.InCrss & (1 << Rol_NET))) // Non-editing teacher in other courses @@ -3260,9 +3260,9 @@ static void Rec_ShowCountry (struct UsrData *UsrDat, unsigned NumCty; /***** If list of countries is empty, try to get it *****/ - if (!Gbl.Ctys.Num) + if (!Gbl.Hierarchy.Sys.Ctys.Num) { - Gbl.Ctys.SelectedOrder = Cty_ORDER_BY_COUNTRY; + Gbl.Hierarchy.Sys.Ctys.SelectedOrder = Cty_ORDER_BY_COUNTRY; Cty_GetListCountries (Cty_GET_BASIC_DATA); } @@ -3287,15 +3287,15 @@ static void Rec_ShowCountry (struct UsrData *UsrDat, fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%s",Txt_Another_country); for (NumCty = 0; - NumCty < Gbl.Ctys.Num; + NumCty < Gbl.Hierarchy.Sys.Ctys.Num; NumCty++) { fprintf (Gbl.F.Out,"", - Gbl.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]); + Gbl.Hierarchy.Sys.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]); } fprintf (Gbl.F.Out,"" "" @@ -3780,7 +3780,7 @@ Rol_Role_t Rec_GetRoleFromRecordForm (void) if ( Role == Rol_STD || Role == Rol_NET || Role == Rol_TCH || - (Role == Rol_GST && Gbl.Hierarchy.Crs.Crs.CrsCod <= 0)) + (Role == Rol_GST && Gbl.Hierarchy.Crs.CrsCod <= 0)) RoleOK = true; break; default: @@ -3989,9 +3989,9 @@ static void Rec_ShowFormMyInsCtrDpt (bool IAmATeacher) ClassForm,Txt_Country); /* If list of countries is empty, try to get it */ - if (!Gbl.Ctys.Num) + if (!Gbl.Hierarchy.Sys.Ctys.Num) { - Gbl.Ctys.SelectedOrder = Cty_ORDER_BY_COUNTRY; + Gbl.Hierarchy.Sys.Ctys.SelectedOrder = Cty_ORDER_BY_COUNTRY; Cty_GetListCountries (Cty_GET_BASIC_DATA); } @@ -4006,15 +4006,15 @@ static void Rec_ShowFormMyInsCtrDpt (bool IAmATeacher) fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out," disabled=\"disabled\">"); for (NumCty = 0; - NumCty < Gbl.Ctys.Num; + NumCty < Gbl.Hierarchy.Sys.Ctys.Num; NumCty++) { fprintf (Gbl.F.Out,"", - Gbl.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]); + Gbl.Hierarchy.Sys.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]); } fprintf (Gbl.F.Out,""); Frm_EndForm (); @@ -4050,15 +4050,15 @@ static void Rec_ShowFormMyInsCtrDpt (bool IAmATeacher) fprintf (Gbl.F.Out,">%s", Txt_Another_institution); for (NumIns = 0; - NumIns < Gbl.Inss.Num; + NumIns < Gbl.Hierarchy.Cty.Inss.Num; NumIns++) { fprintf (Gbl.F.Out,"", - Gbl.Inss.Lst[NumIns].FullName); + Gbl.Hierarchy.Cty.Inss.Lst[NumIns].FullName); } fprintf (Gbl.F.Out,""); Frm_EndForm (); @@ -4096,15 +4096,15 @@ static void Rec_ShowFormMyInsCtrDpt (bool IAmATeacher) fprintf (Gbl.F.Out,">%s", Txt_Another_centre); for (NumCtr = 0; - NumCtr < Gbl.Ctrs.Num; + NumCtr < Gbl.Hierarchy.Ins.Ctrs.Num; NumCtr++) { fprintf (Gbl.F.Out,"", - Gbl.Ctrs.Lst[NumCtr].FullName); + Gbl.Hierarchy.Ins.Ctrs.Lst[NumCtr].FullName); } fprintf (Gbl.F.Out,""); Frm_EndForm (); diff --git a/swad_role.c b/swad_role.c index 01a49d4f..a36a38f3 100644 --- a/swad_role.c +++ b/swad_role.c @@ -86,7 +86,7 @@ void Rol_SetMyRoles (void) /***** Get my role in current course if not yet filled *****/ if (!Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Valid) { - Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role = Rol_GetMyRoleInCrs (Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role = Rol_GetMyRoleInCrs (Gbl.Hierarchy.Crs.CrsCod); Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Valid = true; } @@ -624,7 +624,7 @@ Rol_Role_t Rol_GetRequestedRole (long UsrCod) if (DB_QuerySELECT (&mysql_res,"can not get requested role", "SELECT Role FROM crs_usr_requests" " WHERE CrsCod=%ld AND UsrCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod,UsrCod)) + Gbl.Hierarchy.Crs.CrsCod,UsrCod)) { /***** Get role *****/ row = mysql_fetch_row (mysql_res); diff --git a/swad_scope.c b/swad_scope.c index 1c97c312..ab472aee 100644 --- a/swad_scope.c +++ b/swad_scope.c @@ -152,7 +152,7 @@ void Sco_PutSelectorScope (const char *ParamName,bool SendOnChange) case Hie_CRS: fprintf (Gbl.F.Out,"%s: %s", Txt_Course, - Gbl.Hierarchy.Crs.Crs.ShrtName); + Gbl.Hierarchy.Crs.ShrtName); break; default: Lay_WrongScopeExit (); @@ -202,7 +202,7 @@ void Sco_AdjustScope (void) Gbl.Scope.Current = Gbl.Scope.Default; /***** Avoid impossible scopes *****/ - if (Gbl.Scope.Current == Hie_CRS && Gbl.Hierarchy.Crs.Crs.CrsCod <= 0) + if (Gbl.Scope.Current == Hie_CRS && Gbl.Hierarchy.Crs.CrsCod <= 0) Gbl.Scope.Current = Hie_DEG; if (Gbl.Scope.Current == Hie_DEG && Gbl.Hierarchy.Deg.DegCod <= 0) diff --git a/swad_search.c b/swad_search.c index 91afe24f..efae93f7 100644 --- a/swad_search.c +++ b/swad_search.c @@ -377,7 +377,7 @@ static void Sch_SearchInDB (void) break; case Hie_CRS: sprintf (RangeQuery," AND courses.CrsCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); break; } diff --git a/swad_session.c b/swad_session.c index 4d559d51..8c522fb3 100644 --- a/swad_session.c +++ b/swad_session.c @@ -171,7 +171,7 @@ void Ses_InsertSessionInDB (void) Gbl.Hierarchy.Ins.InsCod, Gbl.Hierarchy.Ctr.CtrCod, Gbl.Hierarchy.Deg.DegCod, - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Gbl.Search.WhatToSearch); } @@ -194,7 +194,7 @@ void Ses_UpdateSessionDataInDB (void) Gbl.Hierarchy.Ins.InsCod, Gbl.Hierarchy.Ctr.CtrCod, Gbl.Hierarchy.Deg.DegCod, - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Gbl.Session.Id); } @@ -301,7 +301,7 @@ bool Ses_GetSessionData (void) Gbl.Hierarchy.Deg.DegCod = Str_ConvertStrCodToLongCod (row[6]); /***** Get course code (row[7]) *****/ - Gbl.Hierarchy.Crs.Crs.CrsCod = Str_ConvertStrCodToLongCod (row[7]); + Gbl.Hierarchy.Crs.CrsCod = Str_ConvertStrCodToLongCod (row[7]); /***** Get last search *****/ if (Gbl.Action.Act != ActLogOut) // When closing session, last search will not be needed diff --git a/swad_statistic.c b/swad_statistic.c index 43986080..3e1d42b8 100644 --- a/swad_statistic.c +++ b/swad_statistic.c @@ -198,7 +198,7 @@ void Sta_LogAccess (const char *Comments) Gbl.Hierarchy.Ins.InsCod, Gbl.Hierarchy.Ctr.CtrCod, Gbl.Hierarchy.Deg.DegCod, - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod, (unsigned) RoleToStore, Gbl.TimeGenerationInMicroseconds, @@ -218,7 +218,7 @@ void Sta_LogAccess (const char *Comments) Gbl.Hierarchy.Ins.InsCod, Gbl.Hierarchy.Ctr.CtrCod, Gbl.Hierarchy.Deg.DegCod, - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod, (unsigned) RoleToStore, Gbl.TimeGenerationInMicroseconds, @@ -345,7 +345,7 @@ void Sta_AskShowCrsHits (void) /***** Start box *****/ snprintf (Gbl.Title,sizeof (Gbl.Title), Txt_Statistics_of_visits_to_the_course_X, - Gbl.Hierarchy.Crs.Crs.ShrtName); + Gbl.Hierarchy.Crs.ShrtName); Box_StartBox (NULL,Gbl.Title,NULL, Hlp_ANALYTICS_Visits_visits_to_course,Box_NOT_CLOSABLE); @@ -1144,7 +1144,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse) if (Gbl.Hierarchy.Level == Hie_CRS) { sprintf (QueryAux," AND %s.CrsCod=%ld", - LogTable,Gbl.Hierarchy.Crs.Crs.CrsCod); + LogTable,Gbl.Hierarchy.Crs.CrsCod); Str_Concat (Query,QueryAux, Sta_MAX_BYTES_QUERY_ACCESS); } @@ -1238,7 +1238,7 @@ static void Sta_ShowHits (Sta_GlobalOrCourseAccesses_t GlobalOrCourse) break; case Sta_SHOW_COURSE_ACCESSES: sprintf (QueryAux," AND %s.CrsCod=%ld", - LogTable,Gbl.Hierarchy.Crs.Crs.CrsCod); + LogTable,Gbl.Hierarchy.Crs.CrsCod); Str_Concat (Query,QueryAux, Sta_MAX_BYTES_QUERY_ACCESS); diff --git a/swad_survey.c b/swad_survey.c index 2d5fc90f..6a9d1784 100644 --- a/swad_survey.c +++ b/swad_survey.c @@ -205,8 +205,8 @@ static void Svy_ListAllSurveys (struct SurveyQuestion *SvyQst) unsigned NumSvy; /***** Get number of groups in current course *****/ - if (!Gbl.Hierarchy.Crs.Grps.NumGrps) - Gbl.Hierarchy.Crs.Grps.WhichGrps = Grp_ALL_GROUPS; + if (!Gbl.Crs.Grps.NumGrps) + Gbl.Crs.Grps.WhichGrps = Grp_ALL_GROUPS; /***** Get list of surveys *****/ Svy_GetListSurveys (); @@ -228,7 +228,7 @@ static void Svy_ListAllSurveys (struct SurveyQuestion *SvyQst) Hlp_ASSESSMENT_Surveys,Box_NOT_CLOSABLE); /***** Select whether show only my groups or all groups *****/ - if (Gbl.Hierarchy.Crs.Grps.NumGrps) + if (Gbl.Crs.Grps.NumGrps) { Set_StartSettingsHead (); Grp_ShowFormToSelWhichGrps (ActSeeAllSvy,Svy_ParamsWhichGroupsToShow); @@ -617,7 +617,7 @@ static void Svy_ShowOneSurvey (long SvyCod,struct SurveyQuestion *SvyQst, break; case Hie_CRS: // Course fprintf (Gbl.F.Out,"%s %s", - Txt_Course,Gbl.Hierarchy.Crs.Crs.ShrtName); + Txt_Course,Gbl.Hierarchy.Crs.ShrtName); break; } fprintf (Gbl.F.Out,"
    "); @@ -636,7 +636,7 @@ static void Svy_ShowOneSurvey (long SvyCod,struct SurveyQuestion *SvyQst, /* Groups whose users can answer this survey */ if (Svy.Scope == Hie_CRS) - if (Gbl.Hierarchy.Crs.Grps.NumGrps) + if (Gbl.Crs.Grps.NumGrps) Svy_GetAndWriteNamesOfGrpsAssociatedToSvy (&Svy); /* Text of the survey */ @@ -866,7 +866,7 @@ void Svy_GetListSurveys (void) Cods[Hie_INS] = Gbl.Hierarchy.Ins.InsCod; // Institution Cods[Hie_CTR] = Gbl.Hierarchy.Ctr.CtrCod; // Centre Cods[Hie_DEG] = Gbl.Hierarchy.Deg.DegCod; // Degree - Cods[Hie_CRS] = Gbl.Hierarchy.Crs.Crs.CrsCod; // Course + Cods[Hie_CRS] = Gbl.Hierarchy.Crs.CrsCod; // Course /* Fill subqueries for system, country, institution, centre and degree */ for (Scope = Hie_SYS; @@ -892,7 +892,7 @@ void Svy_GetListSurveys (void) /* Fill subquery for course */ if (ScopesAllowed & 1 << Hie_CRS) { - if (Gbl.Hierarchy.Crs.Grps.WhichGrps == Grp_ONLY_MY_GROUPS) + if (Gbl.Crs.Grps.WhichGrps == Grp_ONLY_MY_GROUPS) { if (asprintf (&SubQuery[Hie_CRS],"%s(" "Scope='%s' AND Cod=%ld%s" @@ -914,7 +914,7 @@ void Svy_GetListSurveys (void) Gbl.Usrs.Me.UsrDat.UsrCod) < 0) Lay_NotEnoughMemoryExit (); } - else // Gbl.Hierarchy.Crs.Grps.WhichGrps == Grp_ALL_GROUPS + else // Gbl.Crs.Grps.WhichGrps == Grp_ALL_GROUPS { if (asprintf (&SubQuery[Hie_CRS],"%s(Scope='%s' AND Cod=%ld%s)", SubQueryFilled ? " OR " : @@ -2015,7 +2015,7 @@ static void Svy_ShowLstGrpsToEditSurvey (long SvyCod) /***** Get list of groups types and groups in this course *****/ Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS); - if (Gbl.Hierarchy.Crs.Grps.GrpTypes.Num) + if (Gbl.Crs.Grps.GrpTypes.Num) { /***** Start box and table *****/ fprintf (Gbl.F.Out,"" @@ -2041,14 +2041,14 @@ static void Svy_ShowLstGrpsToEditSurvey (long SvyCod) "" "" "", - Txt_The_whole_course,Gbl.Hierarchy.Crs.Crs.ShrtName); + Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName); /***** List the groups for each group type *****/ for (NumGrpTyp = 0; - NumGrpTyp < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num; + NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num; NumGrpTyp++) - if (Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) - Grp_ListGrpsToEditAsgAttSvyGam (&Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp], + if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) + Grp_ListGrpsToEditAsgAttSvyGam (&Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp], SvyCod,Grp_SURVEY); /***** End table and box *****/ @@ -2138,7 +2138,7 @@ void Svy_RecFormSurvey (void) Gbl.Usrs.Me.Role.Logged != Rol_TCH) Lay_ShowErrorAndExit ("Wrong survey scope."); NewSvy.Scope = Hie_CRS; - NewSvy.Cod = Gbl.Hierarchy.Crs.Crs.CrsCod; + NewSvy.Cod = Gbl.Hierarchy.Crs.CrsCod; break; default: Lay_WrongScopeExit (); @@ -2247,7 +2247,7 @@ static void Svy_CreateSurvey (struct Survey *Svy,const char *Txt) Txt); /***** Create groups *****/ - if (Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps) + if (Gbl.Crs.Grps.LstGrpsSel.NumGrps) Svy_CreateGrps (Svy->SvyCod); /***** Write success message *****/ @@ -2284,7 +2284,7 @@ static void Svy_UpdateSurvey (struct Survey *Svy,const char *Txt) Svy_RemoveAllTheGrpsAssociatedToAndSurvey (Svy->SvyCod); /* Create new groups */ - if (Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps) + if (Gbl.Crs.Grps.LstGrpsSel.NumGrps) Svy_CreateGrps (Svy->SvyCod); /***** Write success message *****/ @@ -2367,7 +2367,7 @@ static void Svy_CreateGrps (long SvyCod) /***** Create groups of the survey *****/ for (NumGrpSel = 0; - NumGrpSel < Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps; + NumGrpSel < Gbl.Crs.Grps.LstGrpsSel.NumGrps; NumGrpSel++) /* Create group */ DB_QueryINSERT ("can not associate a group to a survey", @@ -2375,7 +2375,7 @@ static void Svy_CreateGrps (long SvyCod) " (SvyCod,GrpCod)" " VALUES" " (%ld,%ld)", - SvyCod,Gbl.Hierarchy.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]); + SvyCod,Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]); } /*****************************************************************************/ @@ -2437,7 +2437,7 @@ static void Svy_GetAndWriteNamesOfGrpsAssociatedToSvy (struct Survey *Svy) } else fprintf (Gbl.F.Out,"%s %s", - Txt_The_whole_course,Gbl.Hierarchy.Crs.Crs.ShrtName); + Txt_The_whole_course,Gbl.Hierarchy.Crs.ShrtName); fprintf (Gbl.F.Out,"
    "); @@ -3824,7 +3824,7 @@ unsigned Svy_GetNumCoursesWithCrsSurveys (Hie_Level_t Scope) " FROM surveys" " WHERE Scope='%s' AND Cod=%ld", Sco_GetDBStrFromScope (Hie_CRS), - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); break; default: Lay_WrongScopeExit (); @@ -3917,7 +3917,7 @@ unsigned Svy_GetNumCrsSurveys (Hie_Level_t Scope,unsigned *NumNotif) " WHERE surveys.Scope='%s'" " AND CrsCod=%ld", Sco_GetDBStrFromScope (Hie_CRS), - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); break; default: Lay_WrongScopeExit (); @@ -4039,7 +4039,7 @@ float Svy_GetNumQstsPerCrsSurvey (Hie_Level_t Scope) " WHERE surveys.Scope='%s' AND surveys.Cod=%ld" " AND surveys.SvyCod=svy_questions.SvyCod" " GROUP BY svy_questions.SvyCod) AS NumQstsTable", - Sco_GetDBStrFromScope (Hie_CRS),Gbl.Hierarchy.Crs.Crs.CrsCod); + Sco_GetDBStrFromScope (Hie_CRS),Gbl.Hierarchy.Crs.CrsCod); break; default: Lay_WrongScopeExit (); diff --git a/swad_syllabus.c b/swad_syllabus.c index 9b1e0176..66d333db 100644 --- a/swad_syllabus.c +++ b/swad_syllabus.c @@ -230,7 +230,7 @@ bool Syl_CheckAndEditSyllabus (void) Syl_SetSyllabusTypeFromAction (); /***** Load syllabus from XML file to memory *****/ - Syl_LoadListItemsSyllabusIntoMemory (Gbl.Hierarchy.Crs.Crs.CrsCod); + Syl_LoadListItemsSyllabusIntoMemory (Gbl.Hierarchy.Crs.CrsCod); if (Gbl.Action.Act == ActEditorSylLec || Gbl.Action.Act == ActEditorSylPra) @@ -248,7 +248,7 @@ bool Syl_CheckAndEditSyllabus (void) if (Gbl.Syllabus.EditionIsActive) { /***** Button to view *****/ - Frm_StartForm (Inf_ActionsSeeInfo[Gbl.Hierarchy.Crs.Info.Type]); + Frm_StartForm (Inf_ActionsSeeInfo[Gbl.Crs.Info.Type]); Btn_PutConfirmButton (Txt_Done); Frm_EndForm (); } @@ -278,13 +278,13 @@ void Syl_EditSyllabus (void) static void Syl_SetSyllabusTypeFromAction (void) { - Gbl.Hierarchy.Crs.Info.Type = Inf_LECTURES; + Gbl.Crs.Info.Type = Inf_LECTURES; /***** Set the type of syllabus (lectures or practicals) *****/ switch (Gbl.Action.Act) { case ActSeeSyl: - Gbl.Hierarchy.Crs.Info.Type = (Gbl.Syllabus.WhichSyllabus == Syl_LECTURES ? Inf_LECTURES : + Gbl.Crs.Info.Type = (Gbl.Syllabus.WhichSyllabus == Syl_LECTURES ? Inf_LECTURES : Inf_PRACTICALS); break; case ActSeeSylLec: @@ -307,7 +307,7 @@ static void Syl_SetSyllabusTypeFromAction (void) case ActRcvPlaTxtSylLec: case ActRcvRchTxtSylLec: Gbl.Syllabus.WhichSyllabus = Syl_LECTURES; - Gbl.Hierarchy.Crs.Info.Type = Inf_LECTURES; + Gbl.Crs.Info.Type = Inf_LECTURES; break; case ActSeeSylPra: case ActEdiSylPra: @@ -329,7 +329,7 @@ static void Syl_SetSyllabusTypeFromAction (void) case ActRcvPlaTxtSylPra: case ActRcvRchTxtSylPra: Gbl.Syllabus.WhichSyllabus = Syl_PRACTICALS; - Gbl.Hierarchy.Crs.Info.Type = Inf_PRACTICALS; + Gbl.Crs.Info.Type = Inf_PRACTICALS; break; default: Lay_ShowErrorAndExit ("Wrong action."); @@ -521,7 +521,7 @@ static void Syl_ShowSyllabus (bool PutIconToEdit) Gbl.Action.Act == ActLftIteSylLec || Gbl.Action.Act == ActLftIteSylPra); /***** Start box and table *****/ - Box_StartBoxTable (NULL,Txt_INFO_TITLE[Gbl.Hierarchy.Crs.Info.Type], + Box_StartBoxTable (NULL,Txt_INFO_TITLE[Gbl.Crs.Info.Type], PutIconToEdit ? Inf_PutIconToEditInfo : NULL, Gbl.Syllabus.EditionIsActive ? Hlp_COURSE_Syllabus_edit : @@ -611,7 +611,7 @@ static void Syl_ShowRowSyllabus (unsigned NumItem, Ico_PutIconRemovalNotAllowed (); else { - Frm_StartForm (Gbl.Hierarchy.Crs.Info.Type == Inf_LECTURES ? ActDelItmSylLec : + Frm_StartForm (Gbl.Crs.Info.Type == Inf_LECTURES ? ActDelItmSylLec : ActDelItmSylPra); Syl_PutParamNumItem (); Ico_PutIconRemove (); @@ -628,7 +628,7 @@ static void Syl_ShowRowSyllabus (unsigned NumItem, LstItemsSyllabus.Lst[NumItem].HasChildren ? Txt_Move_up_X_and_its_subsections : Txt_Move_up_X, StrItemCod); - Lay_PutContextualLinkOnlyIcon (Gbl.Hierarchy.Crs.Info.Type == Inf_LECTURES ? ActUp_IteSylLec : + Lay_PutContextualLinkOnlyIcon (Gbl.Crs.Info.Type == Inf_LECTURES ? ActUp_IteSylLec : ActUp_IteSylPra, NULL,Syl_PutParamNumItem, "arrow-up.svg", @@ -647,7 +647,7 @@ static void Syl_ShowRowSyllabus (unsigned NumItem, LstItemsSyllabus.Lst[NumItem].HasChildren ? Txt_Move_down_X_and_its_subsections : Txt_Move_down_X, StrItemCod); - Lay_PutContextualLinkOnlyIcon (Gbl.Hierarchy.Crs.Info.Type == Inf_LECTURES ? ActDwnIteSylLec : + Lay_PutContextualLinkOnlyIcon (Gbl.Crs.Info.Type == Inf_LECTURES ? ActDwnIteSylLec : ActDwnIteSylPra, NULL,Syl_PutParamNumItem, "arrow-down.svg", @@ -664,7 +664,7 @@ static void Syl_ShowRowSyllabus (unsigned NumItem, snprintf (Gbl.Title,sizeof (Gbl.Title), Txt_Increase_level_of_X, StrItemCod); - Lay_PutContextualLinkOnlyIcon (Gbl.Hierarchy.Crs.Info.Type == Inf_LECTURES ? ActRgtIteSylLec : + Lay_PutContextualLinkOnlyIcon (Gbl.Crs.Info.Type == Inf_LECTURES ? ActRgtIteSylLec : ActRgtIteSylPra, NULL,Syl_PutParamNumItem, "arrow-left.svg", @@ -682,7 +682,7 @@ static void Syl_ShowRowSyllabus (unsigned NumItem, snprintf (Gbl.Title,sizeof (Gbl.Title), Txt_Decrease_level_of_X, StrItemCod); - Lay_PutContextualLinkOnlyIcon (Gbl.Hierarchy.Crs.Info.Type == Inf_LECTURES ? ActLftIteSylLec : + Lay_PutContextualLinkOnlyIcon (Gbl.Crs.Info.Type == Inf_LECTURES ? ActLftIteSylLec : ActLftIteSylPra, NULL,Syl_PutParamNumItem, "arrow-right.svg", @@ -746,7 +746,7 @@ int Syl_WriteSyllabusIntoHTMLBuffer (char **HTMLBuffer) *HTMLBuffer = NULL; /***** Load syllabus from XML file to list of items in memory *****/ - Syl_LoadListItemsSyllabusIntoMemory (Gbl.Hierarchy.Crs.Crs.CrsCod); + Syl_LoadListItemsSyllabusIntoMemory (Gbl.Hierarchy.Crs.CrsCod); if (LstItemsSyllabus.NumItems) { @@ -817,7 +817,7 @@ static void Syl_WriteSyllabusIntoHTMLTmpFile (FILE *FileHTMLTmp) int i; /***** Write start of HTML code *****/ - Lay_StartHTMLFile (FileHTMLTmp,Txt_INFO_TITLE[Gbl.Hierarchy.Crs.Info.Type]); + Lay_StartHTMLFile (FileHTMLTmp,Txt_INFO_TITLE[Gbl.Crs.Info.Type]); fprintf (FileHTMLTmp,"\n" "\n"); @@ -909,9 +909,9 @@ static void Syl_PutFormItemSyllabus (bool NewItem,unsigned NumItem,int Level,int /***** Text of the item *****/ fprintf (Gbl.F.Out,"", Txt_Group, - Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypName); + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypName); - if (Gbl.Hierarchy.Crs.Records.LstFields.Num) + if (Gbl.Crs.Records.LstFields.Num) { /* 3. Names of record fields that depend on the course */ for (NumField = 0; - NumField < Gbl.Hierarchy.Crs.Records.LstFields.Num; + NumField < Gbl.Crs.Records.LstFields.Num; NumField++) fprintf (Gbl.F.Out,"", - Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].Name); + Gbl.Crs.Records.LstFields.Lst[NumField].Name); /* 4. Visibility type for the record fields that depend on the course, in other row */ fprintf (Gbl.F.Out,"" @@ -6790,12 +6790,12 @@ void Usr_ListAllDataStds (void) fprintf (Gbl.F.Out,""); for (NumField = 0; - NumField < Gbl.Hierarchy.Crs.Records.LstFields.Num; + NumField < Gbl.Crs.Records.LstFields.Num; NumField++) fprintf (Gbl.F.Out,"", - Txt_RECORD_FIELD_VISIBILITY_RECORD[Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].Visibility]); + Txt_RECORD_FIELD_VISIBILITY_RECORD[Gbl.Crs.Records.LstFields.Lst[NumField].Visibility]); } } @@ -7364,7 +7364,7 @@ static void Usr_GetMyUsrListTypeFromDB (void) NumRows = DB_QuerySELECT (&mysql_res,"can not get type of listing of users", "SELECT UsrListType FROM crs_usr" " WHERE CrsCod=%ld AND UsrCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod); if (NumRows == 1) // Should be one only row { @@ -7404,7 +7404,7 @@ static void Usr_UpdateMyUsrListTypeInDB (void) "UPDATE crs_usr SET UsrListType='%s'" " WHERE CrsCod=%ld AND UsrCod=%ld", Usr_StringsUsrListTypeInDB[Gbl.Usrs.Me.ListType], - Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod); + Gbl.Hierarchy.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod); } /*****************************************************************************/ @@ -7468,7 +7468,7 @@ static void Usr_GetMyColsClassPhotoFromDB (void) " in class photo", "SELECT ColsClassPhoto FROM crs_usr" " WHERE CrsCod=%ld AND UsrCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod); if (NumRows == 1) // Should be one only row { @@ -7503,7 +7503,7 @@ static void Usr_UpdateMyColsClassPhotoInDB (void) "UPDATE crs_usr SET ColsClassPhoto=%u" " WHERE CrsCod=%ld AND UsrCod=%ld", Gbl.Usrs.ClassPhoto.Cols, - Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod); + Gbl.Hierarchy.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod); } /*****************************************************************************/ @@ -7565,14 +7565,14 @@ void Usr_GetMyPrefAboutListWithPhotosFromDB (void) Gbl.Usrs.Listing.WithPhotos = Usr_LIST_WITH_PHOTOS_DEF; /***** If no user logged or not course selected... *****/ - if (Gbl.Usrs.Me.Logged && Gbl.Hierarchy.Crs.Crs.CrsCod) + if (Gbl.Usrs.Me.Logged && Gbl.Hierarchy.Crs.CrsCod) { /***** Get if listing of users must show photos from database *****/ NumRows = DB_QuerySELECT (&mysql_res,"can not check if listing of users" " must show photos", "SELECT ListWithPhotos FROM crs_usr" " WHERE CrsCod=%ld AND UsrCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod); if (NumRows == 1) // Should be one only row { @@ -7605,7 +7605,7 @@ static void Usr_UpdateMyPrefAboutListWithPhotosPhotoInDB (void) " WHERE CrsCod=%ld AND UsrCod=%ld", Gbl.Usrs.Listing.WithPhotos ? 'Y' : 'N', - Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod); + Gbl.Hierarchy.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod); } /*****************************************************************************/ @@ -7879,7 +7879,7 @@ void Usr_SeeStudents (void) (Gbl.Scope.Current == Hie_CRS || Gbl.Scope.Current == Hie_DEG) ? Gbl.Hierarchy.Deg.DegCod : -1L, - Gbl.Scope.Current == Hie_CRS ? Gbl.Hierarchy.Crs.Crs.CrsCod : + Gbl.Scope.Current == Hie_CRS ? Gbl.Hierarchy.Crs.CrsCod : -1L); /* Set options allowed */ @@ -8051,7 +8051,7 @@ void Usr_SeeTeachers (void) (Gbl.Scope.Current == Hie_CRS || Gbl.Scope.Current == Hie_DEG) ? Gbl.Hierarchy.Deg.DegCod : -1L, - Gbl.Scope.Current == Hie_CRS ? Gbl.Hierarchy.Crs.Crs.CrsCod : + Gbl.Scope.Current == Hie_CRS ? Gbl.Hierarchy.Crs.CrsCod : -1L); /* Set options allowed */ @@ -8644,7 +8644,7 @@ void Usr_SeeStdClassPhotoPrn (void) (Gbl.Scope.Current == Hie_CRS || Gbl.Scope.Current == Hie_DEG) ? Gbl.Hierarchy.Deg.DegCod : -1L, - Gbl.Scope.Current == Hie_CRS ? Gbl.Hierarchy.Crs.Crs.CrsCod : + Gbl.Scope.Current == Hie_CRS ? Gbl.Hierarchy.Crs.CrsCod : -1L); Tbl_StartTableWide (0); Usr_DrawClassPhoto (Usr_CLASS_PHOTO_PRN, @@ -8711,7 +8711,7 @@ void Usr_SeeTchClassPhotoPrn (void) (Gbl.Scope.Current == Hie_CRS || Gbl.Scope.Current == Hie_DEG) ? Gbl.Hierarchy.Deg.DegCod : -1L, - Gbl.Scope.Current == Hie_CRS ? Gbl.Hierarchy.Crs.Crs.CrsCod : + Gbl.Scope.Current == Hie_CRS ? Gbl.Hierarchy.Crs.CrsCod : -1L); Tbl_StartTableWide (0); @@ -9157,7 +9157,7 @@ unsigned Usr_GetTotalNumberOfUsersInCourses (Hie_Level_t Scope,unsigned Roles) (unsigned) DB_QueryCOUNT ("can not get number of users", "SELECT COUNT(DISTINCT UsrCod) FROM crs_usr" " WHERE CrsCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); else NumUsrs = (unsigned) DB_QueryCOUNT ("can not get number of users", @@ -9165,7 +9165,7 @@ unsigned Usr_GetTotalNumberOfUsersInCourses (Hie_Level_t Scope,unsigned Roles) " FROM crs_usr" " WHERE CrsCod=%ld" " AND Role%s", - Gbl.Hierarchy.Crs.Crs.CrsCod,SubQueryRoles); + Gbl.Hierarchy.Crs.CrsCod,SubQueryRoles); break; default: Lay_WrongScopeExit (); @@ -9467,13 +9467,13 @@ float Usr_GetNumUsrsPerCrs (Rol_Role_t Role) switch (Role) { case Rol_UNK: - return (float) Gbl.Hierarchy.Crs.Crs.NumUsrs[Rol_UNK]; // Any user + return (float) Gbl.Hierarchy.Crs.NumUsrs[Rol_UNK]; // Any user case Rol_STD: - return (float) Gbl.Hierarchy.Crs.Crs.NumUsrs[Rol_STD]; // Students + return (float) Gbl.Hierarchy.Crs.NumUsrs[Rol_STD]; // Students case Rol_NET: - return (float) Gbl.Hierarchy.Crs.Crs.NumUsrs[Rol_UNK]; // Non-editing teachers + return (float) Gbl.Hierarchy.Crs.NumUsrs[Rol_UNK]; // Non-editing teachers case Rol_TCH: - return (float) Gbl.Hierarchy.Crs.Crs.NumUsrs[Rol_UNK]; // Teachers + return (float) Gbl.Hierarchy.Crs.NumUsrs[Rol_UNK]; // Teachers default: Lay_ShowErrorAndExit ("Wrong role."); break; // Not reached diff --git a/swad_web_service.c b/swad_web_service.c index c81ef244..64136ed9 100644 --- a/swad_web_service.c +++ b/swad_web_service.c @@ -513,7 +513,7 @@ static int Svc_GetCurrentDegCodFromCurrentCrsCod (void) /***** Check that key does not exist in database *****/ if (DB_QuerySELECT (&mysql_res,"can not get the degree of a course", "SELECT DegCod FROM courses WHERE CrsCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod)) // Course found in table of courses + Gbl.Hierarchy.Crs.CrsCod)) // Course found in table of courses { row = mysql_fetch_row (mysql_res); @@ -1024,15 +1024,15 @@ int swad__loginBySessionKey (struct soap *soap, row = mysql_fetch_row (mysql_res); /***** Get course (row[2]) *****/ - Gbl.Hierarchy.Crs.Crs.CrsCod = Str_ConvertStrCodToLongCod (row[2]); - Crs_GetDataOfCourseByCod (&Gbl.Hierarchy.Crs.Crs); - loginBySessionKeyOut->courseCode = (int) Gbl.Hierarchy.Crs.Crs.CrsCod; - Str_Copy (loginBySessionKeyOut->courseName,Gbl.Hierarchy.Crs.Crs.FullName, + Gbl.Hierarchy.Crs.CrsCod = Str_ConvertStrCodToLongCod (row[2]); + Crs_GetDataOfCourseByCod (&Gbl.Hierarchy.Crs); + loginBySessionKeyOut->courseCode = (int) Gbl.Hierarchy.Crs.CrsCod; + Str_Copy (loginBySessionKeyOut->courseName,Gbl.Hierarchy.Crs.FullName, Hie_MAX_BYTES_FULL_NAME); /***** Get user code (row[0]) *****/ Gbl.Usrs.Me.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[0]); - UsrFound = Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.Crs.CrsCod); // Get some user's data from database + UsrFound = Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.CrsCod); // Get some user's data from database /***** Get degree (row[1]) *****/ Gbl.Hierarchy.Deg.DegCod = Str_ConvertStrCodToLongCod (row[1]); @@ -1320,7 +1320,7 @@ int swad__getCourseInfo (struct soap *soap, /***** Initializations *****/ Gbl.soap = soap; Gbl.WebService.Function = Svc_getCourseInfo; - Gbl.Hierarchy.Crs.Crs.CrsCod = (long) courseCode; + Gbl.Hierarchy.Crs.CrsCod = (long) courseCode; /***** Check web service key *****/ if ((ReturnCode = Svc_CheckWSKey (wsKey)) != SOAP_OK) @@ -1331,11 +1331,11 @@ int swad__getCourseInfo (struct soap *soap, "Web service key does not exist in database"); /***** Check course and group codes *****/ - if ((ReturnCode = Svc_CheckCourseAndGroupCodes (Gbl.Hierarchy.Crs.Crs.CrsCod,-1L)) != SOAP_OK) + if ((ReturnCode = Svc_CheckCourseAndGroupCodes (Gbl.Hierarchy.Crs.CrsCod,-1L)) != SOAP_OK) return ReturnCode; /***** Get some of my data *****/ - if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.Crs.CrsCod)) + if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.CrsCod)) return soap_receiver_fault (Gbl.soap, "Can not get user's data from database", "User does not exist in database"); @@ -1360,8 +1360,8 @@ int swad__getCourseInfo (struct soap *soap, return soap_receiver_fault (Gbl.soap, "Bad info type", "Unknown requested info type"); - Gbl.Hierarchy.Crs.Info.Type = InfoType; - Inf_GetAndCheckInfoSrcFromDB (Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Hierarchy.Crs.Info.Type,&InfoSrc,&MustBeRead); + Gbl.Crs.Info.Type = InfoType; + Inf_GetAndCheckInfoSrcFromDB (Gbl.Hierarchy.Crs.CrsCod,Gbl.Crs.Info.Type,&InfoSrc,&MustBeRead); Length = strlen (NamesInWSForInfoSrc[InfoSrc]); getCourseInfo->infoSrc = (char *) soap_malloc (Gbl.soap,Length + 1); Str_Copy (getCourseInfo->infoSrc,NamesInWSForInfoSrc[InfoSrc], @@ -1377,7 +1377,7 @@ int swad__getCourseInfo (struct soap *soap, case Inf_INFO_SRC_NONE: // No info available break; case Inf_INFO_SRC_EDITOR: // Internal editor (only for syllabus) - switch (Gbl.Hierarchy.Crs.Info.Type) + switch (Gbl.Crs.Info.Type) { case Inf_LECTURES: // Syllabus (lectures) case Inf_PRACTICALS: // Syllabys (practicals) @@ -1424,7 +1424,7 @@ int swad__getUsers (struct soap *soap, /***** Initializations *****/ Gbl.soap = soap; Gbl.WebService.Function = Svc_getUsers; - Gbl.Hierarchy.Crs.Crs.CrsCod = (courseCode > 0) ? (long) courseCode : + Gbl.Hierarchy.Crs.CrsCod = (courseCode > 0) ? (long) courseCode : -1L; /***** Check web service key *****/ @@ -1436,11 +1436,11 @@ int swad__getUsers (struct soap *soap, "Web service key does not exist in database"); /***** Check course *****/ - if ((ReturnCode = Svc_CheckCourseAndGroupCodes (Gbl.Hierarchy.Crs.Crs.CrsCod,-1L)) != SOAP_OK) + if ((ReturnCode = Svc_CheckCourseAndGroupCodes (Gbl.Hierarchy.Crs.CrsCod,-1L)) != SOAP_OK) return ReturnCode; /***** Get some of my data *****/ - if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.Crs.CrsCod)) + if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.CrsCod)) return soap_receiver_fault (Gbl.soap, "Can not get user's data from database", "User does not exist in database"); @@ -1469,7 +1469,7 @@ int swad__getUsers (struct soap *soap, /***** Create a list of groups selected *****/ Svc_GetLstGrpsSel (groups); - if (Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps) + if (Gbl.Crs.Grps.LstGrpsSel.NumGrps) /***** Get list of groups types and groups in current course *****/ Grp_GetListGrpTypesInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS); @@ -1478,7 +1478,7 @@ int swad__getUsers (struct soap *soap, Svc_CopyListUsers (Role,getUsersOut); Usr_FreeUsrsList (Role); - if (Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps) + if (Gbl.Crs.Grps.LstGrpsSel.NumGrps) { /***** Free list of groups types and groups in current course *****/ Grp_FreeListGrpTypesAndGrps (); @@ -1502,7 +1502,7 @@ int swad__findUsers (struct soap *soap, /***** Initializations *****/ Gbl.soap = soap; Gbl.WebService.Function = Svc_findUsers; - Gbl.Hierarchy.Crs.Crs.CrsCod = (courseCode > 0) ? (long) courseCode : + Gbl.Hierarchy.Crs.CrsCod = (courseCode > 0) ? (long) courseCode : -1L; /***** Check web service key *****/ @@ -1515,11 +1515,11 @@ int swad__findUsers (struct soap *soap, if (Gbl.Hierarchy.Level == Hie_CRS) // Course selected /***** Check course *****/ - if ((ReturnCode = Svc_CheckCourseAndGroupCodes (Gbl.Hierarchy.Crs.Crs.CrsCod,-1L)) != SOAP_OK) + if ((ReturnCode = Svc_CheckCourseAndGroupCodes (Gbl.Hierarchy.Crs.CrsCod,-1L)) != SOAP_OK) return ReturnCode; /***** Get some of my data *****/ - if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.Crs.CrsCod)) + if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.CrsCod)) return soap_receiver_fault (Gbl.soap, "Can not get user's data from database", "User does not exist in database"); @@ -1659,7 +1659,7 @@ int swad__getGroupTypes (struct soap *soap, /***** Initializations *****/ Gbl.soap = soap; Gbl.WebService.Function = Svc_getGroupTypes; - Gbl.Hierarchy.Crs.Crs.CrsCod = (long) courseCode; + Gbl.Hierarchy.Crs.CrsCod = (long) courseCode; /***** Open groups of this course that must be opened if open time is in the past *****/ @@ -1674,13 +1674,13 @@ int swad__getGroupTypes (struct soap *soap, "Web service key does not exist in database"); /***** Check if course code is correct *****/ - if (Gbl.Hierarchy.Crs.Crs.CrsCod <= 0) + if (Gbl.Hierarchy.Crs.CrsCod <= 0) return soap_sender_fault (Gbl.soap, "Bad course code", "Course code must be a integer greater than 0"); /***** Get some of my data *****/ - if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.Crs.CrsCod)) + if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.CrsCod)) return soap_receiver_fault (Gbl.soap, "Can not get user's data from database", "User does not exist in database"); @@ -1772,7 +1772,7 @@ int swad__getGroups (struct soap *soap, /***** Initializations *****/ Gbl.soap = soap; Gbl.WebService.Function = Svc_getGroups; - Gbl.Hierarchy.Crs.Crs.CrsCod = (long) courseCode; + Gbl.Hierarchy.Crs.CrsCod = (long) courseCode; /***** Open groups of this course that must be opened if open time is in the past *****/ @@ -1787,13 +1787,13 @@ int swad__getGroups (struct soap *soap, "Web service key does not exist in database"); /***** Check if course code is correct *****/ - if (Gbl.Hierarchy.Crs.Crs.CrsCod <= 0) + if (Gbl.Hierarchy.Crs.CrsCod <= 0) return soap_sender_fault (Gbl.soap, "Bad course code", "Course code must be a integer greater than 0"); /***** Get some of my data *****/ - if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.Crs.CrsCod)) + if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.CrsCod)) return soap_receiver_fault (Gbl.soap, "Can not get user's data from database", "User does not exist in database"); @@ -1909,7 +1909,7 @@ int swad__sendMyGroups (struct soap *soap, /***** Initializations *****/ Gbl.soap = soap; Gbl.WebService.Function = Svc_sendMyGroups; - Gbl.Hierarchy.Crs.Crs.CrsCod = (long) courseCode; + Gbl.Hierarchy.Crs.CrsCod = (long) courseCode; /***** Check web service key *****/ if ((ReturnCode = Svc_CheckWSKey (wsKey)) != SOAP_OK) @@ -1920,13 +1920,13 @@ int swad__sendMyGroups (struct soap *soap, "Web service key does not exist in database"); /***** Check if course code is correct *****/ - if (Gbl.Hierarchy.Crs.Crs.CrsCod <= 0) + if (Gbl.Hierarchy.Crs.CrsCod <= 0) return soap_sender_fault (Gbl.soap, "Bad course code", "Course code must be a integer greater than 0"); /***** Get some of my data *****/ - if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.Crs.CrsCod)) + if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.CrsCod)) return soap_receiver_fault (Gbl.soap, "Can not get user's data from database", "User does not exist in database"); @@ -2130,7 +2130,7 @@ int swad__getAttendanceEvents (struct soap *soap, /***** Initializations *****/ Gbl.soap = soap; Gbl.WebService.Function = Svc_getAttendanceEvents; - Gbl.Hierarchy.Crs.Crs.CrsCod = (long) courseCode; + Gbl.Hierarchy.Crs.CrsCod = (long) courseCode; /***** Check web service key *****/ if ((ReturnCode = Svc_CheckWSKey (wsKey)) != SOAP_OK) @@ -2141,13 +2141,13 @@ int swad__getAttendanceEvents (struct soap *soap, "Web service key does not exist in database"); /***** Check if course code is correct *****/ - if (Gbl.Hierarchy.Crs.Crs.CrsCod <= 0) + if (Gbl.Hierarchy.Crs.CrsCod <= 0) return soap_sender_fault (Gbl.soap, "Bad course code", "Course code must be a integer greater than 0"); /***** Get some of my data *****/ - if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.Crs.CrsCod)) + if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.CrsCod)) return soap_receiver_fault (Gbl.soap, "Can not get user's data from database", "User does not exist in database"); @@ -2198,7 +2198,7 @@ int swad__getAttendanceEvents (struct soap *soap, /* Get user's code of the user who created the event (row[2]) */ Gbl.Usrs.Other.UsrDat.UsrCod = Str_ConvertStrCodToLongCod (row[2]); - if (Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Gbl.Hierarchy.Crs.Crs.CrsCod)) // Get some user's data from database + if (Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Gbl.Hierarchy.Crs.CrsCod)) // Get some user's data from database { Length = strlen (Gbl.Usrs.Other.UsrDat.Surname1); getAttendanceEventsOut->eventsArray.__ptr[NumAttEvent].userSurname1 = (char *) soap_malloc (Gbl.soap,Length + 1); @@ -2339,7 +2339,7 @@ int swad__sendAttendanceEvent (struct soap *soap, /***** Initializations *****/ Gbl.soap = soap; Gbl.WebService.Function = Svc_sendAttendanceEvent; - Gbl.Hierarchy.Crs.Crs.CrsCod = (long) courseCode; + Gbl.Hierarchy.Crs.CrsCod = (long) courseCode; /***** Check web service key *****/ if ((ReturnCode = Svc_CheckWSKey (wsKey)) != SOAP_OK) @@ -2350,13 +2350,13 @@ int swad__sendAttendanceEvent (struct soap *soap, "Web service key does not exist in database"); /***** Check if course code is correct *****/ - if (Gbl.Hierarchy.Crs.Crs.CrsCod <= 0) + if (Gbl.Hierarchy.Crs.CrsCod <= 0) return soap_sender_fault (Gbl.soap, "Bad course code", "Course code must be a integer greater than 0"); /***** Get some of my data *****/ - if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.Crs.CrsCod)) + if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.CrsCod)) return soap_receiver_fault (Gbl.soap, "Can not get user's data from database", "User does not exist in database"); @@ -2463,7 +2463,7 @@ int swad__removeAttendanceEvent (struct soap *soap, if (Att.AttCod > 0) // The event already exists { Att_GetDataOfAttEventByCod (&Att); - Gbl.Hierarchy.Crs.Crs.CrsCod = Att.CrsCod; + Gbl.Hierarchy.Crs.CrsCod = Att.CrsCod; } else return soap_receiver_fault (Gbl.soap, @@ -2471,13 +2471,13 @@ int swad__removeAttendanceEvent (struct soap *soap, "Attendance event does not exist"); /***** Check if course code is correct *****/ - if (Gbl.Hierarchy.Crs.Crs.CrsCod <= 0) + if (Gbl.Hierarchy.Crs.CrsCod <= 0) return soap_sender_fault (Gbl.soap, "Bad course code", "Course code must be a integer greater than 0"); /***** Get some of my data *****/ - if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.Crs.CrsCod)) + if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.CrsCod)) return soap_receiver_fault (Gbl.soap, "Can not get user's data from database", "User does not exist in database"); @@ -2513,15 +2513,15 @@ static void Svc_GetLstGrpsSel (const char *Groups) *Ptr; NumGrp++) Str_GetNextStringUntilComma (&Ptr,LongStr,1 + 10); - Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps = NumGrp; + Gbl.Crs.Grps.LstGrpsSel.NumGrps = NumGrp; /***** Create a list of groups selected *****/ - if (Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps) + if (Gbl.Crs.Grps.LstGrpsSel.NumGrps) { // Here NestedCalls is always 0 - Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NestedCalls++; + Gbl.Crs.Grps.LstGrpsSel.NestedCalls++; // Here NestedCalls is always 1 - if ((Gbl.Hierarchy.Crs.Grps.LstGrpsSel.GrpCods = (long *) calloc (Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps,sizeof (long))) == NULL) + if ((Gbl.Crs.Grps.LstGrpsSel.GrpCods = (long *) calloc (Gbl.Crs.Grps.LstGrpsSel.NumGrps,sizeof (long))) == NULL) Lay_NotEnoughMemoryExit (); for (Ptr = Groups, NumGrp = 0; @@ -2529,11 +2529,11 @@ static void Svc_GetLstGrpsSel (const char *Groups) ) { Str_GetNextStringUntilComma (&Ptr,LongStr,1 + 10); - Gbl.Hierarchy.Crs.Grps.LstGrpsSel.GrpCods[NumGrp] = Str_ConvertStrCodToLongCod (LongStr); - if (Grp_CheckIfGroupBelongsToCourse (Gbl.Hierarchy.Crs.Grps.LstGrpsSel.GrpCods[NumGrp],Gbl.Hierarchy.Crs.Crs.CrsCod)) + Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrp] = Str_ConvertStrCodToLongCod (LongStr); + if (Grp_CheckIfGroupBelongsToCourse (Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrp],Gbl.Hierarchy.Crs.CrsCod)) NumGrp++; } - Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps = NumGrp; // Update number of groups + Gbl.Crs.Grps.LstGrpsSel.NumGrps = NumGrp; // Update number of groups } } @@ -2569,10 +2569,10 @@ int swad__getAttendanceUsers (struct soap *soap, /***** Get course of this attendance event *****/ Att.AttCod = (long) attendanceEventCode; Att_GetDataOfAttEventByCod (&Att); - Gbl.Hierarchy.Crs.Crs.CrsCod = Att.CrsCod; + Gbl.Hierarchy.Crs.CrsCod = Att.CrsCod; /***** Get some of my data *****/ - if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.Crs.CrsCod)) + if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.CrsCod)) return soap_receiver_fault (Gbl.soap, "Can not get user's data from database", "User does not exist in database"); @@ -2761,10 +2761,10 @@ int swad__sendAttendanceUsers (struct soap *soap, Att.AttCod = (long) attendanceEventCode; if (!Att_GetDataOfAttEventByCod (&Att)) return SOAP_OK; // return with success = 0 - Gbl.Hierarchy.Crs.Crs.CrsCod = Att.CrsCod; + Gbl.Hierarchy.Crs.CrsCod = Att.CrsCod; /***** Get some of my data *****/ - if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.Crs.CrsCod)) + if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.CrsCod)) return soap_receiver_fault (Gbl.soap, "Can not get user's data from database", "User does not exist in database"); @@ -3511,7 +3511,7 @@ int swad__sendNotice (struct soap *soap, /***** Initializations *****/ Gbl.soap = soap; Gbl.WebService.Function = Svc_sendNotice; - Gbl.Hierarchy.Crs.Crs.CrsCod = (long) courseCode; + Gbl.Hierarchy.Crs.CrsCod = (long) courseCode; /***** Check web service key *****/ if ((ReturnCode = Svc_CheckWSKey (wsKey)) != SOAP_OK) @@ -3522,7 +3522,7 @@ int swad__sendNotice (struct soap *soap, "Web service key does not exist in database"); /***** Get some of my data *****/ - if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.Crs.CrsCod)) + if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.CrsCod)) return soap_receiver_fault (Gbl.soap, "Can not get user's data from database", "User does not exist in database"); @@ -3530,7 +3530,7 @@ int swad__sendNotice (struct soap *soap, Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role; /***** Check course and group codes *****/ - if ((ReturnCode = Svc_CheckCourseAndGroupCodes (Gbl.Hierarchy.Crs.Crs.CrsCod,-1L)) != SOAP_OK) + if ((ReturnCode = Svc_CheckCourseAndGroupCodes (Gbl.Hierarchy.Crs.CrsCod,-1L)) != SOAP_OK) return ReturnCode; /***** Get degree of current course *****/ @@ -3551,7 +3551,7 @@ int swad__sendNotice (struct soap *soap, " (CrsCod,UsrCod,CreatTime,Content,Status)" " VALUES" " (%ld,%ld,NOW(),'%s',%u)", - Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod, + Gbl.Hierarchy.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod, body,(unsigned) Not_ACTIVE_NOTICE); /***** Create notifications *****/ @@ -3578,7 +3578,7 @@ int swad__getTestConfig (struct soap *soap, /***** Initializations *****/ Gbl.soap = soap; Gbl.WebService.Function = Svc_getTestConfig; - Gbl.Hierarchy.Crs.Crs.CrsCod = (long) courseCode; + Gbl.Hierarchy.Crs.CrsCod = (long) courseCode; /***** Check web service key *****/ if ((ReturnCode = Svc_CheckWSKey (wsKey)) != SOAP_OK) @@ -3589,7 +3589,7 @@ int swad__getTestConfig (struct soap *soap, "Web service key does not exist in database"); /***** Get some of my data *****/ - if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.Crs.CrsCod)) + if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.CrsCod)) return soap_receiver_fault (Gbl.soap, "Can not get user's data from database", "User does not exist in database"); @@ -3597,7 +3597,7 @@ int swad__getTestConfig (struct soap *soap, Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role; /***** Check if course code is correct *****/ - if (Gbl.Hierarchy.Crs.Crs.CrsCod <= 0) + if (Gbl.Hierarchy.Crs.CrsCod <= 0) return soap_sender_fault (Gbl.soap, "Bad course code", "Course code must be a integer greater than 0"); @@ -3712,7 +3712,7 @@ int swad__getTests (struct soap *soap, /***** Initializations *****/ Gbl.soap = soap; Gbl.WebService.Function = Svc_getTests; - Gbl.Hierarchy.Crs.Crs.CrsCod = (long) courseCode; + Gbl.Hierarchy.Crs.CrsCod = (long) courseCode; /***** Check web service key *****/ if ((ReturnCode = Svc_CheckWSKey (wsKey)) != SOAP_OK) @@ -3723,7 +3723,7 @@ int swad__getTests (struct soap *soap, "Web service key does not exist in database"); /***** Get some of my data *****/ - if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.Crs.CrsCod)) + if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.CrsCod)) return soap_receiver_fault (Gbl.soap, "Can not get user's data from database", "User does not exist in database"); @@ -3731,7 +3731,7 @@ int swad__getTests (struct soap *soap, Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role; /***** Check if course code is correct *****/ - if (Gbl.Hierarchy.Crs.Crs.CrsCod <= 0) + if (Gbl.Hierarchy.Crs.CrsCod <= 0) return soap_sender_fault (Gbl.soap, "Bad course code", "Course code must be a integer greater than 0"); @@ -4121,7 +4121,7 @@ int swad__getTrivialQuestion (struct soap *soap, "Web service key does not exist in database"); /***** Get some of my data *****/ - if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.Crs.CrsCod)) + if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.CrsCod)) return soap_receiver_fault (Gbl.soap, "Can not get user's data from database", "User does not exist in database"); @@ -4331,8 +4331,8 @@ int swad__getDirectoryTree (struct soap *soap, /***** Initializations *****/ Gbl.soap = soap; Gbl.WebService.Function = Svc_getDirectoryTree; - Gbl.Hierarchy.Crs.Crs.CrsCod = (long) courseCode; - Gbl.Hierarchy.Crs.Grps.GrpCod = (long) groupCode; + Gbl.Hierarchy.Crs.CrsCod = (long) courseCode; + Gbl.Crs.Grps.GrpCod = (long) groupCode; /***** Check web service key *****/ if ((ReturnCode = Svc_CheckWSKey (wsKey)) != SOAP_OK) @@ -4342,7 +4342,7 @@ int swad__getDirectoryTree (struct soap *soap, "Bad web service key", "Web service key does not exist in database"); - if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.Crs.CrsCod)) + if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.CrsCod)) return soap_receiver_fault (Gbl.soap, "Can not get user's data from database", "User does not exist in database"); @@ -4350,7 +4350,7 @@ int swad__getDirectoryTree (struct soap *soap, Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role; /***** Check course and group codes *****/ - if ((ReturnCode = Svc_CheckCourseAndGroupCodes (Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Hierarchy.Crs.Grps.GrpCod)) != SOAP_OK) + if ((ReturnCode = Svc_CheckCourseAndGroupCodes (Gbl.Hierarchy.Crs.CrsCod,Gbl.Crs.Grps.GrpCod)) != SOAP_OK) return ReturnCode; /***** Check if I am a student, non-editing teacher or teacher in the course *****/ @@ -4362,8 +4362,8 @@ int swad__getDirectoryTree (struct soap *soap, "Requester must belong to course"); /***** Check if I belong to course/group *****/ - if (Gbl.Hierarchy.Crs.Grps.GrpCod > 0) - if (!Grp_GetIfIBelongToGrp (Gbl.Hierarchy.Crs.Grps.GrpCod)) + if (Gbl.Crs.Grps.GrpCod > 0) + if (!Grp_GetIfIBelongToGrp (Gbl.Crs.Grps.GrpCod)) return soap_receiver_fault (Gbl.soap, "Request forbidden", "Requester must belong to group"); @@ -4411,14 +4411,14 @@ int swad__getDirectoryTree (struct soap *soap, "Course code must be a integer greater than 0"); /* Initialize path to private directory */ - Gbl.Hierarchy.Crs.Crs.CrsCod = (courseCode > 0) ? (long) courseCode : + Gbl.Hierarchy.Crs.CrsCod = (courseCode > 0) ? (long) courseCode : -1L; - Gbl.Hierarchy.Crs.Grps.GrpCod = (groupCode > 0) ? (long) groupCode : + Gbl.Crs.Grps.GrpCod = (groupCode > 0) ? (long) groupCode : -1L; - snprintf (Gbl.Hierarchy.Crs.PathPriv,sizeof (Gbl.Hierarchy.Crs.PathPriv), + snprintf (Gbl.Crs.PathPriv,sizeof (Gbl.Crs.PathPriv), "%s/%ld", - Cfg_PATH_CRS_PRIVATE,Gbl.Hierarchy.Crs.Crs.CrsCod); + Cfg_PATH_CRS_PRIVATE,Gbl.Hierarchy.Crs.CrsCod); Brw_InitializeFileBrowser (); Brw_SetFullPathInTree (Brw_RootFolderInternalNames[Gbl.FileBrowser.Type],"."); @@ -4661,11 +4661,11 @@ int swad__getFile (struct soap *soap, &Gbl.Hierarchy.Ins.InsCod, &Gbl.Hierarchy.Ctr.CtrCod, &Gbl.Hierarchy.Deg.DegCod, - &Gbl.Hierarchy.Crs.Crs.CrsCod, - &Gbl.Hierarchy.Crs.Grps.GrpCod); + &Gbl.Hierarchy.Crs.CrsCod, + &Gbl.Crs.Grps.GrpCod); /***** Get some of my data *****/ - if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.Crs.CrsCod)) + if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.CrsCod)) return soap_receiver_fault (Gbl.soap, "Can not get user's data from database", "User does not exist in database"); @@ -4673,7 +4673,7 @@ int swad__getFile (struct soap *soap, Gbl.Usrs.Me.Role.Logged = Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role; /***** Check course and group codes *****/ - if ((ReturnCode = Svc_CheckCourseAndGroupCodes (Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Hierarchy.Crs.Grps.GrpCod)) != SOAP_OK) + if ((ReturnCode = Svc_CheckCourseAndGroupCodes (Gbl.Hierarchy.Crs.CrsCod,Gbl.Crs.Grps.GrpCod)) != SOAP_OK) return ReturnCode; /***** Check if I am a student, non-editing teacher or teacher in the course *****/ @@ -4685,8 +4685,8 @@ int swad__getFile (struct soap *soap, "Requester must belong to course"); /***** Check if I belong to group *****/ - if (Gbl.Hierarchy.Crs.Grps.GrpCod > 0) - if (!Grp_GetIfIBelongToGrp (Gbl.Hierarchy.Crs.Grps.GrpCod)) + if (Gbl.Crs.Grps.GrpCod > 0) + if (!Grp_GetIfIBelongToGrp (Gbl.Crs.Grps.GrpCod)) return soap_receiver_fault (Gbl.soap, "Request forbidden", "Requester must belong to group"); @@ -4804,15 +4804,15 @@ int swad__getMarks (struct soap *soap, &Gbl.Hierarchy.Ins.InsCod, &Gbl.Hierarchy.Ctr.CtrCod, &Gbl.Hierarchy.Deg.DegCod, - &Gbl.Hierarchy.Crs.Crs.CrsCod, - &Gbl.Hierarchy.Crs.Grps.GrpCod); + &Gbl.Hierarchy.Crs.CrsCod, + &Gbl.Crs.Grps.GrpCod); /***** Check course and group codes *****/ - if ((ReturnCode = Svc_CheckCourseAndGroupCodes (Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Hierarchy.Crs.Grps.GrpCod)) != SOAP_OK) + if ((ReturnCode = Svc_CheckCourseAndGroupCodes (Gbl.Hierarchy.Crs.CrsCod,Gbl.Crs.Grps.GrpCod)) != SOAP_OK) return ReturnCode; /***** Get some of my data *****/ - if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.Crs.CrsCod)) + if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.Hierarchy.Crs.CrsCod)) return soap_receiver_fault (Gbl.soap, "Can not get user's data from database", "User does not exist in database"); @@ -4828,8 +4828,8 @@ int swad__getMarks (struct soap *soap, "Requester must belong to course"); /***** Check if I belong to group *****/ - if (Gbl.Hierarchy.Crs.Grps.GrpCod > 0) - if (!Grp_GetIfIBelongToGrp (Gbl.Hierarchy.Crs.Grps.GrpCod)) + if (Gbl.Crs.Grps.GrpCod > 0) + if (!Grp_GetIfIBelongToGrp (Gbl.Crs.Grps.GrpCod)) return soap_receiver_fault (Gbl.soap, "Request forbidden", "Requester must belong to group"); diff --git a/swad_zip.c b/swad_zip.c index d62881b5..03bc472f 100644 --- a/swad_zip.c +++ b/swad_zip.c @@ -326,7 +326,7 @@ static void ZIP_CreateDirCompressionUsr (struct UsrData *UsrDat) /* Create path to folder and link */ snprintf (PathFolderUsrInsideCrs,sizeof (PathFolderUsrInsideCrs), "%s/usr/%02u/%ld", - Gbl.Hierarchy.Crs.PathPriv, + Gbl.Crs.PathPriv, (unsigned) (UsrDat->UsrCod % 100), UsrDat->UsrCod); snprintf (LinkTmpUsr,sizeof (LinkTmpUsr),
    ", LstItemsSyllabus.NumLevels - Level + 1,Gbl.RowEvenOdd); - Frm_StartForm (NewItem ? (Gbl.Hierarchy.Crs.Info.Type == Inf_LECTURES ? ActInsIteSylLec : + Frm_StartForm (NewItem ? (Gbl.Crs.Info.Type == Inf_LECTURES ? ActInsIteSylLec : ActInsIteSylPra) : - (Gbl.Hierarchy.Crs.Info.Type == Inf_LECTURES ? ActModIteSylLec : + (Gbl.Crs.Info.Type == Inf_LECTURES ? ActModIteSylLec : ActModIteSylPra)); Gbl.Syllabus.ParamNumItem = NumItem; Syl_PutParamNumItem (); @@ -988,7 +988,7 @@ void Syl_RemoveItemSyllabus (void) Syl_SetSyllabusTypeFromAction (); /***** Load syllabus from XML file to memory *****/ - Syl_LoadListItemsSyllabusIntoMemory (Gbl.Hierarchy.Crs.Crs.CrsCod); + Syl_LoadListItemsSyllabusIntoMemory (Gbl.Hierarchy.Crs.CrsCod); Gbl.Syllabus.EditionIsActive = true; @@ -1056,7 +1056,7 @@ void Syl_ChangePlaceItemSyllabus (Syl_ChangePosItem_t UpOrDownPos) Syl_SetSyllabusTypeFromAction (); /***** Load syllabus from XML file to memory *****/ - Syl_LoadListItemsSyllabusIntoMemory (Gbl.Hierarchy.Crs.Crs.CrsCod); + Syl_LoadListItemsSyllabusIntoMemory (Gbl.Hierarchy.Crs.CrsCod); Gbl.Syllabus.EditionIsActive = true; @@ -1246,7 +1246,7 @@ void Syl_ChangeLevelItemSyllabus (Syl_ChangeLevelItem_t IncreaseOrDecreaseLevel) Syl_SetSyllabusTypeFromAction (); /***** Load syllabus from XML file to memory *****/ - Syl_LoadListItemsSyllabusIntoMemory (Gbl.Hierarchy.Crs.Crs.CrsCod); + Syl_LoadListItemsSyllabusIntoMemory (Gbl.Hierarchy.Crs.CrsCod); Gbl.Syllabus.EditionIsActive = true; @@ -1305,7 +1305,7 @@ void Syl_InsertItemSyllabus (void) Syl_SetSyllabusTypeFromAction (); /***** Load syllabus from XML file to memory *****/ - Syl_LoadListItemsSyllabusIntoMemory (Gbl.Hierarchy.Crs.Crs.CrsCod); + Syl_LoadListItemsSyllabusIntoMemory (Gbl.Hierarchy.Crs.CrsCod); Gbl.Syllabus.EditionIsActive = true; @@ -1370,7 +1370,7 @@ void Syl_ModifyItemSyllabus (void) Syl_SetSyllabusTypeFromAction (); /***** Load syllabus from XML file to memory *****/ - Syl_LoadListItemsSyllabusIntoMemory (Gbl.Hierarchy.Crs.Crs.CrsCod); + Syl_LoadListItemsSyllabusIntoMemory (Gbl.Hierarchy.Crs.CrsCod); Gbl.Syllabus.EditionIsActive = true; diff --git a/swad_system.h b/swad_system.h new file mode 100644 index 00000000..69e3adb3 --- /dev/null +++ b/swad_system.h @@ -0,0 +1,49 @@ +// swad_system.h: top level of the hierarchy (system > countries > institutions > centres > degrees > courses) + +#ifndef _SWAD_SYS +#define _SWAD_SYS +/* + SWAD (Shared Workspace At a Distance in Spanish), + is a web platform developed at the University of Granada (Spain), + and used to support university teaching. + + This file is part of SWAD core. + Copyright (C) 1999-2019 Antonio Cañas Vargas + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ +/*****************************************************************************/ +/********************************* Headers ***********************************/ +/*****************************************************************************/ + +/*****************************************************************************/ +/************************** Public types and constants ***********************/ +/*****************************************************************************/ + +struct System + { + struct + { + unsigned Num; // Number of countries + struct Country *Lst; // List of countries + Cty_Order_t SelectedOrder; + // struct Country EditingCty; + } Ctys; + }; + +/*****************************************************************************/ +/***************************** Public prototypes *****************************/ +/*****************************************************************************/ + +#endif diff --git a/swad_tab.c b/swad_tab.c index 0cb81584..528904fa 100644 --- a/swad_tab.c +++ b/swad_tab.c @@ -183,7 +183,7 @@ static bool Tab_CheckIfICanViewTab (Tab_Tab_t Tab) Gbl.Hierarchy.Deg.DegCod <= 0); // No degree selected case TabDeg: return (Gbl.Hierarchy.Deg.DegCod > 0 && // Degree selected - Gbl.Hierarchy.Crs.Crs.CrsCod <= 0); // No course selected + Gbl.Hierarchy.Crs.CrsCod <= 0); // No course selected case TabCrs: return (Gbl.Hierarchy.Level == Hie_CRS); // Course selected case TabAss: @@ -294,7 +294,7 @@ void Tab_DisableIncompatibleTabs (void) /* falls through */ /* no break */ case TabDeg: - Gbl.Hierarchy.Crs.Crs.CrsCod = -1L; + Gbl.Hierarchy.Crs.CrsCod = -1L; break; default: break; diff --git a/swad_test.c b/swad_test.c index e78c5f91..66b13e42 100644 --- a/swad_test.c +++ b/swad_test.c @@ -462,7 +462,7 @@ void Tst_ShowNewTest (void) Lay_WriteHeaderClassPhoto (false,false, Gbl.Hierarchy.Ins.InsCod, Gbl.Hierarchy.Deg.DegCod, - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); /***** Start form *****/ Frm_StartForm (ActAssTst); @@ -561,7 +561,7 @@ void Tst_AssessTest (void) Lay_WriteHeaderClassPhoto (false,false, Gbl.Hierarchy.Ins.InsCod, Gbl.Hierarchy.Deg.DegCod, - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); /***** Header *****/ if (Gbl.Usrs.Me.IBelongToCurrentCrs) @@ -690,7 +690,7 @@ static bool Tst_CheckIfNextTstAllowed (void) " WHERE CrsCod=%ld AND UsrCod=%ld", Gbl.Test.Config.MinTimeNxtTstPerQst, Gbl.Test.Config.MinTimeNxtTstPerQst, - Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod) == 1) + Gbl.Hierarchy.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod) == 1) { /* Get seconds from now to next access to test */ row = mysql_fetch_row (mysql_res); @@ -741,7 +741,7 @@ static void Tst_SetTstStatus (unsigned NumTst,Tst_Status_t TstStatus) " (SessionId,CrsCod,NumTst,Status)" " VALUES" " ('%s',%ld,%u,%u)", - Gbl.Session.Id,Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Session.Id,Gbl.Hierarchy.Crs.CrsCod, NumTst,(unsigned) TstStatus); } @@ -764,7 +764,7 @@ static Tst_Status_t Tst_GetTstStatus (unsigned NumTst) " WHERE SessionId='%s'" " AND CrsCod=%ld" " AND NumTst=%u", - Gbl.Session.Id,Gbl.Hierarchy.Crs.Crs.CrsCod,NumTst); + Gbl.Session.Id,Gbl.Hierarchy.Crs.CrsCod,NumTst); if (NumRows == 1) { @@ -800,7 +800,7 @@ static unsigned Tst_GetNumAccessesTst (void) "SELECT NumAccTst" // row[0] " FROM crs_usr" " WHERE CrsCod=%ld AND UsrCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod); if (NumRows == 0) @@ -1258,7 +1258,7 @@ static void Tst_UpdateMyNumAccessTst (unsigned NumAccessesTst) "UPDATE crs_usr SET NumAccTst=%u" " WHERE CrsCod=%ld AND UsrCod=%ld", NumAccessesTst, - Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod); + Gbl.Hierarchy.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod); } /*****************************************************************************/ @@ -1272,7 +1272,7 @@ static void Tst_UpdateLastAccTst (void) "UPDATE crs_usr SET LastAccTst=NOW(),NumQstsLastTst=%u" " WHERE CrsCod=%ld AND UsrCod=%ld", Gbl.Test.NumQsts, - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod); } @@ -1615,7 +1615,7 @@ void Tst_RenameTag (void) "UPDATE tst_tags SET TagTxt='%s',ChangeTime=NOW()" " WHERE tst_tags.CrsCod=%ld" " AND tst_tags.TagTxt='%s'", - NewTagTxt,Gbl.Hierarchy.Crs.Crs.CrsCod,OldTagTxt); + NewTagTxt,Gbl.Hierarchy.Crs.CrsCod,OldTagTxt); } /***** Write message to show the change made *****/ @@ -1639,7 +1639,7 @@ static bool Tst_CheckIfCurrentCrsHasTestTags (void) return (DB_QueryCOUNT ("can not check if course has tags", "SELECT COUNT(*) FROM tst_tags" " WHERE CrsCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod) != 0); + Gbl.Hierarchy.Crs.CrsCod) != 0); } /*****************************************************************************/ @@ -1657,7 +1657,7 @@ static unsigned long Tst_GetAllTagsFromCurrentCrs (MYSQL_RES **mysql_res) " FROM tst_tags" " WHERE CrsCod=%ld" " ORDER BY TagTxt", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); } /*****************************************************************************/ @@ -1672,7 +1672,7 @@ static unsigned long Tst_GetEnabledTagsFromThisCrs (MYSQL_RES **mysql_res) "SELECT TagCod,TagTxt FROM tst_tags" " WHERE CrsCod=%ld AND TagHidden='N'" " ORDER BY TagTxt", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); } /*****************************************************************************/ @@ -2054,7 +2054,7 @@ static void Tst_GetConfigTstFromDB (void) "MinTimeNxtTstPerQst," // row[4] "Feedback" // row[5] " FROM tst_config WHERE CrsCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); Gbl.Test.Config.Feedback = Tst_FEEDBACK_DEFAULT; Gbl.Test.Config.MinTimeNxtTstPerQst = 0UL; @@ -2154,7 +2154,7 @@ bool Tst_CheckIfCourseHaveTestsAndPluggableIsUnknown (void) "SELECT Pluggable" // row[0] " FROM tst_config" " WHERE CrsCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); if (NumRows == 0) Gbl.Test.Config.Pluggable = Tst_PLUGGABLE_UNKNOWN; @@ -2235,7 +2235,7 @@ void Tst_ReceiveConfigTst (void) " (CrsCod,Pluggable,Min,Def,Max,MinTimeNxtTstPerQst,Feedback)" " VALUES" " (%ld,'%s',%u,%u,%u,'%lu','%s')", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Tst_PluggableDB[Gbl.Test.Config.Pluggable], Gbl.Test.Config.Min,Gbl.Test.Config.Def,Gbl.Test.Config.Max, Gbl.Test.Config.MinTimeNxtTstPerQst, @@ -2492,7 +2492,7 @@ static unsigned long Tst_GetQuestions (MYSQL_RES **mysql_res) Tst_MAX_BYTES_QUERY_TEST); snprintf (CrsCodStr,sizeof (CrsCodStr), "%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); Str_Concat (Query,CrsCodStr, Tst_MAX_BYTES_QUERY_TEST); Str_Concat (Query,"' AND tst_questions.EditTime>=FROM_UNIXTIME('", @@ -2663,9 +2663,9 @@ static unsigned long Tst_GetQuestionsForTest (MYSQL_RES **mysql_res) " AND tst_questions.QstCod=tst_question_tags.QstCod" " AND tst_question_tags.TagCod=tst_tags.TagCod" " AND tst_tags.CrsCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod, - Gbl.Hierarchy.Crs.Crs.CrsCod, - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod); if (!Gbl.Test.Tags.All) // User has not selected all the tags { @@ -4648,7 +4648,7 @@ unsigned long Tst_GetTagsQst (long QstCod,MYSQL_RES **mysql_res) " AND tst_question_tags.TagCod=tst_tags.TagCod" " AND tst_tags.CrsCod=%ld" " ORDER BY tst_question_tags.TagInd", - QstCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + QstCod,Gbl.Hierarchy.Crs.CrsCod); } /*****************************************************************************/ @@ -5518,7 +5518,7 @@ static void Tst_GetQstDataFromDB (char Stem[Cns_MAX_BYTES_TEXT + 1], "MedCod" // row[4] " FROM tst_questions" " WHERE QstCod=%ld AND CrsCod=%ld", - Gbl.Test.QstCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Test.QstCod,Gbl.Hierarchy.Crs.CrsCod); row = mysql_fetch_row (mysql_res); /* Get the type of answer */ @@ -5645,7 +5645,7 @@ static long Tst_GetMedCodFromDB (int NumOpt) "SELECT MedCod" // row[0] " FROM tst_questions" " WHERE QstCod=%ld AND CrsCod=%ld", - Gbl.Test.QstCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Test.QstCod,Gbl.Hierarchy.Crs.CrsCod); else // Get media associated to answer NumRows = DB_QuerySELECT (&mysql_res,"can not get media", @@ -6229,7 +6229,7 @@ static long Tst_GetTagCodFromTagTxt (const char *TagTxt) NumRows = DB_QuerySELECT (&mysql_res,"can not get tag", "SELECT TagCod FROM tst_tags" " WHERE CrsCod=%ld AND TagTxt='%s'", - Gbl.Hierarchy.Crs.Crs.CrsCod,TagTxt); + Gbl.Hierarchy.Crs.CrsCod,TagTxt); if (NumRows == 1) { /***** Get tag code *****/ @@ -6280,7 +6280,7 @@ static void Tst_EnableOrDisableTag (long TagCod,bool TagHidden) " WHERE TagCod=%ld AND CrsCod=%ld", TagHidden ? 'Y' : 'N', - TagCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + TagCod,Gbl.Hierarchy.Crs.CrsCod); } /*****************************************************************************/ @@ -6377,7 +6377,7 @@ void Tst_RemoveQst (void) /***** Remove media associated to question *****/ /* Remove media associated to answers */ - Tst_RemoveMediaFromAllAnsOfQst (Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Test.QstCod); + Tst_RemoveMediaFromAllAnsOfQst (Gbl.Hierarchy.Crs.CrsCod,Gbl.Test.QstCod); /* Remove media associated to stem */ MedCod = Tst_GetMedCodFromDB (-1L); @@ -6393,7 +6393,7 @@ void Tst_RemoveQst (void) DB_QueryDELETE ("can not remove a question", "DELETE FROM tst_questions" " WHERE QstCod=%ld AND CrsCod=%ld", - Gbl.Test.QstCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Test.QstCod,Gbl.Hierarchy.Crs.CrsCod); if (!mysql_affected_rows (&Gbl.mysql)) Lay_ShowErrorAndExit ("The question to be removed does not exist or belongs to another course."); @@ -6435,7 +6435,7 @@ void Tst_ChangeShuffleQst (void) " WHERE QstCod=%ld AND CrsCod=%ld", Shuffle ? 'Y' : 'N', - Gbl.Test.QstCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Test.QstCod,Gbl.Hierarchy.Crs.CrsCod); /***** Write message *****/ Ale_ShowAlert (Ale_SUCCESS,Shuffle ? Txt_The_answers_of_the_question_with_code_X_will_appear_shuffled : @@ -6506,7 +6506,7 @@ static void Tst_InsertOrUpdateQstIntoDB (void) " (%ld,NOW(),'%s','%c'," "'%s','%s',%ld," "0,0)", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Tst_StrAnswerTypesDB[Gbl.Test.AnswerType], Gbl.Test.Shuffle ? 'Y' : 'N', @@ -6529,7 +6529,7 @@ static void Tst_InsertOrUpdateQstIntoDB (void) Gbl.Test.Stem.Text, Gbl.Test.Feedback.Text ? Gbl.Test.Feedback.Text : "", Gbl.Test.Media.MedCod, - Gbl.Test.QstCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Test.QstCod,Gbl.Hierarchy.Crs.CrsCod); /* Remove answers and tags from this test question */ Tst_RemAnsFromQst (); @@ -6556,7 +6556,7 @@ static void Tst_InsertTagsIntoDB (void) /***** Check if this tag exists for current course *****/ if ((TagCod = Tst_GetTagCodFromTagTxt (Gbl.Test.Tags.Txt[NumTag])) < 0) /* This tag is new for current course. Add it to tags table */ - TagCod = Tst_CreateNewTag (Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Test.Tags.Txt[NumTag]); + TagCod = Tst_CreateNewTag (Gbl.Hierarchy.Crs.CrsCod,Gbl.Test.Tags.Txt[NumTag]); /***** Insert tag in tst_question_tags *****/ DB_QueryINSERT ("can not create tag", @@ -6683,8 +6683,8 @@ static void Tst_RemoveUnusedTagsFromCurrentCrs (void) " FROM tst_questions,tst_question_tags" " WHERE tst_questions.CrsCod=%ld" " AND tst_questions.QstCod=tst_question_tags.QstCod)", - Gbl.Hierarchy.Crs.Crs.CrsCod, - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod); } /*****************************************************************************/ @@ -6908,13 +6908,13 @@ static unsigned Tst_GetNumTstQuestions (Hie_Level_t Scope,Tst_AnswerType_t AnsTy "SELECT COUNT(*),SUM(NumHits),SUM(Score)" " FROM tst_questions" " WHERE CrsCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); else DB_QuerySELECT (&mysql_res,"can not get number of test questions", "SELECT COUNT(*),SUM(NumHits),SUM(Score)" " FROM tst_questions" " WHERE CrsCod=%ld AND AnsType='%s'", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Tst_StrAnswerTypesDB[AnsType]); break; default: @@ -7077,7 +7077,7 @@ static unsigned Tst_GetNumCoursesWithTstQuestions (Hie_Level_t Scope,Tst_AnswerT "SELECT COUNT(DISTINCT CrsCod)" " FROM tst_questions" " WHERE CrsCod=%ld", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); else DB_QuerySELECT (&mysql_res,"can not get number of courses" " with test questions", @@ -7085,7 +7085,7 @@ static unsigned Tst_GetNumCoursesWithTstQuestions (Hie_Level_t Scope,Tst_AnswerT " FROM tst_questions" " WHERE CrsCod=%ld" " AND AnsType='%s'", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Tst_StrAnswerTypesDB[AnsType]); break; default: @@ -7264,7 +7264,7 @@ static unsigned Tst_GetNumCoursesWithPluggableTstQuestions (Hie_Level_t Scope,Ts " WHERE tst_questions.CrsCod=%ld" " AND tst_questions.CrsCod=tst_config.CrsCod" " AND tst_config.pluggable='%s'", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Tst_PluggableDB[Tst_PLUGGABLE_YES]); else DB_QuerySELECT (&mysql_res,"can not get number of courses" @@ -7275,7 +7275,7 @@ static unsigned Tst_GetNumCoursesWithPluggableTstQuestions (Hie_Level_t Scope,Ts " AND tst_questions.AnsType='%s'" " AND tst_questions.CrsCod=tst_config.CrsCod" " AND tst_config.pluggable='%s'", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Tst_StrAnswerTypesDB[AnsType], Tst_PluggableDB[Tst_PLUGGABLE_YES]); break; @@ -7434,7 +7434,7 @@ static long Tst_CreateTestResultInDB (void) " (CrsCod,UsrCod,AllowTeachers,TstTime,NumQsts)" " VALUES" " (%ld,%ld,'%c',NOW(),%u)", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Gbl.Usrs.Me.UsrDat.UsrCod, Gbl.Test.AllowTeachers ? 'Y' : 'N', @@ -7630,7 +7630,7 @@ static void Tst_ShowTestResults (struct UsrData *UsrDat) " AND TstTime>=FROM_UNIXTIME(%ld)" " AND TstTime<=FROM_UNIXTIME(%ld)" " ORDER BY TstCod", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, UsrDat->UsrCod, (long) Gbl.DateRange.TimeUTC[0], (long) Gbl.DateRange.TimeUTC[1]); @@ -8067,7 +8067,7 @@ void Tst_ShowOneTestResult (void) Lay_WriteHeaderClassPhoto (false,false, Gbl.Hierarchy.Ins.InsCod, Gbl.Hierarchy.Deg.DegCod, - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); /***** Start table *****/ Tbl_StartTableWideMargin (10); @@ -8290,7 +8290,7 @@ static void Tst_GetTestResultDataByTstCod (long TstCod,time_t *TstTimeUTC, " FROM tst_exams" " WHERE TstCod=%ld AND CrsCod=%ld", TstCod, - Gbl.Hierarchy.Crs.Crs.CrsCod) == 1) + Gbl.Hierarchy.Crs.CrsCod) == 1) { row = mysql_fetch_row (mysql_res); diff --git a/swad_test_import.c b/swad_test_import.c index 8dc85a10..7bd5fae4 100644 --- a/swad_test_import.c +++ b/swad_test_import.c @@ -719,7 +719,7 @@ static bool TsI_CheckIfQuestionExistsInDB (void) " if a question exists", "SELECT QstCod FROM tst_questions" " WHERE CrsCod=%ld AND AnsType='%s' AND Stem='%s'", - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, Tst_StrAnswerTypesDB[Gbl.Test.AnswerType], Gbl.Test.Stem.Text); diff --git a/swad_timeline.c b/swad_timeline.c index 28e3f7db..9fb5968f 100644 --- a/swad_timeline.c +++ b/swad_timeline.c @@ -1985,7 +1985,7 @@ static void TL_PutFormGoToAction (const struct TL_Note *SocNot) case TL_NOTE_CRS_SHA_PUB_FILE: Frm_StartFormUnique (TL_DefaultActions[SocNot->NoteType]); Brw_PutHiddenParamFilCod (SocNot->Cod); - if (SocNot->HieCod != Gbl.Hierarchy.Crs.Crs.CrsCod) // Not the current course + if (SocNot->HieCod != Gbl.Hierarchy.Crs.CrsCod) // Not the current course Crs_PutParamCrsCod (SocNot->HieCod); // Go to another course break; case TL_NOTE_EXAM_ANNOUNCEMENT: @@ -1994,7 +1994,7 @@ static void TL_PutFormGoToAction (const struct TL_Note *SocNot) Anchor); // Locate on this specific exam Exa_FreeAnchorStr (Anchor); Exa_PutHiddenParamExaCod (SocNot->Cod); - if (SocNot->HieCod != Gbl.Hierarchy.Crs.Crs.CrsCod) // Not the current course + if (SocNot->HieCod != Gbl.Hierarchy.Crs.CrsCod) // Not the current course Crs_PutParamCrsCod (SocNot->HieCod); // Go to another course break; case TL_NOTE_POST: // Not applicable @@ -2008,7 +2008,7 @@ static void TL_PutFormGoToAction (const struct TL_Note *SocNot) Gbl.Forum.ForumSelected.Location, Gbl.Forum.ForumSelected.ThrCod, -1L); - if (SocNot->HieCod != Gbl.Hierarchy.Crs.Crs.CrsCod) // Not the current course + if (SocNot->HieCod != Gbl.Hierarchy.Crs.CrsCod) // Not the current course Crs_PutParamCrsCod (SocNot->HieCod); // Go to another course break; case TL_NOTE_NOTICE: @@ -2017,7 +2017,7 @@ static void TL_PutFormGoToAction (const struct TL_Note *SocNot) Anchor); Not_FreeAnchorStr (Anchor); Not_PutHiddenParamNotCod (SocNot->Cod); - if (SocNot->HieCod != Gbl.Hierarchy.Crs.Crs.CrsCod) // Not the current course + if (SocNot->HieCod != Gbl.Hierarchy.Crs.CrsCod) // Not the current course Crs_PutParamCrsCod (SocNot->HieCod); // Go to another course break; default: // Not applicable @@ -2109,7 +2109,7 @@ void TL_StoreAndPublishNote (TL_NoteType_t NoteType,long Cod,struct TL_Publicati case TL_NOTE_CRS_SHA_PUB_FILE: case TL_NOTE_EXAM_ANNOUNCEMENT: case TL_NOTE_NOTICE: - HieCod = Gbl.Hierarchy.Crs.Crs.CrsCod; + HieCod = Gbl.Hierarchy.Crs.CrsCod; break; default: HieCod = -1L; diff --git a/swad_timetable.c b/swad_timetable.c index d4bccb96..6d136876 100644 --- a/swad_timetable.c +++ b/swad_timetable.c @@ -232,7 +232,7 @@ static void TT_ShowTimeTableGrpsSelected (void) extern const char *Txt_All_groups; fprintf (Gbl.F.Out,"
    "); - switch (Gbl.Hierarchy.Crs.Grps.WhichGrps) + switch (Gbl.Crs.Grps.WhichGrps) { case Grp_ONLY_MY_GROUPS: fprintf (Gbl.F.Out,Txt_Groups_OF_A_USER, @@ -364,7 +364,7 @@ void TT_ShowClassTimeTable (void) /***** Start time table drawing *****/ if (Gbl.TimeTable.Type == TT_COURSE_TIMETABLE) Lay_WriteHeaderClassPhoto (PrintView,false, - Gbl.Hierarchy.Ins.InsCod,Gbl.Hierarchy.Deg.DegCod,Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Ins.InsCod,Gbl.Hierarchy.Deg.DegCod,Gbl.Hierarchy.Crs.CrsCod); if (PrintView) /***** Show whether only my groups or all groups are selected *****/ @@ -377,7 +377,7 @@ void TT_ShowClassTimeTable (void) /* Select whether show only my groups or all groups */ if ( Gbl.TimeTable.Type == TT_MY_TIMETABLE || (Gbl.TimeTable.Type == TT_COURSE_TIMETABLE && - Gbl.Hierarchy.Crs.Grps.NumGrps)) + Gbl.Crs.Grps.NumGrps)) TT_PutFormToSelectWhichGroupsToShow (); /* Show form to change first day of week */ @@ -536,7 +536,7 @@ void TT_ShowTimeTable (long UsrCod) switch (Gbl.TimeTable.Type) { case TT_COURSE_TIMETABLE: - TT_WriteCrsTimeTableIntoDB (Gbl.Hierarchy.Crs.Crs.CrsCod); + TT_WriteCrsTimeTableIntoDB (Gbl.Hierarchy.Crs.CrsCod); break; case TT_TUTORING_TIMETABLE: TT_WriteTutTimeTableIntoDB (UsrCod); @@ -681,7 +681,7 @@ static void TT_FillTimeTableFromDB (long UsrCod) switch (Gbl.TimeTable.Type) { case TT_MY_TIMETABLE: - switch (Gbl.Hierarchy.Crs.Grps.WhichGrps) + switch (Gbl.Crs.Grps.WhichGrps) { case Grp_ONLY_MY_GROUPS: NumRows = DB_QuerySELECT (&mysql_res,"can not get timetable", @@ -750,7 +750,7 @@ static void TT_FillTimeTableFromDB (long UsrCod) } break; case TT_COURSE_TIMETABLE: - if (Gbl.Hierarchy.Crs.Grps.WhichGrps == Grp_ALL_GROUPS || + if (Gbl.Crs.Grps.WhichGrps == Grp_ALL_GROUPS || Gbl.Action.Act == ActEdiCrsTT || Gbl.Action.Act == ActChgCrsTT) // If we are editing, all groups are shown NumRows = DB_QuerySELECT (&mysql_res,"can not get timetable", @@ -764,7 +764,7 @@ static void TT_FillTimeTableFromDB (long UsrCod) " WHERE CrsCod=%ld" " ORDER BY Weekday,S,ClassType," "GrpCod,Info,D DESC", - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); else NumRows = DB_QuerySELECT (&mysql_res,"can not get timetable", "SELECT timetable_crs.Weekday," @@ -790,8 +790,8 @@ static void TT_FillTimeTableFromDB (long UsrCod) " AND timetable_crs.GrpCod=crs_grp_usr.GrpCod" " ORDER BY Weekday,S,ClassType," "GrpCod,Info,D DESC", - Gbl.Hierarchy.Crs.Crs.CrsCod,UsrCod, - Gbl.Hierarchy.Crs.Crs.CrsCod,UsrCod); + Gbl.Hierarchy.Crs.CrsCod,UsrCod, + Gbl.Hierarchy.Crs.CrsCod,UsrCod); break; case TT_TUTORING_TIMETABLE: NumRows = DB_QuerySELECT (&mysql_res,"can not get timetable", @@ -981,7 +981,7 @@ static void TT_FillTimeTableFromDB (long UsrCod) /* Course code (row[6]) */ TT_TimeTable[Weekday][Interval].Columns[FirstFreeColumn].CrsCod = (Gbl.TimeTable.Type == TT_MY_TIMETABLE ? Str_ConvertStrCodToLongCod (row[6]) : - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); /* falls through */ /* no break */ case TT_TUTORING_TIMETABLE: @@ -1639,10 +1639,10 @@ static void TT_TimeTableDrawCell (unsigned Weekday,unsigned Interval,unsigned Co fprintf (Gbl.F.Out," selected=\"selected\""); fprintf (Gbl.F.Out,">%s",Txt_All_groups); for (NumGrpTyp = 0; - NumGrpTyp < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num; + NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num; NumGrpTyp++) { - GrpTyp = &Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp]; + GrpTyp = &Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp]; for (NumGrp = 0; NumGrp < GrpTyp->NumGrps; diff --git a/swad_user.c b/swad_user.c index 1e6b5ae3..03b2d940 100644 --- a/swad_user.c +++ b/swad_user.c @@ -584,7 +584,7 @@ void Usr_GetUsrDataFromUsrCod (struct UsrData *UsrDat,Usr_GetPrefs_t GetPrefs) /* Get roles */ UsrDat->Roles.InCurrentCrs.Role = Rol_GetRoleUsrInCrs (UsrDat->UsrCod, - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); UsrDat->Roles.InCurrentCrs.Valid = true; UsrDat->Roles.InCrss = -1; // Force roles to be got from database Rol_GetRolesInAllCrssIfNotYetGot (UsrDat); @@ -1190,7 +1190,7 @@ bool Usr_CheckIfICanViewRecordStd (const struct UsrData *UsrDat) return false; /***** 3. Fast check: Is it a course selected? *****/ - if (Gbl.Hierarchy.Crs.Crs.CrsCod <= 0) + if (Gbl.Hierarchy.Crs.CrsCod <= 0) return false; /***** 4. Fast check: Is he/she a student? *****/ @@ -1245,7 +1245,7 @@ bool Usr_CheckIfICanViewRecordTch (struct UsrData *UsrDat) return false; /***** 3. Fast check: Is it a course selected? *****/ - if (Gbl.Hierarchy.Crs.Crs.CrsCod <= 0) + if (Gbl.Hierarchy.Crs.CrsCod <= 0) return false; /***** 4. Fast check: Is he/she a non-editing teacher or a teacher? *****/ @@ -1270,7 +1270,7 @@ bool Usr_CheckIfICanViewTst (const struct UsrData *UsrDat) return false; /***** 3. Fast check: Is it a course selected? *****/ - if (Gbl.Hierarchy.Crs.Crs.CrsCod <= 0) + if (Gbl.Hierarchy.Crs.CrsCod <= 0) return false; /***** 4. Fast check: Am I a system admin? *****/ @@ -1319,7 +1319,7 @@ bool Usr_CheckIfICanViewAsgWrk (const struct UsrData *UsrDat) return false; /***** 3. Fast check: Is it a course selected? *****/ - if (Gbl.Hierarchy.Crs.Crs.CrsCod <= 0) + if (Gbl.Hierarchy.Crs.CrsCod <= 0) return false; /***** 4. Fast check: Does he/she belong to the current course? *****/ @@ -1369,7 +1369,7 @@ bool Usr_CheckIfICanViewAtt (const struct UsrData *UsrDat) return false; /***** 3. Fast check: Is it a course selected? *****/ - if (Gbl.Hierarchy.Crs.Crs.CrsCod <= 0) + if (Gbl.Hierarchy.Crs.CrsCod <= 0) return false; /***** 4. Fast check: Is he/she a student in the current course? *****/ @@ -2048,7 +2048,7 @@ bool Usr_CheckIfUsrBelongsToCurrentCrs (const struct UsrData *UsrDat) { /***** 1. Fast check: Trivial cases *****/ if (UsrDat->UsrCod <= 0 || - Gbl.Hierarchy.Crs.Crs.CrsCod <= 0) + Gbl.Hierarchy.Crs.CrsCod <= 0) return false; /***** 2. Fast check: If cached... *****/ @@ -2068,7 +2068,7 @@ bool Usr_CheckIfUsrBelongsToCurrentCrs (const struct UsrData *UsrDat) /***** 4. Fast / slow check: Get if user belongs to current course *****/ Gbl.Cache.UsrBelongsToCurrentCrs.UsrCod = UsrDat->UsrCod; Gbl.Cache.UsrBelongsToCurrentCrs.Belongs = Usr_CheckIfUsrBelongsToCrs (UsrDat->UsrCod, - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, false); return Gbl.Cache.UsrBelongsToCurrentCrs.Belongs; } @@ -2088,7 +2088,7 @@ bool Usr_CheckIfUsrHasAcceptedInCurrentCrs (const struct UsrData *UsrDat) { /***** 1. Fast check: Trivial cases *****/ if (UsrDat->UsrCod <= 0 || - Gbl.Hierarchy.Crs.Crs.CrsCod <= 0) + Gbl.Hierarchy.Crs.CrsCod <= 0) return false; /***** 2. Fast check: If cached... *****/ @@ -2099,7 +2099,7 @@ bool Usr_CheckIfUsrHasAcceptedInCurrentCrs (const struct UsrData *UsrDat) and has accepted *****/ Gbl.Cache.UsrHasAcceptedInCurrentCrs.UsrCod = UsrDat->UsrCod; Gbl.Cache.UsrHasAcceptedInCurrentCrs.Accepted = Usr_CheckIfUsrBelongsToCrs (UsrDat->UsrCod, - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, true); return Gbl.Cache.UsrHasAcceptedInCurrentCrs.Accepted; } @@ -3395,7 +3395,7 @@ static void Usr_SetMyPrefsAndRoles (void) if (Gbl.Hierarchy.Level == Hie_CRS) // Course selected { Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Role = Rol_GetRoleUsrInCrs (Gbl.Usrs.Me.UsrDat.UsrCod, - Gbl.Hierarchy.Crs.Crs.CrsCod); + Gbl.Hierarchy.Crs.CrsCod); Gbl.Usrs.Me.UsrDat.Roles.InCurrentCrs.Valid = true; } @@ -3838,22 +3838,22 @@ static void Usr_WriteRowStdAllData (struct UsrData *UsrDat,char *GroupNames) { /***** Write the groups a the que pertenece the student *****/ for (NumGrpTyp = 0; - NumGrpTyp < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num; + NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num; NumGrpTyp++) - if (Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) // If current course tiene groups of este type + if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) // If current course tiene groups of este type { - Grp_GetNamesGrpsStdBelongsTo (Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod, + Grp_GetNamesGrpsStdBelongsTo (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod, UsrDat->UsrCod,GroupNames); Usr_WriteUsrData (Gbl.ColorRows[Gbl.RowEvenOdd],GroupNames,NULL,true,UsrDat->Accepted); } /***** Fields of the record dependientes of the course *****/ for (NumField = 0; - NumField < Gbl.Hierarchy.Crs.Records.LstFields.Num; + NumField < Gbl.Crs.Records.LstFields.Num; NumField++) { /* Get the text of the field */ - if (Rec_GetFieldFromCrsRecord (UsrDat->UsrCod,Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].FieldCod,&mysql_res)) + if (Rec_GetFieldFromCrsRecord (UsrDat->UsrCod,Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod,&mysql_res)) { row = mysql_fetch_row (mysql_res); Str_Copy (Text,row[0], @@ -4427,7 +4427,7 @@ static void Usr_BuildQueryToGetUsrsLstCrs (char **Query,Rol_Role_t Role) /***** If there are no groups selected, don't do anything *****/ if (!Gbl.Usrs.ClassPhoto.AllGroups && - !Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps) + !Gbl.Crs.Grps.LstGrpsSel.NumGrps) { *Query = NULL; return; @@ -4447,7 +4447,7 @@ static void Usr_BuildQueryToGetUsrsLstCrs (char **Query,Rol_Role_t Role) " (SELECT ToUsrCod FROM msg_banned WHERE FromUsrCod=%ld)" " AND crs_usr.UsrCod=usr_data.UsrCod", // Do not get banned users QueryFields, - Gbl.Hierarchy.Crs.Crs.CrsCod,(unsigned) Role, + Gbl.Hierarchy.Crs.CrsCod,(unsigned) Role, Gbl.Usrs.Me.UsrDat.UsrCod); else snprintf (*Query,Usr_MAX_BYTES_QUERY_GET_LIST_USRS + 1, @@ -4456,7 +4456,7 @@ static void Usr_BuildQueryToGetUsrsLstCrs (char **Query,Rol_Role_t Role) " AND crs_usr.Role=%u" " AND crs_usr.UsrCod=usr_data.UsrCod", QueryFields, - Gbl.Hierarchy.Crs.Crs.CrsCod,(unsigned) Role); + Gbl.Hierarchy.Crs.CrsCod,(unsigned) Role); /***** Select users in selected groups *****/ if (!Gbl.Usrs.ClassPhoto.AllGroups) @@ -4465,30 +4465,30 @@ static void Usr_BuildQueryToGetUsrsLstCrs (char **Query,Rol_Role_t Role) Grp_GetListGrpTypesInThisCrs (Grp_ONLY_GROUP_TYPES_WITH_GROUPS); /***** Allocate memory for list of booleans AddStdsWithoutGroupOf *****/ - if ((AddStdsWithoutGroupOf = (bool *) calloc (Gbl.Hierarchy.Crs.Grps.GrpTypes.Num,sizeof (bool))) == NULL) + if ((AddStdsWithoutGroupOf = (bool *) calloc (Gbl.Crs.Grps.GrpTypes.Num,sizeof (bool))) == NULL) Lay_NotEnoughMemoryExit (); /***** Initialize vector of booleans that indicates whether it's necessary add to the list the students who don't belong to any group of each type *****/ for (NumGrpTyp = 0; - NumGrpTyp < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num; + NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num; NumGrpTyp++) AddStdsWithoutGroupOf[NumGrpTyp] = false; /***** Create query with the students who belong to the groups selected *****/ - if (Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps) // If there are groups selected... + if (Gbl.Crs.Grps.LstGrpsSel.NumGrps) // If there are groups selected... { /* Check if there are positive and negative codes in the list */ for (NumGrpSel = 0; - NumGrpSel < Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps; + NumGrpSel < Gbl.Crs.Grps.LstGrpsSel.NumGrps; NumGrpSel++) - if ((GrpCod = Gbl.Hierarchy.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]) > 0) + if ((GrpCod = Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]) > 0) NumPositiveCods++; else for (NumGrpTyp = 0; - NumGrpTyp < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num; + NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num; NumGrpTyp++) - if (Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod == -GrpCod) + if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod == -GrpCod) { AddStdsWithoutGroupOf[NumGrpTyp] = true; break; @@ -4501,9 +4501,9 @@ static void Usr_BuildQueryToGetUsrsLstCrs (char **Query,Rol_Role_t Role) Usr_MAX_BYTES_QUERY_GET_LIST_USRS); NumPositiveCods = 0; for (NumGrpSel = 0; - NumGrpSel < Gbl.Hierarchy.Crs.Grps.LstGrpsSel.NumGrps; + NumGrpSel < Gbl.Crs.Grps.LstGrpsSel.NumGrps; NumGrpSel++) - if ((GrpCod = Gbl.Hierarchy.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]) > 0) + if ((GrpCod = Gbl.Crs.Grps.LstGrpsSel.GrpCods[NumGrpSel]) > 0) { Str_Concat (*Query,NumPositiveCods ? " OR GrpCod='" : " GrpCod='", @@ -4524,7 +4524,7 @@ static void Usr_BuildQueryToGetUsrsLstCrs (char **Query,Rol_Role_t Role) /***** Create a query with the students who don't belong to any group *****/ for (NumGrpTyp = 0; - NumGrpTyp < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num; + NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num; NumGrpTyp++) if (AddStdsWithoutGroupOf[NumGrpTyp]) { @@ -4542,7 +4542,7 @@ static void Usr_BuildQueryToGetUsrsLstCrs (char **Query,Rol_Role_t Role) Usr_MAX_BYTES_QUERY_GET_LIST_USRS); snprintf (LongStr,sizeof (LongStr), "%ld", - Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod); + Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].GrpTypCod); Str_Concat (*Query,LongStr, Usr_MAX_BYTES_QUERY_GET_LIST_USRS); Str_Concat (*Query,"' AND crs_grp.GrpCod=crs_grp_usr.GrpCod)", @@ -4847,7 +4847,7 @@ void Usr_SearchListUsrs (Rol_Role_t Role) " AND crs_usr.CrsCod=%ld" " AND %s", QueryFields, - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, OrderQuery); break; default: @@ -4979,7 +4979,7 @@ void Usr_SearchListUsrs (Rol_Role_t Role) " AND %s", QueryFields, SubQueryRole, - Gbl.Hierarchy.Crs.Crs.CrsCod, + Gbl.Hierarchy.Crs.CrsCod, OrderQuery); break; default: @@ -6398,7 +6398,7 @@ static void Usr_ListMainDataStds (bool PutCheckBoxToSelectUsr) { /***** Allocate memory for the string with the list of group names where student belongs to *****/ if ((GroupNames = (char *) malloc ((Grp_MAX_BYTES_GROUP_NAME + 3) * - Gbl.Hierarchy.Crs.Grps.GrpTypes.NumGrpsTotal)) == NULL) + Gbl.Crs.Grps.GrpTypes.NumGrpsTotal)) == NULL) Lay_NotEnoughMemoryExit (); /***** Start table with list of students *****/ @@ -6715,8 +6715,8 @@ void Usr_ListAllDataStds (void) NumColumnsCommonCard = Usr_NUM_ALL_FIELDS_DATA_STD; if (Gbl.Scope.Current == Hie_CRS) { - NumColumnsCardAndGroups = NumColumnsCommonCard + Gbl.Hierarchy.Crs.Grps.GrpTypes.Num; - NumColumnsTotal = NumColumnsCardAndGroups + Gbl.Hierarchy.Crs.Records.LstFields.Num; + NumColumnsCardAndGroups = NumColumnsCommonCard + Gbl.Crs.Grps.GrpTypes.Num; + NumColumnsTotal = NumColumnsCardAndGroups + Gbl.Crs.Records.LstFields.Num; } else NumColumnsTotal = NumColumnsCardAndGroups = NumColumnsCommonCard; @@ -6724,7 +6724,7 @@ void Usr_ListAllDataStds (void) /***** Allocate memory for the string with the list of group names where student belongs to *****/ if (Gbl.Scope.Current == Hie_CRS) { - Length = (Grp_MAX_BYTES_GROUP_NAME + 2) * Gbl.Hierarchy.Crs.Grps.GrpTypes.NumGrpsTotal; + Length = (Grp_MAX_BYTES_GROUP_NAME + 2) * Gbl.Crs.Grps.GrpTypes.NumGrpsTotal; if ((GroupNames = (char *) malloc (Length + 1)) == NULL) Lay_NotEnoughMemoryExit (); } @@ -6758,27 +6758,27 @@ void Usr_ListAllDataStds (void) /* 2. Columns for the groups */ if (Gbl.Scope.Current == Hie_CRS) { - if (Gbl.Hierarchy.Crs.Grps.GrpTypes.Num) + if (Gbl.Crs.Grps.GrpTypes.Num) for (NumGrpTyp = 0; - NumGrpTyp < Gbl.Hierarchy.Crs.Grps.GrpTypes.Num; + NumGrpTyp < Gbl.Crs.Grps.GrpTypes.Num; NumGrpTyp++) - if (Gbl.Hierarchy.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) // If current course tiene groups of este type + if (Gbl.Crs.Grps.GrpTypes.LstGrpTypes[NumGrpTyp].NumGrps) // If current course tiene groups of este type fprintf (Gbl.F.Out,"
    " "%s %s " "" "%s " "
    " "" "(%s) " "