2019-12-29 13:13:09 +01:00
|
|
|
|
// swad_course_config.c: configuration of current course
|
2019-12-29 12:39:00 +01:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
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.
|
2023-03-10 17:21:04 +01:00
|
|
|
|
Copyright (C) 1999-2023 Antonio Ca<EFBFBD>as Vargas
|
2019-12-29 12:39:00 +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 ***********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-30 22:32:06 +01:00
|
|
|
|
#define _GNU_SOURCE // For asprintf
|
2019-12-29 12:39:00 +01:00
|
|
|
|
#include <stdbool.h> // For boolean type
|
|
|
|
|
#include <stddef.h> // For NULL
|
2019-12-30 22:32:06 +01:00
|
|
|
|
#include <stdio.h> // For asprintf
|
2020-01-03 22:16:51 +01:00
|
|
|
|
#include <stdlib.h> // For free
|
2019-12-29 14:20:17 +01:00
|
|
|
|
#include <string.h> // For string functions
|
2019-12-29 12:39:00 +01:00
|
|
|
|
|
2022-11-06 18:11:10 +01:00
|
|
|
|
#include "swad_action_list.h"
|
2022-10-19 18:07:49 +02:00
|
|
|
|
#include "swad_alert.h"
|
|
|
|
|
#include "swad_box.h"
|
2021-05-27 00:30:06 +02:00
|
|
|
|
#include "swad_course_database.h"
|
2019-12-29 14:20:17 +01:00
|
|
|
|
#include "swad_database.h"
|
2021-04-26 15:27:27 +02:00
|
|
|
|
#include "swad_error.h"
|
2019-12-29 12:39:00 +01:00
|
|
|
|
#include "swad_form.h"
|
|
|
|
|
#include "swad_global.h"
|
2021-02-11 22:57:09 +01:00
|
|
|
|
#include "swad_hierarchy.h"
|
2019-12-29 20:11:57 +01:00
|
|
|
|
#include "swad_hierarchy_config.h"
|
2021-05-27 23:30:16 +02:00
|
|
|
|
#include "swad_hierarchy_level.h"
|
2019-12-29 12:39:00 +01:00
|
|
|
|
#include "swad_HTML.h"
|
2020-04-14 17:15:17 +02:00
|
|
|
|
#include "swad_indicator.h"
|
2019-12-29 12:39:00 +01:00
|
|
|
|
#include "swad_logo.h"
|
2022-10-19 18:07:49 +02:00
|
|
|
|
#include "swad_parameter.h"
|
2019-12-29 12:39:00 +01:00
|
|
|
|
#include "swad_role.h"
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** External global variables from others modules ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
extern struct Globals Gbl;
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************************** Private prototypes *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-08 13:40:21 +02:00
|
|
|
|
static void CrsCfg_PutIconToPrint (__attribute__((unused)) void *Args);
|
2019-12-29 13:13:09 +01:00
|
|
|
|
static void CrsCfg_Title (bool PutLink);
|
|
|
|
|
static void CrsCfg_Degree (bool PrintView,bool PutForm);
|
|
|
|
|
static void CrsCfg_FullName (bool PutForm);
|
|
|
|
|
static void CrsCfg_ShrtName (bool PutForm);
|
|
|
|
|
static void CrsCfg_Year (bool PutForm);
|
|
|
|
|
static void CrsCfg_InstitutionalCode (bool PutForm);
|
|
|
|
|
static void CrsCfg_InternalCode (void);
|
|
|
|
|
static void CrsCfg_Shortcut (bool PrintView);
|
|
|
|
|
static void CrsCfg_QR (void);
|
|
|
|
|
static void CrsCfg_Indicators (void);
|
2019-12-29 12:39:00 +01:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************** Configuration of the current course ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-29 13:13:09 +01:00
|
|
|
|
void CrsCfg_Configuration (bool PrintView)
|
2019-12-29 12:39:00 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Hlp_COURSE_Information;
|
|
|
|
|
bool PutLink;
|
|
|
|
|
bool PutFormDeg;
|
|
|
|
|
bool PutFormName;
|
|
|
|
|
bool PutFormYear;
|
|
|
|
|
bool PutFormInsCod;
|
|
|
|
|
|
|
|
|
|
/***** Trivial check *****/
|
|
|
|
|
if (Gbl.Hierarchy.Crs.CrsCod <= 0) // No course selected
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/***** Initializations *****/
|
|
|
|
|
PutLink = !PrintView && Gbl.Hierarchy.Deg.WWW[0];
|
|
|
|
|
PutFormDeg = !PrintView && Gbl.Usrs.Me.Role.Logged >= Rol_CTR_ADM;
|
|
|
|
|
PutFormName = !PrintView && Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM;
|
|
|
|
|
PutFormYear =
|
|
|
|
|
PutFormInsCod = !PrintView && Gbl.Usrs.Me.Role.Logged >= Rol_TCH;
|
|
|
|
|
|
|
|
|
|
/***** Contextual menu *****/
|
|
|
|
|
if (!PrintView)
|
|
|
|
|
if (Gbl.Usrs.Me.Role.Logged == Rol_GST ||
|
|
|
|
|
Gbl.Usrs.Me.Role.Logged == Rol_USR)
|
|
|
|
|
{
|
|
|
|
|
Mnu_ContextMenuBegin ();
|
2021-10-29 00:32:19 +02:00
|
|
|
|
Enr_PutLinkToRequestSignUp (); // Request enrolment in the current course
|
2019-12-29 12:39:00 +01:00
|
|
|
|
Mnu_ContextMenuEnd ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Begin box *****/
|
|
|
|
|
if (PrintView)
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Box_BoxBegin (NULL,NULL,
|
|
|
|
|
NULL,NULL,
|
2019-12-29 12:39:00 +01:00
|
|
|
|
NULL,Box_NOT_CLOSABLE);
|
|
|
|
|
else
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Box_BoxBegin (NULL,NULL,
|
2020-04-08 13:40:21 +02:00
|
|
|
|
CrsCfg_PutIconToPrint,NULL,
|
2019-12-29 12:39:00 +01:00
|
|
|
|
Hlp_COURSE_Information,Box_NOT_CLOSABLE);
|
|
|
|
|
|
|
|
|
|
/***** Title *****/
|
2019-12-29 13:13:09 +01:00
|
|
|
|
CrsCfg_Title (PutLink);
|
2019-12-29 12:39:00 +01:00
|
|
|
|
|
|
|
|
|
/**************************** Left part ***********************************/
|
2020-01-14 14:16:14 +01:00
|
|
|
|
HTM_DIV_Begin ("class=\"HIE_CFG_LEFT HIE_CFG_WIDTH\"");
|
2019-12-29 12:39:00 +01:00
|
|
|
|
|
2021-05-27 00:30:06 +02:00
|
|
|
|
/***** Begin table *****/
|
|
|
|
|
HTM_TABLE_BeginWidePadding (2);
|
2019-12-29 12:39:00 +01:00
|
|
|
|
|
2021-05-27 00:30:06 +02:00
|
|
|
|
/***** Degree *****/
|
|
|
|
|
CrsCfg_Degree (PrintView,PutFormDeg);
|
2019-12-29 12:39:00 +01:00
|
|
|
|
|
2021-05-27 00:30:06 +02:00
|
|
|
|
/***** Course name *****/
|
|
|
|
|
CrsCfg_FullName (PutFormName);
|
|
|
|
|
CrsCfg_ShrtName (PutFormName);
|
2019-12-29 12:39:00 +01:00
|
|
|
|
|
2021-05-27 00:30:06 +02:00
|
|
|
|
/***** Course year *****/
|
|
|
|
|
CrsCfg_Year (PutFormYear);
|
2019-12-29 12:39:00 +01:00
|
|
|
|
|
2021-05-27 00:30:06 +02:00
|
|
|
|
if (!PrintView)
|
|
|
|
|
{
|
|
|
|
|
/***** Institutional code of the course *****/
|
|
|
|
|
CrsCfg_InstitutionalCode (PutFormInsCod);
|
2019-12-29 12:39:00 +01:00
|
|
|
|
|
2021-05-27 00:30:06 +02:00
|
|
|
|
/***** Internal code of the course *****/
|
|
|
|
|
CrsCfg_InternalCode ();
|
|
|
|
|
}
|
2019-12-29 12:39:00 +01:00
|
|
|
|
|
2021-05-27 00:30:06 +02:00
|
|
|
|
/***** Shortcut to the couse *****/
|
|
|
|
|
CrsCfg_Shortcut (PrintView);
|
2019-12-29 12:39:00 +01:00
|
|
|
|
|
2021-05-27 00:30:06 +02:00
|
|
|
|
if (PrintView)
|
|
|
|
|
/***** QR code with link to the course *****/
|
|
|
|
|
CrsCfg_QR ();
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/***** Number of users *****/
|
2021-05-27 23:30:16 +02:00
|
|
|
|
HieCfg_NumUsrsInCrss (HieLvl_CRS,Gbl.Hierarchy.Crs.CrsCod,Rol_TCH);
|
|
|
|
|
HieCfg_NumUsrsInCrss (HieLvl_CRS,Gbl.Hierarchy.Crs.CrsCod,Rol_NET);
|
|
|
|
|
HieCfg_NumUsrsInCrss (HieLvl_CRS,Gbl.Hierarchy.Crs.CrsCod,Rol_STD);
|
|
|
|
|
HieCfg_NumUsrsInCrss (HieLvl_CRS,Gbl.Hierarchy.Crs.CrsCod,Rol_UNK);
|
2019-12-29 12:39:00 +01:00
|
|
|
|
|
2021-05-27 00:30:06 +02:00
|
|
|
|
/***** Indicators *****/
|
|
|
|
|
CrsCfg_Indicators ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** End table *****/
|
|
|
|
|
HTM_TABLE_End ();
|
2019-12-29 12:39:00 +01:00
|
|
|
|
|
|
|
|
|
/***** End of left part *****/
|
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
|
|
|
|
|
/***** End box *****/
|
|
|
|
|
Box_BoxEnd ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************* Put icon to print the configuration of a course ***************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-08 13:40:21 +02:00
|
|
|
|
static void CrsCfg_PutIconToPrint (__attribute__((unused)) void *Args)
|
2019-12-29 12:39:00 +01:00
|
|
|
|
{
|
2020-04-08 13:40:21 +02:00
|
|
|
|
Ico_PutContextualIconToPrint (ActPrnCrsInf,
|
|
|
|
|
NULL,NULL);
|
2019-12-29 12:39:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************** Print configuration of the current course *****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-29 13:13:09 +01:00
|
|
|
|
void CrsCfg_PrintConfiguration (void)
|
2019-12-29 12:39:00 +01:00
|
|
|
|
{
|
2019-12-29 13:13:09 +01:00
|
|
|
|
CrsCfg_Configuration (true);
|
2019-12-29 12:39:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************** Show title in course configuration *********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-29 13:13:09 +01:00
|
|
|
|
static void CrsCfg_Title (bool PutLink)
|
2019-12-29 12:39:00 +01:00
|
|
|
|
{
|
2019-12-29 20:11:57 +01:00
|
|
|
|
HieCfg_Title (PutLink,
|
2021-05-27 23:30:16 +02:00
|
|
|
|
HieLvl_DEG, // Logo scope
|
2021-05-27 00:30:06 +02:00
|
|
|
|
Gbl.Hierarchy.Deg.DegCod, // Logo code
|
|
|
|
|
Gbl.Hierarchy.Deg.ShrtName, // Logo short name
|
|
|
|
|
Gbl.Hierarchy.Deg.FullName, // Logo full name
|
|
|
|
|
Gbl.Hierarchy.Deg.WWW, // Logo www
|
|
|
|
|
Gbl.Hierarchy.Crs.FullName); // Text full name
|
2019-12-29 12:39:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************** Show degree in course configuration ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-29 13:13:09 +01:00
|
|
|
|
static void CrsCfg_Degree (bool PrintView,bool PutForm)
|
2019-12-29 12:39:00 +01:00
|
|
|
|
{
|
2023-03-06 23:53:45 +01:00
|
|
|
|
extern const char *Par_CodeStr[];
|
2019-12-29 12:39:00 +01:00
|
|
|
|
extern const char *Txt_Degree;
|
|
|
|
|
unsigned NumDeg;
|
2023-04-13 14:25:52 +02:00
|
|
|
|
const struct Deg_Degree *DegInLst;
|
2019-12-29 12:39:00 +01:00
|
|
|
|
|
|
|
|
|
/***** Degree *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
2021-05-27 00:30:06 +02:00
|
|
|
|
/* Label */
|
2023-03-10 17:21:04 +01:00
|
|
|
|
Frm_LabelColumn ("RT",PutForm ? Par_CodeStr[ParCod_OthDeg] :
|
2021-05-27 00:30:06 +02:00
|
|
|
|
NULL,
|
|
|
|
|
Txt_Degree);
|
|
|
|
|
|
|
|
|
|
/* Data */
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"LT DAT_%s\"",The_GetSuffix ());
|
2021-05-27 00:30:06 +02:00
|
|
|
|
if (PutForm)
|
|
|
|
|
{
|
|
|
|
|
/* Get list of degrees of the current center */
|
|
|
|
|
Deg_GetListDegsInCurrentCtr ();
|
|
|
|
|
|
|
|
|
|
/* Put form to select degree */
|
|
|
|
|
Frm_BeginForm (ActChgCrsDegCfg);
|
2023-03-30 21:50:11 +02:00
|
|
|
|
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL,
|
2021-05-27 00:30:06 +02:00
|
|
|
|
"id=\"OthDegCod\" name=\"OthDegCod\""
|
2022-03-30 00:46:18 +02:00
|
|
|
|
" class=\"INPUT_SHORT_NAME INPUT_%s\"",
|
2022-04-05 01:00:24 +02:00
|
|
|
|
The_GetSuffix ());
|
2021-05-27 00:30:06 +02:00
|
|
|
|
for (NumDeg = 0;
|
|
|
|
|
NumDeg < Gbl.Hierarchy.Degs.Num;
|
|
|
|
|
NumDeg++)
|
2023-04-13 14:25:52 +02:00
|
|
|
|
{
|
|
|
|
|
DegInLst = &Gbl.Hierarchy.Degs.Lst[NumDeg];
|
|
|
|
|
HTM_OPTION (HTM_Type_LONG,&DegInLst->DegCod,
|
2023-05-18 12:54:43 +02:00
|
|
|
|
DegInLst->DegCod == Gbl.Hierarchy.Deg.DegCod ? HTM_OPTION_SELECTED :
|
|
|
|
|
HTM_OPTION_UNSELECTED,
|
2023-04-14 00:07:06 +02:00
|
|
|
|
HTM_OPTION_ENABLED,
|
2023-04-13 14:25:52 +02:00
|
|
|
|
"%s",DegInLst->ShrtName);
|
|
|
|
|
}
|
2021-05-27 00:30:06 +02:00
|
|
|
|
HTM_SELECT_End ();
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
|
|
|
|
|
/* Free list of degrees of the current center */
|
|
|
|
|
Deg_FreeListDegs (&Gbl.Hierarchy.Degs);
|
|
|
|
|
}
|
|
|
|
|
else // I can not move course to another degree
|
|
|
|
|
{
|
|
|
|
|
if (!PrintView)
|
|
|
|
|
{
|
|
|
|
|
Frm_BeginFormGoTo (ActSeeDegInf);
|
2023-03-10 17:21:04 +01:00
|
|
|
|
ParCod_PutPar (ParCod_Deg,Gbl.Hierarchy.Deg.DegCod);
|
2022-04-01 01:06:44 +02:00
|
|
|
|
HTM_BUTTON_Submit_Begin (Str_BuildGoToTitle (Gbl.Hierarchy.Deg.ShrtName),
|
2022-09-09 12:50:53 +02:00
|
|
|
|
"class=\"LT BT_LINK\"");
|
2021-12-30 11:50:29 +01:00
|
|
|
|
Str_FreeGoToTitle ();
|
2021-05-27 00:30:06 +02:00
|
|
|
|
}
|
2021-05-27 23:30:16 +02:00
|
|
|
|
Lgo_DrawLogo (HieLvl_DEG,Gbl.Hierarchy.Deg.DegCod,Gbl.Hierarchy.Deg.ShrtName,
|
2023-05-30 22:57:14 +02:00
|
|
|
|
20,"LM");
|
2021-05-27 00:30:06 +02:00
|
|
|
|
HTM_NBSP ();
|
|
|
|
|
HTM_Txt (Gbl.Hierarchy.Deg.FullName);
|
|
|
|
|
if (!PrintView)
|
|
|
|
|
{
|
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
HTM_TD_End ();
|
2019-12-29 12:39:00 +01:00
|
|
|
|
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** Show course full name in course configuration ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-29 13:13:09 +01:00
|
|
|
|
static void CrsCfg_FullName (bool PutForm)
|
2019-12-29 12:39:00 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Course;
|
|
|
|
|
|
2019-12-29 20:11:57 +01:00
|
|
|
|
HieCfg_FullName (PutForm,Txt_Course,ActRenCrsFulCfg,
|
2019-12-29 12:39:00 +01:00
|
|
|
|
Gbl.Hierarchy.Crs.FullName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** Show course short name in course configuration ***************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-29 13:13:09 +01:00
|
|
|
|
static void CrsCfg_ShrtName (bool PutForm)
|
2019-12-29 12:39:00 +01:00
|
|
|
|
{
|
2019-12-29 20:11:57 +01:00
|
|
|
|
HieCfg_ShrtName (PutForm,ActRenCrsShoCfg,Gbl.Hierarchy.Crs.ShrtName);
|
2019-12-29 12:39:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************** Show course year in course configuration ******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-29 13:13:09 +01:00
|
|
|
|
static void CrsCfg_Year (bool PutForm)
|
2019-12-29 12:39:00 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Year_OF_A_DEGREE;
|
|
|
|
|
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
|
|
|
|
|
extern const char *Txt_Not_applicable;
|
|
|
|
|
unsigned Year;
|
|
|
|
|
|
|
|
|
|
/***** Academic year *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
2021-05-27 00:30:06 +02:00
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("RT",PutForm ? "OthCrsYear" :
|
|
|
|
|
NULL,
|
|
|
|
|
Txt_Year_OF_A_DEGREE);
|
|
|
|
|
|
|
|
|
|
/* Data */
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"LB DAT_%s\"",The_GetSuffix ());
|
2021-05-27 00:30:06 +02:00
|
|
|
|
if (PutForm)
|
|
|
|
|
{
|
|
|
|
|
Frm_BeginForm (ActChgCrsYeaCfg);
|
2023-03-30 21:50:11 +02:00
|
|
|
|
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,NULL,
|
2021-12-15 23:54:57 +01:00
|
|
|
|
"id=\"OthCrsYear\" name=\"OthCrsYear\""
|
2022-03-30 00:46:18 +02:00
|
|
|
|
" class=\"INPUT_%s\"",
|
2022-04-05 01:00:24 +02:00
|
|
|
|
The_GetSuffix ());
|
2022-03-30 00:46:18 +02:00
|
|
|
|
for (Year = 0;
|
2021-05-27 00:30:06 +02:00
|
|
|
|
Year <= Deg_MAX_YEARS_PER_DEGREE;
|
|
|
|
|
Year++)
|
|
|
|
|
HTM_OPTION (HTM_Type_UNSIGNED,&Year,
|
2023-05-18 12:54:43 +02:00
|
|
|
|
Year == Gbl.Hierarchy.Crs.Year ? HTM_OPTION_SELECTED :
|
|
|
|
|
HTM_OPTION_UNSELECTED,
|
2023-04-14 00:07:06 +02:00
|
|
|
|
HTM_OPTION_ENABLED,
|
2021-05-27 00:30:06 +02:00
|
|
|
|
"%s",Txt_YEAR_OF_DEGREE[Year]);
|
|
|
|
|
HTM_SELECT_End ();
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
HTM_Txt (Gbl.Hierarchy.Crs.Year ? Txt_YEAR_OF_DEGREE[Gbl.Hierarchy.Crs.Year] :
|
|
|
|
|
Txt_Not_applicable);
|
|
|
|
|
HTM_TD_End ();
|
2019-12-29 12:39:00 +01:00
|
|
|
|
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************* Show institutional code in course configuration ***************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-29 13:13:09 +01:00
|
|
|
|
static void CrsCfg_InstitutionalCode (bool PutForm)
|
2019-12-29 12:39:00 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Institutional_code;
|
|
|
|
|
|
|
|
|
|
/***** Institutional course code *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
2021-05-27 00:30:06 +02:00
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("RT",PutForm ? "InsCrsCod" :
|
|
|
|
|
NULL,
|
|
|
|
|
Txt_Institutional_code);
|
|
|
|
|
|
|
|
|
|
/* Data */
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"LB DAT_%s\"",The_GetSuffix ());
|
2021-05-27 00:30:06 +02:00
|
|
|
|
if (PutForm)
|
|
|
|
|
{
|
|
|
|
|
Frm_BeginForm (ActChgInsCrsCodCfg);
|
|
|
|
|
HTM_INPUT_TEXT ("InsCrsCod",Crs_MAX_CHARS_INSTITUTIONAL_CRS_COD,
|
|
|
|
|
Gbl.Hierarchy.Crs.InstitutionalCrsCod,
|
|
|
|
|
HTM_SUBMIT_ON_CHANGE,
|
2021-12-15 23:54:57 +01:00
|
|
|
|
"id=\"InsCrsCod\" size=\"%u\""
|
2022-03-30 00:46:18 +02:00
|
|
|
|
" class=\"INPUT_INS_CODE INPUT_%s\"",
|
2021-12-15 23:54:57 +01:00
|
|
|
|
Crs_MAX_CHARS_INSTITUTIONAL_CRS_COD,
|
2022-04-05 01:00:24 +02:00
|
|
|
|
The_GetSuffix ());
|
2021-05-27 00:30:06 +02:00
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
HTM_Txt (Gbl.Hierarchy.Crs.InstitutionalCrsCod);
|
|
|
|
|
HTM_TD_End ();
|
2019-12-29 12:39:00 +01:00
|
|
|
|
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************** Show internal code in course configuration *****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-29 13:13:09 +01:00
|
|
|
|
static void CrsCfg_InternalCode (void)
|
2019-12-29 12:39:00 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Internal_code;
|
|
|
|
|
|
|
|
|
|
/***** Internal course code *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
2021-05-27 00:30:06 +02:00
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("RT",NULL,Txt_Internal_code);
|
2019-12-29 12:39:00 +01:00
|
|
|
|
|
2021-05-27 00:30:06 +02:00
|
|
|
|
/* Data */
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"LB DAT_%s\"",The_GetSuffix ());
|
2021-05-27 00:30:06 +02:00
|
|
|
|
HTM_Long (Gbl.Hierarchy.Crs.CrsCod);
|
|
|
|
|
HTM_TD_End ();
|
2019-12-29 12:39:00 +01:00
|
|
|
|
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************** Show course shortcut in course configuration ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-29 13:13:09 +01:00
|
|
|
|
static void CrsCfg_Shortcut (bool PrintView)
|
2019-12-29 12:39:00 +01:00
|
|
|
|
{
|
2023-03-10 17:21:04 +01:00
|
|
|
|
HieCfg_Shortcut (PrintView,ParCod_Crs,Gbl.Hierarchy.Crs.CrsCod);
|
2019-12-29 12:39:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************** Show course QR in course configuration *******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-29 13:13:09 +01:00
|
|
|
|
static void CrsCfg_QR (void)
|
2019-12-29 12:39:00 +01:00
|
|
|
|
{
|
2023-03-10 17:21:04 +01:00
|
|
|
|
HieCfg_QR (ParCod_Crs,Gbl.Hierarchy.Crs.CrsCod);
|
2019-12-29 12:39:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************** Show indicators in course configuration ******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-29 13:13:09 +01:00
|
|
|
|
static void CrsCfg_Indicators (void)
|
2019-12-29 12:39:00 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Indicators;
|
|
|
|
|
extern const char *Txt_of_PART_OF_A_TOTAL;
|
2020-04-12 21:33:02 +02:00
|
|
|
|
struct Ind_IndicatorsCrs IndicatorsCrs;
|
2019-12-29 12:39:00 +01:00
|
|
|
|
int NumIndicatorsFromDB = Ind_GetNumIndicatorsCrsFromDB (Gbl.Hierarchy.Crs.CrsCod);
|
2019-12-30 22:32:06 +01:00
|
|
|
|
char *Title;
|
2019-12-29 12:39:00 +01:00
|
|
|
|
|
|
|
|
|
/***** Compute indicators ******/
|
|
|
|
|
Ind_ComputeAndStoreIndicatorsCrs (Gbl.Hierarchy.Crs.CrsCod,
|
2020-04-12 21:33:02 +02:00
|
|
|
|
NumIndicatorsFromDB,&IndicatorsCrs);
|
2019-12-29 12:39:00 +01:00
|
|
|
|
|
|
|
|
|
/***** Number of indicators *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
2021-05-27 00:30:06 +02:00
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("RT",NULL,Txt_Indicators);
|
|
|
|
|
|
|
|
|
|
/* Data */
|
2022-04-05 01:00:24 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"LB DAT_%s\"",The_GetSuffix ());
|
2021-05-27 00:30:06 +02:00
|
|
|
|
Frm_BeginForm (ActReqStaCrs);
|
|
|
|
|
if (asprintf (&Title,"%u %s %u",
|
|
|
|
|
IndicatorsCrs.NumIndicators,
|
|
|
|
|
Txt_of_PART_OF_A_TOTAL,Ind_NUM_INDICATORS) < 0)
|
|
|
|
|
Err_NotEnoughMemoryExit ();
|
2022-09-09 12:50:53 +02:00
|
|
|
|
HTM_BUTTON_Submit_Begin (Title,"class=\"LB BT_LINK\"");
|
2021-05-27 00:30:06 +02:00
|
|
|
|
HTM_TxtF ("%s ",Title);
|
2021-12-22 18:54:43 +01:00
|
|
|
|
if (IndicatorsCrs.NumIndicators == Ind_NUM_INDICATORS)
|
|
|
|
|
Ico_PutIcon ("check-circle.svg",Ico_GREEN,
|
|
|
|
|
Title,"ICO16x16");
|
|
|
|
|
else
|
2022-04-25 10:08:35 +02:00
|
|
|
|
Ico_PutIcon ("exclamation-triangle.svg",Ico_YELLOW,
|
2021-12-22 18:54:43 +01:00
|
|
|
|
Title,"ICO16x16");
|
2021-05-27 00:30:06 +02:00
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
free (Title);
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
HTM_TD_End ();
|
2019-12-29 12:39:00 +01:00
|
|
|
|
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
}
|
2019-12-29 14:20:17 +01:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************** Change the degree of the current course *******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-29 16:21:42 +01:00
|
|
|
|
void CrsCfg_ChangeCrsDeg (void)
|
2019-12-29 14:20:17 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z;
|
|
|
|
|
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
|
|
|
|
|
extern const char *Txt_The_course_X_has_been_moved_to_the_degree_Y;
|
2021-02-11 00:58:53 +01:00
|
|
|
|
struct Deg_Degree NewDeg;
|
2019-12-29 14:20:17 +01:00
|
|
|
|
|
|
|
|
|
/***** Get parameter with degree code *****/
|
2023-03-10 17:21:04 +01:00
|
|
|
|
NewDeg.DegCod = ParCod_GetAndCheckPar (ParCod_OthDeg);
|
2019-12-29 14:20:17 +01:00
|
|
|
|
|
|
|
|
|
/***** Check if degree has changed *****/
|
|
|
|
|
if (NewDeg.DegCod != Gbl.Hierarchy.Crs.DegCod)
|
|
|
|
|
{
|
|
|
|
|
/***** Get data of new degree *****/
|
2023-03-23 09:35:20 +01:00
|
|
|
|
Deg_GetDegreeDataByCod (&NewDeg);
|
2019-12-29 14:20:17 +01:00
|
|
|
|
|
|
|
|
|
/***** If name of course was in database in the new degree... *****/
|
2021-05-27 00:30:06 +02:00
|
|
|
|
if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.Hierarchy.Crs.ShrtName,-1L,
|
|
|
|
|
NewDeg.DegCod,Gbl.Hierarchy.Crs.Year))
|
2019-12-29 14:20:17 +01:00
|
|
|
|
Ale_CreateAlert (Ale_WARNING,NULL,
|
|
|
|
|
Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z,
|
|
|
|
|
Txt_YEAR_OF_DEGREE[Gbl.Hierarchy.Crs.Year],
|
|
|
|
|
NewDeg.FullName,
|
|
|
|
|
Gbl.Hierarchy.Crs.ShrtName);
|
2021-05-27 00:30:06 +02:00
|
|
|
|
else if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.Hierarchy.Crs.FullName,-1L,
|
|
|
|
|
NewDeg.DegCod,Gbl.Hierarchy.Crs.Year))
|
2019-12-29 14:20:17 +01:00
|
|
|
|
Ale_CreateAlert (Ale_WARNING,NULL,
|
|
|
|
|
Txt_In_the_year_X_of_the_degree_Y_already_existed_a_course_with_the_name_Z,
|
|
|
|
|
Txt_YEAR_OF_DEGREE[Gbl.Hierarchy.Crs.Year],
|
|
|
|
|
NewDeg.FullName,
|
|
|
|
|
Gbl.Hierarchy.Crs.FullName);
|
|
|
|
|
else // Update degree in database
|
|
|
|
|
{
|
|
|
|
|
/***** Update degree in table of courses *****/
|
2021-05-27 00:30:06 +02:00
|
|
|
|
Crs_DB_UpdateCrsDeg (Gbl.Hierarchy.Crs.CrsCod,NewDeg.DegCod);
|
2019-12-29 14:20:17 +01:00
|
|
|
|
Gbl.Hierarchy.Crs.DegCod =
|
|
|
|
|
Gbl.Hierarchy.Deg.DegCod = NewDeg.DegCod;
|
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Initialize again current course, degree, center... *****/
|
2019-12-29 14:20:17 +01:00
|
|
|
|
Hie_InitHierarchy ();
|
|
|
|
|
|
|
|
|
|
/***** Create alert to show the change made *****/
|
|
|
|
|
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
|
|
|
|
Txt_The_course_X_has_been_moved_to_the_degree_Y,
|
|
|
|
|
Gbl.Hierarchy.Crs.FullName,
|
|
|
|
|
Gbl.Hierarchy.Deg.FullName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************** Change the name of a course in configuration ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-29 16:21:42 +01:00
|
|
|
|
void CrsCfg_RenameCourseShort (void)
|
2019-12-29 14:20:17 +01:00
|
|
|
|
{
|
|
|
|
|
Crs_RenameCourse (&Gbl.Hierarchy.Crs,Cns_SHRT_NAME);
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-29 16:21:42 +01:00
|
|
|
|
void CrsCfg_RenameCourseFull (void)
|
2019-12-29 14:20:17 +01:00
|
|
|
|
{
|
|
|
|
|
Crs_RenameCourse (&Gbl.Hierarchy.Crs,Cns_FULL_NAME);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*********** Change the year of a course in course configuration *************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-29 16:21:42 +01:00
|
|
|
|
void CrsCfg_ChangeCrsYear (void)
|
2019-12-29 14:20:17 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_The_course_X_already_exists_in_year_Y;
|
|
|
|
|
extern const char *Txt_YEAR_OF_DEGREE[1 + Deg_MAX_YEARS_PER_DEGREE];
|
|
|
|
|
extern const char *Txt_The_year_of_the_course_X_has_changed;
|
|
|
|
|
extern const char *Txt_The_year_X_is_not_allowed;
|
|
|
|
|
char YearStr[2 + 1];
|
|
|
|
|
unsigned NewYear;
|
|
|
|
|
|
|
|
|
|
/***** Get parameter with year/semester *****/
|
2023-03-07 09:55:39 +01:00
|
|
|
|
Par_GetParText ("OthCrsYear",YearStr,2);
|
2019-12-29 14:20:17 +01:00
|
|
|
|
NewYear = Deg_ConvStrToYear (YearStr);
|
|
|
|
|
|
|
|
|
|
if (NewYear <= Deg_MAX_YEARS_PER_DEGREE) // If year is valid
|
|
|
|
|
{
|
|
|
|
|
/***** If name of course was in database in the new year... *****/
|
2021-05-27 00:30:06 +02:00
|
|
|
|
if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg ("ShortName",Gbl.Hierarchy.Crs.ShrtName,-1L,
|
|
|
|
|
Gbl.Hierarchy.Crs.DegCod,NewYear))
|
2019-12-29 14:20:17 +01:00
|
|
|
|
Ale_CreateAlert (Ale_WARNING,NULL,
|
|
|
|
|
Txt_The_course_X_already_exists_in_year_Y,
|
|
|
|
|
Gbl.Hierarchy.Crs.ShrtName,
|
|
|
|
|
Txt_YEAR_OF_DEGREE[NewYear]);
|
2021-05-27 00:30:06 +02:00
|
|
|
|
else if (Crs_DB_CheckIfCrsNameExistsInYearOfDeg ("FullName",Gbl.Hierarchy.Crs.FullName,-1L,
|
|
|
|
|
Gbl.Hierarchy.Crs.DegCod,NewYear))
|
2019-12-29 14:20:17 +01:00
|
|
|
|
Ale_CreateAlert (Ale_WARNING,NULL,
|
|
|
|
|
Txt_The_course_X_already_exists_in_year_Y,
|
|
|
|
|
Gbl.Hierarchy.Crs.FullName,
|
|
|
|
|
Txt_YEAR_OF_DEGREE[NewYear]);
|
|
|
|
|
else // Update year in database
|
|
|
|
|
{
|
|
|
|
|
/***** Update year in table of courses *****/
|
|
|
|
|
Crs_UpdateCrsYear (&Gbl.Hierarchy.Crs,NewYear);
|
|
|
|
|
|
|
|
|
|
/***** Create alert to show the change made *****/
|
|
|
|
|
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
|
|
|
|
Txt_The_year_of_the_course_X_has_changed,
|
|
|
|
|
Gbl.Hierarchy.Crs.ShrtName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else // Year not valid
|
|
|
|
|
Ale_CreateAlert (Ale_WARNING,NULL,
|
|
|
|
|
Txt_The_year_X_is_not_allowed,
|
|
|
|
|
NewYear);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***** Change the institutional code of a course in course configuration *****/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-29 16:21:42 +01:00
|
|
|
|
void CrsCfg_ChangeInsCrsCod (void)
|
2019-12-29 14:20:17 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_The_institutional_code_of_the_course_X_has_changed_to_Y;
|
|
|
|
|
extern const char *Txt_The_institutional_code_of_the_course_X_has_not_changed;
|
|
|
|
|
char NewInstitutionalCrsCod[Crs_MAX_BYTES_INSTITUTIONAL_CRS_COD + 1];
|
|
|
|
|
|
|
|
|
|
/***** Get institutional code from form *****/
|
2023-03-07 09:55:39 +01:00
|
|
|
|
Par_GetParText ("InsCrsCod",NewInstitutionalCrsCod,Crs_MAX_BYTES_INSTITUTIONAL_CRS_COD);
|
2019-12-29 14:20:17 +01:00
|
|
|
|
|
|
|
|
|
/***** Change the institutional course code *****/
|
|
|
|
|
if (strcmp (NewInstitutionalCrsCod,Gbl.Hierarchy.Crs.InstitutionalCrsCod))
|
|
|
|
|
{
|
|
|
|
|
Crs_UpdateInstitutionalCrsCod (&Gbl.Hierarchy.Crs,NewInstitutionalCrsCod);
|
|
|
|
|
|
|
|
|
|
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
|
|
|
|
Txt_The_institutional_code_of_the_course_X_has_changed_to_Y,
|
|
|
|
|
Gbl.Hierarchy.Crs.ShrtName,
|
|
|
|
|
NewInstitutionalCrsCod);
|
|
|
|
|
}
|
|
|
|
|
else // The same institutional code
|
|
|
|
|
Ale_CreateAlert (Ale_INFO,NULL,
|
|
|
|
|
Txt_The_institutional_code_of_the_course_X_has_not_changed,
|
|
|
|
|
Gbl.Hierarchy.Crs.ShrtName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/** Show message of success after changing a course in course configuration **/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-29 16:21:42 +01:00
|
|
|
|
void CrsCfg_ContEditAfterChgCrs (void)
|
2019-12-29 14:20:17 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Write error/success message *****/
|
|
|
|
|
Ale_ShowAlerts (NULL);
|
|
|
|
|
|
|
|
|
|
/***** Show the form again *****/
|
|
|
|
|
Crs_ShowIntroduction ();
|
|
|
|
|
}
|