Version19.191

This commit is contained in:
acanas 2020-04-20 01:26:46 +02:00
parent f3ef48b818
commit 78b655d1b9
22 changed files with 10500 additions and 1693 deletions

View File

@ -35,7 +35,7 @@ OBJS = swad_account.o swad_action.o swad_agenda.o swad_alert.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 \
swad_enrolment.o swad_exam.o \
swad_enrolment.o swad_exam_announcement.o \
swad_figure.o swad_file.o swad_file_browser.o swad_file_extension.o \
swad_file_MIME.o swad_firewall.o swad_follow.o swad_form.o \
swad_forum.o \

View File

@ -31,7 +31,7 @@
#include "swad_changelog.h"
#include "swad_database.h"
#include "swad_exam.h"
#include "swad_exam_announcement.h"
#include "swad_global.h"
#include "swad_notice.h"
#include "swad_RSS.h"
@ -264,7 +264,7 @@ static void RSS_WriteExamAnnouncements (FILE *FileRSS,struct Course *Crs)
" WHERE CrsCod=%ld AND Status=%u AND ExamDate>=NOW()"
" ORDER BY T",
Gbl.Hierarchy.Crs.CrsCod,
(unsigned) Exa_VISIBLE_EXAM_ANNOUNCEMENT);
(unsigned) ExaAnn_VISIBLE_EXAM_ANNOUNCEMENT);
/***** Write items with notices *****/
if (NumExamAnnouncements)

View File

@ -46,7 +46,7 @@
#include "swad_degree_type.h"
#include "swad_department.h"
#include "swad_duplicate.h"
#include "swad_exam.h"
#include "swad_exam_announcement.h"
#include "swad_enrolment.h"
#include "swad_figure.h"
#include "swad_follow.h"
@ -545,7 +545,7 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
[ActReqTst ] = { 103, 3,TabAss,ActReqTst ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Tst_RequestTest ,"check" },
[ActSeeAllGam ] = {1649, 4,TabAss,ActSeeAllGam ,0x238,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_SeeAllGames ,"gamepad" },
[ActSeeAllSvy ] = { 966, 5,TabAss,ActSeeAllSvy ,0x3F8,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Svy_SeeAllSurveys ,"poll" },
[ActSeeAllExaAnn ] = { 85, 6,TabAss,ActSeeAllExaAnn ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_ListExamAnnouncementsSee ,"bullhorn" },
[ActSeeAllExaAnn ] = { 85, 6,TabAss,ActSeeAllExaAnn ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaAnn_ListExamAnnouncementsSee ,"bullhorn" },
// Actions not in menu:
[ActEdiAss ] = { 69,-1,TabUnk,ActSeeAss ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Inf_FormsToSelSendInfo ,NULL},
@ -738,15 +738,15 @@ const struct Act_Actions Act_Actions[Act_NUM_ACTIONS] =
[ActReqRemSvyQst ] = {1524,-1,TabUnk,ActSeeAllSvy ,0x3E0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Svy_RequestRemoveQst ,NULL},
[ActRemSvyQst ] = { 981,-1,TabUnk,ActSeeAllSvy ,0x3E0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Svy_RemoveQst ,NULL},
[ActSeeOneExaAnn ] = {1572,-1,TabUnk,ActSeeAllExaAnn ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_ListExamAnnouncementsCod ,NULL},
[ActSeeDatExaAnn ] = {1571,-1,TabUnk,ActSeeAllExaAnn ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_ListExamAnnouncementsDay ,NULL},
[ActEdiExaAnn ] = { 91,-1,TabUnk,ActSeeAllExaAnn ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_PutFrmEditAExamAnnouncement,NULL},
[ActRcvExaAnn ] = { 110,-1,TabUnk,ActSeeAllExaAnn ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Exa_ReceiveExamAnnouncement1 ,Exa_ReceiveExamAnnouncement2 ,NULL},
[ActPrnExaAnn ] = { 179,-1,TabUnk,ActSeeAllExaAnn ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,Exa_PrintExamAnnouncement ,NULL},
[ActReqRemExaAnn ] = {1619,-1,TabUnk,ActSeeAllExaAnn ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Exa_ReqRemoveExamAnnouncement ,NULL},
[ActRemExaAnn ] = { 187,-1,TabUnk,ActSeeAllExaAnn ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Exa_RemoveExamAnnouncement1 ,Exa_RemoveExamAnnouncement2 ,NULL},
[ActHidExaAnn ] = {1620,-1,TabUnk,ActSeeAllExaAnn ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Exa_HideExamAnnouncement ,Exa_ListExamAnnouncementsEdit ,NULL},
[ActShoExaAnn ] = {1621,-1,TabUnk,ActSeeAllExaAnn ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,Exa_UnhideExamAnnouncement ,Exa_ListExamAnnouncementsEdit ,NULL},
[ActSeeOneExaAnn ] = {1572,-1,TabUnk,ActSeeAllExaAnn ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaAnn_ListExamAnnouncementsCod ,NULL},
[ActSeeDatExaAnn ] = {1571,-1,TabUnk,ActSeeAllExaAnn ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaAnn_ListExamAnnouncementsDay ,NULL},
[ActEdiExaAnn ] = { 91,-1,TabUnk,ActSeeAllExaAnn ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaAnn_PutFrmEditAExamAnnouncement,NULL},
[ActRcvExaAnn ] = { 110,-1,TabUnk,ActSeeAllExaAnn ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,ExaAnn_ReceiveExamAnnouncement1 ,ExaAnn_ReceiveExamAnnouncement2 ,NULL},
[ActPrnExaAnn ] = { 179,-1,TabUnk,ActSeeAllExaAnn ,0x3F8,0x3C7, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,ExaAnn_PrintExamAnnouncement ,NULL},
[ActReqRemExaAnn ] = {1619,-1,TabUnk,ActSeeAllExaAnn ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,ExaAnn_ReqRemoveExamAnnouncement ,NULL},
[ActRemExaAnn ] = { 187,-1,TabUnk,ActSeeAllExaAnn ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,ExaAnn_RemoveExamAnnouncement1 ,ExaAnn_RemoveExamAnnouncement2 ,NULL},
[ActHidExaAnn ] = {1620,-1,TabUnk,ActSeeAllExaAnn ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,ExaAnn_HideExamAnnouncement ,ExaAnn_ListExamAnnouncementsEdit ,NULL},
[ActShoExaAnn ] = {1621,-1,TabUnk,ActSeeAllExaAnn ,0x220,0x200, 0, 0, 0, 0, 0,Act_CONT_NORM,Act_BRW_1ST_TAB,ExaAnn_UnhideExamAnnouncement ,ExaAnn_ListExamAnnouncementsEdit ,NULL},
// TabFil ******************************************************************
// Actions in menu:

