mirror of https://github.com/acanas/swad-core.git
Version18.95
This commit is contained in:
parent
a6d52e1050
commit
f23839ae96
|
@ -155,7 +155,7 @@ void QR_ExamAnnnouncement (void)
|
|||
" style=\"width:250px; height:250px;\" />"
|
||||
"</div>",
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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 *****/
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 ();
|
||||
|
|
|
@ -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,"<div class=\"PAR %s\">%s</div>"
|
||||
|
@ -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,"<tr>"
|
||||
|
@ -1245,14 +1245,14 @@ static void Asg_ShowLstGrpsToEditAssignment (long AsgCod)
|
|||
"</label>"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
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,"</div>");
|
||||
|
||||
|
@ -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 ();
|
||||
|
|
|
@ -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,"<div class=\"%s\">%s</div>",
|
||||
|
@ -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,"<tr>"
|
||||
|
@ -1211,14 +1211,14 @@ static void Att_ShowLstGrpsToEditAttEvent (long AttCod)
|
|||
"</label>"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
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,"</div>");
|
||||
|
||||
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,"<option value=\"%ld\"%s>%s</option>",
|
||||
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,"</select>");
|
||||
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,"<u>");
|
||||
}
|
||||
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,"</u>");
|
||||
fprintf (Gbl.F.Out,"</a>");
|
||||
Frm_EndForm ();
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,"<tr>"
|
||||
|
@ -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,"<u>");
|
||||
}
|
||||
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,"</u>");
|
||||
fprintf (Gbl.F.Out,"</a>");
|
||||
Frm_EndForm ();
|
||||
|
@ -738,7 +738,7 @@ static void Cty_ListOneCountryForSeeing (struct Country *Cty,unsigned NumCty)
|
|||
"</td>"
|
||||
"</tr>",
|
||||
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,"<tr>"
|
||||
"<td rowspan=\"%u\" class=\"BT\">",
|
||||
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"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
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);
|
||||
|
|
|
@ -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
|
||||
|
|
258
swad_course.c
258
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,"</a>");
|
||||
fprintf (Gbl.F.Out,"<br />%s"
|
||||
"</div>",
|
||||
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,"</td>"
|
||||
"</tr>");
|
||||
|
||||
|
@ -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,"</td>"
|
||||
"</tr>");
|
||||
|
||||
|
@ -351,7 +351,7 @@ static void Crs_Configuration (bool PrintView)
|
|||
Year++)
|
||||
fprintf (Gbl.F.Out,"<option value=\"%u\"%s>%s</option>",
|
||||
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,"</select>");
|
||||
|
@ -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,"</td>"
|
||||
"</tr>");
|
||||
|
@ -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,"</td>"
|
||||
"</tr>");
|
||||
|
||||
|
@ -403,7 +403,7 @@ static void Crs_Configuration (bool PrintView)
|
|||
"</tr>",
|
||||
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)
|
|||
"<td class=\"DAT LEFT_MIDDLE\">",
|
||||
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,"</td>"
|
||||
"</tr>");
|
||||
}
|
||||
|
@ -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,"<tr>"
|
||||
"<td class=\"%s RIGHT_MIDDLE\">"
|
||||
|
@ -511,7 +511,7 @@ static void Crs_ShowNumUsrsInCrs (Rol_Role_t Role)
|
|||
"</tr>",
|
||||
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,"<li class=\"MY_CRSS_LNK %s\" style=\"height:25px;\">",
|
||||
Highlight ? ClassHighlight :
|
||||
ClassNormal);
|
||||
|
@ -912,7 +912,7 @@ void Crs_WriteSelectorOfCourse (void)
|
|||
fprintf (Gbl.F.Out," disabled=\"disabled\"");
|
||||
fprintf (Gbl.F.Out,">"
|
||||
"<option value=\"\"");
|
||||
if (Gbl.Hierarchy.Crs.Crs.CrsCod < 0)
|
||||
if (Gbl.Hierarchy.Crs.CrsCod < 0)
|
||||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out," disabled=\"disabled\">[%s]</option>",
|
||||
Txt_Course);
|
||||
|
@ -942,7 +942,7 @@ void Crs_WriteSelectorOfCourse (void)
|
|||
/* Write option */
|
||||
fprintf (Gbl.F.Out,"<option value=\"%ld\"",CrsCod);
|
||||
if (Gbl.Hierarchy.Level == Hie_CRS && // Course selected
|
||||
(CrsCod == Gbl.Hierarchy.Crs.Crs.CrsCod))
|
||||
(CrsCod == Gbl.Hierarchy.Crs.CrsCod))
|
||||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out,">%s</option>",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,"<option value=\"-1\""
|
||||
" disabled=\"disabled\" selected=\"selected\">"
|
||||
"%s"
|
||||
|
@ -1111,7 +1111,7 @@ void Crs_WriteSelectorMyCoursesInBreadcrumb (void)
|
|||
|
||||
fprintf (Gbl.F.Out,"<option value=\"%ld\"",
|
||||
Gbl.Usrs.Me.MyCrss.Crss[NumMyCrs].CrsCod);
|
||||
if (CrsCod == Gbl.Hierarchy.Crs.Crs.CrsCod) // Course selected
|
||||
if (CrsCod == Gbl.Hierarchy.Crs.CrsCod) // Course selected
|
||||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out,">%s</option>",CrsShortName);
|
||||
}
|
||||
|
@ -1128,8 +1128,8 @@ void Crs_WriteSelectorMyCoursesInBreadcrumb (void)
|
|||
" disabled=\"disabled\" selected=\"selected\">"
|
||||
"%s"
|
||||
"</option>",
|
||||
Gbl.Hierarchy.Crs.Crs.CrsCod,
|
||||
Gbl.Hierarchy.Crs.Crs.ShrtName);
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
Gbl.Hierarchy.Crs.ShrtName);
|
||||
|
||||
/***** End form *****/
|
||||
fprintf (Gbl.F.Out,"</select>");
|
||||
|
@ -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\" />"
|
||||
"</td>",
|
||||
Crs_MAX_CHARS_INSTITUTIONAL_CRS_COD,
|
||||
Gbl.Degs.EditingCrs.InstitutionalCrsCod);
|
||||
Gbl.Crss.EditingCrs.InstitutionalCrsCod);
|
||||
|
||||
/***** Year *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
|
||||
|
@ -1709,7 +1709,7 @@ static void Crs_PutFormToCreateCourse (void)
|
|||
Year++)
|
||||
fprintf (Gbl.F.Out,"<option value=\"%u\"%s>%s</option>",
|
||||
Year,
|
||||
Year == Gbl.Degs.EditingCrs.Year ? " selected=\"selected\"" :
|
||||
Year == Gbl.Crss.EditingCrs.Year ? " selected=\"selected\"" :
|
||||
"",
|
||||
Txt_YEAR_OF_DEGREE[Year]);
|
||||
fprintf (Gbl.F.Out,"</select>"
|
||||
|
@ -1722,7 +1722,7 @@ static void Crs_PutFormToCreateCourse (void)
|
|||
" class=\"INPUT_SHORT_NAME\""
|
||||
" required=\"required\" />"
|
||||
"</td>",
|
||||
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,"<td class=\"LEFT_MIDDLE\">"
|
||||
|
@ -1731,7 +1731,7 @@ static void Crs_PutFormToCreateCourse (void)
|
|||
" class=\"INPUT_FULL_NAME\""
|
||||
" required=\"required\" />"
|
||||
"</td>",
|
||||
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,"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -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,"<option value=\"%ld\"%s>%s</option>",
|
||||
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,"</select>");
|
||||
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,"<option value=\"%ld\"%s>%s</option>",
|
||||
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,"</td>");
|
||||
|
||||
/* Degree WWW */
|
||||
|
@ -995,10 +995,10 @@ static void Deg_PutFormToCreateDegree (void)
|
|||
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\">"
|
||||
"<select name=\"OthDegTypCod\" style=\"width:62px;\">");
|
||||
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,"<option value=\"%ld\"%s>%s</option>",
|
||||
DegTyp->DegTypCod,
|
||||
DegTyp->DegTypCod == Deg->DegTypCod ? " selected=\"selected\"" :
|
||||
|
@ -1365,7 +1365,7 @@ void Deg_EditDegrees (void)
|
|||
Box_StartBox (NULL,Gbl.Title,Deg_PutIconsEditingDegrees,
|
||||
Hlp_CENTRE_Degrees,Box_NOT_CLOSABLE);
|
||||
|
||||
if (Gbl.Degs.DegTypes.Num)
|
||||
if (Gbl.DegTypes.Num)
|
||||
{
|
||||
/***** Put a form to create a new degree *****/
|
||||
Deg_PutFormToCreateDegree ();
|
||||
|
@ -1683,7 +1683,7 @@ bool Deg_GetDataOfDegreeByCod (struct Degree *Deg)
|
|||
Deg->ShrtName[0] = '\0';
|
||||
Deg->FullName[0] = '\0';
|
||||
Deg->WWW[0] = '\0';
|
||||
Deg->LstCrss = NULL;
|
||||
Deg->Crss.Lst = NULL;
|
||||
|
||||
/***** Check if degree code is correct *****/
|
||||
if (Deg->DegCod > 0)
|
||||
|
|
|
@ -76,13 +76,16 @@ struct Degree
|
|||
char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1]; // Short name of degree
|
||||
char FullName[Hie_MAX_BYTES_FULL_NAME + 1]; // Full name of degree
|
||||
char WWW[Cns_MAX_BYTES_WWW + 1];
|
||||
unsigned NumCrss; // Number of courses in this degree
|
||||
struct Course *LstCrss; // List of courses in this degree
|
||||
struct
|
||||
{
|
||||
unsigned Num; // Number of courses in this degree
|
||||
struct Course *Lst; // List of courses in this degree
|
||||
} Crss;
|
||||
};
|
||||
|
||||
struct ListDegrees
|
||||
{
|
||||
unsigned Num; // Number of degrees
|
||||
unsigned Num; // Number of degrees
|
||||
struct Degree *Lst; // List of degrees
|
||||
};
|
||||
|
||||
|
|
|
@ -112,13 +112,13 @@ void DT_WriteSelectorDegreeTypes (void)
|
|||
fprintf (Gbl.F.Out,">%s</option>",Txt_Any_type_of_degree);
|
||||
|
||||
for (NumDegTyp = 0;
|
||||
NumDegTyp < Gbl.Degs.DegTypes.Num;
|
||||
NumDegTyp < Gbl.DegTypes.Num;
|
||||
NumDegTyp++)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<option value=\"%ld\"",Gbl.Degs.DegTypes.Lst[NumDegTyp].DegTypCod );
|
||||
if (Gbl.Degs.DegTypes.Lst[NumDegTyp].DegTypCod == Gbl.Stat.DegTypCod)
|
||||
fprintf (Gbl.F.Out,"<option value=\"%ld\"",Gbl.DegTypes.Lst[NumDegTyp].DegTypCod );
|
||||
if (Gbl.DegTypes.Lst[NumDegTyp].DegTypCod == Gbl.Stat.DegTypCod)
|
||||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out,">%s</option>",Gbl.Degs.DegTypes.Lst[NumDegTyp].DegTypName);
|
||||
fprintf (Gbl.F.Out,">%s</option>",Gbl.DegTypes.Lst[NumDegTyp].DegTypName);
|
||||
}
|
||||
|
||||
fprintf (Gbl.F.Out,"</select>");
|
||||
|
@ -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,"<tr>"
|
||||
|
@ -321,14 +321,14 @@ static void DT_ListDegreeTypesForSeeing (void)
|
|||
fprintf (Gbl.F.Out,"<td class=\"DAT_N LEFT_MIDDLE %s\">"
|
||||
"%s"
|
||||
"</td>",
|
||||
BgColor,Gbl.Degs.DegTypes.Lst[NumDegTyp].DegTypName);
|
||||
BgColor,Gbl.DegTypes.Lst[NumDegTyp].DegTypName);
|
||||
|
||||
/* Number of degrees of this type */
|
||||
fprintf (Gbl.F.Out,"<td class=\"DAT_N RIGHT_MIDDLE %s\">"
|
||||
"%u"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
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,"<tr>"
|
||||
"<td class=\"BM\">");
|
||||
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)
|
|||
"<td class=\"DAT CODE\">"
|
||||
"%ld"
|
||||
"</td>",
|
||||
Gbl.Degs.DegTypes.Lst[NumDegTyp].DegTypCod);
|
||||
Gbl.DegTypes.Lst[NumDegTyp].DegTypCod);
|
||||
|
||||
/* Name of degree type */
|
||||
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\">");
|
||||
Frm_StartForm (ActRenDegTyp);
|
||||
DT_PutParamOtherDegTypCod (Gbl.Degs.DegTypes.Lst[NumDegTyp].DegTypCod);
|
||||
DT_PutParamOtherDegTypCod (Gbl.DegTypes.Lst[NumDegTyp].DegTypCod);
|
||||
fprintf (Gbl.F.Out,"<input type=\"text\" name=\"DegTypName\""
|
||||
" size=\"25\" maxlength=\"%u\" value=\"%s\""
|
||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||
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,"</td>");
|
||||
|
@ -417,7 +417,7 @@ static void DT_ListDegreeTypesForEdition (void)
|
|||
"%u"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
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\" />"
|
||||
"</td>",
|
||||
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,"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
|
@ -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 ();
|
||||
}
|
||||
|
|
|
@ -509,13 +509,13 @@ static void Dpt_ListDepartmentsForEdition (void)
|
|||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out,">%s</option>",Txt_Another_institution);
|
||||
for (NumIns = 0;
|
||||
NumIns < Gbl.Inss.Num;
|
||||
NumIns < Gbl.Hierarchy.Cty.Inss.Num;
|
||||
NumIns++)
|
||||
fprintf (Gbl.F.Out,"<option value=\"%ld\"%s>%s</option>",
|
||||
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,"</select>");
|
||||
Frm_EndForm ();
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
@ -876,13 +876,13 @@ static void Dpt_PutFormToCreateDepartment (void)
|
|||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out,">%s</option>",Txt_Another_institution);
|
||||
for (NumIns = 0;
|
||||
NumIns < Gbl.Inss.Num;
|
||||
NumIns < Gbl.Hierarchy.Cty.Inss.Num;
|
||||
NumIns++)
|
||||
fprintf (Gbl.F.Out,"<option value=\"%ld\"%s>%s</option>",
|
||||
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,"</select>"
|
||||
"</td>");
|
||||
|
||||
|
|
|
@ -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<<Role)&%u)<>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);
|
||||
|
|
24
swad_exam.c
24
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 *****/
|
||||
|
|
|
@ -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 ();
|
||||
|
|
|
@ -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)
|
|||
"</label>"
|
||||
"</li>",
|
||||
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)
|
|||
"<label>"
|
||||
"<input type=\"radio\" name=\"GrpCod\" value=\"%ld\"",
|
||||
(IsGroupZone &&
|
||||
GrpDat.GrpCod == Gbl.Hierarchy.Crs.Grps.GrpCod) ? "BROWSER_TITLE" :
|
||||
GrpDat.GrpCod == Gbl.Crs.Grps.GrpCod) ? "BROWSER_TITLE" :
|
||||
"BROWSER_TITLE_LIGHT",
|
||||
Cfg_URL_ICON_PUBLIC,
|
||||
NumGrp < LstMyGrps.NumGrps - 1 ? "submid" :
|
||||
"subend",
|
||||
GrpDat.GrpCod);
|
||||
if (IsGroupZone && GrpDat.GrpCod == Gbl.Hierarchy.Crs.Grps.GrpCod)
|
||||
if (IsGroupZone && GrpDat.GrpCod == Gbl.Crs.Grps.GrpCod)
|
||||
fprintf (Gbl.F.Out," checked=\"checked\"");
|
||||
fprintf (Gbl.F.Out," onclick=\"document.getElementById('%s').submit();\" />"
|
||||
"%s %s"
|
||||
|
@ -3913,7 +3913,7 @@ static void Brw_UpdateLastAccess (void)
|
|||
if (Gbl.Action.Act == ActChgToSeeDocCrs ||
|
||||
Gbl.Action.Act == ActChgToAdmDocCrs ||
|
||||
Gbl.Action.Act == ActChgToAdmTch) // Update group of last access to a documents/teachers zone only when user changes zone
|
||||
Brw_UpdateGrpLastAccZone ("LastDowGrpCod",Gbl.Hierarchy.Crs.Grps.GrpCod);
|
||||
Brw_UpdateGrpLastAccZone ("LastDowGrpCod",Gbl.Crs.Grps.GrpCod);
|
||||
break;
|
||||
case Brw_ADMI_SHR_CRS:
|
||||
if (Gbl.Action.Act == ActChgToAdmSha) // Update group of last access to a shared files zone only when user changes zone
|
||||
|
@ -3921,7 +3921,7 @@ static void Brw_UpdateLastAccess (void)
|
|||
break;
|
||||
case Brw_ADMI_SHR_GRP:
|
||||
if (Gbl.Action.Act == ActChgToAdmSha) // Update group of last access to a shared files zone only when user changes zone
|
||||
Brw_UpdateGrpLastAccZone ("LastComGrpCod",Gbl.Hierarchy.Crs.Grps.GrpCod);
|
||||
Brw_UpdateGrpLastAccZone ("LastComGrpCod",Gbl.Crs.Grps.GrpCod);
|
||||
break;
|
||||
case Brw_SHOW_MRK_CRS:
|
||||
case Brw_ADMI_MRK_CRS:
|
||||
|
@ -3933,7 +3933,7 @@ static void Brw_UpdateLastAccess (void)
|
|||
case Brw_ADMI_MRK_GRP:
|
||||
if (Gbl.Action.Act == ActChgToSeeMrk ||
|
||||
Gbl.Action.Act == ActChgToAdmMrk) // Update group of last access to a marks zone only when user changes zone
|
||||
Brw_UpdateGrpLastAccZone ("LastAssGrpCod",Gbl.Hierarchy.Crs.Grps.GrpCod);
|
||||
Brw_UpdateGrpLastAccZone ("LastAssGrpCod",Gbl.Crs.Grps.GrpCod);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -3951,7 +3951,7 @@ static void Brw_UpdateGrpLastAccZone (const char *FieldNameDB,long GrpCod)
|
|||
"UPDATE crs_usr SET %s=%ld"
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
FieldNameDB,GrpCod,
|
||||
Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
Gbl.Hierarchy.Crs.CrsCod,Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -5008,7 +5008,7 @@ static void Brw_PutCheckboxFullTree (void)
|
|||
static void Brw_PutParamsFullTree (void)
|
||||
{
|
||||
if (Brw_GetIfGroupFileBrowser ())
|
||||
Grp_PutParamGrpCod (Gbl.Hierarchy.Crs.Grps.GrpCod);
|
||||
Grp_PutParamGrpCod (Gbl.Crs.Grps.GrpCod);
|
||||
else if (Brw_GetIfProjectFileBrowser ()) // This file browser needs specify a project
|
||||
Prj_PutParamPrjCod (Gbl.Prjs.PrjCod);
|
||||
else if (Brw_GetIfCrsAssigWorksFileBrowser ())
|
||||
|
@ -5202,7 +5202,7 @@ static void Brw_GetAndUpdateDateLastAccFileBrowser (void)
|
|||
case Brw_ADMI_ASG_CRS:
|
||||
case Brw_ADMI_WRK_USR:
|
||||
case Brw_ADMI_WRK_CRS:
|
||||
Cod = Gbl.Hierarchy.Crs.Crs.CrsCod;
|
||||
Cod = Gbl.Hierarchy.Crs.CrsCod;
|
||||
break;
|
||||
case Brw_SHOW_DOC_GRP:
|
||||
case Brw_ADMI_DOC_GRP:
|
||||
|
@ -5210,7 +5210,7 @@ static void Brw_GetAndUpdateDateLastAccFileBrowser (void)
|
|||
case Brw_ADMI_SHR_GRP:
|
||||
case Brw_SHOW_MRK_GRP:
|
||||
case Brw_ADMI_MRK_GRP:
|
||||
Cod = Gbl.Hierarchy.Crs.Grps.GrpCod;
|
||||
Cod = Gbl.Crs.Grps.GrpCod;
|
||||
break;
|
||||
case Brw_ADMI_DOC_PRJ:
|
||||
case Brw_ADMI_ASS_PRJ:
|
||||
|
@ -5277,7 +5277,7 @@ static long Brw_GetGrpLastAccZone (const char *FieldNameDB)
|
|||
"SELECT %s FROM crs_usr"
|
||||
" WHERE CrsCod=%ld AND UsrCod=%ld",
|
||||
FieldNameDB,
|
||||
Gbl.Hierarchy.Crs.Crs.CrsCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
|
||||
if (NumRows == 0) // May be an administrator not belonging to this course
|
||||
|
@ -7360,12 +7360,12 @@ static bool Brw_CheckIfClipboardIsInThisTree (void)
|
|||
case Brw_ADMI_MRK_CRS:
|
||||
case Brw_ADMI_ASG_USR:
|
||||
case Brw_ADMI_WRK_USR:
|
||||
if (Gbl.FileBrowser.Clipboard.Cod == Gbl.Hierarchy.Crs.Crs.CrsCod)
|
||||
if (Gbl.FileBrowser.Clipboard.Cod == Gbl.Hierarchy.Crs.CrsCod)
|
||||
return true; // I am in the course of the clipboard
|
||||
break;
|
||||
case Brw_ADMI_ASG_CRS:
|
||||
case Brw_ADMI_WRK_CRS:
|
||||
if (Gbl.FileBrowser.Clipboard.Cod == Gbl.Hierarchy.Crs.Crs.CrsCod &&
|
||||
if (Gbl.FileBrowser.Clipboard.Cod == Gbl.Hierarchy.Crs.CrsCod &&
|
||||
Gbl.FileBrowser.Clipboard.WorksUsrCod == Gbl.Usrs.Other.UsrDat.UsrCod)
|
||||
return true; // I am in the course of the clipboard
|
||||
// I am in the student's works of the clipboard
|
||||
|
@ -7374,7 +7374,7 @@ static bool Brw_CheckIfClipboardIsInThisTree (void)
|
|||
case Brw_ADMI_TCH_GRP:
|
||||
case Brw_ADMI_SHR_GRP:
|
||||
case Brw_ADMI_MRK_GRP:
|
||||
if (Gbl.FileBrowser.Clipboard.Cod == Gbl.Hierarchy.Crs.Grps.GrpCod)
|
||||
if (Gbl.FileBrowser.Clipboard.Cod == Gbl.Crs.Grps.GrpCod)
|
||||
return true; // I am in the group of the clipboard
|
||||
break;
|
||||
case Brw_ADMI_DOC_PRJ:
|
||||
|
@ -7457,12 +7457,12 @@ static long Brw_GetCodForClipboard (void)
|
|||
case Brw_ADMI_WRK_USR:
|
||||
case Brw_ADMI_WRK_CRS:
|
||||
case Brw_ADMI_MRK_CRS:
|
||||
return Gbl.Hierarchy.Crs.Crs.CrsCod;
|
||||
return Gbl.Hierarchy.Crs.CrsCod;
|
||||
case Brw_ADMI_DOC_GRP:
|
||||
case Brw_ADMI_TCH_GRP:
|
||||
case Brw_ADMI_SHR_GRP:
|
||||
case Brw_ADMI_MRK_GRP:
|
||||
return Gbl.Hierarchy.Crs.Grps.GrpCod;
|
||||
return Gbl.Crs.Grps.GrpCod;
|
||||
case Brw_ADMI_DOC_PRJ:
|
||||
case Brw_ADMI_ASS_PRJ:
|
||||
return Gbl.Prjs.PrjCod;
|
||||
|
@ -7820,12 +7820,12 @@ static long Brw_GetCodForExpandedFolders (void)
|
|||
case Brw_ADMI_WRK_USR:
|
||||
case Brw_ADMI_WRK_CRS:
|
||||
case Brw_ADMI_MRK_CRS:
|
||||
return Gbl.Hierarchy.Crs.Crs.CrsCod;
|
||||
return Gbl.Hierarchy.Crs.CrsCod;
|
||||
case Brw_ADMI_DOC_GRP:
|
||||
case Brw_ADMI_TCH_GRP:
|
||||
case Brw_ADMI_SHR_GRP:
|
||||
case Brw_ADMI_MRK_GRP:
|
||||
return Gbl.Hierarchy.Crs.Grps.GrpCod;
|
||||
return Gbl.Crs.Grps.GrpCod;
|
||||
default:
|
||||
return -1L;
|
||||
}
|
||||
|
@ -7916,7 +7916,7 @@ static void Brw_RemoveAffectedClipboards (Brw_FileBrowser_t FileBrowser,
|
|||
"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld",
|
||||
(unsigned) FileBrowser,
|
||||
Gbl.Hierarchy.Crs.Crs.CrsCod);
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
break;
|
||||
case Brw_ADMI_DOC_GRP:
|
||||
case Brw_ADMI_TCH_GRP:
|
||||
|
@ -7926,7 +7926,7 @@ static void Brw_RemoveAffectedClipboards (Brw_FileBrowser_t FileBrowser,
|
|||
"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld",
|
||||
(unsigned) FileBrowser,
|
||||
Gbl.Hierarchy.Crs.Grps.GrpCod);
|
||||
Gbl.Crs.Grps.GrpCod);
|
||||
break;
|
||||
case Brw_ADMI_ASG_USR:
|
||||
case Brw_ADMI_WRK_USR:
|
||||
|
@ -7934,7 +7934,7 @@ static void Brw_RemoveAffectedClipboards (Brw_FileBrowser_t FileBrowser,
|
|||
"DELETE FROM clipboard"
|
||||
" WHERE UsrCod=%ld AND FileBrowser=%u AND Cod=%ld",
|
||||
MyUsrCod,(unsigned) FileBrowser,
|
||||
Gbl.Hierarchy.Crs.Crs.CrsCod);
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
break;
|
||||
case Brw_ADMI_ASG_CRS:
|
||||
case Brw_ADMI_WRK_CRS:
|
||||
|
@ -7942,7 +7942,7 @@ static void Brw_RemoveAffectedClipboards (Brw_FileBrowser_t FileBrowser,
|
|||
"DELETE FROM clipboard"
|
||||
" WHERE FileBrowser=%u AND Cod=%ld AND WorksUsrCod=%ld",
|
||||
(unsigned) FileBrowser,
|
||||
Gbl.Hierarchy.Crs.Crs.CrsCod,WorksUsrCod);
|
||||
Gbl.Hierarchy.Crs.CrsCod,WorksUsrCod);
|
||||
break;
|
||||
case Brw_ADMI_DOC_PRJ:
|
||||
case Brw_ADMI_ASS_PRJ:
|
||||
|
@ -8021,7 +8021,7 @@ void Brw_PasteIntoFileBrowser (void)
|
|||
// Possible institution: Gbl.Hierarchy.Ins.InsCod
|
||||
// Possible centre: Gbl.Hierarchy.Ctr.CtrCod
|
||||
// Possible degree: Gbl.Hierarchy.Deg.DegCod
|
||||
// Possible course: Gbl.Hierarchy.Crs.Crs.CrsCod
|
||||
// Possible course: Gbl.Hierarchy.Crs.CrsCod
|
||||
// Possible student in works: Gbl.Usrs.Other.UsrDat.UsrCod
|
||||
// Path (should be a folder): Gbl.FileBrowser.Priv.FullPathInTree
|
||||
// Returns the number of files pasted
|
||||
|
@ -9958,19 +9958,19 @@ void Brw_ShowFileMetadata (void)
|
|||
case Brw_ADMI_DOC_CRS:
|
||||
case Brw_ADMI_DOC_GRP:
|
||||
Ntf_MarkNotifAsSeen (Ntf_EVENT_DOCUMENT_FILE,
|
||||
FileMetadata.FilCod,Gbl.Hierarchy.Crs.Crs.CrsCod,
|
||||
FileMetadata.FilCod,Gbl.Hierarchy.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
break;
|
||||
case Brw_ADMI_TCH_CRS:
|
||||
case Brw_ADMI_TCH_GRP:
|
||||
Ntf_MarkNotifAsSeen (Ntf_EVENT_TEACHERS_FILE,
|
||||
FileMetadata.FilCod,Gbl.Hierarchy.Crs.Crs.CrsCod,
|
||||
FileMetadata.FilCod,Gbl.Hierarchy.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
break;
|
||||
case Brw_ADMI_SHR_CRS:
|
||||
case Brw_ADMI_SHR_GRP:
|
||||
Ntf_MarkNotifAsSeen (Ntf_EVENT_SHARED_FILE,
|
||||
FileMetadata.FilCod,Gbl.Hierarchy.Crs.Crs.CrsCod,
|
||||
FileMetadata.FilCod,Gbl.Hierarchy.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
break;
|
||||
case Brw_SHOW_MRK_CRS:
|
||||
|
@ -9978,7 +9978,7 @@ void Brw_ShowFileMetadata (void)
|
|||
case Brw_ADMI_MRK_CRS:
|
||||
case Brw_ADMI_MRK_GRP:
|
||||
Ntf_MarkNotifAsSeen (Ntf_EVENT_MARKS_FILE,
|
||||
FileMetadata.FilCod,Gbl.Hierarchy.Crs.Crs.CrsCod,
|
||||
FileMetadata.FilCod,Gbl.Hierarchy.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
break;
|
||||
default:
|
||||
|
@ -10108,19 +10108,19 @@ void Brw_DownloadFile (void)
|
|||
case Brw_ADMI_DOC_CRS:
|
||||
case Brw_ADMI_DOC_GRP:
|
||||
Ntf_MarkNotifAsSeen (Ntf_EVENT_DOCUMENT_FILE,
|
||||
FileMetadata.FilCod,Gbl.Hierarchy.Crs.Crs.CrsCod,
|
||||
FileMetadata.FilCod,Gbl.Hierarchy.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
break;
|
||||
case Brw_ADMI_TCH_CRS:
|
||||
case Brw_ADMI_TCH_GRP:
|
||||
Ntf_MarkNotifAsSeen (Ntf_EVENT_TEACHERS_FILE,
|
||||
FileMetadata.FilCod,Gbl.Hierarchy.Crs.Crs.CrsCod,
|
||||
FileMetadata.FilCod,Gbl.Hierarchy.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
break;
|
||||
case Brw_ADMI_SHR_CRS:
|
||||
case Brw_ADMI_SHR_GRP:
|
||||
Ntf_MarkNotifAsSeen (Ntf_EVENT_SHARED_FILE,
|
||||
FileMetadata.FilCod,Gbl.Hierarchy.Crs.Crs.CrsCod,
|
||||
FileMetadata.FilCod,Gbl.Hierarchy.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
break;
|
||||
case Brw_SHOW_MRK_CRS:
|
||||
|
@ -10128,7 +10128,7 @@ void Brw_DownloadFile (void)
|
|||
case Brw_ADMI_MRK_CRS:
|
||||
case Brw_ADMI_MRK_GRP:
|
||||
Ntf_MarkNotifAsSeen (Ntf_EVENT_MARKS_FILE,
|
||||
FileMetadata.FilCod,Gbl.Hierarchy.Crs.Crs.CrsCod,
|
||||
FileMetadata.FilCod,Gbl.Hierarchy.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
break;
|
||||
default:
|
||||
|
@ -11219,12 +11219,12 @@ long Brw_GetCodForFiles (void)
|
|||
case Brw_ADMI_ASG_USR:
|
||||
case Brw_ADMI_WRK_USR:
|
||||
case Brw_ADMI_MRK_CRS:
|
||||
return Gbl.Hierarchy.Crs.Crs.CrsCod;
|
||||
return Gbl.Hierarchy.Crs.CrsCod;
|
||||
case Brw_ADMI_DOC_GRP:
|
||||
case Brw_ADMI_TCH_GRP:
|
||||
case Brw_ADMI_SHR_GRP:
|
||||
case Brw_ADMI_MRK_GRP:
|
||||
return Gbl.Hierarchy.Crs.Grps.GrpCod;
|
||||
return Gbl.Crs.Grps.GrpCod;
|
||||
case Brw_ADMI_DOC_PRJ:
|
||||
case Brw_ADMI_ASS_PRJ:
|
||||
return Gbl.Prjs.PrjCod;
|
||||
|
@ -11533,7 +11533,7 @@ static bool Brw_CheckIfICanEditFileOrFolder (unsigned Level)
|
|||
case Brw_ADMI_DOC_GRP:
|
||||
if (Gbl.Usrs.Me.Role.Logged == Rol_TCH) // A teacher...
|
||||
// ...can edit only if he/she belongs to group
|
||||
return Grp_GetIfIBelongToGrp (Gbl.Hierarchy.Crs.Grps.GrpCod);
|
||||
return Grp_GetIfIBelongToGrp (Gbl.Crs.Grps.GrpCod);
|
||||
// An administrator can edit
|
||||
return (Gbl.Usrs.Me.Role.Logged > Rol_TCH);
|
||||
case Brw_ADMI_TCH_CRS:
|
||||
|
@ -11606,7 +11606,7 @@ static bool Brw_CheckIfICanCreateIntoFolder (unsigned Level)
|
|||
case Brw_ADMI_DOC_GRP:
|
||||
if (Gbl.Usrs.Me.Role.Logged == Rol_TCH) // A teacher
|
||||
// ...can create/paste only if he/she belongs to group
|
||||
return Grp_GetIfIBelongToGrp (Gbl.Hierarchy.Crs.Grps.GrpCod);
|
||||
return Grp_GetIfIBelongToGrp (Gbl.Crs.Grps.GrpCod);
|
||||
// An administrator can create/paste
|
||||
return (Gbl.Usrs.Me.Role.Logged > Rol_TCH);
|
||||
case Brw_ADMI_TCH_CRS:
|
||||
|
@ -11615,7 +11615,7 @@ static bool Brw_CheckIfICanCreateIntoFolder (unsigned Level)
|
|||
if (Gbl.Usrs.Me.Role.Logged == Rol_NET || // A non-editing teacher...
|
||||
Gbl.Usrs.Me.Role.Logged == Rol_TCH) // ...or a teacher
|
||||
// ...can create/paste only if he/she belongs to group
|
||||
return Grp_GetIfIBelongToGrp (Gbl.Hierarchy.Crs.Grps.GrpCod);
|
||||
return Grp_GetIfIBelongToGrp (Gbl.Crs.Grps.GrpCod);
|
||||
// An administrator can create/paste
|
||||
return (Gbl.Usrs.Me.Role.Logged > Rol_TCH);
|
||||
case Brw_ADMI_SHR_CRS:
|
||||
|
@ -11624,7 +11624,7 @@ static bool Brw_CheckIfICanCreateIntoFolder (unsigned Level)
|
|||
if (Gbl.Usrs.Me.Role.Logged >= Rol_STD && // A student, non-editing teacher...
|
||||
Gbl.Usrs.Me.Role.Logged <= Rol_TCH) // ...or a teacher
|
||||
// ...can create/paste only if he/she belongs to group
|
||||
return Grp_GetIfIBelongToGrp (Gbl.Hierarchy.Crs.Grps.GrpCod);
|
||||
return Grp_GetIfIBelongToGrp (Gbl.Crs.Grps.GrpCod);
|
||||
// An administrator can create/paste
|
||||
return Gbl.Usrs.Me.Role.Logged >= Rol_STD;
|
||||
case Brw_ADMI_ASG_USR:
|
||||
|
@ -11894,7 +11894,7 @@ void Brw_RemoveZonesOfGroupsOfType (long GrpTypCod)
|
|||
Lay_ShowErrorAndExit ("Wrong group code.");
|
||||
|
||||
/* Remove file zones of this group */
|
||||
Brw_RemoveGrpZones (Gbl.Hierarchy.Crs.Crs.CrsCod,GrpCod);
|
||||
Brw_RemoveGrpZones (Gbl.Hierarchy.Crs.CrsCod,GrpCod);
|
||||
}
|
||||
|
||||
/***** Free structure that stores the query result *****/
|
||||
|
@ -12203,7 +12203,7 @@ static void Brw_WriteRowDocData (unsigned long *NumDocsNotHidden,MYSQL_ROW row)
|
|||
|
||||
/***** Set row color *****/
|
||||
BgColor = (CrsCod > 0 &&
|
||||
CrsCod == Gbl.Hierarchy.Crs.Crs.CrsCod) ? "LIGHT_BLUE" :
|
||||
CrsCod == Gbl.Hierarchy.Crs.CrsCod) ? "LIGHT_BLUE" :
|
||||
Gbl.ColorRows[Gbl.RowEvenOdd];
|
||||
|
||||
/***** Write number of document in this search *****/
|
||||
|
|
|
@ -1498,7 +1498,7 @@ void Fol_GetAndShowRankingFollowers (void)
|
|||
" AND crs_usr.UsrCod=usr_follow.FollowedCod"
|
||||
" GROUP BY usr_follow.FollowedCod"
|
||||
" ORDER BY N DESC,usr_follow.FollowedCod LIMIT 100",
|
||||
Gbl.Hierarchy.Crs.Crs.CrsCod);
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
break;
|
||||
default:
|
||||
Lay_WrongScopeExit ();
|
||||
|
|
|
@ -205,7 +205,7 @@ void Frm_SetParamsForm (char ParamsStr[Frm_MAX_BYTES_PARAMS_STR + 1],Act_Action_
|
|||
case Hie_CRS: // Course
|
||||
snprintf (ParamLocation,sizeof (ParamLocation),
|
||||
"<input type=\"hidden\" name=\"crs\" value=\"%ld\" />",
|
||||
Gbl.Hierarchy.Crs.Crs.CrsCod);
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -1070,7 +1070,7 @@ static void For_ShowPostsOfAThread (Ale_AlertType_t AlertType,const char *Messag
|
|||
case For_FORUM_COURSE_TCHS:
|
||||
case For_FORUM_COURSE_USRS:
|
||||
Ntf_MarkNotifAsSeen (Ntf_EVENT_FORUM_POST_COURSE,
|
||||
PstCod,Gbl.Hierarchy.Crs.Crs.CrsCod,
|
||||
PstCod,Gbl.Hierarchy.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
break;
|
||||
default:
|
||||
|
@ -1634,7 +1634,7 @@ static void For_ShowForumList (void)
|
|||
if (Gbl.Usrs.Me.IBelongToCurrentCrs ||
|
||||
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
|
||||
/***** Links to forums of current degree *****/
|
||||
For_WriteLinksToCrsForums (Gbl.Hierarchy.Crs.Crs.CrsCod,
|
||||
For_WriteLinksToCrsForums (Gbl.Hierarchy.Crs.CrsCod,
|
||||
true,
|
||||
IsLastItemInLevel);
|
||||
}
|
||||
|
|
44
swad_game.c
44
swad_game.c
|
@ -200,8 +200,8 @@ static void Gam_ListAllGames (void)
|
|||
unsigned NumGame;
|
||||
|
||||
/***** 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 games *****/
|
||||
Gam_GetListGames ();
|
||||
|
@ -223,7 +223,7 @@ static void Gam_ListAllGames (void)
|
|||
Hlp_ASSESSMENT_Games,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 (ActSeeAllGam,Gam_ParamsWhichGroupsToShow);
|
||||
|
@ -631,7 +631,7 @@ static void Gam_ShowOneGame (long GamCod,
|
|||
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,"</div>");
|
||||
|
@ -650,7 +650,7 @@ static void Gam_ShowOneGame (long GamCod,
|
|||
|
||||
/* Groups whose users can answer this game */
|
||||
if (Game.Scope == Hie_CRS)
|
||||
if (Gbl.Hierarchy.Crs.Grps.NumGrps)
|
||||
if (Gbl.Crs.Grps.NumGrps)
|
||||
Gam_GetAndWriteNamesOfGrpsAssociatedToGame (&Game);
|
||||
|
||||
/* Text of the game */
|
||||
|
@ -902,7 +902,7 @@ void Gam_GetListGames (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;
|
||||
|
@ -928,7 +928,7 @@ void Gam_GetListGames (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"
|
||||
|
@ -950,7 +950,7 @@ void Gam_GetListGames (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 " :
|
||||
|
@ -1974,7 +1974,7 @@ static void Gam_ShowLstGrpsToEditGame (long GamCod)
|
|||
/***** 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,"<tr>"
|
||||
|
@ -2000,14 +2000,14 @@ static void Gam_ShowLstGrpsToEditGame (long GamCod)
|
|||
"</label>"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
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,"</div>");
|
||||
|
||||
|
@ -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 ();
|
||||
|
|
|
@ -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;
|
||||
|
|
133
swad_global.h
133
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];
|
||||
|
|
580
swad_group.c
580
swad_group.c
File diff suppressed because it is too large
Load Diff
|
@ -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);
|
||||
|
|
|
@ -432,12 +432,12 @@ void Hie_WriteBigNameCtyInsCtrDegCrs (void)
|
|||
"<div id=\"big_short_name\">"
|
||||
"%s" // Short name
|
||||
"</div>",
|
||||
(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;
|
||||
|
|
|
@ -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 ();
|
||||
|
|
240
swad_info.c
240
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,"<li>");
|
||||
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,"<a href=\"%s\" target=\"_blank\" class=\"%s\">",
|
||||
|
@ -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,"<input type=\"radio\""
|
||||
" id=\"InfoSrc%u\" name=\"InfoSrc\" value=\"%u\"",
|
||||
(unsigned) InfoSrc,(unsigned) InfoSrc);
|
||||
|
@ -1190,27 +1190,27 @@ static bool Inf_CheckIfInfoAvailable (Inf_InfoSrc_t InfoSrc)
|
|||
case Inf_INFO_SRC_NONE:
|
||||
return false;
|
||||
case Inf_INFO_SRC_EDITOR:
|
||||
switch (Gbl.Hierarchy.Crs.Info.Type)
|
||||
switch (Gbl.Crs.Info.Type)
|
||||
{
|
||||
case Inf_LECTURES:
|
||||
case Inf_PRACTICALS:
|
||||
return Syl_CheckSyllabus (Gbl.Hierarchy.Crs.Crs.CrsCod,Gbl.Hierarchy.Crs.Info.Type);
|
||||
return Syl_CheckSyllabus (Gbl.Hierarchy.Crs.CrsCod,Gbl.Crs.Info.Type);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false; // Not reached
|
||||
case Inf_INFO_SRC_PLAIN_TEXT:
|
||||
return Inf_CheckPlainTxt (Gbl.Hierarchy.Crs.Crs.CrsCod,
|
||||
Gbl.Hierarchy.Crs.Info.Type);
|
||||
return Inf_CheckPlainTxt (Gbl.Hierarchy.Crs.CrsCod,
|
||||
Gbl.Crs.Info.Type);
|
||||
case Inf_INFO_SRC_RICH_TEXT:
|
||||
return Inf_CheckRichTxt (Gbl.Hierarchy.Crs.Crs.CrsCod,
|
||||
Gbl.Hierarchy.Crs.Info.Type);
|
||||
return Inf_CheckRichTxt (Gbl.Hierarchy.Crs.CrsCod,
|
||||
Gbl.Crs.Info.Type);
|
||||
case Inf_INFO_SRC_PAGE:
|
||||
return Inf_CheckPage (Gbl.Hierarchy.Crs.Crs.CrsCod,
|
||||
Gbl.Hierarchy.Crs.Info.Type);
|
||||
return Inf_CheckPage (Gbl.Hierarchy.Crs.CrsCod,
|
||||
Gbl.Crs.Info.Type);
|
||||
case Inf_INFO_SRC_URL:
|
||||
return Inf_CheckURL (Gbl.Hierarchy.Crs.Crs.CrsCod,
|
||||
Gbl.Hierarchy.Crs.Info.Type);
|
||||
return Inf_CheckURL (Gbl.Hierarchy.Crs.CrsCod,
|
||||
Gbl.Crs.Info.Type);
|
||||
}
|
||||
|
||||
return false; // Not reached
|
||||
|
@ -1224,7 +1224,7 @@ void Inf_FormToEnterIntegratedEditor (Inf_InfoSrc_t InfoSrc)
|
|||
{
|
||||
extern const char *Txt_Edit;
|
||||
|
||||
Frm_StartForm (Inf_ActionsInfo[InfoSrc][Gbl.Hierarchy.Crs.Info.Type]);
|
||||
Frm_StartForm (Inf_ActionsInfo[InfoSrc][Gbl.Crs.Info.Type]);
|
||||
Btn_PutConfirmButton (Txt_Edit);
|
||||
Frm_EndForm ();
|
||||
}
|
||||
|
@ -1237,7 +1237,7 @@ void Inf_FormToEnterPlainTextEditor (Inf_InfoSrc_t InfoSrc)
|
|||
{
|
||||
extern const char *Txt_Edit_plain_text;
|
||||
|
||||
Frm_StartForm (Inf_ActionsInfo[InfoSrc][Gbl.Hierarchy.Crs.Info.Type]);
|
||||
Frm_StartForm (Inf_ActionsInfo[InfoSrc][Gbl.Crs.Info.Type]);
|
||||
Btn_PutConfirmButton (Txt_Edit_plain_text);
|
||||
Frm_EndForm ();
|
||||
}
|
||||
|
@ -1250,7 +1250,7 @@ void Inf_FormToEnterRichTextEditor (Inf_InfoSrc_t InfoSrc)
|
|||
{
|
||||
extern const char *Txt_Edit_rich_text;
|
||||
|
||||
Frm_StartForm (Inf_ActionsInfo[InfoSrc][Gbl.Hierarchy.Crs.Info.Type]);
|
||||
Frm_StartForm (Inf_ActionsInfo[InfoSrc][Gbl.Crs.Info.Type]);
|
||||
Btn_PutConfirmButton (Txt_Edit_rich_text);
|
||||
Frm_EndForm ();
|
||||
}
|
||||
|
@ -1266,7 +1266,7 @@ void Inf_FormToSendPage (Inf_InfoSrc_t InfoSrc)
|
|||
extern const char *Txt_Upload_file;
|
||||
|
||||
/***** Start form *****/
|
||||
Frm_StartForm (Inf_ActionsInfo[InfoSrc][Gbl.Hierarchy.Crs.Info.Type]);
|
||||
Frm_StartForm (Inf_ActionsInfo[InfoSrc][Gbl.Crs.Info.Type]);
|
||||
|
||||
/***** File *****/
|
||||
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">"
|
||||
|
@ -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,"<div class=\"CENTER_MIDDLE\">"
|
||||
|
@ -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,"\" />"
|
||||
"</label>"
|
||||
|
@ -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,"<div class=\"DAT LEFT_MIDDLE\">");
|
||||
|
||||
|
@ -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,"<div id=\"crs_info\" class=\"LEFT_MIDDLE\">");
|
||||
|
||||
|
@ -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,"<body>\n"
|
||||
"<div class=\"DAT LEFT_MIDDLE\">\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))
|
||||
{
|
||||
|
|
|
@ -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,"<option value=\"%ld\"%s>%s</option>",
|
||||
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,"</select>");
|
||||
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,"<td class=\"%s RIGHT_MIDDLE %s\">"
|
||||
"%u"
|
||||
"</td>",
|
||||
TxtClassNormal,BgColor,Ins->NumCtrs);
|
||||
TxtClassNormal,BgColor,Ins->Ctrs.Num);
|
||||
|
||||
/* Number of degrees in this institution */
|
||||
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">"
|
||||
|
@ -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,"<u>");
|
||||
}
|
||||
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,"</u>");
|
||||
fprintf (Gbl.F.Out,"</a>");
|
||||
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,"<tr>"
|
||||
"<td class=\"BM\">");
|
||||
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,"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
"%u"
|
||||
"</td>",
|
||||
Ins->NumCtrs);
|
||||
Ins->Ctrs.Num);
|
||||
|
||||
/* Number of users in courses of this institution */
|
||||
fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_MIDDLE\">"
|
||||
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -332,7 +332,7 @@ void Lay_WriteStartOfPage (void)
|
|||
fprintf (Gbl.F.Out,"<div class=\"MAIN_ZONE_CANVAS\">");
|
||||
|
||||
/* 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"
|
||||
"</script>\n",
|
||||
Gbl.Session.Id,
|
||||
Gbl.Hierarchy.Crs.Crs.CrsCod);
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -916,7 +916,7 @@ void Mai_ListEmails (void)
|
|||
Str_Concat (StrAddresses,UsrDat.Email,
|
||||
Mai_MAX_BYTES_STR_ADDR);
|
||||
fprintf (Gbl.F.Out,"<a href=\"mailto:%s?subject=%s\">%s</a>",
|
||||
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)
|
|||
"<a href=\"mailto:%s?subject=%s&cc=%s&bcc=%s\""
|
||||
" title=\"%s\" class=\"%s\">",
|
||||
Gbl.Usrs.Me.UsrDat.Email,
|
||||
Gbl.Hierarchy.Crs.Crs.FullName,
|
||||
Gbl.Hierarchy.Crs.FullName,
|
||||
Gbl.Usrs.Me.UsrDat.Email,
|
||||
StrAddresses,
|
||||
Txt_Create_email_message,
|
||||
|
|
18
swad_mark.c
18
swad_mark.c
|
@ -128,10 +128,10 @@ void Mrk_GetAndWriteNumRowsHeaderAndFooter (Brw_FileType_t FileType,
|
|||
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_TOP COLOR%u\">",
|
||||
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,"<td class=\"%s RIGHT_TOP COLOR%u\">",
|
||||
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
|
||||
|
|
|
@ -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,"<div class=\"AUTHOR_TXT\">"
|
||||
"(%s)"
|
||||
"</div>",
|
||||
|
|
|
@ -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 ();
|
||||
|
|
|
@ -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,"<div class=\"CENTER_MIDDLE\">"
|
||||
"<a href=\"");
|
||||
RSS_WriteRSSLink (Gbl.F.Out,Gbl.Hierarchy.Crs.Crs.CrsCod);
|
||||
RSS_WriteRSSLink (Gbl.F.Out,Gbl.Hierarchy.Crs.CrsCod);
|
||||
fprintf (Gbl.F.Out,"\" target=\"_blank\">"
|
||||
"<img src=\"%s/rss-square.svg\""
|
||||
" alt=\"RSS\" title=\"RSS\""
|
||||
|
@ -494,7 +494,7 @@ void Not_ShowNotices (Not_Listing_t TypeNoticesListing,long HighlightNotCod)
|
|||
|
||||
/***** Mark possible notification as seen *****/
|
||||
Ntf_MarkNotifAsSeen (Ntf_EVENT_NOTICE,
|
||||
-1L,Gbl.Hierarchy.Crs.Crs.CrsCod,
|
||||
-1L,Gbl.Hierarchy.Crs.CrsCod,
|
||||
Gbl.Usrs.Me.UsrDat.UsrCod);
|
||||
}
|
||||
|
||||
|
@ -570,7 +570,7 @@ static void Not_GetDataAndShowNotice (long NotCod)
|
|||
"Status"
|
||||
" FROM notices"
|
||||
" WHERE NotCod=%ld AND CrsCod=%ld",
|
||||
NotCod,Gbl.Hierarchy.Crs.Crs.CrsCod))
|
||||
NotCod,Gbl.Hierarchy.Crs.CrsCod))
|
||||
{
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
||||
|
@ -933,7 +933,7 @@ unsigned Not_GetNumNotices (Hie_Level_t Scope,Not_Status_t Status,unsigned *NumN
|
|||
" FROM notices"
|
||||
" WHERE CrsCod=%ld"
|
||||
" AND Status=%u",
|
||||
Gbl.Hierarchy.Crs.Crs.CrsCod,
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
Status);
|
||||
break;
|
||||
default:
|
||||
|
@ -1024,7 +1024,7 @@ unsigned Not_GetNumNoticesDeleted (Hie_Level_t Scope,unsigned *NumNotif)
|
|||
"SELECT COUNT(*),SUM(NumNotif)"
|
||||
" FROM notices_deleted"
|
||||
" WHERE CrsCod=%ld",
|
||||
Gbl.Hierarchy.Crs.Crs.CrsCod);
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
break;
|
||||
default:
|
||||
Lay_WrongScopeExit ();
|
||||
|
@ -1085,10 +1085,10 @@ static long Not_GetParamNotCod (void)
|
|||
|
||||
static void Not_SetNotCodToEdit (long NotCod)
|
||||
{
|
||||
Gbl.Hierarchy.Crs.Notices.NotCod = NotCod;
|
||||
Gbl.Crs.Notices.NotCod = NotCod;
|
||||
}
|
||||
|
||||
static long Not_GetNotCodToEdit (void)
|
||||
{
|
||||
return Gbl.Hierarchy.Crs.Notices.NotCod;
|
||||
return Gbl.Crs.Notices.NotCod;
|
||||
}
|
||||
|
|
|
@ -788,7 +788,7 @@ static bool Ntf_StartFormGoToAction (Ntf_NotifyEvent_t NotifyEvent,
|
|||
{
|
||||
if (CrsCod > 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 *****/
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 ();
|
||||
|
|
|
@ -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 ();
|
||||
|
|
284
swad_record.c
284
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,"<tr>");
|
||||
|
@ -300,7 +300,7 @@ void Rec_ListFieldsRecordsForEdition (void)
|
|||
/* Write icon to remove the field */
|
||||
fprintf (Gbl.F.Out,"<td class=\"BM\">");
|
||||
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,"</td>");
|
||||
|
@ -308,12 +308,12 @@ void Rec_ListFieldsRecordsForEdition (void)
|
|||
/* Name of the field */
|
||||
fprintf (Gbl.F.Out,"<td class=\"LEFT_MIDDLE\">");
|
||||
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,"<input type=\"text\" name=\"FieldName\""
|
||||
" style=\"width:500px;\" maxlength=\"%u\" value=\"%s\""
|
||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||
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,"</td>");
|
||||
|
@ -321,11 +321,11 @@ void Rec_ListFieldsRecordsForEdition (void)
|
|||
/* Number of lines in the form */
|
||||
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">");
|
||||
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,"<input type=\"text\" name=\"NumLines\""
|
||||
" size=\"2\" maxlength=\"2\" value=\"%u\""
|
||||
" onchange=\"document.getElementById('%s').submit();\" />",
|
||||
Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].NumLines,
|
||||
Gbl.Crs.Records.LstFields.Lst[NumField].NumLines,
|
||||
Gbl.Form.Id);
|
||||
Frm_EndForm ();
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
@ -333,7 +333,7 @@ void Rec_ListFieldsRecordsForEdition (void)
|
|||
/* Visibility of a field */
|
||||
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">");
|
||||
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,"<select name=\"Visibility\""
|
||||
" onchange=\"document.getElementById('%s').submit();\">",
|
||||
Gbl.Form.Id);
|
||||
|
@ -342,7 +342,7 @@ void Rec_ListFieldsRecordsForEdition (void)
|
|||
Vis++)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Vis);
|
||||
if (Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].Visibility == Vis)
|
||||
if (Gbl.Crs.Records.LstFields.Lst[NumField].Visibility == Vis)
|
||||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out,">%s</option>",
|
||||
Txt_RECORD_FIELD_VISIBILITY_MENU[Vis]);
|
||||
|
@ -388,7 +388,7 @@ void Rec_ShowFormCreateRecordField (void)
|
|||
" style=\"width:500px;\" maxlength=\"%u\" value=\"%s\""
|
||||
" required=\"required\" />"
|
||||
"</td>",
|
||||
Rec_MAX_CHARS_NAME_FIELD,Gbl.Hierarchy.Crs.Records.Field.Name);
|
||||
Rec_MAX_CHARS_NAME_FIELD,Gbl.Crs.Records.Field.Name);
|
||||
|
||||
/***** Number of lines in form ******/
|
||||
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
|
||||
|
@ -396,7 +396,7 @@ void Rec_ShowFormCreateRecordField (void)
|
|||
" size=\"2\" maxlength=\"2\" value=\"%u\""
|
||||
" required=\"required\" />"
|
||||
"</td>",
|
||||
Gbl.Hierarchy.Crs.Records.Field.NumLines);
|
||||
Gbl.Crs.Records.Field.NumLines);
|
||||
|
||||
/***** Visibility to students *****/
|
||||
fprintf (Gbl.F.Out,"<td class=\"CENTER_MIDDLE\">"
|
||||
|
@ -406,7 +406,7 @@ void Rec_ShowFormCreateRecordField (void)
|
|||
Vis++)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<option value=\"%u\"",(unsigned) Vis);
|
||||
if (Gbl.Hierarchy.Crs.Records.Field.Visibility == Vis)
|
||||
if (Gbl.Crs.Records.Field.Visibility == Vis)
|
||||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out,">%s</option>",
|
||||
Txt_RECORD_FIELD_VISIBILITY_MENU[Vis]);
|
||||
|
@ -461,29 +461,29 @@ void Rec_ReceiveFormField (void)
|
|||
|
||||
/***** Get parameters from the form *****/
|
||||
/* Get the name of the field */
|
||||
Par_GetParToText ("FieldName",Gbl.Hierarchy.Crs.Records.Field.Name,
|
||||
Par_GetParToText ("FieldName",Gbl.Crs.Records.Field.Name,
|
||||
Rec_MAX_BYTES_NAME_FIELD);
|
||||
|
||||
/* Get the number of lines */
|
||||
Gbl.Hierarchy.Crs.Records.Field.NumLines = (unsigned)
|
||||
Gbl.Crs.Records.Field.NumLines = (unsigned)
|
||||
Par_GetParToUnsignedLong ("NumLines",
|
||||
Rec_MIN_LINES_IN_EDITION_FIELD,
|
||||
Rec_MAX_LINES_IN_EDITION_FIELD,
|
||||
Rec_DEF_LINES_IN_EDITION_FIELD);
|
||||
|
||||
/* Get the field visibility by students */
|
||||
Gbl.Hierarchy.Crs.Records.Field.Visibility = (Rec_VisibilityRecordFields_t)
|
||||
Gbl.Crs.Records.Field.Visibility = (Rec_VisibilityRecordFields_t)
|
||||
Par_GetParToUnsignedLong ("Visibility",
|
||||
0,
|
||||
Rec_NUM_TYPES_VISIBILITY - 1,
|
||||
(unsigned long) Rec_VISIBILITY_DEFAULT);
|
||||
|
||||
if (Gbl.Hierarchy.Crs.Records.Field.Name[0]) // If there's a name
|
||||
if (Gbl.Crs.Records.Field.Name[0]) // If there's a name
|
||||
{
|
||||
/***** If the field already was in the database... *****/
|
||||
if (Rec_CheckIfRecordFieldIsRepeated (Gbl.Hierarchy.Crs.Records.Field.Name))
|
||||
if (Rec_CheckIfRecordFieldIsRepeated (Gbl.Crs.Records.Field.Name))
|
||||
Ale_ShowAlert (Ale_ERROR,Txt_The_record_field_X_already_exists,
|
||||
Gbl.Hierarchy.Crs.Records.Field.Name);
|
||||
Gbl.Crs.Records.Field.Name);
|
||||
else // Add the new field to the database
|
||||
Rec_CreateRecordField ();
|
||||
}
|
||||
|
@ -558,7 +558,7 @@ unsigned long Rec_GetAllFieldsInCurrCrs (MYSQL_RES **mysql_res)
|
|||
"SELECT FieldCod,FieldName,Visibility"
|
||||
" FROM crs_record_fields"
|
||||
" WHERE CrsCod=%ld ORDER BY FieldName",
|
||||
Gbl.Hierarchy.Crs.Crs.CrsCod);
|
||||
Gbl.Hierarchy.Crs.CrsCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -575,14 +575,14 @@ void Rec_CreateRecordField (void)
|
|||
" (CrsCod,FieldName,NumLines,Visibility)"
|
||||
" VALUES"
|
||||
" (%ld,'%s',%u,%u)",
|
||||
Gbl.Hierarchy.Crs.Crs.CrsCod,
|
||||
Gbl.Hierarchy.Crs.Records.Field.Name,
|
||||
Gbl.Hierarchy.Crs.Records.Field.NumLines,
|
||||
(unsigned) Gbl.Hierarchy.Crs.Records.Field.Visibility);
|
||||
Gbl.Hierarchy.Crs.CrsCod,
|
||||
Gbl.Crs.Records.Field.Name,
|
||||
Gbl.Crs.Records.Field.NumLines,
|
||||
(unsigned) Gbl.Crs.Records.Field.Visibility);
|
||||
|
||||
/***** Write message of success *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Created_new_record_field_X,
|
||||
Gbl.Hierarchy.Crs.Records.Field.Name);
|
||||
Gbl.Crs.Records.Field.Name);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -594,11 +594,11 @@ void Rec_ReqRemField (void)
|
|||
unsigned NumRecords;
|
||||
|
||||
/***** Get the code of field *****/
|
||||
if ((Gbl.Hierarchy.Crs.Records.Field.FieldCod = Rec_GetFieldCod ()) == -1)
|
||||
if ((Gbl.Crs.Records.Field.FieldCod = Rec_GetFieldCod ()) == -1)
|
||||
Lay_ShowErrorAndExit ("Code of field is missing.");
|
||||
|
||||
/***** Check if exists any record with that field filled *****/
|
||||
if ((NumRecords = Rec_CountNumRecordsInCurrCrsWithField (Gbl.Hierarchy.Crs.Records.Field.FieldCod))) // There are records with that field filled
|
||||
if ((NumRecords = Rec_CountNumRecordsInCurrCrsWithField (Gbl.Crs.Records.Field.FieldCod))) // There are records with that field filled
|
||||
Rec_AskConfirmRemFieldWithRecords (NumRecords);
|
||||
else // There are no records with that field filled
|
||||
Rec_RemoveFieldFromDB ();
|
||||
|
@ -639,16 +639,16 @@ void Rec_AskConfirmRemFieldWithRecords (unsigned NumRecords)
|
|||
extern const char *Txt_Remove_record_field;
|
||||
|
||||
/***** Get from the database the name of the field *****/
|
||||
Rec_GetFieldByCod (Gbl.Hierarchy.Crs.Records.Field.FieldCod,
|
||||
Gbl.Hierarchy.Crs.Records.Field.Name,
|
||||
&Gbl.Hierarchy.Crs.Records.Field.NumLines,
|
||||
&Gbl.Hierarchy.Crs.Records.Field.Visibility);
|
||||
Rec_GetFieldByCod (Gbl.Crs.Records.Field.FieldCod,
|
||||
Gbl.Crs.Records.Field.Name,
|
||||
&Gbl.Crs.Records.Field.NumLines,
|
||||
&Gbl.Crs.Records.Field.Visibility);
|
||||
|
||||
/***** Show question and button to remove my photo *****/
|
||||
Ale_ShowAlertAndButton (ActRemFie,NULL,NULL,Rec_PutParamFielCod,
|
||||
Btn_REMOVE_BUTTON,Txt_Remove_record_field,
|
||||
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_field_X_from_the_records_of_Y_Z_,
|
||||
Gbl.Hierarchy.Crs.Records.Field.Name,Gbl.Hierarchy.Crs.Crs.FullName,
|
||||
Gbl.Crs.Records.Field.Name,Gbl.Hierarchy.Crs.FullName,
|
||||
NumRecords);
|
||||
|
||||
/***** List record fields again *****/
|
||||
|
@ -664,24 +664,24 @@ void Rec_RemoveFieldFromDB (void)
|
|||
extern const char *Txt_Record_field_X_removed;
|
||||
|
||||
/***** Get from the database the name of the field *****/
|
||||
Rec_GetFieldByCod (Gbl.Hierarchy.Crs.Records.Field.FieldCod,
|
||||
Gbl.Hierarchy.Crs.Records.Field.Name,
|
||||
&Gbl.Hierarchy.Crs.Records.Field.NumLines,
|
||||
&Gbl.Hierarchy.Crs.Records.Field.Visibility);
|
||||
Rec_GetFieldByCod (Gbl.Crs.Records.Field.FieldCod,
|
||||
Gbl.Crs.Records.Field.Name,
|
||||
&Gbl.Crs.Records.Field.NumLines,
|
||||
&Gbl.Crs.Records.Field.Visibility);
|
||||
|
||||
/***** Remove field from all records *****/
|
||||
DB_QueryDELETE ("can not remove field from all students' records",
|
||||
"DELETE FROM crs_records WHERE FieldCod=%ld",
|
||||
Gbl.Hierarchy.Crs.Records.Field.FieldCod);
|
||||
Gbl.Crs.Records.Field.FieldCod);
|
||||
|
||||
/***** Remove the field *****/
|
||||
DB_QueryDELETE ("can not remove field of record",
|
||||
"DELETE FROM crs_record_fields WHERE FieldCod=%ld",
|
||||
Gbl.Hierarchy.Crs.Records.Field.FieldCod);
|
||||
Gbl.Crs.Records.Field.FieldCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_Record_field_X_removed,
|
||||
Gbl.Hierarchy.Crs.Records.Field.Name);
|
||||
Gbl.Crs.Records.Field.Name);
|
||||
|
||||
/***** Show the form again *****/
|
||||
Rec_ReqEditRecordFields ();
|
||||
|
@ -693,7 +693,7 @@ void Rec_RemoveFieldFromDB (void)
|
|||
|
||||
static void Rec_PutParamFielCod (void)
|
||||
{
|
||||
Par_PutHiddenParamLong ("FieldCod",Gbl.Hierarchy.Crs.Records.Field.FieldCod);
|
||||
Par_PutHiddenParamLong ("FieldCod",Gbl.Crs.Records.Field.FieldCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -714,7 +714,7 @@ static void Rec_GetFieldByCod (long FieldCod,char Name[Rec_MAX_BYTES_NAME_FIELD
|
|||
"SELECT FieldName,NumLines,Visibility"
|
||||
" FROM crs_record_fields"
|
||||
" WHERE CrsCod=%ld AND FieldCod=%ld",
|
||||
Gbl.Hierarchy.Crs.Crs.CrsCod,FieldCod);
|
||||
Gbl.Hierarchy.Crs.CrsCod,FieldCod);
|
||||
|
||||
/***** Count number of rows in result *****/
|
||||
if (NumRows != 1)
|
||||
|
@ -749,7 +749,7 @@ static void Rec_GetFieldByCod (long FieldCod,char Name[Rec_MAX_BYTES_NAME_FIELD
|
|||
void Rec_RemoveField (void)
|
||||
{
|
||||
/***** Get the code of the field *****/
|
||||
if ((Gbl.Hierarchy.Crs.Records.Field.FieldCod = Rec_GetFieldCod ()) == -1)
|
||||
if ((Gbl.Crs.Records.Field.FieldCod = Rec_GetFieldCod ()) == -1)
|
||||
Lay_ShowErrorAndExit ("Code of field is missing.");
|
||||
|
||||
/***** Borrarlo from the database *****/
|
||||
|
@ -770,27 +770,27 @@ void Rec_RenameField (void)
|
|||
|
||||
/***** Get parameters of the form *****/
|
||||
/* Get the code of the field */
|
||||
if ((Gbl.Hierarchy.Crs.Records.Field.FieldCod = Rec_GetFieldCod ()) == -1)
|
||||
if ((Gbl.Crs.Records.Field.FieldCod = Rec_GetFieldCod ()) == -1)
|
||||
Lay_ShowErrorAndExit ("Code of field is missing.");
|
||||
|
||||
/* Get the new group name */
|
||||
Par_GetParToText ("FieldName",NewFieldName,Rec_MAX_BYTES_NAME_FIELD);
|
||||
|
||||
/***** Get from the database the old field name *****/
|
||||
Rec_GetFieldByCod (Gbl.Hierarchy.Crs.Records.Field.FieldCod,
|
||||
Gbl.Hierarchy.Crs.Records.Field.Name,
|
||||
&Gbl.Hierarchy.Crs.Records.Field.NumLines,
|
||||
&Gbl.Hierarchy.Crs.Records.Field.Visibility);
|
||||
Rec_GetFieldByCod (Gbl.Crs.Records.Field.FieldCod,
|
||||
Gbl.Crs.Records.Field.Name,
|
||||
&Gbl.Crs.Records.Field.NumLines,
|
||||
&Gbl.Crs.Records.Field.Visibility);
|
||||
|
||||
/***** Check if new name is empty *****/
|
||||
if (!NewFieldName[0])
|
||||
Ale_ShowAlert (Ale_ERROR,Txt_You_can_not_leave_the_name_of_the_field_X_empty,
|
||||
Gbl.Hierarchy.Crs.Records.Field.Name);
|
||||
Gbl.Crs.Records.Field.Name);
|
||||
else
|
||||
{
|
||||
/***** Check if the name of the olde field match the new one
|
||||
(this happens when return is pressed without changes) *****/
|
||||
if (strcmp (Gbl.Hierarchy.Crs.Records.Field.Name,NewFieldName)) // Different names
|
||||
if (strcmp (Gbl.Crs.Records.Field.Name,NewFieldName)) // Different names
|
||||
{
|
||||
/***** If the group ya estaba in the database... *****/
|
||||
if (Rec_CheckIfRecordFieldIsRepeated (NewFieldName))
|
||||
|
@ -802,11 +802,11 @@ void Rec_RenameField (void)
|
|||
DB_QueryUPDATE ("can not update name of field of record",
|
||||
"UPDATE crs_record_fields SET FieldName='%s'"
|
||||
" WHERE FieldCod=%ld",
|
||||
NewFieldName,Gbl.Hierarchy.Crs.Records.Field.FieldCod);
|
||||
NewFieldName,Gbl.Crs.Records.Field.FieldCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_The_record_field_X_has_been_renamed_as_Y,
|
||||
Gbl.Hierarchy.Crs.Records.Field.Name,NewFieldName);
|
||||
Gbl.Crs.Records.Field.Name,NewFieldName);
|
||||
}
|
||||
}
|
||||
else // The same name
|
||||
|
@ -815,7 +815,7 @@ void Rec_RenameField (void)
|
|||
}
|
||||
|
||||
/***** Show the form again *****/
|
||||
Str_Copy (Gbl.Hierarchy.Crs.Records.Field.Name,NewFieldName,
|
||||
Str_Copy (Gbl.Crs.Records.Field.Name,NewFieldName,
|
||||
Rec_MAX_BYTES_NAME_FIELD);
|
||||
Rec_ReqEditRecordFields ();
|
||||
}
|
||||
|
@ -832,7 +832,7 @@ void Rec_ChangeLinesField (void)
|
|||
|
||||
/***** Get parameters of the form *****/
|
||||
/* Get the code of field */
|
||||
if ((Gbl.Hierarchy.Crs.Records.Field.FieldCod = Rec_GetFieldCod ()) == -1)
|
||||
if ((Gbl.Crs.Records.Field.FieldCod = Rec_GetFieldCod ()) == -1)
|
||||
Lay_ShowErrorAndExit ("Code of field is missing.");
|
||||
|
||||
/* Get the new number of lines */
|
||||
|
@ -843,28 +843,28 @@ void Rec_ChangeLinesField (void)
|
|||
Rec_DEF_LINES_IN_EDITION_FIELD);
|
||||
|
||||
/* Get from the database the number of lines of the field */
|
||||
Rec_GetFieldByCod (Gbl.Hierarchy.Crs.Records.Field.FieldCod,Gbl.Hierarchy.Crs.Records.Field.Name,&Gbl.Hierarchy.Crs.Records.Field.NumLines,&Gbl.Hierarchy.Crs.Records.Field.Visibility);
|
||||
Rec_GetFieldByCod (Gbl.Crs.Records.Field.FieldCod,Gbl.Crs.Records.Field.Name,&Gbl.Crs.Records.Field.NumLines,&Gbl.Crs.Records.Field.Visibility);
|
||||
|
||||
/***** Check if the old number of rows matches the new one
|
||||
(this happens when return is pressed without changes) *****/
|
||||
if (Gbl.Hierarchy.Crs.Records.Field.NumLines == NewNumLines)
|
||||
if (Gbl.Crs.Records.Field.NumLines == NewNumLines)
|
||||
Ale_ShowAlert (Ale_INFO,Txt_The_number_of_editing_lines_in_the_record_field_X_has_not_changed,
|
||||
Gbl.Hierarchy.Crs.Records.Field.Name);
|
||||
Gbl.Crs.Records.Field.Name);
|
||||
else
|
||||
{
|
||||
/***** Update of the table of fields changing the old maximum of students by the new one *****/
|
||||
DB_QueryUPDATE ("can not update the number of lines of a record field",
|
||||
"UPDATE crs_record_fields SET NumLines=%u"
|
||||
" WHERE FieldCod=%ld",
|
||||
NewNumLines,Gbl.Hierarchy.Crs.Records.Field.FieldCod);
|
||||
NewNumLines,Gbl.Crs.Records.Field.FieldCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_From_now_on_the_number_of_editing_lines_of_the_field_X_is_Y,
|
||||
Gbl.Hierarchy.Crs.Records.Field.Name,NewNumLines);
|
||||
Gbl.Crs.Records.Field.Name,NewNumLines);
|
||||
}
|
||||
|
||||
/***** Show the form again *****/
|
||||
Gbl.Hierarchy.Crs.Records.Field.NumLines = NewNumLines;
|
||||
Gbl.Crs.Records.Field.NumLines = NewNumLines;
|
||||
Rec_ReqEditRecordFields ();
|
||||
}
|
||||
|
||||
|
@ -880,7 +880,7 @@ void Rec_ChangeVisibilityField (void)
|
|||
|
||||
/***** Get parameters of the form *****/
|
||||
/* Get the code of field */
|
||||
if ((Gbl.Hierarchy.Crs.Records.Field.FieldCod = Rec_GetFieldCod ()) == -1)
|
||||
if ((Gbl.Crs.Records.Field.FieldCod = Rec_GetFieldCod ()) == -1)
|
||||
Lay_ShowErrorAndExit ("Code of field is missing.");
|
||||
|
||||
/* Get the new visibility of the field */
|
||||
|
@ -891,13 +891,13 @@ void Rec_ChangeVisibilityField (void)
|
|||
(unsigned long) Rec_VISIBILITY_DEFAULT);
|
||||
|
||||
/* Get from the database the visibility of the field */
|
||||
Rec_GetFieldByCod (Gbl.Hierarchy.Crs.Records.Field.FieldCod,Gbl.Hierarchy.Crs.Records.Field.Name,&Gbl.Hierarchy.Crs.Records.Field.NumLines,&Gbl.Hierarchy.Crs.Records.Field.Visibility);
|
||||
Rec_GetFieldByCod (Gbl.Crs.Records.Field.FieldCod,Gbl.Crs.Records.Field.Name,&Gbl.Crs.Records.Field.NumLines,&Gbl.Crs.Records.Field.Visibility);
|
||||
|
||||
/***** Check if the old visibility matches the new one
|
||||
(this happens when return is pressed without changes) *****/
|
||||
if (Gbl.Hierarchy.Crs.Records.Field.Visibility == NewVisibility)
|
||||
if (Gbl.Crs.Records.Field.Visibility == NewVisibility)
|
||||
Ale_ShowAlert (Ale_INFO,Txt_The_visibility_of_the_record_field_X_has_not_changed,
|
||||
Gbl.Hierarchy.Crs.Records.Field.Name);
|
||||
Gbl.Crs.Records.Field.Name);
|
||||
else
|
||||
{
|
||||
/***** Update of the table of fields changing the old visibility by the new *****/
|
||||
|
@ -905,15 +905,15 @@ void Rec_ChangeVisibilityField (void)
|
|||
"UPDATE crs_record_fields SET Visibility=%u"
|
||||
" WHERE FieldCod=%ld",
|
||||
(unsigned) NewVisibility,
|
||||
Gbl.Hierarchy.Crs.Records.Field.FieldCod);
|
||||
Gbl.Crs.Records.Field.FieldCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
Ale_ShowAlert (Ale_SUCCESS,Txt_RECORD_FIELD_VISIBILITY_MSG[NewVisibility],
|
||||
Gbl.Hierarchy.Crs.Records.Field.Name);
|
||||
Gbl.Crs.Records.Field.Name);
|
||||
}
|
||||
|
||||
/***** Show the form again *****/
|
||||
Gbl.Hierarchy.Crs.Records.Field.Visibility = NewVisibility;
|
||||
Gbl.Crs.Records.Field.Visibility = NewVisibility;
|
||||
Rec_ReqEditRecordFields ();
|
||||
}
|
||||
|
||||
|
@ -923,13 +923,13 @@ void Rec_ChangeVisibilityField (void)
|
|||
|
||||
void Rec_FreeListFields (void)
|
||||
{
|
||||
if (Gbl.Hierarchy.Crs.Records.LstFields.NestedCalls > 0)
|
||||
if (--Gbl.Hierarchy.Crs.Records.LstFields.NestedCalls == 0)
|
||||
if (Gbl.Hierarchy.Crs.Records.LstFields.Lst)
|
||||
if (Gbl.Crs.Records.LstFields.NestedCalls > 0)
|
||||
if (--Gbl.Crs.Records.LstFields.NestedCalls == 0)
|
||||
if (Gbl.Crs.Records.LstFields.Lst)
|
||||
{
|
||||
free ((void *) Gbl.Hierarchy.Crs.Records.LstFields.Lst);
|
||||
Gbl.Hierarchy.Crs.Records.LstFields.Lst = NULL;
|
||||
Gbl.Hierarchy.Crs.Records.LstFields.Num = 0;
|
||||
free ((void *) Gbl.Crs.Records.LstFields.Lst);
|
||||
Gbl.Crs.Records.LstFields.Lst = NULL;
|
||||
Gbl.Crs.Records.LstFields.Num = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1101,7 +1101,7 @@ static void Rec_ShowRecordOneStdCrs (void)
|
|||
fprintf (Gbl.F.Out,"</div>");
|
||||
|
||||
/***** Record of the student in the course *****/
|
||||
if (Gbl.Hierarchy.Crs.Records.LstFields.Num) // There are fields in the record
|
||||
if (Gbl.Crs.Records.LstFields.Num) // There are fields in the record
|
||||
{
|
||||
switch (Gbl.Usrs.Me.Role.Logged)
|
||||
{
|
||||
|
@ -1229,7 +1229,7 @@ static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView,
|
|||
fprintf (Gbl.F.Out,"</div>");
|
||||
|
||||
/* Record of the student in the course */
|
||||
if (Gbl.Hierarchy.Crs.Records.LstFields.Num) // There are fields in the record
|
||||
if (Gbl.Crs.Records.LstFields.Num) // There are fields in the record
|
||||
{
|
||||
ItsMe = Usr_ItsMe (UsrDat.UsrCod);
|
||||
if ( Gbl.Usrs.Me.Role.Logged == Rol_NET ||
|
||||
|
@ -1703,9 +1703,9 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
|
|||
if (TypeOfView == Rec_CRS_MY_RECORD_AS_STUDENT_FORM)
|
||||
/* Check if I can edit any of the record fields */
|
||||
for (NumField = 0;
|
||||
NumField < Gbl.Hierarchy.Crs.Records.LstFields.Num;
|
||||
NumField < Gbl.Crs.Records.LstFields.Num;
|
||||
NumField++)
|
||||
if (Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD)
|
||||
if (Gbl.Crs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD)
|
||||
{
|
||||
ICanEdit = true;
|
||||
Frm_StartForm (ActRcvRecCrs);
|
||||
|
@ -1756,7 +1756,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
|
|||
"%s<br />%s<br />%s"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
Gbl.Hierarchy.Deg.FullName,Gbl.Hierarchy.Crs.Crs.FullName,
|
||||
Gbl.Hierarchy.Deg.FullName,Gbl.Hierarchy.Crs.FullName,
|
||||
UsrDat->FullName);
|
||||
Tbl_EndTable ();
|
||||
fprintf (Gbl.F.Out,"</td>"
|
||||
|
@ -1764,12 +1764,12 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
|
|||
|
||||
/***** Fields of the record that depends on the course *****/
|
||||
for (NumField = 0, Gbl.RowEvenOdd = 0;
|
||||
NumField < Gbl.Hierarchy.Crs.Records.LstFields.Num;
|
||||
NumField < Gbl.Crs.Records.LstFields.Num;
|
||||
NumField++, Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd)
|
||||
{
|
||||
ShowField = !(TypeOfView == Rec_CRS_MY_RECORD_AS_STUDENT_FORM ||
|
||||
TypeOfView == Rec_CRS_MY_RECORD_AS_STUDENT_CHECK) ||
|
||||
Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].Visibility != Rec_HIDDEN_FIELD;
|
||||
Gbl.Crs.Records.LstFields.Lst[NumField].Visibility != Rec_HIDDEN_FIELD;
|
||||
// If the field must be shown...
|
||||
if (ShowField)
|
||||
{
|
||||
|
@ -1778,7 +1778,7 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
|
|||
{
|
||||
case Rol_STD:
|
||||
ICanEditThisField = (TypeOfView == Rec_CRS_MY_RECORD_AS_STUDENT_FORM &&
|
||||
Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD);
|
||||
Gbl.Crs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD);
|
||||
break;
|
||||
case Rol_TCH:
|
||||
case Rol_SYS_ADM:
|
||||
|
@ -1797,15 +1797,15 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
|
|||
ICanEditThisField ? The_ClassFormInBox[Gbl.Prefs.Theme] :
|
||||
"REC_DAT_SMALL",
|
||||
Gbl.RowEvenOdd,
|
||||
Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].Name);
|
||||
Gbl.Crs.Records.LstFields.Lst[NumField].Name);
|
||||
if (TypeOfView == Rec_CRS_LIST_ONE_RECORD ||
|
||||
TypeOfView == Rec_CRS_LIST_SEVERAL_RECORDS)
|
||||
fprintf (Gbl.F.Out,"<span class=\"DAT_SMALL\"> (%s)</span>",
|
||||
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]);
|
||||
fprintf (Gbl.F.Out,"</td>");
|
||||
|
||||
/* 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))
|
||||
{
|
||||
ThisFieldHasText = true;
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
@ -1821,8 +1821,8 @@ static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
|
|||
{
|
||||
fprintf (Gbl.F.Out,"<textarea name=\"Field%ld\" rows=\"%u\""
|
||||
" class=\"REC_C2_BOT_INPUT\">",
|
||||
Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].FieldCod,
|
||||
Gbl.Hierarchy.Crs.Records.LstFields.Lst[NumField].NumLines);
|
||||
Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod,
|
||||
Gbl.Crs.Records.LstFields.Lst[NumField].NumLines);
|
||||
if (ThisFieldHasText)
|
||||
fprintf (Gbl.F.Out,"%s",row[0]);
|
||||
fprintf (Gbl.F.Out,"</textarea>");
|
||||
|
@ -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</option>",Txt_Another_country);
|
||||
for (NumCty = 0;
|
||||
NumCty < Gbl.Ctys.Num;
|
||||
NumCty < Gbl.Hierarchy.Sys.Ctys.Num;
|
||||
NumCty++)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<option value=\"%ld\"",
|
||||
Gbl.Ctys.Lst[NumCty].CtyCod);
|
||||
if (Gbl.Ctys.Lst[NumCty].CtyCod == UsrDat->CtyCod)
|
||||
Gbl.Hierarchy.Sys.Ctys.Lst[NumCty].CtyCod);
|
||||
if (Gbl.Hierarchy.Sys.Ctys.Lst[NumCty].CtyCod == UsrDat->CtyCod)
|
||||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out,">%s</option>",
|
||||
Gbl.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]);
|
||||
Gbl.Hierarchy.Sys.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</select>"
|
||||
"</td>"
|
||||
|
@ -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\"></option>");
|
||||
for (NumCty = 0;
|
||||
NumCty < Gbl.Ctys.Num;
|
||||
NumCty < Gbl.Hierarchy.Sys.Ctys.Num;
|
||||
NumCty++)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<option value=\"%ld\"",
|
||||
Gbl.Ctys.Lst[NumCty].CtyCod);
|
||||
if (Gbl.Ctys.Lst[NumCty].CtyCod == Gbl.Usrs.Me.UsrDat.InsCtyCod)
|
||||
Gbl.Hierarchy.Sys.Ctys.Lst[NumCty].CtyCod);
|
||||
if (Gbl.Hierarchy.Sys.Ctys.Lst[NumCty].CtyCod == Gbl.Usrs.Me.UsrDat.InsCtyCod)
|
||||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out,">%s</option>",
|
||||
Gbl.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]);
|
||||
Gbl.Hierarchy.Sys.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</select>");
|
||||
Frm_EndForm ();
|
||||
|
@ -4050,15 +4050,15 @@ static void Rec_ShowFormMyInsCtrDpt (bool IAmATeacher)
|
|||
fprintf (Gbl.F.Out,">%s</option>",
|
||||
Txt_Another_institution);
|
||||
for (NumIns = 0;
|
||||
NumIns < Gbl.Inss.Num;
|
||||
NumIns < Gbl.Hierarchy.Cty.Inss.Num;
|
||||
NumIns++)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<option value=\"%ld\"",
|
||||
Gbl.Inss.Lst[NumIns].InsCod);
|
||||
if (Gbl.Inss.Lst[NumIns].InsCod == Gbl.Usrs.Me.UsrDat.InsCod)
|
||||
Gbl.Hierarchy.Cty.Inss.Lst[NumIns].InsCod);
|
||||
if (Gbl.Hierarchy.Cty.Inss.Lst[NumIns].InsCod == Gbl.Usrs.Me.UsrDat.InsCod)
|
||||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out,">%s</option>",
|
||||
Gbl.Inss.Lst[NumIns].FullName);
|
||||
Gbl.Hierarchy.Cty.Inss.Lst[NumIns].FullName);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</select>");
|
||||
Frm_EndForm ();
|
||||
|
@ -4096,15 +4096,15 @@ static void Rec_ShowFormMyInsCtrDpt (bool IAmATeacher)
|
|||
fprintf (Gbl.F.Out,">%s</option>",
|
||||
Txt_Another_centre);
|
||||
for (NumCtr = 0;
|
||||
NumCtr < Gbl.Ctrs.Num;
|
||||
NumCtr < Gbl.Hierarchy.Ins.Ctrs.Num;
|
||||
NumCtr++)
|
||||
{
|
||||
fprintf (Gbl.F.Out,"<option value=\"%ld\"",
|
||||
Gbl.Ctrs.Lst[NumCtr].CtrCod);
|
||||
if (Gbl.Ctrs.Lst[NumCtr].CtrCod == Gbl.Usrs.Me.UsrDat.Tch.CtrCod)
|
||||
Gbl.Hierarchy.Ins.Ctrs.Lst[NumCtr].CtrCod);
|
||||
if (Gbl.Hierarchy.Ins.Ctrs.Lst[NumCtr].CtrCod == Gbl.Usrs.Me.UsrDat.Tch.CtrCod)
|
||||
fprintf (Gbl.F.Out," selected=\"selected\"");
|
||||
fprintf (Gbl.F.Out,">%s</option>",
|
||||
Gbl.Ctrs.Lst[NumCtr].FullName);
|
||||
Gbl.Hierarchy.Ins.Ctrs.Lst[NumCtr].FullName);
|
||||
}
|
||||
fprintf (Gbl.F.Out,"</select>");
|
||||
Frm_EndForm ();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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,"</div>");
|
||||
|
@ -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,"<tr>"
|
||||
|
@ -2041,14 +2041,14 @@ static void Svy_ShowLstGrpsToEditSurvey (long SvyCod)
|
|||
"</label>"
|
||||
"</td>"
|
||||
"</tr>",
|
||||
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,"</div>");
|
||||
|
||||
|
@ -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 ();
|
||||
|
|
|
@ -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,"<body>\n"
|
||||
"<table>\n");
|
||||
|
||||
|
@ -909,9 +909,9 @@ static void Syl_PutFormItemSyllabus (bool NewItem,unsigned NumItem,int Level,int
|
|||
/***** Text of the item *****/
|
||||
fprintf (Gbl.F.Out,"<td colspan=\"%d\" class=\"LEFT_MIDDLE COLOR%u\">",
|
||||
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;
|
||||
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
/********************************* 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
|
|
@ -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;
|
||||
|
|
84
swad_test.c
84
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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -232,7 +232,7 @@ static void TT_ShowTimeTableGrpsSelected (void)
|
|||
extern const char *Txt_All_groups;
|
||||
|
||||
fprintf (Gbl.F.Out,"<div class=\"CLASSPHOTO_TITLE CENTER_MIDDLE\">");
|
||||
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</option>",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;
|
||||
|
|
124
swad_user.c
124
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,"<th class=\"LEFT_MIDDLE LIGHT_BLUE\">"
|
||||
"%s %s "
|
||||
"</th>",
|
||||
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,"<th class=\"LEFT_MIDDLE LIGHT_BLUE\">"
|
||||
"%s "
|
||||
"</th>",
|
||||
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,"</tr>"
|
||||
|
@ -6790,12 +6790,12 @@ void Usr_ListAllDataStds (void)
|
|||
fprintf (Gbl.F.Out,"<td class=\"VERY_LIGHT_BLUE\">"
|
||||
"</td>");
|
||||
for (NumField = 0;
|
||||
NumField < Gbl.Hierarchy.Crs.Records.LstFields.Num;
|
||||
NumField < Gbl.Crs.Records.LstFields.Num;
|
||||
NumField++)
|
||||
fprintf (Gbl.F.Out,"<th class=\"LEFT_MIDDLE VERY_LIGHT_BLUE\">"
|
||||
"(%s) "
|
||||
"</th>",
|
||||
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
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in New Issue