// swad_hierarchy.c: hierarchy (system, institution, centre, degree, course)
/*
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-2019 Antonio Caņ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 .
*/
/*****************************************************************************/
/********************************* Headers ***********************************/
/*****************************************************************************/
#include // For fprintf, etc.
#include // For string functions
#include "swad_config.h"
#include "swad_degree.h"
#include "swad_form.h"
#include "swad_global.h"
#include "swad_logo.h"
#include "swad_table.h"
#include "swad_theme.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/
/*****************************************************************************/
extern struct Globals Gbl;
/*****************************************************************************/
/*************************** Public constants ********************************/
/*****************************************************************************/
/*****************************************************************************/
/***************************** Private types *********************************/
/*****************************************************************************/
/*****************************************************************************/
/**************************** Private constants ******************************/
/*****************************************************************************/
/*****************************************************************************/
/**************************** Private prototypes *****************************/
/*****************************************************************************/
/*****************************************************************************/
/********** List pending institutions, centres, degrees and courses **********/
/*****************************************************************************/
void Hie_SeePending (void)
{
/***** Put contextual links *****/
fprintf (Gbl.F.Out,"
");
/* Put link to remove old courses */
Crs_PutLinkToRemoveOldCrss ();
fprintf (Gbl.F.Out,"
");
/***** List countries with pending institutions *****/
Cty_SeeCtyWithPendingInss ();
/***** List institutions with pending centres *****/
Ins_SeeInsWithPendingCtrs ();
/***** List centres with pending degrees *****/
Ctr_SeeCtrWithPendingDegs ();
/***** List degrees with pending courses *****/
Deg_SeeDegWithPendingCrss ();
}
/*****************************************************************************/
/*** Write menu to select country, institution, centre, degree and course ****/
/*****************************************************************************/
void Hie_WriteMenuHierarchy (void)
{
extern const char *The_ClassFormInBox[The_NUM_THEMES];
extern const char *Txt_Country;
extern const char *Txt_Institution;
extern const char *Txt_Centre;
extern const char *Txt_Degree;
extern const char *Txt_Course;
/***** Start table *****/
Tbl_StartTableCenter (2);
/***** Write a 1st selector
with all the countries *****/
fprintf (Gbl.F.Out,"
");
if (Gbl.Hierarchy.Cty.CtyCod > 0) // Country selected...
{
fprintf (Gbl.F.Out,"
",ClassTxt);
/***** Separator *****/
fprintf (Gbl.F.Out," > ");
/***** Form to go to see institutions of this country *****/
Frm_StartFormGoTo (ActSeeIns);
Cty_PutParamCtyCod (Gbl.Hierarchy.Cty.CtyCod);
Frm_LinkFormSubmit (Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language],ClassTxt,NULL);
fprintf (Gbl.F.Out,"%s",Gbl.Hierarchy.Cty.Name[Gbl.Prefs.Language]);
Frm_EndForm ();
fprintf (Gbl.F.Out,"
");
}
else
{
fprintf (Gbl.F.Out,"
",ClassTxt);
/***** Separator *****/
fprintf (Gbl.F.Out," > ");
/***** Form to go to select countries *****/
Frm_StartFormGoTo (ActSeeCty);
Frm_LinkFormSubmit (Txt_Country,ClassTxt,NULL);
fprintf (Gbl.F.Out,"%s",Txt_Country);
Frm_EndForm ();
fprintf (Gbl.F.Out,"
");
}
if (Gbl.Hierarchy.Ctr.CtrCod > 0) // Centre selected...
{
fprintf (Gbl.F.Out,"
",ClassTxt);
/***** Separator *****/
fprintf (Gbl.F.Out," > ");
/***** Form to see degrees of this centre *****/
Frm_StartFormGoTo (ActSeeDeg);
Ctr_PutParamCtrCod (Gbl.Hierarchy.Ctr.CtrCod);
Frm_LinkFormSubmit (Gbl.Hierarchy.Ctr.FullName,ClassTxt,NULL);
fprintf (Gbl.F.Out,"%s",Gbl.Hierarchy.Ctr.ShrtName);
Frm_EndForm ();
fprintf (Gbl.F.Out,"
");
}
else if (Gbl.Hierarchy.Ins.InsCod > 0)
{
fprintf (Gbl.F.Out,"
",ClassTxt);
/***** Separator *****/
fprintf (Gbl.F.Out," > ");
/***** Form to go to select centres *****/
Frm_StartFormGoTo (ActSeeCtr);
Frm_LinkFormSubmit (Txt_Centre,ClassTxt,NULL);
fprintf (Gbl.F.Out,"%s",Txt_Centre);
Frm_EndForm ();
fprintf (Gbl.F.Out,"
",ClassTxt);
/***** Separator *****/
fprintf (Gbl.F.Out," > ");
/***** Form to go to see courses of this degree *****/
Frm_StartFormGoTo (ActSeeCrs);
Deg_PutParamDegCod (Gbl.Hierarchy.Deg.DegCod);
Frm_LinkFormSubmit (Gbl.Hierarchy.Deg.FullName,ClassTxt,NULL);
fprintf (Gbl.F.Out,"%s",Gbl.Hierarchy.Deg.ShrtName);
Frm_EndForm ();
fprintf (Gbl.F.Out,"
");
}
else if (Gbl.Hierarchy.Ctr.CtrCod > 0)
{
fprintf (Gbl.F.Out,"
",ClassTxt);
/***** Separator *****/
fprintf (Gbl.F.Out," > ");
/***** Form to go to select degrees *****/
Frm_StartFormGoTo (ActSeeDeg);
Frm_LinkFormSubmit (Txt_Degree,ClassTxt,NULL);
fprintf (Gbl.F.Out,"%s",Txt_Degree);
Frm_EndForm ();
fprintf (Gbl.F.Out,"
");
}
/*****************************************************************************/
/*************** Write course full name in the top of the page ***************/
/*****************************************************************************/
void Hie_WriteBigNameCtyInsCtrDegCrs (void)
{
extern const char *The_ClassCourse[The_NUM_THEMES];
extern const char *Txt_TAGLINE;
fprintf (Gbl.F.Out,"
",
The_ClassCourse[Gbl.Prefs.Theme]);
/***** Logo *****/
switch (Gbl.Hierarchy.Level)
{
case Hie_SYS: // System
fprintf (Gbl.F.Out,"",
Cfg_URL_ICON_PUBLIC,
Cfg_PLATFORM_SHORT_NAME,Cfg_PLATFORM_FULL_NAME);
break;
case Hie_CTY: // Country
Cty_DrawCountryMap (&Gbl.Hierarchy.Cty,"COUNTRY_MAP_TITLE");
break;
case Hie_INS: // Institution
Log_DrawLogo (Hie_INS,Gbl.Hierarchy.Ins.InsCod,
Gbl.Hierarchy.Ins.ShrtName,40,"TOP_LOGO",false);
break;
case Hie_CTR: // Centre
Log_DrawLogo (Hie_CTR,Gbl.Hierarchy.Ctr.CtrCod,
Gbl.Hierarchy.Ctr.ShrtName,40,"TOP_LOGO",false);
break;
case Hie_DEG: // Degree
case Hie_CRS: // Course
Log_DrawLogo (Hie_DEG,Gbl.Hierarchy.Deg.DegCod,
Gbl.Hierarchy.Deg.ShrtName,40,"TOP_LOGO",false);
break;
default:
break;
}
/***** Text *****/
fprintf (Gbl.F.Out,"
");
if (Gbl.Hierarchy.Cty.CtyCod > 0)
fprintf (Gbl.F.Out,"