View File

@ -30,7 +30,7 @@
#include "swad_box.h"
#include "swad_calendar.h"
#include "swad_database.h"
#include "swad_exam.h"
#include "swad_exam_announcement.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_global.h"

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.190.5 (2020-04-19)"
#define Log_PLATFORM_VERSION "SWAD 19.191 (2020-04-20)"
#define CSS_FILE "swad19.190.css"
#define JS_FILE "swad19.172.1.js"
/*
@ -550,7 +550,10 @@ 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
// TODO: Cambiar icono notificaciones nuevas con "bell-on.svg"
// TODO: Ahmed El Moukhtari Koubaa: Cuando le damos a la opción de mostrar solo los mensajes no leídos, se muestran estos mensajes, pero cuando los intentamos leer, es decir, hacemos clic sobre ellos se recarga toda la página por así decirlo y vuelve a dar una lista con los mensajes, pero descartando aquel que clicamos porque, entiendo yo al menos, que ya lo ha marcado como leído.
Version 19.191: Apr 20, 2020 Module swad_exam for exam announcements is renamed as swad_exam_announcement.
New modules swad_exam, swad_exam_event and swad_exam_result to make exams. (295885 lines)
Version 19.190.5: Apr 19, 2020 Anchors in forms to edit buildings and rooms. (288527 lines)
Version 19.190.4: Apr 19, 2020 Icons for room types. (288516 lines)
Copy the following 23 icons to icon public directory:

View File

@ -28,9 +28,9 @@
/** Uncomment one of the following installations of SWAD or create your own **/
/*****************************************************************************/
#define LOCALHOST_UBUNTU // Comment this line if not applicable
//#define LOCALHOST_UBUNTU // Comment this line if not applicable
//#define OPENSWAD_ORG // Comment this line if not applicable
//#define SWAD_UGR_ES // Comment this line if not applicable
#define SWAD_UGR_ES // Comment this line if not applicable
//#define SWADBERRY_UGR_ES // Comment this line if not applicable
/*****************************************************************************/

View File

