Version 16.225.10

This commit is contained in:
Antonio Cañas Vargas 2017-05-29 13:20:48 +02:00
parent 9628123aae
commit a6e47e0c51
2 changed files with 34 additions and 11 deletions

View File

@ -233,13 +233,14 @@
/****************************** Public constants *****************************/
/*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.225.9 (2017-05-29)"
#define Log_PLATFORM_VERSION "SWAD 16.225.10 (2017-05-29)"
#define CSS_FILE "swad16.222.css"
#define JS_FILE "swad16.206.3.js"
// Number of lines (includes comments but not blank lines) has been got with the following command:
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/*
Version 16.225.10:May 29, 2017 Buttons to register students in listing of teacher's courses. (220561 lines)
Version 16.225.9: May 29, 2017 Fixed minor bug in user administration. (220540 lines)
Version 16.225.8: May 29, 2017 Statistics of hits in course accessible by non-editing teachers.
Changes in error handlong in stats of hits. (220514 lines)

View File

@ -45,6 +45,7 @@
#include "swad_notification.h"
#include "swad_parameter.h"
#include "swad_QR.h"
#include "swad_role.h"
#include "swad_RSS.h"
#include "swad_tab.h"
#include "swad_theme.h"
@ -513,6 +514,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
extern const char *Txt_My_courses;
extern const char *Txt_System;
extern const char *Txt_Go_to_X;
extern const char *Txt_Register_students;
struct Country Cty;
struct Instit Ins;
struct Centre Ctr;
@ -539,6 +541,7 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
char ActTxt[Act_MAX_BYTES_ACTION_TXT + 1];
const char *ClassNormal;
char ClassHighlight[64];
Rol_Role_t MyRoleInCrsDB;
ClassNormal = The_ClassForm[Gbl.Prefs.Theme];
sprintf (ClassHighlight,"%s LIGHT_BLUE",The_ClassFormDark[Gbl.Prefs.Theme]);
@ -744,6 +747,25 @@ static void Crs_WriteListMyCoursesToSelectOne (void)
Crs.FullName,
Crs.FullName);
Act_FormEnd ();
/***** Put link to register students *****/
MyRoleInCrsDB = Rol_GetRoleInCrs (Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
if (MyRoleInCrsDB == Rol_TCH) // I am a teacher in this course
{
Crs.NumUsrs[Rol_STD] = Usr_GetNumUsrsInCrs (Rol_STD,Crs.CrsCod);
if (!Crs.NumUsrs[Rol_STD]) // No students in this course
{
Act_FormStart (ActReqEnrSevStd);
Crs_PutParamCrsCod (Crs.CrsCod);
fprintf (Gbl.F.Out,"<button type=\"submit\" class=\"BT_SUBMIT_INLINE BT_CONFIRM\">"
"%s"
"</button>",
Txt_Register_students);
Act_FormEnd ();
}
}
fprintf (Gbl.F.Out,"</li>");
}
@ -1991,10 +2013,10 @@ bool Crs_GetDataOfCourseByCod (struct Course *Crs)
Crs->RequesterUsrCod = -1L;
Crs->ShrtName[0] = '\0';
Crs->FullName[0] = '\0';
Crs->NumUsrs[Rol_UNK ] =
Crs->NumUsrs[Rol_STD ] =
Crs->NumUsrs[Rol_UNK] =
Crs->NumUsrs[Rol_STD] =
Crs->NumUsrs[Rol_NET] =
Crs->NumUsrs[Rol_TCH ] = 0;
Crs->NumUsrs[Rol_TCH] = 0;
/***** Check if course code is correct *****/
if (Crs->CrsCod > 0)
@ -2056,12 +2078,12 @@ static void Crs_GetDataOfCourseFromRow (struct Course *Crs,MYSQL_ROW row)
Hie_MAX_BYTES_FULL_NAME);
/***** Get number of users *****/
Crs->NumUsrs[Rol_STD ] = Usr_GetNumUsrsInCrs (Rol_STD ,Crs->CrsCod);
Crs->NumUsrs[Rol_STD] = Usr_GetNumUsrsInCrs (Rol_STD,Crs->CrsCod);
Crs->NumUsrs[Rol_NET] = Usr_GetNumUsrsInCrs (Rol_NET,Crs->CrsCod);
Crs->NumUsrs[Rol_TCH ] = Usr_GetNumUsrsInCrs (Rol_TCH ,Crs->CrsCod);
Crs->NumUsrs[Rol_UNK ] = Crs->NumUsrs[Rol_STD ] +
Crs->NumUsrs[Rol_NET] +
Crs->NumUsrs[Rol_TCH ];
Crs->NumUsrs[Rol_TCH] = Usr_GetNumUsrsInCrs (Rol_TCH,Crs->CrsCod);
Crs->NumUsrs[Rol_UNK] = Crs->NumUsrs[Rol_STD] +
Crs->NumUsrs[Rol_NET] +
Crs->NumUsrs[Rol_TCH];
}
/*****************************************************************************/
@ -3162,9 +3184,9 @@ static void Crs_WriteRowCrsData (unsigned NumCrs,MYSQL_ROW row,bool WriteColumnA
Lay_ShowErrorAndExit ("Wrong code of course.");
/***** Get number of teachers and students in this course *****/
NumTchs = Usr_GetNumUsrsInCrs (Rol_TCH ,CrsCod) +
NumTchs = Usr_GetNumUsrsInCrs (Rol_TCH,CrsCod) +
Usr_GetNumUsrsInCrs (Rol_NET,CrsCod);
NumStds = Usr_GetNumUsrsInCrs (Rol_STD ,CrsCod);
NumStds = Usr_GetNumUsrsInCrs (Rol_STD,CrsCod);
if (NumTchs + NumStds)
{
Style = "DAT_N";