mirror of
https://github.com/acanas/swad-core.git
synced 2024-06-05 08:15:25 +02:00
Version 20.88.3: Jun 02, 2021 Queries moved to module swad_center_database.
This commit is contained in:
parent
4f83e637c6
commit
b71f3fc86e
|
@ -1288,8 +1288,8 @@ void Ctr_ChangeCtrWWW (void)
|
|||
void Ctr_ChangeCtrStatus (void)
|
||||
{
|
||||
extern const char *Txt_The_status_of_the_center_X_has_changed;
|
||||
Ctr_Status_t Status;
|
||||
Ctr_StatusTxt_t StatusTxt;
|
||||
Ctr_Status_t NewStatus;
|
||||
Ctr_StatusTxt_t NewStatusTxt;
|
||||
|
||||
/***** Center constructor *****/
|
||||
Ctr_EditingCenterConstructor ();
|
||||
|
@ -1298,22 +1298,22 @@ void Ctr_ChangeCtrStatus (void)
|
|||
Ctr_EditingCtr->CtrCod = Ctr_GetAndCheckParamOtherCtrCod (1);
|
||||
|
||||
/***** Get parameter with status *****/
|
||||
Status = (Ctr_Status_t)
|
||||
Par_GetParToUnsignedLong ("Status",
|
||||
0,
|
||||
(unsigned long) Ctr_MAX_STATUS,
|
||||
(unsigned long) Ctr_WRONG_STATUS);
|
||||
if (Status == Ctr_WRONG_STATUS)
|
||||
NewStatus = (Ctr_Status_t)
|
||||
Par_GetParToUnsignedLong ("Status",
|
||||
0,
|
||||
(unsigned long) Ctr_MAX_STATUS,
|
||||
(unsigned long) Ctr_WRONG_STATUS);
|
||||
if (NewStatus == Ctr_WRONG_STATUS)
|
||||
Err_WrongStatusExit ();
|
||||
StatusTxt = Ctr_GetStatusTxtFromStatusBits (Status);
|
||||
Status = Ctr_GetStatusBitsFromStatusTxt (StatusTxt); // New status
|
||||
NewStatusTxt = Ctr_GetStatusTxtFromStatusBits (NewStatus);
|
||||
NewStatus = Ctr_GetStatusBitsFromStatusTxt (NewStatusTxt); // New status
|
||||
|
||||
/***** Get data of center *****/
|
||||
Ctr_GetDataOfCenterByCod (Ctr_EditingCtr);
|
||||
|
||||
/***** Update status in table of centers *****/
|
||||
Ctr_DB_UpdateCtrStatus (Ctr_EditingCtr->CtrCod,Status);
|
||||
Ctr_EditingCtr->Status = Status;
|
||||
Ctr_DB_UpdateCtrStatus (Ctr_EditingCtr->CtrCod,NewStatus);
|
||||
Ctr_EditingCtr->Status = NewStatus;
|
||||
|
||||
/***** Write message to show the change made
|
||||
and put button to go to center changed *****/
|
||||
|
|
|
@ -102,10 +102,6 @@ static void CtrCfg_NumUsrs (void);
|
|||
static void CtrCfg_NumDegs (void);
|
||||
static void CtrCfg_NumCrss (void);
|
||||
|
||||
static void Ctr_DB_UpdateCtrIns (long CtrCod,long InsCod);
|
||||
static void CtrCfg_UpdateCtrCoordinateDB (long CtrCod,
|
||||
const char *CoordField,double NewCoord);
|
||||
|
||||
/*****************************************************************************/
|
||||
/****************** Show information of the current center *******************/
|
||||
/*****************************************************************************/
|
||||
|
@ -519,11 +515,7 @@ static void CtrCfg_GetPhotoAttr (long CtrCod,char **PhotoAttribution)
|
|||
CtrCfg_FreePhotoAttr (PhotoAttribution);
|
||||
|
||||
/***** Get photo attribution from database *****/
|
||||
if (DB_QuerySELECT (&mysql_res,"can not get photo attribution",
|
||||
"SELECT PhotoAttribution" // row[0]
|
||||
" FROM ctr_centers"
|
||||
" WHERE CtrCod=%ld",
|
||||
CtrCod))
|
||||
if (Ctr_DB_GetPhotoAttribution (&mysql_res,CtrCod))
|
||||
{
|
||||
/* Get row */
|
||||
row = mysql_fetch_row (mysql_res);
|
||||
|
@ -633,7 +625,7 @@ static void CtrCfg_FullName (bool PutForm)
|
|||
extern const char *Txt_Center;
|
||||
|
||||
HieCfg_FullName (PutForm,Txt_Center,ActRenCtrFulCfg,
|
||||
Gbl.Hierarchy.Ctr.FullName);
|
||||
Gbl.Hierarchy.Ctr.FullName);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -1008,13 +1000,7 @@ void CtrCfg_ChangeCtrPhotoAttr (void)
|
|||
Par_GetParToText ("Attribution",NewPhotoAttribution,Med_MAX_BYTES_ATTRIBUTION);
|
||||
|
||||
/***** Update the table changing old attribution by new attribution *****/
|
||||
DB_QueryUPDATE ("can not update the photo attribution"
|
||||
" of the current center",
|
||||
"UPDATE ctr_centers"
|
||||
" SET PhotoAttribution='%s'"
|
||||
" WHERE CtrCod=%ld",
|
||||
NewPhotoAttribution,
|
||||
Gbl.Hierarchy.Ctr.CtrCod);
|
||||
Ctr_DB_UpdateCtrPhotoAttribution (Gbl.Hierarchy.Ctr.CtrCod,NewPhotoAttribution);
|
||||
|
||||
/***** Show the center information again *****/
|
||||
CtrCfg_ShowConfiguration ();
|
||||
|
@ -1041,17 +1027,17 @@ void CtrCfg_ChangeCtrIns (void)
|
|||
|
||||
/***** Check if it already exists a center with the same name in the new institution *****/
|
||||
if (Ctr_DB_CheckIfCtrNameExistsInIns ("ShortName",
|
||||
Gbl.Hierarchy.Ctr.ShrtName,
|
||||
Gbl.Hierarchy.Ctr.CtrCod,
|
||||
NewIns.InsCod))
|
||||
Gbl.Hierarchy.Ctr.ShrtName,
|
||||
Gbl.Hierarchy.Ctr.CtrCod,
|
||||
NewIns.InsCod))
|
||||
/***** Create warning message *****/
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_center_X_already_exists,
|
||||
Gbl.Hierarchy.Ctr.ShrtName);
|
||||
else if (Ctr_DB_CheckIfCtrNameExistsInIns ("FullName",
|
||||
Gbl.Hierarchy.Ctr.FullName,
|
||||
Gbl.Hierarchy.Ctr.CtrCod,
|
||||
NewIns.InsCod))
|
||||
Gbl.Hierarchy.Ctr.FullName,
|
||||
Gbl.Hierarchy.Ctr.CtrCod,
|
||||
NewIns.InsCod))
|
||||
/***** Create warning message *****/
|
||||
Ale_CreateAlert (Ale_WARNING,NULL,
|
||||
Txt_The_center_X_already_exists,
|
||||
|
@ -1074,21 +1060,6 @@ void CtrCfg_ChangeCtrIns (void)
|
|||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Update institution in table of centers ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void Ctr_DB_UpdateCtrIns (long CtrCod,long InsCod)
|
||||
{
|
||||
/***** Update institution in table of centers *****/
|
||||
DB_QueryUPDATE ("can not update the institution of a center",
|
||||
"UPDATE ctr_centers"
|
||||
" SET InsCod=%ld"
|
||||
" WHERE CtrCod=%ld",
|
||||
InsCod,
|
||||
CtrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************ Change the place of a center ***********************/
|
||||
/*****************************************************************************/
|
||||
|
@ -1140,7 +1111,7 @@ void CtrCfg_ChangeCtrLatitude (void)
|
|||
NewLatitude = Map_GetLatitudeFromStr (LatitudeStr);
|
||||
|
||||
/***** Update database changing old latitude by new latitude *****/
|
||||
CtrCfg_UpdateCtrCoordinateDB (Gbl.Hierarchy.Ctr.CtrCod,"Latitude",NewLatitude);
|
||||
Ctr_DB_UpdateCtrCoordinate (Gbl.Hierarchy.Ctr.CtrCod,"Latitude",NewLatitude);
|
||||
Gbl.Hierarchy.Ctr.Coord.Latitude = NewLatitude;
|
||||
|
||||
/***** Show the form again *****/
|
||||
|
@ -1161,7 +1132,7 @@ void CtrCfg_ChangeCtrLongitude (void)
|
|||
NewLongitude = Map_GetLongitudeFromStr (LongitudeStr);
|
||||
|
||||
/***** Update database changing old longitude by new longitude *****/
|
||||
CtrCfg_UpdateCtrCoordinateDB (Gbl.Hierarchy.Ctr.CtrCod,"Longitude",NewLongitude);
|
||||
Ctr_DB_UpdateCtrCoordinate (Gbl.Hierarchy.Ctr.CtrCod,"Longitude",NewLongitude);
|
||||
Gbl.Hierarchy.Ctr.Coord.Longitude = NewLongitude;
|
||||
|
||||
/***** Show the form again *****/
|
||||
|
@ -1182,32 +1153,13 @@ void CtrCfg_ChangeCtrAltitude (void)
|
|||
NewAltitude = Map_GetAltitudeFromStr (AltitudeStr);
|
||||
|
||||
/***** Update database changing old altitude by new altitude *****/
|
||||
CtrCfg_UpdateCtrCoordinateDB (Gbl.Hierarchy.Ctr.CtrCod,"Altitude",NewAltitude);
|
||||
Ctr_DB_UpdateCtrCoordinate (Gbl.Hierarchy.Ctr.CtrCod,"Altitude",NewAltitude);
|
||||
Gbl.Hierarchy.Ctr.Coord.Altitude = NewAltitude;
|
||||
|
||||
/***** Show the form again *****/
|
||||
CtrCfg_ShowConfiguration ();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******** Update database changing old coordinate by new coordinate **********/
|
||||
/*****************************************************************************/
|
||||
|
||||
static void CtrCfg_UpdateCtrCoordinateDB (long CtrCod,
|
||||
const char *CoordField,double NewCoord)
|
||||
{
|
||||
/***** Update database changing old coordinate by new coordinate *****/
|
||||
Str_SetDecimalPointToUS (); // To write the decimal point as a dot
|
||||
DB_QueryUPDATE ("can not update a coordinate of a center",
|
||||
"UPDATE ctr_centers"
|
||||
" SET %s='%.15lg'"
|
||||
" WHERE CtrCod=%ld",
|
||||
CoordField,
|
||||
NewCoord,
|
||||
CtrCod);
|
||||
Str_SetDecimalPointToLocal (); // Return to local system
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************************* Change the URL of a center ************************/
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -296,6 +296,20 @@ void Ctr_DB_GetShortNameOfCenterByCod (long CtrCod,char ShrtName[Cns_HIERARCHY_M
|
|||
CtrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Get photo attribution from database ********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned Ctr_DB_GetPhotoAttribution (MYSQL_RES **mysql_res,long CtrCod)
|
||||
{
|
||||
return (unsigned)
|
||||
DB_QuerySELECT (mysql_res,"can not get photo attribution",
|
||||
"SELECT PhotoAttribution" // row[0]
|
||||
" FROM ctr_centers"
|
||||
" WHERE CtrCod=%ld",
|
||||
CtrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Check if the name of center exists ********************/
|
||||
/*****************************************************************************/
|
||||
|
@ -427,6 +441,7 @@ unsigned Ctr_DB_GetNumCtrsWithDegs (const char *SubQuery)
|
|||
" AND ctr_centers.CtrCod=deg_degrees.CtrCod",
|
||||
SubQuery);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Get number of centers with courses ********************/
|
||||
/*****************************************************************************/
|
||||
|
@ -445,6 +460,7 @@ unsigned Ctr_DB_GetNumCtrsWithCrss (const char *SubQuery)
|
|||
" AND deg_degrees.DegCod=crs_courses.DegCod",
|
||||
SubQuery);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/********************* Get number of centers with users **********************/
|
||||
/*****************************************************************************/
|
||||
|
@ -468,6 +484,20 @@ unsigned Ctr_DB_GetNumCtrsWithUsrs (Rol_Role_t Role,const char *SubQuery)
|
|||
SubQuery,(unsigned) Role);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************* Update institution in table of centers ******************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Ctr_DB_UpdateCtrIns (long CtrCod,long NewInsCod)
|
||||
{
|
||||
DB_QueryUPDATE ("can not update the institution of a center",
|
||||
"UPDATE ctr_centers"
|
||||
" SET InsCod=%ld"
|
||||
" WHERE CtrCod=%ld",
|
||||
NewInsCod,
|
||||
CtrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/************** Update database changing old place by new place **************/
|
||||
/*****************************************************************************/
|
||||
|
@ -504,7 +534,6 @@ void Ctr_DB_UpdateCtrName (long CtrCod,const char *FieldName,const char *NewCtrN
|
|||
|
||||
void Ctr_DB_UpdateCtrWWW (long CtrCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1])
|
||||
{
|
||||
/***** Update database changing old WWW by new WWW *****/
|
||||
DB_QueryUPDATE ("can not update the web of a center",
|
||||
"UPDATE ctr_centers"
|
||||
" SET WWW='%s'"
|
||||
|
@ -513,17 +542,49 @@ void Ctr_DB_UpdateCtrWWW (long CtrCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1])
|
|||
CtrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******* Update the table changing old attribution by new attribution ********/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Ctr_DB_UpdateCtrPhotoAttribution (long CtrCod,const char NewPhotoAttribution[Med_MAX_BYTES_ATTRIBUTION + 1])
|
||||
{
|
||||
DB_QueryUPDATE ("can not update the photo attribution of a center",
|
||||
"UPDATE ctr_centers"
|
||||
" SET PhotoAttribution='%s'"
|
||||
" WHERE CtrCod=%ld",
|
||||
NewPhotoAttribution,
|
||||
CtrCod);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******** Update database changing old coordinate by new coordinate **********/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Ctr_DB_UpdateCtrCoordinate (long CtrCod,
|
||||
const char *CoordField,double NewCoord)
|
||||
{
|
||||
Str_SetDecimalPointToUS (); // To write the decimal point as a dot
|
||||
DB_QueryUPDATE ("can not update a coordinate of a center",
|
||||
"UPDATE ctr_centers"
|
||||
" SET %s='%.15lg'"
|
||||
" WHERE CtrCod=%ld",
|
||||
CoordField,
|
||||
NewCoord,
|
||||
CtrCod);
|
||||
Str_SetDecimalPointToLocal (); // Return to local system
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/******************** Update status in table of centers **********************/
|
||||
/*****************************************************************************/
|
||||
|
||||
void Ctr_DB_UpdateCtrStatus (long CtrCod,Ctr_Status_t Status)
|
||||
void Ctr_DB_UpdateCtrStatus (long CtrCod,Ctr_Status_t NewStatus)
|
||||
{
|
||||
DB_QueryUPDATE ("can not update the status of a center",
|
||||
"UPDATE ctr_centers"
|
||||
" SET Status=%u"
|
||||
" WHERE CtrCod=%ld",
|
||||
(unsigned) Status,
|
||||
(unsigned) NewStatus,
|
||||
CtrCod);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "swad_constant.h"
|
||||
// #include "swad_degree.h"
|
||||
// #include "swad_map.h"
|
||||
#include "swad_media.h"
|
||||
// #include "swad_role_type.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -54,6 +55,7 @@ unsigned Ctr_DB_GetCtrsWithPendingDegs (MYSQL_RES **mysql_res);
|
|||
unsigned Ctr_DB_GetDataOfCenterByCod (MYSQL_RES **mysql_res,long CtrCod);
|
||||
long Ctr_DB_GetInsCodOfCenterByCod (long CtrCod);
|
||||
void Ctr_DB_GetShortNameOfCenterByCod (long CtrCod,char ShrtName[Cns_HIERARCHY_MAX_BYTES_SHRT_NAME + 1]);
|
||||
unsigned Ctr_DB_GetPhotoAttribution (MYSQL_RES **mysql_res,long CtrCod);
|
||||
bool Ctr_DB_CheckIfCtrNameExistsInIns (const char *FieldName,const char *Name,
|
||||
long CtrCod,long InsCod);
|
||||
unsigned Ctr_DB_GetNumCtrsInCty (long CtyCod);
|
||||
|
@ -66,10 +68,14 @@ unsigned Ctr_DB_GetNumCtrsWithDegs (const char *SubQuery);
|
|||
unsigned Ctr_DB_GetNumCtrsWithCrss (const char *SubQuery);
|
||||
unsigned Ctr_DB_GetNumCtrsWithUsrs (Rol_Role_t Role,const char *SubQuery);
|
||||
|
||||
void Ctr_DB_UpdateCtrIns (long CtrCod,long NewInsCod);
|
||||
void Ctr_DB_UpdateCtrPlc (long CtrCod,long NewPlcCod);
|
||||
void Ctr_DB_UpdateCtrName (long CtrCod,const char *FieldName,const char *NewCtrName);
|
||||
void Ctr_DB_UpdateCtrWWW (long CtrCod,const char NewWWW[Cns_MAX_BYTES_WWW + 1]);
|
||||
void Ctr_DB_UpdateCtrStatus (long CtrCod,Ctr_Status_t Status);
|
||||
void Ctr_DB_UpdateCtrPhotoAttribution (long CtrCod,const char NewPhotoAttribution[Med_MAX_BYTES_ATTRIBUTION + 1]);
|
||||
void Ctr_DB_UpdateCtrCoordinate (long CtrCod,
|
||||
const char *CoordField,double NewCoord);
|
||||
void Ctr_DB_UpdateCtrStatus (long CtrCod,Ctr_Status_t NewStatus);
|
||||
|
||||
void Ctr_DB_RemoveCenter (long CtrCod);
|
||||
|
||||
|
|
|
@ -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 20.88.1 (2021-06-02)"
|
||||
#define Log_PLATFORM_VERSION "SWAD 20.88.3 (2021-06-02)"
|
||||
#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 20.88.3: Jun 02, 2021 Queries moved to module swad_center_database. (312755 lines)
|
||||
Version 20.88.2: Jun 02, 2021 Queries moved to module swad_center_database.
|
||||
Fixed bug in visibility of exam results. Reported by Mancia Anguita López. (312738 lines)
|
||||
Version 20.88.1: Jun 02, 2021 Queries moved to module swad_center_database. (312668 lines)
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#define _GNU_SOURCE // For asprintf
|
||||
#include <stdio.h> // For asprintf
|
||||
#include <stdlib.h> // For free
|
||||
|
||||
#include "swad_country_database.h"
|
||||
#include "swad_database.h"
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
#define _GNU_SOURCE // For asprintf
|
||||
#include <stdio.h> // For asprintf
|
||||
#include <stdlib.h> // For free
|
||||
|
||||
#include "swad_course.h"
|
||||
#include "swad_course_config.h"
|
||||
|
|
Loading…
Reference in New Issue
Block a user