@ -35,7 +35,7 @@
#include "swad_course.h"
#include "swad_course_config.h"
#include "swad_database.h"
#include "swad_exam.h"
#include "swad_exam_announcement.h"
#include "swad_figure.h"
#include "swad_form.h"
#include "swad_forum.h"
@ -1835,7 +1835,7 @@ static void Crs_EmptyCourseCompletely (long CrsCod)
DB_QueryUPDATE ("can not remove exam announcements of a course",
"UPDATE exam_announcements SET Status=%u"
" WHERE CrsCod=%ld",
(unsigned) Exa_DELETED_EXAM_ANNOUNCEMENT,CrsCod);
(unsigned) ExaAnn_DELETED_EXAM_ANNOUNCEMENT,CrsCod);
/***** Remove course cards of the course *****/
/* Remove content of course cards */

View File

@ -1012,7 +1012,7 @@ mysql> DESCRIBE exam_announcements;
"NumNotif INT NOT NULL DEFAULT 0,"
"CrsFullName VARCHAR(2047) NOT NULL," // Hie_MAX_BYTES_FULL_NAME
"Year TINYINT NOT NULL,"
"ExamSession VARCHAR(2047) NOT NULL," // Exa_MAX_BYTES_SESSION
"ExamSession VARCHAR(2047) NOT NULL," // ExaAnn_MAX_BYTES_SESSION
"CallDate DATETIME NOT NULL,"
"ExamDate DATETIME NOT NULL,"
"Duration TIME NOT NULL,"

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
// swad_exam.h: exam announcements
// swad_exam.h: exams
#ifndef _SWAD_EXA
#define _SWAD_EXA
/*
SWAD (Shared Workspace At a Distance in Spanish),
SWAD (Shared Workspace At a Distance),
is a web platform developed at the University of Granada (Spain),
and used to support university teaching.
@ -11,7 +11,7 @@
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
it under the terms of the GNU Affero General 3 License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
@ -23,106 +23,147 @@
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 <stdbool.h> // For boolean type
#include "swad_constant.h"
#include "swad_course.h"
#include "swad_date.h"
#include "swad_notification.h"
#include "swad_scope.h"
/*****************************************************************************/
/************************** Public types and constants ***********************/
/*****************************************************************************/
#define Exa_NUM_VIEWS 3
#define Exa_MAX_CHARS_TITLE (128 - 1) // 127
#define Exa_MAX_BYTES_TITLE ((Exa_MAX_CHARS_TITLE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
#define Exa_NUM_ORDERS 3
typedef enum
{
Exa_NORMAL_VIEW,
Exa_PRINT_VIEW,
Exa_FORM_VIEW,
} Exa_TypeViewExamAnnouncement_t;
Exa_ORDER_BY_START_DATE = 0,
Exa_ORDER_BY_END_DATE = 1,
Exa_ORDER_BY_TITLE = 2,
} Exa_Order_t;
#define Exa_ORDER_DEFAULT Exa_ORDER_BY_START_DATE
#define Exa_NUM_STATUS 3
#define Exa_NUM_ANS_TYPES 2
typedef enum
{
Exa_VISIBLE_EXAM_ANNOUNCEMENT = 0,
Exa_HIDDEN_EXAM_ANNOUNCEMENT = 1,
Exa_DELETED_EXAM_ANNOUNCEMENT = 2,
} Exa_ExamAnnouncementStatus_t; // Don't change these numbers because they are used in database
Exa_ANS_UNIQUE_CHOICE = 0,
Exa_ANS_MULTIPLE_CHOICE = 1,
} Exa_AnswerType_t;
#define Exa_ANSWER_TYPE_DEFAULT Exa_ANS_UNIQUE_CHOICE
#define Exa_MAX_CHARS_SESSION (128 - 1) // 127
#define Exa_MAX_BYTES_SESSION ((Exa_MAX_CHARS_SESSION + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
struct Exa_ExamAnnouncement
struct Exa_ExamSelected
{
long CrsCod;
Exa_ExamAnnouncementStatus_t Status;
char CrsFullName[Hie_MAX_BYTES_FULL_NAME + 1];
unsigned Year; // Number of year (0 (N.A.), 1, 2, 3, 4, 5, 6) in the degree
char Session[Exa_MAX_BYTES_SESSION + 1]; // Exam session is june, september, etc.
struct Date CallDate;
struct Date ExamDate;
struct Hour StartTime;
struct Hour Duration;
char *Place;
char *Mode;
char *Structure;
char *DocRequired;
char *MatRequired;
char *MatAllowed;
char *OtherInfo;
long ExaCod; // Exam code
bool Selected; // Is this exam selected when seeing match results?
};
struct Exa_ExamCodeAndDate
struct Exa_Exams
{
long ExaCod;
struct Date ExamDate;
bool LstIsRead; // Is the list already read from database...
// ...or it needs to be read?
unsigned Num; // Total number of exams
unsigned NumSelected; // Number of exams selected
struct Exa_ExamSelected *Lst;// List of exams
Exa_Order_t SelectedOrder;
unsigned CurrentPage;
char *ListQuestions;
char *ExaCodsSelected; // String with selected exam codes separated by separator multiple
long ExaCod; // Selected/current exam code
long EvtCod; // Selected/current match code
unsigned QstInd; // Current question index
};
struct Exa_ExamAnnouncements
struct Exa_Exam
{
unsigned NumExaAnns; // Number of announcements of exam in the list
struct Exa_ExamCodeAndDate *Lst; // List of exam announcements
long NewExaCod; // New exam announcement just created
long HighlightExaCod; // Exam announcement to be highlighted
char HighlightDate[4 + 2 + 2 + 1]; // Date with exam announcements to be highlighted (in YYYYMMDD format)
long ExaCod; // Used to put contextual icons
const char *Anchor; // Used to put contextual icons
struct Exa_ExamAnnouncement ExamAnn;
long ExaCod; // Exam code
long CrsCod; // Course code
long UsrCod; // Author code
double MaxGrade; // Score range [0...max.score]
// will be converted to
// grade range [0...max.grade]
unsigned Visibility; // Visibility of results
char Title[Exa_MAX_BYTES_TITLE + 1];
time_t TimeUTC[Dat_NUM_START_END_TIME];
bool Hidden; // Exam is hidden
unsigned NumQsts; // Number of questions in the exam
unsigned NumEves; // Number of events in the exam
unsigned NumUnfinishedEves; // Number of unfinished events in the exam
};
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
void Exa_ResetExamAnnouncements (struct Exa_ExamAnnouncements *ExamAnns);
void Exa_ResetExams (struct Exa_Exams *Exams);
void Exa_PutFrmEditAExamAnnouncement (void);
void Exa_ReceiveExamAnnouncement1 (void);
void Exa_ReceiveExamAnnouncement2 (void);
void Exa_PrintExamAnnouncement (void);
void Exa_ReqRemoveExamAnnouncement (void);
void Exa_RemoveExamAnnouncement1 (void);
void Exa_RemoveExamAnnouncement2 (void);
void Exa_HideExamAnnouncement (void);
void Exa_UnhideExamAnnouncement (void);
void Exa_SeeAllExams (void);
void Exa_SeeOneExam (void);
void Exa_ShowOnlyOneExam (struct Exa_Exams *Exams,
struct Exa_Exam *Exam,
bool ListExamQuestions,
bool PutFormNewMatch);
void Exa_ShowOnlyOneExamBegin (struct Exa_Exams *Exams,
struct Exa_Exam *Exam,
bool ListExamQuestions,
bool PutFormNewMatch);
void Exa_ShowOnlyOneExamEnd (void);
void Exa_FreeListExamAnnouncements (struct Exa_ExamAnnouncements *ExamAnns);
void Exa_ListExamAnnouncementsSee (void);
void Exa_ListExamAnnouncementsEdit (void);
void Exa_SetCurrentExaCod (long ExaCod);
void Exa_PutParams (void *Exams);
void Exa_PutParamExamCod (long ExaCod);
long Exa_GetParamExamCod (void);
long Exa_GetParams (struct Exa_Exams *Exams);
void Exa_ListExamAnnouncementsCod (void);
void Exa_ListExamAnnouncementsDay (void);
void Exa_GetListExams (struct Exa_Exams *Exams,Exa_Order_t SelectedOrder);
void Exa_GetListSelectedExaCods (struct Exa_Exams *Exams);
void Exa_GetDataOfExamByCod (struct Exa_Exam *Exam);
void Exa_GetDataOfExamByFolder (struct Exa_Exam *Exam);
void Exa_FreeListExams (struct Exa_Exams *Exams);
void Exa_CreateListExamAnnouncements (struct Exa_ExamAnnouncements *ExamAnns);
void Exa_PutHiddenParamExaCod (long ExaCod);
void Exa_AskRemExam (void);
void Exa_RemoveExam (void);
void Exa_RemoveExamsCrs (long CrsCod);
void Exa_GetSummaryAndContentExamAnnouncement (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
char **ContentStr,
long ExaCod,bool GetContent);
void Exa_HideExam (void);
void Exa_UnhideExam (void);
void Exa_RequestCreatOrEditExam (void);
void Exa_RecFormExam (void);
bool Mch_CheckIfMatchIsAssociatedToGrp (long EvtCod,long GrpCod);
unsigned Exa_GetNumQstsExam (long ExaCod);
void Exa_RequestNewQuestion (void);
void Exa_ListTstQuestionsToSelect (void);
void Exa_PutParamQstInd (unsigned QstInd);
unsigned Exa_GetParamQstInd (void);
long Exa_GetQstCodFromQstInd (long ExaCod,unsigned QstInd);
unsigned Exa_GetPrevQuestionIndexInExam (long ExaCod,unsigned QstInd);
unsigned Exa_GetNextQuestionIndexInExam (long ExaCod,unsigned QstInd);
void Exa_AddTstQuestionsToExam (void);
void Exa_RequestRemoveQst (void);
void Exa_RemoveQst (void);
void Exa_MoveUpQst (void);
void Exa_MoveDownQst (void);
void Exa_PutButtonNewMatch (struct Exa_Exams *Exams,long ExaCod);
void Exa_RequestNewMatch (void);
unsigned Exa_GetNumCoursesWithExams (Hie_Level_t Scope);
unsigned Exa_GetNumExams (Hie_Level_t Scope);
double Exa_GetNumQstsPerCrsExam (Hie_Level_t Scope);
void Exa_ShowTstTagsPresentInAnExam (long ExaCod);
void Exa_GetScoreRange (long ExaCod,double *MinScore,double *MaxScore);
#endif

