From d3dcc2faa98663f81b6b9ad7ab5207642f19698b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Sat, 25 Jul 2015 20:20:07 +0200 Subject: [PATCH] Version 14.120.3 --- swad_centre.c | 4 +-- swad_centre.h | 2 +- swad_changelog.h | 3 ++- swad_country.c | 4 +-- swad_country.h | 2 +- swad_course.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++ swad_course.h | 1 + swad_degree.c | 32 ++++++++++++++++------ swad_institution.c | 4 +-- swad_institution.h | 2 +- 10 files changed, 102 insertions(+), 18 deletions(-) diff --git a/swad_centre.c b/swad_centre.c index 2b41e2d6..36d5fe1e 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -1057,7 +1057,7 @@ void Ctr_FreeListCentres (void) /************************** Write selector of centre *************************/ /*****************************************************************************/ -void Ctr_WriteSelectorOfCentre (Act_Action_t NextAction) +void Ctr_WriteSelectorOfCentre (void) { extern const char *Txt_Centre; char Query[128]; @@ -1068,7 +1068,7 @@ void Ctr_WriteSelectorOfCentre (Act_Action_t NextAction) long CtrCod; /***** Start form *****/ - Act_FormGoToStart (NextAction); + Act_FormGoToStart (ActSeeDeg); fprintf (Gbl.F.Out,"" "", + Txt_Course); + + if (Gbl.CurrentDeg.Deg.DegCod > 0) + { + /***** Get courses belonging to the current degree from database *****/ + sprintf (Query,"SELECT CrsCod,ShortName FROM courses" + " WHERE DegCod='%ld'" + " ORDER BY ShortName", + Gbl.CurrentDeg.Deg.DegCod); + NumCrss = (unsigned) DB_QuerySELECT (Query,&mysql_res,"can not get courses of a degree"); + + /***** Get courses of this degree *****/ + for (NumCrs = 0; + NumCrs < NumCrss; + NumCrs++) + { + /* Get next course */ + row = mysql_fetch_row (mysql_res); + + /* Get course code (row[0]) */ + if ((CrsCod = Str_ConvertStrCodToLongCod (row[0])) < 0) + Lay_ShowErrorAndExit ("Wrong course."); + + /* Write option */ + fprintf (Gbl.F.Out,"",row[1]); + } + + /***** Free structure that stores the query result *****/ + DB_FreeMySQLResult (&mysql_res); + } + + /***** End form *****/ + fprintf (Gbl.F.Out,""); + Act_FormEnd (); + } + /*****************************************************************************/ /************************** Show courses of a degree *************************/ /*****************************************************************************/ diff --git a/swad_course.h b/swad_course.h index 4d7c53f3..43a1336c 100644 --- a/swad_course.h +++ b/swad_course.h @@ -104,6 +104,7 @@ unsigned Crs_GetNumCrssInCtr (long CtrCod); unsigned Crs_GetNumCrssInDeg (long DegCod); unsigned Crs_GetNumCrssWithUsrs (Rol_Role_t Role,const char *SubQuery); +void Crs_WriteSelectorOfCourse (void); void Crs_ShowCrssOfCurrentDeg (void); void Crs_ReqEditCourses (void); void Crs_FreeListCoursesInDegree (struct Degree *Deg); diff --git a/swad_degree.c b/swad_degree.c index bbad2d8f..514184ed 100644 --- a/swad_degree.c +++ b/swad_degree.c @@ -86,7 +86,7 @@ typedef enum static void Deg_Configuration (bool PrintView); static void Deg_ListDegreeTypes (void); -static void Deg_WriteSelectorOfDegree (Act_Action_t NextAction); +static void Deg_WriteSelectorOfDegree (void); static void Deg_EditDegreeTypes (void); static void Deg_ListDegreeTypesForSeeing (void); static void Deg_ListDegreeTypesForEdition (void); @@ -489,6 +489,7 @@ void Deg_WriteMenuAllCourses (void) extern const char *Txt_Institution; extern const char *Txt_Centre; extern const char *Txt_Degree; + extern const char *Txt_Course; /***** Start of table *****/ fprintf (Gbl.F.Out,"" "" ""); @@ -516,7 +517,7 @@ void Deg_WriteMenuAllCourses (void) "" "" ""); @@ -530,7 +531,7 @@ void Deg_WriteMenuAllCourses (void) "" "" ""); @@ -544,9 +545,24 @@ void Deg_WriteMenuAllCourses (void) "" "" ""); + + if (Gbl.CurrentDeg.Deg.DegCod > 0) + { + /***** Write a 5th selector + with all the courses of selected degree *****/ + fprintf (Gbl.F.Out,"" + "" + "" + ""); + } } } } @@ -559,7 +575,7 @@ void Deg_WriteMenuAllCourses (void) /*************************** Write selector of degree ************************/ /*****************************************************************************/ -static void Deg_WriteSelectorOfDegree (Act_Action_t NextAction) +static void Deg_WriteSelectorOfDegree (void) { extern const char *Txt_Degree; char Query[512]; @@ -570,7 +586,7 @@ static void Deg_WriteSelectorOfDegree (Act_Action_t NextAction) long DegCod; /***** Start form *****/ - Act_FormGoToStart (NextAction); + Act_FormGoToStart (ActSeeCrs); fprintf (Gbl.F.Out,"
", The_ClassFormul[Gbl.Prefs.Theme],Txt_Country); - Cty_WriteSelectorOfCountry (ActSeeIns); + Cty_WriteSelectorOfCountry (); fprintf (Gbl.F.Out,"
", The_ClassFormul[Gbl.Prefs.Theme],Txt_Institution); - Ins_WriteSelectorOfInstitution (ActSeeCtr); + Ins_WriteSelectorOfInstitution (); fprintf (Gbl.F.Out,"
", The_ClassFormul[Gbl.Prefs.Theme],Txt_Centre); - Ctr_WriteSelectorOfCentre (ActSeeDeg); + Ctr_WriteSelectorOfCentre (); fprintf (Gbl.F.Out,"
", The_ClassFormul[Gbl.Prefs.Theme],Txt_Degree); - Deg_WriteSelectorOfDegree (ActSeeCrs); + Deg_WriteSelectorOfDegree (); fprintf (Gbl.F.Out,"
" + "%s:" + "", + The_ClassFormul[Gbl.Prefs.Theme],Txt_Course); + Crs_WriteSelectorOfCourse (); + fprintf (Gbl.F.Out,"