Version19.185

This commit is contained in:
acanas 2020-04-14 17:15:17 +02:00
parent d0c4d46c0a
commit 333d3337da
74 changed files with 1984 additions and 1868 deletions

View File

@ -30,8 +30,8 @@ OBJS = swad_account.o swad_action.o swad_agenda.o swad_alert.o \
swad_announcement.o swad_API.o swad_assignment.o swad_attendance.o \
swad_banner.o swad_box.o swad_button.o \
swad_calendar.o swad_centre.o swad_centre_config.o swad_chat.o \
swad_classroom.o swad_config.o swad_connected.o swad_cookie.o \
swad_country.o swad_country_config.o swad_course.o \
swad_config.o swad_connected.o swad_cookie.o swad_country.o \
swad_country_config.o swad_course.o \
swad_course_config.o swad_cryptography.o \
swad_database.o swad_date.o swad_degree.o swad_degree_config.o \
swad_degree_type.o swad_department.o swad_duplicate.o \
@ -53,7 +53,7 @@ OBJS = swad_account.o swad_action.o swad_agenda.o swad_alert.o \
swad_place.o swad_plugin.o swad_privacy.o swad_profile.o \
swad_program.o swad_project.o \
swad_QR.o \
swad_record.o swad_report.o swad_role.o swad_RSS.o \
swad_record.o swad_report.o swad_role.o swad_room.o swad_RSS.o \
swad_scope.o swad_search.o swad_session.o swad_setting.o \
swad_statistic.o swad_string.o swad_survey.o swad_syllabus.o \
swad_system_config.o \

View File