1793
swad_exam_announcement.c Normal file

File diff suppressed because it is too large Load Diff

128
swad_exam_announcement.h Normal file
View File

@ -0,0 +1,128 @@
// swad_exam_announcement.h: exam announcements
#ifndef _SWAD_EXA_ANN
#define _SWAD_EXA_ANN
/*
SWAD (Shared Workspace At a Distance),
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 3 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 <stdbool.h> // For boolean type
#include "swad_constant.h"
#include "swad_course.h"
#include "swad_date.h"
#include "swad_notification.h"
/*****************************************************************************/
/************************** Public types and constants ***********************/
/*****************************************************************************/
#define ExaAnn_NUM_VIEWS 3
typedef enum
{
ExaAnn_NORMAL_VIEW,
ExaAnn_PRINT_VIEW,
ExaAnn_FORM_VIEW,
} ExaAnn_TypeViewExamAnnouncement_t;
#define ExaAnn_NUM_STATUS 3
typedef enum
{
ExaAnn_VISIBLE_EXAM_ANNOUNCEMENT = 0,
ExaAnn_HIDDEN_EXAM_ANNOUNCEMENT = 1,
ExaAnn_DELETED_EXAM_ANNOUNCEMENT = 2,
} ExaAnn_Status_t; // Don't change these numbers because they are used in database
#define ExaAnn_MAX_CHARS_SESSION (128 - 1) // 127
#define ExaAnn_MAX_BYTES_SESSION ((ExaAnn_MAX_CHARS_SESSION + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
struct ExaAnn_ExamAnnouncement
{
long CrsCod;
ExaAnn_Status_t Status;
char CrsFullName[Hie_MAX_BYTES_FULL_NAME + 1];
unsigned Year; // Number of year (0 (N.A.), 1, 2, 3, 4, 5, 6) in the degree
char Session[ExaAnn_MAX_BYTES_SESSION + 1]; // Exam session is june, september, etc.
struct Date CallDate;
struct Date ExamDate;
struct Hour StartTime;
struct Hour Duration;
char *Place;
char *Mode;
char *Structure;
char *DocRequired;
char *MatRequired;
char *MatAllowed;
char *OtherInfo;
};
struct ExaAnn_ExamCodeAndDate
{
long ExaCod;
struct Date ExamDate;
};
struct ExaAnn_ExamAnnouncements
{
unsigned NumExaAnns; // Number of announcements of exam in the list
struct ExaAnn_ExamCodeAndDate *Lst; // List of exam announcements
long NewExaCod; // New exam announcement just created
long HighlightExaCod; // Exam announcement to be highlighted
char HighlightDate[4 + 2 + 2 + 1]; // Date with exam announcements to be highlighted (in YYYYMMDD format)
long ExaCod; // Used to put contextual icons
const char *Anchor; // Used to put contextual icons
struct ExaAnn_ExamAnnouncement ExamAnn;
};
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
void ExaAnn_ResetExamAnnouncements (struct ExaAnn_ExamAnnouncements *ExamAnns);
void ExaAnn_PutFrmEditAExamAnnouncement (void);
void ExaAnn_ReceiveExamAnnouncement1 (void);
void ExaAnn_ReceiveExamAnnouncement2 (void);
void ExaAnn_PrintExamAnnouncement (void);
void ExaAnn_ReqRemoveExamAnnouncement (void);
void ExaAnn_RemoveExamAnnouncement1 (void);
void ExaAnn_RemoveExamAnnouncement2 (void);
void ExaAnn_HideExamAnnouncement (void);
void ExaAnn_UnhideExamAnnouncement (void);
void ExaAnn_FreeListExamAnnouncements (struct ExaAnn_ExamAnnouncements *ExamAnns);
void ExaAnn_ListExamAnnouncementsSee (void);
void ExaAnn_ListExamAnnouncementsEdit (void);
void ExaAnn_ListExamAnnouncementsCod (void);
void ExaAnn_ListExamAnnouncementsDay (void);
void ExaAnn_CreateListExamAnnouncements (struct ExaAnn_ExamAnnouncements *ExamAnns);
void ExaAnn_PutHiddenParamExaCod (long ExaCod);
void ExaAnn_GetSummaryAndContentExamAnnouncement (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
char **ContentStr,
long ExaCod,bool GetContent);
#endif

