// swad_indicators.c: indicators of courses /* 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-2019 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 . */ /*****************************************************************************/ /********************************* Headers ***********************************/ /*****************************************************************************/ #define _GNU_SOURCE // For asprintf #include // For NULL #include // For aprintf #include // To access MySQL databases #include "swad_action.h" #include "swad_box.h" #include "swad_database.h" #include "swad_form.h" #include "swad_forum.h" #include "swad_global.h" #include "swad_HTML.h" #include "swad_indicator.h" #include "swad_parameter.h" #include "swad_theme.h" /*****************************************************************************/ /************** External global variables from others modules ****************/ /*****************************************************************************/ extern struct Globals Gbl; /*****************************************************************************/ /*************************** Internal constants ******************************/ /*****************************************************************************/ /*****************************************************************************/ /******************************* Internal types ******************************/ /*****************************************************************************/ typedef enum { Ind_INDICATORS_BRIEF, Ind_INDICATORS_FULL, } Ind_IndicatorsLayout_t; /*****************************************************************************/ /***************************** Internal prototypes ***************************/ /*****************************************************************************/ static void Ind_GetParamsIndicators (void); static void Ind_GetParamNumIndicators (void); static unsigned Ind_GetTableOfCourses (MYSQL_RES **mysql_res); static bool Ind_GetIfShowBigList (unsigned NumCrss); static void Ind_PutButtonToConfirmIWantToSeeBigList (unsigned NumCrss); static void Ind_PutParamsConfirmIWantToSeeBigList (void); static void Ind_GetNumCoursesWithIndicators (unsigned NumCrssWithIndicatorYes[1 + Ind_NUM_INDICATORS], unsigned NumCrss,MYSQL_RES *mysql_res); static void Ind_ShowNumCoursesWithIndicators (unsigned NumCrssWithIndicatorYes[1 + Ind_NUM_INDICATORS], unsigned NumCrss,bool PutForm); static void Ind_ShowTableOfCoursesWithIndicators (Ind_IndicatorsLayout_t IndicatorsLayout, unsigned NumCrss,MYSQL_RES *mysql_res); static unsigned Ind_GetAndUpdateNumIndicatorsCrs (long CrsCod); static void Ind_StoreIndicatorsCrsIntoDB (long CrsCod,unsigned NumIndicators); static unsigned long Ind_GetNumFilesInDocumZonesOfCrsFromDB (long CrsCod); static unsigned long Ind_GetNumFilesInShareZonesOfCrsFromDB (long CrsCod); static unsigned long Ind_GetNumFilesInAssigZonesOfCrsFromDB (long CrsCod); static unsigned long Ind_GetNumFilesInWorksZonesOfCrsFromDB (long CrsCod); /*****************************************************************************/ /******************* Request showing statistics of courses *******************/ /*****************************************************************************/ void Ind_ReqIndicatorsCourses (void) { extern const char *Hlp_ANALYTICS_Indicators; extern const char *The_ClassFormInBox[The_NUM_THEMES]; extern const char *Txt_Scope; extern const char *Txt_Types_of_degree; extern const char *Txt_only_if_the_scope_is_X; extern const char *Txt_Department; extern const char *Txt_Any_department; extern const char *Txt_No_of_indicators; extern const char *Txt_Indicators_of_courses; extern const char *Txt_Show_more_details; MYSQL_RES *mysql_res; unsigned NumCrss; unsigned NumCrssWithIndicatorYes[1 + Ind_NUM_INDICATORS]; unsigned NumCrssToList; unsigned Ind; /***** Get parameters *****/ Ind_GetParamsIndicators (); /***** Begin box *****/ Box_BoxBegin (NULL,Txt_Indicators_of_courses,NULL, Hlp_ANALYTICS_Indicators,Box_NOT_CLOSABLE); /***** Form to update indicators *****/ /* Begin form and table */ Frm_StartForm (ActReqStaCrs); HTM_TABLE_BeginWidePadding (2); /* Scope */ HTM_TR_Begin (NULL); HTM_TD_Begin ("class=\"RM\""); fprintf (Gbl.F.Out,"