@ -13304,7 +13304,7 @@ ALTER TABLE log TRUNCATE PARTITION p2014;
------------------------------------
// Cambios realizados el 14 de abril de 2020
@ -13321,5 +13321,14 @@ SELECT ExaCod,CrsCod FROM tst_exams WHERE ExaCod IN (138946,149939,153732,155072
SELECT * FROM tst_exams WHERE ExaCod IN (138946,149939,153732,155072,158845,160028,163616,163617,165036,176633,177040,177140,177221,180469,182532,189061,189169,189179,189207,189245,189273,200335,200336,200337,203975,205562,206021,207224,215085,218272,218294,218300,218317,218665,218851,218869,218880,218955,219045,219074,219082,219086,219089,219092,219095,219097,219104,219107,219189,252548,252549,252550,259574,259825);
-----------------------------------------
SELECT my_courses.CrsCod,COUNT(*) AS N FROM (SELECT UsrCod,CrsCod,Role FROM crs_usr WHERE UsrCod=1346 AND Role=5) AS my_courses LEFT JOIN log ON (my_courses.UsrCod=log.UsrCod AND my_courses.CrsCod=log.CrsCod AND my_courses.Role=log.Role) GROUP BY my_courses.CrsCod ORDER BY N DESC,my_courses.CrsCod DESC;
SELECT my_courses.CrsCod,COUNT(*) AS N FROM (SELECT CrsCod,UsrCod,Role FROM crs_usr WHERE UsrCod=1346 AND Role=5) AS my_courses LEFT JOIN log ON (my_courses.CrsCod=log.CrsCod AND my_courses.UsrCod=log.UsrCod AND my_courses.Role=log.Role) GROUP BY my_courses.CrsCod ORDER BY N DESC,my_courses.CrsCod DESC;
SELECT my_courses.CrsCod,COUNT(*) AS N FROM (SELECT CrsCod FROM crs_usr WHERE UsrCod=1346 AND Role=5) AS my_courses LEFT JOIN log ON (my_courses.CrsCod=log.CrsCod) WHERE log.UsrCod=1346 AND log.Role=5 GROUP BY my_courses.CrsCod ORDER BY N DESC,my_courses.CrsCod DESC;

View File

@ -181,18 +181,6 @@ CREATE TABLE IF NOT EXISTS chat (
NumUsrs INT NOT NULL,
UNIQUE INDEX(RoomCode));
--
-- Table classrooms: stores the classrooms associated to each centre
--
CREATE TABLE IF NOT EXISTS classrooms (
ClaCod INT NOT NULL AUTO_INCREMENT,
CtrCod INT NOT NULL,
ShortName VARCHAR(511) NOT NULL,
FullName VARCHAR(2047) NOT NULL,
Capacity INT NOT NULL,
Location VARCHAR(2047) NOT NULL,
UNIQUE INDEX(ClaCod),
INDEX(CtrCod));
--
-- Table clicks_without_photo: stores the number of clicks that remains to each user before being required to submit his/her photo
--
CREATE TABLE IF NOT EXISTS clicks_without_photo (
@ -283,13 +271,13 @@ CREATE TABLE IF NOT EXISTS crs_grp (
GrpCod INT NOT NULL AUTO_INCREMENT,
GrpTypCod INT NOT NULL,
GrpName VARCHAR(2047) NOT NULL,
ClaCod INT NOT NULL DEFAULT -1,
RooCod INT NOT NULL DEFAULT -1,
MaxStudents INT NOT NULL,
Open ENUM('N','Y') NOT NULL DEFAULT 'N',
FileZones ENUM('N','Y') NOT NULL DEFAULT 'N',
UNIQUE INDEX(GrpCod),
INDEX(GrpTypCod),
INDEX(ClaCod));
INDEX(RooCod));
--
-- Table crs_grp_types: stores the types of groups in courses
--
@ -1131,6 +1119,18 @@ CREATE TABLE IF NOT EXISTS projects (
INDEX(CrsCod,ModifTime),
INDEX(CrsCod,DptCod));
--
-- Table rooms: stores the classrooms associated to each centre
--
CREATE TABLE IF NOT EXISTS rooms (
RooCod INT NOT NULL AUTO_INCREMENT,
CtrCod INT NOT NULL,
ShortName VARCHAR(511) NOT NULL,
FullName VARCHAR(2047) NOT NULL,
Capacity INT NOT NULL,
Location VARCHAR(2047) NOT NULL,
UNIQUE INDEX(RooCod),
INDEX(CtrCod));
--
-- Table sessions: stores the information of open sessions
--
CREATE TABLE IF NOT EXISTS sessions (

View File

@ -103,8 +103,10 @@ cp -f /home/acanas/swad/swad/swad /var/www/cgi-bin/
#include "swad_account.h"
#include "swad_API.h"
#include "swad_attendance.h"
#include "swad_database.h"
#include "swad_file_browser.h"
#include "swad_forum.h"
#include "swad_global.h"
#include "swad_hierarchy.h"
#include "swad_ID.h"

View File

@ -28,7 +28,9 @@
#include <string.h> // For string functions
#include "swad_account.h"
#include "swad_agenda.h"
#include "swad_announcement.h"
#include "swad_attendance.h"
#include "swad_box.h"
#include "swad_calendar.h"
#include "swad_database.h"
@ -36,14 +38,17 @@
#include "swad_enrolment.h"
#include "swad_follow.h"
#include "swad_form.h"
#include "swad_forum.h"
#include "swad_global.h"
#include "swad_HTML.h"
#include "swad_ID.h"
#include "swad_language.h"
#include "swad_message.h"
#include "swad_nickname.h"
#include "swad_notification.h"
#include "swad_parameter.h"
#include "swad_profile.h"
#include "swad_project.h"
#include "swad_report.h"
#include "swad_test_exam.h"
#include "swad_timeline.h"

View File

@ -28,6 +28,7 @@
#include "swad_action.h"
#include "swad_agenda.h"
#include "swad_announcement.h"
#include "swad_attendance.h"
#include "swad_banner.h"
#include "swad_calendar.h"
#include "swad_centre_config.h"
@ -42,23 +43,28 @@
#include "swad_date.h"
#include "swad_degree_config.h"
#include "swad_degree_type.h"
#include "swad_department.h"
#include "swad_duplicate.h"
#include "swad_exam.h"
#include "swad_enrolment.h"
#include "swad_figure.h"
#include "swad_follow.h"
#include "swad_forum.h"
#include "swad_game.h"
#include "swad_global.h"
#include "swad_holiday.h"
#include "swad_ID.h"
#include "swad_indicator.h"
#include "swad_institution_config.h"
#include "swad_language.h"
#include "swad_link.h"
#include "swad_log.h"
#include "swad_mail.h"
#include "swad_maintenance.h"
#include "swad_mark.h"
#include "swad_match.h"
#include "swad_match_result.h"
#include "swad_message.h"
#include "swad_MFU.h"
#include "swad_network.h"
#include "swad_nickname.h"
@ -67,6 +73,7 @@
#include "swad_parameter.h"
#include "swad_password.h"
#include "swad_photo.h"
#include "swad_place.h"
#include "swad_privacy.h"
#include "swad_profile.h"
#include "swad_program.h"
@ -76,10 +83,12 @@
#include "swad_role.h"
#include "swad_search.h"
#include "swad_setting.h"
#include "swad_survey.h"
#include "swad_system_config.h"
#include "swad_tab.h"
#include "swad_test_import.h"
#include "swad_timeline.h"
#include "swad_timetable.h"
#include "swad_zip.h"
/*****************************************************************************/
@ -306,7 +315,7 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
// Actions in menu:
[ActSeeCtrInf ] = {1151, 0,TabCtr,ActSeeCtrInf , 0, 0, 0,0x3C7, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,CtrCfg_ShowConfiguration ,"info" },
[ActSeeDeg ] = {1011, 1,TabCtr,ActSeeDeg , 0, 0, 0,0x3C7, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Deg_ShowDegsOfCurrentCtr ,"graduation-cap" },
[ActSeeCla ] = {1744, 2,TabCtr,ActSeeCla , 0, 0, 0,0x3C7, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Cla_SeeClassrooms ,"classroom" },
[ActSeeRoo ] = {1744, 2,TabCtr,ActSeeRoo , 0, 0, 0,0x3C7, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Roo_SeeRooms ,"classroom" },
// Actions not in menu:
[ActPrnCtrInf ] = {1152,-1,TabUnk,ActSeeCtrInf , 0, 0, 0,0x3C7, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,CtrCfg_PrintConfiguration ,NULL},
@ -341,13 +350,13 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
[ActChgDegWWW ] = { 554,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Deg_ChangeDegWWW ,Deg_ContEditAfterChgDeg ,NULL},
[ActChgDegSta ] = {1207,-1,TabUnk,ActSeeDeg , 0, 0, 0,0x380, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Deg_ChangeDegStatus ,Deg_ContEditAfterChgDeg ,NULL},
[ActEdiCla ] = {1745,-1,TabUnk,ActSeeCla , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Cla_EditClassrooms ,NULL},
[ActNewCla ] = {1746,-1,TabUnk,ActSeeCla , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Cla_RecFormNewClassroom ,Cla_ContEditAfterChgCla ,NULL},
[ActRemCla ] = {1747,-1,TabUnk,ActSeeCla , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Cla_RemoveClassroom ,Cla_ContEditAfterChgCla ,NULL},
[ActRenClaSho ] = {1748,-1,TabUnk,ActSeeCla , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Cla_RenameClassroomShort ,Cla_ContEditAfterChgCla ,NULL},
[ActRenClaFul ] = {1749,-1,TabUnk,ActSeeCla , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Cla_RenameClassroomFull ,Cla_ContEditAfterChgCla ,NULL},
[ActChgClaMaxStd ] = {1750,-1,TabUnk,ActSeeCla , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Cla_ChangeCapacity ,Cla_ContEditAfterChgCla ,NULL},
[ActRenClaLoc ] = {1751,-1,TabUnk,ActSeeCla , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Cla_ChangeClassroomLocation ,Cla_ContEditAfterChgCla ,NULL},
[ActEdiRoo ] = {1745,-1,TabUnk,ActSeeRoo , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Roo_EditRooms ,NULL},
[ActNewRoo ] = {1746,-1,TabUnk,ActSeeRoo , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Roo_RecFormNewRoom ,Roo_ContEditAfterChgRoom ,NULL},
[ActRemRoo ] = {1747,-1,TabUnk,ActSeeRoo , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Roo_RemoveRoom ,Roo_ContEditAfterChgRoom ,NULL},
[ActRenRooSho ] = {1748,-1,TabUnk,ActSeeRoo , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Roo_RenameRoomShort ,Roo_ContEditAfterChgRoom ,NULL},
[ActRenRooFul ] = {1749,-1,TabUnk,ActSeeRoo , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Roo_RenameRoomFull ,Roo_ContEditAfterChgRoom ,NULL},
[ActChgRooMaxUsr ] = {1750,-1,TabUnk,ActSeeRoo , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Roo_ChangeCapacity ,Roo_ContEditAfterChgRoom ,NULL},
[ActRenRooLoc ] = {1751,-1,TabUnk,ActSeeRoo , 0, 0, 0,0x3C6, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Roo_ChangeRoomLocation ,Roo_ContEditAfterChgRoom ,NULL},
// TabDeg ******************************************************************
// Actions in menu:
@ -1241,7 +1250,7 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
[ActDisFilZonGrp ] = { 496,-1,TabUnk,ActReqSelGrp ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Grp_DisableFileZonesGrp ,NULL},
[ActChgGrpTyp ] = { 167,-1,TabUnk,ActReqSelGrp ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Grp_ChangeGroupType ,NULL},
[ActRenGrp ] = { 121,-1,TabUnk,ActReqSelGrp ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Grp_RenameGroup ,NULL},
[ActChgGrpCla ] = {1752,-1,TabUnk,ActReqSelGrp ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Grp_ChangeGroupClassroom ,NULL},
[ActChgGrpRoo ] = {1752,-1,TabUnk,ActReqSelGrp ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Grp_ChangeGroupRoom ,NULL},
[ActChgMaxStdGrp ] = { 106,-1,TabUnk,ActReqSelGrp ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Grp_ChangeMaxStdsGrp ,NULL},
[ActLstGst ] = { 587,-1,TabUnk,ActLstOth ,0x3F8,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,0x3C7,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Usr_SeeGuests ,NULL},
@ -3472,15 +3481,15 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un
ActChgNicOth, // #1741
ActChgNicStd, // #1742
ActChgNicTch, // #1743
ActSeeCla, // #1744
ActEdiCla, // #1745
ActNewCla, // #1746
ActRemCla, // #1747
ActRenClaSho, // #1748
ActRenClaFul, // #1749
ActChgClaMaxStd, // #1750
ActRenClaLoc, // #1751
ActChgGrpCla, // #1752
ActSeeRoo, // #1744
ActEdiRoo, // #1745
ActNewRoo, // #1746
ActRemRoo, // #1747
ActRenRooSho, // #1748
ActRenRooFul, // #1749
ActChgRooMaxUsr, // #1750
ActRenRooLoc, // #1751
ActChgGrpRoo, // #1752
ActDoActOnSevGst, // #1753
ActDoActOnSevStd, // #1754
ActDoActOnSevTch, // #1755

View File

@ -293,7 +293,7 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
// Actions in menu
#define ActSeeCtrInf (ActRenHld + 1)
#define ActSeeDeg (ActRenHld + 2)
#define ActSeeCla (ActRenHld + 3)
#define ActSeeRoo (ActRenHld + 3)
// Secondary actions
#define ActPrnCtrInf (ActRenHld + 4)
@ -328,40 +328,40 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
#define ActChgDegWWW (ActRenHld + 31)
#define ActChgDegSta (ActRenHld + 32)
#define ActEdiCla (ActRenHld + 33)
#define ActNewCla (ActRenHld + 34)
#define ActRemCla (ActRenHld + 35)
#define ActRenClaSho (ActRenHld + 36)
#define ActRenClaFul (ActRenHld + 37)
#define ActChgClaMaxStd (ActRenHld + 38)
#define ActRenClaLoc (ActRenHld + 39)
#define ActEdiRoo (ActRenHld + 33)
#define ActNewRoo (ActRenHld + 34)
#define ActRemRoo (ActRenHld + 35)
#define ActRenRooSho (ActRenHld + 36)
#define ActRenRooFul (ActRenHld + 37)
#define ActChgRooMaxUsr (ActRenHld + 38)
#define ActRenRooLoc (ActRenHld + 39)
/*****************************************************************************/
/********************************* Degree tab ********************************/
/*****************************************************************************/
// Actions in menu
#define ActSeeDegInf (ActRenClaLoc + 1)
#define ActSeeCrs (ActRenClaLoc + 2)
#define ActSeeDegInf (ActRenRooLoc + 1)
#define ActSeeCrs (ActRenRooLoc + 2)
// Secondary actions
#define ActPrnDegInf (ActRenClaLoc + 3)
#define ActChgDegCtrCfg (ActRenClaLoc + 4)
#define ActRenDegShoCfg (ActRenClaLoc + 5)
#define ActRenDegFulCfg (ActRenClaLoc + 6)
#define ActChgDegWWWCfg (ActRenClaLoc + 7)
#define ActReqDegLog (ActRenClaLoc + 8)
#define ActRecDegLog (ActRenClaLoc + 9)
#define ActRemDegLog (ActRenClaLoc + 10)
#define ActPrnDegInf (ActRenRooLoc + 3)
#define ActChgDegCtrCfg (ActRenRooLoc + 4)
#define ActRenDegShoCfg (ActRenRooLoc + 5)
#define ActRenDegFulCfg (ActRenRooLoc + 6)
#define ActChgDegWWWCfg (ActRenRooLoc + 7)
#define ActReqDegLog (ActRenRooLoc + 8)
#define ActRecDegLog (ActRenRooLoc + 9)
#define ActRemDegLog (ActRenRooLoc + 10)
#define ActEdiCrs (ActRenClaLoc + 11)
#define ActReqCrs (ActRenClaLoc + 12)
#define ActNewCrs (ActRenClaLoc + 13)
#define ActRemCrs (ActRenClaLoc + 14)
#define ActChgInsCrsCod (ActRenClaLoc + 15)
#define ActChgCrsYea (ActRenClaLoc + 16)
#define ActRenCrsSho (ActRenClaLoc + 17)
#define ActRenCrsFul (ActRenClaLoc + 18)
#define ActChgCrsSta (ActRenClaLoc + 19)
#define ActEdiCrs (ActRenRooLoc + 11)
#define ActReqCrs (ActRenRooLoc + 12)
#define ActNewCrs (ActRenRooLoc + 13)
#define ActRemCrs (ActRenRooLoc + 14)
#define ActChgInsCrsCod (ActRenRooLoc + 15)
#define ActChgCrsYea (ActRenRooLoc + 16)
#define ActRenCrsSho (ActRenRooLoc + 17)
#define ActRenCrsFul (ActRenRooLoc + 18)
#define ActChgCrsSta (ActRenRooLoc + 19)
/*****************************************************************************/
/******************************** Course tab *********************************/
@ -1210,7 +1210,7 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to
#define ActDisFilZonGrp (ActRemOldBrf + 24)
#define ActChgGrpTyp (ActRemOldBrf + 25)
#define ActRenGrp (ActRemOldBrf + 26)
#define ActChgGrpCla (ActRemOldBrf + 27)
#define ActChgGrpRoo (ActRemOldBrf + 27)
#define ActChgMaxStdGrp (ActRemOldBrf + 28)
#define ActLstGst (ActRemOldBrf + 29)

View File

@ -1559,10 +1559,10 @@ static void Att_GetAndWriteNamesOfGrpsAssociatedToAttEvent (struct Att_Event *Ev
NumGrps = (unsigned) DB_QuerySELECT (&mysql_res,"can not get groups of an attendance event",
"SELECT crs_grp_types.GrpTypName,"
"crs_grp.GrpName,"
"classrooms.ShortName"
"rooms.ShortName"
" FROM (att_grp,crs_grp,crs_grp_types)"
" LEFT JOIN classrooms"
" ON crs_grp.ClaCod=classrooms.ClaCod"
" LEFT JOIN rooms"
" ON crs_grp.RooCod=rooms.RooCod"
" WHERE att_grp.AttCod=%ld"
" AND att_grp.GrpCod=crs_grp.GrpCod"
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod"
@ -1589,7 +1589,7 @@ static void Att_GetAndWriteNamesOfGrpsAssociatedToAttEvent (struct Att_Event *Ev
/* Write group type name (row[0]) and group name (row[1]) */
HTM_TxtF ("%s&nbsp;%s",row[0],row[1]);
/* Write the name of the classroom (row[2]) */
/* Write the name of the room (row[2]) */
if (row[2]) // May be NULL because of LEFT JOIN
if (row[2][0])
HTM_TxtF ("&nbsp;(%s)",row[2]);

View File

@ -37,9 +37,9 @@
#include "swad_global.h"
#include "swad_HTML.h"
#include "swad_language.h"
#include "swad_link.h"
#include "swad_parameter.h"
#include "swad_photo.h"
// struct Ban_Banners Ban_Banners;
/*****************************************************************************/
/************** External global variables from others modules ****************/

View File

@ -31,8 +31,10 @@
#include "swad_calendar.h"
#include "swad_database.h"
#include "swad_exam.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_global.h"
#include "swad_holiday.h"
#include "swad_HTML.h"
#include "swad_parameter.h"
#include "swad_setting.h"

View File

@ -33,10 +33,15 @@
#include "swad_centre.h"
#include "swad_centre_config.h"
#include "swad_database.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_forum.h"
#include "swad_global.h"
#include "swad_HTML.h"
#include "swad_logo.h"
#include "swad_message.h"
#include "swad_place.h"
#include "swad_survey.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/
@ -1252,8 +1257,8 @@ void Ctr_RemoveCentre (void)
/***** Remove information related to files in centre *****/
Brw_RemoveCtrFilesFromDB (Ctr_EditingCtr->CtrCod);
/***** Remove all classrooms in centre *****/
Cla_RemoveAllClassroomsInCtr (Ctr_EditingCtr->CtrCod);
/***** Remove all rooms in centre *****/
Roo_RemoveAllRoomsInCtr (Ctr_EditingCtr->CtrCod);
/***** Remove directories of the centre *****/
snprintf (PathCtr,sizeof (PathCtr),

View File

@ -41,6 +41,7 @@
#include "swad_hierarchy_config.h"
#include "swad_HTML.h"
#include "swad_logo.h"
#include "swad_place.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/

View File

@ -497,7 +497,7 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
#define Log_PLATFORM_VERSION "SWAD 19.184 (2020-04-14)"
#define Log_PLATFORM_VERSION "SWAD 19.185 (2020-04-14)"
#define CSS_FILE "swad19.146.css"
#define JS_FILE "swad19.172.1.js"
/*
@ -548,6 +548,16 @@ Funci
// TODO: Oresti Baños: cambiar ojos por candados en descriptores para prohibir/permitir y dejar los ojos para poder elegir descriptores
// TODO: Integrar pull requests con traducciones del alemán del usuario eruedin en GitHub
Version 19.185: Apr 14, 2020 Module swad_classroom is renamed as swad_room.
Improvement in querying the database in the usage report. (285813 lines)
5 changes necessary in database:
RENAME TABLE classrooms TO rooms;
ALTER TABLE rooms CHANGE COLUMN ClaCod RooCod INT NOT NULL AUTO_INCREMENT;
ALTER TABLE rooms DROP INDEX ClaCod,ADD UNIQUE INDEX(RooCod);
ALTER TABLE crs_grp CHANGE COLUMN ClaCod RooCod INT NOT NULL DEFAULT -1;
ALTER TABLE crs_grp DROP INDEX ClaCod,ADD INDEX(RooCod);
Version 19.184: Apr 14, 2020 Code refactoring in classrooms. (285706 lines)
Version 19.183.2: Apr 14, 2020 Fixed bug in test exams. (285684 lines)
Version 19.183.1: Apr 14, 2020 Fixed bug in forums, reported by Javier Fernández Baldomero. (285677 lines)

File diff suppressed because it is too large Load Diff

View File

@ -1,111 +0,0 @@
// swad_classroom.h: classrooms, laboratories or other classrooms where classes are taught
#ifndef _SWAD_CLA
#define _SWAD_CLA
/*
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-2020 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 **********************************/
/*****************************************************************************/
#include "swad_string.h"
/*****************************************************************************/
/************************** Public types and constants ***********************/
/*****************************************************************************/
#define Cla_MAX_CHARS_SHRT_NAME (32 - 1) // 31
#define Cla_MAX_BYTES_SHRT_NAME ((Cla_MAX_CHARS_SHRT_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 511
#define Cla_MAX_CHARS_FULL_NAME (128 - 1) // 127
#define Cla_MAX_BYTES_FULL_NAME ((Cla_MAX_CHARS_FULL_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
#define Cla_MAX_CAPACITY 10000 // If capacity of a classroom is greater than this, it is considered infinite
#define Cla_UNLIMITED_CAPACITY INT_MAX // This number can be stored in database as an integer...
// ...and means that a classroom has no limited capacity
#define Cla_MAX_CHARS_LOCATION (128 - 1) // 127
#define Cla_MAX_BYTES_LOCATION ((Cla_MAX_CHARS_LOCATION + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
struct Cla_Classroom
{
long ClaCod;
long InsCod;
char ShrtName[Cla_MAX_BYTES_SHRT_NAME + 1];
char FullName[Cla_MAX_BYTES_FULL_NAME + 1];
unsigned Capacity; // Seating capacity (maximum number of people that fit in the room)
char Location[Cla_MAX_BYTES_LOCATION + 1]; // Examples: Ground floor, first floor, basement
};
#define Cla_NUM_ORDERS 4
typedef enum
{
Cla_ORDER_BY_SHRT_NAME = 0,
Cla_ORDER_BY_FULL_NAME = 1,
Cla_ORDER_BY_CAPACITY = 2,
Cla_ORDER_BY_LOCATION = 3,
} Cla_Order_t;
#define Cla_ORDER_DEFAULT Cla_ORDER_BY_LOCATION
/***** Get all data or only short name *****/
typedef enum
{
Cla_ALL_DATA,
Cla_ONLY_SHRT_NAME,
} Cla_WhichData_t;
struct Cla_Classrooms
{
unsigned Num; // Number of classrooms
struct Cla_Classroom *Lst; // List of classrooms
Cla_Order_t SelectedOrder;
};
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
void Cla_ResetClassrooms (struct Cla_Classrooms *Classrooms);
void Cla_SeeClassrooms (void);
void Cla_EditClassrooms (void);
void Cla_PutIconToViewClassrooms (void);
void Cla_GetListClassrooms (struct Cla_Classrooms *Classrooms,
Cla_WhichData_t WhichData);
void Cla_FreeListClassrooms (struct Cla_Classrooms *Classrooms);
void Cla_GetListClassroomsInThisCtr (void);
void Cla_GetDataOfClassroomByCod (struct Cla_Classroom *Cla);
long Cla_GetParamClaCod (void);
void Cla_RemoveClassroom (void);
void Cla_RemoveAllClassroomsInCtr (long CtrCod);
void Cla_RenameClassroomShort (void);
void Cla_RenameClassroomFull (void);
void Cla_ChangeCapacity (void);
void Cla_ChangeClassroomLocation (void);
void Cla_ContEditAfterChgCla (void);
void Cla_RecFormNewClassroom (void);
#endif

View File

@ -28,6 +28,7 @@
#include "swad_box.h"
#include "swad_cookie.h"
#include "swad_database.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_global.h"
#include "swad_HTML.h"

View File

@ -34,9 +34,11 @@
#include "swad_country_config.h"
#include "swad_database.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_global.h"
#include "swad_HTML.h"
#include "swad_survey.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/

View File

@ -31,16 +31,23 @@
#include <stdlib.h> // For free
#include <string.h> // For string functions
#include "swad_attendance.h"
#include "swad_course.h"
#include "swad_course_config.h"
#include "swad_database.h"
#include "swad_exam.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_forum.h"
#include "swad_global.h"
#include "swad_help.h"
#include "swad_HTML.h"
#include "swad_info.h"
#include "swad_logo.h"
#include "swad_message.h"
#include "swad_project.h"
#include "swad_search.h"
#include "swad_survey.h"
#include "swad_test_exam.h"
/*****************************************************************************/

View File

@ -37,6 +37,7 @@
#include "swad_global.h"
#include "swad_hierarchy_config.h"
#include "swad_HTML.h"
#include "swad_indicator.h"
#include "swad_logo.h"
#include "swad_role.h"

View File

@ -471,31 +471,6 @@ mysql> DESCRIBE chat;
"NumUsrs INT NOT NULL,"
"UNIQUE INDEX(RoomCode))");
/***** Table classrooms *****/
/*
mysql> DESCRIBE classrooms;
+-----------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+---------------+------+-----+---------+----------------+
| ClaCod | int(11) | NO | PRI | NULL | auto_increment |
| CtrCod | int(11) | NO | MUL | NULL | |
| ShortName | varchar(511) | NO | | NULL | |
| FullName | varchar(2047) | NO | | NULL | |
| Capacity | int(11) | NO | | NULL | |
| Location | varchar(2047) | NO | | NULL | |
+-----------+---------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS classrooms ("
"ClaCod INT NOT NULL AUTO_INCREMENT,"
"CtrCod INT NOT NULL,"
"ShortName VARCHAR(511) NOT NULL," // Cla_MAX_BYTES_SHRT_NAME
"FullName VARCHAR(2047) NOT NULL," // Cla_MAX_BYTES_FULL_NAME
"Capacity INT NOT NULL,"
"Location VARCHAR(2047) NOT NULL," // Cla_MAX_BYTES_LOCATION
"UNIQUE INDEX(ClaCod),"
"INDEX(CtrCod))");
/***** Table clicks_without_photo *****/
/*
mysql> DESCRIBE clicks_without_photo;
@ -666,7 +641,7 @@ mysql> DESCRIBE crs_grp;
| GrpCod | int(11) | NO | PRI | NULL | auto_increment |
| GrpTypCod | int(11) | NO | MUL | NULL | |
| GrpName | varchar(2047) | NO | | NULL | |
| ClaCod | int(11) | NO | MUL | -1 | |
| RooCod | int(11) | NO | MUL | -1 | |
| MaxStudents | int(11) | NO | | NULL | |
| Open | enum('N','Y') | NO | | N | |
| FileZones | enum('N','Y') | NO | | N | |
@ -678,12 +653,12 @@ mysql> DESCRIBE crs_grp;
"GrpTypCod INT NOT NULL,"
"GrpName VARCHAR(2047) NOT NULL," // Grp_MAX_BYTES_GROUP_NAME
"MaxStudents INT NOT NULL,"
"ClaCod INT NOT NULL DEFAULT -1,"
"RooCod INT NOT NULL DEFAULT -1,"
"Open ENUM('N','Y') NOT NULL DEFAULT 'N',"
"FileZones ENUM('N','Y') NOT NULL DEFAULT 'N',"
"UNIQUE INDEX(GrpCod),"
"INDEX(GrpTypCod),"
"INDEX(ClaCod))");
"INDEX(RooCod))");
/***** Table crs_grp_types *****/
/*
@ -2353,6 +2328,31 @@ mysql> DESCRIBE projects;
"INDEX(CrsCod,ModifTime),"
"INDEX(CrsCod,DptCod))");
/***** Table rooms *****/
/*
mysql> DESCRIBE rooms;
+-----------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+---------------+------+-----+---------+----------------+
| RooCod | int(11) | NO | PRI | NULL | auto_increment |
| CtrCod | int(11) | NO | MUL | NULL | |
| ShortName | varchar(511) | NO | | NULL | |
| FullName | varchar(2047) | NO | | NULL | |
| Capacity | int(11) | NO | | NULL | |
| Location | varchar(2047) | NO | | NULL | |
+-----------+---------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)
*/
DB_CreateTable ("CREATE TABLE IF NOT EXISTS rooms ("
"RooCod INT NOT NULL AUTO_INCREMENT,"
"CtrCod INT NOT NULL,"
"ShortName VARCHAR(511) NOT NULL," // Roo_MAX_BYTES_SHRT_NAME
"FullName VARCHAR(2047) NOT NULL," // Roo_MAX_BYTES_FULL_NAME
"Capacity INT NOT NULL,"
"Location VARCHAR(2047) NOT NULL," // Roo_MAX_BYTES_LOCATION
"UNIQUE INDEX(RooCod),"
"INDEX(CtrCod))");
/***** Table sessions *****/
/*
mysql> DESCRIBE sessions;

View File

@ -36,6 +36,7 @@
#include "swad_config.h"
#include "swad_database.h"
#include "swad_date.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_global.h"
#include "swad_HTML.h"

View File

@ -33,10 +33,14 @@
#include "swad_database.h"
#include "swad_degree.h"
#include "swad_degree_config.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_forum.h"
#include "swad_global.h"
#include "swad_HTML.h"
#include "swad_logo.h"
#include "swad_message.h"
#include "swad_survey.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/

View File

@ -37,6 +37,7 @@
#include "swad_database.h"
#include "swad_degree.h"
#include "swad_degree_type.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_global.h"
#include "swad_HTML.h"

View File

@ -32,6 +32,7 @@
#include "swad_account.h"
#include "swad_announcement.h"
#include "swad_attendance.h"
#include "swad_box.h"
#include "swad_database.h"
#include "swad_duplicate.h"
@ -41,8 +42,10 @@
#include "swad_HTML.h"
#include "swad_ID.h"
#include "swad_match.h"
#include "swad_message.h"
#include "swad_notification.h"
#include "swad_parameter.h"
#include "swad_photo.h"
#include "swad_role.h"
#include "swad_test_exam.h"
#include "swad_user.h"

View File

@ -43,12 +43,17 @@
#include "swad_HTML.h"
#include "swad_institution.h"
#include "swad_logo.h"
#include "swad_message.h"
#include "swad_network.h"
#include "swad_notice.h"
#include "swad_privacy.h"
#include "swad_profile.h"
#include "swad_program.h"
#include "swad_project.h"
#include "swad_role.h"
#include "swad_survey.h"
#include "swad_test.h"
#include "swad_timeline.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/

View File

@ -41,6 +41,7 @@
#include "swad_box.h"
#include "swad_config.h"
#include "swad_database.h"
#include "swad_figure.h"
#include "swad_file_browser.h"
#include "swad_file_extension.h"
#include "swad_file_MIME.h"
@ -54,6 +55,7 @@
#include "swad_parameter.h"
#include "swad_photo.h"
#include "swad_profile.h"
#include "swad_project.h"
#include "swad_role.h"
#include "swad_string.h"
#include "swad_timeline.h"

View File

@ -30,11 +30,13 @@
#include "swad_box.h"
#include "swad_database.h"
#include "swad_figure.h"
#include "swad_follow.h"
#include "swad_form.h"
#include "swad_global.h"
#include "swad_HTML.h"
#include "swad_notification.h"
#include "swad_photo.h"
#include "swad_privacy.h"
#include "swad_profile.h"
#include "swad_user.h"

View File

@ -37,12 +37,14 @@
#include "swad_box.h"
#include "swad_config.h"
#include "swad_database.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_forum.h"
#include "swad_global.h"
#include "swad_HTML.h"
#include "swad_layout.h"
#include "swad_logo.h"
#include "swad_message.h"
#include "swad_notification.h"
#include "swad_pagination.h"
#include "swad_parameter.h"

View File

@ -34,6 +34,7 @@
#include <string.h> // For string functions
#include "swad_database.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_game.h"
#include "swad_global.h"

View File

@ -36,18 +36,21 @@
#include "swad_action.h"
#include "swad_API.h"
#include "swad_calendar.h"
#include "swad_classroom.h"
#include "swad_room.h"
#include "swad_config.h"
#include "swad_constant.h"
#include "swad_department.h"
#include "swad_exam.h"
#include "swad_follow.h"
#include "swad_global.h"
#include "swad_icon.h"
#include "swad_link.h"
#include "swad_parameter.h"
#include "swad_program.h"
#include "swad_project.h"
#include "swad_role.h"
#include "swad_setting.h"
#include "swad_statistic.h"
#include "swad_theme.h"
/*****************************************************************************/
@ -255,7 +258,7 @@ void Gbl_InitializeGlobals (void)
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.RooCod = -1L; // -1L stands for no room assigned
Gbl.Crs.Grps.MaxStudents = Grp_NUM_STUDENTS_NOT_LIMITED;
Gbl.Crs.Grps.Open = false;
Gbl.Crs.Grps.LstGrpsSel.GrpCods = NULL;

View File

@ -33,53 +33,32 @@
#include <mysql/mysql.h> // To access MySQL databases
#include "swad_alert.h"
#include "swad_agenda.h"
#include "swad_API.h"
#include "swad_assignment.h"
#include "swad_attendance.h"
#include "swad_banner.h"
#include "swad_box.h"
#include "swad_centre.h"
#include "swad_classroom.h"
#include "swad_connected.h"
#include "swad_config.h"
#include "swad_country.h"
#include "swad_course.h"
#include "swad_cryptography.h"
#include "swad_department.h"
#include "swad_degree_type.h"
#include "swad_enrolment.h"
#include "swad_exam.h"
#include "swad_figure.h"
#include "swad_file.h"
#include "swad_file_browser.h"
#include "swad_forum.h"
#include "swad_game.h"
#include "swad_holiday.h"
#include "swad_icon.h"
#include "swad_indicator.h"
#include "swad_institution.h"
#include "swad_layout.h"
#include "swad_link.h"
#include "swad_mail.h"
#include "swad_mark.h"
#include "swad_media.h"
#include "swad_menu.h"
#include "swad_message.h"
#include "swad_parameter.h"
#include "swad_password.h"
#include "swad_photo.h"
#include "swad_place.h"
#include "swad_plugin.h"
#include "swad_project.h"
#include "swad_record.h"
#include "swad_search.h"
#include "swad_session.h"
#include "swad_survey.h"
#include "swad_syllabus.h"
#include "swad_test.h"
#include "swad_timeline.h"
#include "swad_timetable.h"
/*****************************************************************************/
/***************************** Public constants ******************************/
@ -448,7 +427,8 @@ struct Globals
bool HiddenLevels[1 + Brw_MAX_DIR_LEVELS];
const char *TxtStyle;
const char *InputStyle;
struct Asg_Assignment Asg; // Data of assignment when browsing level 1 or an assignment zone
struct Asg_Assignment Asg; // Data of assignment when browsing level 1 or an assignment zone.
// TODO: Remove from global?
struct
{
bool CreateZIP;

View File

@ -32,6 +32,7 @@
#include <string.h> // For string functions
#include "swad_action.h"
#include "swad_attendance.h"
#include "swad_box.h"
#include "swad_database.h"
#include "swad_form.h"
@ -45,6 +46,7 @@
#include "swad_program.h"
#include "swad_project.h"
#include "swad_setting.h"
#include "swad_survey.h"
/*****************************************************************************/
/*************************** Private constants *******************************/
@ -96,7 +98,7 @@ static void Grp_ReqEditGroupsInternal2 (Ale_AlertType_t AlertTypeGroups,
const char *AlertTextGroups);
static void Grp_EditGroupTypes (void);
static void Grp_EditGroups (const struct Cla_Classrooms *Classrooms);
static void Grp_EditGroups (const struct Roo_Rooms *Rooms);
static void Grp_PutIconsEditingGroups (__attribute__((unused)) void *Args);
static void Grp_PutIconToCreateNewGroup (void);
@ -116,7 +118,7 @@ static void Grp_PutIconToViewGroups (void);
static void Grp_PutIconToCreateNewGroupType (void);
static void Grp_WriteHeadingGroupTypes (void);
static void Grp_ListGroupsForEdition (const struct Cla_Classrooms *Classrooms);
static void Grp_ListGroupsForEdition (const struct Roo_Rooms *Rooms);
static void Grp_WriteHeadingGroups (void);
static void Grp_PutIconToEditGroups (__attribute__((unused)) void *Args);
@ -129,7 +131,7 @@ static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp,
static void Grp_WriteGrpHead (struct GroupType *GrpTyp);
static void Grp_WriteRowGrp (struct Group *Grp,bool Highlight);
static void Grp_PutFormToCreateGroupType (void);
static void Grp_PutFormToCreateGroup (const struct Cla_Classrooms *Classrooms);
static void Grp_PutFormToCreateGroup (const struct Roo_Rooms *Rooms);
static unsigned Grp_CountNumGrpsInThisCrsOfType (long GrpTypCod);
static void Grp_GetDataOfGroupTypeByCod (struct GroupType *GrpTyp);
static bool Grp_GetMultipleEnrolmentOfAGroupType (long GrpTypCod);
@ -253,28 +255,28 @@ static void Grp_ReqEditGroupsInternal1 (Ale_AlertType_t AlertTypeGroupTypes,
static void Grp_ReqEditGroupsInternal2 (Ale_AlertType_t AlertTypeGroups,
const char *AlertTextGroups)
{
struct Cla_Classrooms Classrooms;
struct Roo_Rooms Rooms;
/***** Reset classrooms context *****/
Cla_ResetClassrooms (&Classrooms);
/***** Reset rooms context *****/
Roo_ResetRooms (&Rooms);
/***** Show optional alert *****/
if (AlertTextGroups)
if (AlertTextGroups[0])
Ale_ShowAlert (AlertTypeGroups,AlertTextGroups);
/***** Get list of classrooms in this centre *****/
Cla_GetListClassrooms (&Classrooms,Cla_ONLY_SHRT_NAME);
/***** Get list of rooms in this centre *****/
Roo_GetListRooms (&Rooms,Roo_ONLY_SHRT_NAME);
/***** Put form to edit groups *****/
if (Gbl.Crs.Grps.GrpTypes.Num) // If there are group types...
Grp_EditGroups (&Classrooms);
Grp_EditGroups (&Rooms);
/***** End groups section *****/
HTM_SECTION_End ();
/***** Free list of classrooms in this centre *****/
Cla_FreeListClassrooms (&Classrooms);
/***** Free list of rooms in this centre *****/
Roo_FreeListRooms (&Rooms);
/***** Free list of groups types and groups in this course *****/
Grp_FreeListGrpTypesAndGrps ();
@ -313,7 +315,7 @@ static void Grp_EditGroupTypes (void)
/**************************** Put forms to edit groups ***********************/
/*****************************************************************************/
static void Grp_EditGroups (const struct Cla_Classrooms *Classrooms)
static void Grp_EditGroups (const struct Roo_Rooms *Rooms)
{
extern const char *Hlp_USERS_Groups;
extern const char *Txt_Groups;
@ -325,11 +327,11 @@ static void Grp_EditGroups (const struct Cla_Classrooms *Classrooms)
Hlp_USERS_Groups,Box_NOT_CLOSABLE);
/***** Put a form to create a new group *****/
Grp_PutFormToCreateGroup (Classrooms);
Grp_PutFormToCreateGroup (Rooms);
/***** Forms to edit current groups *****/
if (Gbl.Crs.Grps.GrpTypes.NumGrpsTotal) // If there are groups...
Grp_ListGroupsForEdition (Classrooms);
Grp_ListGroupsForEdition (Rooms);
else // There are group types, but there aren't groups
Ale_ShowAlert (Ale_INFO,Txt_No_groups_have_been_created_in_the_course_X,
Gbl.Hierarchy.Crs.ShrtName);
@ -977,7 +979,7 @@ static void Grp_LockTables (void)
"crs_grp WRITE,"
"crs_grp_usr WRITE,"
"crs_usr READ,"
"classrooms READ");
"rooms READ");
Gbl.DB.LockedTables = true;
}
@ -1473,14 +1475,14 @@ static void Grp_WriteHeadingGroupTypes (void)
/********************** List current groups for edition **********************/
/*****************************************************************************/
static void Grp_ListGroupsForEdition (const struct Cla_Classrooms *Classrooms)
static void Grp_ListGroupsForEdition (const struct Roo_Rooms *Rooms)
{
extern const char *Txt_Group_X_open_click_to_close_it;
extern const char *Txt_Group_X_closed_click_to_open_it;
extern const char *Txt_File_zones_of_the_group_X_enabled_click_to_disable_them;
extern const char *Txt_File_zones_of_the_group_X_disabled_click_to_enable_them;
extern const char *Txt_No_assigned_classroom;
extern const char *Txt_Another_classroom;
extern const char *Txt_No_assigned_room;
extern const char *Txt_Another_room;
unsigned NumGrpTyp;
unsigned NumTipGrpAux;
unsigned NumGrpThisType;
@ -1580,31 +1582,31 @@ static void Grp_ListGroupsForEdition (const struct Cla_Classrooms *Classrooms)
Frm_EndForm ();
HTM_TD_End ();
/***** Classroom *****/
/***** Room *****/
/* Start selector */
HTM_TD_Begin ("class=\"CM\"");
Frm_StartFormAnchor (ActChgGrpCla,Grp_GROUPS_SECTION_ID);
Frm_StartFormAnchor (ActChgGrpRoo,Grp_GROUPS_SECTION_ID);
Grp_PutParamGrpCod (Grp->GrpCod);
HTM_SELECT_Begin (true,
"name=\"ClaCod\" style=\"width:100px;\"");
"name=\"RooCod\" style=\"width:100px;\"");
/* Option for no assigned classroom */
/* Option for no assigned room */
HTM_OPTION (HTM_Type_STRING,"-1",
Grp->Classroom.ClaCod < 0,false,
"%s",Txt_No_assigned_classroom);
Grp->Room.RooCod < 0,false,
"%s",Txt_No_assigned_room);
/* Option for another classroom */
/* Option for another room */
HTM_OPTION (HTM_Type_STRING,"0",
Grp->Classroom.ClaCod == 0,false,
"%s",Txt_Another_classroom);
Grp->Room.RooCod == 0,false,
"%s",Txt_Another_room);
/* Options for classrooms */
/* Options for rooms */
for (NumCla = 0;
NumCla < Classrooms->Num;
NumCla < Rooms->Num;
NumCla++)
HTM_OPTION (HTM_Type_LONG,&Classrooms->Lst[NumCla].ClaCod,
Classrooms->Lst[NumCla].ClaCod == Grp->Classroom.ClaCod,false,
"%s",Classrooms->Lst[NumCla].ShrtName);
HTM_OPTION (HTM_Type_LONG,&Rooms->Lst[NumCla].RooCod,
Rooms->Lst[NumCla].RooCod == Grp->Room.RooCod,false,
"%s",Rooms->Lst[NumCla].ShrtName);
/* End selector */
HTM_SELECT_End ();
@ -1648,7 +1650,7 @@ static void Grp_WriteHeadingGroups (void)
extern const char *Txt_Type_BR_of_group;
extern const char *Txt_Group_name;
extern const char *Txt_eg_A_B;
extern const char *Txt_Classroom;
extern const char *Txt_Room;
extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES];
extern const char *Txt_Max_BR_students;
Rol_Role_t Role;
@ -1664,7 +1666,7 @@ static void Grp_WriteHeadingGroups (void)
HTM_BR ();
HTM_TxtF ("(%s)",Txt_eg_A_B);
HTM_TH_End ();
HTM_TH (1,1,"CM",Txt_Classroom);
HTM_TH (1,1,"CM",Txt_Room);
for (Role = Rol_TCH;
Role >= Rol_STD;
Role--)
@ -2308,7 +2310,7 @@ static void Grp_ListGrpsForMultipleSelection (struct GroupType *GrpTyp,
HTM_LABEL_End ();
HTM_TD_End ();
/* Classroom */
/* Room */
HTM_TD_Begin ("class=\"DAT LM\"");
HTM_TD_End ();
@ -2336,7 +2338,7 @@ static void Grp_WriteGrpHead (struct GroupType *GrpTyp)
{
extern const char *Txt_Opening_of_groups;
extern const char *Txt_Group;
extern const char *Txt_Classroom;
extern const char *Txt_Room;
extern const char *Txt_Max_BR_students;
extern const char *Txt_ROLES_PLURAL_BRIEF_Abc[Rol_NUM_ROLES];
extern const char *Txt_Vacants;
@ -2371,7 +2373,7 @@ static void Grp_WriteGrpHead (struct GroupType *GrpTyp)
HTM_TH_Empty (2);
HTM_TH (1,1,"LM",Txt_Group);
HTM_TH (1,1,"LM",Txt_Classroom);
HTM_TH (1,1,"LM",Txt_Room);
for (Role = Rol_TCH;
Role >= Rol_STD;
Role--)
@ -2417,12 +2419,12 @@ static void Grp_WriteRowGrp (struct Group *Grp,bool Highlight)
HTM_LABEL_End ();
HTM_TD_End ();
/***** Classroom *****/
/***** Room *****/
if (Highlight)
HTM_TD_Begin ("class=\"DAT LM LIGHT_BLUE\"");
else
HTM_TD_Begin ("class=\"DAT LM\"");
HTM_Txt (Grp->Classroom.ShrtName);
HTM_Txt (Grp->Room.ShrtName);
HTM_TD_End ();
/***** Current number of users in this group *****/
@ -2574,13 +2576,13 @@ static void Grp_PutFormToCreateGroupType (void)
/*********************** Put a form to create a new group ********************/
/*****************************************************************************/
static void Grp_PutFormToCreateGroup (const struct Cla_Classrooms *Classrooms)
static void Grp_PutFormToCreateGroup (const struct Roo_Rooms *Rooms)
{
extern const char *Txt_New_group;
extern const char *Txt_Group_closed;
extern const char *Txt_File_zones_disabled;
extern const char *Txt_No_assigned_classroom;
extern const char *Txt_Another_classroom;
extern const char *Txt_No_assigned_room;
extern const char *Txt_Another_room;
extern const char *Txt_Create_group;
unsigned NumGrpTyp;
unsigned NumCla;
@ -2640,27 +2642,27 @@ static void Grp_PutFormToCreateGroup (const struct Cla_Classrooms *Classrooms)
"size=\"20\" required=\"required\"");
HTM_TD_End ();
/***** Classroom *****/
/***** Room *****/
/* Start selector */
HTM_TD_Begin ("class=\"CM\"");
HTM_SELECT_Begin (false,
"name=\"ClaCod\" style=\"width:100px;\"");
"name=\"RooCod\" style=\"width:100px;\"");
/* Option for no assigned classroom */
HTM_OPTION (HTM_Type_STRING,"-1",Gbl.Crs.Grps.ClaCod < 0,false,
"%s",Txt_No_assigned_classroom);
/* Option for no assigned room */
HTM_OPTION (HTM_Type_STRING,"-1",Gbl.Crs.Grps.RooCod < 0,false,
"%s",Txt_No_assigned_room);
/* Option for another classroom */
HTM_OPTION (HTM_Type_STRING,"0",Gbl.Crs.Grps.ClaCod == 0,false,
"%s",Txt_Another_classroom);
/* Option for another room */
HTM_OPTION (HTM_Type_STRING,"0",Gbl.Crs.Grps.RooCod == 0,false,
"%s",Txt_Another_room);
/* Options for classrooms */
/* Options for rooms */
for (NumCla = 0;
NumCla < Classrooms->Num;
NumCla < Rooms->Num;
NumCla++)
HTM_OPTION (HTM_Type_LONG,&Classrooms->Lst[NumCla].ClaCod,
Classrooms->Lst[NumCla].ClaCod == Gbl.Crs.Grps.ClaCod,false,
"%s",Classrooms->Lst[NumCla].ShrtName);
HTM_OPTION (HTM_Type_LONG,&Rooms->Lst[NumCla].RooCod,
Rooms->Lst[NumCla].RooCod == Gbl.Crs.Grps.RooCod,false,
"%s",Rooms->Lst[NumCla].ShrtName);
/* End selector */
HTM_SELECT_End ();
@ -2915,15 +2917,15 @@ void Grp_GetListGrpTypesAndGrpsInThisCrs (Grp_WhichGroupTypes_t WhichGroupTypes)
Str_Copy (Grp->GrpName,row[1],
Grp_MAX_BYTES_GROUP_NAME);
/* Get classroom code (row[2]) */
Grp->Classroom.ClaCod = Str_ConvertStrCodToLongCod (row[2]);
/* Get room code (row[2]) */
Grp->Room.RooCod = Str_ConvertStrCodToLongCod (row[2]);
/* Get classroom short name (row[3]) */
/* Get room short name (row[3]) */
if (row[3]) // May be NULL because of LEFT JOIN
Str_Copy (Grp->Classroom.ShrtName,row[3],
Cla_MAX_BYTES_SHRT_NAME);
Str_Copy (Grp->Room.ShrtName,row[3],
Roo_MAX_BYTES_SHRT_NAME);
else // NULL
Grp->Classroom.ShrtName[0] = '\0';
Grp->Room.ShrtName[0] = '\0';
/* Get number of current users in group */
for (Role = Rol_TCH;
@ -3021,18 +3023,18 @@ static unsigned Grp_CountNumGrpsInThisCrsOfType (long GrpTypCod)
unsigned long Grp_GetGrpsOfType (long GrpTypCod,MYSQL_RES **mysql_res)
{
/***** Get groups of a type from database *****/
// Don't use INNER JOIN because there are groups without assigned classroom
// Don't use INNER JOIN because there are groups without assigned room
return DB_QuerySELECT (mysql_res,"can not get groups of a type",
"SELECT crs_grp.GrpCod,"
"crs_grp.GrpName,"
"crs_grp.ClaCod,"
"classrooms.ShortName,"
"crs_grp.RooCod,"
"rooms.ShortName,"
"crs_grp.MaxStudents,"
"crs_grp.Open,"
"crs_grp.FileZones"
" FROM crs_grp"
" LEFT JOIN classrooms"
" ON crs_grp.ClaCod=classrooms.ClaCod"
" LEFT JOIN rooms"
" ON crs_grp.RooCod=rooms.RooCod"
" WHERE crs_grp.GrpTypCod=%ld"
" ORDER BY crs_grp.GrpName",
GrpTypCod);
@ -3116,8 +3118,8 @@ void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat)
GrpDat->CrsCod = -1L;
GrpDat->GrpTypName[0] = '\0';
GrpDat->GrpName[0] = '\0';
GrpDat->Classroom.ClaCod = -1L;
GrpDat->Classroom.ShrtName[0] = '\0';
GrpDat->Room.RooCod = -1L;
GrpDat->Room.ShrtName[0] = '\0';
GrpDat->MaxStudents = 0;
GrpDat->Vacant = 0;
GrpDat->Open = false;
@ -3133,14 +3135,14 @@ void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat)
"crs_grp_types.GrpTypName," // row[2]
"crs_grp_types.Multiple," // row[3]
"crs_grp.GrpName," // row[4]
"crs_grp.ClaCod," // row[5]
"classrooms.ShortName," // row[6]
"crs_grp.RooCod," // row[5]
"rooms.ShortName," // row[6]
"crs_grp.MaxStudents," // row[7]
"crs_grp.Open," // row[8]
"crs_grp.FileZones" // row[9]
" FROM (crs_grp,crs_grp_types)"
" LEFT JOIN classrooms"
" ON crs_grp.ClaCod=classrooms.ClaCod"
" LEFT JOIN rooms"
" ON crs_grp.RooCod=rooms.RooCod"
" WHERE crs_grp.GrpCod=%ld"
" AND crs_grp.GrpTypCod=crs_grp_types.GrpTypCod",
GrpDat->GrpCod);
@ -3170,14 +3172,14 @@ void Grp_GetDataOfGroupByCod (struct GroupData *GrpDat)
Grp_MAX_BYTES_GROUP_NAME);
/* Get the code of the course (row[5]) */
GrpDat->Classroom.ClaCod = Str_ConvertStrCodToLongCod (row[5]);
GrpDat->Room.RooCod = Str_ConvertStrCodToLongCod (row[5]);
/* Get the name of the classroom (row[6]) */
/* Get the name of the room (row[6]) */
if (row[6]) // May be NULL because of LEFT JOIN
Str_Copy (GrpDat->Classroom.ShrtName,row[6],
Cla_MAX_BYTES_SHRT_NAME);
Str_Copy (GrpDat->Room.ShrtName,row[6],
Roo_MAX_BYTES_SHRT_NAME);
else // NULL
GrpDat->Classroom.ShrtName[0] = '\0';
GrpDat->Room.ShrtName[0] = '\0';
/* Get maximum number of students (row[7]) */
GrpDat->MaxStudents = Grp_ConvertToNumMaxStdsGrp (row[7]);
@ -3783,8 +3785,8 @@ void Grp_RecFormNewGrp (void)
Par_GetParToText ("GrpName",Gbl.Crs.Grps.GrpName,
Grp_MAX_BYTES_GROUP_NAME);
/* Get classroom */
Gbl.Crs.Grps.ClaCod = Cla_GetParamClaCod ();
/* Get room */
Gbl.Crs.Grps.RooCod = Roo_GetParamRooCod ();
/* Get maximum number of students */
Gbl.Crs.Grps.MaxStudents = (unsigned)
@ -3895,12 +3897,12 @@ static void Grp_CreateGroup (void)
/***** Create a new group *****/
DB_QueryINSERT ("can not create group",
"INSERT INTO crs_grp"
" (GrpTypCod,GrpName,ClaCod,MaxStudents,Open,FileZones)"
" (GrpTypCod,GrpName,RooCod,MaxStudents,Open,FileZones)"
" VALUES"
" (%ld,'%s',%ld,%u,'N','N')",
Gbl.Crs.Grps.GrpTyp.GrpTypCod,
Gbl.Crs.Grps.GrpName,
Gbl.Crs.Grps.ClaCod,
Gbl.Crs.Grps.RooCod,
Gbl.Crs.Grps.MaxStudents);
}
@ -4373,13 +4375,13 @@ void Grp_ChangeGroupType (void)
}
/*****************************************************************************/
/*********************** Change the classroom of a group *********************/
/************************* Change the room of a group ************************/
/*****************************************************************************/
void Grp_ChangeGroupClassroom (void)
void Grp_ChangeGroupRoom (void)
{
extern const char *Txt_The_classroom_assigned_to_the_group_X_has_changed;
long NewClaCod;
extern const char *Txt_The_room_assigned_to_the_group_X_has_changed;
long NewRooCod;
struct GroupData GrpDat;
Ale_AlertType_t AlertType;
char AlertTxt[256 + Grp_MAX_BYTES_GROUP_NAME];
@ -4389,26 +4391,26 @@ void Grp_ChangeGroupClassroom (void)
if ((Gbl.Crs.Grps.GrpCod = Grp_GetParamGrpCod ()) == -1L)
Lay_ShowErrorAndExit ("Code of group is missing.");
/* Get the new classroom */
NewClaCod = Cla_GetParamClaCod ();
/* Get the new room */
NewRooCod = Roo_GetParamRooCod ();
/* Get from the database the name of the group */
GrpDat.GrpCod = Gbl.Crs.Grps.GrpCod;
Grp_GetDataOfGroupByCod (&GrpDat);
/***** Update the table of groups changing old classroom by new classroom *****/
DB_QueryUPDATE ("can not update the classroom of a group",
"UPDATE crs_grp SET ClaCod=%ld WHERE GrpCod=%ld",
NewClaCod,Gbl.Crs.Grps.GrpCod);
/***** Update the table of groups changing old room by new room *****/
DB_QueryUPDATE ("can not update the room of a group",
"UPDATE crs_grp SET RooCod=%ld WHERE GrpCod=%ld",
NewRooCod,Gbl.Crs.Grps.GrpCod);
/* Create message to show the change made */
AlertType = Ale_SUCCESS;
snprintf (AlertTxt,sizeof (AlertTxt),
Txt_The_classroom_assigned_to_the_group_X_has_changed,
Txt_The_room_assigned_to_the_group_X_has_changed,
GrpDat.GrpName);
/***** Show the form again *****/
Gbl.Crs.Grps.ClaCod = NewClaCod;
Gbl.Crs.Grps.RooCod = NewRooCod;
Grp_ReqEditGroupsInternal (Ale_INFO,NULL,
AlertType,AlertTxt);
}