4069
swad_exam_event.c Normal file

File diff suppressed because it is too large Load Diff

149
swad_exam_event.h Normal file
View File

@ -0,0 +1,149 @@
// swad_exam_event.h: exam events (each ocurrence of an exam)
#ifndef _SWAD_EXA_EVE
#define _SWAD_EXA_EVE
/*
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_scope.h"
#include "swad_test.h"
/*****************************************************************************/
/************************** Public types and constants ***********************/
/*****************************************************************************/
#define ExaEvt_NEW_MATCH_SECTION_ID "new_match"
#define ExaEvt_AFTER_LAST_QUESTION ((unsigned)((1UL << 31) - 1)) // 2^31 - 1, don't change this number because it is used in database to indicate that a event is finished
#define ExaEvt_NUM_SHOWING 5
typedef enum
{
ExaEvt_START, // Start: don't show anything
ExaEvt_STEM, // Showing only the question stem
ExaEvt_ANSWERS, // Showing the question stem and the answers
ExaEvt_RESULTS, // Showing the results
ExaEvt_END, // End: don't show anything
} ExaEvt_Showing_t;
#define ExaEvt_SHOWING_DEFAULT ExaEvt_START
struct ExaEvt_Match
{
long EvtCod;
long ExaCod;
long UsrCod;
time_t TimeUTC[Dat_NUM_START_END_TIME];
char Title[Exa_MAX_BYTES_TITLE + 1];
struct
{
unsigned QstInd; // 0 means that the exam has not started. First question has index 1.
long QstCod;
time_t QstStartTimeUTC;
ExaEvt_Showing_t Showing; // What is shown on teacher's screen
long Countdown; // > 0 ==> countdown in progress
// = 0 ==> countdown over ==> go to next step
// < 0 ==> no countdown at this time
unsigned NumCols; // Number of columns for answers on teacher's screen
bool ShowQstResults; // Show global results of current question while playing
bool ShowUsrResults; // Show exam with results of all questions for the student
bool Playing; // Is being played now?
unsigned NumPlayers;
} Status; // Status related to event playing
};
struct ExaEvt_UsrAnswer
{
int NumOpt; // < 0 ==> no answer selected
int AnsInd; // < 0 ==> no answer selected
};
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
long ExaEvt_GetEvtCodBeingPlayed (void);
void ExaEvt_ListEvents (struct Exa_Exams *Exams,
struct Exa_Exam *Exam,
bool PutFormNewEvent);
void ExaEvt_GetDataOfEventByCod (struct ExaEvt_Match *Event);
void ExaEvt_ToggleVisibilResultsEvtUsr (void);
void ExaEvt_RequestRemoveEvent (void);
void ExaEvt_RemoveEvent (void);
void ExaEvt_RemoveEventsInExamFromAllTables (long ExaCod);
void ExaEvt_RemoveEventInCourseFromAllTables (long CrsCod);
void ExaEvt_RemoveUsrFromEventTablesInCrs (long UsrCod,long CrsCod);
void ExaEvt_PutParamsEdit (void *Exams);
void ExaEvt_GetAndCheckParameters (struct Exa_Exams *Exams,
struct Exa_Exam *Exam,
struct ExaEvt_Match *Event);
long ExaEvt_GetParamEvtCod (void);
void ExaEvt_CreateNewEventTch (void);
void ExaEvt_ResumeEvent (void);
void ExaEvt_GetIndexes (long EvtCod,unsigned QstInd,
unsigned Indexes[Tst_MAX_OPTIONS_PER_QUESTION]);
void ExaEvt_RemoveGroup (long GrpCod);
void ExaEvt_RemoveGroupsOfType (long GrpTypCod);
void ExaEvt_PlayPauseEvent (void);
void ExaEvt_ChangeNumColsEvt (void);
void ExaEvt_ToggleVisibilResultsEvtQst (void);
void ExaEvt_BackEvent (void);
void ExaEvt_ForwardEvent (void);
unsigned ExaEvt_GetNumEventsInExam (long ExaCod);
unsigned ExaEvt_GetNumUnfinishedEventsInExam (long ExaCod);
bool ExaEvt_CheckIfICanPlayThisEventBasedOnGrps (const struct ExaEvt_Match *Event);
void ExaEvt_WriteChoiceAnsViewEvent (const struct ExaEvt_Match *Event,
const struct Tst_Question *Question,
const char *Class,bool ShowResult);
bool ExaEvt_RegisterMeAsPlayerInEvent (struct ExaEvt_Match *Event);
void ExaEvt_GetEventBeingPlayed (void);
void ExaEvt_JoinEventAsStd (void);
void ExaEvt_RemoveMyQuestionAnswer (void);
void ExaEvt_StartCountdown (void);
void ExaEvt_RefreshEventTch (void);
void ExaEvt_RefreshEventStd (void);
void ExaEvt_GetQstAnsFromDB (long EvtCod,long UsrCod,unsigned QstInd,
struct ExaEvt_UsrAnswer *UsrAnswer);
void ExaEvt_ReceiveQuestionAnswer (void);
unsigned ExaEvt_GetNumUsrsWhoAnsweredQst (long EvtCod,unsigned QstInd);
unsigned ExaEvt_GetNumUsrsWhoHaveChosenAns (long EvtCod,unsigned QstInd,unsigned AnsInd);
void ExaEvt_DrawBarNumUsrs (unsigned NumRespondersAns,unsigned NumRespondersQst,bool Correct);
#endif

