2021-10-09 18:24:47 +02:00
|
|
|
|
// swad_program_database.h: course program, operations with database
|
|
|
|
|
|
|
|
|
|
#ifndef _SWAD_PRG_DB
|
|
|
|
|
#define _SWAD_PRG_DB
|
|
|
|
|
/*
|
|
|
|
|
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.
|
2024-02-07 00:40:28 +01:00
|
|
|
|
Copyright (C) 1999-2024 Antonio Ca<EFBFBD>as Vargas
|
2021-10-09 18:24:47 +02: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 ***********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2023-10-27 17:50:57 +02:00
|
|
|
|
#include "swad_contracted_expanded.h"
|
2023-09-22 14:47:56 +02:00
|
|
|
|
#include "swad_hierarchy_type.h"
|
2021-10-09 18:24:47 +02:00
|
|
|
|
#include "swad_program.h"
|
2022-07-14 10:17:36 +02:00
|
|
|
|
#include "swad_program_resource.h"
|
2021-10-09 18:24:47 +02:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Public prototypes *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2022-07-14 10:17:36 +02:00
|
|
|
|
//--------------------------------- Items -------------------------------------
|
2021-10-09 18:24:47 +02:00
|
|
|
|
long Prg_DB_InsertItem (const struct Prg_Item *Item,const char *Txt);
|
|
|
|
|
void Prg_DB_UpdateItem (const struct Prg_Item *Item,const char *Txt);
|
2023-09-10 14:49:01 +02:00
|
|
|
|
void Prg_DB_HideOrUnhideItem (long ItmCod,
|
|
|
|
|
HidVis_HiddenOrVisible_t HiddenOrVisible);
|
2021-10-09 18:24:47 +02:00
|
|
|
|
void Prg_DB_UpdateIndexRange (long Diff,long Begin,long End);
|
2022-07-15 18:15:40 +02:00
|
|
|
|
void Prg_DB_LockTableItems (void);
|
2021-10-09 18:24:47 +02:00
|
|
|
|
void Prg_DB_MoveDownItems (unsigned Index);
|
|
|
|
|
void Prg_DB_MoveLeftRightItemRange (const struct Prg_ItemRange *ToMove,
|
|
|
|
|
Prg_MoveLeftRight_t LeftRight);
|
|
|
|
|
|
|
|
|
|
unsigned Prg_DB_GetListItems (MYSQL_RES **mysql_res);
|
2023-03-23 09:35:20 +01:00
|
|
|
|
unsigned Prg_DB_GetItemDataByCod (MYSQL_RES **mysql_res,long ItmCod);
|
2021-10-09 18:24:47 +02:00
|
|
|
|
void Prg_DB_GetItemTxt (long ItmCod,char Txt[Cns_MAX_BYTES_TEXT + 1]);
|
2022-07-12 14:42:10 +02:00
|
|
|
|
|
2023-09-22 14:47:56 +02:00
|
|
|
|
unsigned Prg_DB_GetNumCoursesWithItems (Hie_Level_t Level);
|
|
|
|
|
unsigned Prg_DB_GetNumItems (Hie_Level_t Level);
|
2021-10-09 18:24:47 +02:00
|
|
|
|
|
|
|
|
|
void Prg_DB_RemoveItemRange (const struct Prg_ItemRange *ToRemove);
|
|
|
|
|
void Prg_DB_RemoveCrsItems (long CrsCod);
|
|
|
|
|
|
2022-07-14 10:17:36 +02:00
|
|
|
|
//------------------------------ Resources ------------------------------------
|
2022-09-13 20:26:58 +02:00
|
|
|
|
long Prg_DB_CreateResource (const struct Prg_Item *Item);
|
2022-07-25 01:01:20 +02:00
|
|
|
|
|
2022-09-13 20:26:58 +02:00
|
|
|
|
void Prg_DB_UpdateResourceTitle (long ItmCod,long RscCod,
|
2023-03-26 20:46:28 +02:00
|
|
|
|
const char NewTitle[Rsc_MAX_BYTES_RESOURCE_TITLE + 1]);
|
2022-07-22 22:25:49 +02:00
|
|
|
|
|
2022-07-15 18:15:40 +02:00
|
|
|
|
unsigned Prg_DB_GetListResources (MYSQL_RES **mysql_res,long ItmCod,
|
|
|
|
|
bool ShowHiddenResources);
|
2023-03-23 09:35:20 +01:00
|
|
|
|
unsigned Prg_DB_GetResourceDataByCod (MYSQL_RES **mysql_res,long RscCod);
|
2022-09-14 23:16:03 +02:00
|
|
|
|
|
2022-07-15 18:15:40 +02:00
|
|
|
|
unsigned Prg_DB_GetRscIndBefore (long ItmCod,unsigned RscInd);
|
|
|
|
|
unsigned Prg_DB_GetRscIndAfter (long ItmCod,unsigned RscInd);
|
|
|
|
|
long Prg_DB_GetRscCodFromRscInd (long ItmCod,unsigned RscInd);
|
|
|
|
|
|
2022-09-13 20:26:58 +02:00
|
|
|
|
void Prg_DB_RemoveResource (const struct Prg_Item *Item);
|
2022-07-14 10:17:36 +02:00
|
|
|
|
|
2023-09-10 14:54:42 +02:00
|
|
|
|
void Prg_DB_HideOrUnhideResource (long RscCod,
|
|
|
|
|
HidVis_HiddenOrVisible_t HiddenOrVisible);
|
2022-07-14 14:34:17 +02:00
|
|
|
|
|
2022-07-15 18:15:40 +02:00
|
|
|
|
void Prg_DB_LockTableResources (void);
|
|
|
|
|
void Prg_DB_UpdateRscInd (long RscCod,int RscInd);
|
2022-09-17 14:02:22 +02:00
|
|
|
|
void Prg_DB_UpdateRscLink (const struct Prg_Item *Item);
|
2022-07-15 18:15:40 +02:00
|
|
|
|
|
2022-09-22 00:21:23 +02:00
|
|
|
|
void Prg_DB_InsertItemInExpandedItems (long ItmCod);
|
2023-10-27 17:50:57 +02:00
|
|
|
|
ConExp_ContractedOrExpanded_t Prg_DB_GetIfContractedOrExpandedItem (long ItmCod);
|
2022-09-22 00:21:23 +02:00
|
|
|
|
void Prg_DB_RemoveItemFromExpandedItems (long ItmCod);
|
|
|
|
|
|
2021-10-09 18:24:47 +02:00
|
|
|
|
#endif
|