View File

@ -27,8 +27,8 @@
/********************************* Headers ***********************************/
/*****************************************************************************/
#include "swad_classroom.h"
#include "swad_info.h"
#include "swad_room.h"
#include "swad_user.h"
/*****************************************************************************/
@ -65,9 +65,9 @@ struct GroupData
char GrpName[Grp_MAX_BYTES_GROUP_NAME + 1];
struct
{
long ClaCod; // Classroom code
char ShrtName[Cla_MAX_BYTES_SHRT_NAME + 1]; // Classroom short name
} Classroom;
long RooCod; // Room code
char ShrtName[Roo_MAX_BYTES_SHRT_NAME + 1]; // Room short name
} Room;
unsigned MaxStudents;
int Vacant;
bool Open; // Group is open?
@ -81,9 +81,9 @@ struct Group
char GrpName[Grp_MAX_BYTES_GROUP_NAME + 1]; // Name of group
struct
{
long ClaCod; // Classroom code
char ShrtName[Cla_MAX_BYTES_SHRT_NAME + 1]; // Classroom short name
} Classroom;
long RooCod; // Room code
char ShrtName[Roo_MAX_BYTES_SHRT_NAME + 1]; // Room short name
} Room;
unsigned NumUsrs[Rol_NUM_ROLES]; // Number of users in the group
unsigned MaxStudents; // Maximum number of students in the group
bool Open; // Group is open?
@ -147,7 +147,7 @@ struct Grp_Groups
struct GroupType GrpTyp;
long GrpCod; // Group to be edited, removed...
char GrpName[Grp_MAX_BYTES_GROUP_NAME + 1];
long ClaCod;
long RooCod;
unsigned MaxStudents;
bool Open;
bool FileZones;
@ -217,7 +217,7 @@ void Grp_EnableFileZonesGrp (void);
void Grp_DisableFileZonesGrp (void);
void Grp_ChangeGroupType (void);
void Grp_ChangeGroupClassroom (void);
void Grp_ChangeGroupRoom (void);
void Grp_ChangeMandatGrpTyp (void);
void Grp_ChangeMultiGrpTyp (void);

