2022-09-24 18:53:31 +02:00
|
|
|
|
// swad_attendance_resource.c: links to attendance events as program resources
|
|
|
|
|
/*
|
|
|
|
|
SWAD (Shared Workspace At a Distance),
|
|
|
|
|
is a web platform developed at the University of Granada (Spain),
|
|
|
|
|
and used to support university teaching.
|
|
|
|
|
|
|
|
|
|
This file is part of SWAD core.
|
|
|
|
|
Copyright (C) 1999-2022 Antonio Ca<EFBFBD>as Vargas
|
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Affero General Public License as
|
|
|
|
|
published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************************** Headers **********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "swad_alert.h"
|
|
|
|
|
#include "swad_attendance.h"
|
|
|
|
|
#include "swad_attendance_database.h"
|
2022-09-28 15:19:17 +02:00
|
|
|
|
#include "swad_attendance_resource.h"
|
2022-09-24 18:53:31 +02:00
|
|
|
|
#include "swad_error.h"
|
|
|
|
|
#include "swad_form.h"
|
|
|
|
|
#include "swad_program_database.h"
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************ Get link to attendance event ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void AttRsc_GetLinkToEvent (void)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Link_to_resource_X_copied_into_clipboard;
|
|
|
|
|
long AttCod;
|
|
|
|
|
char Title[Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE + 1];
|
|
|
|
|
|
|
|
|
|
/***** Get attendance event code *****/
|
2022-09-29 16:50:42 +02:00
|
|
|
|
AttCod = Att_GetParamAttCod ();
|
2022-09-24 18:53:31 +02:00
|
|
|
|
|
|
|
|
|
/***** Get attendance event title *****/
|
2022-09-28 15:19:17 +02:00
|
|
|
|
AttRsc_GetTitleFromAttCod (AttCod,Title,sizeof (Title) - 1);
|
2022-09-24 18:53:31 +02:00
|
|
|
|
|
|
|
|
|
/***** Copy link to attendance event into resource clipboard *****/
|
|
|
|
|
Prg_DB_CopyToClipboard (PrgRsc_ATTENDANCE_EVENT,AttCod);
|
|
|
|
|
|
|
|
|
|
/***** Write sucess message *****/
|
|
|
|
|
Ale_ShowAlert (Ale_SUCCESS,Txt_Link_to_resource_X_copied_into_clipboard,
|
|
|
|
|
Title);
|
|
|
|
|
|
|
|
|
|
/***** Show attendance events again *****/
|
|
|
|
|
Att_SeeAttEvents ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/**************** Write attendance event in course program *******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void AttRsc_WriteAttEventInCrsProgram (long AttCod,bool PutFormToGo,
|
|
|
|
|
const char *Icon,const char *IconTitle)
|
|
|
|
|
{
|
|
|
|
|
extern const char *Txt_Actions[Act_NUM_ACTIONS];
|
2022-09-28 15:19:17 +02:00
|
|
|
|
Act_Action_t NextAction;
|
2022-09-24 18:53:31 +02:00
|
|
|
|
char Title[Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE + 1];
|
|
|
|
|
|
|
|
|
|
/***** Get game title *****/
|
2022-09-28 15:19:17 +02:00
|
|
|
|
AttRsc_GetTitleFromAttCod (AttCod,Title,sizeof (Title) - 1);
|
2022-09-24 18:53:31 +02:00
|
|
|
|
|
|
|
|
|
/***** Begin form to go to game *****/
|
|
|
|
|
if (PutFormToGo)
|
|
|
|
|
{
|
2022-09-28 15:19:17 +02:00
|
|
|
|
NextAction = (AttCod > 0) ? ActSeeOneAtt : // Attendance events specified
|
|
|
|
|
ActSeeAtt; // All attendance events
|
|
|
|
|
Frm_BeginForm (NextAction);
|
2022-09-24 18:53:31 +02:00
|
|
|
|
Att_PutParamAttCod (AttCod);
|
|
|
|
|
Att_PutParamsCodGrps (AttCod);
|
2022-09-28 15:19:17 +02:00
|
|
|
|
HTM_BUTTON_Submit_Begin (Txt_Actions[NextAction],
|
2022-09-24 18:53:31 +02:00
|
|
|
|
"class=\"LM BT_LINK PRG_LNK_%s\"",
|
|
|
|
|
The_GetSuffix ());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***** Icon depending on type ******/
|
|
|
|
|
if (PutFormToGo)
|
2022-09-28 15:19:17 +02:00
|
|
|
|
Ico_PutIconLink (Icon,Ico_BLACK,NextAction);
|
2022-09-24 18:53:31 +02:00
|
|
|
|
else
|
|
|
|
|
Ico_PutIconOn (Icon,Ico_BLACK,IconTitle);
|
|
|
|
|
|
|
|
|
|
/***** Write attendance event title *****/
|
|
|
|
|
HTM_Txt (Title);
|
|
|
|
|
|
|
|
|
|
/***** End form to download file *****/
|
|
|
|
|
if (PutFormToGo)
|
|
|
|
|
{
|
|
|
|
|
/* End form */
|
|
|
|
|
HTM_BUTTON_End ();
|
|
|
|
|
|
|
|
|
|
Frm_EndForm ();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/*************** Get attendance event title from game code *******************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
void AttRsc_GetTitleFromAttCod (long AttCod,char *Title,size_t TitleSize)
|
|
|
|
|
{
|
2022-09-29 00:04:41 +02:00
|
|
|
|
extern const char *Txt_Control_of_class_attendance;
|
2022-09-24 18:53:31 +02:00
|
|
|
|
char TitleFromDB[Att_MAX_BYTES_ATTENDANCE_EVENT_TITLE + 1];
|
|
|
|
|
|
2022-09-28 15:19:17 +02:00
|
|
|
|
if (AttCod > 0)
|
|
|
|
|
{
|
|
|
|
|
/***** Get attendance event title *****/
|
|
|
|
|
Att_DB_GetAttEventTitle (AttCod,TitleFromDB);
|
|
|
|
|
Str_Copy (Title,TitleFromDB,TitleSize);
|
|
|
|
|
}
|
|
|
|
|
else
|
2022-09-29 00:04:41 +02:00
|
|
|
|
/***** Generic title for all attendance events *****/
|
|
|
|
|
Str_Copy (Title,Txt_Control_of_class_attendance,TitleSize);
|
2022-09-24 18:53:31 +02:00
|
|
|
|
}
|