swad-core/swad_photo.h

145 lines
4.8 KiB
C
Raw Permalink Normal View History

2014-12-01 23:55:08 +01:00
// swad_photo.h: Users' photos management
#ifndef _SWAD_PHO
#define _SWAD_PHO
/*
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 ***********************************/
/*****************************************************************************/
2021-02-11 14:39:46 +01:00
#include "swad_user.h"
2014-12-01 23:55:08 +01:00
/*****************************************************************************/
/************************* Public types and constants ************************/
/*****************************************************************************/
2015-09-28 18:28:29 +02:00
#define Pho_PHOTO_REAL_WIDTH 186
#define Pho_PHOTO_REAL_HEIGHT 248
2014-12-01 23:55:08 +01:00
2015-03-13 00:16:02 +01:00
/***** Zoom? *****/
typedef enum
{
Pho_ZOOM,
Pho_NO_ZOOM,
} Pho_Zoom_t;
2014-12-01 23:55:08 +01:00
/***** Average photos of students in degrees ******/
typedef enum
{
Pho_DEGREES_SEE,
Pho_DEGREES_PRINT,
} Pho_AvgPhotoSeeOrPrint_t;
#define Pho_NUM_AVERAGE_PHOTO_TYPES 2
typedef enum
{
Pho_PHOTO_MEDIAN_ALL = 0,
Pho_PHOTO_AVERAGE_ALL = 1,
} Pho_AvgPhotoTypeOfAverage_t;
2017-01-29 12:42:19 +01:00
#define Pho_PHOTO_AVG_DEFAULT Pho_PHOTO_MEDIAN_ALL
2014-12-01 23:55:08 +01:00
#define Pho_NUM_HOW_COMPUTE_PHOTO_SIZES 4
typedef enum
{
Pho_PROPORTIONAL_TO_NUMBER_OF_STUDENTS = 0,
Pho_PROPORTIONAL_TO_NUMBER_OF_PHOTOS = 1,
Pho_PROPORTIONAL_TO_PERCENT = 2,
Pho_UNIQUE_SIZE = 3,
} Pho_HowComputePhotoSize_t;
2017-01-29 12:42:19 +01:00
#define Pho_PHOTO_SIZE_DEFAULT Pho_PROPORTIONAL_TO_NUMBER_OF_STUDENTS
2014-12-01 23:55:08 +01:00
#define Pho_NUM_HOW_ORDER_DEGREES 4
typedef enum
{
Pho_NUMBER_OF_STUDENTS = 0,
Pho_NUMBER_OF_PHOTOS = 1,
Pho_PERCENT = 2,
Pho_DEGREE_NAME = 3,
} Pho_HowOrderDegrees_t;
2017-01-29 12:42:19 +01:00
#define Pho_ORDER_DEFAULT Pho_NUMBER_OF_STUDENTS
2014-12-01 23:55:08 +01:00
2014-12-12 22:39:55 +01:00
#define Pho_MAX_CLICKS_WITHOUT_PHOTO 50
2020-04-12 21:33:02 +02:00
struct Pho_DegPhotos
{
Pho_AvgPhotoTypeOfAverage_t TypeOfAverage;
Pho_HowComputePhotoSize_t HowComputePhotoSize;
Pho_HowOrderDegrees_t HowOrderDegrees;
int MaxStds;
int MaxStdsWithPhoto;
double MaxPercent;
2020-04-12 22:33:47 +02:00
};
2020-04-12 21:33:02 +02:00
2014-12-01 23:55:08 +01:00
/*****************************************************************************/
/***************************** Public prototypes *****************************/
/*****************************************************************************/
Usr_Can_t Pho_ICanChangeOtherUsrPhoto (struct Usr_Data *UsrDat);
void Pho_PutIconToChangeUsrPhoto (struct Usr_Data *UsrDat);
2018-10-07 22:53:59 +02:00
void Pho_ReqMyPhoto (void);
2014-12-01 23:55:08 +01:00
void Pho_SendPhotoUsr (void);
void Pho_RecMyPhotoDetFaces (void);
2016-04-11 18:54:23 +02:00
void Pho_RecOtherUsrPhotoDetFaces (void);
2016-06-14 19:26:13 +02:00
void Pho_ReqRemMyPhoto (void);
2014-12-01 23:55:08 +01:00
void Pho_RemoveMyPhoto1 (void);
void Pho_RemoveMyPhoto2 (void);
void Pho_ReqRemUsrPhoto (void);
2014-12-01 23:55:08 +01:00
void Pho_RemoveUsrPhoto (void);
2016-06-14 19:26:13 +02:00
2014-12-01 23:55:08 +01:00
void Pho_UpdateMyPhoto1 (void);
void Pho_UpdateMyPhoto2 (void);
void Pho_ChangeUsrPhoto1 (void);
void Pho_ChangeUsrPhoto2 (void);
2014-12-01 23:55:08 +01:00
2014-12-12 22:39:55 +01:00
unsigned Pho_UpdateMyClicksWithoutPhoto (void);
void Pho_ShowUsrPhotoIfAllowed (struct Usr_Data *UsrDat,
const char *ClassPhoto,Pho_Zoom_t Zoom);
bool Pho_ShowingUsrPhotoIsAllowed (struct Usr_Data *UsrDat,
char PhotoURL[WWW_MAX_BYTES_WWW + 1]);
bool Pho_BuildLinkToPhoto (const struct Usr_Data *UsrDat,char PhotoURL[WWW_MAX_BYTES_WWW + 1]);
2018-10-18 02:02:32 +02:00
bool Pho_CheckIfPrivPhotoExists (long UsrCod,char PathPrivRelPhoto[PATH_MAX + 1]);
void Pho_BuildHTMLUsrPhoto (const struct Usr_Data *UsrDat,const char *PhotoURL,
const char *ClassPhoto,Pho_Zoom_t Zoom,
char **ImgStr,
char **CaptionStr);
void Pho_ShowUsrPhoto (const struct Usr_Data *UsrDat,const char *PhotoURL,
const char *ClassPhoto,Pho_Zoom_t Zoom);
2014-12-01 23:55:08 +01:00
bool Pho_RemovePhoto (struct Usr_Data *UsrDat);
void Pho_UpdatePhotoName (struct Usr_Data *UsrDat);
2015-03-06 14:11:11 +01:00
void Pho_ChangePhotoVisibility (void);
2015-01-01 19:39:46 +01:00
2014-12-01 23:55:08 +01:00
void Pho_CalcPhotoDegree (void);
void Pho_ShowPhotoDegree (void);
void Pho_PrintPhotoDegree (void);
2019-04-11 09:55:35 +02:00
void Pho_PutParTypeOfAvg (Pho_AvgPhotoTypeOfAverage_t TypeOfAverage);
void Pho_PutParPhotoSize (Pho_HowComputePhotoSize_t HowComputePhotoSize);
void Pho_PutParOrderDegrees (Pho_HowOrderDegrees_t HowOrderDegrees);
2014-12-01 23:55:08 +01:00
#endif