View File

@ -627,46 +627,46 @@ const char *Hlp_CENTRE_Degrees =
"CENTRE.Degrees.en";
#endif
const char *Hlp_CENTRE_Classrooms =
const char *Hlp_CENTRE_Rooms =
#if L==1
"CENTRE.Classrooms.es";
"CENTRE.Rooms.es";
#elif L==2
"CENTRE.Classrooms.en";
"CENTRE.Rooms.en";
#elif L==3
"CENTRE.Classrooms.en";
"CENTRE.Rooms.en";
#elif L==4
"CENTRE.Classrooms.es";
"CENTRE.Rooms.es";
#elif L==5
"CENTRE.Classrooms.en";
"CENTRE.Rooms.en";
#elif L==6
"CENTRE.Classrooms.es";
"CENTRE.Rooms.es";
#elif L==7
"CENTRE.Classrooms.en";
"CENTRE.Rooms.en";
#elif L==8
"CENTRE.Classrooms.en";
"CENTRE.Rooms.en";
#elif L==9
"CENTRE.Classrooms.en";
"CENTRE.Rooms.en";
#endif
const char *Hlp_CENTRE_Classrooms_edit =
const char *Hlp_CENTRE_Rooms_edit =
#if L==1
"CENTRE.Classrooms.es#editar";
"CENTRE.Rooms.es#editar";
#elif L==2
"CENTRE.Classrooms.en#edit";
"CENTRE.Rooms.en#edit";
#elif L==3
"CENTRE.Classrooms.en#edit";
"CENTRE.Rooms.en#edit";
#elif L==4
"CENTRE.Classrooms.es#editar";
"CENTRE.Rooms.es#editar";
#elif L==5
"CENTRE.Classrooms.en#edit";
"CENTRE.Rooms.en#edit";
#elif L==6
"CENTRE.Classrooms.es#editar";
"CENTRE.Rooms.es#editar";
#elif L==7
"CENTRE.Classrooms.en#edit";
"CENTRE.Rooms.en#edit";
#elif L==8
"CENTRE.Classrooms.en#edit";
"CENTRE.Rooms.en#edit";
#elif L==9
"CENTRE.Classrooms.en#edit";
"CENTRE.Rooms.en#edit";
#endif
/***** DEGREE tab *****/

