mirror of https://github.com/acanas/swad-core.git
Version 21.7: Sep 18, 2021 New module swad_hierarchy_database for database queries related to hierarchy.
This commit is contained in:
parent
f9acc93507
commit
b044148aa6
3
Makefile
3
Makefile
|
@ -53,7 +53,8 @@ OBJS = swad_account.o swad_account_database.o swad_action.o swad_admin.o \
|
|||
swad_form.o swad_forum.o swad_forum_database.o \
|
||||
swad_game.o swad_game_database.o swad_global.o swad_group.o \
|
||||
swad_group_database.o swad_help.o swad_hierarchy.o \
|
||||
swad_hierarchy_config.o swad_holiday.o swad_HTML.o \
|
||||
swad_hierarchy_config.o swad_hierarchy_database.o swad_holiday.o \
|
||||
swad_HTML.o \
|
||||
swad_icon.o swad_ID.o swad_indicator.o swad_info.o swad_institution.o \
|
||||
swad_institution_config.o swad_institution_database.o \
|
||||
swad_language.o swad_layout.o swad_link.o swad_log.o swad_logo.o \
|
||||
|
|
|
@ -602,13 +602,14 @@ TODO: FIX BUG, URGENT! En las fechas como par
|
|||
|
||||
TODO: En las encuestas, que los estudiantes no puedan ver los resultados hasta que no finalice el plazo.
|
||||
*/
|
||||
#define Log_PLATFORM_VERSION "SWAD 21.6.3 (2021-09-20)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 21.7 (2021-09-20)"
|
||||
#define CSS_FILE "swad20.45.css"
|
||||
#define JS_FILE "swad20.69.1.js"
|
||||
/*
|
||||
TODO: Rename CENTRE to CENTER in help wiki.
|
||||
TODO: Rename ASSESSMENT.Announcements to ASSESSMENT.Calls_for_exams
|
||||
|
||||
Version 21.7: Sep 18, 2021 New module swad_hierarchy_database for database queries related to hierarchy. (315774 lines)
|
||||
Version 21.6.3: Sep 20, 2021 Queries moved to module swad_game_database. (315708 lines)
|
||||
Version 21.6.2: Sep 18, 2021 Queries moved to module swad_game_database. (315679 lines)
|
||||
Version 21.6.1: Sep 18, 2021 Queries moved to module swad_game_database. (315571 lines)
|
||||
|
|
|
@ -26,28 +26,13 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
#define _GNU_SOURCE // For asprintf
|
||||
// #include <float.h> // For DBL_MAX
|
||||
// #include <linux/limits.h> // For PATH_MAX
|
||||
// #include <stddef.h> // For NULL
|
||||
#include <stdio.h> // For asprintf
|
||||
// #include <stdlib.h> // For free
|
||||
// #include <string.h> // For string functions
|
||||
|
||||
#include "swad_database.h"
|
||||
#include "swad_error.h"
|
||||
// #include "swad_figure.h"
|
||||
// #include "swad_form.h"
|
||||
#include "swad_game.h"
|
||||
#include "swad_game_database.h"
|
||||
#include "swad_global.h"
|
||||
// #include "swad_hierarchy_level.h"
|
||||
// #include "swad_HTML.h"
|
||||
// #include "swad_match.h"
|
||||
// #include "swad_match_result.h"
|
||||
// #include "swad_pagination.h"
|
||||
// #include "swad_role.h"
|
||||
// #include "swad_test.h"
|
||||
// #include "swad_test_visibility.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/************** External global variables from others modules ****************/
|
||||
|
|
|
@ -27,9 +27,7 @@
|
|||
/********************************* Headers ***********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
// #include "swad_date.h"
|
||||
#include "swad_hierarchy_level.h"
|
||||
// #include "swad_scope.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************** Public types and constants ***********************/
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "swad_global.h"
|
||||
#include "swad_group_database.h"
|
||||
#include "swad_hierarchy.h"
|
||||
#include "swad_hierarchy_database.h"
|
||||
#include "swad_hierarchy_level.h"
|
||||
#include "swad_HTML.h"
|
||||
#include "swad_logo.h"
|
||||
|
@ -665,49 +666,8 @@ void Hie_GetAndWriteInsCtrDegAdminBy (long UsrCod,unsigned ColSpan)
|
|||
struct Hie_Hierarchy Hie;
|
||||
|
||||
/***** Get institutions, centers, degrees admin by user from database *****/
|
||||
NumRows = (unsigned)
|
||||
DB_QuerySELECT (&mysql_res,"can not get institutions, centers, degrees"
|
||||
" admin by a user",
|
||||
"(SELECT %u AS S," // row[0]
|
||||
"-1 AS Cod," // row[1]
|
||||
"'' AS FullName" // row[2]
|
||||
" FROM usr_admins"
|
||||
" WHERE UsrCod=%ld"
|
||||
" AND Scope='%s')"
|
||||
" UNION "
|
||||
"(SELECT %u AS S," // row[0]
|
||||
"usr_admins.Cod," // row[1]
|
||||
"ins_instits.FullName" // row[2]
|
||||
" FROM usr_admins,"
|
||||
"ins_instits"
|
||||
" WHERE usr_admins.UsrCod=%ld"
|
||||
" AND usr_admins.Scope='%s'"
|
||||
" AND usr_admins.Cod=ins_instits.InsCod)"
|
||||
" UNION "
|
||||
"(SELECT %u AS S," // row[0]
|
||||
"usr_admins.Cod," // row[1]
|
||||
"ctr_centers.FullName" // row[2]
|
||||
" FROM usr_admins,"
|
||||
"ctr_centers"
|
||||
" WHERE usr_admins.UsrCod=%ld"
|
||||
" AND usr_admins.Scope='%s'"
|
||||
" AND usr_admins.Cod=ctr_centers.CtrCod)"
|
||||
" UNION "
|
||||
"(SELECT %u AS S," // row[0]
|
||||
"usr_admins.Cod," // row[1]
|
||||
"deg_degrees.FullName" // row[2]
|
||||
" FROM usr_admins,"
|
||||
"deg_degrees"
|
||||
" WHERE usr_admins.UsrCod=%ld"
|
||||
" AND usr_admins.Scope='%s'"
|
||||
" AND usr_admins.Cod=deg_degrees.DegCod)"
|
||||
" ORDER BY S,"
|
||||
"FullName",
|
||||
(unsigned) HieLvl_SYS,UsrCod,Sco_GetDBStrFromScope (HieLvl_SYS),
|
||||
(unsigned) HieLvl_INS,UsrCod,Sco_GetDBStrFromScope (HieLvl_INS),
|
||||
(unsigned) HieLvl_CTR,UsrCod,Sco_GetDBStrFromScope (HieLvl_CTR),
|
||||
(unsigned) HieLvl_DEG,UsrCod,Sco_GetDBStrFromScope (HieLvl_DEG));
|
||||
if (NumRows)
|
||||
NumRows = Hie_DB_GetInsCtrDegAdminBy (&mysql_res,UsrCod);
|
||||
|
||||
/***** Get the list of degrees *****/
|
||||
for (NumRow = 1;
|
||||
NumRow <= NumRows;
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
// swad_hierarchy_database.c: hierarchy (system, institution, center, degree, course), operations with database
|
||||
|
||||
/*
|
||||
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-2021 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_database.h"
|
||||
#include "swad_hierarchy_database.h"
|
||||
#include "swad_hierarchy_level.h"
|
||||
#include "swad_scope.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/************** External global variables from others modules ****************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************************** Public constants ********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Private types *********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************************** Private constants *******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/*************************** Private prototypes ******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/****** Get institutions, centers and degrees administrated by an admin *****/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Hie_DB_GetInsCtrDegAdminBy (MYSQL_RES **mysql_res,long UsrCod)
|
||||
{
|
||||
return (unsigned)
|
||||
DB_QuerySELECT (mysql_res,"can not get institutions, centers, degrees"
|
||||
" admin by a user",
|
||||
"(SELECT %u AS S," // row[0]
|
||||
"-1 AS Cod," // row[1]
|
||||
"'' AS FullName" // row[2]
|
||||
" FROM usr_admins"
|
||||
" WHERE UsrCod=%ld"
|
||||
" AND Scope='%s')"
|
||||
" UNION "
|
||||
"(SELECT %u AS S," // row[0]
|
||||
"usr_admins.Cod," // row[1]
|
||||
"ins_instits.FullName" // row[2]
|
||||
" FROM usr_admins,"
|
||||
"ins_instits"
|
||||
" WHERE usr_admins.UsrCod=%ld"
|
||||
" AND usr_admins.Scope='%s'"
|
||||
" AND usr_admins.Cod=ins_instits.InsCod)"
|
||||
" UNION "
|
||||
"(SELECT %u AS S," // row[0]
|
||||
"usr_admins.Cod," // row[1]
|
||||
"ctr_centers.FullName" // row[2]
|
||||
" FROM usr_admins,"
|
||||
"ctr_centers"
|
||||
" WHERE usr_admins.UsrCod=%ld"
|
||||
" AND usr_admins.Scope='%s'"
|
||||
" AND usr_admins.Cod=ctr_centers.CtrCod)"
|
||||
" UNION "
|
||||
"(SELECT %u AS S," // row[0]
|
||||
"usr_admins.Cod," // row[1]
|
||||
"deg_degrees.FullName" // row[2]
|
||||
" FROM usr_admins,"
|
||||
"deg_degrees"
|
||||
" WHERE usr_admins.UsrCod=%ld"
|
||||
" AND usr_admins.Scope='%s'"
|
||||
" AND usr_admins.Cod=deg_degrees.DegCod)"
|
||||
" ORDER BY S,"
|
||||
"FullName",
|
||||
(unsigned) HieLvl_SYS,UsrCod,Sco_GetDBStrFromScope (HieLvl_SYS),
|
||||
(unsigned) HieLvl_INS,UsrCod,Sco_GetDBStrFromScope (HieLvl_INS),
|
||||
(unsigned) HieLvl_CTR,UsrCod,Sco_GetDBStrFromScope (HieLvl_CTR),
|
||||
(unsigned) HieLvl_DEG,UsrCod,Sco_GetDBStrFromScope (HieLvl_DEG));
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
// swad_hierarchy_database.h: hierarchy (system, institution, center, degree, course), operations with database
|
||||
|
||||
#ifndef _SWAD_HIE_DB
|
||||
#define _SWAD_HIE_DB
|
||||
/*
|
||||
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-2021 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 <mysql/mysql.h> // To access MySQL databases
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public constants ******************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************************* Public types ********************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/***************************** Public prototypes *****************************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Hie_DB_GetInsCtrDegAdminBy (MYSQL_RES **mysql_res,long UsrCod);
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue