2014-12-01 23:55:08 +01:00
|
|
|
|
// swad_statistic.h: statistics
|
|
|
|
|
|
|
|
|
|
#ifndef _SWAD_STA
|
|
|
|
|
#define _SWAD_STA
|
|
|
|
|
/*
|
|
|
|
|
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.
|
2016-01-01 20:19:43 +01:00
|
|
|
|
Copyright (C) 1999-2016 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_user.h"
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************** Public types and constants ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#define Sta_NUM_ROLES_STAT 11
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
Sta_IDENTIFIED_USRS = 0,
|
|
|
|
|
Sta_ALL_USRS = 1,
|
|
|
|
|
Sta_INS_ADMINS = 2,
|
|
|
|
|
Sta_CTR_ADMINS = 3,
|
|
|
|
|
Sta_DEG_ADMINS = 4,
|
|
|
|
|
Sta_TEACHERS = 5,
|
|
|
|
|
Sta_STUDENTS = 6,
|
|
|
|
|
Sta_VISITORS = 7,
|
2016-11-07 16:26:35 +01:00
|
|
|
|
Sta_GUESTS = 8,
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Sta_UNKNOWN_USRS = 9,
|
|
|
|
|
Sta_ME = 10,
|
|
|
|
|
} Sta_Role_t;
|
|
|
|
|
|
2015-09-25 01:48:00 +02:00
|
|
|
|
#define Sta_NUM_COUNT_TYPES 5
|
2014-12-01 23:55:08 +01:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
Sta_TOTAL_CLICKS = 0,
|
|
|
|
|
Sta_DISTINCT_USRS = 1,
|
|
|
|
|
Sta_CLICKS_PER_USR = 2,
|
|
|
|
|
Sta_GENERATION_TIME = 3,
|
|
|
|
|
Sta_SEND_TIME = 4,
|
|
|
|
|
} Sta_CountType_t;
|
|
|
|
|
|
2015-09-25 01:48:00 +02:00
|
|
|
|
#define Sta_NUM_CLICKS_DETAILED_OR_GROUPED 2
|
2014-12-01 23:55:08 +01:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
2015-09-25 01:48:00 +02:00
|
|
|
|
Sta_CLICKS_DETAILED = 0,
|
|
|
|
|
Sta_CLICKS_GROUPED = 1,
|
|
|
|
|
} Sta_ClicksDetailedOrGrouped_t;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2015-10-11 14:12:20 +02:00
|
|
|
|
#define Sta_NUM_CLICKS_GROUPED_BY 24
|
2015-09-25 01:48:00 +02:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
Sta_CLICKS_CRS_DETAILED_LIST = 0,
|
|
|
|
|
|
|
|
|
|
Sta_CLICKS_CRS_PER_USR = 1,
|
|
|
|
|
Sta_CLICKS_CRS_PER_DAYS = 2,
|
|
|
|
|
Sta_CLICKS_CRS_PER_DAYS_AND_HOUR = 3,
|
|
|
|
|
Sta_CLICKS_CRS_PER_WEEKS = 4,
|
|
|
|
|
Sta_CLICKS_CRS_PER_MONTHS = 5,
|
|
|
|
|
Sta_CLICKS_CRS_PER_HOUR = 6,
|
|
|
|
|
Sta_CLICKS_CRS_PER_MINUTE = 7,
|
|
|
|
|
Sta_CLICKS_CRS_PER_ACTION = 8,
|
|
|
|
|
|
|
|
|
|
Sta_CLICKS_GBL_PER_DAYS = 9,
|
|
|
|
|
Sta_CLICKS_GBL_PER_DAYS_AND_HOUR = 10,
|
|
|
|
|
Sta_CLICKS_GBL_PER_WEEKS = 11,
|
|
|
|
|
Sta_CLICKS_GBL_PER_MONTHS = 12,
|
|
|
|
|
Sta_CLICKS_GBL_PER_HOUR = 13,
|
|
|
|
|
Sta_CLICKS_GBL_PER_MINUTE = 14,
|
|
|
|
|
Sta_CLICKS_GBL_PER_ACTION = 15,
|
|
|
|
|
Sta_CLICKS_GBL_PER_PLUGIN = 16,
|
|
|
|
|
Sta_CLICKS_GBL_PER_WEB_SERVICE_FUNCTION = 17,
|
|
|
|
|
Sta_CLICKS_GBL_PER_BANNER = 18,
|
2015-10-11 14:12:20 +02:00
|
|
|
|
Sta_CLICKS_GBL_PER_COUNTRY = 19,
|
|
|
|
|
Sta_CLICKS_GBL_PER_INSTITUTION = 20,
|
|
|
|
|
Sta_CLICKS_GBL_PER_CENTRE = 21,
|
|
|
|
|
Sta_CLICKS_GBL_PER_DEGREE = 22,
|
|
|
|
|
Sta_CLICKS_GBL_PER_COURSE = 23,
|
2015-09-25 01:48:00 +02:00
|
|
|
|
} Sta_ClicksGroupedBy_t;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2016-02-07 23:51:22 +01:00
|
|
|
|
#define Sta_NUM_FIGURES 23
|
2014-12-01 23:55:08 +01:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
Sta_USERS, // Number of users
|
2015-04-03 11:49:11 +02:00
|
|
|
|
Sta_USERS_RANKING, // Users' ranking
|
|
|
|
|
Sta_HIERARCHY, // Number of countries, institutions, centres, degrees and courses
|
2016-10-28 10:03:37 +02:00
|
|
|
|
Sta_INSTITS, // Number of users in each institution
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Sta_FOLDERS_AND_FILES, // Number of folders and files
|
|
|
|
|
Sta_OER, // Number of OERs (Open Educational Resources)
|
|
|
|
|
Sta_ASSIGNMENTS, // Number of assignments
|
|
|
|
|
Sta_TESTS, // Number of test questions
|
2016-02-07 23:51:22 +01:00
|
|
|
|
Sta_SOCIAL_ACTIVITY, // Number of social notes
|
2016-01-30 01:42:34 +01:00
|
|
|
|
Sta_FOLLOW, // Number of following and followers
|
2016-01-30 00:07:23 +01:00
|
|
|
|
Sta_FORUMS, // Number of forums, threads and posts
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Sta_NOTIFY_EVENTS, // Number of users per notify event
|
|
|
|
|
Sta_NOTICES, // Number of notices
|
2015-04-03 11:49:11 +02:00
|
|
|
|
Sta_MESSAGES, // Number of users' (sent and received) messages
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Sta_SURVEYS, // Number of surveys
|
2016-11-07 16:35:58 +01:00
|
|
|
|
Sta_SOCIAL_NETWORKS, // Number of users in social networks
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Sta_LANGUAGES, // Number of users per language
|
2015-01-02 18:05:56 +01:00
|
|
|
|
Sta_ICON_SETS, // Number of users per icon set
|
|
|
|
|
Sta_MENUS, // Number of users per menu
|
2016-12-24 00:55:02 +01:00
|
|
|
|
Sta_FIRST_DAY_OF_WEEK, // Number of users per first day of week
|
|
|
|
|
Sta_THEMES, // Number of users per theme
|
2015-01-02 18:05:56 +01:00
|
|
|
|
Sta_SIDE_COLUMNS, // Number of users per layout of columns
|
2016-11-07 16:26:35 +01:00
|
|
|
|
Sta_PRIVACY, // Number of users per privacity
|
2015-09-25 01:48:00 +02:00
|
|
|
|
} Sta_FigureType_t;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
#define Sta_NUM_COLOR_TYPES 3
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
Sta_COLOR,
|
|
|
|
|
Sta_BLACK_TO_WHITE,
|
|
|
|
|
Sta_WHITE_TO_BLACK,
|
|
|
|
|
} Sta_ColorType_t;
|
|
|
|
|
|
2016-04-22 09:47:25 +02:00
|
|
|
|
#define Sta_NUM_STAT_CRS_FILE_ZONES 11
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2016-09-12 00:50:24 +02:00
|
|
|
|
struct Sta_Hits
|
|
|
|
|
{
|
|
|
|
|
float Num;
|
|
|
|
|
float Max;
|
|
|
|
|
float Total;
|
|
|
|
|
};
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Public prototypes *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Sta_GetRemoteAddr (void);
|
|
|
|
|
void Sta_LogAccess (const char *Comments);
|
|
|
|
|
void Sta_RemoveOldEntriesRecentLog (void);
|
2015-10-11 17:40:07 +02:00
|
|
|
|
void Sta_AskShowCrsHits (void);
|
|
|
|
|
void Sta_AskShowGblHits (void);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Sta_SetIniEndDates (void);
|
|
|
|
|
void Sta_SeeGblAccesses (void);
|
2015-09-30 23:26:48 +02:00
|
|
|
|
void Sta_SeeCrsAccesses (void);
|
2016-09-12 00:50:24 +02:00
|
|
|
|
|
|
|
|
|
void Sta_ComputeMaxAndTotalHits (struct Sta_Hits *Hits,
|
|
|
|
|
unsigned long NumRows,
|
|
|
|
|
MYSQL_RES *mysql_res,unsigned Field,
|
|
|
|
|
unsigned Divisor);
|
|
|
|
|
|
2016-11-06 15:36:26 +01:00
|
|
|
|
void Sta_ReqShowFigures (void);
|
|
|
|
|
void Sta_PutIconToShowFigure (void);
|
|
|
|
|
void Sta_PutHiddenParamFigures (void);
|
|
|
|
|
void Sta_ShowFigures (void);
|
|
|
|
|
|
2015-11-17 01:22:57 +01:00
|
|
|
|
unsigned Sta_GetTotalNumberOfUsersInCourses (Sco_Scope_t Scope,Rol_Role_t Role);
|
2016-09-12 00:50:24 +02:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
void Sta_WriteParamsDatesSeeAccesses (void);
|
|
|
|
|
|
|
|
|
|
void Sta_ComputeTimeToGeneratePage (void);
|
|
|
|
|
void Sta_ComputeTimeToSendPage (void);
|
|
|
|
|
void Sta_WriteTimeToGenerateAndSendPage (void);
|
|
|
|
|
void Sta_WriteTime (char *Str,long TimeInMicroseconds);
|
|
|
|
|
|
|
|
|
|
#endif
|