View File

@ -30,6 +30,7 @@
#include "swad_box.h"
#include "swad_config.h"
#include "swad_database.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_global.h"
#include "swad_HTML.h"

View File

@ -31,11 +31,13 @@
#include "swad_action.h"
#include "swad_box.h"
#include "swad_database.h"
#include "swad_department.h"
#include "swad_form.h"
#include "swad_forum.h"
#include "swad_global.h"
#include "swad_HTML.h"
#include "swad_indicator.h"
#include "swad_message.h"
#include "swad_parameter.h"
#include "swad_theme.h"

View File

@ -31,11 +31,17 @@
#include <string.h> // For string functions
#include "swad_database.h"
#include "swad_department.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_forum.h"
#include "swad_global.h"
#include "swad_HTML.h"
#include "swad_institution.h"
#include "swad_logo.h"
#include "swad_message.h"
#include "swad_place.h"
#include "swad_survey.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/

View File

@ -32,6 +32,7 @@
#include <stdlib.h> // For free
#include "swad_database.h"
#include "swad_department.h"
#include "swad_form.h"
#include "swad_global.h"
#include "swad_help.h"
@ -39,6 +40,7 @@
#include "swad_HTML.h"
#include "swad_institution.h"
#include "swad_logo.h"
#include "swad_place.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/