1457
swad_exam_result.c Normal file

File diff suppressed because it is too large Load Diff

56
swad_exam_result.h Normal file
View File

@ -0,0 +1,56 @@
// swad_exam_result.h: exams results
#ifndef _SWAD_EXA_RES
#define _SWAD_EXA_RES
/*
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_test_exam.h"
/*****************************************************************************/
/************************** Public types and constants ***********************/
/*****************************************************************************/
#define ExaRes_RESULTS_BOX_ID "exares_box"
#define ExaRes_RESULTS_TABLE_ID "exares_table"
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
void ExaRes_ShowMyExaResultsInCrs (void);
void ExaRes_ShowMyExaResultsInExa (void);
void ExaRes_ShowMyExaResultsInEve (void);
void ExaRes_ShowAllExaResultsInCrs (void);
void ExaRes_SelUsrsToViewExaResults (void);
void ExaRes_ShowAllExaResultsInExa (void);
void ExaRes_ShowAllExaResultsInEve (void);
void ExaRes_ShowOneExaResult (void);
void ExaRes_GetExamResultQuestionsFromDB (long EvtCod,long UsrCod,
struct TstExa_Exam *Exam);
#endif

View File

@ -119,8 +119,8 @@ long Gam_GetParams (struct Gam_Games *Games);
void Gam_GetListGames (struct Gam_Games *Games,Gam_Order_t SelectedOrder);
void Gam_GetListSelectedGamCods (struct Gam_Games *Games);
void Gam_GetDataOfGameByCod (struct Gam_Game *Gam);
void Gam_GetDataOfGameByFolder (struct Gam_Game *Gam);
void Gam_GetDataOfGameByCod (struct Gam_Game *Game);
void Gam_GetDataOfGameByFolder (struct Gam_Game *Game);
void Gam_FreeListGames (struct Gam_Games *Games);
void Gam_AskRemGame (void);

