Version 16.220.2

This commit is contained in:
Antonio Cañas Vargas 2017-05-21 14:43:10 +02:00
parent a65d5b0524
commit f5b33ab1c1
11 changed files with 145 additions and 154 deletions

View File

@ -79,6 +79,7 @@ extern struct Globals Gbl;
static void Ctr_Configuration (bool PrintView); static void Ctr_Configuration (bool PrintView);
static void Ctr_PutIconsToPrintAndUpload (void); static void Ctr_PutIconsToPrintAndUpload (void);
static void Ctr_PutIconToChangePhoto (void); static void Ctr_PutIconToChangePhoto (void);
static void Ctr_ShowNumUsrsInCrssOfCtr (Rol_Role_t Role);
static void Ctr_ListCentres (void); static void Ctr_ListCentres (void);
static bool Ctr_CheckIfICanCreateCentres (void); static bool Ctr_CheckIfICanCreateCentres (void);
@ -288,7 +289,6 @@ static void Ctr_Configuration (bool PrintView)
extern const char *Txt_Degrees; extern const char *Txt_Degrees;
extern const char *Txt_Degrees_of_CENTRE_X; extern const char *Txt_Degrees_of_CENTRE_X;
extern const char *Txt_Courses; extern const char *Txt_Courses;
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
unsigned NumIns; unsigned NumIns;
struct Place Plc; struct Place Plc;
char PathPhoto[PATH_MAX + 1]; char PathPhoto[PATH_MAX + 1];
@ -618,59 +618,11 @@ static void Ctr_Configuration (bool PrintView)
Txt_Courses, Txt_Courses,
Crs_GetNumCrssInCtr (Gbl.CurrentCtr.Ctr.CtrCod)); Crs_GetNumCrssInCtr (Gbl.CurrentCtr.Ctr.CtrCod));
/***** Number of teachers in courses of this centre *****/
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">"
"%s:"
"</td>"
"<td class=\"DAT LEFT_MIDDLE\">"
"%u"
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_TCH][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfCtr (Rol_TCH,Gbl.CurrentCtr.Ctr.CtrCod));
/***** Number of non-editing teachers in courses of this centre *****/
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">"
"%s:"
"</td>"
"<td class=\"DAT LEFT_MIDDLE\">"
"%u"
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_NED_TCH][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfCtr (Rol_NED_TCH,Gbl.CurrentCtr.Ctr.CtrCod));
/***** Number of students in courses of this centre *****/
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">"
"%s:"
"</td>"
"<td class=\"DAT LEFT_MIDDLE\">"
"%u"
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfCtr (Rol_STD,Gbl.CurrentCtr.Ctr.CtrCod));
/***** Number of users in courses of this centre *****/ /***** Number of users in courses of this centre *****/
fprintf (Gbl.F.Out,"<tr>" Ctr_ShowNumUsrsInCrssOfCtr (Rol_TCH);
"<td class=\"%s RIGHT_MIDDLE\">" Ctr_ShowNumUsrsInCrssOfCtr (Rol_NED_TCH);
"%s + %s + %s:" Ctr_ShowNumUsrsInCrssOfCtr (Rol_STD);
"</td>" Ctr_ShowNumUsrsInCrssOfCtr (Rol_UNK);
"<td class=\"DAT LEFT_MIDDLE\">"
"%u"
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_TCH ][Usr_SEX_UNKNOWN],
Txt_ROLES_PLURAL_Abc[Rol_NED_TCH][Usr_SEX_UNKNOWN],
Txt_ROLES_PLURAL_Abc[Rol_STD ][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfCtr (Rol_UNK,Gbl.CurrentCtr.Ctr.CtrCod));
} }
/***** End table *****/ /***** End table *****/
@ -727,6 +679,30 @@ static void Ctr_PutIconToChangePhoto (void)
NULL); NULL);
} }
/*****************************************************************************/
/**************** Number of users in courses of this centre ******************/
/*****************************************************************************/
static void Ctr_ShowNumUsrsInCrssOfCtr (Rol_Role_t Role)
{
extern const char *The_ClassForm[The_NUM_THEMES];
extern const char *Txt_Users_in_courses;
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">"
"%s:"
"</td>"
"<td class=\"DAT LEFT_MIDDLE\">"
"%u"
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
(Role == Rol_UNK) ? Txt_Users_in_courses :
Txt_ROLES_PLURAL_Abc[Role][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfCtr (Role,Gbl.CurrentCtr.Ctr.CtrCod));
}
/*****************************************************************************/ /*****************************************************************************/
/*************** Show the centres of the current institution *****************/ /*************** Show the centres of the current institution *****************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -233,13 +233,14 @@
/****************************** Public constants *****************************/ /****************************** Public constants *****************************/
/*****************************************************************************/ /*****************************************************************************/
#define Log_PLATFORM_VERSION "SWAD 16.220.1 (2017-05-20)" #define Log_PLATFORM_VERSION "SWAD 16.220.2 (2017-05-21)"
#define CSS_FILE "swad16.209.3.css" #define CSS_FILE "swad16.209.3.css"
#define JS_FILE "swad16.206.3.js" #define JS_FILE "swad16.206.3.js"
// Number of lines (includes comments but not blank lines) has been got with the following command: // 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 // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1
/* /*
Version 16.220.2: May 21, 2017 Changes related with new role. Not finished. (219319 lines)
Version 16.220.1: May 20, 2017 Changes related with new role. Not finished. (219332 lines) Version 16.220.1: May 20, 2017 Changes related with new role. Not finished. (219332 lines)
Version 16.220: May 19, 2017 Changes permission of actions after creating new role. Not finished. (219227 lines) Version 16.220: May 19, 2017 Changes permission of actions after creating new role. Not finished. (219227 lines)
Version 16.219: May 19, 2017 New role: non-editing teacher. Not finished. (219226 lines) Version 16.219: May 19, 2017 New role: non-editing teacher. Not finished. (219226 lines)

View File

@ -65,6 +65,7 @@ extern struct Globals Gbl;
static void Cty_Configuration (bool PrintView); static void Cty_Configuration (bool PrintView);
static void Cty_PutIconToPrint (void); static void Cty_PutIconToPrint (void);
static void Cty_ShowNumUsrsInCrssOfCty (Rol_Role_t Role);
static void Cty_PutHeadCountriesForSeeing (bool OrderSelectable); static void Cty_PutHeadCountriesForSeeing (bool OrderSelectable);
static void Cty_ListOneCountryForSeeing (struct Country *Cty,unsigned NumCty); static void Cty_ListOneCountryForSeeing (struct Country *Cty,unsigned NumCty);
@ -232,7 +233,6 @@ static void Cty_Configuration (bool PrintView)
extern const char *Txt_Degrees; extern const char *Txt_Degrees;
extern const char *Txt_Courses; extern const char *Txt_Courses;
extern const char *Txt_Users_of_the_country; extern const char *Txt_Users_of_the_country;
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
char *MapAttribution = NULL; char *MapAttribution = NULL;
bool PutLink = !PrintView && Gbl.CurrentCty.Cty.WWW[Gbl.Prefs.Language][0]; bool PutLink = !PrintView && Gbl.CurrentCty.Cty.WWW[Gbl.Prefs.Language][0];
@ -428,45 +428,11 @@ static void Cty_Configuration (bool PrintView)
Txt_Courses, Txt_Courses,
Crs_GetNumCrssInCty (Gbl.CurrentCty.Cty.CtyCod)); Crs_GetNumCrssInCty (Gbl.CurrentCty.Cty.CtyCod));
/***** Number of teachers in courses of this country *****/
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">"
"%s:"
"</td>"
"<td class=\"DAT LEFT_MIDDLE\">"
"%u"
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_TCH][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfCty (Rol_TCH,Gbl.CurrentCty.Cty.CtyCod));
/***** Number of students in courses of this country *****/
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">"
"%s:"
"</td>"
"<td class=\"DAT LEFT_MIDDLE\">"
"%u"
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfCty (Rol_STD,Gbl.CurrentCty.Cty.CtyCod));
/***** Number of users in courses of this country *****/ /***** Number of users in courses of this country *****/
fprintf (Gbl.F.Out,"<tr>" Cty_ShowNumUsrsInCrssOfCty (Rol_TCH);
"<td class=\"%s RIGHT_MIDDLE\">" Cty_ShowNumUsrsInCrssOfCty (Rol_NED_TCH);
"%s + %s:" Cty_ShowNumUsrsInCrssOfCty (Rol_STD);
"</td>" Cty_ShowNumUsrsInCrssOfCty (Rol_UNK);
"<td class=\"DAT LEFT_MIDDLE\">"
"%u"
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_TCH][Usr_SEX_UNKNOWN],
Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfCty (Rol_UNK,Gbl.CurrentCty.Cty.CtyCod));
} }
/***** End table *****/ /***** End table *****/
@ -486,6 +452,30 @@ static void Cty_PutIconToPrint (void)
Lay_PutContextualIconToPrint (ActPrnCtyInf,NULL); Lay_PutContextualIconToPrint (ActPrnCtyInf,NULL);
} }
/*****************************************************************************/
/**************** Number of users in courses of this country *****************/
/*****************************************************************************/
static void Cty_ShowNumUsrsInCrssOfCty (Rol_Role_t Role)
{
extern const char *The_ClassForm[The_NUM_THEMES];
extern const char *Txt_Users_in_courses;
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">"
"%s:"
"</td>"
"<td class=\"DAT LEFT_MIDDLE\">"
"%u"
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
(Role == Rol_UNK) ? Txt_Users_in_courses :
Txt_ROLES_PLURAL_Abc[Role][Usr_SEX_UNKNOWN],
Usr_GetNumUsrsInCrssOfCty (Role,Gbl.CurrentCty.Cty.CtyCod));
}
/*****************************************************************************/ /*****************************************************************************/
/*************************** List all the countries **************************/ /*************************** List all the countries **************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -73,6 +73,7 @@ extern struct Globals Gbl;
static void Crs_Configuration (bool PrintView); static void Crs_Configuration (bool PrintView);
static void Crs_PutIconToPrint (void); static void Crs_PutIconToPrint (void);
static void Crs_ShowNumUsrsInCrs (Rol_Role_t Role);
static void Crs_WriteListMyCoursesToSelectOne (void); static void Crs_WriteListMyCoursesToSelectOne (void);
@ -170,7 +171,6 @@ static void Crs_Configuration (bool PrintView)
extern const char *Txt_Shortcut; extern const char *Txt_Shortcut;
extern const char *Txt_STR_LANG_ID[1 + Txt_NUM_LANGUAGES]; extern const char *Txt_STR_LANG_ID[1 + Txt_NUM_LANGUAGES];
extern const char *Txt_QR_code; extern const char *Txt_QR_code;
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
extern const char *Txt_Indicators; extern const char *Txt_Indicators;
extern const char *Txt_of_PART_OF_A_TOTAL; extern const char *Txt_of_PART_OF_A_TOTAL;
unsigned NumDeg; unsigned NumDeg;
@ -427,29 +427,10 @@ static void Crs_Configuration (bool PrintView)
} }
else else
{ {
/***** Number of teachers *****/ /***** Number of users *****/
fprintf (Gbl.F.Out,"<tr>" Crs_ShowNumUsrsInCrs (Rol_TCH);
"<td class=\"%s RIGHT_MIDDLE\">" Crs_ShowNumUsrsInCrs (Rol_NED_TCH);
"%s:" Crs_ShowNumUsrsInCrs (Rol_STD);
"</td>"
"<td class=\"DAT LEFT_MIDDLE\">"
"%u"
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_TCH][Usr_SEX_UNKNOWN],Gbl.CurrentCrs.Crs.NumTchs);
/***** Number of students *****/
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">"
"%s:"
"</td>"
"<td class=\"DAT LEFT_MIDDLE\">"
"%u"
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Rol_STD][Usr_SEX_UNKNOWN],Gbl.CurrentCrs.Crs.NumStds);
/***** Indicators *****/ /***** Indicators *****/
NumIndicatorsFromDB = Ind_GetNumIndicatorsCrsFromDB (Gbl.CurrentCrs.Crs.CrsCod); NumIndicatorsFromDB = Ind_GetNumIndicatorsCrsFromDB (Gbl.CurrentCrs.Crs.CrsCod);
@ -495,6 +476,28 @@ static void Crs_PutIconToPrint (void)
Lay_PutContextualIconToPrint (ActPrnCrsInf,NULL); Lay_PutContextualIconToPrint (ActPrnCrsInf,NULL);
} }
/*****************************************************************************/
/**************** Number of users in courses of this country *****************/
/*****************************************************************************/
static void Crs_ShowNumUsrsInCrs (Rol_Role_t Role)
{
extern const char *The_ClassForm[The_NUM_THEMES];
extern const char *Txt_ROLES_PLURAL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
fprintf (Gbl.F.Out,"<tr>"
"<td class=\"%s RIGHT_MIDDLE\">"
"%s:"
"</td>"
"<td class=\"DAT LEFT_MIDDLE\">"
"%u"
"</td>"
"</tr>",
The_ClassForm[Gbl.Prefs.Theme],
Txt_ROLES_PLURAL_Abc[Role][Usr_SEX_UNKNOWN],
Gbl.CurrentCrs.Crs.NumUsrs[Role]);
}
/*****************************************************************************/ /*****************************************************************************/
/************************ Write menu with my courses *************************/ /************************ Write menu with my courses *************************/
/*****************************************************************************/ /*****************************************************************************/
@ -1245,11 +1248,11 @@ static bool Crs_ListCoursesOfAYearForSeeing (unsigned Year)
"</td>", "</td>",
BgColor, BgColor,
Gbl.Prefs.IconsURL, Gbl.Prefs.IconsURL,
Crs->NumUsrs ? "ok_green" : Crs->NumUsrs[Rol_UNK] ? "ok_green" :
"tr", "tr",
Crs->NumUsrs ? Txt_COURSE_With_users : Crs->NumUsrs[Rol_UNK] ? Txt_COURSE_With_users :
Txt_COURSE_Without_users, Txt_COURSE_Without_users,
Crs->NumUsrs ? Txt_COURSE_With_users : Crs->NumUsrs[Rol_UNK] ? Txt_COURSE_With_users :
Txt_COURSE_Without_users); Txt_COURSE_Without_users);
/* Institutional code of the course */ /* Institutional code of the course */
@ -1282,13 +1285,13 @@ static bool Crs_ListCoursesOfAYearForSeeing (unsigned Year)
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">" fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">"
"%u" "%u"
"</td>", "</td>",
TxtClassNormal,BgColor,Crs->NumTchs); TxtClassNormal,BgColor,Crs->NumUsrs[Rol_TCH]);
/* Current number of students in this course */ /* Current number of students in this course */
fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">" fprintf (Gbl.F.Out,"<td class=\"%s RIGHT_MIDDLE %s\">"
"%u" "%u"
"</td>", "</td>",
TxtClassNormal,BgColor,Crs->NumStds); TxtClassNormal,BgColor,Crs->NumUsrs[Rol_STD]);
/* Course status */ /* Course status */
StatusTxt = Crs_GetStatusTxtFromStatusBits (Crs->Status); StatusTxt = Crs_GetStatusTxtFromStatusBits (Crs->Status);
@ -1404,7 +1407,7 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
/* Put icon to remove course */ /* Put icon to remove course */
fprintf (Gbl.F.Out,"<tr>" fprintf (Gbl.F.Out,"<tr>"
"<td class=\"BM\">"); "<td class=\"BM\">");
if (Crs->NumUsrs || // Course has users ==> deletion forbidden if (Crs->NumUsrs[Rol_UNK] || // Course has users ==> deletion forbidden
!ICanEdit) !ICanEdit)
Lay_PutIconRemovalNotAllowed (); Lay_PutIconRemovalNotAllowed ();
else // Crs->NumUsrs == 0 && ICanEdit else // Crs->NumUsrs == 0 && ICanEdit
@ -1506,13 +1509,13 @@ static void Crs_ListCoursesOfAYearForEdition (unsigned Year)
fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_MIDDLE\">" fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_MIDDLE\">"
"%u" "%u"
"</td>", "</td>",
Crs->NumTchs); Crs->NumUsrs[Rol_TCH]);
/* Current number of students in this course */ /* Current number of students in this course */
fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_MIDDLE\">" fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_MIDDLE\">"
"%u" "%u"
"</td>", "</td>",
Crs->NumStds); Crs->NumUsrs[Rol_STD]);
/* Course requester */ /* Course requester */
UsrDat.UsrCod = Crs->RequesterUsrCod; UsrDat.UsrCod = Crs->RequesterUsrCod;
@ -1946,7 +1949,7 @@ void Crs_RemoveCourse (void)
if (Crs_CheckIfICanEdit (&Crs)) if (Crs_CheckIfICanEdit (&Crs))
{ {
/***** Check if this course has users *****/ /***** Check if this course has users *****/
if (Crs.NumUsrs) // Course has users ==> don't remove if (Crs.NumUsrs[Rol_UNK]) // Course has users ==> don't remove
Ale_ShowAlert (Ale_WARNING,Txt_To_remove_a_course_you_must_first_remove_all_users_in_the_course); Ale_ShowAlert (Ale_WARNING,Txt_To_remove_a_course_you_must_first_remove_all_users_in_the_course);
else // Course has no users ==> remove it else // Course has no users ==> remove it
{ {
@ -1984,9 +1987,9 @@ bool Crs_GetDataOfCourseByCod (struct Course *Crs)
Crs->RequesterUsrCod = -1L; Crs->RequesterUsrCod = -1L;
Crs->ShrtName[0] = '\0'; Crs->ShrtName[0] = '\0';
Crs->FullName[0] = '\0'; Crs->FullName[0] = '\0';
Crs->NumStds = 0; Crs->NumUsrs[Rol_UNK] = 0;
Crs->NumTchs = 0; Crs->NumUsrs[Rol_STD] = 0;
Crs->NumUsrs = 0; Crs->NumUsrs[Rol_TCH] = 0;
/***** Check if course code is correct *****/ /***** Check if course code is correct *****/
if (Crs->CrsCod > 0) if (Crs->CrsCod > 0)
@ -2047,14 +2050,15 @@ static void Crs_GetDataOfCourseFromRow (struct Course *Crs,MYSQL_ROW row)
Str_Copy (Crs->FullName,row[7], Str_Copy (Crs->FullName,row[7],
Hie_MAX_BYTES_FULL_NAME); Hie_MAX_BYTES_FULL_NAME);
/***** Get number of teachers *****/
Crs->NumTchs = Usr_GetNumUsrsInCrs (Rol_TCH,Crs->CrsCod);
/***** Get number of students *****/ /***** Get number of students *****/
Crs->NumStds = Usr_GetNumUsrsInCrs (Rol_STD,Crs->CrsCod); Crs->NumUsrs[Rol_STD] = Usr_GetNumUsrsInCrs (Rol_STD,Crs->CrsCod);
Crs->NumUsrs = Crs->NumStds + /***** Get number of teachers *****/
Crs->NumTchs; Crs->NumUsrs[Rol_TCH] = Usr_GetNumUsrsInCrs (Rol_TCH,Crs->CrsCod);
/***** Compute total of users in course *****/
Crs->NumUsrs[Rol_UNK] = Crs->NumUsrs[Rol_STD] +
Crs->NumUsrs[Rol_TCH];
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@ -85,9 +85,7 @@ struct Course
long RequesterUsrCod; // User code of the person who requested the creation of this course long RequesterUsrCod; // User code of the person who requested the creation of this course
char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1]; // Short name of course char ShrtName[Hie_MAX_BYTES_SHRT_NAME + 1]; // Short name of course
char FullName[Hie_MAX_BYTES_FULL_NAME + 1]; // Full name of course char FullName[Hie_MAX_BYTES_FULL_NAME + 1]; // Full name of course
unsigned NumUsrs; // Number of users (students + teachers) unsigned NumUsrs[Rol_NUM_ROLES]; // Number of users
unsigned NumTchs; // Number of teachers
unsigned NumStds; // Number of students
}; };
/*****************************************************************************/ /*****************************************************************************/

View File

@ -597,7 +597,7 @@ static void Enr_ShowFormRegRemSeveralUsrs (Rol_Role_t Role)
/***** Put contextual links *****/ /***** Put contextual links *****/
if (Role == Rol_STD && // Users to admin: students if (Role == Rol_STD && // Users to admin: students
Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected
Gbl.CurrentCrs.Crs.NumStds) // This course has students Gbl.CurrentCrs.Crs.NumUsrs[Rol_STD]) // This course has students
{ {
fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">"); fprintf (Gbl.F.Out,"<div class=\"CONTEXT_MENU\">");
@ -1946,7 +1946,8 @@ void Enr_SignUpInCrs (void)
/***** Notify teachers or admins by email about the new enrolment request *****/ /***** Notify teachers or admins by email about the new enrolment request *****/
// If this course has teachers ==> send notification to teachers // 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 this course has no teachers and I want to be a teacher ==> send notification to administrators or superusers
if (Gbl.CurrentCrs.Crs.NumTchs || RoleFromForm == Rol_TCH) if (Gbl.CurrentCrs.Crs.NumUsrs[Rol_TCH] ||
RoleFromForm == Rol_TCH)
Ntf_StoreNotifyEventsToAllUsrs (Ntf_EVENT_ENROLMENT_REQUEST,ReqCod); Ntf_StoreNotifyEventsToAllUsrs (Ntf_EVENT_ENROLMENT_REQUEST,ReqCod);
} }
} }
@ -2764,7 +2765,7 @@ static void Enr_ShowEnrolmentRequestsGivenRoles (unsigned RolesSelected)
fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_TOP\">" fprintf (Gbl.F.Out,"<td class=\"DAT RIGHT_TOP\">"
"%u" "%u"
"</td>", "</td>",
Crs.NumTchs); Crs.NumUsrs[Rol_TCH]);
/***** User photo *****/ /***** User photo *****/
fprintf (Gbl.F.Out,"<td class=\"DAT CENTER_TOP\"" fprintf (Gbl.F.Out,"<td class=\"DAT CENTER_TOP\""

View File

@ -150,7 +150,7 @@ void Hlp_ShowHelpWhatWouldYouLikeToDo (void)
if (Gbl.Usrs.Me.MyCrss.Num) // I am enroled in some courses if (Gbl.Usrs.Me.MyCrss.Num) // I am enroled in some courses
{ {
if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected if (Gbl.CurrentCrs.Crs.CrsCod > 0 && // Course selected
!Gbl.CurrentCrs.Crs.NumStds && // Current course has no students !Gbl.CurrentCrs.Crs.NumUsrs[Rol_STD] && // Current course has no students
Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_TCH) // I am a teacher in current course Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB == Rol_TCH) // I am a teacher in current course
{ {
/* Request students enrolment */ /* Request students enrolment */

View File

@ -642,7 +642,7 @@ void Mrk_ShowMyMarks (void)
} }
else // Course zone else // Course zone
{ {
if (Gbl.CurrentCrs.Crs.NumStds) // If there are students in this course if (Gbl.CurrentCrs.Crs.NumUsrs[Rol_STD]) // If there are students in this course
{ {
Gbl.Usrs.Other.UsrDat.UsrCod = Usr_GetRamdomStdFromCrs (Gbl.CurrentCrs.Crs.CrsCod); Gbl.Usrs.Other.UsrDat.UsrCod = Usr_GetRamdomStdFromCrs (Gbl.CurrentCrs.Crs.CrsCod);
UsrDat = &Gbl.Usrs.Other.UsrDat; UsrDat = &Gbl.Usrs.Other.UsrDat;

View File

@ -1267,7 +1267,7 @@ unsigned Ntf_StoreNotifyEventsToAllUsrs (Ntf_NotifyEvent_t NotifyEvent,long Cod)
case Ntf_EVENT_ENROLMENT_TEACHER: // This function should not be called in this case case Ntf_EVENT_ENROLMENT_TEACHER: // This function should not be called in this case
return 0; return 0;
case Ntf_EVENT_ENROLMENT_REQUEST: case Ntf_EVENT_ENROLMENT_REQUEST:
if (Gbl.CurrentCrs.Crs.NumTchs) if (Gbl.CurrentCrs.Crs.NumUsrs[Rol_TCH])
// If this course has teachers ==> send notification to teachers // If this course has teachers ==> send notification to teachers
sprintf (Query,"SELECT UsrCod FROM crs_usr" sprintf (Query,"SELECT UsrCod FROM crs_usr"
" WHERE CrsCod=%ld" " WHERE CrsCod=%ld"

View File

@ -50236,6 +50236,27 @@ const char *Txt_X_users_have_been_removed = // Warning: it is very important to
"%u users have been removed."; // Necessita de tradução "%u users have been removed."; // Necessita de tradução
#endif #endif
const char *Txt_Users_in_courses =
#if L==1
"Usuaris en assignatures";
#elif L==2
"Benutzer in Kursen";
#elif L==3
"Users in courses";
#elif L==4
"Usuarios en asignaturas";
#elif L==5
"Utilisateurs dans mati&egrave;res";
#elif L==6
"Puruh&aacute;ra en asignaturas"; // Okoteve traducción
#elif L==7
"Utenti nei corsi";
#elif L==8
"U&zdot;ytkownicy kurs&oacute;w";
#elif L==9
"Utilizadores em disciplinas";
#endif
const char *Txt_Users_of_the_centre = const char *Txt_Users_of_the_centre =
#if L==1 #if L==1
"Usuaris del centre"; "Usuaris del centre";

View File

@ -8445,9 +8445,9 @@ static float Usr_GetNumUsrsPerCrs (Rol_Role_t Role)
(unsigned) Role); (unsigned) Role);
break; break;
case Sco_SCOPE_CRS: case Sco_SCOPE_CRS:
return (float) ( Role == Rol_UNK ? Gbl.CurrentCrs.Crs.NumUsrs : // Any user return (float) ( Role == Rol_UNK ? Gbl.CurrentCrs.Crs.NumUsrs[Rol_UNK] : // Any user
(Role == Rol_TCH ? Gbl.CurrentCrs.Crs.NumTchs : // Teachers (Role == Rol_TCH ? Gbl.CurrentCrs.Crs.NumUsrs[Rol_TCH] : // Teachers
Gbl.CurrentCrs.Crs.NumStds)); // Students Gbl.CurrentCrs.Crs.NumUsrs[Rol_STD])); // Students
default: default:
Lay_ShowErrorAndExit ("Wrong scope."); Lay_ShowErrorAndExit ("Wrong scope.");
break; break;