View File

@ -27,6 +27,7 @@
#include "swad_box.h"
#include "swad_database.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_global.h"
#include "swad_HTML.h"

View File

@ -31,6 +31,7 @@
#include "swad_action.h"
#include "swad_API.h"
#include "swad_banner.h"
#include "swad_box.h"
#include "swad_calendar.h"
#include "swad_changelog.h"
@ -44,8 +45,10 @@
#include "swad_global.h"
#include "swad_help.h"
#include "swad_hierarchy.h"
#include "swad_holiday.h"
#include "swad_HTML.h"
#include "swad_language.h"
#include "swad_link.h"
#include "swad_log.h"
#include "swad_logo.h"
#include "swad_match.h"

View File

@ -29,6 +29,7 @@
#include <stdlib.h> // For calloc
#include <string.h> // For string functions
#include "swad_banner.h"
#include "swad_box.h"
#include "swad_constant.h"
#include "swad_database.h"

View File

@ -29,6 +29,7 @@
#include <string.h> // For strlen
#include "swad_action.h"
#include "swad_banner.h"
#include "swad_config.h"
#include "swad_database.h"
#include "swad_global.h"

View File

@ -28,6 +28,7 @@
/*****************************************************************************/
#include "swad_scope.h"
#include "swad_test.h"
/*****************************************************************************/
/************************** Public types and constants ***********************/