View File

@ -40,7 +40,7 @@
#include "swad_config.h"
#include "swad_constant.h"
#include "swad_department.h"
#include "swad_exam.h"
#include "swad_exam_announcement.h"
#include "swad_follow.h"
#include "swad_global.h"
#include "swad_icon.h"

View File

@ -38,7 +38,7 @@
#include "swad_config.h"
#include "swad_connected.h"
#include "swad_database.h"
#include "swad_exam.h"
#include "swad_exam_announcement.h"
#include "swad_firewall.h"
#include "swad_follow.h"
#include "swad_form.h"
@ -492,7 +492,7 @@ static void Lay_WriteScripts (void)
extern const char *Txt_DAYS_SMALL[7];
extern const char *Txt_Exam_of_X;
struct Hld_Holidays Holidays;
struct Exa_ExamAnnouncements ExamAnns;
struct ExaAnn_ExamAnnouncements ExamAnns;
unsigned DayOfWeek; /* 0, 1, 2, 3, 4, 5, 6 */
unsigned NumHld;
unsigned NumExamAnnouncement; // Number of exam announcement
@ -539,10 +539,10 @@ static void Lay_WriteScripts (void)
Hld_GetListHolidays (&Holidays);
/***** Reset exam announcements context *****/
Exa_ResetExamAnnouncements (&ExamAnns);
ExaAnn_ResetExamAnnouncements (&ExamAnns);
/***** Create list of exam announcements *****/
Exa_CreateListExamAnnouncements (&ExamAnns);
ExaAnn_CreateListExamAnnouncements (&ExamAnns);
/***** Write script to initialize variables used to draw months *****/
HTM_SCRIPT_Begin (NULL,NULL);
@ -587,7 +587,7 @@ static void Lay_WriteScripts (void)
HTM_SCRIPT_End ();
/***** Free list of exam announcements *****/
Exa_FreeListExamAnnouncements (&ExamAnns);
ExaAnn_FreeListExamAnnouncements (&ExamAnns);
/***** Free list of holidays *****/
Hld_FreeListHolidays (&Holidays);

