2020-04-20 01:26:46 +02:00
|
|
|
|
// swad_exam.h: exams
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
#ifndef _SWAD_EXA
|
|
|
|
|
#define _SWAD_EXA
|
|
|
|
|
/*
|
2020-04-20 01:26:46 +02:00
|
|
|
|
SWAD (Shared Workspace At a Distance),
|
2014-12-01 23:55:08 +01:00
|
|
|
|
is a web platform developed at the University of Granada (Spain),
|
|
|
|
|
and used to support university teaching.
|
|
|
|
|
|
|
|
|
|
This file is part of SWAD core.
|
2020-01-01 14:53:57 +01:00
|
|
|
|
Copyright (C) 1999-2020 Antonio Ca<EFBFBD>as Vargas
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
2020-04-20 01:26:46 +02:00
|
|
|
|
it under the terms of the GNU Affero General 3 License as
|
2014-12-01 23:55:08 +01:00
|
|
|
|
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/>.
|
|
|
|
|
*/
|
2020-04-20 01:26:46 +02:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************************* Headers ***********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-12-12 02:21:41 +01:00
|
|
|
|
#include "swad_date.h"
|
2020-04-20 01:26:46 +02:00
|
|
|
|
#include "swad_scope.h"
|
2016-12-12 02:21:41 +01:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************** Public types and constants ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-20 01:26:46 +02:00
|
|
|
|
#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
|
|
|
|
|
|
2020-04-25 01:36:53 +02:00
|
|
|
|
#define ExaSet_MAX_CHARS_TITLE (128 - 1) // 127
|
|
|
|
|
#define ExaSet_MAX_BYTES_TITLE ((ExaSet_MAX_CHARS_TITLE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
|
|
|
|
|
2020-04-20 01:26:46 +02:00
|
|
|
|
#define Exa_NUM_ORDERS 3
|
2014-12-01 23:55:08 +01:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
2020-04-20 01:26:46 +02:00
|
|
|
|
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
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2020-04-20 01:26:46 +02:00
|
|
|
|
#define Exa_NUM_ANS_TYPES 2
|
2014-12-01 23:55:08 +01:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
2020-04-20 01:26:46 +02:00
|
|
|
|
Exa_ANS_UNIQUE_CHOICE = 0,
|
|
|
|
|
Exa_ANS_MULTIPLE_CHOICE = 1,
|
|
|
|
|
} Exa_AnswerType_t;
|
|
|
|
|
#define Exa_ANSWER_TYPE_DEFAULT Exa_ANS_UNIQUE_CHOICE
|
2017-03-08 14:12:33 +01:00
|
|
|
|
|
2020-04-20 01:26:46 +02:00
|
|
|
|
struct Exa_ExamSelected
|
2016-12-12 02:21:41 +01:00
|
|
|
|
{
|
2020-04-20 01:26:46 +02:00
|
|
|
|
long ExaCod; // Exam code
|
|
|
|
|
bool Selected; // Is this exam selected when seeing match results?
|
2016-12-12 02:21:41 +01:00
|
|
|
|
};
|
|
|
|
|
|
2020-04-25 01:36:53 +02:00
|
|
|
|
/* Exams context */
|
2020-04-20 01:26:46 +02:00
|
|
|
|
struct Exa_Exams
|
2019-03-25 19:05:10 +01:00
|
|
|
|
{
|
2020-04-20 01:26:46 +02:00
|
|
|
|
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
|
2020-04-25 01:36:53 +02:00
|
|
|
|
long SetCod; // Selected/current set code
|
2020-04-20 01:26:46 +02:00
|
|
|
|
long EvtCod; // Selected/current match code
|
2020-04-24 02:49:51 +02:00
|
|
|
|
unsigned SetInd; // Current set index
|
2020-04-27 19:37:49 +02:00
|
|
|
|
long QstCod; // Current question code
|
2019-03-25 19:05:10 +01:00
|
|
|
|
};
|
|
|
|
|
|
2020-04-20 01:26:46 +02:00
|
|
|
|
struct Exa_Exam
|
2020-04-12 20:08:37 +02:00
|
|
|
|
{
|
2020-04-20 01:26:46 +02:00
|
|
|
|
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
|
2020-04-26 03:07:55 +02:00
|
|
|
|
unsigned NumSets; // Number of sets in the exam
|
2020-04-20 01:26:46 +02:00
|
|
|
|
unsigned NumQsts; // Number of questions in the exam
|
2020-04-22 03:15:04 +02:00
|
|
|
|
unsigned NumEvts; // Number of events in the exam
|
|
|
|
|
unsigned NumUnfinishedEvts; // Number of unfinished events in the exam
|
2020-04-12 20:08:37 +02:00
|
|
|
|
};
|
|
|
|
|
|
2020-04-25 01:36:53 +02:00
|
|
|
|
struct ExaSet_Set
|
2020-04-24 02:49:51 +02:00
|
|
|
|
{
|
2020-04-25 01:36:53 +02:00
|
|
|
|
long ExaCod; // Exam code
|
|
|
|
|
long SetCod; // Set code
|
|
|
|
|
unsigned SetInd; // Set index (position in the exam)
|
|
|
|
|
unsigned NumQstsToExam; // Number of questions in this set taht will appear in the exam
|
|
|
|
|
char Title[ExaSet_MAX_BYTES_TITLE + 1]; // Title of the set
|
2020-04-24 02:49:51 +02:00
|
|
|
|
};
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Public prototypes *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-20 01:26:46 +02:00
|
|
|
|
void Exa_ResetExams (struct Exa_Exams *Exams);
|
2020-04-23 23:09:28 +02:00
|
|
|
|
void Exa_ResetExam (struct Exa_Exam *Exam);
|
2020-04-20 01:26:46 +02:00
|
|
|
|
|
|
|
|
|
void Exa_SeeAllExams (void);
|
|
|
|
|
void Exa_SeeOneExam (void);
|
|
|
|
|
void Exa_ShowOnlyOneExam (struct Exa_Exams *Exams,
|
|
|
|
|
struct Exa_Exam *Exam,
|
|
|
|
|
bool PutFormNewMatch);
|
|
|
|
|
void Exa_ShowOnlyOneExamBegin (struct Exa_Exams *Exams,
|
|
|
|
|
struct Exa_Exam *Exam,
|
|
|
|
|
bool PutFormNewMatch);
|
|
|
|
|
void Exa_ShowOnlyOneExamEnd (void);
|
|
|
|
|
|
|
|
|
|
void Exa_SetCurrentExaCod (long ExaCod);
|
2020-04-27 14:20:21 +02:00
|
|
|
|
void ExaSet_PutParamsOneSet (void *Exams);
|
2020-04-20 01:26:46 +02:00
|
|
|
|
void Exa_PutParams (void *Exams);
|
|
|
|
|
void Exa_PutParamExamCod (long ExaCod);
|
|
|
|
|
long Exa_GetParamExamCod (void);
|
2020-04-25 01:36:53 +02:00
|
|
|
|
long ExaSet_GetParamSetCod (void);
|
|
|
|
|
void Exa_GetParams (struct Exa_Exams *Exams);
|
2020-04-20 01:26:46 +02:00
|
|
|
|
|
|
|
|
|
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_AskRemExam (void);
|
|
|
|
|
void Exa_RemoveExam (void);
|
|
|
|
|
void Exa_RemoveExamsCrs (long CrsCod);
|
|
|
|
|
|
|
|
|
|
void Exa_HideExam (void);
|
|
|
|
|
void Exa_UnhideExam (void);
|
|
|
|
|
|
|
|
|
|
void Exa_RequestCreatOrEditExam (void);
|
|
|
|
|
|
2020-04-25 01:36:53 +02:00
|
|
|
|
void ExaSet_RecFormSet (void);
|
2020-04-27 02:09:56 +02:00
|
|
|
|
void ExaSet_ChangeSetTitle (void);
|
2020-04-27 03:16:55 +02:00
|
|
|
|
void ExaSet_ChangeNumQstsToExam (void);
|
2020-04-27 02:09:56 +02:00
|
|
|
|
|
2020-04-20 01:26:46 +02:00
|
|
|
|
void Exa_RecFormExam (void);
|
|
|
|
|
bool Mch_CheckIfMatchIsAssociatedToGrp (long EvtCod,long GrpCod);
|
|
|
|
|
|
2020-04-26 03:07:55 +02:00
|
|
|
|
unsigned ExaSet_GetNumSetsExam (long ExaCod);
|
|
|
|
|
unsigned ExaSet_GetNumQstsExam (long ExaCod);
|
2020-04-24 02:49:51 +02:00
|
|
|
|
|
2020-04-25 01:36:53 +02:00
|
|
|
|
void ExaSet_RequestCreatOrEditSet (void);
|
2020-04-27 14:20:21 +02:00
|
|
|
|
void ExaSet_ReqSelectQstsToAddToSet (void);
|
|
|
|
|
void ExaSet_ListQstsToAddToSet (void);
|
2020-04-20 01:26:46 +02:00
|
|
|
|
|
|
|
|
|
void Exa_PutParamQstInd (unsigned QstInd);
|
|
|
|
|
unsigned Exa_GetParamQstInd (void);
|
|
|
|
|
long Exa_GetQstCodFromQstInd (long ExaCod,unsigned QstInd);
|
2020-04-26 11:56:52 +02:00
|
|
|
|
|
2020-04-20 01:26:46 +02:00
|
|
|
|
unsigned Exa_GetPrevQuestionIndexInExam (long ExaCod,unsigned QstInd);
|
|
|
|
|
unsigned Exa_GetNextQuestionIndexInExam (long ExaCod,unsigned QstInd);
|
|
|
|
|
|
2020-04-27 14:20:21 +02:00
|
|
|
|
void ExaSet_AddQstsToSet (void);
|
2020-04-24 02:49:51 +02:00
|
|
|
|
|
2020-04-25 01:36:53 +02:00
|
|
|
|
void ExaSet_RequestRemoveSet (void);
|
|
|
|
|
void ExaSet_RemoveSet (void);
|
2020-04-24 02:49:51 +02:00
|
|
|
|
|
2020-04-25 01:36:53 +02:00
|
|
|
|
void ExaSet_MoveUpSet (void);
|
|
|
|
|
void ExaSet_MoveDownSet (void);
|
2020-04-20 01:26:46 +02:00
|
|
|
|
|
2020-04-27 19:37:49 +02:00
|
|
|
|
void ExaSet_RequestRemoveQstFromSet (void);
|
|
|
|
|
void ExaSet_RemoveQstFromSet (void);
|
2020-04-12 20:08:37 +02:00
|
|
|
|
|
2020-04-20 01:26:46 +02:00
|
|
|
|
unsigned Exa_GetNumCoursesWithExams (Hie_Level_t Scope);
|
|
|
|
|
unsigned Exa_GetNumExams (Hie_Level_t Scope);
|
|
|
|
|
double Exa_GetNumQstsPerCrsExam (Hie_Level_t Scope);
|
2016-06-01 19:34:44 +02:00
|
|
|
|
|
2020-04-20 01:26:46 +02:00
|
|
|
|
void Exa_ShowTstTagsPresentInAnExam (long ExaCod);
|
2019-03-25 19:05:10 +01:00
|
|
|
|
|
2020-04-20 01:26:46 +02:00
|
|
|
|
void Exa_GetScoreRange (long ExaCod,double *MinScore,double *MaxScore);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
#endif
|