swad-core/swad_syllabus.h

126 lines
4.3 KiB
C
Raw Permalink Normal View History

2014-12-01 23:55:08 +01:00
// swad_syllabus.h: syllabus
#ifndef _SWAD_SYL
#define _SWAD_SYL
/*
SWAD (Shared Workspace At a Distance in Spanish),
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-2024 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 ***********************************/
/*****************************************************************************/
#include "swad_view.h"
2014-12-01 23:55:08 +01:00
/*****************************************************************************/
2014-12-27 21:09:34 +01:00
/************************ Public constants and types *************************/
2014-12-01 23:55:08 +01:00
/*****************************************************************************/
#define Syl_NUM_WHICH_SYLLABUS 3
2014-12-27 21:09:34 +01:00
typedef enum
{
Syl_NONE = 0,
Syl_LECTURES = 1,
Syl_PRACTICALS = 2,
2014-12-27 21:09:34 +01:00
} Syl_WhichSyllabus_t; // Which syllabus I want to see
2014-12-28 02:42:41 +01:00
#define Syl_DEFAULT_WHICH_SYLLABUS Syl_LECTURES
2014-12-27 21:09:34 +01:00
#define Syl_NUM_CHANGE_POS_ITEM 2
2014-12-01 23:55:08 +01:00
typedef enum
{
Syl_GET_UP,
Syl_GET_DOWN,
} Syl_ChangePosItem_t;
typedef enum
{
Syl_INCREASE_LEVEL,
Syl_DECREASE_LEVEL,
} Syl_ChangeLevelItem_t;
2020-02-24 19:31:55 +01:00
struct LstItemsSyllabus
{
struct ItemSyllabus *Lst; // List of items of a syllabus
unsigned NumItems; // Number of items in the list
unsigned NumItemsWithChildren; // Number of items with children
int NumLevels; // Number of levels in the list
};
2014-12-01 23:55:08 +01:00
// Structure used to get the limits (number of items) of the subtrees to exchange in a syllabus
struct MoveSubtrees
{
struct
{
unsigned Ini,End;
} ToGetUp,ToGetDown; // Number of initial and ending items of the two subtrees to get up and get down
bool MovAllowed;
};
2020-04-12 02:47:32 +02:00
struct Syl_Syllabus
{
char PathDir[PATH_MAX + 1];
unsigned NumItem; // Item being edited
unsigned ParNumItem; // Used as parameter in forms
Vie_ViewType_t ViewType;
2020-04-12 02:47:32 +02:00
Syl_WhichSyllabus_t WhichSyllabus;
};
2014-12-01 23:55:08 +01:00
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
2020-04-12 02:47:32 +02:00
void Syl_ResetSyllabus (struct Syl_Syllabus *Syllabus);
2014-12-27 21:09:34 +01:00
Syl_WhichSyllabus_t Syl_GetParWhichSyllabus (void);
void Syl_PutParWhichSyllabus (void *SyllabusSelected);
void Syl_PutFormWhichSyllabus (Syl_WhichSyllabus_t WhichSyllabus);
2016-05-30 14:27:10 +02:00
2020-04-12 02:47:32 +02:00
bool Syl_CheckSyllabus (struct Syl_Syllabus *Syllabus,long CrsCod);
bool Syl_CheckAndShowSyllabus (struct Syl_Syllabus *Syllabus);
2014-12-01 23:55:08 +01:00
void Syl_EditSyllabus (void);
2016-05-30 14:27:10 +02:00
2020-04-12 02:47:32 +02:00
void Syl_LoadListItemsSyllabusIntoMemory (struct Syl_Syllabus *Syllabus,
long CrsCod);
2014-12-01 23:55:08 +01:00
void Syl_FreeListItemsSyllabus (void);
2016-05-30 15:25:21 +02:00
int Syl_ReadLevelItemSyllabus (FILE *XML);
2020-02-24 19:31:55 +01:00
void Syl_WriteSyllabusIntoHTMLTmpFile (FILE *FileHTMLTmp);
2017-01-16 01:51:01 +01:00
2014-12-01 23:55:08 +01:00
void Syl_RemoveItemSyllabus (void);
void Syl_UpItemSyllabus (void);
void Syl_DownItemSyllabus (void);
2020-04-12 02:47:32 +02:00
2014-12-01 23:55:08 +01:00
void Syl_CalculateUpSubtreeSyllabus (struct MoveSubtrees *Subtree,unsigned NumItem);
void Syl_CalculateDownSubtreeSyllabus (struct MoveSubtrees *Subtree,unsigned NumItem);
void Syl_RightItemSyllabus (void);
void Syl_LeftItemSyllabus (void);
2020-04-12 02:47:32 +02:00
2014-12-01 23:55:08 +01:00
void Syl_InsertItemSyllabus (void);
void Syl_ModifyItemSyllabus (void);
2020-04-12 02:47:32 +02:00
void Syl_BuildPathFileSyllabus (const struct Syl_Syllabus *Syllabus,
char PathFile[PATH_MAX + 1]);
2014-12-01 23:55:08 +01:00
void Syl_WriteStartFileSyllabus (FILE *FileSyllabus);
void Syl_WriteAllItemsFileSyllabus (FILE *FileSyllabus);
void Syl_WriteItemFileSyllabus (FILE *FileSyllabus,int Level,const char *Text);
void Syl_WriteEndFileSyllabus (FILE *FileSyllabus);
#endif