View File

@ -2496,9 +2496,6 @@ static void Mch_PutFormCountdown (struct Mch_Match *Match,long Seconds,const cha
Frm_StartFormOnSubmit (ActUnk,OnSubmit);
}
else
{
}
/***** Put icon *****/
HTM_DIV_Begin ("class=\"MCH_SMALLBUTTON_CONT\"");

View File

@ -37,7 +37,7 @@
#include "swad_config.h"
#include "swad_database.h"
#include "swad_enrolment.h"
#include "swad_exam.h"
#include "swad_exam_announcement.h"
#include "swad_figure.h"
#include "swad_follow.h"
#include "swad_form.h"
@ -859,7 +859,7 @@ void Ntf_GetNotifSummaryAndContent (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
Asg_GetNotifAssignment (SummaryStr,ContentStr,Cod,GetContent);
break;
case Ntf_EVENT_EXAM_ANNOUNCEMENT:
Exa_GetSummaryAndContentExamAnnouncement (SummaryStr,ContentStr,Cod,GetContent);
ExaAnn_GetSummaryAndContentExamAnnouncement (SummaryStr,ContentStr,Cod,GetContent);
break;
case Ntf_EVENT_MARKS_FILE:
Mrk_GetNotifMyMarks (SummaryStr,ContentStr,Cod,UsrCod,GetContent);

View File

@ -36,7 +36,7 @@
#include "swad_box.h"
#include "swad_constant.h"
#include "swad_database.h"
#include "swad_exam.h"
#include "swad_exam_announcement.h"
#include "swad_figure.h"
#include "swad_follow.h"
#include "swad_form.h"
@ -2137,7 +2137,7 @@ static void TL_PutFormGoToAction (const struct TL_Note *SocNot,
Frm_StartFormUniqueAnchor (TL_DefaultActions[SocNot->NoteType],
Anchor); // Locate on this specific exam
Frm_FreeAnchorStr (Anchor);
Exa_PutHiddenParamExaCod (SocNot->Cod);
ExaAnn_PutHiddenParamExaCod (SocNot->Cod);
if (SocNot->HieCod != Gbl.Hierarchy.Crs.CrsCod) // Not the current course
Crs_PutParamCrsCod (SocNot->HieCod); // Go to another course
break;
@ -2209,7 +2209,7 @@ static void TL_GetNoteSummary (const struct TL_Note *SocNot,
Brw_GetSummaryAndContentOfFile (SummaryStr,NULL,SocNot->Cod,false);
break;
case TL_NOTE_EXAM_ANNOUNCEMENT:
Exa_GetSummaryAndContentExamAnnouncement (SummaryStr,NULL,SocNot->Cod,false);
ExaAnn_GetSummaryAndContentExamAnnouncement (SummaryStr,NULL,SocNot->Cod,false);
break;
case TL_NOTE_POST:
// Not applicable