mirror of https://github.com/acanas/swad-core.git
Version 15.248
This commit is contained in:
parent
dac9276f93
commit
aff03a995e
|
@ -421,6 +421,8 @@ int swad__getAttendanceEvents (char *wsKey,int courseCode,
|
|||
struct swad__getAttendanceEventsOutput *getAttendanceEventsOut);
|
||||
int swad__sendAttendanceEvent (char *wsKey,int attendanceEventCode,int courseCode,int hidden,int startTime,int endTime,int commentsTeachersVisible,char *title,char *text,char *groups,
|
||||
struct swad__sendAttendanceEventOutput *sendAttendanceEventOut);
|
||||
int swad__removeAttendanceEvent (char *wsKey,int attendanceEventCode,
|
||||
struct swad__sendAttendanceEventOutput *sendAttendanceEventOut);
|
||||
int swad__getAttendanceUsers (char *wsKey,int attendanceEventCode,
|
||||
struct swad__getAttendanceUsersOutput *getAttendanceUsersOut);
|
||||
int swad__sendAttendanceUsers (char *wsKey,int attendanceEventCode,char *users,int setOthersAsAbsent,
|
||||
|
|
|
@ -2345,7 +2345,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
|
|||
/* ActNewAtt */{1065,-1,TabUsr,ActSeeAtt ,0x110,0x100,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Att_RecFormAttEvent ,NULL},
|
||||
/* ActChgAtt */{1066,-1,TabUsr,ActSeeAtt ,0x110,0x100,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Att_RecFormAttEvent ,NULL},
|
||||
/* ActReqRemAtt */{1067,-1,TabUsr,ActSeeAtt ,0x110,0x100,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Att_AskRemAttEvent ,NULL},
|
||||
/* ActRemAtt */{1068,-1,TabUsr,ActSeeAtt ,0x110,0x100,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Att_RemoveAttEvent ,NULL},
|
||||
/* ActRemAtt */{1068,-1,TabUsr,ActSeeAtt ,0x110,0x100,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Att_GetAndRemAttEvent ,NULL},
|
||||
/* ActHidAtt */{1069,-1,TabUsr,ActSeeAtt ,0x110,0x100,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Att_HideAttEvent ,NULL},
|
||||
/* ActShoAtt */{1070,-1,TabUsr,ActSeeAtt ,0x110,0x100,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Att_ShowAttEvent ,NULL},
|
||||
/* ActSeeOneAtt */{1071,-1,TabUsr,ActSeeAtt ,0x118,0x100,0x000,Act_CONTENT_NORM,Act_MAIN_WINDOW,NULL ,Att_SeeOneAttEvent ,NULL},
|
||||
|
|
|
@ -94,6 +94,9 @@ static void Att_RemoveAllTheGrpsAssociatedToAnAttEvent (long AttCod);
|
|||
static void Att_CreateGrps (long AttCod);
|
||||
static void Att_GetAndWriteNamesOfGrpsAssociatedToAttEvent (struct AttendanceEvent *Att);
|
||||
|
||||
static void Att_RemoveAllUsrsFromAnAttEvent (long AttCod);
|
||||
static void Att_RemoveAttEventFromCurrentCrs (long AttCod);
|
||||
|
||||
static void Att_ListAttOnlyMeAsStudent (struct AttendanceEvent *Att);
|
||||
static void Att_ListAttStudents (struct AttendanceEvent *Att);
|
||||
static void Att_WriteRowStdToCallTheRoll (unsigned NumStd,struct UsrData *UsrDat,struct AttendanceEvent *Att);
|
||||
|
@ -925,13 +928,12 @@ void Att_AskRemAttEvent (void)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************ Remove an attendance event *************************/
|
||||
/** Get param., remove an attendance event and show attendance events again **/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Att_RemoveAttEvent (void)
|
||||
void Att_GetAndRemAttEvent (void)
|
||||
{
|
||||
extern const char *Txt_Event_X_removed;
|
||||
char Query[512];
|
||||
struct AttendanceEvent Att;
|
||||
|
||||
/***** Get attendance event code *****/
|
||||
|
@ -939,32 +941,36 @@ void Att_RemoveAttEvent (void)
|
|||
Lay_ShowErrorAndExit ("Code of attendance event is missing.");
|
||||
|
||||
/***** Get data of the attendance event from database *****/
|
||||
Att_GetDataOfAttEventByCodAndCheckCrs (&Att); // Inside this function, the course is checked to be the current one
|
||||
// Inside this function, the course is checked to be the current one
|
||||
Att_GetDataOfAttEventByCodAndCheckCrs (&Att);
|
||||
|
||||
/***** Remove users registered in the attendance event *****/
|
||||
sprintf (Query,"DELETE FROM att_usr"
|
||||
" WHERE AttCod='%ld'",
|
||||
Att.AttCod);
|
||||
DB_QueryDELETE (Query,"can not remove attendance event");
|
||||
|
||||
/***** Remove all the groups of this attendance event *****/
|
||||
Att_RemoveAllTheGrpsAssociatedToAnAttEvent (Att.AttCod);
|
||||
|
||||
/***** Remove attendance event *****/
|
||||
sprintf (Query,"DELETE FROM att_events"
|
||||
" WHERE AttCod='%ld' AND CrsCod='%ld'",
|
||||
Att.AttCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove attendance event");
|
||||
/***** Remove the attendance event from database *****/
|
||||
Att_RemoveAttEventFromDB (Att.AttCod);
|
||||
|
||||
/***** Write message to show the change made *****/
|
||||
sprintf (Gbl.Message,Txt_Event_X_removed,
|
||||
Att.Title);
|
||||
sprintf (Gbl.Message,Txt_Event_X_removed,Att.Title);
|
||||
Lay_ShowAlert (Lay_SUCCESS,Gbl.Message);
|
||||
|
||||
/***** Show attendance events again *****/
|
||||
Att_SeeAttEvents ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**************** Remove an attendance event from database *******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Att_RemoveAttEventFromDB (long AttCod)
|
||||
{
|
||||
/***** Remove users registered in the attendance event *****/
|
||||
Att_RemoveAllUsrsFromAnAttEvent (AttCod);
|
||||
|
||||
/***** Remove all the groups of this attendance event *****/
|
||||
Att_RemoveAllTheGrpsAssociatedToAnAttEvent (AttCod);
|
||||
|
||||
/***** Remove attendance event *****/
|
||||
Att_RemoveAttEventFromCurrentCrs (AttCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Hide an attendance event **************************/
|
||||
/*****************************************************************************/
|
||||
|
@ -1430,35 +1436,6 @@ static void Att_RemoveAllTheGrpsAssociatedToAnAttEvent (long AttCod)
|
|||
DB_QueryDELETE (Query,"can not remove the groups associated to an attendance event");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********** Remove one student from all the attendance events ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Att_RemoveUsrFromAllAttEvents (long UsrCod)
|
||||
{
|
||||
char Query[256];
|
||||
|
||||
/***** Remove group from all the attendance events *****/
|
||||
sprintf (Query,"DELETE FROM att_usr WHERE UsrCod='%ld'",UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user from all attendance events");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********** Remove one student from all the attendance events ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Att_RemoveUsrFromCrsAttEvents (long UsrCod,long CrsCod)
|
||||
{
|
||||
char Query[512];
|
||||
|
||||
/***** Remove group from all the attendance events *****/
|
||||
sprintf (Query,"DELETE FROM att_usr USING att_events,att_usr"
|
||||
" WHERE att_events.CrsCod='%ld'"
|
||||
" AND att_events.AttCod=att_usr.AttCod AND att_usr.UsrCod='%ld'",
|
||||
CrsCod,UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user from attendance events of a course");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************* Remove one group from all the attendance events ***************/
|
||||
/*****************************************************************************/
|
||||
|
@ -1574,6 +1551,61 @@ static void Att_GetAndWriteNamesOfGrpsAssociatedToAttEvent (struct AttendanceEve
|
|||
DB_FreeMySQLResult (&mysql_res);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********** Remove all users registered in an attendance event **************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Att_RemoveAllUsrsFromAnAttEvent (long AttCod)
|
||||
{
|
||||
char Query[256];
|
||||
|
||||
sprintf (Query,"DELETE FROM att_usr WHERE AttCod='%ld'",AttCod);
|
||||
DB_QueryDELETE (Query,"can not remove attendance event");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Remove one user from all the attendance events where he/she is registered */
|
||||
/*****************************************************************************/
|
||||
|
||||
void Att_RemoveUsrFromAllAttEvents (long UsrCod)
|
||||
{
|
||||
char Query[256];
|
||||
|
||||
/***** Remove group from all the attendance events *****/
|
||||
sprintf (Query,"DELETE FROM att_usr WHERE UsrCod='%ld'",UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user from all attendance events");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********** Remove one student from all the attendance events ***************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Att_RemoveUsrFromCrsAttEvents (long UsrCod,long CrsCod)
|
||||
{
|
||||
char Query[512];
|
||||
|
||||
/***** Remove group from all the attendance events *****/
|
||||
sprintf (Query,"DELETE FROM att_usr USING att_events,att_usr"
|
||||
" WHERE att_events.CrsCod='%ld'"
|
||||
" AND att_events.AttCod=att_usr.AttCod AND att_usr.UsrCod='%ld'",
|
||||
CrsCod,UsrCod);
|
||||
DB_QueryDELETE (Query,"can not remove user from attendance events of a course");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*********************** Remove an attendance event **************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Att_RemoveAttEventFromCurrentCrs (long AttCod)
|
||||
{
|
||||
char Query[256];
|
||||
|
||||
sprintf (Query,"DELETE FROM att_events"
|
||||
" WHERE AttCod='%ld' AND CrsCod='%ld'",
|
||||
AttCod,Gbl.CurrentCrs.Crs.CrsCod);
|
||||
DB_QueryDELETE (Query,"can not remove attendance event");
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************** Remove all the attendance events of a course ****************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -86,8 +86,11 @@ void Att_GetNotifAttEvent (char *SummaryStr,char **ContentStr,long AsgCod,unsign
|
|||
|
||||
void Att_PutParamAttCod (long AttCod);
|
||||
long Att_GetParamAttCod (void);
|
||||
|
||||
void Att_AskRemAttEvent (void);
|
||||
void Att_RemoveAttEvent (void);
|
||||
void Att_GetAndRemAttEvent (void);
|
||||
void Att_RemoveAttEventFromDB (long AttCod);
|
||||
|
||||
void Att_HideAttEvent (void);
|
||||
void Att_ShowAttEvent (void);
|
||||
void Att_RecFormAttEvent (void);
|
||||
|
@ -95,11 +98,14 @@ void Att_CreateAttEvent (struct AttendanceEvent *Att,const char *Txt);
|
|||
void Att_UpdateAttEvent (struct AttendanceEvent *Att,const char *Txt);
|
||||
bool Att_CheckIfAttEventIsAssociatedToGrps (long AttCod);
|
||||
bool Att_CheckIfAttEventIsAssociatedToGrp (long AsgCod,long GrpCod);
|
||||
void Att_RemoveGroupsOfType (long GrpTypCod);
|
||||
void Att_RemoveGroup (long GrpCod);
|
||||
|
||||
void Att_RemoveUsrFromAllAttEvents (long UsrCod);
|
||||
void Att_RemoveUsrFromCrsAttEvents (long UsrCod,long CrsCod);
|
||||
void Att_RemoveGroup (long GrpCod);
|
||||
void Att_RemoveGroupsOfType (long GrpTypCod);
|
||||
|
||||
void Att_RemoveCrsAttEvents (long CrsCod);
|
||||
|
||||
unsigned Att_GetNumAttEventsInCrs(long CrsCod);
|
||||
|
||||
unsigned Att_GetNumCoursesWithAttEvents (Sco_Scope_t Scope);
|
||||
|
|
|
@ -135,13 +135,14 @@
|
|||
/****************************** Public constants *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.247.2 (2016-07-30)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 15.248 (2016-09-06)"
|
||||
#define CSS_FILE "swad15.229.css"
|
||||
#define JS_FILE "swad15.238.1.js"
|
||||
|
||||
// Number of lines (includes comments but not blank lines) has been got with the following command:
|
||||
// nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*.h sql/swad*.sql | tail -1
|
||||
/*
|
||||
Version 15.248: Sep 06, 2016 New web service function removeAttendanceEvent. (204186 lines)
|
||||
Version 15.247.2: Jul 30, 2016 Fixed bug in listings of users, reported by José Abraham Mora Sánchez. (204104 lines)
|
||||
Version 15.247.1: Jul 27, 2016 In listings of users ready for printing, show institution name instead of logo. (204102 lines)
|
||||
Version 15.247: Jul 26, 2016 In listings of users, show institution logo with link to institution. (204093 lines)
|
||||
|
|
|
@ -2364,6 +2364,73 @@ int swad__sendAttendanceEvent (struct soap *soap,
|
|||
return SOAP_OK;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************ Remove an attendance event *************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
int swad__removeAttendanceEvent (struct soap *soap,
|
||||
char *wsKey,int attendanceEventCode, // input
|
||||
struct swad__sendAttendanceEventOutput *sendAttendanceEventOut) // output
|
||||
{
|
||||
int ReturnCode;
|
||||
struct AttendanceEvent Att;
|
||||
|
||||
/***** Initializations *****/
|
||||
Gbl.soap = soap;
|
||||
Gbl.WebService.Function = Svc_sendAttendanceEvent;
|
||||
sendAttendanceEventOut->attendanceEventCode = 0;
|
||||
|
||||
/***** Check web service key *****/
|
||||
if ((ReturnCode = Svc_CheckWSKey (wsKey)) != SOAP_OK)
|
||||
return ReturnCode;
|
||||
if (Gbl.Usrs.Me.UsrDat.UsrCod < 0) // Web service key does not exist in database
|
||||
return soap_receiver_fault (Gbl.soap,
|
||||
"Bad web service key",
|
||||
"Web service key does not exist in database");
|
||||
|
||||
/**** Get data of attendance event *****/
|
||||
/* Event code */
|
||||
Att.AttCod = (long) attendanceEventCode;
|
||||
|
||||
/* Course code */
|
||||
if (Att.AttCod > 0) // The event already exists
|
||||
{
|
||||
Att_GetDataOfAttEventByCod (&Att);
|
||||
Gbl.CurrentCrs.Crs.CrsCod = Att.CrsCod;
|
||||
}
|
||||
else
|
||||
return soap_receiver_fault (Gbl.soap,
|
||||
"Request forbidden",
|
||||
"Attendance event does not exist");
|
||||
|
||||
/***** Check if course code is correct *****/
|
||||
if (Gbl.CurrentCrs.Crs.CrsCod <= 0)
|
||||
return soap_sender_fault (Gbl.soap,
|
||||
"Bad course code",
|
||||
"Course code must be a integer greater than 0");
|
||||
|
||||
/***** Get some of my data *****/
|
||||
if (!Svc_GetSomeUsrDataFromUsrCod (&Gbl.Usrs.Me.UsrDat,Gbl.CurrentCrs.Crs.CrsCod))
|
||||
return soap_receiver_fault (Gbl.soap,
|
||||
"Can not get user's data from database",
|
||||
"User does not exist in database");
|
||||
Gbl.Usrs.Me.Logged = true;
|
||||
Gbl.Usrs.Me.LoggedRole = Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB;
|
||||
|
||||
/***** Check if I am a teacher in the course *****/
|
||||
if (Gbl.Usrs.Me.UsrDat.RoleInCurrentCrsDB != Rol_TEACHER)
|
||||
return soap_receiver_fault (Gbl.soap,
|
||||
"Request forbidden",
|
||||
"Requester must be a teacher");
|
||||
|
||||
/***** Remove the attendance event from database *****/
|
||||
Att_RemoveAttEventFromDB (Att.AttCod);
|
||||
|
||||
sendAttendanceEventOut->attendanceEventCode = Att.AttCod;
|
||||
|
||||
return SOAP_OK;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************** Create a list of groups selected *********************/
|
||||
/*****************************************************************************/
|
||||
|
|
Loading…
Reference in New Issue