2014-12-01 23:55:08 +01:00
|
|
|
|
// swad_record.c: users' record cards
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
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.
|
2021-02-09 12:43:45 +01:00
|
|
|
|
Copyright (C) 1999-2021 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 ***********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-29 16:43:07 +02:00
|
|
|
|
#define _GNU_SOURCE // For asprintf
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include <linux/limits.h> // For PATH_MAX
|
2019-12-29 12:39:00 +01:00
|
|
|
|
#include <stddef.h> // For NULL
|
2020-04-29 16:43:07 +02:00
|
|
|
|
#include <stdio.h> // For asprintf
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include <stdlib.h> // For calloc
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
2018-10-16 01:36:13 +02:00
|
|
|
|
#include "swad_account.h"
|
2021-06-11 10:46:53 +02:00
|
|
|
|
#include "swad_account_database.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_action.h"
|
2017-06-10 21:38:10 +02:00
|
|
|
|
#include "swad_box.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_config.h"
|
|
|
|
|
#include "swad_database.h"
|
2020-04-14 17:15:17 +02:00
|
|
|
|
#include "swad_department.h"
|
2021-06-09 20:27:57 +02:00
|
|
|
|
#include "swad_enrolment_database.h"
|
2021-04-26 15:27:27 +02:00
|
|
|
|
#include "swad_error.h"
|
2021-05-07 19:11:57 +02:00
|
|
|
|
#include "swad_follow_database.h"
|
2018-11-09 20:47:39 +01:00
|
|
|
|
#include "swad_form.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_global.h"
|
2021-05-27 23:30:16 +02:00
|
|
|
|
#include "swad_hierarchy_level.h"
|
2019-10-23 19:05:05 +02:00
|
|
|
|
#include "swad_HTML.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_ID.h"
|
2015-01-17 20:06:25 +01:00
|
|
|
|
#include "swad_logo.h"
|
2020-04-14 17:15:17 +02:00
|
|
|
|
#include "swad_message.h"
|
2021-09-27 23:59:50 +02:00
|
|
|
|
#include "swad_message_database.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_network.h"
|
|
|
|
|
#include "swad_parameter.h"
|
|
|
|
|
#include "swad_photo.h"
|
2016-12-09 13:59:33 +01:00
|
|
|
|
#include "swad_privacy.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_QR.h"
|
|
|
|
|
#include "swad_record.h"
|
2016-12-13 13:32:19 +01:00
|
|
|
|
#include "swad_role.h"
|
2019-03-26 11:53:21 +01:00
|
|
|
|
#include "swad_setting.h"
|
2020-04-14 17:15:17 +02:00
|
|
|
|
#include "swad_timetable.h"
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#include "swad_user.h"
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** External global variables from others modules ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
extern struct Globals Gbl;
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private constants *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2015-12-13 13:53:00 +01:00
|
|
|
|
#define Rec_INSTITUTION_LOGO_SIZE 64
|
|
|
|
|
#define Rec_DEGREE_LOGO_SIZE 64
|
2015-12-22 09:38:32 +01:00
|
|
|
|
|
2016-04-22 12:24:02 +02:00
|
|
|
|
#define Rec_USR_MIN_AGE 12 // years old
|
2015-12-22 09:38:32 +01:00
|
|
|
|
#define Rec_USR_MAX_AGE 120 // years old
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
#define Rec_SHOW_OFFICE_HOURS_DEFAULT true
|
|
|
|
|
|
2018-10-08 12:37:29 +02:00
|
|
|
|
#define Rec_MY_INS_CTR_DPT_ID "my_ins_ctr_dpt_section"
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Private prototypes ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Rec_WriteHeadingRecordFields (void);
|
2017-04-28 11:38:21 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
static unsigned Rec_DB_GetAllFieldsInCurrCrs (MYSQL_RES **mysql_res);
|
2021-04-17 01:08:48 +02:00
|
|
|
|
|
2020-04-08 22:09:35 +02:00
|
|
|
|
static void Rec_PutParamFieldCod (void *FieldCod);
|
2017-03-08 01:21:21 +01:00
|
|
|
|
static void Rec_GetFieldByCod (long FieldCod,char Name[Rec_MAX_BYTES_NAME_FIELD + 1],
|
2017-01-15 22:58:26 +01:00
|
|
|
|
unsigned *NumLines,Rec_VisibilityRecordFields_t *Visibility);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-05-09 20:56:02 +02:00
|
|
|
|
static void Rec_ListRecordsGsts (Rec_SharedRecordViewType_t TypeOfView);
|
|
|
|
|
|
2015-03-05 18:58:59 +01:00
|
|
|
|
static void Rec_ShowRecordOneStdCrs (void);
|
2016-11-18 00:17:53 +01:00
|
|
|
|
static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView,
|
|
|
|
|
Rec_CourseRecordViewType_t CrsTypeOfView);
|
2017-05-09 20:56:02 +02:00
|
|
|
|
|
2015-03-05 18:58:59 +01:00
|
|
|
|
static void Rec_ShowRecordOneTchCrs (void);
|
2017-05-09 20:56:02 +02:00
|
|
|
|
static void Rec_ListRecordsTchs (Rec_SharedRecordViewType_t TypeOfView);
|
2015-03-05 18:58:59 +01:00
|
|
|
|
|
2015-10-03 21:10:47 +02:00
|
|
|
|
static void Rec_ShowLinkToPrintPreviewOfRecords (void);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
static void Rec_GetParamRecordsPerPage (void);
|
2016-11-27 17:30:10 +01:00
|
|
|
|
static void Rec_WriteFormShowOfficeHoursOneTch (bool ShowOfficeHours);
|
|
|
|
|
static void Rec_WriteFormShowOfficeHoursSeveralTchs (bool ShowOfficeHours);
|
|
|
|
|
static void Rec_PutParamsShowOfficeHoursOneTch (void);
|
|
|
|
|
static void Rec_PutParamsShowOfficeHoursSeveralTchs (void);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
static bool Rec_GetParamShowOfficeHours (void);
|
2016-11-18 00:17:53 +01:00
|
|
|
|
static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
|
|
|
|
|
struct UsrData *UsrDat,const char *Anchor);
|
2015-03-30 13:59:32 +02:00
|
|
|
|
static void Rec_ShowMyCrsRecordUpdated (void);
|
2017-05-22 14:52:11 +02:00
|
|
|
|
static bool Rec_CheckIfICanEditField (Rec_VisibilityRecordFields_t Visibility);
|
2016-04-22 12:24:02 +02:00
|
|
|
|
|
2020-04-08 22:09:35 +02:00
|
|
|
|
static void Rec_PutIconsCommands (__attribute__((unused)) void *Args);
|
|
|
|
|
static void Rec_PutParamsMyTsts (__attribute__((unused)) void *Args);
|
|
|
|
|
static void Rec_PutParamsStdTsts (__attribute__((unused)) void *Args);
|
|
|
|
|
static void Rec_PutParamsWorks (__attribute__((unused)) void *Args);
|
|
|
|
|
static void Rec_PutParamsStudent (__attribute__((unused)) void *Args);
|
|
|
|
|
static void Rec_PutParamsMsgUsr (__attribute__((unused)) void *Args);
|
2021-02-11 00:58:53 +01:00
|
|
|
|
static void Rec_ShowInstitutionInHead (struct Ins_Instit *Ins,bool PutFormLinks);
|
2016-04-22 12:39:36 +02:00
|
|
|
|
static void Rec_ShowPhoto (struct UsrData *UsrDat);
|
2016-04-22 12:44:56 +02:00
|
|
|
|
static void Rec_ShowFullName (struct UsrData *UsrDat);
|
2016-04-22 19:50:59 +02:00
|
|
|
|
static void Rec_ShowNickname (struct UsrData *UsrDat,bool PutFormLinks);
|
2016-04-23 13:58:20 +02:00
|
|
|
|
static void Rec_ShowCountryInHead (struct UsrData *UsrDat,bool ShowData);
|
2016-04-22 20:00:26 +02:00
|
|
|
|
static void Rec_ShowWebsAndSocialNets (struct UsrData *UsrDat,
|
2016-11-18 00:17:53 +01:00
|
|
|
|
Rec_SharedRecordViewType_t TypeOfView);
|
2019-12-27 19:22:48 +01:00
|
|
|
|
static void Rec_ShowEmail (struct UsrData *UsrDat);
|
|
|
|
|
static void Rec_ShowUsrIDs (struct UsrData *UsrDat,const char *Anchor);
|
2016-04-23 13:23:09 +02:00
|
|
|
|
static void Rec_ShowRole (struct UsrData *UsrDat,
|
2019-12-27 19:22:48 +01:00
|
|
|
|
Rec_SharedRecordViewType_t TypeOfView);
|
|
|
|
|
static void Rec_ShowSurname1 (struct UsrData *UsrDat,bool PutForm);
|
|
|
|
|
static void Rec_ShowSurname2 (struct UsrData *UsrDat,bool PutForm);
|
|
|
|
|
static void Rec_ShowFirstName (struct UsrData *UsrDat,bool PutForm);
|
|
|
|
|
static void Rec_ShowCountry (struct UsrData *UsrDat,bool PutForm);
|
|
|
|
|
static void Rec_ShowDateOfBirth (struct UsrData *UsrDat,bool ShowData,bool PutForm);
|
2020-04-29 16:43:07 +02:00
|
|
|
|
static void Rec_ShowPhone (struct UsrData *UsrDat,bool ShowData,bool PutForm,
|
|
|
|
|
unsigned NumPhone);
|
2019-12-27 19:22:48 +01:00
|
|
|
|
static void Rec_ShowComments (struct UsrData *UsrDat,bool ShowData,bool PutForm);
|
2021-02-11 00:58:53 +01:00
|
|
|
|
static void Rec_ShowTeacherRows (struct UsrData *UsrDat,struct Ins_Instit *Ins,
|
2019-12-27 19:22:48 +01:00
|
|
|
|
bool ShowData);
|
2021-02-11 00:58:53 +01:00
|
|
|
|
static void Rec_ShowInstitution (struct Ins_Instit *Ins,bool ShowData);
|
2021-03-07 21:21:04 +01:00
|
|
|
|
static void Rec_ShowCenter (struct UsrData *UsrDat,bool ShowData);
|
2019-12-27 19:22:48 +01:00
|
|
|
|
static void Rec_ShowDepartment (struct UsrData *UsrDat,bool ShowData);
|
|
|
|
|
static void Rec_ShowOffice (struct UsrData *UsrDat,bool ShowData);
|
|
|
|
|
static void Rec_ShowOfficePhone (struct UsrData *UsrDat,bool ShowData);
|
2016-04-22 12:24:02 +02:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
static void Rec_WriteLinkToDataProtectionClause (void);
|
|
|
|
|
|
2015-12-07 23:13:08 +01:00
|
|
|
|
static void Rec_GetUsrExtraDataFromRecordForm (struct UsrData *UsrDat);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
static void Rec_GetUsrCommentsFromForm (struct UsrData *UsrDat);
|
2018-10-08 12:37:29 +02:00
|
|
|
|
|
2018-10-09 22:51:12 +02:00
|
|
|
|
static void Rec_ShowFormMyInsCtrDpt (bool IAmATeacher);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************** Create, edit and remove fields of records *******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_ReqEditRecordFields (void)
|
|
|
|
|
{
|
2017-03-20 11:30:19 +01:00
|
|
|
|
extern const char *Hlp_USERS_Students_course_record_card;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
extern const char *Txt_There_are_no_record_fields_in_the_course_X;
|
2015-03-24 17:47:26 +01:00
|
|
|
|
extern const char *Txt_Record_fields;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get list of fields of records in current course *****/
|
|
|
|
|
Rec_GetListRecordFieldsInCurrentCrs ();
|
|
|
|
|
|
|
|
|
|
/***** List the current fields of records for edit them *****/
|
2019-04-04 10:45:15 +02:00
|
|
|
|
if (Gbl.Crs.Records.LstFields.Num) // Fields found...
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2019-10-26 02:19:42 +02:00
|
|
|
|
/* Begin box and table */
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Box_BoxTableBegin (NULL,Txt_Record_fields,
|
|
|
|
|
NULL,NULL,
|
2017-06-12 15:03:29 +02:00
|
|
|
|
Hlp_USERS_Students_course_record_card,Box_NOT_CLOSABLE,2);
|
2017-06-12 14:16:33 +02:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Rec_ListFieldsRecordsForEdition ();
|
2017-06-12 14:16:33 +02:00
|
|
|
|
|
|
|
|
|
/* End table and box */
|
2019-11-25 23:18:08 +01:00
|
|
|
|
Box_BoxTableEnd ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
else // No fields of records found for current course in the database
|
2019-02-16 18:25:41 +01:00
|
|
|
|
Ale_ShowAlert (Ale_INFO,Txt_There_are_no_record_fields_in_the_course_X,
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Hierarchy.Crs.FullName);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Put a form to create a new record field *****/
|
|
|
|
|
Rec_ShowFormCreateRecordField ();
|
|
|
|
|
|
|
|
|
|
/* Free list of fields of records */
|
|
|
|
|
Rec_FreeListFields ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****** Create a list with the fields of records from current course *********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_GetListRecordFieldsInCurrentCrs (void)
|
|
|
|
|
{
|
|
|
|
|
MYSQL_RES *mysql_res;
|
|
|
|
|
MYSQL_ROW row;
|
|
|
|
|
unsigned long NumRow;
|
|
|
|
|
unsigned Vis;
|
|
|
|
|
|
2019-04-04 10:45:15 +02:00
|
|
|
|
if (++Gbl.Crs.Records.LstFields.NestedCalls > 1) // If the list is already created, don't do anything
|
2014-12-01 23:55:08 +01:00
|
|
|
|
return;
|
|
|
|
|
|
2018-11-01 19:23:52 +01:00
|
|
|
|
/***** Get fields of records in a course from database *****/
|
2021-03-29 16:38:56 +02:00
|
|
|
|
Gbl.Crs.Records.LstFields.Num = (unsigned)
|
|
|
|
|
DB_QuerySELECT (&mysql_res,"can not get fields of records in a course",
|
2021-04-05 23:45:24 +02:00
|
|
|
|
"SELECT FieldCod," // row[0]
|
|
|
|
|
"FieldName," // row[1]
|
|
|
|
|
"NumLines," // row[2]
|
|
|
|
|
"Visibility" // row[3]
|
2021-03-29 16:38:56 +02:00
|
|
|
|
" FROM crs_record_fields"
|
|
|
|
|
" WHERE CrsCod=%ld"
|
|
|
|
|
" ORDER BY FieldName",
|
|
|
|
|
Gbl.Hierarchy.Crs.CrsCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get the fields of records *****/
|
2019-04-04 10:45:15 +02:00
|
|
|
|
if (Gbl.Crs.Records.LstFields.Num)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Create a list of fields *****/
|
2021-02-15 16:25:55 +01:00
|
|
|
|
if ((Gbl.Crs.Records.LstFields.Lst = calloc (Gbl.Crs.Records.LstFields.Num,
|
|
|
|
|
sizeof (*Gbl.Crs.Records.LstFields.Lst))) == NULL)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_NotEnoughMemoryExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get the fields *****/
|
|
|
|
|
for (NumRow = 0;
|
2019-04-04 10:45:15 +02:00
|
|
|
|
NumRow < Gbl.Crs.Records.LstFields.Num;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
NumRow++)
|
|
|
|
|
{
|
|
|
|
|
/* Get next field */
|
|
|
|
|
row = mysql_fetch_row (mysql_res);
|
|
|
|
|
|
|
|
|
|
/* Get the code of field (row[0]) */
|
2021-04-25 20:36:48 +02:00
|
|
|
|
if ((Gbl.Crs.Records.LstFields.Lst[NumRow].FieldCod = Str_ConvertStrCodToLongCod (row[0])) <= 0)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongRecordFieldExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Name of the field (row[1]) */
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Str_Copy (Gbl.Crs.Records.LstFields.Lst[NumRow].Name,row[1],
|
2021-02-15 16:25:55 +01:00
|
|
|
|
sizeof (Gbl.Crs.Records.LstFields.Lst[NumRow].Name) - 1);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Number of lines (row[2]) */
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.LstFields.Lst[NumRow].NumLines = Rec_ConvertToNumLinesField (row[2]);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Visible or editable by students? (row[3]) */
|
|
|
|
|
if (sscanf (row[3],"%u",&Vis) != 1)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongRecordFieldExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
if (Vis < Rec_NUM_TYPES_VISIBILITY)
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.LstFields.Lst[NumRow].Visibility = (Rec_VisibilityRecordFields_t) Vis;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
else
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.LstFields.Lst[NumRow].Visibility = Rec_VISIBILITY_DEFAULT;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Free structure that stores the query result *****/
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********* List the fields of records already present in database ************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_ListFieldsRecordsForEdition (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_RECORD_FIELD_VISIBILITY_MENU[Rec_NUM_TYPES_VISIBILITY];
|
|
|
|
|
unsigned NumField;
|
|
|
|
|
Rec_VisibilityRecordFields_t Vis;
|
2019-11-06 15:27:33 +01:00
|
|
|
|
unsigned VisUnsigned;
|
2019-11-08 01:10:32 +01:00
|
|
|
|
char StrNumLines[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Write heading *****/
|
|
|
|
|
Rec_WriteHeadingRecordFields ();
|
|
|
|
|
|
|
|
|
|
/***** List the fields *****/
|
|
|
|
|
for (NumField = 0;
|
2019-04-04 10:45:15 +02:00
|
|
|
|
NumField < Gbl.Crs.Records.LstFields.Num;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
NumField++)
|
|
|
|
|
{
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Write icon to remove the field */
|
|
|
|
|
HTM_TD_Begin ("class=\"BM\"");
|
|
|
|
|
Ico_PutContextualIconToRemove (ActReqRemFie,NULL,
|
|
|
|
|
Rec_PutParamFieldCod,&Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/* Name of the field */
|
|
|
|
|
HTM_TD_Begin ("class=\"LM\"");
|
|
|
|
|
Frm_BeginForm (ActRenFie);
|
|
|
|
|
Rec_PutParamFieldCod (&Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod);
|
|
|
|
|
HTM_INPUT_TEXT ("FieldName",Rec_MAX_CHARS_NAME_FIELD,
|
|
|
|
|
Gbl.Crs.Records.LstFields.Lst[NumField].Name,
|
|
|
|
|
HTM_SUBMIT_ON_CHANGE,
|
|
|
|
|
"class=\"REC_FIELDNAME\"");
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/* Number of lines in the form */
|
|
|
|
|
HTM_TD_Begin ("class=\"CM\"");
|
|
|
|
|
Frm_BeginForm (ActChgRowFie);
|
|
|
|
|
Rec_PutParamFieldCod (&Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod);
|
|
|
|
|
snprintf (StrNumLines,sizeof (StrNumLines),"%u",
|
|
|
|
|
Gbl.Crs.Records.LstFields.Lst[NumField].NumLines);
|
|
|
|
|
HTM_INPUT_TEXT ("NumLines",Cns_MAX_DECIMAL_DIGITS_UINT,StrNumLines,
|
|
|
|
|
HTM_SUBMIT_ON_CHANGE,
|
|
|
|
|
"size=\"2\"");
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/* Visibility of a field */
|
|
|
|
|
HTM_TD_Begin ("class=\"CM\"");
|
|
|
|
|
Frm_BeginForm (ActChgVisFie);
|
|
|
|
|
Rec_PutParamFieldCod (&Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod);
|
|
|
|
|
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,
|
|
|
|
|
"name=\"Visibility\"");
|
|
|
|
|
for (Vis = (Rec_VisibilityRecordFields_t) 0;
|
|
|
|
|
Vis <= (Rec_VisibilityRecordFields_t) (Rec_NUM_TYPES_VISIBILITY - 1);
|
|
|
|
|
Vis++)
|
|
|
|
|
{
|
|
|
|
|
VisUnsigned = (unsigned) Vis;
|
|
|
|
|
HTM_OPTION (HTM_Type_UNSIGNED,&VisUnsigned,
|
|
|
|
|
Gbl.Crs.Records.LstFields.Lst[NumField].Visibility == Vis,false,
|
|
|
|
|
"%s",Txt_RECORD_FIELD_VISIBILITY_MENU[Vis]);
|
|
|
|
|
}
|
|
|
|
|
HTM_SELECT_End ();
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
HTM_TD_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************* Show form to create a new record field ******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_ShowFormCreateRecordField (void)
|
|
|
|
|
{
|
2017-03-20 11:30:19 +01:00
|
|
|
|
extern const char *Hlp_USERS_Students_course_record_card;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
extern const char *Txt_New_record_field;
|
|
|
|
|
extern const char *Txt_RECORD_FIELD_VISIBILITY_MENU[Rec_NUM_TYPES_VISIBILITY];
|
|
|
|
|
extern const char *Txt_Create_record_field;
|
|
|
|
|
Rec_VisibilityRecordFields_t Vis;
|
2019-11-06 15:27:33 +01:00
|
|
|
|
unsigned VisUnsigned;
|
2019-11-08 01:10:32 +01:00
|
|
|
|
char StrNumLines[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-10-20 22:00:28 +02:00
|
|
|
|
/***** Begin form *****/
|
2021-03-02 00:54:26 +01:00
|
|
|
|
Frm_BeginForm (ActNewFie);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Begin box and table *****/
|
|
|
|
|
Box_BoxTableBegin (NULL,Txt_New_record_field,
|
|
|
|
|
NULL,NULL,
|
|
|
|
|
Hlp_USERS_Students_course_record_card,Box_NOT_CLOSABLE,2);
|
|
|
|
|
|
|
|
|
|
/***** Write heading *****/
|
|
|
|
|
Rec_WriteHeadingRecordFields ();
|
|
|
|
|
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
|
|
|
|
/***** Write disabled icon to remove the field *****/
|
|
|
|
|
HTM_TD_Begin ("class=\"BM\"");
|
|
|
|
|
Ico_PutIconRemovalNotAllowed ();
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Field name *****/
|
|
|
|
|
HTM_TD_Begin ("class=\"LM\"");
|
|
|
|
|
HTM_INPUT_TEXT ("FieldName",Rec_MAX_CHARS_NAME_FIELD,Gbl.Crs.Records.Field.Name,
|
|
|
|
|
HTM_DONT_SUBMIT_ON_CHANGE,
|
|
|
|
|
"class=\"REC_FIELDNAME\" required=\"required\"");
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Number of lines in form ******/
|
|
|
|
|
HTM_TD_Begin ("class=\"CM\"");
|
|
|
|
|
snprintf (StrNumLines,sizeof (StrNumLines),"%u",
|
|
|
|
|
Gbl.Crs.Records.Field.NumLines);
|
|
|
|
|
HTM_INPUT_TEXT ("NumLines",Cns_MAX_DECIMAL_DIGITS_UINT,StrNumLines,
|
|
|
|
|
HTM_DONT_SUBMIT_ON_CHANGE,
|
|
|
|
|
"size=\"2\" required=\"required\"");
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
/***** Visibility to students *****/
|
|
|
|
|
HTM_TD_Begin ("class=\"CM\"");
|
|
|
|
|
HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,
|
|
|
|
|
"name=\"Visibility\"");
|
|
|
|
|
for (Vis = (Rec_VisibilityRecordFields_t) 0;
|
|
|
|
|
Vis <= (Rec_VisibilityRecordFields_t) (Rec_NUM_TYPES_VISIBILITY - 1);
|
|
|
|
|
Vis++)
|
|
|
|
|
{
|
|
|
|
|
VisUnsigned = (unsigned) Vis;
|
|
|
|
|
HTM_OPTION (HTM_Type_UNSIGNED,&VisUnsigned,
|
|
|
|
|
Gbl.Crs.Records.Field.Visibility == Vis,false,
|
|
|
|
|
"%s",Txt_RECORD_FIELD_VISIBILITY_MENU[Vis]);
|
|
|
|
|
}
|
|
|
|
|
HTM_SELECT_End ();
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_TR_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** End table, send button and end box *****/
|
|
|
|
|
Box_BoxTableWithButtonEnd (Btn_CREATE_BUTTON,Txt_Create_record_field);
|
2015-03-24 17:47:26 +01:00
|
|
|
|
|
2015-04-11 23:46:21 +02:00
|
|
|
|
/***** End form *****/
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************** Write heading of groups **************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Rec_WriteHeadingRecordFields (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Field_BR_name;
|
2020-05-07 14:15:39 +02:00
|
|
|
|
extern const char *Txt_Number_of_BR_lines;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
extern const char *Txt_Visible_by_BR_the_student;
|
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_TH_Empty (1);
|
|
|
|
|
HTM_TH (1,1,"CM",Txt_Field_BR_name);
|
|
|
|
|
HTM_TH (1,1,"CM",Txt_Number_of_BR_lines);
|
|
|
|
|
HTM_TH (1,1,"CM",Txt_Visible_by_BR_the_student);
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************** Receive data from a form of record fields *******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_ReceiveFormField (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_The_record_field_X_already_exists;
|
|
|
|
|
extern const char *Txt_You_must_specify_the_name_of_the_new_record_field;
|
|
|
|
|
|
|
|
|
|
/***** Get parameters from the form *****/
|
|
|
|
|
/* Get the name of the field */
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Par_GetParToText ("FieldName",Gbl.Crs.Records.Field.Name,
|
2017-03-11 18:59:13 +01:00
|
|
|
|
Rec_MAX_BYTES_NAME_FIELD);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get the number of lines */
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.Field.NumLines = (unsigned)
|
2017-01-29 21:41:08 +01:00
|
|
|
|
Par_GetParToUnsignedLong ("NumLines",
|
|
|
|
|
Rec_MIN_LINES_IN_EDITION_FIELD,
|
|
|
|
|
Rec_MAX_LINES_IN_EDITION_FIELD,
|
|
|
|
|
Rec_DEF_LINES_IN_EDITION_FIELD);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get the field visibility by students */
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.Field.Visibility = (Rec_VisibilityRecordFields_t)
|
2017-01-29 21:41:08 +01:00
|
|
|
|
Par_GetParToUnsignedLong ("Visibility",
|
|
|
|
|
0,
|
|
|
|
|
Rec_NUM_TYPES_VISIBILITY - 1,
|
|
|
|
|
(unsigned long) Rec_VISIBILITY_DEFAULT);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-04-04 10:45:15 +02:00
|
|
|
|
if (Gbl.Crs.Records.Field.Name[0]) // If there's a name
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/***** If the field already was in the database... *****/
|
2019-04-04 10:45:15 +02:00
|
|
|
|
if (Rec_CheckIfRecordFieldIsRepeated (Gbl.Crs.Records.Field.Name))
|
2019-02-16 18:25:41 +01:00
|
|
|
|
Ale_ShowAlert (Ale_ERROR,Txt_The_record_field_X_already_exists,
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.Field.Name);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
else // Add the new field to the database
|
|
|
|
|
Rec_CreateRecordField ();
|
|
|
|
|
}
|
|
|
|
|
else // If there is not name
|
2019-02-16 18:25:41 +01:00
|
|
|
|
Ale_ShowAlert (Ale_ERROR,Txt_You_must_specify_the_name_of_the_new_record_field);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Show the form again *****/
|
|
|
|
|
Rec_ReqEditRecordFields ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********* Get number of lines of the form to edit a record field ************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
unsigned Rec_ConvertToNumLinesField (const char *StrNumLines)
|
|
|
|
|
{
|
2019-11-08 01:10:32 +01:00
|
|
|
|
unsigned NumLines;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-11-08 01:10:32 +01:00
|
|
|
|
if (sscanf (StrNumLines,"%u",&NumLines) != 1)
|
2017-01-29 12:42:19 +01:00
|
|
|
|
return Rec_DEF_LINES_IN_EDITION_FIELD;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
else if (NumLines < Rec_MIN_LINES_IN_EDITION_FIELD)
|
|
|
|
|
return Rec_MIN_LINES_IN_EDITION_FIELD;
|
|
|
|
|
else if (NumLines > Rec_MAX_LINES_IN_EDITION_FIELD)
|
|
|
|
|
return Rec_MAX_LINES_IN_EDITION_FIELD;
|
2019-11-08 01:10:32 +01:00
|
|
|
|
return NumLines;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* Check if the name of the field of record equals any of the existing ones **/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
bool Rec_CheckIfRecordFieldIsRepeated (const char *FieldName)
|
|
|
|
|
{
|
|
|
|
|
bool FieldIsRepeated = false;
|
|
|
|
|
MYSQL_RES *mysql_res;
|
|
|
|
|
MYSQL_ROW row;
|
2021-04-17 01:08:48 +02:00
|
|
|
|
unsigned NumRows;
|
|
|
|
|
unsigned NumRow;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Query database */
|
2021-07-08 15:00:17 +02:00
|
|
|
|
if ((NumRows = Rec_DB_GetAllFieldsInCurrCrs (&mysql_res)) > 0) // If se han encontrado groups...
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/* Compare with all the tipos of group from the database */
|
|
|
|
|
for (NumRow = 0;
|
|
|
|
|
NumRow < NumRows;
|
|
|
|
|
NumRow++)
|
|
|
|
|
{
|
|
|
|
|
/* Get next type of group */
|
|
|
|
|
row = mysql_fetch_row (mysql_res);
|
|
|
|
|
|
|
|
|
|
/* The name of the field is in row[1] */
|
|
|
|
|
if (!strcasecmp (FieldName,row[1]))
|
|
|
|
|
{
|
|
|
|
|
FieldIsRepeated = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Free structure that stores the query result */
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
|
|
|
|
|
|
|
|
|
return FieldIsRepeated;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******* Get the fields of records already present in current course *********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
static unsigned Rec_DB_GetAllFieldsInCurrCrs (MYSQL_RES **mysql_res)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2018-11-01 19:23:52 +01:00
|
|
|
|
/***** Get fields of records in current course from database *****/
|
|
|
|
|
return DB_QuerySELECT (mysql_res,"can not get fields of records"
|
|
|
|
|
" in a course",
|
2021-03-29 16:38:56 +02:00
|
|
|
|
"SELECT FieldCod," // row[0]
|
|
|
|
|
"FieldName," // row[1]
|
|
|
|
|
"Visibility" // row[2]
|
|
|
|
|
" FROM crs_record_fields"
|
|
|
|
|
" WHERE CrsCod=%ld"
|
|
|
|
|
" ORDER BY FieldName",
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Hierarchy.Crs.CrsCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************* Create a field of record **************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_CreateRecordField (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Created_new_record_field_X;
|
|
|
|
|
|
|
|
|
|
/***** Create the new field *****/
|
2018-11-02 19:37:11 +01:00
|
|
|
|
DB_QueryINSERT ("can not create field of record",
|
|
|
|
|
"INSERT INTO crs_record_fields"
|
|
|
|
|
" (CrsCod,FieldName,NumLines,Visibility)"
|
|
|
|
|
" VALUES"
|
|
|
|
|
" (%ld,'%s',%u,%u)",
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Hierarchy.Crs.CrsCod,
|
|
|
|
|
Gbl.Crs.Records.Field.Name,
|
|
|
|
|
Gbl.Crs.Records.Field.NumLines,
|
|
|
|
|
(unsigned) Gbl.Crs.Records.Field.Visibility);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2014-12-27 19:43:01 +01:00
|
|
|
|
/***** Write message of success *****/
|
2019-02-17 01:14:55 +01:00
|
|
|
|
Ale_ShowAlert (Ale_SUCCESS,Txt_Created_new_record_field_X,
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.Field.Name);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************** Request the removing of a field of records *****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_ReqRemField (void)
|
|
|
|
|
{
|
|
|
|
|
unsigned NumRecords;
|
|
|
|
|
|
|
|
|
|
/***** Get the code of field *****/
|
2021-04-25 20:36:48 +02:00
|
|
|
|
if ((Gbl.Crs.Records.Field.FieldCod = Rec_GetFieldCod ()) <= 0)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongRecordFieldExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Check if exists any record with that field filled *****/
|
2021-07-08 15:00:17 +02:00
|
|
|
|
if ((NumRecords = Rec_DB_CountNumRecordsInCurrCrsWithField (Gbl.Crs.Records.Field.FieldCod))) // There are records with that field filled
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Rec_AskConfirmRemFieldWithRecords (NumRecords);
|
|
|
|
|
else // There are no records with that field filled
|
|
|
|
|
Rec_RemoveFieldFromDB ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************ Get a parameter with a code of field of records ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
long Rec_GetFieldCod (void)
|
|
|
|
|
{
|
|
|
|
|
/***** Get the code of the field *****/
|
2017-01-28 20:32:50 +01:00
|
|
|
|
return Par_GetParToLong ("FieldCod");
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************** Get the number of records with a field filled ***************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
unsigned Rec_DB_CountNumRecordsInCurrCrsWithField (long FieldCod)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Get number of cards with a given field in a course from database *****/
|
2021-04-17 01:57:19 +02:00
|
|
|
|
return (unsigned)
|
|
|
|
|
DB_QueryCOUNT ("can not get number of records"
|
|
|
|
|
" with a given field not empty in a course",
|
|
|
|
|
"SELECT COUNT(*)"
|
|
|
|
|
" FROM crs_records"
|
|
|
|
|
" WHERE FieldCod=%ld",
|
|
|
|
|
FieldCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******* Request confirmation for the removing of a field with records *******/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_AskConfirmRemFieldWithRecords (unsigned NumRecords)
|
|
|
|
|
{
|
2019-02-17 01:14:55 +01:00
|
|
|
|
extern const char *Txt_Do_you_really_want_to_remove_the_field_X_from_the_records_of_Y_Z_;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
extern const char *Txt_Remove_record_field;
|
|
|
|
|
|
|
|
|
|
/***** Get from the database the name of the field *****/
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Rec_GetFieldByCod (Gbl.Crs.Records.Field.FieldCod,
|
|
|
|
|
Gbl.Crs.Records.Field.Name,
|
|
|
|
|
&Gbl.Crs.Records.Field.NumLines,
|
|
|
|
|
&Gbl.Crs.Records.Field.Visibility);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-04-28 11:38:21 +02:00
|
|
|
|
/***** Show question and button to remove my photo *****/
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Ale_ShowAlertAndButton (ActRemFie,NULL,NULL,
|
2020-04-08 22:09:35 +02:00
|
|
|
|
Rec_PutParamFieldCod,&Gbl.Crs.Records.Field.FieldCod,
|
2019-02-17 01:14:55 +01:00
|
|
|
|
Btn_REMOVE_BUTTON,Txt_Remove_record_field,
|
|
|
|
|
Ale_QUESTION,Txt_Do_you_really_want_to_remove_the_field_X_from_the_records_of_Y_Z_,
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.Field.Name,Gbl.Hierarchy.Crs.FullName,
|
2019-02-17 01:14:55 +01:00
|
|
|
|
NumRecords);
|
2017-04-28 11:38:21 +02:00
|
|
|
|
|
|
|
|
|
/***** List record fields again *****/
|
|
|
|
|
Rec_ReqEditRecordFields ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** Remove from the database a field of records ******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_RemoveFieldFromDB (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Record_field_X_removed;
|
|
|
|
|
|
|
|
|
|
/***** Get from the database the name of the field *****/
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Rec_GetFieldByCod (Gbl.Crs.Records.Field.FieldCod,
|
|
|
|
|
Gbl.Crs.Records.Field.Name,
|
|
|
|
|
&Gbl.Crs.Records.Field.NumLines,
|
|
|
|
|
&Gbl.Crs.Records.Field.Visibility);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Remove field from all records *****/
|
2018-11-02 22:00:31 +01:00
|
|
|
|
DB_QueryDELETE ("can not remove field from all students' records",
|
2021-04-17 13:40:55 +02:00
|
|
|
|
"DELETE FROM crs_records"
|
|
|
|
|
" WHERE FieldCod=%ld",
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.Field.FieldCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Remove the field *****/
|
2018-11-02 22:00:31 +01:00
|
|
|
|
DB_QueryDELETE ("can not remove field of record",
|
2021-04-17 13:40:55 +02:00
|
|
|
|
"DELETE FROM crs_record_fields"
|
|
|
|
|
" WHERE FieldCod=%ld",
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.Field.FieldCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Write message to show the change made *****/
|
2019-02-16 18:25:41 +01:00
|
|
|
|
Ale_ShowAlert (Ale_SUCCESS,Txt_Record_field_X_removed,
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.Field.Name);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Show the form again *****/
|
|
|
|
|
Rec_ReqEditRecordFields ();
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-28 11:38:21 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************** Put parameter with field code ************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-08 22:09:35 +02:00
|
|
|
|
static void Rec_PutParamFieldCod (void *FieldCod)
|
2017-04-28 11:38:21 +02:00
|
|
|
|
{
|
2020-04-08 22:09:35 +02:00
|
|
|
|
if (FieldCod)
|
|
|
|
|
Par_PutHiddenParamLong (NULL,"FieldCod",*((long *) FieldCod));
|
2017-04-28 11:38:21 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** Get the data of a field of records from its code *************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-03-08 01:21:21 +01:00
|
|
|
|
static void Rec_GetFieldByCod (long FieldCod,char Name[Rec_MAX_BYTES_NAME_FIELD + 1],
|
2017-01-15 22:58:26 +01:00
|
|
|
|
unsigned *NumLines,Rec_VisibilityRecordFields_t *Visibility)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
MYSQL_RES *mysql_res;
|
|
|
|
|
MYSQL_ROW row;
|
|
|
|
|
unsigned Vis;
|
|
|
|
|
|
|
|
|
|
/***** Get a field of a record in a course from database *****/
|
2021-04-17 01:08:48 +02:00
|
|
|
|
if (DB_QuerySELECT (&mysql_res,"can not get a field of a record in a course",
|
|
|
|
|
"SELECT FieldName," // row[0]
|
2021-04-25 20:36:48 +02:00
|
|
|
|
"NumLines," // row[1]
|
2021-04-17 01:08:48 +02:00
|
|
|
|
"Visibility" // row[2]
|
|
|
|
|
" FROM crs_record_fields"
|
|
|
|
|
" WHERE CrsCod=%ld"
|
|
|
|
|
" AND FieldCod=%ld",
|
|
|
|
|
Gbl.Hierarchy.Crs.CrsCod,FieldCod) != 1)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongRecordFieldExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get the field *****/
|
|
|
|
|
row = mysql_fetch_row (mysql_res);
|
|
|
|
|
|
|
|
|
|
/* Name of the field */
|
2021-02-15 16:25:55 +01:00
|
|
|
|
Str_Copy (Name,row[0],Rec_MAX_BYTES_NAME_FIELD);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Number of lines of the field (row[1]) */
|
|
|
|
|
*NumLines = Rec_ConvertToNumLinesField (row[1]);
|
|
|
|
|
|
|
|
|
|
/* Visible or editable by students? (row[2]) */
|
|
|
|
|
if (sscanf (row[2],"%u",&Vis) != 1)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongRecordFieldExit ();
|
2021-07-08 15:00:17 +02:00
|
|
|
|
*Visibility = (Vis < Rec_NUM_TYPES_VISIBILITY) ? (Rec_VisibilityRecordFields_t) Vis :
|
|
|
|
|
Rec_VISIBILITY_DEFAULT;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Free structure that stores the query result *****/
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************* Remove a field of records *************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_RemoveField (void)
|
|
|
|
|
{
|
|
|
|
|
/***** Get the code of the field *****/
|
2021-04-25 20:36:48 +02:00
|
|
|
|
if ((Gbl.Crs.Records.Field.FieldCod = Rec_GetFieldCod ()) <= 0)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongRecordFieldExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Borrarlo from the database *****/
|
|
|
|
|
Rec_RemoveFieldFromDB ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************** Rename a field of records ************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_RenameField (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_The_record_field_X_already_exists;
|
|
|
|
|
extern const char *Txt_The_record_field_X_has_been_renamed_as_Y;
|
|
|
|
|
extern const char *Txt_The_name_of_the_field_X_has_not_changed;
|
2017-03-08 01:21:21 +01:00
|
|
|
|
char NewFieldName[Rec_MAX_BYTES_NAME_FIELD + 1];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get parameters of the form *****/
|
|
|
|
|
/* Get the code of the field */
|
2021-04-25 20:36:48 +02:00
|
|
|
|
if ((Gbl.Crs.Records.Field.FieldCod = Rec_GetFieldCod ()) <= 0)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongRecordFieldExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get the new group name */
|
2017-03-08 01:21:21 +01:00
|
|
|
|
Par_GetParToText ("FieldName",NewFieldName,Rec_MAX_BYTES_NAME_FIELD);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-01-02 15:10:51 +01:00
|
|
|
|
/***** Get from the database the old field name *****/
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Rec_GetFieldByCod (Gbl.Crs.Records.Field.FieldCod,
|
|
|
|
|
Gbl.Crs.Records.Field.Name,
|
|
|
|
|
&Gbl.Crs.Records.Field.NumLines,
|
|
|
|
|
&Gbl.Crs.Records.Field.Visibility);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Check if new name is empty *****/
|
2019-12-20 00:30:54 +01:00
|
|
|
|
if (NewFieldName[0])
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Check if the name of the olde field match the new one
|
|
|
|
|
(this happens when return is pressed without changes) *****/
|
2019-04-04 10:45:15 +02:00
|
|
|
|
if (strcmp (Gbl.Crs.Records.Field.Name,NewFieldName)) // Different names
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/***** If the group ya estaba in the database... *****/
|
|
|
|
|
if (Rec_CheckIfRecordFieldIsRepeated (NewFieldName))
|
2019-02-16 18:25:41 +01:00
|
|
|
|
Ale_ShowAlert (Ale_ERROR,Txt_The_record_field_X_already_exists,
|
|
|
|
|
NewFieldName);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Update the table of fields changing then old name by the new one */
|
2018-11-03 12:16:40 +01:00
|
|
|
|
DB_QueryUPDATE ("can not update name of field of record",
|
2021-04-17 13:11:37 +02:00
|
|
|
|
"UPDATE crs_record_fields"
|
|
|
|
|
" SET FieldName='%s'"
|
2018-11-03 12:16:40 +01:00
|
|
|
|
" WHERE FieldCod=%ld",
|
2021-04-17 13:11:37 +02:00
|
|
|
|
NewFieldName,
|
|
|
|
|
Gbl.Crs.Records.Field.FieldCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Write message to show the change made *****/
|
2019-02-16 18:25:41 +01:00
|
|
|
|
Ale_ShowAlert (Ale_SUCCESS,Txt_The_record_field_X_has_been_renamed_as_Y,
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.Field.Name,NewFieldName);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else // The same name
|
2019-02-16 18:25:41 +01:00
|
|
|
|
Ale_ShowAlert (Ale_INFO,Txt_The_name_of_the_field_X_has_not_changed,
|
|
|
|
|
NewFieldName);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
2019-12-20 00:30:54 +01:00
|
|
|
|
else
|
|
|
|
|
Ale_ShowAlertYouCanNotLeaveFieldEmpty ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Show the form again *****/
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Str_Copy (Gbl.Crs.Records.Field.Name,NewFieldName,
|
2021-02-15 16:25:55 +01:00
|
|
|
|
sizeof (Gbl.Crs.Records.Field.Name) - 1);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Rec_ReqEditRecordFields ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********* Change number of lines of the form of a field of records **********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_ChangeLinesField (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_The_number_of_editing_lines_in_the_record_field_X_has_not_changed;
|
|
|
|
|
extern const char *Txt_From_now_on_the_number_of_editing_lines_of_the_field_X_is_Y;
|
|
|
|
|
unsigned NewNumLines;
|
|
|
|
|
|
|
|
|
|
/***** Get parameters of the form *****/
|
|
|
|
|
/* Get the code of field */
|
2021-04-25 20:36:48 +02:00
|
|
|
|
if ((Gbl.Crs.Records.Field.FieldCod = Rec_GetFieldCod ()) <= 0)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongRecordFieldExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get the new number of lines */
|
2017-01-29 21:41:08 +01:00
|
|
|
|
NewNumLines = (unsigned)
|
|
|
|
|
Par_GetParToUnsignedLong ("NumLines",
|
|
|
|
|
Rec_MIN_LINES_IN_EDITION_FIELD,
|
|
|
|
|
Rec_MAX_LINES_IN_EDITION_FIELD,
|
|
|
|
|
Rec_DEF_LINES_IN_EDITION_FIELD);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get from the database the number of lines of the field */
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Rec_GetFieldByCod (Gbl.Crs.Records.Field.FieldCod,Gbl.Crs.Records.Field.Name,&Gbl.Crs.Records.Field.NumLines,&Gbl.Crs.Records.Field.Visibility);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-01-02 15:10:51 +01:00
|
|
|
|
/***** Check if the old number of rows matches the new one
|
2014-12-01 23:55:08 +01:00
|
|
|
|
(this happens when return is pressed without changes) *****/
|
2019-04-04 10:45:15 +02:00
|
|
|
|
if (Gbl.Crs.Records.Field.NumLines == NewNumLines)
|
2019-02-16 18:25:41 +01:00
|
|
|
|
Ale_ShowAlert (Ale_INFO,Txt_The_number_of_editing_lines_in_the_record_field_X_has_not_changed,
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.Field.Name);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/***** Update of the table of fields changing the old maximum of students by the new one *****/
|
2018-11-03 12:16:40 +01:00
|
|
|
|
DB_QueryUPDATE ("can not update the number of lines of a record field",
|
2021-04-17 13:11:37 +02:00
|
|
|
|
"UPDATE crs_record_fields"
|
|
|
|
|
" SET NumLines=%u"
|
2018-11-03 12:16:40 +01:00
|
|
|
|
" WHERE FieldCod=%ld",
|
2021-04-17 13:11:37 +02:00
|
|
|
|
NewNumLines,
|
|
|
|
|
Gbl.Crs.Records.Field.FieldCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Write message to show the change made *****/
|
2019-02-16 18:25:41 +01:00
|
|
|
|
Ale_ShowAlert (Ale_SUCCESS,Txt_From_now_on_the_number_of_editing_lines_of_the_field_X_is_Y,
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.Field.Name,NewNumLines);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Show the form again *****/
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.Field.NumLines = NewNumLines;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Rec_ReqEditRecordFields ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************ Change wisibility by students of a field of records ************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_ChangeVisibilityField (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_The_visibility_of_the_record_field_X_has_not_changed;
|
|
|
|
|
extern const char *Txt_RECORD_FIELD_VISIBILITY_MSG[Rec_NUM_TYPES_VISIBILITY];
|
|
|
|
|
Rec_VisibilityRecordFields_t NewVisibility;
|
|
|
|
|
|
|
|
|
|
/***** Get parameters of the form *****/
|
|
|
|
|
/* Get the code of field */
|
2021-04-25 20:36:48 +02:00
|
|
|
|
if ((Gbl.Crs.Records.Field.FieldCod = Rec_GetFieldCod ()) <= 0)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongRecordFieldExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get the new visibility of the field */
|
2017-01-29 12:42:19 +01:00
|
|
|
|
NewVisibility = (Rec_VisibilityRecordFields_t)
|
2017-01-29 21:41:08 +01:00
|
|
|
|
Par_GetParToUnsignedLong ("Visibility",
|
|
|
|
|
0,
|
|
|
|
|
Rec_NUM_TYPES_VISIBILITY - 1,
|
|
|
|
|
(unsigned long) Rec_VISIBILITY_DEFAULT);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get from the database the visibility of the field */
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Rec_GetFieldByCod (Gbl.Crs.Records.Field.FieldCod,Gbl.Crs.Records.Field.Name,&Gbl.Crs.Records.Field.NumLines,&Gbl.Crs.Records.Field.Visibility);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Check if the old visibility matches the new one
|
2019-01-02 15:10:51 +01:00
|
|
|
|
(this happens when return is pressed without changes) *****/
|
2019-04-04 10:45:15 +02:00
|
|
|
|
if (Gbl.Crs.Records.Field.Visibility == NewVisibility)
|
2019-02-16 18:25:41 +01:00
|
|
|
|
Ale_ShowAlert (Ale_INFO,Txt_The_visibility_of_the_record_field_X_has_not_changed,
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.Field.Name);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/***** Update of the table of fields changing the old visibility by the new *****/
|
2018-11-03 12:16:40 +01:00
|
|
|
|
DB_QueryUPDATE ("can not update the visibility of a record field",
|
2021-04-17 13:11:37 +02:00
|
|
|
|
"UPDATE crs_record_fields"
|
|
|
|
|
" SET Visibility=%u"
|
2018-11-03 12:16:40 +01:00
|
|
|
|
" WHERE FieldCod=%ld",
|
|
|
|
|
(unsigned) NewVisibility,
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.Field.FieldCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Write message to show the change made *****/
|
2019-02-16 18:25:41 +01:00
|
|
|
|
Ale_ShowAlert (Ale_SUCCESS,Txt_RECORD_FIELD_VISIBILITY_MSG[NewVisibility],
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.Field.Name);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Show the form again *****/
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.Field.Visibility = NewVisibility;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Rec_ReqEditRecordFields ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************** Liberar list of fields of records ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_FreeListFields (void)
|
|
|
|
|
{
|
2019-04-04 10:45:15 +02:00
|
|
|
|
if (Gbl.Crs.Records.LstFields.NestedCalls > 0)
|
|
|
|
|
if (--Gbl.Crs.Records.LstFields.NestedCalls == 0)
|
|
|
|
|
if (Gbl.Crs.Records.LstFields.Lst)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2019-11-06 19:45:20 +01:00
|
|
|
|
free (Gbl.Crs.Records.LstFields.Lst);
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.LstFields.Lst = NULL;
|
|
|
|
|
Gbl.Crs.Records.LstFields.Num = 0;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************* Put a link to list official students ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_PutLinkToEditRecordFields (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Edit_record_fields;
|
|
|
|
|
|
|
|
|
|
/***** Link to edit record fields *****/
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Lay_PutContextualLinkIconText (ActEdiRecFie,NULL,
|
|
|
|
|
NULL,NULL,
|
2019-01-12 03:00:59 +01:00
|
|
|
|
"pen.svg",
|
|
|
|
|
Txt_Edit_record_fields);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*********************** Draw records of several guests **********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-05-09 20:56:02 +02:00
|
|
|
|
void Rec_ListRecordsGstsShow (void)
|
|
|
|
|
{
|
2019-03-11 13:33:34 +01:00
|
|
|
|
Gbl.Action.Original = ActSeeRecSevGst; // Used to know where to go when confirming ID
|
2017-05-09 20:56:02 +02:00
|
|
|
|
Rec_ListRecordsGsts (Rec_SHA_RECORD_LIST);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Rec_ListRecordsGstsPrint (void)
|
|
|
|
|
{
|
2019-03-11 00:51:54 +01:00
|
|
|
|
/***** List records ready to be printed *****/
|
2017-05-09 20:56:02 +02:00
|
|
|
|
Rec_ListRecordsGsts (Rec_SHA_RECORD_PRINT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void Rec_ListRecordsGsts (Rec_SharedRecordViewType_t TypeOfView)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2017-05-10 09:39:38 +02:00
|
|
|
|
unsigned NumUsr = 0;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
const char *Ptr;
|
|
|
|
|
struct UsrData UsrDat;
|
2017-05-25 13:43:54 +02:00
|
|
|
|
char RecordSectionId[32];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-03-11 13:33:34 +01:00
|
|
|
|
/***** Get list of selected users if not already got *****/
|
2019-11-15 03:34:48 +01:00
|
|
|
|
Usr_GetListsSelectedEncryptedUsrsCods (&Gbl.Usrs.Selected);
|
2019-03-11 13:33:34 +01:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/***** Assign users listing type depending on current action *****/
|
|
|
|
|
Gbl.Usrs.Listing.RecsUsrs = Rec_RECORD_USERS_GUESTS;
|
|
|
|
|
|
|
|
|
|
/***** Get parameter with number of user records per page (only for printing) *****/
|
2017-05-09 20:56:02 +02:00
|
|
|
|
if (TypeOfView == Rec_SHA_RECORD_PRINT)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Rec_GetParamRecordsPerPage ();
|
|
|
|
|
|
2017-05-09 20:56:02 +02:00
|
|
|
|
if (TypeOfView == Rec_SHA_RECORD_LIST) // Listing several records
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2019-10-24 09:46:20 +02:00
|
|
|
|
/***** Contextual menu *****/
|
|
|
|
|
Mnu_ContextMenuBegin ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Print view */
|
|
|
|
|
Frm_BeginForm (ActPrnRecSevGst);
|
|
|
|
|
Usr_PutHiddenParSelectedUsrsCods (&Gbl.Usrs.Selected);
|
|
|
|
|
Rec_ShowLinkToPrintPreviewOfRecords ();
|
|
|
|
|
Frm_EndForm ();
|
2019-10-24 00:04:40 +02:00
|
|
|
|
|
2019-10-24 09:46:20 +02:00
|
|
|
|
Mnu_ContextMenuEnd ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Initialize structure with user's data *****/
|
|
|
|
|
Usr_UsrDataConstructor (&UsrDat);
|
|
|
|
|
UsrDat.Accepted = false; // Guests have no courses,...
|
|
|
|
|
// ...so they have not accepted...
|
|
|
|
|
// ...inscription in any course
|
|
|
|
|
|
|
|
|
|
/***** List the records *****/
|
2019-03-11 13:33:34 +01:00
|
|
|
|
Ptr = Gbl.Usrs.Selected.List[Rol_UNK];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
while (*Ptr)
|
|
|
|
|
{
|
2021-02-15 16:25:55 +01:00
|
|
|
|
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EnUsrCod,
|
2017-03-13 14:22:36 +01:00
|
|
|
|
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
2021-04-24 15:10:07 +02:00
|
|
|
|
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get guest's data from database
|
|
|
|
|
Usr_DONT_GET_PREFS,
|
|
|
|
|
Usr_GET_ROLE_IN_CURRENT_CRS))
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2021-03-02 00:54:26 +01:00
|
|
|
|
/* Begin container for this user */
|
2021-02-15 16:25:55 +01:00
|
|
|
|
snprintf (RecordSectionId,sizeof (RecordSectionId),"record_%u",NumUsr);
|
2019-10-26 01:56:36 +02:00
|
|
|
|
HTM_SECTION_Begin (RecordSectionId);
|
2019-10-24 00:04:40 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
if (Gbl.Action.Act == ActPrnRecSevGst &&
|
|
|
|
|
NumUsr != 0 &&
|
|
|
|
|
(NumUsr % Gbl.Usrs.Listing.RecsPerPag) == 0)
|
|
|
|
|
HTM_DIV_Begin ("class=\"REC_USR\" style=\"page-break-before:always;\"");
|
|
|
|
|
else
|
|
|
|
|
HTM_DIV_Begin ("class=\"REC_USR\"");
|
|
|
|
|
|
|
|
|
|
/* Show optional alert */
|
|
|
|
|
if (UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // Selected user
|
|
|
|
|
Ale_ShowAlerts (NULL);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Shared record */
|
|
|
|
|
HTM_DIV_Begin ("class=\"REC_LEFT\"");
|
|
|
|
|
Rec_ShowSharedUsrRecord (TypeOfView,&UsrDat,RecordSectionId);
|
|
|
|
|
HTM_DIV_End ();
|
2017-05-10 10:09:19 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* End container for this user */
|
|
|
|
|
HTM_DIV_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-10-26 01:56:36 +02:00
|
|
|
|
HTM_SECTION_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-05-10 09:39:38 +02:00
|
|
|
|
NumUsr++;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-03-11 13:33:34 +01:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/***** Free memory used for user's data *****/
|
|
|
|
|
Usr_UsrDataDestructor (&UsrDat);
|
2019-03-11 13:33:34 +01:00
|
|
|
|
|
|
|
|
|
/***** Free memory used by list of selected users' codes *****/
|
2019-11-15 03:34:48 +01:00
|
|
|
|
Usr_FreeListsSelectedEncryptedUsrsCods (&Gbl.Usrs.Selected);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-05 01:55:46 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********** Get user's data and draw record of one unique student ************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-01-10 15:26:33 +01:00
|
|
|
|
void Rec_GetUsrAndShowRecOneStdCrs (void)
|
2015-03-05 01:55:46 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Get the selected student *****/
|
2016-01-25 14:40:57 +01:00
|
|
|
|
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
2015-03-05 01:55:46 +01:00
|
|
|
|
|
2021-04-24 15:10:07 +02:00
|
|
|
|
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, // Get student's data from database
|
|
|
|
|
Usr_DONT_GET_PREFS,
|
|
|
|
|
Usr_GET_ROLE_IN_CURRENT_CRS))
|
2016-12-09 13:59:33 +01:00
|
|
|
|
if (Usr_CheckIfICanViewRecordStd (&Gbl.Usrs.Other.UsrDat))
|
2015-03-05 01:55:46 +01:00
|
|
|
|
Rec_ShowRecordOneStdCrs ();
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************** Draw record of one unique student **********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2015-03-05 18:58:59 +01:00
|
|
|
|
static void Rec_ShowRecordOneStdCrs (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2018-10-10 14:03:06 +02:00
|
|
|
|
bool ItsMe;
|
|
|
|
|
|
2017-03-30 11:20:06 +02:00
|
|
|
|
/***** Get if student has accepted enrolment in current course *****/
|
2017-06-09 15:04:02 +02:00
|
|
|
|
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
|
2015-03-05 01:55:46 +01:00
|
|
|
|
|
2017-05-10 10:09:19 +02:00
|
|
|
|
/***** Assign users listing type depending on current action *****/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Gbl.Usrs.Listing.RecsUsrs = Rec_RECORD_USERS_STUDENTS;
|
|
|
|
|
|
2017-05-10 10:09:19 +02:00
|
|
|
|
/***** Get list of fields of records in current course *****/
|
|
|
|
|
Rec_GetListRecordFieldsInCurrentCrs ();
|
|
|
|
|
|
2019-10-24 09:46:20 +02:00
|
|
|
|
/***** Contextual menu *****/
|
|
|
|
|
Mnu_ContextMenuBegin ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-10-24 09:46:20 +02:00
|
|
|
|
/* Edit record fields */
|
2017-06-04 18:18:54 +02:00
|
|
|
|
if (Gbl.Usrs.Me.Role.Logged == Rol_TCH)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Rec_PutLinkToEditRecordFields ();
|
|
|
|
|
|
2019-10-24 09:46:20 +02:00
|
|
|
|
/* Print view */
|
2021-03-02 00:54:26 +01:00
|
|
|
|
Frm_BeginForm (ActPrnRecSevStd);
|
2019-11-15 03:34:48 +01:00
|
|
|
|
Usr_CreateListSelectedUsrsCodsAndFillWithOtherUsr (&Gbl.Usrs.Selected);
|
|
|
|
|
Usr_PutHiddenParSelectedUsrsCods (&Gbl.Usrs.Selected);
|
|
|
|
|
Usr_FreeListsSelectedEncryptedUsrsCods (&Gbl.Usrs.Selected);
|
2021-07-08 15:00:17 +02:00
|
|
|
|
Rec_ShowLinkToPrintPreviewOfRecords ();
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-10-24 09:46:20 +02:00
|
|
|
|
Mnu_ContextMenuEnd ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-05-10 10:09:19 +02:00
|
|
|
|
/***** Show optional alert (result of editing data in course record) *****/
|
2019-03-09 20:12:44 +01:00
|
|
|
|
Ale_ShowAlerts (NULL);
|
2017-05-09 10:32:54 +02:00
|
|
|
|
|
2021-03-02 00:54:26 +01:00
|
|
|
|
/***** Begin container for this user *****/
|
2019-10-24 00:04:40 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"REC_USR\"");
|
2017-05-10 10:09:19 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Shared record *****/
|
|
|
|
|
HTM_DIV_Begin ("class=\"REC_LEFT\"");
|
|
|
|
|
Rec_ShowSharedUsrRecord (Rec_SHA_RECORD_LIST,&Gbl.Usrs.Other.UsrDat,NULL);
|
|
|
|
|
HTM_DIV_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Record of the student in the course *****/
|
|
|
|
|
if (Gbl.Crs.Records.LstFields.Num) // There are fields in the record
|
|
|
|
|
{
|
|
|
|
|
switch (Gbl.Usrs.Me.Role.Logged)
|
|
|
|
|
{
|
|
|
|
|
case Rol_STD:
|
|
|
|
|
ItsMe = Usr_ItsMe (Gbl.Usrs.Other.UsrDat.UsrCod);
|
|
|
|
|
if (ItsMe)
|
|
|
|
|
{
|
|
|
|
|
HTM_DIV_Begin ("class=\"REC_RIGHT\"");
|
|
|
|
|
Rec_ShowCrsRecord (Rec_CRS_MY_RECORD_AS_STUDENT_FORM,&Gbl.Usrs.Other.UsrDat,NULL);
|
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case Rol_NET:
|
|
|
|
|
case Rol_TCH:
|
|
|
|
|
case Rol_SYS_ADM:
|
2019-10-24 00:04:40 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"REC_RIGHT\"");
|
2021-07-08 15:00:17 +02:00
|
|
|
|
Rec_ShowCrsRecord (Rec_CRS_LIST_ONE_RECORD,&Gbl.Usrs.Other.UsrDat,NULL);
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2021-07-08 15:00:17 +02:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-03-29 22:36:21 +02:00
|
|
|
|
|
2017-05-10 10:09:19 +02:00
|
|
|
|
/***** End container for this user *****/
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2017-05-10 10:09:19 +02:00
|
|
|
|
|
|
|
|
|
/***** Free list of fields of records *****/
|
2015-03-29 22:36:21 +02:00
|
|
|
|
Rec_FreeListFields ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************** Draw records of several students ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-05-09 20:56:02 +02:00
|
|
|
|
void Rec_ListRecordsStdsShow (void)
|
2015-10-03 21:10:47 +02:00
|
|
|
|
{
|
2019-03-11 13:33:34 +01:00
|
|
|
|
Gbl.Action.Original = ActSeeRecSevStd; // Used to know where to go when confirming ID...
|
2017-05-10 10:09:19 +02:00
|
|
|
|
// ...or changing course record
|
2016-11-18 00:17:53 +01:00
|
|
|
|
Rec_ListRecordsStds (Rec_SHA_RECORD_LIST,
|
2017-05-08 20:48:27 +02:00
|
|
|
|
Rec_CRS_LIST_SEVERAL_RECORDS);
|
2015-10-03 21:10:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
2017-05-09 20:56:02 +02:00
|
|
|
|
void Rec_ListRecordsStdsPrint (void)
|
2015-10-03 21:10:47 +02:00
|
|
|
|
{
|
2019-03-11 00:51:54 +01:00
|
|
|
|
/***** List records ready to be printed *****/
|
2016-11-18 00:17:53 +01:00
|
|
|
|
Rec_ListRecordsStds (Rec_SHA_RECORD_PRINT,
|
2017-05-08 20:48:27 +02:00
|
|
|
|
Rec_CRS_PRINT_SEVERAL_RECORDS);
|
2015-10-03 21:10:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-11-18 00:17:53 +01:00
|
|
|
|
static void Rec_ListRecordsStds (Rec_SharedRecordViewType_t ShaTypeOfView,
|
|
|
|
|
Rec_CourseRecordViewType_t CrsTypeOfView)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2015-10-03 21:10:47 +02:00
|
|
|
|
unsigned NumUsr = 0;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
const char *Ptr;
|
|
|
|
|
struct UsrData UsrDat;
|
2018-10-10 23:56:42 +02:00
|
|
|
|
bool ItsMe;
|
2017-05-25 13:43:54 +02:00
|
|
|
|
char RecordSectionId[32];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-03-11 13:33:34 +01:00
|
|
|
|
/***** Get list of selected users if not already got *****/
|
2019-11-15 03:34:48 +01:00
|
|
|
|
Usr_GetListsSelectedEncryptedUsrsCods (&Gbl.Usrs.Selected);
|
2019-03-11 13:33:34 +01:00
|
|
|
|
|
2017-05-10 10:09:19 +02:00
|
|
|
|
/***** Assign users listing type depending on current action *****/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Gbl.Usrs.Listing.RecsUsrs = Rec_RECORD_USERS_STUDENTS;
|
|
|
|
|
|
|
|
|
|
/***** Get parameter with number of user records per page (only for printing) *****/
|
2016-11-18 00:17:53 +01:00
|
|
|
|
if (ShaTypeOfView == Rec_SHA_RECORD_PRINT)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Rec_GetParamRecordsPerPage ();
|
|
|
|
|
|
|
|
|
|
/***** Get list of fields of records in current course *****/
|
|
|
|
|
Rec_GetListRecordFieldsInCurrentCrs ();
|
|
|
|
|
|
2016-11-18 00:17:53 +01:00
|
|
|
|
if (ShaTypeOfView == Rec_SHA_RECORD_LIST)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2019-10-24 09:46:20 +02:00
|
|
|
|
/***** Contextual menu *****/
|
|
|
|
|
Mnu_ContextMenuBegin ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Edit record fields */
|
|
|
|
|
if (Gbl.Usrs.Me.Role.Logged == Rol_TCH)
|
|
|
|
|
Rec_PutLinkToEditRecordFields ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Print view */
|
|
|
|
|
Frm_BeginForm (ActPrnRecSevStd);
|
|
|
|
|
Usr_PutHiddenParSelectedUsrsCods (&Gbl.Usrs.Selected);
|
|
|
|
|
Rec_ShowLinkToPrintPreviewOfRecords ();
|
|
|
|
|
Frm_EndForm ();
|
2019-10-24 00:04:40 +02:00
|
|
|
|
|
2019-10-24 09:46:20 +02:00
|
|
|
|
Mnu_ContextMenuEnd ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Initialize structure with user's data *****/
|
|
|
|
|
Usr_UsrDataConstructor (&UsrDat);
|
|
|
|
|
|
|
|
|
|
/***** List the records *****/
|
2019-03-11 13:33:34 +01:00
|
|
|
|
Ptr = Gbl.Usrs.Selected.List[Rol_UNK];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
while (*Ptr)
|
|
|
|
|
{
|
2021-02-15 16:25:55 +01:00
|
|
|
|
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EnUsrCod,
|
2017-03-13 14:22:36 +01:00
|
|
|
|
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
2021-04-24 15:10:07 +02:00
|
|
|
|
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get student's data from database
|
|
|
|
|
Usr_DONT_GET_PREFS,
|
|
|
|
|
Usr_GET_ROLE_IN_CURRENT_CRS))
|
2017-06-09 15:04:02 +02:00
|
|
|
|
if (Usr_CheckIfUsrBelongsToCurrentCrs (&UsrDat))
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2017-05-10 09:39:38 +02:00
|
|
|
|
/* Check if this user has accepted
|
2015-10-03 21:10:47 +02:00
|
|
|
|
his/her inscription in the current course */
|
2017-06-09 15:04:02 +02:00
|
|
|
|
UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&UsrDat);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-03-02 00:54:26 +01:00
|
|
|
|
/* Begin container for this user */
|
2021-02-15 16:25:55 +01:00
|
|
|
|
snprintf (RecordSectionId,sizeof (RecordSectionId),"record_%u",NumUsr);
|
2019-10-26 01:56:36 +02:00
|
|
|
|
HTM_SECTION_Begin (RecordSectionId);
|
2019-10-24 00:04:40 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
if (Gbl.Action.Act == ActPrnRecSevStd &&
|
|
|
|
|
NumUsr != 0 &&
|
|
|
|
|
(NumUsr % Gbl.Usrs.Listing.RecsPerPag) == 0)
|
|
|
|
|
HTM_DIV_Begin ("class=\"REC_USR\" style=\"page-break-before:always;\"");
|
|
|
|
|
else
|
|
|
|
|
HTM_DIV_Begin ("class=\"REC_USR\"");
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Show optional alert */
|
|
|
|
|
if (UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // Selected user
|
|
|
|
|
Ale_ShowAlerts (NULL);
|
|
|
|
|
|
|
|
|
|
/* Shared record */
|
|
|
|
|
HTM_DIV_Begin ("class=\"REC_LEFT\"");
|
|
|
|
|
Rec_ShowSharedUsrRecord (ShaTypeOfView,&UsrDat,RecordSectionId);
|
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
|
|
|
|
|
/* Record of the student in the course */
|
|
|
|
|
if (Gbl.Crs.Records.LstFields.Num) // There are fields in the record
|
2017-05-09 12:29:25 +02:00
|
|
|
|
{
|
2021-07-08 15:00:17 +02:00
|
|
|
|
ItsMe = Usr_ItsMe (UsrDat.UsrCod);
|
|
|
|
|
if ( Gbl.Usrs.Me.Role.Logged == Rol_NET ||
|
|
|
|
|
Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
|
|
|
|
|
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ||
|
|
|
|
|
(Gbl.Usrs.Me.Role.Logged == Rol_STD && // I am student in this course...
|
|
|
|
|
ItsMe)) // ...and it's me
|
|
|
|
|
{
|
|
|
|
|
HTM_DIV_Begin ("class=\"REC_RIGHT\"");
|
|
|
|
|
Rec_ShowCrsRecord (CrsTypeOfView,&UsrDat,RecordSectionId);
|
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
}
|
2017-05-09 12:29:25 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* End container for this user */
|
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
|
2019-10-26 01:56:36 +02:00
|
|
|
|
HTM_SECTION_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2015-10-03 21:10:47 +02:00
|
|
|
|
NumUsr++;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2015-09-17 11:21:49 +02:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/***** Free memory used for user's data *****/
|
|
|
|
|
Usr_UsrDataDestructor (&UsrDat);
|
|
|
|
|
|
|
|
|
|
/***** Free list of fields of records *****/
|
2016-11-18 00:17:53 +01:00
|
|
|
|
Rec_FreeListFields ();
|
2019-03-11 13:33:34 +01:00
|
|
|
|
|
|
|
|
|
/***** Free memory used by list of selected users' codes *****/
|
2019-11-15 03:34:48 +01:00
|
|
|
|
Usr_FreeListsSelectedEncryptedUsrsCods (&Gbl.Usrs.Selected);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-05 01:55:46 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********** Get user's data and draw record of one unique teacher ************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-01-10 15:26:33 +01:00
|
|
|
|
void Rec_GetUsrAndShowRecOneTchCrs (void)
|
2015-03-05 01:55:46 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Get the selected teacher *****/
|
2016-01-25 14:40:57 +01:00
|
|
|
|
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
2015-03-05 01:55:46 +01:00
|
|
|
|
|
|
|
|
|
/***** Show the record *****/
|
2021-04-24 15:10:07 +02:00
|
|
|
|
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat, // Get teacher's data from database
|
|
|
|
|
Usr_DONT_GET_PREFS,
|
|
|
|
|
Usr_GET_ROLE_IN_CURRENT_CRS))
|
2016-12-09 13:59:33 +01:00
|
|
|
|
if (Usr_CheckIfICanViewRecordTch (&Gbl.Usrs.Other.UsrDat))
|
2015-03-05 01:55:46 +01:00
|
|
|
|
Rec_ShowRecordOneTchCrs ();
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************** Draw record of one unique teacher **********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2015-03-05 18:58:59 +01:00
|
|
|
|
static void Rec_ShowRecordOneTchCrs (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2016-11-18 10:08:01 +01:00
|
|
|
|
extern const char *Hlp_USERS_Teachers_timetable;
|
2021-03-19 21:01:09 +01:00
|
|
|
|
extern const char *Txt_TIMETABLE_TYPES[Tmt_NUM_TIMETABLE_TYPES];
|
|
|
|
|
struct Tmt_Timetable Timetable;
|
2019-11-08 01:10:32 +01:00
|
|
|
|
char Width[Cns_MAX_DECIMAL_DIGITS_UINT + 2 + 1];
|
2016-11-27 17:30:10 +01:00
|
|
|
|
bool ShowOfficeHours;
|
2015-12-01 01:09:55 +01:00
|
|
|
|
|
|
|
|
|
/***** Width for office hours *****/
|
2021-02-15 16:25:55 +01:00
|
|
|
|
snprintf (Width,sizeof (Width),"%upx",Rec_RECORD_WIDTH);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-03-30 11:20:06 +02:00
|
|
|
|
/***** Get if teacher has accepted enrolment in current course *****/
|
2017-06-09 15:04:02 +02:00
|
|
|
|
Gbl.Usrs.Other.UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&Gbl.Usrs.Other.UsrDat);
|
2015-03-05 01:55:46 +01:00
|
|
|
|
|
2017-05-10 10:09:19 +02:00
|
|
|
|
/***** Assign users listing type depending on current action *****/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Gbl.Usrs.Listing.RecsUsrs = Rec_RECORD_USERS_TEACHERS;
|
|
|
|
|
|
2016-11-27 17:30:10 +01:00
|
|
|
|
/***** Get if I want to see teachers' office hours in teachers' records *****/
|
|
|
|
|
ShowOfficeHours = Rec_GetParamShowOfficeHours ();
|
|
|
|
|
|
2019-10-24 09:46:20 +02:00
|
|
|
|
/***** Contextual menu *****/
|
|
|
|
|
Mnu_ContextMenuBegin ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Show office hours? */
|
|
|
|
|
Rec_WriteFormShowOfficeHoursOneTch (ShowOfficeHours);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Print view */
|
|
|
|
|
Frm_BeginForm (ActPrnRecSevTch);
|
|
|
|
|
Usr_CreateListSelectedUsrsCodsAndFillWithOtherUsr (&Gbl.Usrs.Selected);
|
|
|
|
|
Usr_PutHiddenParSelectedUsrsCods (&Gbl.Usrs.Selected);
|
|
|
|
|
Usr_FreeListsSelectedEncryptedUsrsCods (&Gbl.Usrs.Selected);
|
|
|
|
|
Par_PutHiddenParamChar ("ParamOfficeHours",'Y');
|
|
|
|
|
Par_PutHiddenParamChar ("ShowOfficeHours",ShowOfficeHours ? 'Y' :
|
|
|
|
|
'N');
|
|
|
|
|
Rec_ShowLinkToPrintPreviewOfRecords ();
|
|
|
|
|
Frm_EndForm ();
|
2015-04-02 14:22:21 +02:00
|
|
|
|
|
2019-10-24 09:46:20 +02:00
|
|
|
|
Mnu_ContextMenuEnd ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-03-02 00:54:26 +01:00
|
|
|
|
/***** Begin container for this user *****/
|
2019-10-24 00:04:40 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"REC_USR\"");
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Shared record *****/
|
|
|
|
|
HTM_DIV_Begin ("class=\"REC_LEFT\"");
|
|
|
|
|
Rec_ShowSharedUsrRecord (Rec_SHA_RECORD_LIST,&Gbl.Usrs.Other.UsrDat,NULL);
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2021-07-08 15:00:17 +02:00
|
|
|
|
|
|
|
|
|
/***** Office hours *****/
|
|
|
|
|
if (ShowOfficeHours)
|
|
|
|
|
{
|
|
|
|
|
HTM_DIV_Begin ("class=\"REC_RIGHT\"");
|
|
|
|
|
Timetable.Type = Tmt_TUTORING_TIMETABLE;
|
|
|
|
|
Box_BoxBegin (Width,Txt_TIMETABLE_TYPES[Timetable.Type],
|
|
|
|
|
NULL,NULL,
|
|
|
|
|
Hlp_USERS_Teachers_timetable,Box_NOT_CLOSABLE);
|
|
|
|
|
Tmt_ShowTimeTable (&Timetable,Gbl.Usrs.Other.UsrDat.UsrCod);
|
|
|
|
|
Box_BoxEnd ();
|
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-03-02 00:54:26 +01:00
|
|
|
|
/***** Begin container for this user *****/
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************** Draw records of several teachers ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-05-09 20:56:02 +02:00
|
|
|
|
void Rec_ListRecordsTchsShow (void)
|
|
|
|
|
{
|
2019-03-11 13:33:34 +01:00
|
|
|
|
Gbl.Action.Original = ActSeeRecSevTch; // Used to know where to go when confirming ID
|
2017-05-09 20:56:02 +02:00
|
|
|
|
Rec_ListRecordsTchs (Rec_SHA_RECORD_LIST);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Rec_ListRecordsTchsPrint (void)
|
|
|
|
|
{
|
2019-03-11 00:51:54 +01:00
|
|
|
|
/***** List records ready to be printed *****/
|
2017-05-09 20:56:02 +02:00
|
|
|
|
Rec_ListRecordsTchs (Rec_SHA_RECORD_PRINT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void Rec_ListRecordsTchs (Rec_SharedRecordViewType_t TypeOfView)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2016-11-18 10:08:01 +01:00
|
|
|
|
extern const char *Hlp_USERS_Teachers_timetable;
|
2021-03-19 21:01:09 +01:00
|
|
|
|
extern const char *Txt_TIMETABLE_TYPES[Tmt_NUM_TIMETABLE_TYPES];
|
|
|
|
|
struct Tmt_Timetable Timetable;
|
2017-05-10 09:39:38 +02:00
|
|
|
|
unsigned NumUsr = 0;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
const char *Ptr;
|
|
|
|
|
struct UsrData UsrDat;
|
2017-05-25 13:43:54 +02:00
|
|
|
|
char RecordSectionId[32];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
bool ShowOfficeHours;
|
2019-11-08 01:10:32 +01:00
|
|
|
|
char Width[Cns_MAX_DECIMAL_DIGITS_UINT + 2 + 1];
|
2015-12-01 01:09:55 +01:00
|
|
|
|
|
2019-03-11 13:33:34 +01:00
|
|
|
|
/***** Get list of selected users if not already got *****/
|
2019-11-15 03:34:48 +01:00
|
|
|
|
Usr_GetListsSelectedEncryptedUsrsCods (&Gbl.Usrs.Selected);
|
2019-03-11 13:33:34 +01:00
|
|
|
|
|
2015-12-01 01:09:55 +01:00
|
|
|
|
/***** Width for office hours *****/
|
2021-02-15 16:25:55 +01:00
|
|
|
|
snprintf (Width,sizeof (Width),"%upx",Rec_RECORD_WIDTH);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-05-10 10:09:19 +02:00
|
|
|
|
/***** Assign users listing type depending on current action *****/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Gbl.Usrs.Listing.RecsUsrs = Rec_RECORD_USERS_TEACHERS;
|
|
|
|
|
|
|
|
|
|
/***** Get if I want to see teachers' office hours in teachers' records *****/
|
|
|
|
|
ShowOfficeHours = Rec_GetParamShowOfficeHours ();
|
|
|
|
|
|
|
|
|
|
/***** Get parameter with number of user records per page (only for printing) *****/
|
2016-01-17 15:10:54 +01:00
|
|
|
|
if (Gbl.Action.Act == ActPrnRecSevTch)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Rec_GetParamRecordsPerPage ();
|
|
|
|
|
|
2019-03-11 13:33:34 +01:00
|
|
|
|
if (Gbl.Action.Act == ActSeeRecSevTch)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2019-10-24 09:46:20 +02:00
|
|
|
|
/***** Contextual menu *****/
|
|
|
|
|
Mnu_ContextMenuBegin ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Show office hours? */
|
|
|
|
|
Rec_WriteFormShowOfficeHoursSeveralTchs (ShowOfficeHours);
|
|
|
|
|
|
|
|
|
|
/* Print view */
|
|
|
|
|
Frm_BeginForm (ActPrnRecSevTch);
|
|
|
|
|
Usr_PutHiddenParSelectedUsrsCods (&Gbl.Usrs.Selected);
|
|
|
|
|
Par_PutHiddenParamChar ("ParamOfficeHours",'Y');
|
|
|
|
|
Par_PutHiddenParamChar ("ShowOfficeHours",
|
|
|
|
|
ShowOfficeHours ? 'Y' :
|
|
|
|
|
'N');
|
|
|
|
|
Rec_ShowLinkToPrintPreviewOfRecords ();
|
|
|
|
|
Frm_EndForm ();
|
2015-04-02 14:22:21 +02:00
|
|
|
|
|
2019-10-24 09:46:20 +02:00
|
|
|
|
Mnu_ContextMenuEnd ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Initialize structure with user's data *****/
|
|
|
|
|
Usr_UsrDataConstructor (&UsrDat);
|
|
|
|
|
|
|
|
|
|
/***** List the records *****/
|
2019-03-11 13:33:34 +01:00
|
|
|
|
Ptr = Gbl.Usrs.Selected.List[Rol_UNK];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
while (*Ptr)
|
|
|
|
|
{
|
2021-02-15 16:25:55 +01:00
|
|
|
|
Par_GetNextStrUntilSeparParamMult (&Ptr,UsrDat.EnUsrCod,
|
2017-03-13 14:22:36 +01:00
|
|
|
|
Cry_BYTES_ENCRYPTED_STR_SHA256_BASE64);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Usr_GetUsrCodFromEncryptedUsrCod (&UsrDat);
|
2021-04-24 15:10:07 +02:00
|
|
|
|
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&UsrDat, // Get teacher's data from database
|
|
|
|
|
Usr_DONT_GET_PREFS,
|
|
|
|
|
Usr_GET_ROLE_IN_CURRENT_CRS))
|
2017-06-09 15:04:02 +02:00
|
|
|
|
if (Usr_CheckIfUsrBelongsToCurrentCrs (&UsrDat))
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2017-05-10 09:39:38 +02:00
|
|
|
|
/* Check if this user has accepted
|
|
|
|
|
his/her inscription in the current course */
|
2017-06-09 15:04:02 +02:00
|
|
|
|
UsrDat.Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (&UsrDat);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-03-02 00:54:26 +01:00
|
|
|
|
/* Begin container for this user */
|
2021-02-15 16:25:55 +01:00
|
|
|
|
snprintf (RecordSectionId,sizeof (RecordSectionId),"record_%u",NumUsr);
|
2019-10-26 01:56:36 +02:00
|
|
|
|
HTM_SECTION_Begin (RecordSectionId);
|
2019-10-24 00:04:40 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
if (Gbl.Action.Act == ActPrnRecSevTch &&
|
|
|
|
|
NumUsr != 0 &&
|
|
|
|
|
(NumUsr % Gbl.Usrs.Listing.RecsPerPag) == 0)
|
|
|
|
|
HTM_DIV_Begin ("class=\"REC_USR\" style=\"page-break-before:always;\"");
|
|
|
|
|
else
|
|
|
|
|
HTM_DIV_Begin ("class=\"REC_USR\"");
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Show optional alert */
|
|
|
|
|
if (UsrDat.UsrCod == Gbl.Usrs.Other.UsrDat.UsrCod) // Selected user
|
|
|
|
|
Ale_ShowAlerts (NULL);
|
2017-05-10 10:09:19 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Shared record */
|
|
|
|
|
HTM_DIV_Begin ("class=\"REC_LEFT\"");
|
|
|
|
|
Rec_ShowSharedUsrRecord (TypeOfView,&UsrDat,RecordSectionId);
|
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
|
|
|
|
|
/* Office hours */
|
|
|
|
|
if (ShowOfficeHours)
|
|
|
|
|
{
|
|
|
|
|
HTM_DIV_Begin ("class=\"REC_RIGHT\"");
|
|
|
|
|
Timetable.Type = Tmt_TUTORING_TIMETABLE;
|
|
|
|
|
Box_BoxBegin (Width,Txt_TIMETABLE_TYPES[Timetable.Type],
|
|
|
|
|
NULL,NULL,
|
|
|
|
|
Hlp_USERS_Teachers_timetable,Box_NOT_CLOSABLE);
|
|
|
|
|
Tmt_ShowTimeTable (&Timetable,UsrDat.UsrCod);
|
|
|
|
|
Box_BoxEnd ();
|
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* End container for this user */
|
|
|
|
|
HTM_DIV_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-10-26 01:56:36 +02:00
|
|
|
|
HTM_SECTION_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-05-10 09:39:38 +02:00
|
|
|
|
NumUsr++;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-03-07 22:15:47 +01:00
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/***** Free memory used for user's data *****/
|
|
|
|
|
Usr_UsrDataDestructor (&UsrDat);
|
2019-03-11 13:33:34 +01:00
|
|
|
|
|
|
|
|
|
/***** Free memory used by list of selected users' codes *****/
|
2019-11-15 03:34:48 +01:00
|
|
|
|
Usr_FreeListsSelectedEncryptedUsrsCods (&Gbl.Usrs.Selected);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************** Show a link to print preview of users' records **************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2015-10-03 21:10:47 +02:00
|
|
|
|
static void Rec_ShowLinkToPrintPreviewOfRecords (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2019-11-18 20:12:10 +01:00
|
|
|
|
extern const char *The_ClassFormLinkOutBoxBold[The_NUM_THEMES];
|
2019-02-22 21:47:50 +01:00
|
|
|
|
extern const char *The_ClassFormInBox[The_NUM_THEMES];
|
2015-01-28 01:14:14 +01:00
|
|
|
|
extern const char *Txt_Print;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
extern const char *Txt_record_cards_per_page;
|
|
|
|
|
unsigned i;
|
|
|
|
|
|
2019-11-20 10:17:42 +01:00
|
|
|
|
HTM_BUTTON_SUBMIT_Begin (Txt_Print,The_ClassFormLinkOutBoxBold[Gbl.Prefs.Theme],NULL);
|
2021-07-08 15:00:17 +02:00
|
|
|
|
Ico_PutIconTextLink ("print.svg",Txt_Print);
|
2019-11-18 20:12:10 +01:00
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
|
2019-11-02 23:40:52 +01:00
|
|
|
|
HTM_LABEL_Begin ("class=\"%s\"",The_ClassFormInBox[Gbl.Prefs.Theme]);
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_Txt ("(");
|
|
|
|
|
HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,
|
|
|
|
|
"name=\"RecsPerPag\"");
|
|
|
|
|
for (i = Rec_MIN_RECORDS_PER_PAGE;
|
|
|
|
|
i <= Rec_MAX_RECORDS_PER_PAGE;
|
|
|
|
|
i++)
|
|
|
|
|
HTM_OPTION (HTM_Type_UNSIGNED,&i,
|
|
|
|
|
i == Gbl.Usrs.Listing.RecsPerPag,false,
|
|
|
|
|
"%u",i);
|
|
|
|
|
HTM_SELECT_End ();
|
|
|
|
|
HTM_TxtF (" %s)",Txt_record_cards_per_page);
|
2019-11-02 12:59:31 +01:00
|
|
|
|
HTM_LABEL_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/** Get parameter with number of user records per page (only for printing) ***/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Rec_GetParamRecordsPerPage (void)
|
|
|
|
|
{
|
2017-01-29 21:41:08 +01:00
|
|
|
|
Gbl.Usrs.Listing.RecsPerPag = (unsigned)
|
|
|
|
|
Par_GetParToUnsignedLong ("RecsPerPag",
|
|
|
|
|
Rec_MIN_RECORDS_PER_PAGE,
|
|
|
|
|
Rec_MAX_RECORDS_PER_PAGE,
|
|
|
|
|
Rec_DEF_RECORDS_PER_PAGE);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2016-11-27 17:30:10 +01:00
|
|
|
|
/*********** Write a form to select whether show all office hours ************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-11-27 17:30:10 +01:00
|
|
|
|
static void Rec_WriteFormShowOfficeHoursOneTch (bool ShowOfficeHours)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2021-03-19 21:01:09 +01:00
|
|
|
|
extern const char *Txt_Show_tutoring_hours;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2020-04-10 19:14:08 +02:00
|
|
|
|
Lay_PutContextualCheckbox (ActSeeRecOneTch,
|
|
|
|
|
Rec_PutParamsShowOfficeHoursOneTch,
|
2017-05-22 12:23:08 +02:00
|
|
|
|
"ShowOfficeHours",
|
|
|
|
|
ShowOfficeHours,false,
|
2021-03-19 21:01:09 +01:00
|
|
|
|
Txt_Show_tutoring_hours,
|
|
|
|
|
Txt_Show_tutoring_hours);
|
2016-11-27 17:30:10 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void Rec_WriteFormShowOfficeHoursSeveralTchs (bool ShowOfficeHours)
|
|
|
|
|
{
|
2021-03-19 21:01:09 +01:00
|
|
|
|
extern const char *Txt_Show_tutoring_hours;
|
2016-11-27 17:30:10 +01:00
|
|
|
|
|
2020-04-10 19:14:08 +02:00
|
|
|
|
Lay_PutContextualCheckbox (ActSeeRecSevTch,
|
|
|
|
|
Rec_PutParamsShowOfficeHoursSeveralTchs,
|
2017-05-22 12:23:08 +02:00
|
|
|
|
"ShowOfficeHours",
|
|
|
|
|
ShowOfficeHours,false,
|
2021-03-19 21:01:09 +01:00
|
|
|
|
Txt_Show_tutoring_hours,
|
|
|
|
|
Txt_Show_tutoring_hours);
|
2016-11-27 17:30:10 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void Rec_PutParamsShowOfficeHoursOneTch (void)
|
|
|
|
|
{
|
2021-02-15 16:25:55 +01:00
|
|
|
|
Usr_PutParamOtherUsrCodEncrypted (Gbl.Usrs.Other.UsrDat.EnUsrCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Par_PutHiddenParamChar ("ParamOfficeHours",'Y');
|
2016-11-27 17:30:10 +01:00
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2016-11-27 17:30:10 +01:00
|
|
|
|
static void Rec_PutParamsShowOfficeHoursSeveralTchs (void)
|
|
|
|
|
{
|
2019-11-15 03:34:48 +01:00
|
|
|
|
Usr_PutHiddenParSelectedUsrsCods (&Gbl.Usrs.Selected);
|
2016-11-27 17:30:10 +01:00
|
|
|
|
Par_PutHiddenParamChar ("ParamOfficeHours",'Y');
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********** Get parameter to show (or not) teachers' office hours ************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
// Returns true if office hours must be shown
|
|
|
|
|
|
|
|
|
|
static bool Rec_GetParamShowOfficeHours (void)
|
|
|
|
|
{
|
2017-01-28 20:32:50 +01:00
|
|
|
|
if (Par_GetParToBool ("ParamOfficeHours"))
|
|
|
|
|
return Par_GetParToBool ("ShowOfficeHours");
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
return Rec_SHOW_OFFICE_HOURS_DEFAULT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************** Update my record in the course and show it ******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_UpdateAndShowMyCrsRecord (void)
|
|
|
|
|
{
|
|
|
|
|
/***** Get list of fields of records in current course *****/
|
|
|
|
|
Rec_GetListRecordFieldsInCurrentCrs ();
|
|
|
|
|
|
|
|
|
|
/***** Allocate memory for the texts of the fields *****/
|
|
|
|
|
Rec_AllocMemFieldsRecordsCrs ();
|
|
|
|
|
|
|
|
|
|
/***** Get data of the record from the form *****/
|
|
|
|
|
Rec_GetFieldsCrsRecordFromForm ();
|
|
|
|
|
|
|
|
|
|
/***** Update the record *****/
|
|
|
|
|
Rec_UpdateCrsRecord (Gbl.Usrs.Me.UsrDat.UsrCod);
|
|
|
|
|
|
|
|
|
|
/***** Show updated record *****/
|
|
|
|
|
Rec_ShowMyCrsRecordUpdated ();
|
|
|
|
|
|
|
|
|
|
/***** Free memory used for some fields *****/
|
|
|
|
|
Rec_FreeMemFieldsRecordsCrs ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2015-10-03 21:10:47 +02:00
|
|
|
|
/***** Update record in the course of one student and show records again *****/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_UpdateAndShowOtherCrsRecord (void)
|
|
|
|
|
{
|
2015-10-03 21:10:47 +02:00
|
|
|
|
extern const char *Txt_Student_record_card_in_this_course_has_been_updated;
|
2017-05-09 20:56:02 +02:00
|
|
|
|
long OriginalActCod;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-05-09 20:56:02 +02:00
|
|
|
|
/***** Get where we came from *****/
|
|
|
|
|
OriginalActCod = Par_GetParToLong ("OriginalActCod");
|
|
|
|
|
Gbl.Action.Original = Act_GetActionFromActCod (OriginalActCod);
|
2017-05-09 10:32:54 +02:00
|
|
|
|
|
2015-10-03 21:10:47 +02:00
|
|
|
|
/***** Get the user whose record we want to modify *****/
|
2016-01-25 14:40:57 +01:00
|
|
|
|
Usr_GetParamOtherUsrCodEncryptedAndGetListIDs ();
|
2021-04-24 15:10:07 +02:00
|
|
|
|
Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,
|
|
|
|
|
Usr_DONT_GET_PREFS,
|
|
|
|
|
Usr_GET_ROLE_IN_CURRENT_CRS);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get list of fields of records in current course *****/
|
|
|
|
|
Rec_GetListRecordFieldsInCurrentCrs ();
|
|
|
|
|
|
|
|
|
|
/***** Allocate memory for the texts of the fields *****/
|
|
|
|
|
Rec_AllocMemFieldsRecordsCrs ();
|
|
|
|
|
|
|
|
|
|
/***** Get data of the record from the form *****/
|
|
|
|
|
Rec_GetFieldsCrsRecordFromForm ();
|
|
|
|
|
|
|
|
|
|
/***** Update the record *****/
|
|
|
|
|
Rec_UpdateCrsRecord (Gbl.Usrs.Other.UsrDat.UsrCod);
|
2019-03-09 20:12:44 +01:00
|
|
|
|
Ale_CreateAlert (Ale_SUCCESS,NULL,
|
|
|
|
|
Txt_Student_record_card_in_this_course_has_been_updated);
|
2017-05-09 10:32:54 +02:00
|
|
|
|
|
|
|
|
|
/***** Show one or multiple records *****/
|
2017-05-09 20:56:02 +02:00
|
|
|
|
switch (Gbl.Action.Original)
|
|
|
|
|
{
|
2019-03-11 13:33:34 +01:00
|
|
|
|
case ActSeeRecSevStd:
|
2017-05-09 20:56:02 +02:00
|
|
|
|
/* Show multiple records again (including the updated one) */
|
|
|
|
|
Rec_ListRecordsStdsShow ();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
/* Show only the updated record of one student */
|
|
|
|
|
Rec_ShowRecordOneStdCrs ();
|
|
|
|
|
break;
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Free memory used for some fields *****/
|
|
|
|
|
Rec_FreeMemFieldsRecordsCrs ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2016-11-18 01:07:00 +01:00
|
|
|
|
/************************* Show shared record card ***************************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
// Show form or only data depending on TypeOfView
|
|
|
|
|
|
2016-11-18 00:17:53 +01:00
|
|
|
|
static void Rec_ShowCrsRecord (Rec_CourseRecordViewType_t TypeOfView,
|
|
|
|
|
struct UsrData *UsrDat,const char *Anchor)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2016-11-18 00:17:53 +01:00
|
|
|
|
extern const char *Hlp_USERS_Students_course_record_card;
|
2019-02-22 21:47:50 +01:00
|
|
|
|
extern const char *The_ClassFormInBox[The_NUM_THEMES];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
extern const char *Txt_RECORD_FIELD_VISIBILITY_RECORD[Rec_NUM_TYPES_VISIBILITY];
|
2019-02-18 18:27:45 +01:00
|
|
|
|
extern const char *Txt_Save_changes;
|
2016-11-18 00:17:53 +01:00
|
|
|
|
const char *Rec_RecordHelp[Rec_COURSE_NUM_VIEW_TYPES] =
|
|
|
|
|
{
|
2019-11-22 01:04:03 +01:00
|
|
|
|
[Rec_CRS_MY_RECORD_AS_STUDENT_FORM ] = Hlp_USERS_Students_course_record_card,
|
|
|
|
|
[Rec_CRS_MY_RECORD_AS_STUDENT_CHECK] = Hlp_USERS_Students_course_record_card,
|
|
|
|
|
[Rec_CRS_LIST_ONE_RECORD ] = Hlp_USERS_Students_course_record_card,
|
|
|
|
|
[Rec_CRS_LIST_SEVERAL_RECORDS ] = Hlp_USERS_Students_course_record_card,
|
|
|
|
|
[Rec_CRS_PRINT_ONE_RECORD ] = NULL,
|
|
|
|
|
[Rec_CRS_PRINT_SEVERAL_RECORDS ] = NULL,
|
2016-11-18 00:17:53 +01:00
|
|
|
|
};
|
2019-11-08 01:10:32 +01:00
|
|
|
|
char StrRecordWidth[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
|
2015-07-17 13:06:32 +02:00
|
|
|
|
bool ItsMe;
|
2017-01-25 18:48:41 +01:00
|
|
|
|
bool ICanEdit = false;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
unsigned NumField;
|
|
|
|
|
MYSQL_RES *mysql_res;
|
|
|
|
|
MYSQL_ROW row = NULL; // Initialized to avoid warning
|
2015-07-17 13:06:32 +02:00
|
|
|
|
bool ShowField;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
bool ThisFieldHasText;
|
2017-01-25 18:48:41 +01:00
|
|
|
|
bool ICanEditThisField;
|
2017-01-15 22:58:26 +01:00
|
|
|
|
char Text[Cns_MAX_BYTES_TEXT + 1];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-06-04 18:18:54 +02:00
|
|
|
|
switch (Gbl.Usrs.Me.Role.Logged)
|
2015-07-17 13:06:32 +02:00
|
|
|
|
{
|
2017-05-24 01:43:00 +02:00
|
|
|
|
case Rol_STD: // I am a student
|
2018-10-10 23:56:42 +02:00
|
|
|
|
ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
2018-10-10 14:03:06 +02:00
|
|
|
|
if (ItsMe)
|
2015-07-17 13:06:32 +02:00
|
|
|
|
{
|
2017-05-24 01:43:00 +02:00
|
|
|
|
switch (TypeOfView)
|
|
|
|
|
{
|
|
|
|
|
case Rec_CRS_LIST_ONE_RECORD:
|
|
|
|
|
case Rec_CRS_LIST_SEVERAL_RECORDS:
|
|
|
|
|
// When listing records, I can see only my record as student
|
|
|
|
|
TypeOfView = Rec_CRS_MY_RECORD_AS_STUDENT_FORM;
|
|
|
|
|
break;
|
|
|
|
|
case Rec_CRS_MY_RECORD_AS_STUDENT_FORM:
|
|
|
|
|
case Rec_CRS_MY_RECORD_AS_STUDENT_CHECK:
|
|
|
|
|
case Rec_CRS_PRINT_ONE_RECORD:
|
|
|
|
|
case Rec_CRS_PRINT_SEVERAL_RECORDS:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_NoPermissionExit ();
|
2017-05-24 01:43:00 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (TypeOfView == Rec_CRS_MY_RECORD_AS_STUDENT_FORM)
|
|
|
|
|
/* Check if I can edit any of the record fields */
|
|
|
|
|
for (NumField = 0;
|
2019-04-04 10:45:15 +02:00
|
|
|
|
NumField < Gbl.Crs.Records.LstFields.Num;
|
2017-05-24 01:43:00 +02:00
|
|
|
|
NumField++)
|
2019-04-04 10:45:15 +02:00
|
|
|
|
if (Gbl.Crs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD)
|
2017-05-24 01:43:00 +02:00
|
|
|
|
{
|
|
|
|
|
ICanEdit = true;
|
2021-03-02 00:54:26 +01:00
|
|
|
|
Frm_BeginForm (ActRcvRecCrs);
|
2017-05-24 01:43:00 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-10-10 23:56:42 +02:00
|
|
|
|
else // Not me ==> I am a student trying to do something forbidden
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_NoPermissionExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
break;
|
2017-05-24 01:43:00 +02:00
|
|
|
|
case Rol_NET:
|
2017-05-08 20:48:27 +02:00
|
|
|
|
break;
|
2017-05-24 01:43:00 +02:00
|
|
|
|
case Rol_TCH:
|
|
|
|
|
case Rol_SYS_ADM:
|
|
|
|
|
if (TypeOfView == Rec_CRS_LIST_ONE_RECORD ||
|
|
|
|
|
TypeOfView == Rec_CRS_LIST_SEVERAL_RECORDS)
|
|
|
|
|
{
|
|
|
|
|
ICanEdit = true;
|
2021-06-29 15:25:42 +02:00
|
|
|
|
Frm_BeginFormAnchor (ActRcvRecOthUsr,Anchor);
|
2019-11-03 13:19:32 +01:00
|
|
|
|
Par_PutHiddenParamLong (NULL,"OriginalActCod",
|
2019-03-11 13:33:34 +01:00
|
|
|
|
Act_GetActCod (ActSeeRecSevStd)); // Original action, used to know where we came from
|
2021-02-15 16:25:55 +01:00
|
|
|
|
Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod);
|
2017-05-24 01:43:00 +02:00
|
|
|
|
if (TypeOfView == Rec_CRS_LIST_SEVERAL_RECORDS)
|
2019-11-15 03:34:48 +01:00
|
|
|
|
Usr_PutHiddenParSelectedUsrsCods (&Gbl.Usrs.Selected);
|
2017-05-24 01:43:00 +02:00
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
break;
|
|
|
|
|
default:
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongRoleExit ();
|
2017-05-24 01:43:00 +02:00
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2019-10-26 02:19:42 +02:00
|
|
|
|
/***** Begin box and table *****/
|
2021-02-15 16:25:55 +01:00
|
|
|
|
snprintf (StrRecordWidth,sizeof (StrRecordWidth),"%upx",Rec_RECORD_WIDTH);
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Box_BoxTableBegin (StrRecordWidth,NULL,
|
|
|
|
|
NULL,NULL,
|
2017-06-12 15:03:29 +02:00
|
|
|
|
Rec_RecordHelp[TypeOfView],Box_NOT_CLOSABLE,2);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Write heading *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
HTM_TD_Begin ("colspan=\"2\" class=\"LT\"");
|
|
|
|
|
HTM_TABLE_BeginWide ();
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
|
|
|
|
HTM_TD_Begin ("class=\"LM\" style=\"width:%upx;\"",Rec_DEGREE_LOGO_SIZE);
|
|
|
|
|
Lgo_DrawLogo (HieLvl_DEG,Gbl.Hierarchy.Deg.DegCod,
|
|
|
|
|
Gbl.Hierarchy.Deg.ShrtName,Rec_DEGREE_LOGO_SIZE,NULL,true);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
HTM_TD_Begin ("class=\"REC_HEAD CM\"");
|
|
|
|
|
HTM_Txt (Gbl.Hierarchy.Deg.FullName);
|
|
|
|
|
HTM_BR ();
|
|
|
|
|
HTM_Txt (Gbl.Hierarchy.Crs.FullName);
|
|
|
|
|
HTM_BR ();
|
|
|
|
|
HTM_Txt (UsrDat->FullName);
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
HTM_TABLE_End ();
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
HTM_TR_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Fields of the record that depends on the course *****/
|
|
|
|
|
for (NumField = 0, Gbl.RowEvenOdd = 0;
|
|
|
|
|
NumField < Gbl.Crs.Records.LstFields.Num;
|
|
|
|
|
NumField++, Gbl.RowEvenOdd = 1 - Gbl.RowEvenOdd)
|
|
|
|
|
{
|
|
|
|
|
ShowField = !(TypeOfView == Rec_CRS_MY_RECORD_AS_STUDENT_FORM ||
|
|
|
|
|
TypeOfView == Rec_CRS_MY_RECORD_AS_STUDENT_CHECK) ||
|
|
|
|
|
Gbl.Crs.Records.LstFields.Lst[NumField].Visibility != Rec_HIDDEN_FIELD;
|
|
|
|
|
// If the field must be shown...
|
|
|
|
|
if (ShowField)
|
2017-05-24 01:43:00 +02:00
|
|
|
|
{
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Can I edit this field? */
|
|
|
|
|
switch (Gbl.Usrs.Me.Role.Logged)
|
|
|
|
|
{
|
|
|
|
|
case Rol_STD:
|
|
|
|
|
ICanEditThisField = (TypeOfView == Rec_CRS_MY_RECORD_AS_STUDENT_FORM &&
|
|
|
|
|
Gbl.Crs.Records.LstFields.Lst[NumField].Visibility == Rec_EDITABLE_FIELD);
|
|
|
|
|
break;
|
|
|
|
|
case Rol_TCH:
|
|
|
|
|
case Rol_SYS_ADM:
|
|
|
|
|
ICanEditThisField = (TypeOfView == Rec_CRS_LIST_ONE_RECORD ||
|
|
|
|
|
TypeOfView == Rec_CRS_LIST_SEVERAL_RECORDS);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
ICanEditThisField = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Name of the field */
|
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-09 23:49:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"REC_C1_BOT %s RT COLOR%u\"",
|
|
|
|
|
ICanEditThisField ? The_ClassFormInBox[Gbl.Prefs.Theme] :
|
|
|
|
|
"REC_DAT_SMALL",
|
|
|
|
|
Gbl.RowEvenOdd);
|
|
|
|
|
HTM_TxtColon (Gbl.Crs.Records.LstFields.Lst[NumField].Name);
|
|
|
|
|
if (TypeOfView == Rec_CRS_LIST_ONE_RECORD ||
|
|
|
|
|
TypeOfView == Rec_CRS_LIST_SEVERAL_RECORDS)
|
|
|
|
|
{
|
|
|
|
|
HTM_SPAN_Begin ("class=\"DAT_SMALL\"");
|
|
|
|
|
HTM_NBSP ();
|
|
|
|
|
HTM_TxtF ("(%s)",Txt_RECORD_FIELD_VISIBILITY_RECORD[Gbl.Crs.Records.LstFields.Lst[NumField].Visibility]);
|
|
|
|
|
HTM_SPAN_End ();
|
|
|
|
|
}
|
|
|
|
|
HTM_TD_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Get the text of the field */
|
|
|
|
|
if (Rec_DB_GetFieldFromCrsRecord (&mysql_res,UsrDat->UsrCod,
|
|
|
|
|
Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod))
|
|
|
|
|
{
|
|
|
|
|
ThisFieldHasText = true;
|
|
|
|
|
row = mysql_fetch_row (mysql_res);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
ThisFieldHasText = false;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Write form, text, or nothing depending on
|
|
|
|
|
the user's role and the visibility of the field */
|
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_BOT DAT_N LT COLOR%u\"",Gbl.RowEvenOdd);
|
|
|
|
|
if (ICanEditThisField) // Show with form
|
|
|
|
|
{
|
|
|
|
|
HTM_TEXTAREA_Begin ("name=\"Field%ld\" rows=\"%u\""
|
|
|
|
|
" class=\"REC_C2_BOT_INPUT\"",
|
|
|
|
|
Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod,
|
|
|
|
|
Gbl.Crs.Records.LstFields.Lst[NumField].NumLines);
|
|
|
|
|
if (ThisFieldHasText)
|
|
|
|
|
HTM_Txt (row[0]);
|
|
|
|
|
HTM_TEXTAREA_End ();
|
|
|
|
|
}
|
|
|
|
|
else // Show without form
|
|
|
|
|
{
|
|
|
|
|
if (ThisFieldHasText)
|
|
|
|
|
{
|
|
|
|
|
Str_Copy (Text,row[0],sizeof (Text));
|
|
|
|
|
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML,
|
|
|
|
|
Text,Cns_MAX_BYTES_TEXT,false);
|
|
|
|
|
HTM_Txt (Text);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
HTM_Hyphen ();
|
|
|
|
|
}
|
|
|
|
|
HTM_TD_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
|
|
|
|
|
/* Free structure that stores the query result */
|
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-06-12 14:16:33 +02:00
|
|
|
|
/***** End box *****/
|
2017-01-25 18:48:41 +01:00
|
|
|
|
if (ICanEdit)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2017-06-12 14:16:33 +02:00
|
|
|
|
/* End table, send button and end box */
|
2019-11-25 23:18:08 +01:00
|
|
|
|
Box_BoxTableWithButtonEnd (Btn_CONFIRM_BUTTON,Txt_Save_changes);
|
2017-06-12 14:16:33 +02:00
|
|
|
|
|
|
|
|
|
/* End form */
|
2018-11-09 20:47:39 +01:00
|
|
|
|
Frm_EndForm ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
2015-04-11 23:46:21 +02:00
|
|
|
|
else
|
2017-06-12 14:16:33 +02:00
|
|
|
|
/* End table and box */
|
2019-11-25 23:18:08 +01:00
|
|
|
|
Box_BoxTableEnd ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** Get the text of a field of a record of course ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-05-10 21:10:06 +02:00
|
|
|
|
unsigned Rec_DB_GetFieldFromCrsRecord (MYSQL_RES **mysql_res,long UsrCod,long FieldCod)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2018-11-01 19:23:52 +01:00
|
|
|
|
return DB_QuerySELECT (mysql_res,"can not get the text"
|
|
|
|
|
" of a field of a record",
|
2021-04-05 23:45:24 +02:00
|
|
|
|
"SELECT Txt" // row[0]
|
2021-03-29 16:38:56 +02:00
|
|
|
|
" FROM crs_records"
|
|
|
|
|
" WHERE FieldCod=%ld"
|
|
|
|
|
" AND UsrCod=%ld",
|
2021-04-17 01:08:48 +02:00
|
|
|
|
FieldCod,
|
|
|
|
|
UsrCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/****************** Get the fields of the record from form *******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_GetFieldsCrsRecordFromForm (void)
|
|
|
|
|
{
|
|
|
|
|
unsigned NumField;
|
2019-11-08 01:10:32 +01:00
|
|
|
|
char FieldParamName[5 + Cns_MAX_DECIMAL_DIGITS_LONG + 1];
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
for (NumField = 0;
|
2019-04-04 10:45:15 +02:00
|
|
|
|
NumField < Gbl.Crs.Records.LstFields.Num;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
NumField++)
|
2019-04-04 10:45:15 +02:00
|
|
|
|
if (Rec_CheckIfICanEditField (Gbl.Crs.Records.LstFields.Lst[NumField].Visibility))
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2019-02-18 19:35:52 +01:00
|
|
|
|
/* Get text from the form */
|
2021-02-15 16:25:55 +01:00
|
|
|
|
snprintf (FieldParamName,sizeof (FieldParamName),"Field%ld",
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod);
|
|
|
|
|
Par_GetParToHTML (FieldParamName,Gbl.Crs.Records.LstFields.Lst[NumField].Text,Cns_MAX_BYTES_TEXT);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************************** Update record of a user *************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_UpdateCrsRecord (long UsrCod)
|
|
|
|
|
{
|
|
|
|
|
unsigned NumField;
|
|
|
|
|
MYSQL_RES *mysql_res;
|
|
|
|
|
bool FieldAlreadyExists;
|
|
|
|
|
|
|
|
|
|
for (NumField = 0;
|
2019-04-04 10:45:15 +02:00
|
|
|
|
NumField < Gbl.Crs.Records.LstFields.Num;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
NumField++)
|
2019-04-04 10:45:15 +02:00
|
|
|
|
if (Rec_CheckIfICanEditField (Gbl.Crs.Records.LstFields.Lst[NumField].Visibility))
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Check if already exists this field for this user in database *****/
|
2021-05-10 21:10:06 +02:00
|
|
|
|
FieldAlreadyExists = (Rec_DB_GetFieldFromCrsRecord (&mysql_res,UsrCod,
|
|
|
|
|
Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod) != 0);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
DB_FreeMySQLResult (&mysql_res);
|
|
|
|
|
if (FieldAlreadyExists)
|
|
|
|
|
{
|
2019-04-04 10:45:15 +02:00
|
|
|
|
if (Gbl.Crs.Records.LstFields.Lst[NumField].Text[0])
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/***** Update text of the field of record course *****/
|
2018-11-03 12:16:40 +01:00
|
|
|
|
DB_QueryUPDATE ("can not update field of record",
|
2021-04-17 13:11:37 +02:00
|
|
|
|
"UPDATE crs_records"
|
|
|
|
|
" SET Txt='%s'"
|
|
|
|
|
" WHERE UsrCod=%ld"
|
|
|
|
|
" AND FieldCod=%ld",
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.LstFields.Lst[NumField].Text,
|
2018-11-03 12:16:40 +01:00
|
|
|
|
UsrCod,
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
else
|
|
|
|
|
/***** Remove text of the field of record course *****/
|
2018-11-02 22:00:31 +01:00
|
|
|
|
DB_QueryDELETE ("can not remove field of record",
|
|
|
|
|
"DELETE FROM crs_records"
|
2021-04-17 13:40:55 +02:00
|
|
|
|
" WHERE UsrCod=%ld"
|
|
|
|
|
" AND FieldCod=%ld",
|
2018-11-02 22:00:31 +01:00
|
|
|
|
UsrCod,
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
2019-04-04 10:45:15 +02:00
|
|
|
|
else if (Gbl.Crs.Records.LstFields.Lst[NumField].Text[0])
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/***** Insert text field of record course *****/
|
2018-11-02 19:37:11 +01:00
|
|
|
|
DB_QueryINSERT ("can not create field of record",
|
|
|
|
|
"INSERT INTO crs_records"
|
|
|
|
|
" (FieldCod,UsrCod,Txt)"
|
|
|
|
|
" VALUES"
|
|
|
|
|
" (%ld,%ld,'%s')",
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.LstFields.Lst[NumField].FieldCod,
|
2018-11-02 19:37:11 +01:00
|
|
|
|
UsrCod,
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.LstFields.Lst[NumField].Text);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************ Remove fields of record of a user in current course ************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-05-10 21:10:06 +02:00
|
|
|
|
void Rec_DB_RemoveFieldsCrsRecordInCrs (long UsrCod,struct Crs_Course *Crs)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2018-11-02 22:00:31 +01:00
|
|
|
|
DB_QueryDELETE ("can not remove user's record in a course",
|
|
|
|
|
"DELETE FROM crs_records"
|
2021-03-29 16:38:56 +02:00
|
|
|
|
" WHERE UsrCod=%ld"
|
|
|
|
|
" AND FieldCod IN"
|
|
|
|
|
" (SELECT FieldCod"
|
|
|
|
|
" FROM crs_record_fields"
|
|
|
|
|
" WHERE CrsCod=%ld)",
|
2018-11-02 22:00:31 +01:00
|
|
|
|
UsrCod,Crs->CrsCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************* Remove fields of record of a user in all courses **************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-05-10 21:10:06 +02:00
|
|
|
|
void Rec_DB_RemoveFieldsCrsRecordAll (long UsrCod)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2018-11-02 22:00:31 +01:00
|
|
|
|
DB_QueryDELETE ("can not remove user's records in all courses",
|
2021-04-17 13:40:55 +02:00
|
|
|
|
"DELETE FROM crs_records"
|
|
|
|
|
" WHERE UsrCod=%ld",
|
2018-11-02 22:00:31 +01:00
|
|
|
|
UsrCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************** Show my record in the course already updated ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2015-03-30 13:59:32 +02:00
|
|
|
|
static void Rec_ShowMyCrsRecordUpdated (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Your_record_card_in_this_course_has_been_updated;
|
|
|
|
|
|
2019-02-16 18:25:41 +01:00
|
|
|
|
/***** Write success message *****/
|
|
|
|
|
Ale_ShowAlert (Ale_SUCCESS,Txt_Your_record_card_in_this_course_has_been_updated);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2016-11-18 01:07:00 +01:00
|
|
|
|
/***** Shared record *****/
|
2017-05-09 20:56:02 +02:00
|
|
|
|
Rec_ShowSharedUsrRecord (Rec_SHA_RECORD_LIST,&Gbl.Usrs.Me.UsrDat,NULL);
|
2015-03-30 14:51:32 +02:00
|
|
|
|
|
|
|
|
|
/***** Show updated user's record *****/
|
2016-11-18 00:17:53 +01:00
|
|
|
|
Rec_ShowCrsRecord (Rec_CRS_MY_RECORD_AS_STUDENT_CHECK,&Gbl.Usrs.Me.UsrDat,NULL);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***** Allocate memory for the text of the field of the record in course *****/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_AllocMemFieldsRecordsCrs (void)
|
|
|
|
|
{
|
|
|
|
|
unsigned NumField;
|
|
|
|
|
|
|
|
|
|
for (NumField = 0;
|
2019-04-04 10:45:15 +02:00
|
|
|
|
NumField < Gbl.Crs.Records.LstFields.Num;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
NumField++)
|
2019-04-04 10:45:15 +02:00
|
|
|
|
if (Rec_CheckIfICanEditField (Gbl.Crs.Records.LstFields.Lst[NumField].Visibility))
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/* Allocate memory for the texts of the fields */
|
2021-02-15 16:25:55 +01:00
|
|
|
|
if ((Gbl.Crs.Records.LstFields.Lst[NumField].Text = malloc (Cns_MAX_BYTES_TEXT + 1)) == NULL)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_NotEnoughMemoryExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**** Free memory used by the texts of the field of the record in course *****/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_FreeMemFieldsRecordsCrs (void)
|
|
|
|
|
{
|
|
|
|
|
unsigned NumField;
|
|
|
|
|
|
|
|
|
|
for (NumField = 0;
|
2019-04-04 10:45:15 +02:00
|
|
|
|
NumField < Gbl.Crs.Records.LstFields.Num;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
NumField++)
|
2019-04-04 10:45:15 +02:00
|
|
|
|
if (Rec_CheckIfICanEditField (Gbl.Crs.Records.LstFields.Lst[NumField].Visibility))
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/* Free memory of the text of the field */
|
2019-04-04 10:45:15 +02:00
|
|
|
|
if (Gbl.Crs.Records.LstFields.Lst[NumField].Text)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2019-11-06 19:45:20 +01:00
|
|
|
|
free (Gbl.Crs.Records.LstFields.Lst[NumField].Text);
|
2019-04-04 10:45:15 +02:00
|
|
|
|
Gbl.Crs.Records.LstFields.Lst[NumField].Text = NULL;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-05-22 14:52:11 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* Check if I can edit a field depending on my role and the field visibility */
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static bool Rec_CheckIfICanEditField (Rec_VisibilityRecordFields_t Visibility)
|
|
|
|
|
{
|
|
|
|
|
// Non-editing teachers can not edit fields
|
2017-06-04 18:18:54 +02:00
|
|
|
|
return Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
|
|
|
|
|
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM ||
|
|
|
|
|
(Gbl.Usrs.Me.Role.Logged == Rol_STD &&
|
2017-05-22 14:52:11 +02:00
|
|
|
|
Visibility == Rec_EDITABLE_FIELD);
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
2016-11-18 01:07:00 +01:00
|
|
|
|
/*********** Show form to sign up and edit my shared record card *************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-05-30 02:17:33 +02:00
|
|
|
|
void Rec_ShowFormSignUpInCrsWithMySharedRecord (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Show the form *****/
|
2017-05-30 02:17:33 +02:00
|
|
|
|
Rec_ShowSharedUsrRecord (Rec_SHA_SIGN_UP_IN_CRS_FORM,&Gbl.Usrs.Me.UsrDat,NULL);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************** Show form to edit the record of a new user ******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-01-27 12:57:31 +01:00
|
|
|
|
void Rec_ShowFormOtherNewSharedRecord (struct UsrData *UsrDat,Rol_Role_t DefaultRole)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Show the form *****/
|
2021-09-12 14:20:24 +02:00
|
|
|
|
/* In this case UsrDat->Roles.InCurrentCrs
|
2017-01-27 12:57:31 +01:00
|
|
|
|
is not the current role in current course.
|
|
|
|
|
Instead it is initialized with the preferred role. */
|
2021-05-27 23:30:16 +02:00
|
|
|
|
UsrDat->Roles.InCurrentCrs = (Gbl.Hierarchy.Level == HieLvl_CRS) ? DefaultRole : // Course selected
|
2021-09-12 14:20:24 +02:00
|
|
|
|
Rol_UNK; // No course selected
|
2017-05-09 20:56:02 +02:00
|
|
|
|
Rec_ShowSharedUsrRecord (Rec_SHA_OTHER_NEW_USR_FORM,UsrDat,NULL);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-03-09 22:01:06 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********* Show other existing user's shared record to be edited *************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_ShowOtherSharedRecordEditable (void)
|
|
|
|
|
{
|
|
|
|
|
/***** User's record *****/
|
|
|
|
|
Rec_ShowSharedUsrRecord (Rec_SHA_OTHER_EXISTING_USR_FORM,
|
|
|
|
|
&Gbl.Usrs.Other.UsrDat,NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*********************** Show my record after update *************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-11-18 01:07:00 +01:00
|
|
|
|
void Rec_ShowMySharedRecordUpd (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Your_personal_data_have_been_updated;
|
|
|
|
|
|
|
|
|
|
/***** Write alert *****/
|
2019-02-16 18:25:41 +01:00
|
|
|
|
Ale_ShowAlert (Ale_SUCCESS,Txt_Your_personal_data_have_been_updated);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2018-10-09 00:06:30 +02:00
|
|
|
|
/***** Show my record and other data *****/
|
2018-10-09 13:41:55 +02:00
|
|
|
|
Rec_ShowMySharedRecordAndMore ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************** Show user's record for check *************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-11-18 01:07:00 +01:00
|
|
|
|
void Rec_ShowSharedRecordUnmodifiable (struct UsrData *UsrDat)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Get password, user type and user's data from database *****/
|
2021-04-24 15:10:07 +02:00
|
|
|
|
Usr_GetAllUsrDataFromUsrCod (UsrDat,
|
|
|
|
|
Usr_DONT_GET_PREFS,
|
|
|
|
|
Usr_GET_ROLE_IN_CURRENT_CRS);
|
2017-06-09 15:04:02 +02:00
|
|
|
|
UsrDat->Accepted = Usr_CheckIfUsrHasAcceptedInCurrentCrs (UsrDat);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Show user's record *****/
|
2019-10-24 00:04:40 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"CM\"");
|
2021-07-08 15:00:17 +02:00
|
|
|
|
Rec_ShowSharedUsrRecord (Rec_SHA_OTHER_USR_CHECK,UsrDat,NULL);
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2018-10-09 01:04:47 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************** Show public shared record card of another user ***************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_ShowPublicSharedRecordOtherUsr (void)
|
|
|
|
|
{
|
|
|
|
|
Rec_ShowSharedUsrRecord (Rec_SHA_RECORD_PUBLIC,&Gbl.Usrs.Other.UsrDat,NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
2016-11-18 01:07:00 +01:00
|
|
|
|
/************************** Show shared record card **************************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
// Show form or only data depending on TypeOfView
|
|
|
|
|
|
2016-11-18 00:17:53 +01:00
|
|
|
|
void Rec_ShowSharedUsrRecord (Rec_SharedRecordViewType_t TypeOfView,
|
2017-05-09 20:56:02 +02:00
|
|
|
|
struct UsrData *UsrDat,const char *Anchor)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2017-03-02 21:18:52 +01:00
|
|
|
|
extern const char *Hlp_USERS_SignUp;
|
2016-11-13 13:31:39 +01:00
|
|
|
|
extern const char *Hlp_PROFILE_Record;
|
2019-03-12 21:25:55 +01:00
|
|
|
|
extern const char *Hlp_START_Profiles_view_public_profile;
|
2016-11-20 20:03:47 +01:00
|
|
|
|
extern const char *Hlp_USERS_Guests;
|
2016-11-18 00:17:53 +01:00
|
|
|
|
extern const char *Hlp_USERS_Students_shared_record_card;
|
2016-11-18 10:08:01 +01:00
|
|
|
|
extern const char *Hlp_USERS_Teachers_shared_record_card;
|
2017-05-30 02:17:33 +02:00
|
|
|
|
extern const char *Txt_Sign_up;
|
2015-03-29 14:09:23 +02:00
|
|
|
|
extern const char *Txt_Save_changes;
|
2015-03-29 21:43:33 +02:00
|
|
|
|
extern const char *Txt_Register;
|
|
|
|
|
extern const char *Txt_Confirm;
|
2016-11-18 00:17:53 +01:00
|
|
|
|
const char *Rec_RecordHelp[Rec_SHARED_NUM_VIEW_TYPES] =
|
|
|
|
|
{
|
2019-11-22 01:04:03 +01:00
|
|
|
|
[Rec_SHA_SIGN_UP_IN_CRS_FORM ] = Hlp_USERS_SignUp,
|
2016-11-18 00:17:53 +01:00
|
|
|
|
|
2019-11-22 01:04:03 +01:00
|
|
|
|
[Rec_SHA_MY_RECORD_FORM ] = Hlp_PROFILE_Record,
|
2016-11-18 00:17:53 +01:00
|
|
|
|
|
2019-11-22 01:04:03 +01:00
|
|
|
|
[Rec_SHA_OTHER_EXISTING_USR_FORM] = NULL,
|
|
|
|
|
[Rec_SHA_OTHER_NEW_USR_FORM ] = NULL,
|
|
|
|
|
[Rec_SHA_OTHER_USR_CHECK ] = NULL,
|
2016-11-18 00:17:53 +01:00
|
|
|
|
|
2019-11-22 01:04:03 +01:00
|
|
|
|
[Rec_SHA_RECORD_LIST ] = NULL,
|
|
|
|
|
[Rec_SHA_RECORD_PRINT ] = NULL,
|
|
|
|
|
[Rec_SHA_RECORD_PUBLIC ] = Hlp_START_Profiles_view_public_profile,
|
2016-11-18 00:17:53 +01:00
|
|
|
|
};
|
|
|
|
|
const char *Rec_RecordListHelp[Rol_NUM_ROLES] =
|
|
|
|
|
{
|
2019-11-22 01:04:03 +01:00
|
|
|
|
[Rol_UNK ] = NULL,
|
|
|
|
|
[Rol_GST ] = Hlp_USERS_Guests,
|
|
|
|
|
[Rol_USR ] = NULL,
|
|
|
|
|
[Rol_STD ] = Hlp_USERS_Students_shared_record_card,
|
|
|
|
|
[Rol_NET ] = Hlp_USERS_Teachers_shared_record_card,
|
|
|
|
|
[Rol_TCH ] = Hlp_USERS_Teachers_shared_record_card,
|
|
|
|
|
[Rol_DEG_ADM] = NULL,
|
|
|
|
|
[Rol_CTR_ADM] = NULL,
|
|
|
|
|
[Rol_INS_ADM] = NULL,
|
|
|
|
|
[Rol_SYS_ADM] = NULL,
|
2016-11-18 00:17:53 +01:00
|
|
|
|
};
|
2019-11-08 01:10:32 +01:00
|
|
|
|
char StrRecordWidth[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
|
2016-12-13 13:32:19 +01:00
|
|
|
|
bool ItsMe;
|
2017-05-22 14:52:11 +02:00
|
|
|
|
bool IAmLoggedAsTeacherOrSysAdm;
|
2016-12-13 13:32:19 +01:00
|
|
|
|
bool CountryForm;
|
2017-01-25 18:48:41 +01:00
|
|
|
|
bool ICanEdit;
|
2015-03-24 10:11:17 +01:00
|
|
|
|
bool PutFormLinks; // Put links (forms) inside record card
|
2016-12-13 13:32:19 +01:00
|
|
|
|
bool ShowData;
|
|
|
|
|
bool ShowIDRows;
|
|
|
|
|
bool ShowAddressRows;
|
2017-05-22 14:52:11 +02:00
|
|
|
|
bool StudentInCurrentCrs;
|
|
|
|
|
bool TeacherInCurrentCrs;
|
2016-12-13 13:32:19 +01:00
|
|
|
|
bool ShowTeacherRows;
|
2021-02-11 00:58:53 +01:00
|
|
|
|
struct Ins_Instit Ins;
|
2017-05-22 14:52:11 +02:00
|
|
|
|
Act_Action_t NextAction;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2016-04-22 12:44:56 +02:00
|
|
|
|
/***** Initializations *****/
|
2018-10-10 23:56:42 +02:00
|
|
|
|
ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
2017-06-04 18:18:54 +02:00
|
|
|
|
IAmLoggedAsTeacherOrSysAdm = (Gbl.Usrs.Me.Role.Logged == Rol_NET || // My current role is non-editing teacher
|
|
|
|
|
Gbl.Usrs.Me.Role.Logged == Rol_TCH || // My current role is teacher
|
|
|
|
|
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM); // My current role is system admin
|
2016-12-13 13:32:19 +01:00
|
|
|
|
CountryForm = (TypeOfView == Rec_SHA_MY_RECORD_FORM);
|
|
|
|
|
ShowData = (ItsMe ||
|
2017-06-04 18:18:54 +02:00
|
|
|
|
Gbl.Usrs.Me.Role.Logged >= Rol_DEG_ADM ||
|
2016-12-13 13:32:19 +01:00
|
|
|
|
UsrDat->Accepted);
|
|
|
|
|
ShowIDRows = (TypeOfView != Rec_SHA_RECORD_PUBLIC);
|
2017-05-22 14:52:11 +02:00
|
|
|
|
|
2021-04-24 15:10:07 +02:00
|
|
|
|
StudentInCurrentCrs = UsrDat->Roles.InCurrentCrs == Rol_STD;
|
|
|
|
|
TeacherInCurrentCrs = UsrDat->Roles.InCurrentCrs == Rol_NET ||
|
|
|
|
|
UsrDat->Roles.InCurrentCrs == Rol_TCH;
|
2017-05-22 14:52:11 +02:00
|
|
|
|
|
2016-12-13 13:32:19 +01:00
|
|
|
|
ShowAddressRows = (TypeOfView == Rec_SHA_MY_RECORD_FORM ||
|
|
|
|
|
((TypeOfView == Rec_SHA_RECORD_LIST ||
|
|
|
|
|
TypeOfView == Rec_SHA_RECORD_PRINT) &&
|
2017-05-22 14:52:11 +02:00
|
|
|
|
IAmLoggedAsTeacherOrSysAdm &&
|
|
|
|
|
StudentInCurrentCrs)); // He/she is a student in the current course
|
2021-04-24 15:10:07 +02:00
|
|
|
|
Rol_GetRolesInAllCrss (UsrDat); // Get user's roles if not got
|
2018-10-09 00:06:30 +02:00
|
|
|
|
ShowTeacherRows = (TypeOfView == Rec_SHA_RECORD_LIST ||
|
|
|
|
|
TypeOfView == Rec_SHA_RECORD_PRINT) &&
|
|
|
|
|
TeacherInCurrentCrs; // He/she is a teacher in the current course
|
2016-12-13 13:32:19 +01:00
|
|
|
|
|
2017-01-25 18:35:42 +01:00
|
|
|
|
/* Data form = I can edit fields like surnames and name */
|
|
|
|
|
switch (TypeOfView)
|
|
|
|
|
{
|
|
|
|
|
case Rec_SHA_MY_RECORD_FORM:
|
|
|
|
|
case Rec_SHA_OTHER_NEW_USR_FORM:
|
2017-01-25 18:48:41 +01:00
|
|
|
|
ICanEdit = true;
|
2017-01-25 18:35:42 +01:00
|
|
|
|
break;
|
|
|
|
|
case Rec_SHA_OTHER_EXISTING_USR_FORM:
|
2017-01-27 10:42:20 +01:00
|
|
|
|
ICanEdit = Usr_ICanChangeOtherUsrData (UsrDat);
|
2017-01-25 18:35:42 +01:00
|
|
|
|
break;
|
2017-05-30 02:17:33 +02:00
|
|
|
|
default: // In other options, I can not edit user's data
|
2017-01-25 18:48:41 +01:00
|
|
|
|
ICanEdit = false;
|
2017-01-25 18:35:42 +01:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-24 15:10:07 +02:00
|
|
|
|
Rec_RecordHelp[Rec_SHA_RECORD_LIST] = Rec_RecordListHelp[UsrDat->Roles.InCurrentCrs];
|
2016-11-18 00:17:53 +01:00
|
|
|
|
|
2016-01-14 10:31:09 +01:00
|
|
|
|
PutFormLinks = !Gbl.Form.Inside && // Only if not inside another form
|
2018-04-24 13:21:53 +02:00
|
|
|
|
Act_GetBrowserTab (Gbl.Action.Act) == Act_BRW_1ST_TAB; // Only in main browser tab
|
2015-03-24 10:11:17 +01:00
|
|
|
|
|
2016-04-22 12:44:56 +02:00
|
|
|
|
Ins.InsCod = UsrDat->InsCod;
|
|
|
|
|
if (Ins.InsCod > 0)
|
2021-10-01 18:54:12 +02:00
|
|
|
|
Ins_GetDataOfInstitByCod (&Ins);
|
2016-04-22 12:44:56 +02:00
|
|
|
|
|
2019-10-26 02:19:42 +02:00
|
|
|
|
/***** Begin box and table *****/
|
2015-12-13 17:49:53 +01:00
|
|
|
|
sprintf (StrRecordWidth,"%upx",Rec_RECORD_WIDTH);
|
2016-05-05 14:20:38 +02:00
|
|
|
|
Gbl.Record.UsrDat = UsrDat;
|
|
|
|
|
Gbl.Record.TypeOfView = TypeOfView;
|
2020-03-26 02:54:30 +01:00
|
|
|
|
if (TypeOfView == Rec_SHA_OTHER_NEW_USR_FORM)
|
|
|
|
|
Box_BoxTableBegin (StrRecordWidth,NULL,
|
|
|
|
|
NULL,NULL, // New user ==> don't put icons
|
|
|
|
|
Rec_RecordHelp[TypeOfView],Box_NOT_CLOSABLE,2);
|
|
|
|
|
else
|
|
|
|
|
Box_BoxTableBegin (StrRecordWidth,NULL,
|
2020-04-08 22:09:35 +02:00
|
|
|
|
Rec_PutIconsCommands,NULL,
|
2020-03-26 02:54:30 +01:00
|
|
|
|
Rec_RecordHelp[TypeOfView],Box_NOT_CLOSABLE,2);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2016-04-22 12:39:36 +02:00
|
|
|
|
/***** Institution and user's photo *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2021-07-08 15:00:17 +02:00
|
|
|
|
Rec_ShowInstitutionInHead (&Ins,PutFormLinks);
|
|
|
|
|
Rec_ShowPhoto (UsrDat);
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-06-09 15:04:02 +02:00
|
|
|
|
/***** Full name *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2021-07-08 15:00:17 +02:00
|
|
|
|
Rec_ShowFullName (UsrDat);
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** User's nickname *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2021-07-08 15:00:17 +02:00
|
|
|
|
Rec_ShowNickname (UsrDat,PutFormLinks);
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2015-03-05 21:42:02 +01:00
|
|
|
|
|
2016-04-22 20:00:26 +02:00
|
|
|
|
/***** User's country, web and social networks *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2021-07-08 15:00:17 +02:00
|
|
|
|
Rec_ShowCountryInHead (UsrDat,ShowData);
|
|
|
|
|
Rec_ShowWebsAndSocialNets (UsrDat,TypeOfView);
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2015-03-29 13:57:24 +02:00
|
|
|
|
if (ShowIDRows ||
|
|
|
|
|
ShowAddressRows ||
|
|
|
|
|
ShowTeacherRows)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-09 23:49:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_TD_Begin ("colspan=\"3\"");
|
2015-03-29 15:03:35 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Show email and user's IDs *****/
|
|
|
|
|
if (ShowIDRows)
|
|
|
|
|
{
|
|
|
|
|
HTM_TABLE_BeginWidePadding (2);
|
2017-05-09 20:56:02 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Show email */
|
|
|
|
|
Rec_ShowEmail (UsrDat);
|
2017-05-09 20:56:02 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Show user's IDs */
|
|
|
|
|
Rec_ShowUsrIDs (UsrDat,Anchor);
|
2017-05-09 20:56:02 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_TABLE_End ();
|
|
|
|
|
}
|
2016-04-23 19:34:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Begin form *****/
|
|
|
|
|
switch (TypeOfView)
|
2017-05-22 14:52:11 +02:00
|
|
|
|
{
|
2021-07-08 15:00:17 +02:00
|
|
|
|
case Rec_SHA_SIGN_UP_IN_CRS_FORM:
|
|
|
|
|
Frm_BeginForm (ActSignUp);
|
2017-05-22 14:52:11 +02:00
|
|
|
|
break;
|
2021-07-08 15:00:17 +02:00
|
|
|
|
case Rec_SHA_MY_RECORD_FORM:
|
|
|
|
|
Frm_BeginForm (ActChgMyData);
|
2017-05-22 14:52:11 +02:00
|
|
|
|
break;
|
2021-07-08 15:00:17 +02:00
|
|
|
|
case Rec_SHA_OTHER_EXISTING_USR_FORM:
|
|
|
|
|
switch (Gbl.Action.Act)
|
|
|
|
|
{
|
|
|
|
|
case ActReqMdfStd:
|
|
|
|
|
NextAction = ActUpdStd;
|
|
|
|
|
break;
|
|
|
|
|
case ActReqMdfNET:
|
|
|
|
|
NextAction = ActUpdNET;
|
|
|
|
|
break;
|
|
|
|
|
case ActReqMdfTch:
|
|
|
|
|
NextAction = ActUpdTch;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
NextAction = ActUpdOth;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
Frm_BeginForm (NextAction);
|
|
|
|
|
Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod); // Existing user
|
2017-05-22 14:52:11 +02:00
|
|
|
|
break;
|
2021-07-08 15:00:17 +02:00
|
|
|
|
case Rec_SHA_OTHER_NEW_USR_FORM:
|
|
|
|
|
switch (Gbl.Action.Act)
|
|
|
|
|
{
|
|
|
|
|
case ActReqMdfStd:
|
|
|
|
|
NextAction = ActCreStd;
|
|
|
|
|
break;
|
|
|
|
|
case ActReqMdfNET:
|
|
|
|
|
NextAction = ActCreNET;
|
|
|
|
|
break;
|
|
|
|
|
case ActReqMdfTch:
|
|
|
|
|
NextAction = ActCreTch;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
NextAction = ActCreOth;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
Frm_BeginForm (NextAction);
|
|
|
|
|
ID_PutParamOtherUsrIDPlain (); // New user
|
2017-05-22 14:52:11 +02:00
|
|
|
|
break;
|
2017-05-30 02:17:33 +02:00
|
|
|
|
default:
|
2017-05-22 14:52:11 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
2015-03-29 15:03:35 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_TABLE_BeginWidePadding (2);
|
2015-03-29 13:57:24 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
if (ShowIDRows)
|
|
|
|
|
{
|
|
|
|
|
/***** Role or sex *****/
|
|
|
|
|
Rec_ShowRole (UsrDat,TypeOfView);
|
2015-03-29 13:57:24 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Name *****/
|
|
|
|
|
Rec_ShowSurname1 (UsrDat,ICanEdit);
|
|
|
|
|
Rec_ShowSurname2 (UsrDat,ICanEdit);
|
|
|
|
|
Rec_ShowFirstName (UsrDat,ICanEdit);
|
2015-03-29 13:57:24 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Country *****/
|
|
|
|
|
if (CountryForm)
|
|
|
|
|
Rec_ShowCountry (UsrDat,ICanEdit);
|
|
|
|
|
}
|
2015-03-29 13:57:24 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Address rows *****/
|
|
|
|
|
if (ShowAddressRows)
|
|
|
|
|
{
|
|
|
|
|
/***** Date of birth *****/
|
|
|
|
|
Rec_ShowDateOfBirth (UsrDat,ShowData,ICanEdit);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Phones *****/
|
|
|
|
|
Rec_ShowPhone (UsrDat,ShowData,ICanEdit,0);
|
|
|
|
|
Rec_ShowPhone (UsrDat,ShowData,ICanEdit,1);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** User's comments *****/
|
|
|
|
|
Rec_ShowComments (UsrDat,ShowData,ICanEdit);
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Teacher's rows *****/
|
|
|
|
|
if (ShowTeacherRows)
|
|
|
|
|
Rec_ShowTeacherRows (UsrDat,&Ins,ShowData);
|
2016-04-23 16:37:16 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_TABLE_End ();
|
2015-03-29 13:57:24 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Button and end form *****/
|
|
|
|
|
switch (TypeOfView)
|
2015-03-29 21:43:33 +02:00
|
|
|
|
{
|
2021-07-08 15:00:17 +02:00
|
|
|
|
case Rec_SHA_SIGN_UP_IN_CRS_FORM:
|
|
|
|
|
Btn_PutConfirmButton (Txt_Sign_up);
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
break;
|
|
|
|
|
case Rec_SHA_MY_RECORD_FORM:
|
|
|
|
|
Btn_PutConfirmButton (Txt_Save_changes);
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
break;
|
|
|
|
|
case Rec_SHA_OTHER_NEW_USR_FORM:
|
|
|
|
|
if (Gbl.Crs.Grps.NumGrps) // This course has groups?
|
|
|
|
|
Grp_ShowLstGrpsToChgOtherUsrsGrps (UsrDat->UsrCod);
|
|
|
|
|
Btn_PutConfirmButton (Txt_Register);
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
break;
|
|
|
|
|
case Rec_SHA_OTHER_EXISTING_USR_FORM:
|
|
|
|
|
/***** Show list of groups to register/remove me/user *****/
|
|
|
|
|
if (Gbl.Crs.Grps.NumGrps) // This course has groups?
|
|
|
|
|
{
|
|
|
|
|
if (ItsMe)
|
|
|
|
|
{
|
|
|
|
|
// Don't show groups if I don't belong to course
|
|
|
|
|
if (Gbl.Usrs.Me.IBelongToCurrentCrs)
|
|
|
|
|
Grp_ShowLstGrpsToChgMyGrps ();
|
|
|
|
|
}
|
|
|
|
|
else // Not me
|
|
|
|
|
Grp_ShowLstGrpsToChgOtherUsrsGrps (UsrDat->UsrCod);
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Which action, register or removing? *****/
|
|
|
|
|
if (Enr_PutActionsRegRemOneUsr (ItsMe))
|
|
|
|
|
Btn_PutConfirmButton (Txt_Confirm);
|
|
|
|
|
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HTM_TD_End ();
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2015-03-29 14:09:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
2017-06-12 14:16:33 +02:00
|
|
|
|
/***** End table and box *****/
|
2019-11-25 23:18:08 +01:00
|
|
|
|
Box_BoxTableEnd ();
|
2016-05-05 14:20:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*********** Show commands (icon to make actions) in record card *************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2020-04-08 22:09:35 +02:00
|
|
|
|
static void Rec_PutIconsCommands (__attribute__((unused)) void *Args)
|
2016-05-05 14:20:38 +02:00
|
|
|
|
{
|
2016-05-05 14:32:58 +02:00
|
|
|
|
extern const char *Txt_Edit_my_personal_data;
|
2017-02-17 01:59:58 +01:00
|
|
|
|
extern const char *Txt_My_public_profile;
|
|
|
|
|
extern const char *Txt_Another_user_s_profile;
|
2016-05-05 14:20:38 +02:00
|
|
|
|
extern const char *Txt_View_record_for_this_course;
|
2016-12-09 13:59:33 +01:00
|
|
|
|
extern const char *Txt_View_record_and_office_hours;
|
2017-01-20 09:26:35 +01:00
|
|
|
|
extern const char *Txt_Show_agenda;
|
2017-01-31 00:25:10 +01:00
|
|
|
|
extern const char *Txt_Administer_user;
|
2016-05-05 14:20:38 +02:00
|
|
|
|
extern const char *Txt_Write_a_message;
|
2016-11-24 22:08:04 +01:00
|
|
|
|
extern const char *Txt_View_homework;
|
2020-05-18 22:59:07 +02:00
|
|
|
|
extern const char *Txt_View_tests;
|
|
|
|
|
extern const char *Txt_View_exams;
|
|
|
|
|
extern const char *Txt_View_games;
|
2016-11-18 00:49:16 +01:00
|
|
|
|
extern const char *Txt_View_attendance;
|
2016-05-05 14:20:38 +02:00
|
|
|
|
extern const char *Txt_Following_unfollow;
|
|
|
|
|
extern const char *Txt_Follow;
|
2018-10-10 23:56:42 +02:00
|
|
|
|
bool ItsMe = Usr_ItsMe (Gbl.Record.UsrDat->UsrCod);
|
2016-12-09 14:17:32 +01:00
|
|
|
|
bool ICanViewUsrProfile;
|
2019-03-12 10:47:40 +01:00
|
|
|
|
bool RecipientHasBannedMe;
|
2017-05-22 14:52:11 +02:00
|
|
|
|
Act_Action_t NextAction;
|
2016-05-05 14:20:38 +02:00
|
|
|
|
|
2020-04-08 22:09:35 +02:00
|
|
|
|
if (!Gbl.Form.Inside && // Only if not inside another form
|
|
|
|
|
Act_GetBrowserTab (Gbl.Action.Act) == Act_BRW_1ST_TAB && // Only in main browser tab
|
|
|
|
|
Gbl.Usrs.Me.Logged) // Only if I am logged
|
2016-05-05 14:20:38 +02:00
|
|
|
|
{
|
2020-04-08 22:09:35 +02:00
|
|
|
|
ICanViewUsrProfile = Pri_ShowingIsAllowed (Gbl.Record.UsrDat->BaPrfVisibility,
|
|
|
|
|
Gbl.Record.UsrDat);
|
|
|
|
|
|
2021-03-02 00:54:26 +01:00
|
|
|
|
/***** Begin container *****/
|
2020-04-08 22:09:35 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"FRAME_ICO\"");
|
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
if (ItsMe)
|
|
|
|
|
/***** Button to edit my record card *****/
|
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActReqEdiRecSha,NULL,
|
|
|
|
|
NULL,NULL,
|
|
|
|
|
"pen.svg",
|
|
|
|
|
Txt_Edit_my_personal_data);
|
|
|
|
|
if (ICanViewUsrProfile)
|
|
|
|
|
/***** Button to view user's profile *****/
|
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActSeeOthPubPrf,NULL,
|
|
|
|
|
Rec_PutParamUsrCodEncrypted,NULL,
|
|
|
|
|
"user.svg",
|
|
|
|
|
ItsMe ? Txt_My_public_profile :
|
|
|
|
|
Txt_Another_user_s_profile);
|
|
|
|
|
|
|
|
|
|
/***** Button to view user's record card *****/
|
|
|
|
|
if (Usr_CheckIfICanViewRecordStd (Gbl.Record.UsrDat))
|
|
|
|
|
/* View student's records: common record card and course record card */
|
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActSeeRecOneStd,NULL,
|
|
|
|
|
Rec_PutParamUsrCodEncrypted,NULL,
|
|
|
|
|
"address-card.svg",
|
|
|
|
|
Txt_View_record_for_this_course);
|
|
|
|
|
else if (Usr_CheckIfICanViewRecordTch (Gbl.Record.UsrDat))
|
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActSeeRecOneTch,NULL,
|
|
|
|
|
Rec_PutParamUsrCodEncrypted,NULL,
|
|
|
|
|
"address-card.svg",
|
|
|
|
|
Txt_View_record_and_office_hours);
|
|
|
|
|
|
|
|
|
|
/***** Button to view user's agenda *****/
|
|
|
|
|
if (ItsMe)
|
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActSeeMyAgd,NULL,
|
|
|
|
|
NULL,NULL,
|
|
|
|
|
"calendar.svg",
|
|
|
|
|
Txt_Show_agenda);
|
|
|
|
|
else if (Usr_CheckIfICanViewUsrAgenda (Gbl.Record.UsrDat))
|
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActSeeUsrAgd,NULL,
|
|
|
|
|
Rec_PutParamUsrCodEncrypted,NULL,
|
|
|
|
|
"calendar.svg",
|
|
|
|
|
Txt_Show_agenda);
|
|
|
|
|
|
|
|
|
|
/***** Button to admin user *****/
|
|
|
|
|
if (ItsMe ||
|
|
|
|
|
Gbl.Usrs.Me.Role.Logged == Rol_TCH ||
|
|
|
|
|
Gbl.Usrs.Me.Role.Logged == Rol_DEG_ADM ||
|
|
|
|
|
Gbl.Usrs.Me.Role.Logged == Rol_CTR_ADM ||
|
|
|
|
|
Gbl.Usrs.Me.Role.Logged == Rol_INS_ADM ||
|
|
|
|
|
Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
|
2020-03-26 02:54:30 +01:00
|
|
|
|
{
|
2021-07-08 15:00:17 +02:00
|
|
|
|
switch (Gbl.Record.UsrDat->Roles.InCurrentCrs)
|
|
|
|
|
{
|
|
|
|
|
case Rol_STD:
|
|
|
|
|
NextAction = ActReqMdfStd;
|
|
|
|
|
break;
|
|
|
|
|
case Rol_NET:
|
|
|
|
|
NextAction = ActReqMdfNET;
|
|
|
|
|
break;
|
|
|
|
|
case Rol_TCH:
|
|
|
|
|
NextAction = ActReqMdfTch;
|
|
|
|
|
break;
|
|
|
|
|
default: // Guest, user or admin
|
|
|
|
|
NextAction = ActReqMdfOth;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
Lay_PutContextualLinkOnlyIcon (NextAction,NULL,
|
|
|
|
|
Rec_PutParamUsrCodEncrypted,NULL,
|
|
|
|
|
"user-cog.svg",
|
|
|
|
|
Txt_Administer_user);
|
2020-03-26 02:54:30 +01:00
|
|
|
|
}
|
2017-10-05 22:29:33 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
if (Gbl.Hierarchy.Level == HieLvl_CRS) // Course selected
|
2020-03-26 02:54:30 +01:00
|
|
|
|
{
|
2021-07-08 15:00:17 +02:00
|
|
|
|
if (Gbl.Record.UsrDat->Roles.InCurrentCrs == Rol_STD) // He/she is a student in current course
|
2017-06-08 15:32:33 +02:00
|
|
|
|
{
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Buttons to view student's test, exam and match results *****/
|
|
|
|
|
if (Usr_CheckIfICanViewTstExaMchResult (Gbl.Record.UsrDat))
|
2020-05-18 22:59:07 +02:00
|
|
|
|
{
|
2021-07-08 15:00:17 +02:00
|
|
|
|
if (ItsMe)
|
|
|
|
|
{
|
|
|
|
|
/* My test results in course */
|
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActSeeMyTstResCrs,NULL,
|
|
|
|
|
Rec_PutParamsMyTsts,NULL,
|
|
|
|
|
"check.svg",
|
|
|
|
|
Txt_View_tests);
|
|
|
|
|
/* My exam results in course */
|
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActSeeMyExaResCrs,NULL,
|
|
|
|
|
Rec_PutParamsMyTsts,NULL,
|
|
|
|
|
"file-signature.svg",
|
|
|
|
|
Txt_View_exams);
|
|
|
|
|
/* My match results in course */
|
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActSeeMyMchResCrs,NULL,
|
|
|
|
|
Rec_PutParamsMyTsts,NULL,
|
|
|
|
|
"gamepad.svg",
|
|
|
|
|
Txt_View_games);
|
|
|
|
|
}
|
|
|
|
|
else // Not me
|
|
|
|
|
{
|
|
|
|
|
/* User's test results in course */
|
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActSeeUsrTstResCrs,NULL,
|
|
|
|
|
Rec_PutParamsStdTsts,NULL,
|
|
|
|
|
"check.svg",
|
|
|
|
|
Txt_View_tests);
|
|
|
|
|
/* User's exam results in course */
|
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActSeeUsrExaResCrs,NULL,
|
|
|
|
|
Rec_PutParamsStdTsts,NULL,
|
|
|
|
|
"file-signature.svg",
|
|
|
|
|
Txt_View_exams);
|
|
|
|
|
/* User's match results in course */
|
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActSeeUsrMchResCrs,NULL,
|
|
|
|
|
Rec_PutParamsStdTsts,NULL,
|
|
|
|
|
"gamepad.svg",
|
|
|
|
|
Txt_View_games);
|
|
|
|
|
}
|
2020-05-18 22:59:07 +02:00
|
|
|
|
}
|
2021-07-08 15:00:17 +02:00
|
|
|
|
|
|
|
|
|
/***** Button to view student's assignments and works *****/
|
|
|
|
|
if (Usr_CheckIfICanViewAsgWrk (Gbl.Record.UsrDat))
|
2020-05-18 22:59:07 +02:00
|
|
|
|
{
|
2021-07-08 15:00:17 +02:00
|
|
|
|
if (ItsMe)
|
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActAdmAsgWrkUsr,NULL,
|
|
|
|
|
NULL,NULL,
|
|
|
|
|
"folder-open.svg",
|
|
|
|
|
Txt_View_homework);
|
|
|
|
|
else // Not me, I am not a student in current course
|
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActAdmAsgWrkCrs,NULL,
|
|
|
|
|
Rec_PutParamsWorks,NULL,
|
|
|
|
|
"folder-open.svg",
|
|
|
|
|
Txt_View_homework);
|
2020-05-18 22:59:07 +02:00
|
|
|
|
}
|
2017-03-01 12:59:49 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Button to view student's attendance *****/
|
|
|
|
|
if (Usr_CheckIfICanViewAtt (Gbl.Record.UsrDat))
|
|
|
|
|
{
|
|
|
|
|
if (ItsMe)
|
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActSeeLstMyAtt,NULL,
|
|
|
|
|
NULL,NULL,
|
|
|
|
|
"calendar-check.svg",
|
|
|
|
|
Txt_View_attendance);
|
|
|
|
|
else // Not me
|
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActSeeLstUsrAtt,NULL,
|
|
|
|
|
Rec_PutParamsStudent,NULL,
|
|
|
|
|
"calendar-check.svg",
|
|
|
|
|
Txt_View_attendance);
|
|
|
|
|
}
|
2020-03-26 02:54:30 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2016-05-05 14:20:38 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Button to print QR code *****/
|
|
|
|
|
QR_PutLinkToPrintQRCode (ActPrnUsrQR,
|
|
|
|
|
Rec_PutParamUsrCodEncrypted,NULL);
|
|
|
|
|
|
|
|
|
|
/***** Button to send a message *****/
|
|
|
|
|
RecipientHasBannedMe = Msg_DB_CheckIfUsrIsBanned (Gbl.Usrs.Me.UsrDat.UsrCod, // From:
|
|
|
|
|
Gbl.Record.UsrDat->UsrCod); // To:
|
|
|
|
|
if (!RecipientHasBannedMe)
|
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActReqMsgUsr,NULL,
|
|
|
|
|
Rec_PutParamsMsgUsr,NULL,
|
|
|
|
|
"envelope.svg",
|
|
|
|
|
Txt_Write_a_message);
|
|
|
|
|
|
|
|
|
|
/***** Button to follow / unfollow *****/
|
|
|
|
|
if (!ItsMe) // Not me
|
|
|
|
|
{
|
|
|
|
|
if (Fol_DB_CheckUsrIsFollowerOf (Gbl.Usrs.Me.UsrDat.UsrCod,
|
|
|
|
|
Gbl.Record.UsrDat->UsrCod))
|
|
|
|
|
// I follow user
|
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActUnfUsr,NULL,
|
|
|
|
|
Rec_PutParamUsrCodEncrypted,NULL,
|
|
|
|
|
"user-check.svg",
|
|
|
|
|
Txt_Following_unfollow); // Put button to unfollow, even if I can not view user's profile
|
|
|
|
|
else if (ICanViewUsrProfile)
|
|
|
|
|
Lay_PutContextualLinkOnlyIcon (ActFolUsr,NULL,
|
|
|
|
|
Rec_PutParamUsrCodEncrypted,NULL,
|
|
|
|
|
"user-plus.svg",
|
|
|
|
|
Txt_Follow); // Put button to follow
|
|
|
|
|
}
|
2016-05-05 14:20:38 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Button to change user's photo *****/
|
|
|
|
|
Pho_PutIconToChangeUsrPhoto ();
|
2018-10-16 01:36:13 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Button to change user's account *****/
|
|
|
|
|
Acc_PutIconToChangeUsrAccount ();
|
2018-10-07 18:07:01 +02:00
|
|
|
|
|
2020-04-08 22:09:35 +02:00
|
|
|
|
/***** End container *****/
|
|
|
|
|
HTM_DIV_End ();
|
2016-05-05 14:20:38 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-08 22:09:35 +02:00
|
|
|
|
void Rec_PutParamUsrCodEncrypted (__attribute__((unused)) void *Args)
|
2016-05-05 14:20:38 +02:00
|
|
|
|
{
|
2021-02-15 16:25:55 +01:00
|
|
|
|
Usr_PutParamUsrCodEncrypted (Gbl.Record.UsrDat->EnUsrCod);
|
2016-05-05 14:20:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
2020-04-08 22:09:35 +02:00
|
|
|
|
static void Rec_PutParamsMyTsts (__attribute__((unused)) void *Args)
|
2019-02-11 22:15:18 +01:00
|
|
|
|
{
|
2020-04-08 22:09:35 +02:00
|
|
|
|
Dat_SetIniEndDates ();
|
|
|
|
|
Dat_WriteParamsIniEndDates ();
|
2019-02-11 22:15:18 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-04-08 22:09:35 +02:00
|
|
|
|
static void Rec_PutParamsStdTsts (__attribute__((unused)) void *Args)
|
2019-02-11 22:15:18 +01:00
|
|
|
|
{
|
2020-04-08 22:09:35 +02:00
|
|
|
|
Rec_PutParamsStudent (NULL);
|
|
|
|
|
Dat_SetIniEndDates ();
|
|
|
|
|
Dat_WriteParamsIniEndDates ();
|
2019-02-11 22:15:18 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-04-08 22:09:35 +02:00
|
|
|
|
static void Rec_PutParamsWorks (__attribute__((unused)) void *Args)
|
2016-05-05 14:20:38 +02:00
|
|
|
|
{
|
2020-04-08 22:09:35 +02:00
|
|
|
|
Rec_PutParamsStudent (NULL);
|
|
|
|
|
Par_PutHiddenParamChar ("FullTree",'Y'); // By default, show all files
|
|
|
|
|
Gbl.FileBrowser.FullTree = true;
|
|
|
|
|
Brw_PutHiddenParamFullTreeIfSelected (&Gbl.FileBrowser.FullTree);
|
2016-05-05 14:20:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
2020-04-08 22:09:35 +02:00
|
|
|
|
static void Rec_PutParamsStudent (__attribute__((unused)) void *Args)
|
2016-05-05 14:20:38 +02:00
|
|
|
|
{
|
2021-02-15 16:25:55 +01:00
|
|
|
|
Par_PutHiddenParamString (NULL,"UsrCodStd",Gbl.Record.UsrDat->EnUsrCod);
|
2020-04-08 22:09:35 +02:00
|
|
|
|
Grp_PutParamAllGroups ();
|
2016-05-05 14:20:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
2020-04-08 22:09:35 +02:00
|
|
|
|
static void Rec_PutParamsMsgUsr (__attribute__((unused)) void *Args)
|
2016-05-05 14:20:38 +02:00
|
|
|
|
{
|
2020-04-08 22:09:35 +02:00
|
|
|
|
Rec_PutParamUsrCodEncrypted (NULL);
|
|
|
|
|
Grp_PutParamAllGroups ();
|
|
|
|
|
Par_PutHiddenParamChar ("ShowOnlyOneRecipient",'Y');
|
2015-03-05 23:18:43 +01:00
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2016-04-22 12:24:02 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*********************** Show institution in record card *********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-02-11 00:58:53 +01:00
|
|
|
|
static void Rec_ShowInstitutionInHead (struct Ins_Instit *Ins,bool PutFormLinks)
|
2016-04-22 12:24:02 +02:00
|
|
|
|
{
|
2016-04-22 12:39:36 +02:00
|
|
|
|
/***** Institution logo *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("rowspan=\"4\" class=\"REC_C1_TOP CM\"");
|
2021-07-08 15:00:17 +02:00
|
|
|
|
if (Ins->InsCod > 0)
|
2016-04-22 12:24:02 +02:00
|
|
|
|
{
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Form to go to the institution */
|
|
|
|
|
if (PutFormLinks)
|
|
|
|
|
{
|
|
|
|
|
Frm_BeginFormGoTo (ActSeeInsInf);
|
|
|
|
|
Ins_PutParamInsCod (Ins->InsCod);
|
|
|
|
|
HTM_BUTTON_SUBMIT_Begin (Ins->FullName,"BT_LINK",NULL);
|
|
|
|
|
}
|
|
|
|
|
Lgo_DrawLogo (HieLvl_INS,Ins->InsCod,Ins->ShrtName,
|
|
|
|
|
Rec_INSTITUTION_LOGO_SIZE,NULL,true);
|
|
|
|
|
if (PutFormLinks)
|
|
|
|
|
{
|
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
}
|
2016-04-22 12:24:02 +02:00
|
|
|
|
}
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2016-04-22 12:39:36 +02:00
|
|
|
|
|
|
|
|
|
/***** Institution name *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_TOP REC_HEAD LM\"");
|
2021-07-08 15:00:17 +02:00
|
|
|
|
if (Ins->InsCod > 0)
|
2016-04-22 12:24:02 +02:00
|
|
|
|
{
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Form to go to the institution */
|
|
|
|
|
if (PutFormLinks)
|
|
|
|
|
{
|
|
|
|
|
Frm_BeginFormGoTo (ActSeeInsInf);
|
|
|
|
|
Ins_PutParamInsCod (Ins->InsCod);
|
|
|
|
|
HTM_BUTTON_SUBMIT_Begin (Ins->FullName,"BT_LINK REC_HEAD LM",NULL);
|
|
|
|
|
}
|
|
|
|
|
HTM_Txt (Ins->FullName);
|
|
|
|
|
if (PutFormLinks)
|
|
|
|
|
{
|
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
}
|
2016-04-22 12:24:02 +02:00
|
|
|
|
}
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2016-04-22 12:24:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-22 12:39:36 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************** Show user's photo in record card *********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Rec_ShowPhoto (struct UsrData *UsrDat)
|
|
|
|
|
{
|
|
|
|
|
/***** User's photo *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("rowspan=\"3\" class=\"REC_C3_TOP CT\"");
|
2021-03-02 10:16:41 +01:00
|
|
|
|
Pho_ShowUsrPhotoIfAllowed (UsrDat,"PHOTO186x248",Pho_ZOOM,false);
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2016-04-22 12:39:36 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-22 12:44:56 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************************** Show user's full name ***************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Rec_ShowFullName (struct UsrData *UsrDat)
|
|
|
|
|
{
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_MID LT\"");
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"REC_NAME\"");
|
2016-04-22 12:44:56 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** First name *****/
|
|
|
|
|
HTM_Txt (UsrDat->FrstName);
|
|
|
|
|
HTM_BR ();
|
2016-04-22 12:44:56 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Surname 1 *****/
|
|
|
|
|
HTM_Txt (UsrDat->Surname1);
|
|
|
|
|
HTM_BR ();
|
2016-04-22 12:44:56 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** Surname 2 *****/
|
|
|
|
|
HTM_Txt (UsrDat->Surname2);
|
2016-04-22 12:44:56 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_DIV_End ();
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2016-04-22 12:44:56 +02:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
2016-04-22 19:55:41 +02:00
|
|
|
|
/*************************** Show user's nickname ****************************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
2016-04-22 19:50:59 +02:00
|
|
|
|
|
|
|
|
|
static void Rec_ShowNickname (struct UsrData *UsrDat,bool PutFormLinks)
|
|
|
|
|
{
|
2017-02-17 01:59:58 +01:00
|
|
|
|
extern const char *Txt_My_public_profile;
|
|
|
|
|
extern const char *Txt_Another_user_s_profile;
|
|
|
|
|
bool ItsMe;
|
2016-04-22 19:50:59 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_MID LB\"");
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"REC_NICK\"");
|
|
|
|
|
if (UsrDat->Nickname[0])
|
|
|
|
|
{
|
|
|
|
|
if (PutFormLinks)
|
|
|
|
|
{
|
|
|
|
|
/* Put form to go to public profile */
|
|
|
|
|
ItsMe = Usr_ItsMe (UsrDat->UsrCod);
|
|
|
|
|
Frm_BeginForm (ActSeeOthPubPrf);
|
|
|
|
|
Usr_PutParamUsrCodEncrypted (UsrDat->EnUsrCod);
|
|
|
|
|
HTM_BUTTON_SUBMIT_Begin (ItsMe ? Txt_My_public_profile :
|
|
|
|
|
Txt_Another_user_s_profile,
|
|
|
|
|
"BT_LINK REC_NICK",
|
|
|
|
|
NULL);
|
|
|
|
|
}
|
|
|
|
|
HTM_TxtF ("@%s",UsrDat->Nickname);
|
|
|
|
|
if (PutFormLinks)
|
|
|
|
|
{
|
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
HTM_DIV_End ();
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2016-04-22 19:50:59 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-22 19:55:41 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************************** Show user's country ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2016-04-23 13:58:20 +02:00
|
|
|
|
static void Rec_ShowCountryInHead (struct UsrData *UsrDat,bool ShowData)
|
2016-04-22 19:55:41 +02:00
|
|
|
|
{
|
2019-12-27 19:22:48 +01:00
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_MID DAT_N LT\"");
|
2021-07-08 15:00:17 +02:00
|
|
|
|
if (ShowData && UsrDat->CtyCod > 0)
|
|
|
|
|
/* Link to see country information */
|
|
|
|
|
Cty_WriteCountryName (UsrDat->CtyCod,
|
|
|
|
|
"BT_LINK DAT_N"); // Put link to country
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2016-04-22 19:55:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-22 20:00:26 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************* Show user's webs and social networks ********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Rec_ShowWebsAndSocialNets (struct UsrData *UsrDat,
|
2016-11-18 00:17:53 +01:00
|
|
|
|
Rec_SharedRecordViewType_t TypeOfView)
|
2016-04-22 20:00:26 +02:00
|
|
|
|
{
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_Begin ("class=\"REC_C3_MID CT\"");
|
2021-07-08 15:00:17 +02:00
|
|
|
|
if (TypeOfView != Rec_SHA_RECORD_PRINT)
|
|
|
|
|
Net_ShowWebsAndSocialNets (UsrDat);
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TD_End ();
|
2016-04-22 20:00:26 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-22 20:31:10 +02:00
|
|
|
|
/*****************************************************************************/
|
2016-11-16 23:19:52 +01:00
|
|
|
|
/***************************** Show user's email *****************************/
|
2016-04-22 20:31:10 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-27 19:22:48 +01:00
|
|
|
|
static void Rec_ShowEmail (struct UsrData *UsrDat)
|
2016-04-22 20:31:10 +02:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Email;
|
|
|
|
|
|
2019-12-27 21:10:39 +01:00
|
|
|
|
/***** Email *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RM",NULL,Txt_Email);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_BOT DAT_N LM\"");
|
|
|
|
|
if (UsrDat->Email[0])
|
|
|
|
|
{
|
|
|
|
|
HTM_DIV_Begin ("class=\"REC_EMAIL\""); // Limited width
|
|
|
|
|
if (Mai_ICanSeeOtherUsrEmail (UsrDat))
|
|
|
|
|
{
|
|
|
|
|
HTM_A_Begin ("href=\"mailto:%s\" class=\"DAT_N\"",UsrDat->Email);
|
|
|
|
|
HTM_Txt (UsrDat->Email);
|
|
|
|
|
HTM_A_End ();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
HTM_Txt ("********");
|
|
|
|
|
HTM_DIV_End ();
|
|
|
|
|
}
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2016-04-22 20:31:10 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-22 20:47:11 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************************* Show user's IDs *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-27 19:22:48 +01:00
|
|
|
|
static void Rec_ShowUsrIDs (struct UsrData *UsrDat,const char *Anchor)
|
2016-04-22 20:47:11 +02:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_ID;
|
|
|
|
|
|
2019-12-27 21:10:39 +01:00
|
|
|
|
/***** User's IDs *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RT",NULL,Txt_ID);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_BOT DAT_N LT\"");
|
|
|
|
|
ID_WriteUsrIDs (UsrDat,Anchor);
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2016-04-22 20:47:11 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-23 13:23:09 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************** Show user's role / sex ***************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Rec_ShowRole (struct UsrData *UsrDat,
|
2019-12-27 19:22:48 +01:00
|
|
|
|
Rec_SharedRecordViewType_t TypeOfView)
|
2016-04-23 13:23:09 +02:00
|
|
|
|
{
|
2018-12-08 16:43:13 +01:00
|
|
|
|
extern const char *Usr_StringsSexIcons[Usr_NUM_SEXS];
|
2016-04-23 13:23:09 +02:00
|
|
|
|
extern const char *Txt_Role;
|
|
|
|
|
extern const char *Txt_Sex;
|
|
|
|
|
extern const char *Txt_SEX_SINGULAR_Abc[Usr_NUM_SEXS];
|
|
|
|
|
extern const char *Txt_ROLES_SINGUL_Abc[Rol_NUM_ROLES][Usr_NUM_SEXS];
|
2017-05-30 02:17:33 +02:00
|
|
|
|
bool RoleForm = (TypeOfView == Rec_SHA_SIGN_UP_IN_CRS_FORM ||
|
|
|
|
|
TypeOfView == Rec_SHA_OTHER_EXISTING_USR_FORM ||
|
|
|
|
|
TypeOfView == Rec_SHA_OTHER_NEW_USR_FORM);
|
2016-11-18 00:17:53 +01:00
|
|
|
|
bool SexForm = (TypeOfView == Rec_SHA_MY_RECORD_FORM);
|
2017-05-30 02:17:33 +02:00
|
|
|
|
Rol_Role_t DefaultRoleInForm;
|
2016-04-23 13:23:09 +02:00
|
|
|
|
Rol_Role_t Role;
|
2019-11-06 15:27:33 +01:00
|
|
|
|
unsigned RoleUnsigned;
|
2016-04-23 13:23:09 +02:00
|
|
|
|
Usr_Sex_t Sex;
|
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
if (RoleForm)
|
|
|
|
|
{
|
|
|
|
|
/***** Form to select a role *****/
|
|
|
|
|
/* Get user's roles if not got */
|
|
|
|
|
Rol_GetRolesInAllCrss (UsrDat);
|
2016-12-13 13:32:19 +01:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RM","Role",Txt_Role);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_BOT DAT_N LM\"");
|
|
|
|
|
switch (TypeOfView)
|
2016-04-23 13:23:09 +02:00
|
|
|
|
{
|
2021-07-08 15:00:17 +02:00
|
|
|
|
case Rec_SHA_SIGN_UP_IN_CRS_FORM: // I want to apply for enrolment
|
|
|
|
|
/***** Set default role *****/
|
|
|
|
|
if (UsrDat->UsrCod == Gbl.Hierarchy.Crs.RequesterUsrCod || // Creator of the course
|
|
|
|
|
(UsrDat->Roles.InCrss & (1 << Rol_TCH))) // Teacher in other courses
|
|
|
|
|
DefaultRoleInForm = Rol_TCH; // Request sign up as a teacher
|
|
|
|
|
else if ((UsrDat->Roles.InCrss & (1 << Rol_NET))) // Non-editing teacher in other courses
|
|
|
|
|
DefaultRoleInForm = Rol_NET; // Request sign up as a non-editing teacher
|
|
|
|
|
else
|
|
|
|
|
DefaultRoleInForm = Rol_STD; // Request sign up as a student
|
|
|
|
|
|
|
|
|
|
/***** Selector of role *****/
|
|
|
|
|
HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,
|
|
|
|
|
"id=\"Role\" name=\"Role\"");
|
2017-05-18 19:13:41 +02:00
|
|
|
|
for (Role = Rol_STD;
|
|
|
|
|
Role <= Rol_TCH;
|
2016-04-23 13:23:09 +02:00
|
|
|
|
Role++)
|
|
|
|
|
{
|
2019-11-06 15:27:33 +01:00
|
|
|
|
RoleUnsigned = (unsigned) Role;
|
2019-11-06 19:45:20 +01:00
|
|
|
|
HTM_OPTION (HTM_Type_UNSIGNED,&RoleUnsigned,
|
2019-11-06 15:27:33 +01:00
|
|
|
|
Role == DefaultRoleInForm,false,
|
|
|
|
|
"%s",Txt_ROLES_SINGUL_Abc[Role][UsrDat->Sex]);
|
2016-04-23 13:23:09 +02:00
|
|
|
|
}
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_SELECT_End ();
|
|
|
|
|
break;
|
|
|
|
|
case Rec_SHA_OTHER_EXISTING_USR_FORM: // The other user already exists in the platform
|
|
|
|
|
if (Gbl.Hierarchy.Level == HieLvl_CRS) // Course selected
|
|
|
|
|
{
|
|
|
|
|
/***** Set default role *****/
|
|
|
|
|
switch (UsrDat->Roles.InCurrentCrs)
|
2017-05-30 02:17:33 +02:00
|
|
|
|
{
|
2021-07-08 15:00:17 +02:00
|
|
|
|
case Rol_STD: // Student in current course
|
|
|
|
|
case Rol_NET: // Non-editing teacher in current course
|
|
|
|
|
case Rol_TCH: // Teacher in current course
|
|
|
|
|
DefaultRoleInForm = UsrDat->Roles.InCurrentCrs;
|
2017-05-30 02:17:33 +02:00
|
|
|
|
break;
|
2021-07-08 15:00:17 +02:00
|
|
|
|
default: // User does not belong to current course
|
|
|
|
|
/* If there is a request of this user, default role is the requested role */
|
|
|
|
|
DefaultRoleInForm = Rol_DB_GetRequestedRole (UsrDat->UsrCod);
|
|
|
|
|
|
|
|
|
|
switch (DefaultRoleInForm)
|
|
|
|
|
{
|
|
|
|
|
case Rol_STD: // Role requested: student
|
|
|
|
|
case Rol_NET: // Role requested: non-editing teacher
|
|
|
|
|
case Rol_TCH: // Role requested: teacher
|
|
|
|
|
break;
|
|
|
|
|
default: // No role requested
|
|
|
|
|
switch (Gbl.Action.Act)
|
|
|
|
|
{
|
|
|
|
|
case ActReqMdfStd:
|
|
|
|
|
DefaultRoleInForm = Rol_STD;
|
|
|
|
|
break;
|
|
|
|
|
case ActReqMdfNET:
|
|
|
|
|
DefaultRoleInForm = Rol_NET;
|
|
|
|
|
break;
|
|
|
|
|
case ActReqMdfTch:
|
|
|
|
|
DefaultRoleInForm = Rol_TCH;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
if ((UsrDat->Roles.InCrss & (1 << Rol_TCH))) // Teacher in other courses
|
|
|
|
|
DefaultRoleInForm = Rol_TCH;
|
|
|
|
|
else if ((UsrDat->Roles.InCrss & (1 << Rol_NET))) // Non-editing teacher in other courses
|
|
|
|
|
DefaultRoleInForm = Rol_NET;
|
|
|
|
|
else
|
|
|
|
|
DefaultRoleInForm = Rol_STD;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2017-05-30 02:17:33 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Selector of role *****/
|
2020-04-27 03:16:55 +02:00
|
|
|
|
HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,
|
2019-11-05 15:47:35 +01:00
|
|
|
|
"id=\"Role\" name=\"Role\"");
|
2021-07-08 15:00:17 +02:00
|
|
|
|
switch (Gbl.Usrs.Me.Role.Logged)
|
|
|
|
|
{
|
|
|
|
|
case Rol_GST:
|
|
|
|
|
case Rol_USR:
|
|
|
|
|
case Rol_STD:
|
|
|
|
|
case Rol_NET:
|
|
|
|
|
RoleUnsigned = (unsigned) Gbl.Usrs.Me.Role.Logged;
|
|
|
|
|
HTM_OPTION (HTM_Type_UNSIGNED,&RoleUnsigned,true,true,
|
|
|
|
|
"%s",Txt_ROLES_SINGUL_Abc[Gbl.Usrs.Me.Role.Logged][UsrDat->Sex]);
|
|
|
|
|
break;
|
|
|
|
|
case Rol_TCH:
|
|
|
|
|
case Rol_DEG_ADM:
|
|
|
|
|
case Rol_CTR_ADM:
|
|
|
|
|
case Rol_INS_ADM:
|
|
|
|
|
case Rol_SYS_ADM:
|
|
|
|
|
for (Role = Rol_STD;
|
|
|
|
|
Role <= Rol_TCH;
|
|
|
|
|
Role++)
|
|
|
|
|
{
|
|
|
|
|
RoleUnsigned = (unsigned) Role;
|
|
|
|
|
HTM_OPTION (HTM_Type_UNSIGNED,&RoleUnsigned,
|
|
|
|
|
Role == DefaultRoleInForm,false,
|
|
|
|
|
"%s",Txt_ROLES_SINGUL_Abc[Role][UsrDat->Sex]);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default: // The rest of users can not register other users
|
|
|
|
|
break;
|
|
|
|
|
}
|
2019-11-05 08:46:38 +01:00
|
|
|
|
HTM_SELECT_End ();
|
2021-07-08 15:00:17 +02:00
|
|
|
|
}
|
|
|
|
|
else // No course selected
|
|
|
|
|
{
|
|
|
|
|
/***** Set default role *****/
|
|
|
|
|
DefaultRoleInForm = (UsrDat->Roles.InCrss & ((1 << Rol_STD) |
|
|
|
|
|
(1 << Rol_NET) |
|
|
|
|
|
(1 << Rol_TCH))) ? Rol_USR : // If user belongs to any course
|
|
|
|
|
Rol_GST; // If user don't belong to any course
|
|
|
|
|
|
2017-05-30 02:17:33 +02:00
|
|
|
|
/***** Selector of role *****/
|
2020-04-27 03:16:55 +02:00
|
|
|
|
HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,
|
2019-11-05 15:47:35 +01:00
|
|
|
|
"id=\"Role\" name=\"Role\"");
|
2021-07-08 15:00:17 +02:00
|
|
|
|
RoleUnsigned = (unsigned) DefaultRoleInForm;
|
|
|
|
|
HTM_OPTION (HTM_Type_UNSIGNED,&RoleUnsigned,true,true,
|
|
|
|
|
"%s",Txt_ROLES_SINGUL_Abc[DefaultRoleInForm][UsrDat->Sex]);
|
2019-11-05 08:46:38 +01:00
|
|
|
|
HTM_SELECT_End ();
|
2021-07-08 15:00:17 +02:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case Rec_SHA_OTHER_NEW_USR_FORM: // The user does not exist in platform
|
|
|
|
|
if (Gbl.Hierarchy.Level == HieLvl_CRS) // Course selected
|
|
|
|
|
switch (Gbl.Usrs.Me.Role.Logged)
|
|
|
|
|
{
|
|
|
|
|
case Rol_TCH:
|
|
|
|
|
case Rol_DEG_ADM:
|
|
|
|
|
case Rol_CTR_ADM:
|
|
|
|
|
case Rol_INS_ADM:
|
|
|
|
|
case Rol_SYS_ADM:
|
|
|
|
|
/***** Set default role *****/
|
|
|
|
|
switch (Gbl.Action.Act)
|
|
|
|
|
{
|
|
|
|
|
case ActReqMdfStd:
|
|
|
|
|
DefaultRoleInForm = Rol_STD;
|
|
|
|
|
break;
|
|
|
|
|
case ActReqMdfNET:
|
|
|
|
|
DefaultRoleInForm = Rol_NET;
|
|
|
|
|
break;
|
|
|
|
|
case ActReqMdfTch:
|
|
|
|
|
DefaultRoleInForm = Rol_TCH;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
DefaultRoleInForm = Rol_STD;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Selector of role *****/
|
|
|
|
|
HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,
|
|
|
|
|
"id=\"Role\" name=\"Role\"");
|
|
|
|
|
for (Role = Rol_STD;
|
|
|
|
|
Role <= Rol_TCH;
|
|
|
|
|
Role++)
|
|
|
|
|
{
|
|
|
|
|
RoleUnsigned = (unsigned) Role;
|
|
|
|
|
HTM_OPTION (HTM_Type_UNSIGNED,&RoleUnsigned,
|
|
|
|
|
Role == DefaultRoleInForm,false,
|
|
|
|
|
"%s",Txt_ROLES_SINGUL_Abc[Role][Usr_SEX_UNKNOWN]);
|
|
|
|
|
}
|
|
|
|
|
HTM_SELECT_End ();
|
|
|
|
|
break;
|
|
|
|
|
default: // The rest of users can not register other users
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else // No course selected
|
|
|
|
|
switch (Gbl.Usrs.Me.Role.Logged)
|
|
|
|
|
{
|
|
|
|
|
case Rol_SYS_ADM:
|
|
|
|
|
/***** Selector of role *****/
|
|
|
|
|
HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,
|
|
|
|
|
"id=\"Role\" name=\"Role\"");
|
|
|
|
|
RoleUnsigned = (unsigned) Rol_GST;
|
|
|
|
|
HTM_OPTION (HTM_Type_UNSIGNED,&RoleUnsigned,
|
|
|
|
|
true,false,
|
|
|
|
|
"%s",Txt_ROLES_SINGUL_Abc[Rol_GST][Usr_SEX_UNKNOWN]);
|
|
|
|
|
HTM_SELECT_End ();
|
|
|
|
|
break;
|
|
|
|
|
default: // The rest of users can not register other users
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
HTM_TD_End ();
|
2016-04-23 13:23:09 +02:00
|
|
|
|
}
|
2021-07-08 15:00:17 +02:00
|
|
|
|
else if (SexForm)
|
|
|
|
|
{
|
|
|
|
|
/***** Form to select a sex *****/
|
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RM","",
|
|
|
|
|
Str_BuildStringStr ("%s*",Txt_Sex));
|
|
|
|
|
Str_FreeString ();
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_BOT LM\"");
|
|
|
|
|
for (Sex = Usr_SEX_FEMALE;
|
|
|
|
|
Sex <= Usr_SEX_MALE;
|
|
|
|
|
Sex++)
|
|
|
|
|
{
|
|
|
|
|
HTM_LABEL_Begin ("class=\"DAT_N\"");
|
|
|
|
|
HTM_INPUT_RADIO ("Sex",false,
|
|
|
|
|
"value=\"%u\"%s required=\"required\"",
|
|
|
|
|
(unsigned) Sex,
|
|
|
|
|
Sex == Gbl.Usrs.Me.UsrDat.Sex ? " checked=\"checked\"" : "");
|
|
|
|
|
HTM_TxtF ("%s %s",Usr_StringsSexIcons[Sex],Txt_SEX_SINGULAR_Abc[Sex]);
|
|
|
|
|
HTM_LABEL_End ();
|
|
|
|
|
}
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
}
|
|
|
|
|
else // RoleForm == false, SexForm == false
|
2016-04-23 13:23:09 +02:00
|
|
|
|
{
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/***** No form, only text *****/
|
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RM",NULL,Txt_Role);
|
|
|
|
|
|
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_BOT DAT_N LM\"");
|
|
|
|
|
HTM_Txt (Txt_ROLES_SINGUL_Abc[UsrDat->Roles.InCurrentCrs][UsrDat->Sex]);
|
|
|
|
|
HTM_TD_End ();
|
2016-04-23 13:23:09 +02:00
|
|
|
|
}
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2016-04-23 13:23:09 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-23 13:37:43 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************************** Show user's surname 1 ***************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-27 19:22:48 +01:00
|
|
|
|
static void Rec_ShowSurname1 (struct UsrData *UsrDat,bool PutForm)
|
2016-04-23 13:37:43 +02:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Surname_1;
|
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-09 23:49:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Label */
|
|
|
|
|
if (PutForm)
|
|
|
|
|
{
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RM","Surname1",
|
|
|
|
|
Str_BuildStringStr ("%s*",Txt_Surname_1));
|
|
|
|
|
Str_FreeString ();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RM",NULL,Txt_Surname_1);
|
|
|
|
|
|
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_BOT DAT_N LM\"");
|
|
|
|
|
if (PutForm)
|
|
|
|
|
HTM_INPUT_TEXT ("Surname1",Usr_MAX_CHARS_FIRSTNAME_OR_SURNAME,UsrDat->Surname1,
|
|
|
|
|
HTM_DONT_SUBMIT_ON_CHANGE,
|
|
|
|
|
"id=\"Surname1\" class=\"REC_C2_BOT_INPUT\""
|
|
|
|
|
" required=\"required\"");
|
|
|
|
|
else if (UsrDat->Surname1[0])
|
|
|
|
|
{
|
|
|
|
|
HTM_STRONG_Begin ();
|
|
|
|
|
HTM_Txt (UsrDat->Surname1);
|
|
|
|
|
HTM_STRONG_End ();
|
|
|
|
|
}
|
|
|
|
|
HTM_TD_End ();
|
2019-10-09 23:49:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2016-04-23 13:37:43 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-23 13:45:03 +02:00
|
|
|
|
/*****************************************************************************/
|
2016-04-23 13:49:38 +02:00
|
|
|
|
/*************************** Show user's surname 2 ***************************/
|
2016-04-23 13:45:03 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-27 19:22:48 +01:00
|
|
|
|
static void Rec_ShowSurname2 (struct UsrData *UsrDat,bool PutForm)
|
2016-04-23 13:45:03 +02:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Surname_2;
|
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RM",PutForm ? "Surname2" :
|
|
|
|
|
NULL,
|
|
|
|
|
Txt_Surname_2);
|
|
|
|
|
|
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_BOT DAT_N LM\"");
|
|
|
|
|
if (PutForm)
|
|
|
|
|
HTM_INPUT_TEXT ("Surname2",Usr_MAX_CHARS_FIRSTNAME_OR_SURNAME,
|
|
|
|
|
UsrDat->Surname2,
|
|
|
|
|
HTM_DONT_SUBMIT_ON_CHANGE,
|
|
|
|
|
"id=\"Surname2\" class=\"REC_C2_BOT_INPUT\"");
|
|
|
|
|
else if (UsrDat->Surname2[0])
|
|
|
|
|
{
|
|
|
|
|
HTM_STRONG_Begin ();
|
|
|
|
|
HTM_Txt (UsrDat->Surname2);
|
|
|
|
|
HTM_STRONG_End ();
|
|
|
|
|
}
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2016-04-23 13:45:03 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-23 13:49:38 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************** Show user's first name ***************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-27 19:22:48 +01:00
|
|
|
|
static void Rec_ShowFirstName (struct UsrData *UsrDat,bool PutForm)
|
2016-04-23 13:49:38 +02:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_First_name;
|
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Label */
|
|
|
|
|
if (PutForm)
|
|
|
|
|
{
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RM","FirstName",
|
|
|
|
|
Str_BuildStringStr ("%s*",Txt_First_name));
|
|
|
|
|
Str_FreeString ();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RM",NULL,Txt_First_name);
|
|
|
|
|
|
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("colspan=\"2\" class=\"REC_C2_BOT DAT_N LM\"");
|
|
|
|
|
if (PutForm)
|
|
|
|
|
HTM_INPUT_TEXT ("FirstName",Usr_MAX_CHARS_FIRSTNAME_OR_SURNAME,
|
|
|
|
|
UsrDat->FrstName,
|
|
|
|
|
HTM_DONT_SUBMIT_ON_CHANGE,
|
|
|
|
|
"id=\"FirstName\" class=\"REC_C2_BOT_INPUT\""
|
|
|
|
|
" required=\"required\"");
|
|
|
|
|
else if (UsrDat->FrstName[0])
|
|
|
|
|
{
|
|
|
|
|
HTM_STRONG_Begin ();
|
|
|
|
|
HTM_Txt (UsrDat->FrstName);
|
|
|
|
|
HTM_STRONG_End ();
|
|
|
|
|
}
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2016-04-23 13:49:38 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-23 13:58:20 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************************** Show user's country ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-27 19:22:48 +01:00
|
|
|
|
static void Rec_ShowCountry (struct UsrData *UsrDat,bool PutForm)
|
2016-04-23 13:58:20 +02:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Country;
|
|
|
|
|
extern const char *Txt_Another_country;
|
|
|
|
|
unsigned NumCty;
|
|
|
|
|
|
|
|
|
|
/***** If list of countries is empty, try to get it *****/
|
2021-05-22 12:34:10 +02:00
|
|
|
|
Cty_GetBasicListOfCountries ();
|
2016-04-23 13:58:20 +02:00
|
|
|
|
|
2019-12-27 19:22:48 +01:00
|
|
|
|
/***** Selector of country *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/* Label */
|
|
|
|
|
if (PutForm)
|
|
|
|
|
{
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RM","OthCtyCod",
|
|
|
|
|
Str_BuildStringStr ("%s*",Txt_Country));
|
|
|
|
|
Str_FreeString ();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RM",NULL,Txt_Country);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("colspan=\"2\" class=\"REC_C2_BOT LM\"");
|
|
|
|
|
HTM_SELECT_Begin (HTM_DONT_SUBMIT_ON_CHANGE,
|
|
|
|
|
"id=\"OthCtyCod\" name=\"OthCtyCod\""
|
|
|
|
|
" class=\"REC_C2_BOT_INPUT\" required=\"required\"");
|
|
|
|
|
HTM_OPTION (HTM_Type_STRING,"",false,false,
|
|
|
|
|
"%s",Txt_Country);
|
|
|
|
|
HTM_OPTION (HTM_Type_STRING,"0",UsrDat->CtyCod == 0,false,
|
|
|
|
|
"%s",Txt_Another_country);
|
|
|
|
|
for (NumCty = 0;
|
|
|
|
|
NumCty < Gbl.Hierarchy.Ctys.Num;
|
|
|
|
|
NumCty++)
|
|
|
|
|
HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod,
|
|
|
|
|
Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod == UsrDat->CtyCod,false,
|
|
|
|
|
"%s",Gbl.Hierarchy.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]);
|
|
|
|
|
HTM_SELECT_End ();
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2021-05-22 12:34:10 +02:00
|
|
|
|
|
|
|
|
|
// Do not free here list of countries, because it can be reused
|
2016-04-23 13:58:20 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-23 14:06:49 +02:00
|
|
|
|
/*****************************************************************************/
|
2016-04-23 14:12:52 +02:00
|
|
|
|
/************************ Show user's date of birth **************************/
|
2016-04-23 14:06:49 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-27 19:22:48 +01:00
|
|
|
|
static void Rec_ShowDateOfBirth (struct UsrData *UsrDat,bool ShowData,bool PutForm)
|
2016-04-23 14:06:49 +02:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Date_of_birth;
|
|
|
|
|
|
2019-12-27 21:10:39 +01:00
|
|
|
|
/***** Date of birth *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RM",PutForm ? "" :
|
|
|
|
|
NULL,
|
|
|
|
|
Txt_Date_of_birth);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_BOT DAT_N LM\"");
|
|
|
|
|
if (ShowData)
|
|
|
|
|
{
|
|
|
|
|
if (PutForm)
|
|
|
|
|
Dat_WriteFormDate (Gbl.Now.Date.Year - Rec_USR_MAX_AGE,
|
|
|
|
|
Gbl.Now.Date.Year - Rec_USR_MIN_AGE,
|
|
|
|
|
"Birth",
|
|
|
|
|
&(UsrDat->Birthday),
|
|
|
|
|
false,false);
|
|
|
|
|
else if (UsrDat->StrBirthday[0])
|
|
|
|
|
HTM_Txt (UsrDat->StrBirthday);
|
|
|
|
|
}
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2016-04-23 14:06:49 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-23 14:18:09 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************* Show user's local phone ***************************/
|
|
|
|
|
/*****************************************************************************/
|
2020-04-29 16:43:07 +02:00
|
|
|
|
// NumPhone can be 0 or 1
|
2016-04-23 14:18:09 +02:00
|
|
|
|
|
2020-04-29 16:43:07 +02:00
|
|
|
|
static void Rec_ShowPhone (struct UsrData *UsrDat,bool ShowData,bool PutForm,
|
|
|
|
|
unsigned NumPhone)
|
2016-04-23 14:18:09 +02:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Phone;
|
2020-04-29 16:43:07 +02:00
|
|
|
|
char *Name;
|
|
|
|
|
char *Label;
|
2016-04-23 14:18:09 +02:00
|
|
|
|
|
2020-04-29 16:43:07 +02:00
|
|
|
|
/***** Internal name / id *****/
|
|
|
|
|
if (asprintf (&Name,"Phone%u",NumPhone) < 0)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_NotEnoughMemoryExit ();
|
2016-04-23 14:36:02 +02:00
|
|
|
|
|
2020-04-29 16:43:07 +02:00
|
|
|
|
/***** Label to show *****/
|
|
|
|
|
if (asprintf (&Label,"%s %u",Txt_Phone,NumPhone + 1) < 0)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_NotEnoughMemoryExit ();
|
2016-04-23 14:36:02 +02:00
|
|
|
|
|
2020-04-29 16:43:07 +02:00
|
|
|
|
/***** Phone *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RM",PutForm ? Name :
|
|
|
|
|
NULL,
|
|
|
|
|
Label);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_BOT DAT_N LM\"");
|
|
|
|
|
if (ShowData)
|
|
|
|
|
{
|
|
|
|
|
if (PutForm)
|
|
|
|
|
HTM_INPUT_TEL (Name,UsrDat->Phone[NumPhone],
|
|
|
|
|
HTM_DONT_SUBMIT_ON_CHANGE,
|
|
|
|
|
"id=\"%s\" class=\"REC_C2_BOT_INPUT\"",Name);
|
|
|
|
|
else if (UsrDat->Phone[NumPhone][0])
|
|
|
|
|
{
|
|
|
|
|
HTM_A_Begin ("href=\"tel:%s\" class=\"DAT_N\"",UsrDat->Phone[NumPhone]);
|
|
|
|
|
HTM_Txt (UsrDat->Phone[NumPhone]);
|
|
|
|
|
HTM_A_End ();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2020-04-29 16:43:07 +02:00
|
|
|
|
|
|
|
|
|
/***** Free label *****/
|
|
|
|
|
free (Label);
|
|
|
|
|
|
|
|
|
|
/***** Free name / id *****/
|
|
|
|
|
free (Name);
|
2016-04-23 14:36:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-23 14:43:53 +02:00
|
|
|
|
/*****************************************************************************/
|
2016-04-23 14:51:12 +02:00
|
|
|
|
/************************** Show user's comments *****************************/
|
2016-04-23 14:43:53 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-27 19:22:48 +01:00
|
|
|
|
static void Rec_ShowComments (struct UsrData *UsrDat,bool ShowData,bool PutForm)
|
2016-04-23 14:43:53 +02:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_USER_comments;
|
|
|
|
|
|
2019-12-27 21:10:39 +01:00
|
|
|
|
/***** Comments *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RT",PutForm ? "Comments" :
|
|
|
|
|
NULL,
|
|
|
|
|
Txt_USER_comments);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_BOT DAT_N LT\"");
|
|
|
|
|
if (ShowData)
|
|
|
|
|
{
|
|
|
|
|
if (PutForm)
|
|
|
|
|
{
|
|
|
|
|
HTM_TEXTAREA_Begin ("id=\"Comments\" name=\"Comments\""
|
|
|
|
|
" rows=\"4\" class=\"REC_C2_BOT_INPUT\"");
|
|
|
|
|
HTM_Txt (UsrDat->Comments);
|
|
|
|
|
HTM_TEXTAREA_End ();
|
|
|
|
|
}
|
|
|
|
|
else if (UsrDat->Comments[0])
|
|
|
|
|
{
|
|
|
|
|
Str_ChangeFormat (Str_FROM_HTML,Str_TO_RIGOROUS_HTML, // Convert from HTML to rigorous HTML
|
|
|
|
|
UsrDat->Comments,Cns_MAX_BYTES_TEXT,false);
|
|
|
|
|
HTM_Txt (UsrDat->Comments);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2016-04-23 14:43:53 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-23 14:51:12 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************** Show user's institution **************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-02-11 00:58:53 +01:00
|
|
|
|
static void Rec_ShowTeacherRows (struct UsrData *UsrDat,struct Ins_Instit *Ins,
|
2019-12-27 19:22:48 +01:00
|
|
|
|
bool ShowData)
|
2018-10-08 01:07:15 +02:00
|
|
|
|
{
|
|
|
|
|
/***** Institution *****/
|
2019-12-27 19:22:48 +01:00
|
|
|
|
Rec_ShowInstitution (Ins,ShowData);
|
2018-10-08 01:07:15 +02:00
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Center *****/
|
|
|
|
|
Rec_ShowCenter (UsrDat,ShowData);
|
2018-10-08 01:07:15 +02:00
|
|
|
|
|
|
|
|
|
/***** Department *****/
|
2019-12-27 19:22:48 +01:00
|
|
|
|
Rec_ShowDepartment (UsrDat,ShowData);
|
2018-10-08 01:07:15 +02:00
|
|
|
|
|
|
|
|
|
/***** Office *****/
|
2019-12-27 19:22:48 +01:00
|
|
|
|
Rec_ShowOffice (UsrDat,ShowData);
|
2018-10-08 01:07:15 +02:00
|
|
|
|
|
|
|
|
|
/***** Office phone *****/
|
2019-12-27 19:22:48 +01:00
|
|
|
|
Rec_ShowOfficePhone (UsrDat,ShowData);
|
2018-10-08 01:07:15 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************** Show user's institution **************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-02-11 00:58:53 +01:00
|
|
|
|
static void Rec_ShowInstitution (struct Ins_Instit *Ins,bool ShowData)
|
2016-04-23 14:51:12 +02:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Institution;
|
|
|
|
|
|
2019-12-27 21:10:39 +01:00
|
|
|
|
/***** Institution *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RT",NULL,Txt_Institution);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_BOT DAT_N LT\"");
|
|
|
|
|
if (ShowData)
|
|
|
|
|
if (Ins->InsCod > 0)
|
|
|
|
|
{
|
|
|
|
|
if (Ins->WWW[0])
|
|
|
|
|
HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"DAT_N\"",
|
|
|
|
|
Ins->WWW);
|
|
|
|
|
HTM_Txt (Ins->FullName);
|
|
|
|
|
if (Ins->WWW[0])
|
|
|
|
|
HTM_A_End ();
|
|
|
|
|
}
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2016-04-23 14:51:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-23 15:00:07 +02:00
|
|
|
|
/*****************************************************************************/
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/*************************** Show user's center ******************************/
|
2016-04-23 15:00:07 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
static void Rec_ShowCenter (struct UsrData *UsrDat,bool ShowData)
|
2016-04-23 15:00:07 +02:00
|
|
|
|
{
|
2021-03-07 21:21:04 +01:00
|
|
|
|
extern const char *Txt_Center;
|
|
|
|
|
struct Ctr_Center Ctr;
|
2016-04-23 15:00:07 +02:00
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Center *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RT",NULL,Txt_Center);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_BOT DAT_N LT\"");
|
|
|
|
|
if (ShowData)
|
|
|
|
|
{
|
|
|
|
|
if (UsrDat->Tch.CtrCod > 0)
|
|
|
|
|
{
|
|
|
|
|
Ctr.CtrCod = UsrDat->Tch.CtrCod;
|
|
|
|
|
Ctr_GetDataOfCenterByCod (&Ctr);
|
|
|
|
|
if (Ctr.WWW[0])
|
|
|
|
|
HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"DAT_N\"",
|
|
|
|
|
Ctr.WWW);
|
|
|
|
|
HTM_Txt (Ctr.FullName);
|
|
|
|
|
if (Ctr.WWW[0])
|
|
|
|
|
HTM_A_End ();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2016-04-23 15:00:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-23 15:08:32 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************* Show user's department ****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-27 19:22:48 +01:00
|
|
|
|
static void Rec_ShowDepartment (struct UsrData *UsrDat,bool ShowData)
|
2016-04-23 15:08:32 +02:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Department;
|
2020-04-13 20:50:47 +02:00
|
|
|
|
struct Dpt_Department Dpt;
|
2016-04-23 15:08:32 +02:00
|
|
|
|
|
2019-12-27 21:10:39 +01:00
|
|
|
|
/***** Department *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RT",NULL,Txt_Department);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_BOT DAT_N LT\"");
|
|
|
|
|
if (ShowData)
|
|
|
|
|
{
|
|
|
|
|
if (UsrDat->Tch.DptCod > 0)
|
|
|
|
|
{
|
|
|
|
|
Dpt.DptCod = UsrDat->Tch.DptCod;
|
|
|
|
|
Dpt_GetDataOfDepartmentByCod (&Dpt);
|
|
|
|
|
if (Dpt.WWW[0])
|
|
|
|
|
HTM_A_Begin ("href=\"%s\" target=\"_blank\" class=\"DAT_N\"",
|
|
|
|
|
Dpt.WWW);
|
|
|
|
|
HTM_Txt (Dpt.FullName);
|
|
|
|
|
if (Dpt.WWW[0])
|
|
|
|
|
HTM_A_End ();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2016-04-23 15:08:32 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-23 15:15:06 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************************** Show user's office ******************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-27 19:22:48 +01:00
|
|
|
|
static void Rec_ShowOffice (struct UsrData *UsrDat,bool ShowData)
|
2016-04-23 15:15:06 +02:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Office;
|
|
|
|
|
|
2019-12-27 21:10:39 +01:00
|
|
|
|
/***** Office *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RT",NULL,Txt_Office);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_BOT DAT_N LT\"");
|
|
|
|
|
if (ShowData)
|
|
|
|
|
HTM_Txt (UsrDat->Tch.Office);
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2016-04-23 15:15:06 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-23 15:20:37 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************************** Show user's office phone ******************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-12-27 19:22:48 +01:00
|
|
|
|
static void Rec_ShowOfficePhone (struct UsrData *UsrDat,bool ShowData)
|
2016-04-23 15:20:37 +02:00
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Phone;
|
|
|
|
|
|
2019-12-27 21:10:39 +01:00
|
|
|
|
/***** Office phone *****/
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_Begin (NULL);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RM",NULL,Txt_Phone);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-07-08 15:00:17 +02:00
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_BOT DAT_N LM\"");
|
|
|
|
|
if (ShowData)
|
|
|
|
|
{
|
|
|
|
|
HTM_A_Begin ("href=\"tel:%s\" class=\"DAT_N\"",
|
|
|
|
|
UsrDat->Tch.OfficePhone);
|
|
|
|
|
HTM_Txt (UsrDat->Tch.OfficePhone);
|
|
|
|
|
HTM_A_End ();
|
|
|
|
|
}
|
|
|
|
|
HTM_TD_End ();
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2019-10-23 19:05:05 +02:00
|
|
|
|
HTM_TR_End ();
|
2016-04-23 15:20:37 +02:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-22 19:50:59 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*********************** Write a link to netiquette rules ********************/
|
|
|
|
|
/*****************************************************************************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
static void Rec_WriteLinkToDataProtectionClause (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_DATA_PROTECTION_CLAUSE;
|
|
|
|
|
|
2019-10-24 00:04:40 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"CM\"");
|
2021-07-08 15:00:17 +02:00
|
|
|
|
HTM_A_Begin ("class=\"TIT\" href=\"%s/\" target=\"_blank\"",
|
|
|
|
|
Cfg_URL_DATA_PROTECTION_PUBLIC);
|
|
|
|
|
HTM_Txt (Txt_DATA_PROTECTION_CLAUSE);
|
|
|
|
|
HTM_A_End ();
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************** Update and show data from identified user ******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_UpdateMyRecord (void)
|
|
|
|
|
{
|
|
|
|
|
/***** Get my data from record form *****/
|
|
|
|
|
Rec_GetUsrNameFromRecordForm (&Gbl.Usrs.Me.UsrDat);
|
|
|
|
|
Rec_GetUsrExtraDataFromRecordForm (&Gbl.Usrs.Me.UsrDat);
|
|
|
|
|
|
|
|
|
|
/***** Update my data in database *****/
|
2014-12-12 18:50:36 +01:00
|
|
|
|
Enr_UpdateUsrData (&Gbl.Usrs.Me.UsrDat);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**** Get and check future user's role in current course from record form ****/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
Rol_Role_t Rec_GetRoleFromRecordForm (void)
|
|
|
|
|
{
|
|
|
|
|
Rol_Role_t Role;
|
2017-05-22 14:52:11 +02:00
|
|
|
|
bool RoleOK;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get role as a parameter from form *****/
|
2017-01-29 21:41:08 +01:00
|
|
|
|
Role = (Rol_Role_t)
|
|
|
|
|
Par_GetParToUnsignedLong ("Role",
|
|
|
|
|
0,
|
|
|
|
|
Rol_NUM_ROLES - 1,
|
2017-05-18 19:13:41 +02:00
|
|
|
|
(unsigned long) Rol_UNK);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Check if I can register a user
|
|
|
|
|
with the received role in current course *****/
|
|
|
|
|
/* Check for other possible errors */
|
2017-05-22 14:52:11 +02:00
|
|
|
|
RoleOK = false;
|
2017-06-04 18:18:54 +02:00
|
|
|
|
switch (Gbl.Usrs.Me.Role.Logged)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2017-05-18 19:13:41 +02:00
|
|
|
|
case Rol_STD: // I am logged as student
|
2017-05-22 14:52:11 +02:00
|
|
|
|
case Rol_NET: // I am logged as non-editing teacher
|
|
|
|
|
/* A student or a non-editing teacher can only change his/her data, but not his/her role */
|
2017-06-04 18:18:54 +02:00
|
|
|
|
Role = Gbl.Usrs.Me.Role.Logged;
|
|
|
|
|
RoleOK = true;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
break;
|
2017-05-18 19:13:41 +02:00
|
|
|
|
case Rol_TCH: // I am logged as teacher
|
2017-01-19 18:32:28 +01:00
|
|
|
|
case Rol_DEG_ADM: // I am logged as degree admin
|
2021-03-07 21:21:04 +01:00
|
|
|
|
case Rol_CTR_ADM: // I am logged as center admin
|
2017-01-19 18:32:28 +01:00
|
|
|
|
case Rol_INS_ADM: // I am logged as institution admin
|
2017-05-18 19:13:41 +02:00
|
|
|
|
if (Role == Rol_STD ||
|
2017-05-22 14:52:11 +02:00
|
|
|
|
Role == Rol_NET ||
|
2017-05-18 19:13:41 +02:00
|
|
|
|
Role == Rol_TCH)
|
2015-09-16 22:13:00 +02:00
|
|
|
|
RoleOK = true;
|
|
|
|
|
break;
|
|
|
|
|
case Rol_SYS_ADM:
|
2017-05-18 19:13:41 +02:00
|
|
|
|
if ( Role == Rol_STD ||
|
2017-05-22 14:52:11 +02:00
|
|
|
|
Role == Rol_NET ||
|
2017-05-18 19:13:41 +02:00
|
|
|
|
Role == Rol_TCH ||
|
2019-04-04 10:45:15 +02:00
|
|
|
|
(Role == Rol_GST && Gbl.Hierarchy.Crs.CrsCod <= 0))
|
2015-09-16 22:13:00 +02:00
|
|
|
|
RoleOK = true;
|
|
|
|
|
break;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2015-09-16 22:13:00 +02:00
|
|
|
|
if (!RoleOK)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_WrongRoleExit ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
return Role;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2016-11-18 01:07:00 +01:00
|
|
|
|
/*************** Get data fields of shared record from form ******************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_GetUsrNameFromRecordForm (struct UsrData *UsrDat)
|
|
|
|
|
{
|
2021-02-15 22:49:44 +01:00
|
|
|
|
char Surname1[Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1]; // Temporary surname 1
|
|
|
|
|
char FrstName[Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME + 1]; // Temporary first name
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-01-26 11:08:19 +01:00
|
|
|
|
/***** Get surname 1 *****/
|
2021-02-15 22:49:44 +01:00
|
|
|
|
Par_GetParToText ("Surname1",Surname1,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
2017-01-26 11:08:19 +01:00
|
|
|
|
Str_ConvertToTitleType (Surname1);
|
|
|
|
|
// Surname 1 is mandatory, so avoid overwriting surname 1 with empty string
|
|
|
|
|
if (Surname1[0]) // New surname 1 not empty
|
2021-02-15 16:25:55 +01:00
|
|
|
|
Str_Copy (UsrDat->Surname1,Surname1,sizeof (UsrDat->Surname1) - 1);
|
2017-01-26 11:08:19 +01:00
|
|
|
|
|
|
|
|
|
/***** Get surname 2 *****/
|
2021-02-15 22:49:44 +01:00
|
|
|
|
Par_GetParToText ("Surname2",UsrDat->Surname2,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Str_ConvertToTitleType (UsrDat->Surname2);
|
|
|
|
|
|
2017-01-26 11:08:19 +01:00
|
|
|
|
/***** Get first name *****/
|
2021-02-15 22:49:44 +01:00
|
|
|
|
Par_GetParToText ("FirstName",FrstName,Usr_MAX_BYTES_FIRSTNAME_OR_SURNAME);
|
|
|
|
|
Str_ConvertToTitleType (FrstName);
|
2017-01-26 11:08:19 +01:00
|
|
|
|
// First name is mandatory, so avoid overwriting first name with empty string
|
2021-02-15 22:49:44 +01:00
|
|
|
|
if (FrstName[0]) // New first name not empty
|
|
|
|
|
Str_Copy (UsrDat->FrstName,FrstName,sizeof (UsrDat->FrstName) - 1);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-01-26 11:08:19 +01:00
|
|
|
|
/***** Build full name *****/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Usr_BuildFullName (UsrDat);
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-07 23:13:08 +01:00
|
|
|
|
static void Rec_GetUsrExtraDataFromRecordForm (struct UsrData *UsrDat)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
|
|
|
|
/***** Get sex from form *****/
|
2017-01-29 21:41:08 +01:00
|
|
|
|
UsrDat->Sex = (Usr_Sex_t)
|
|
|
|
|
Par_GetParToUnsignedLong ("Sex",
|
|
|
|
|
(unsigned long) Usr_SEX_FEMALE,
|
|
|
|
|
(unsigned long) Usr_SEX_MALE,
|
|
|
|
|
(unsigned long) Usr_SEX_UNKNOWN);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get country code *****/
|
2017-01-28 20:32:50 +01:00
|
|
|
|
UsrDat->CtyCod = Par_GetParToLong ("OthCtyCod");
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2015-10-23 01:06:32 +02:00
|
|
|
|
Dat_GetDateFromForm ("BirthDay","BirthMonth","BirthYear",
|
|
|
|
|
&(UsrDat->Birthday.Day ),
|
|
|
|
|
&(UsrDat->Birthday.Month),
|
|
|
|
|
&(UsrDat->Birthday.Year ));
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Dat_ConvDateToDateStr (&(UsrDat->Birthday),UsrDat->StrBirthday);
|
|
|
|
|
|
2020-04-29 16:43:07 +02:00
|
|
|
|
Par_GetParToText ("Phone0",UsrDat->Phone[0],Usr_MAX_BYTES_PHONE);
|
|
|
|
|
Par_GetParToText ("Phone1",UsrDat->Phone[1],Usr_MAX_BYTES_PHONE);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
Rec_GetUsrCommentsFromForm (UsrDat);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********** Get the comments of the record of a user from the form ***********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void Rec_GetUsrCommentsFromForm (struct UsrData *UsrDat)
|
|
|
|
|
{
|
|
|
|
|
/***** Check if memory is allocated for comments *****/
|
|
|
|
|
if (!UsrDat->Comments)
|
2021-04-26 15:27:27 +02:00
|
|
|
|
Err_ShowErrorAndExit ("Can not read comments of a user.");
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get the parameter with the comments *****/
|
|
|
|
|
Par_GetParToHTML ("Comments",UsrDat->Comments,Cns_MAX_BYTES_TEXT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/**** Show my shared record and a form to edit my institution, center... *****/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2018-10-09 13:41:55 +02:00
|
|
|
|
void Rec_ShowMySharedRecordAndMore (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2018-10-09 22:51:12 +02:00
|
|
|
|
extern const char *Txt_Please_fill_in_your_record_card_including_your_name;
|
|
|
|
|
extern const char *Txt_Please_fill_in_your_record_card_including_your_sex;
|
|
|
|
|
extern const char *Txt_Please_fill_in_your_record_card_including_your_country_nationality;
|
|
|
|
|
extern const char *Txt_Please_select_the_country_of_your_institution;
|
2019-02-18 20:05:07 +01:00
|
|
|
|
extern const char *Txt_Please_select_your_institution;
|
2021-03-07 21:21:04 +01:00
|
|
|
|
extern const char *Txt_Please_select_your_center;
|
2019-02-18 20:05:07 +01:00
|
|
|
|
extern const char *Txt_Please_select_your_department;
|
2018-10-09 22:51:12 +02:00
|
|
|
|
bool IAmATeacher;
|
|
|
|
|
|
|
|
|
|
/***** Get my roles if not yet got *****/
|
2021-04-24 15:10:07 +02:00
|
|
|
|
Rol_GetRolesInAllCrss (&Gbl.Usrs.Me.UsrDat);
|
2018-10-09 22:51:12 +02:00
|
|
|
|
|
|
|
|
|
/***** Check if I am a teacher *****/
|
|
|
|
|
IAmATeacher = (Gbl.Usrs.Me.UsrDat.Roles.InCrss & ((1 << Rol_NET) | // I am a non-editing teacher...
|
|
|
|
|
(1 << Rol_TCH))); // ...or a teacher in any course
|
|
|
|
|
|
|
|
|
|
/***** If user has no name and surname, sex... *****/
|
2021-02-15 16:25:55 +01:00
|
|
|
|
if (!Gbl.Usrs.Me.UsrDat.FrstName[0] ||
|
2018-10-09 22:51:12 +02:00
|
|
|
|
!Gbl.Usrs.Me.UsrDat.Surname1[0]) // 1. No name
|
2019-02-16 18:25:41 +01:00
|
|
|
|
Ale_ShowAlert (Ale_WARNING,Txt_Please_fill_in_your_record_card_including_your_name);
|
2018-10-09 22:51:12 +02:00
|
|
|
|
else if (Gbl.Usrs.Me.UsrDat.Sex == Usr_SEX_UNKNOWN) // 2. No sex
|
2019-02-16 18:25:41 +01:00
|
|
|
|
Ale_ShowAlert (Ale_WARNING,Txt_Please_fill_in_your_record_card_including_your_sex);
|
2018-10-09 22:51:12 +02:00
|
|
|
|
else if (Gbl.Usrs.Me.UsrDat.CtyCod < 0) // 3. No country
|
2019-02-16 18:25:41 +01:00
|
|
|
|
Ale_ShowAlert (Ale_WARNING,Txt_Please_fill_in_your_record_card_including_your_country_nationality);
|
2018-10-09 22:51:12 +02:00
|
|
|
|
else if (Gbl.Usrs.Me.UsrDat.InsCtyCod < 0) // 4. No institution country
|
2019-02-16 18:25:41 +01:00
|
|
|
|
Ale_ShowAlert (Ale_WARNING,Txt_Please_select_the_country_of_your_institution);
|
2018-10-09 22:51:12 +02:00
|
|
|
|
else if (Gbl.Usrs.Me.UsrDat.InsCod < 0) // 5. No institution
|
2019-02-18 20:05:07 +01:00
|
|
|
|
Ale_ShowAlert (Ale_WARNING,Txt_Please_select_your_institution);
|
2018-10-09 22:51:12 +02:00
|
|
|
|
else if (IAmATeacher)
|
|
|
|
|
{
|
2021-03-07 21:21:04 +01:00
|
|
|
|
if (Gbl.Usrs.Me.UsrDat.Tch.CtrCod < 0) // 6. No center
|
|
|
|
|
Ale_ShowAlert (Ale_WARNING,Txt_Please_select_your_center);
|
2018-10-09 22:51:12 +02:00
|
|
|
|
else if (Gbl.Usrs.Me.UsrDat.Tch.DptCod < 0) // 7. No deparment
|
2019-02-18 20:05:07 +01:00
|
|
|
|
Ale_ShowAlert (Ale_WARNING,Txt_Please_select_your_department);
|
2018-10-09 22:51:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-03-02 00:54:26 +01:00
|
|
|
|
/***** Begin container *****/
|
2019-10-24 00:04:40 +02:00
|
|
|
|
HTM_DIV_Begin ("class=\"REC_USR\"");
|
2018-10-08 18:41:56 +02:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/***** Left part *****/
|
|
|
|
|
/* Begin container for left part */
|
|
|
|
|
HTM_DIV_Begin ("class=\"REC_LEFT\"");
|
2018-10-09 13:00:21 +02:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/* My shared record card */
|
|
|
|
|
Rec_ShowSharedUsrRecord (Rec_SHA_MY_RECORD_FORM,&Gbl.Usrs.Me.UsrDat,NULL);
|
2018-10-09 13:00:21 +02:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/* End container for left part */
|
|
|
|
|
HTM_DIV_End ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/***** Right part *****/
|
|
|
|
|
/* Begin container for right part */
|
|
|
|
|
HTM_DIV_Begin ("class=\"REC_RIGHT\"");
|
2018-10-08 18:41:56 +02:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/* My institution, center and department */
|
|
|
|
|
Rec_ShowFormMyInsCtrDpt (IAmATeacher);
|
2018-10-09 22:51:12 +02:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/* My webs / social networks */
|
|
|
|
|
Net_ShowFormMyWebsAndSocialNets ();
|
2018-10-08 18:41:56 +02:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/* End container for right part */
|
|
|
|
|
HTM_DIV_End ();
|
2018-10-08 18:41:56 +02:00
|
|
|
|
|
2018-10-09 22:51:12 +02:00
|
|
|
|
/***** End container *****/
|
2019-10-23 20:07:56 +02:00
|
|
|
|
HTM_DIV_End ();
|
2018-10-08 18:41:56 +02:00
|
|
|
|
|
2018-10-08 12:37:29 +02:00
|
|
|
|
/***** Data protection clause *****/
|
|
|
|
|
Rec_WriteLinkToDataProtectionClause ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/********* Show form to edit my institution, center and department ***********/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2018-10-09 22:51:12 +02:00
|
|
|
|
static void Rec_ShowFormMyInsCtrDpt (bool IAmATeacher)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2016-11-13 13:40:52 +01:00
|
|
|
|
extern const char *Hlp_PROFILE_Institution;
|
2019-02-22 21:47:50 +01:00
|
|
|
|
extern const char *The_ClassFormInBox[The_NUM_THEMES];
|
2021-03-07 21:21:04 +01:00
|
|
|
|
extern const char *Txt_Institution_center_and_department;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
extern const char *Txt_Institution;
|
2018-10-08 23:04:05 +02:00
|
|
|
|
extern const char *Txt_Country;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
extern const char *Txt_Another_institution;
|
2021-03-07 21:21:04 +01:00
|
|
|
|
extern const char *Txt_Center;
|
|
|
|
|
extern const char *Txt_Another_center;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
extern const char *Txt_Department;
|
|
|
|
|
extern const char *Txt_Office;
|
|
|
|
|
extern const char *Txt_Phone;
|
|
|
|
|
unsigned NumCty;
|
|
|
|
|
unsigned NumIns;
|
|
|
|
|
unsigned NumCtr;
|
2019-11-08 01:10:32 +01:00
|
|
|
|
char StrRecordWidth[Cns_MAX_DECIMAL_DIGITS_UINT + 1];
|
2016-12-13 13:32:19 +01:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/***** Get list of countries *****/
|
|
|
|
|
Cty_GetBasicListOfCountries ();
|
|
|
|
|
|
2021-03-02 00:54:26 +01:00
|
|
|
|
/***** Begin section *****/
|
2019-10-26 01:56:36 +02:00
|
|
|
|
HTM_SECTION_Begin (Rec_MY_INS_CTR_DPT_ID);
|
2018-10-08 12:37:29 +02:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/***** Begin box and table *****/
|
|
|
|
|
sprintf (StrRecordWidth,"%upx",Rec_RECORD_WIDTH);
|
|
|
|
|
Box_BoxTableBegin (StrRecordWidth,
|
|
|
|
|
IAmATeacher ? Txt_Institution_center_and_department :
|
|
|
|
|
Txt_Institution,
|
|
|
|
|
NULL,NULL,
|
|
|
|
|
Hlp_PROFILE_Institution,Box_NOT_CLOSABLE,2);
|
2019-10-07 20:17:29 +02:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/***** Country *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RM","InsCtyCod",
|
|
|
|
|
Str_BuildStringStr ("%s*",Txt_Country));
|
|
|
|
|
Str_FreeString ();
|
|
|
|
|
|
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_BOT LM\"");
|
|
|
|
|
|
|
|
|
|
/* Begin form to select the country of my institution */
|
2021-06-29 15:25:42 +02:00
|
|
|
|
Frm_BeginFormAnchor (ActChgCtyMyIns,Rec_MY_INS_CTR_DPT_ID);
|
2021-05-22 12:34:10 +02:00
|
|
|
|
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,
|
|
|
|
|
"id=\"InsCtyCod\" name=\"OthCtyCod\""
|
|
|
|
|
" class=\"REC_C2_BOT_INPUT\"");
|
|
|
|
|
HTM_OPTION (HTM_Type_STRING,"-1",
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.InsCtyCod <= 0,true,
|
|
|
|
|
NULL);
|
|
|
|
|
for (NumCty = 0;
|
|
|
|
|
NumCty < Gbl.Hierarchy.Ctys.Num;
|
|
|
|
|
NumCty++)
|
|
|
|
|
HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod,
|
|
|
|
|
Gbl.Hierarchy.Ctys.Lst[NumCty].CtyCod == Gbl.Usrs.Me.UsrDat.InsCtyCod,false,
|
|
|
|
|
"%s",Gbl.Hierarchy.Ctys.Lst[NumCty].Name[Gbl.Prefs.Language]);
|
|
|
|
|
HTM_SELECT_End ();
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
|
|
|
|
|
/***** Institution *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RM","OthInsCod",
|
|
|
|
|
Str_BuildStringStr ("%s*",Txt_Institution));
|
|
|
|
|
Str_FreeString ();
|
|
|
|
|
|
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_BOT LM\"");
|
|
|
|
|
|
|
|
|
|
/* Get list of institutions in this country */
|
|
|
|
|
Ins_FreeListInstitutions ();
|
|
|
|
|
if (Gbl.Usrs.Me.UsrDat.InsCtyCod > 0)
|
|
|
|
|
Ins_GetBasicListOfInstitutions (Gbl.Usrs.Me.UsrDat.InsCtyCod);
|
|
|
|
|
|
|
|
|
|
/* Begin form to select institution */
|
2021-06-29 15:25:42 +02:00
|
|
|
|
Frm_BeginFormAnchor (ActChgMyIns,Rec_MY_INS_CTR_DPT_ID);
|
2021-05-22 12:34:10 +02:00
|
|
|
|
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,
|
|
|
|
|
"id=\"OthInsCod\" name=\"OthInsCod\""
|
|
|
|
|
" class=\"REC_C2_BOT_INPUT\"");
|
|
|
|
|
HTM_OPTION (HTM_Type_STRING,"-1",
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.InsCod < 0,true,
|
|
|
|
|
NULL);
|
|
|
|
|
HTM_OPTION (HTM_Type_STRING,"0",
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.InsCod == 0,false,
|
|
|
|
|
"%s",Txt_Another_institution);
|
|
|
|
|
for (NumIns = 0;
|
|
|
|
|
NumIns < Gbl.Hierarchy.Inss.Num;
|
|
|
|
|
NumIns++)
|
|
|
|
|
HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Inss.Lst[NumIns].InsCod,
|
|
|
|
|
Gbl.Hierarchy.Inss.Lst[NumIns].InsCod == Gbl.Usrs.Me.UsrDat.InsCod,false,
|
|
|
|
|
"%s",Gbl.Hierarchy.Inss.Lst[NumIns].FullName);
|
|
|
|
|
HTM_SELECT_End ();
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
|
|
|
|
|
if (IAmATeacher)
|
|
|
|
|
{
|
|
|
|
|
/***** Center *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RM","OthCtrCod",
|
|
|
|
|
Str_BuildStringStr ("%s*",Txt_Center));
|
|
|
|
|
Str_FreeString ();
|
|
|
|
|
|
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_BOT LM\"");
|
|
|
|
|
|
|
|
|
|
/* Get list of centers in this institution */
|
|
|
|
|
Ctr_FreeListCenters ();
|
|
|
|
|
if (Gbl.Usrs.Me.UsrDat.InsCod > 0)
|
|
|
|
|
Ctr_GetBasicListOfCenters (Gbl.Usrs.Me.UsrDat.InsCod);
|
|
|
|
|
|
|
|
|
|
/* Begin form to select center */
|
2021-06-29 15:25:42 +02:00
|
|
|
|
Frm_BeginFormAnchor (ActChgMyCtr,Rec_MY_INS_CTR_DPT_ID);
|
2021-05-22 12:34:10 +02:00
|
|
|
|
HTM_SELECT_Begin (HTM_SUBMIT_ON_CHANGE,
|
|
|
|
|
"id=\"OthCtrCod\" name=\"OthCtrCod\""
|
|
|
|
|
" class=\"REC_C2_BOT_INPUT\"");
|
|
|
|
|
HTM_OPTION (HTM_Type_STRING,"-1",
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.Tch.CtrCod < 0,true,
|
|
|
|
|
NULL);
|
|
|
|
|
HTM_OPTION (HTM_Type_STRING,"0",
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.Tch.CtrCod == 0,false,
|
|
|
|
|
Txt_Another_center);
|
|
|
|
|
for (NumCtr = 0;
|
|
|
|
|
NumCtr < Gbl.Hierarchy.Ctrs.Num;
|
|
|
|
|
NumCtr++)
|
|
|
|
|
HTM_OPTION (HTM_Type_LONG,&Gbl.Hierarchy.Ctrs.Lst[NumCtr].CtrCod,
|
|
|
|
|
Gbl.Hierarchy.Ctrs.Lst[NumCtr].CtrCod == Gbl.Usrs.Me.UsrDat.Tch.CtrCod,false,
|
|
|
|
|
Gbl.Hierarchy.Ctrs.Lst[NumCtr].FullName);
|
|
|
|
|
HTM_SELECT_End ();
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
|
|
|
|
|
/***** Department *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RM",Dpt_PARAM_DPT_COD_NAME,
|
|
|
|
|
Str_BuildStringStr ("%s*",Txt_Department));
|
|
|
|
|
Str_FreeString ();
|
|
|
|
|
|
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_BOT LM\"");
|
2021-06-29 15:25:42 +02:00
|
|
|
|
Frm_BeginFormAnchor (ActChgMyDpt,Rec_MY_INS_CTR_DPT_ID);
|
2021-05-22 12:34:10 +02:00
|
|
|
|
Dpt_WriteSelectorDepartment (Gbl.Usrs.Me.UsrDat.InsCod, // Departments in my institution
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.Tch.DptCod, // Selected department
|
|
|
|
|
"REC_C2_BOT_INPUT", // Selector class
|
|
|
|
|
-1L, // First option
|
|
|
|
|
"", // Text when no department selected
|
|
|
|
|
true); // Submit on change
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
|
|
|
|
|
/***** Office *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RM","Office",Txt_Office);
|
|
|
|
|
|
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_BOT LM\"");
|
2021-06-29 15:25:42 +02:00
|
|
|
|
Frm_BeginFormAnchor (ActChgMyOff,Rec_MY_INS_CTR_DPT_ID);
|
2021-05-22 12:34:10 +02:00
|
|
|
|
HTM_INPUT_TEXT ("Office",Usr_MAX_CHARS_ADDRESS,Gbl.Usrs.Me.UsrDat.Tch.Office,
|
|
|
|
|
HTM_SUBMIT_ON_CHANGE,
|
|
|
|
|
"id=\"Office\" class=\"REC_C2_BOT_INPUT\"");
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
|
|
|
|
|
/***** Office phone *****/
|
|
|
|
|
HTM_TR_Begin (NULL);
|
|
|
|
|
|
|
|
|
|
/* Label */
|
|
|
|
|
Frm_LabelColumn ("REC_C1_BOT RM","OfficePhone",Txt_Phone);
|
|
|
|
|
|
|
|
|
|
/* Data */
|
|
|
|
|
HTM_TD_Begin ("class=\"REC_C2_BOT LM\"");
|
2021-06-29 15:25:42 +02:00
|
|
|
|
Frm_BeginFormAnchor (ActChgMyOffPho,Rec_MY_INS_CTR_DPT_ID);
|
2021-05-22 12:34:10 +02:00
|
|
|
|
HTM_INPUT_TEL ("OfficePhone",Gbl.Usrs.Me.UsrDat.Tch.OfficePhone,
|
|
|
|
|
HTM_SUBMIT_ON_CHANGE,
|
|
|
|
|
"id=\"OfficePhone\" class=\"REC_C2_BOT_INPUT\"");
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
HTM_TD_End ();
|
|
|
|
|
|
|
|
|
|
HTM_TR_End ();
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-05-22 12:34:10 +02:00
|
|
|
|
/***** End table and box *****/
|
|
|
|
|
Box_BoxTableEnd ();
|
2018-10-08 12:37:29 +02:00
|
|
|
|
|
|
|
|
|
/***** End section *****/
|
2019-10-26 01:56:36 +02:00
|
|
|
|
HTM_SECTION_End ();
|
2021-05-22 12:34:10 +02:00
|
|
|
|
|
|
|
|
|
// Do not free list of countries here, because it can be reused
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******** Receive form data to change the country of my institution **********/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_ChgCountryOfMyInstitution (void)
|
|
|
|
|
{
|
2017-05-31 22:51:40 +02:00
|
|
|
|
unsigned NumInss;
|
|
|
|
|
|
2016-10-23 19:40:14 +02:00
|
|
|
|
/***** Get country code of my institution *****/
|
2017-05-31 21:05:59 +02:00
|
|
|
|
Gbl.Usrs.Me.UsrDat.InsCtyCod = Cty_GetAndCheckParamOtherCtyCod (0);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** When country changes, the institution, center and department must be reset *****/
|
2017-05-31 22:51:40 +02:00
|
|
|
|
NumInss = Ins_GetNumInssInCty (Gbl.Usrs.Me.UsrDat.InsCtyCod);
|
|
|
|
|
if (NumInss)
|
|
|
|
|
{
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.InsCod = -1L;
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.Tch.CtrCod = -1L;
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.Tch.DptCod = -1L;
|
|
|
|
|
}
|
|
|
|
|
else // Country has no institutions
|
|
|
|
|
{
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.InsCod = 0; // Another institution
|
2021-03-07 21:21:04 +01:00
|
|
|
|
Gbl.Usrs.Me.UsrDat.Tch.CtrCod = 0; // Another center
|
2017-05-31 22:51:40 +02:00
|
|
|
|
Gbl.Usrs.Me.UsrDat.Tch.DptCod = 0; // Another department
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Update institution, center and department *****/
|
2021-06-11 10:46:53 +02:00
|
|
|
|
Acc_DB_UpdateMyInstitutionCenterDepartment ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Show form again *****/
|
2018-10-09 13:41:55 +02:00
|
|
|
|
Rec_ShowMySharedRecordAndMore ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************** Receive form data to change my institution *****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_UpdateMyInstitution (void)
|
|
|
|
|
{
|
2021-02-11 00:58:53 +01:00
|
|
|
|
struct Ins_Instit Ins;
|
2017-05-31 22:51:40 +02:00
|
|
|
|
unsigned NumCtrs;
|
|
|
|
|
unsigned NumDpts;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get my institution *****/
|
|
|
|
|
/* Get institution code */
|
2017-05-31 21:05:59 +02:00
|
|
|
|
Ins.InsCod = Ins_GetAndCheckParamOtherInsCod (0); // 0 (another institution) is allowed here
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get country of institution */
|
2016-10-23 19:40:14 +02:00
|
|
|
|
if (Ins.InsCod > 0)
|
|
|
|
|
{
|
2021-10-01 18:54:12 +02:00
|
|
|
|
Ins_GetDataOfInstitByCod (&Ins);
|
2016-10-23 19:40:14 +02:00
|
|
|
|
if (Gbl.Usrs.Me.UsrDat.InsCtyCod != Ins.CtyCod)
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.InsCtyCod = Ins.CtyCod;
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2017-05-31 22:51:40 +02:00
|
|
|
|
/* Set institution code */
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Gbl.Usrs.Me.UsrDat.InsCod = Ins.InsCod;
|
2017-05-31 22:51:40 +02:00
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** When institution changes, the center and department must be reset *****/
|
2017-05-31 22:51:40 +02:00
|
|
|
|
NumCtrs = Ctr_GetNumCtrsInIns (Gbl.Usrs.Me.UsrDat.InsCod);
|
|
|
|
|
NumDpts = Dpt_GetNumDptsInIns (Gbl.Usrs.Me.UsrDat.InsCod);
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.Tch.CtrCod = (NumCtrs ? -1L : 0);
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.Tch.DptCod = (NumDpts ? -1L : 0);
|
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Update institution, center and department *****/
|
2021-06-11 10:46:53 +02:00
|
|
|
|
Acc_DB_UpdateMyInstitutionCenterDepartment ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Show form again *****/
|
2018-10-09 13:41:55 +02:00
|
|
|
|
Rec_ShowMySharedRecordAndMore ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/******************* Receive form data to change my center *******************/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
void Rec_UpdateMyCenter (void)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2021-03-07 21:21:04 +01:00
|
|
|
|
struct Ctr_Center Ctr;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Get my center *****/
|
|
|
|
|
/* Get center code */
|
|
|
|
|
Ctr.CtrCod = Ctr_GetAndCheckParamOtherCtrCod (0); // 0 (another center) is allowed here
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/* Get institution of center */
|
2016-10-23 19:40:14 +02:00
|
|
|
|
if (Ctr.CtrCod > 0)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2021-03-07 21:21:04 +01:00
|
|
|
|
Ctr_GetDataOfCenterByCod (&Ctr);
|
2016-10-23 19:40:14 +02:00
|
|
|
|
if (Gbl.Usrs.Me.UsrDat.InsCod != Ctr.InsCod)
|
|
|
|
|
{
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.InsCod = Ctr.InsCod;
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.Tch.DptCod = -1L;
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/* Set center code */
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Gbl.Usrs.Me.UsrDat.Tch.CtrCod = Ctr.CtrCod;
|
2017-05-31 22:51:40 +02:00
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Update institution, center and department *****/
|
2021-06-11 10:46:53 +02:00
|
|
|
|
Acc_DB_UpdateMyInstitutionCenterDepartment ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Show form again *****/
|
2018-10-09 13:41:55 +02:00
|
|
|
|
Rec_ShowMySharedRecordAndMore ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************** Receive form data to change my department *****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_UpdateMyDepartment (void)
|
|
|
|
|
{
|
2020-04-13 20:50:47 +02:00
|
|
|
|
struct Dpt_Department Dpt;
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Get my department *****/
|
|
|
|
|
/* Get department code */
|
2017-05-31 21:05:59 +02:00
|
|
|
|
Dpt.DptCod = Dpt_GetAndCheckParamDptCod (0); // 0 (another department) is allowed here
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/* Get institution of department */
|
2016-10-23 19:40:14 +02:00
|
|
|
|
if (Dpt.DptCod > 0)
|
2014-12-01 23:55:08 +01:00
|
|
|
|
{
|
2016-10-23 19:40:14 +02:00
|
|
|
|
Dpt_GetDataOfDepartmentByCod (&Dpt);
|
|
|
|
|
if (Gbl.Usrs.Me.UsrDat.InsCod != Dpt.InsCod)
|
|
|
|
|
{
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.InsCod = Dpt.InsCod;
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.Tch.CtrCod = -1L;
|
|
|
|
|
}
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2021-03-07 21:21:04 +01:00
|
|
|
|
/***** Update institution, center and department *****/
|
2014-12-01 23:55:08 +01:00
|
|
|
|
Gbl.Usrs.Me.UsrDat.Tch.DptCod = Dpt.DptCod;
|
2021-06-11 10:46:53 +02:00
|
|
|
|
Acc_DB_UpdateMyInstitutionCenterDepartment ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Show form again *****/
|
2018-10-09 13:41:55 +02:00
|
|
|
|
Rec_ShowMySharedRecordAndMore ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************* Receive form data to change my office *******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_UpdateMyOffice (void)
|
|
|
|
|
{
|
|
|
|
|
/***** Get my office *****/
|
2017-03-08 14:12:33 +01:00
|
|
|
|
Par_GetParToText ("Office",Gbl.Usrs.Me.UsrDat.Tch.Office,Usr_MAX_BYTES_ADDRESS);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Update office *****/
|
2018-11-03 12:16:40 +01:00
|
|
|
|
DB_QueryUPDATE ("can not update office",
|
2021-04-17 13:11:37 +02:00
|
|
|
|
"UPDATE usr_data"
|
|
|
|
|
" SET Office='%s'"
|
|
|
|
|
" WHERE UsrCod=%ld",
|
2018-11-03 12:16:40 +01:00
|
|
|
|
Gbl.Usrs.Me.UsrDat.Tch.Office,
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Show form again *****/
|
2018-10-09 13:41:55 +02:00
|
|
|
|
Rec_ShowMySharedRecordAndMore ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************** Receive form data to change my office phone ****************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_UpdateMyOfficePhone (void)
|
|
|
|
|
{
|
|
|
|
|
/***** Get my office *****/
|
|
|
|
|
Par_GetParToText ("OfficePhone",Gbl.Usrs.Me.UsrDat.Tch.OfficePhone,Usr_MAX_BYTES_PHONE);
|
|
|
|
|
|
|
|
|
|
/***** Update office phone *****/
|
2018-11-03 12:16:40 +01:00
|
|
|
|
DB_QueryUPDATE ("can not update office phone",
|
2021-04-17 13:11:37 +02:00
|
|
|
|
"UPDATE usr_data"
|
|
|
|
|
" SET OfficePhone='%s'"
|
|
|
|
|
" WHERE UsrCod=%ld",
|
2018-11-03 12:16:40 +01:00
|
|
|
|
Gbl.Usrs.Me.UsrDat.Tch.OfficePhone,
|
|
|
|
|
Gbl.Usrs.Me.UsrDat.UsrCod);
|
2014-12-01 23:55:08 +01:00
|
|
|
|
|
|
|
|
|
/***** Show form again *****/
|
2018-10-09 13:41:55 +02:00
|
|
|
|
Rec_ShowMySharedRecordAndMore ();
|
2014-12-01 23:55:08 +01:00
|
|
|
|
}
|
2021-05-27 00:30:06 +02:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/******************** Remove content of course record cards ******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_DB_RemoveCrsRecordContents (long CrsCod)
|
|
|
|
|
{
|
|
|
|
|
DB_QueryDELETE ("can not remove content of cards in a course",
|
|
|
|
|
"DELETE FROM crs_records"
|
|
|
|
|
" USING crs_record_fields,"
|
|
|
|
|
"crs_records"
|
|
|
|
|
" WHERE crs_record_fields.CrsCod=%ld"
|
|
|
|
|
" AND crs_record_fields.FieldCod=crs_records.FieldCod",
|
|
|
|
|
CrsCod);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************ Remove definition of fields in course record cards *************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void Rec_DB_RemoveCrsRecordFields (long CrsCod)
|
|
|
|
|
{
|
|
|
|
|
DB_QueryDELETE ("can not remove fields of cards in a course",
|
|
|
|
|
"DELETE FROM crs_record_fields"
|
|
|
|
|
" WHERE CrsCod=%ld",
|
|
|
|
|
CrsCod);
|
|
|
|
|
}
|