2014-12-01 23:55:08 +01:00
|
|
|
|
// swad_survey.h: surveys
|
|
|
|
|
|
|
|
|
|
#ifndef _SWAD_SVY
|
|
|
|
|
#define _SWAD_SVY
|
|
|
|
|
/*
|
|
|
|
|
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.
|
2017-01-13 01:51:23 +01:00
|
|
|
|
Copyright (C) 1999-2017 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
|
|
|
|
|
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_date.h"
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************** Public types and constants ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-03-08 14:12:33 +01:00
|
|
|
|
#define Svy_MAX_CHARS_SURVEY_TITLE (128 - 1) // 127
|
|
|
|
|
#define Svy_MAX_BYTES_SURVEY_TITLE ((Svy_MAX_CHARS_SURVEY_TITLE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
#define Svy_NUM_DATES 2
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
Svy_START_TIME = 0,
|
|
|
|
|
Svy_END_TIME = 1,
|
|
|
|
|
} Svy_StartOrEndTime_t;
|
|
|
|
|
|
|
|
|
|
struct Survey
|
|
|
|
|
{
|
|
|
|
|
long SvyCod;
|
2016-10-26 01:23:02 +02:00
|
|
|
|
Sco_Scope_t Scope;
|
2016-10-27 01:30:14 +02:00
|
|
|
|
long Cod; // Country, institution, centre, degree or course code
|
2014-12-01 23:55:08 +01:00
|
|
|
|
unsigned Roles; // Example: if survey can be made by students and teachers, Roles == (1 << Rol_ROLE_STUDENT) | (1 << Rol_ROLE_TEACHER)
|
|
|
|
|
long UsrCod;
|
2017-03-08 03:48:23 +01:00
|
|
|
|
char Title[Svy_MAX_BYTES_SURVEY_TITLE + 1];
|
2016-10-26 01:23:02 +02:00
|
|
|
|
time_t TimeUTC[Svy_NUM_DATES];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
unsigned NumQsts; // Number of questions in the survey
|
|
|
|
|
unsigned NumUsrs; // Number of distinct users who have already answered the survey
|
|
|
|
|
struct
|
|
|
|
|
{
|
|
|
|
|
bool Visible; // Survey is not hidden
|
|
|
|
|
bool Open; // Start date <= now <= end date
|
|
|
|
|
bool IAmLoggedWithAValidRoleToAnswer; // I am logged with a valid role to answer this survey
|
2016-10-27 01:30:14 +02:00
|
|
|
|
bool IBelongToScope; // I belong to the scope of this survey
|
2014-12-01 23:55:08 +01:00
|
|
|
|
bool IHaveAnswered; // I have already answered this survey
|
|
|
|
|
bool ICanAnswer;
|
|
|
|
|
bool ICanViewResults;
|
|
|
|
|
bool ICanEdit;
|
|
|
|
|
} Status;
|
|
|
|
|
};
|
|
|
|
|
|
2016-10-26 01:23:02 +02:00
|
|
|
|
#define Svy_NUM_ORDERS 2
|
2014-12-01 23:55:08 +01:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
Svy_ORDER_BY_START_DATE = 0,
|
|
|
|
|
Svy_ORDER_BY_END_DATE = 1,
|
2017-01-29 12:42:19 +01:00
|
|
|
|
} Svy_Order_t;
|
2017-01-29 21:41:08 +01:00
|
|
|
|
#define Svy_ORDER_DEFAULT Svy_ORDER_BY_START_DATE
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
#define Svy_NUM_ANS_TYPES 2
|
2017-01-29 21:41:08 +01:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
Svy_ANS_UNIQUE_CHOICE = 0,
|
|
|
|
|
Svy_ANS_MULTIPLE_CHOICE = 1,
|
|
|
|
|
} Svy_AnswerType_t;
|
|
|
|
|
#define Svy_ANSWER_TYPE_DEFAULT Svy_ANS_UNIQUE_CHOICE
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Public prototypes *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Svy_SeeAllSurveys (void);
|
|
|
|
|
void Svy_SeeOneSurvey (void);
|
2017-01-29 12:42:19 +01:00
|
|
|
|
void Svy_PutHiddenParamSvyOrder (void);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Svy_RequestCreatOrEditSvy (void);
|
|
|
|
|
void Svy_GetListSurveys (void);
|
|
|
|
|
void Svy_GetDataOfSurveyByCod (struct Survey *Svy);
|
|
|
|
|
void Svy_GetDataOfSurveyByFolder (struct Survey *Svy);
|
|
|
|
|
void Svy_FreeListSurveys (void);
|
2017-03-08 14:12:33 +01:00
|
|
|
|
void Svy_GetNotifSurvey (char SummaryStr[Ntf_MAX_BYTES_SUMMARY + 1],
|
2017-03-06 13:01:16 +01:00
|
|
|
|
char **ContentStr,
|
|
|
|
|
long SvyCod,bool GetContent);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Svy_AskRemSurvey (void);
|
|
|
|
|
void Svy_RemoveSurvey (void);
|
|
|
|
|
void Svy_AskResetSurvey (void);
|
|
|
|
|
void Svy_ResetSurvey (void);
|
|
|
|
|
void Svy_HideSurvey (void);
|
|
|
|
|
void Svy_UnhideSurvey (void);
|
|
|
|
|
void Svy_RecFormSurvey (void);
|
|
|
|
|
bool Svy_CheckIfSvyIsAssociatedToGrp (long SvyCod,long GrpCod);
|
|
|
|
|
void Svy_RemoveGroup (long GrpCod);
|
|
|
|
|
void Svy_RemoveGroupsOfType (long GrpTypCod);
|
2016-10-27 22:26:52 +02:00
|
|
|
|
void Svy_RemoveSurveys (Sco_Scope_t Scope,long Cod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
void Svy_RequestEditQuestion (void);
|
|
|
|
|
void Svy_ReceiveQst (void);
|
2016-04-05 10:47:36 +02:00
|
|
|
|
|
|
|
|
|
void Svy_RequestRemoveQst (void);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Svy_RemoveQst (void);
|
|
|
|
|
|
|
|
|
|
void Svy_ReceiveSurveyAnswers (void);
|
|
|
|
|
|
2016-10-27 15:06:11 +02:00
|
|
|
|
unsigned Svy_GetNumCoursesWithCrsSurveys (Sco_Scope_t Scope);
|
|
|
|
|
unsigned Svy_GetNumCrsSurveys (Sco_Scope_t Scope,unsigned *NumNotif);
|
|
|
|
|
float Svy_GetNumQstsPerCrsSurvey (Sco_Scope_t Scope);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
#endif
|