View File

@ -41,6 +41,7 @@
#include "swad_ID.h"
#include "swad_match.h"
#include "swad_match_result.h"
#include "swad_photo.h"
#include "swad_test_visibility.h"
#include "swad_user.h"

View File

@ -27,6 +27,7 @@
#include "swad_box.h"
#include "swad_database.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_global.h"
#include "swad_HTML.h"
@ -93,7 +94,7 @@ static const Act_Action_t Mnu_MenuActions[Tab_NUM_TABS][Act_MAX_OPTIONS_IN_MENU_
[TabCtr] = {
[ 0] = ActSeeCtrInf,
[ 1] = ActSeeDeg,
[ 2] = ActSeeCla,
[ 2] = ActSeeRoo,
},
[TabDeg] = {
[ 0] = ActSeeDegInf,

View File

@ -38,6 +38,7 @@
#include "swad_config.h"
#include "swad_course.h"
#include "swad_database.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_forum.h"
#include "swad_global.h"

View File

@ -29,6 +29,7 @@
#include "swad_box.h"
#include "swad_database.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_global.h"
#include "swad_HTML.h"

View File

@ -34,6 +34,7 @@
#include "swad_box.h"
#include "swad_database.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_global.h"
#include "swad_HTML.h"

View File

@ -38,15 +38,18 @@
#include "swad_database.h"
#include "swad_enrolment.h"
#include "swad_exam.h"
#include "swad_figure.h"
#include "swad_follow.h"
#include "swad_form.h"
#include "swad_forum.h"
#include "swad_global.h"
#include "swad_HTML.h"
#include "swad_mark.h"
#include "swad_message.h"
#include "swad_notice.h"
#include "swad_notification.h"
#include "swad_parameter.h"
#include "swad_survey.h"
#include "swad_timeline.h"
/*****************************************************************************/

View File

@ -31,16 +31,20 @@
#include <stdlib.h> // For free
#include "swad_action.h"
#include "swad_agenda.h"
#include "swad_attendance.h"
#include "swad_database.h"
#include "swad_form.h"
#include "swad_forum.h"
#include "swad_game.h"
#include "swad_global.h"
#include "swad_HTML.h"
#include "swad_message.h"
#include "swad_pagination.h"
#include "swad_parameter.h"
#include "swad_program.h"
#include "swad_project.h"
#include "swad_survey.h"
/*****************************************************************************/
/*************** External global variables from others modules ***************/

View File

@ -51,6 +51,7 @@
#include "swad_photo.h"
#include "swad_privacy.h"
#include "swad_setting.h"
#include "swad_statistic.h"
#include "swad_theme.h"
#include "swad_user.h"

View File

@ -29,6 +29,7 @@
#include "swad_action.h"
#include "swad_box.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_global.h"
#include "swad_HTML.h"

View File

@ -33,15 +33,19 @@
#include "swad_box.h"
#include "swad_config.h"
#include "swad_database.h"
#include "swad_figure.h"
#include "swad_follow.h"
#include "swad_form.h"
#include "swad_forum.h"
#include "swad_global.h"
#include "swad_HTML.h"
#include "swad_language.h"
#include "swad_message.h"
#include "swad_network.h"
#include "swad_nickname.h"
#include "swad_notification.h"
#include "swad_parameter.h"
#include "swad_photo.h"
#include "swad_privacy.h"
#include "swad_profile.h"
#include "swad_role.h"

View File

@ -34,6 +34,8 @@
#include "swad_box.h"
#include "swad_database.h"
#include "swad_department.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_global.h"
#include "swad_HTML.h"

View File

@ -35,6 +35,7 @@
#include "swad_box.h"
#include "swad_config.h"
#include "swad_database.h"
#include "swad_department.h"
#include "swad_enrolment.h"
#include "swad_follow.h"
#include "swad_form.h"
@ -42,6 +43,7 @@
#include "swad_HTML.h"
#include "swad_ID.h"
#include "swad_logo.h"
#include "swad_message.h"
#include "swad_network.h"
#include "swad_parameter.h"
#include "swad_photo.h"
@ -50,6 +52,7 @@
#include "swad_record.h"
#include "swad_role.h"
#include "swad_setting.h"
#include "swad_timetable.h"
#include "swad_user.h"
/*****************************************************************************/

View File

@ -1016,15 +1016,17 @@ static void Rep_GetAndWriteMyCurrentCrss (Rol_Role_t Role,
/***** Get courses of a user from database *****/
NumCrss =
(unsigned) DB_QuerySELECT (&mysql_res,"can not get courses of a user",
"SELECT crs_usr.CrsCod,log.CrsCod,COUNT(*) AS N"
" FROM crs_usr LEFT JOIN log ON"
" (crs_usr.CrsCod=log.CrsCod"
" AND crs_usr.UsrCod=log.UsrCod"
" AND crs_usr.Role=log.Role)"
" WHERE crs_usr.UsrCod=%ld"
" AND crs_usr.Role=%u"
" GROUP BY crs_usr.CrsCod"
" ORDER BY N DESC,log.CrsCod DESC",
"SELECT my_courses.CrsCod," // row[0]
"COUNT(*) AS N" // row[1]
" FROM"
" (SELECT CrsCod FROM crs_usr"
" WHERE UsrCod=%ld AND Role=%u) AS my_courses" // It's imperative to use a derived table to not block crs_usr!
" LEFT JOIN log"
" ON (my_courses.CrsCod=log.CrsCod)"
" WHERE log.UsrCod=%ld AND log.Role=%u"
" GROUP BY my_courses.CrsCod"
" ORDER BY N DESC,my_courses.CrsCod DESC",
Gbl.Usrs.Me.UsrDat.UsrCod,(unsigned) Role,
Gbl.Usrs.Me.UsrDat.UsrCod,(unsigned) Role);
/***** List the courses (one row per course) *****/

1087
swad_room.c Normal file

File diff suppressed because it is too large Load Diff

111
swad_room.h Normal file
View File

@ -0,0 +1,111 @@
// swad_room.h: classrooms, laboratories, offices or other rooms in a centre
#ifndef _SWAD_ROO
#define _SWAD_ROO
/*
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-2020 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 **********************************/
/*****************************************************************************/
#include "swad_string.h"
/*****************************************************************************/
/************************** Public types and constants ***********************/
/*****************************************************************************/
#define Roo_MAX_CHARS_SHRT_NAME (32 - 1) // 31
#define Roo_MAX_BYTES_SHRT_NAME ((Roo_MAX_CHARS_SHRT_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 511
#define Roo_MAX_CHARS_FULL_NAME (128 - 1) // 127
#define Roo_MAX_BYTES_FULL_NAME ((Roo_MAX_CHARS_FULL_NAME + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
#define Roo_MAX_CAPACITY 10000 // If capacity of a room is greater than this, it is considered infinite
#define Roo_UNLIMITED_CAPACITY INT_MAX // This number can be stored in database as an integer...
// ...and means that a room has no limited capacity
#define Roo_MAX_CHARS_LOCATION (128 - 1) // 127
#define Roo_MAX_BYTES_LOCATION ((Roo_MAX_CHARS_LOCATION + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
struct Roo_Room
{
long RooCod;
long InsCod;
char ShrtName[Roo_MAX_BYTES_SHRT_NAME + 1];
char FullName[Roo_MAX_BYTES_FULL_NAME + 1];
unsigned Capacity; // Seating capacity (maximum number of people that fit in the room)
char Location[Roo_MAX_BYTES_LOCATION + 1]; // Examples: Ground floor, first floor, basement
};
#define Roo_NUM_ORDERS 4
typedef enum
{
Roo_ORDER_BY_SHRT_NAME = 0,
Roo_ORDER_BY_FULL_NAME = 1,
Roo_ORDER_BY_CAPACITY = 2,
Roo_ORDER_BY_LOCATION = 3,
} Roo_Order_t;
#define Roo_ORDER_DEFAULT Roo_ORDER_BY_LOCATION
/***** Get all data or only short name *****/
typedef enum
{
Roo_ALL_DATA,
Roo_ONLY_SHRT_NAME,
} Roo_WhichData_t;
struct Roo_Rooms
{
unsigned Num; // Number of rooms
struct Roo_Room *Lst; // List of rooms
Roo_Order_t SelectedOrder;
};
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
void Roo_ResetRooms (struct Roo_Rooms *Rooms);
void Roo_SeeRooms (void);
void Roo_EditRooms (void);
void Roo_PutIconToViewRooms (void);
void Roo_GetListRooms (struct Roo_Rooms *Rooms,
Roo_WhichData_t WhichData);
void Roo_FreeListRooms (struct Roo_Rooms *Rooms);
void Roo_GetListRoomsInThisCtr (void);
void Roo_GetDataOfRoomByCod (struct Roo_Room *Roo);
long Roo_GetParamRooCod (void);
void Roo_RemoveRoom (void);
void Roo_RemoveAllRoomsInCtr (long CtrCod);
void Roo_RenameRoomShort (void);
void Roo_RenameRoomFull (void);
void Roo_ChangeCapacity (void);
void Roo_ChangeRoomLocation (void);
void Roo_ContEditAfterChgRoom (void);
void Roo_RecFormNewRoom (void);
#endif

View File

@ -35,6 +35,7 @@
#include "swad_cookie.h"
#include "swad_database.h"
#include "swad_date.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_global.h"
#include "swad_HTML.h"

View File

@ -31,6 +31,7 @@
#include <stdlib.h> // For getenv, malloc
#include <string.h> // For string functions
#include "swad_banner.h"
#include "swad_box.h"
#include "swad_database.h"
#include "swad_form.h"

View File

@ -32,8 +32,10 @@
#include <stdlib.h> // For calloc
#include <string.h> // For string functions
#include "swad_attendance.h"
#include "swad_box.h"
#include "swad_database.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_global.h"
#include "swad_group.h"

View File

@ -38,6 +38,7 @@
#include "swad_config.h"
#include "swad_database.h"
#include "swad_form.h"
#include "swad_forum.h"
#include "swad_global.h"
#include "swad_HTML.h"
#include "swad_parameter.h"

View File

@ -48,8 +48,6 @@
/************** External global variables from others modules ****************/
/*****************************************************************************/
extern struct Globals Gbl; // All the global parameters and variables must be in this structure
/*****************************************************************************/
/***************************** Private constants *****************************/
/*****************************************************************************/

View File

@ -40,6 +40,7 @@
#include "swad_action.h"
#include "swad_box.h"
#include "swad_database.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_global.h"
#include "swad_HTML.h"

View File

@ -29,6 +29,7 @@
#include "swad_database.h"
#include "swad_global.h"
#include "swad_test.h"
#include "swad_test_config.h"
#include "swad_test_visibility.h"

View File

@ -38,6 +38,7 @@
#include "swad_global.h"
#include "swad_HTML.h"
#include "swad_ID.h"
#include "swad_photo.h"
#include "swad_test.h"
#include "swad_test_exam.h"
#include "swad_test_visibility.h"

View File

@ -27,6 +27,7 @@
/********************************* Headers ***********************************/
/*****************************************************************************/
#include "swad_test.h"
#include "swad_user.h"
/*****************************************************************************/

View File

@ -49,8 +49,6 @@
/************** External global variables from others modules ****************/
/*****************************************************************************/
extern struct Globals Gbl;
/*****************************************************************************/
/************************* Private global variables **************************/
/*****************************************************************************/

File diff suppressed because it is too large Load Diff

View File

@ -3569,15 +3569,15 @@ const char *Txt_Actions[Act_NUM_ACTIONS] =
"" // Precisa de tradução
#endif
,
[ActSeeCla] =
[ActSeeRoo] =
#if L==1 // ca
"" // Necessita traducció
#elif L==2 // de
"" // Need Übersetzung
#elif L==3 // en
"List classrooms in a centre"
"List rooms in a centre"
#elif L==4 // es
""
"Listar salas de un centro"
#elif L==5 // fr
"" // Besoin de traduction
#elif L==6 // gn
@ -4199,15 +4199,15 @@ const char *Txt_Actions[Act_NUM_ACTIONS] =
"" // Precisa de tradução
#endif
,
[ActEdiCla] =
[ActEdiRoo] =
#if L==1 // ca
"" // Necessita traducció
#elif L==2 // de
"" // Need Übersetzung
#elif L==3 // en
"Edit classrooms"
"Edit rooms"
#elif L==4 // es
""
"Editar salas"
#elif L==5 // fr
"" // Besoin de traduction
#elif L==6 // gn
@ -4220,15 +4220,15 @@ const char *Txt_Actions[Act_NUM_ACTIONS] =
"" // Precisa de tradução
#endif
,
[ActNewCla] =
[ActNewRoo] =
#if L==1 // ca
"" // Necessita traducció
#elif L==2 // de
"" // Need Übersetzung
#elif L==3 // en
"Request the creation of a classroom"
"Request the creation of a room"
#elif L==4 // es
""
"Solicitar la creaci&oacute;n de una sala"
#elif L==5 // fr
"" // Besoin de traduction
#elif L==6 // gn
@ -4241,15 +4241,15 @@ const char *Txt_Actions[Act_NUM_ACTIONS] =
"" // Precisa de tradução
#endif
,
[ActRemCla] =
[ActRemRoo] =
#if L==1 // ca
"" // Necessita traducció
#elif L==2 // de
"" // Need Übersetzung
#elif L==3 // en
"Remove a classroom"
"Remove a room"
#elif L==4 // es
""
"Eliminar sala"
#elif L==5 // fr
"" // Besoin de traduction
#elif L==6 // gn
@ -4262,15 +4262,15 @@ const char *Txt_Actions[Act_NUM_ACTIONS] =
"" // Precisa de tradução
#endif
,
[ActRenClaSho] =
[ActRenRooSho] =
#if L==1 // ca
"" // Necessita traducció
#elif L==2 // de
"" // Need Übersetzung
#elif L==3 // en
"Change short name of a classroom"
"Change short name of a room"
#elif L==4 // es
""
"Cambiar nombre breve de sala"
#elif L==5 // fr
"" // Besoin de traduction
#elif L==6 // gn
@ -4283,15 +4283,15 @@ const char *Txt_Actions[Act_NUM_ACTIONS] =
"" // Precisa de tradução
#endif
,
[ActRenClaFul] =
[ActRenRooFul] =
#if L==1 // ca
"" // Necessita traducció
#elif L==2 // de
"" // Need Übersetzung
#elif L==3 // en
"Change full name of a classroom"
"Change full name of a room"
#elif L==4 // es
""
"Cambiar nombre completo de sala"
#elif L==5 // fr
"" // Besoin de traduction
#elif L==6 // gn
@ -4304,15 +4304,15 @@ const char *Txt_Actions[Act_NUM_ACTIONS] =
"" // Precisa de tradução
#endif
,
[ActChgClaMaxStd] =
[ActChgRooMaxUsr] =
#if L==1 // ca
"" // Necessita traducció
#elif L==2 // de
"" // Need Übersetzung
#elif L==3 // en
"Change number of students in a classroom"
"Change number of usuarios in a room"
#elif L==4 // es
""
"Cambiar n&uacute;mero de usuarios de una sala"
#elif L==5 // fr
"" // Besoin de traduction
#elif L==6 // gn
@ -4325,15 +4325,15 @@ const char *Txt_Actions[Act_NUM_ACTIONS] =
"" // Precisa de tradução
#endif
,
[ActRenClaLoc] =
[ActRenRooLoc] =
#if L==1 // ca
"" // Necessita traducció
#elif L==2 // de
"" // Need Übersetzung
#elif L==3 // en
"Change location of a classroom"
"Change location of a room"
#elif L==4 // es
""
"Cambiar ubicaci&oacute;n de una sala"
#elif L==5 // fr
"" // Besoin de traduction
#elif L==6 // gn
@ -21020,15 +21020,15 @@ const char *Txt_Actions[Act_NUM_ACTIONS] =
"" // Precisa de tradução
#endif
,
[ActChgGrpCla] =
[ActChgGrpRoo] =
#if L==1 // ca
"" // Necessita traducció
#elif L==2 // de
"" // Need Übersetzung
#elif L==3 // en
"Change the classroom of a group"
"Change the room of a group"
#elif L==4 // es
""
"Cambiar la sala de un grupo"
#elif L==5 // fr
"" // Besoin de traduction
#elif L==6 // gn

View File

@ -30,6 +30,7 @@
#include "swad_box.h"
#include "swad_config.h"
#include "swad_database.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_global.h"
#include "swad_HTML.h"

View File

@ -37,12 +37,15 @@
#include "swad_constant.h"
#include "swad_database.h"
#include "swad_exam.h"
#include "swad_figure.h"
#include "swad_follow.h"
#include "swad_form.h"
#include "swad_forum.h"
#include "swad_global.h"
#include "swad_HTML.h"
#include "swad_layout.h"
#include "swad_media.h"
#include "swad_message.h"
#include "swad_notice.h"
#include "swad_notification.h"
#include "swad_parameter.h"

View File

@ -1495,7 +1495,7 @@ static void TT_TimeTableDrawCell (const struct TT_Timetable *Timetable,
struct Course Crs;
struct GroupType *GrpTyp;
struct Group *Grp;
char *Classroom;
char *Room;
/***** Compute row span and background color depending on hour type *****/
switch (IntervalType)
@ -1611,10 +1611,10 @@ static void TT_TimeTableDrawCell (const struct TT_Timetable *Timetable,
HTM_Txt (GrpDat.GrpTypName);
HTM_BR ();
HTM_Txt (GrpDat.GrpName);
if (GrpDat.Classroom.ClaCod > 0)
if (GrpDat.Room.RooCod > 0)
{
HTM_BR ();
HTM_TxtF ("(%s)",GrpDat.Classroom.ShrtName);
HTM_TxtF ("(%s)",GrpDat.Room.ShrtName);
}
}
@ -1727,21 +1727,21 @@ static void TT_TimeTableDrawCell (const struct TT_Timetable *Timetable,
NumGrp++)
{
Grp = &GrpTyp->LstGrps[NumGrp];
if (Grp->Classroom.ClaCod > 0)
if (Grp->Room.RooCod > 0)
{
if (asprintf (&Classroom," (%s)",Grp->Classroom.ShrtName) < 0)
if (asprintf (&Room," (%s)",Grp->Room.ShrtName) < 0)
Lay_NotEnoughMemoryExit ();
}
else
{
if (asprintf (&Classroom,"%s","") < 0)
if (asprintf (&Room,"%s","") < 0)
Lay_NotEnoughMemoryExit ();
}
HTM_OPTION (HTM_Type_LONG,&Grp->GrpCod,
GrpCod == Grp->GrpCod,false,
"%s %s%s",
GrpTyp->GrpTypName,Grp->GrpName,Classroom);
free (Classroom);
GrpTyp->GrpTypName,Grp->GrpName,Room);
free (Room);
}
}
HTM_SELECT_End ();

View File

@ -37,6 +37,7 @@
#include <unistd.h> // For access, lstat, getpid, chdir, symlink, unlink
#include "swad_account.h"
#include "swad_agenda.h"
#include "swad_announcement.h"
#include "swad_box.h"
#include "swad_calendar.h"
@ -44,8 +45,10 @@
#include "swad_connected.h"
#include "swad_course.h"
#include "swad_database.h"
#include "swad_department.h"
#include "swad_duplicate.h"
#include "swad_enrolment.h"
#include "swad_figure.h"
#include "swad_follow.h"
#include "swad_form.h"
#include "swad_global.h"
@ -60,6 +63,7 @@
#include "swad_notification.h"
#include "swad_parameter.h"
#include "swad_password.h"
#include "swad_photo.h"
#include "swad_privacy.h"
#include "swad_QR.h"
#include "swad_record.h"