"
""
"%u"
" | ",
NumRequests - NumReq);
/***** Link to course *****/
Crs_GetDataOfCourseByCod (&Crs);
Deg.DegCod = Crs.DegCod;
Deg_GetDataOfDegreeByCod (&Deg);
fprintf (Gbl.F.Out,"");
Act_FormGoToStart (ActSeeCrsInf);
Crs_PutParamCrsCod (Crs.CrsCod);
sprintf (Gbl.Title,Txt_Go_to_X,Crs.FullName);
Act_LinkFormSubmit (Gbl.Title,"DAT",NULL);
fprintf (Gbl.F.Out,"%s > %s"
"",
Deg.ShrtName,Crs.ShrtName);
Act_FormEnd ();
fprintf (Gbl.F.Out," | ");
/***** Number of teachers in the course *****/
fprintf (Gbl.F.Out,""
"%u"
" | ",
Crs.NumUsrs[Rol_TCH]);
/***** User photo *****/
fprintf (Gbl.F.Out,"");
ShowPhoto = Pho_ShowingUsrPhotoIsAllowed (&UsrDat,PhotoURL);
Pho_ShowUsrPhoto (&UsrDat,ShowPhoto ? PhotoURL :
NULL,
"PHOTO21x28",Pho_ZOOM,false);
fprintf (Gbl.F.Out," | ");
/***** User name *****/
fprintf (Gbl.F.Out,""
" "); // Limited width
Usr_WriteFirstNameBRSurnames (&UsrDat);
fprintf (Gbl.F.Out," "
" | ");
/***** Requested role (row[3]) *****/
fprintf (Gbl.F.Out,""
"%s"
" | ",
Txt_ROLES_SINGUL_abc[DesiredRole][UsrDat.Sex]);
/***** Request time (row[4]) *****/
Msg_WriteMsgDate (Dat_GetUNIXTimeFromStr (row[4]),"DAT");
/***** Button to confirm the request *****/
fprintf (Gbl.F.Out,"");
switch (DesiredRole)
{
case Rol_STD:
NextAction = ActReqMdfStd;
break;
case Rol_NET:
NextAction = ActReqMdfNET;
break;
case Rol_TCH:
NextAction = ActReqMdfTch;
break;
default:
NextAction = ActUnk;
Lay_ShowErrorAndExit ("Wrong role.");
break;
}
Act_FormStart (NextAction);
Crs_PutParamCrsCod (Crs.CrsCod);
Usr_PutParamUsrCodEncrypted (UsrDat.EncryptedUsrCod);
Btn_PutCreateButtonInline (Txt_Register);
Act_FormEnd ();
fprintf (Gbl.F.Out," | ");
/***** Button to reject the request *****/
fprintf (Gbl.F.Out,"");
Act_FormStart (ActReqRejSignUp);
Crs_PutParamCrsCod (Crs.CrsCod);
Usr_PutParamUsrCodEncrypted (UsrDat.EncryptedUsrCod);
Btn_PutRemoveButtonInline (Txt_Reject);
Act_FormEnd ();
fprintf (Gbl.F.Out," | "
"
");
/***** Mark possible notification as seen *****/
Ntf_MarkNotifAsSeen (Ntf_EVENT_ENROLMENT_REQUEST,
ReqCod,Gbl.CurrentCrs.Crs.CrsCod,
Gbl.Usrs.Me.UsrDat.UsrCod);
}
else // User does not exists or user already belongs to course ==> remove pair from crs_usr_requests table
Enr_RemoveEnrolmentRequest (Crs.CrsCod,UsrDat.UsrCod);
}
/* End table */
Tbl_EndTable ();
/* Free memory used for user's data */
Usr_UsrDataDestructor (&UsrDat);
}
else // There are no requests
Ale_ShowAlert (Ale_INFO,Txt_No_enrolment_requests);
/***** End box *****/
Box_EndBox ();
}
/*****************************************************************************/
/********************* Remove a request for enrolment ***********************/
/*****************************************************************************/
static void Enr_RemoveEnrolmentRequest (long CrsCod,long UsrCod)
{
char Query[256];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
long ReqCod;
/***** Mark possible notifications as removed
Important: do this before removing the request *****/
/* Request request code (returns 0 or 1 rows) */
sprintf (Query,"SELECT ReqCod FROM crs_usr_requests"
" WHERE CrsCod=%ld AND UsrCod=%ld",
CrsCod,UsrCod);
if (DB_QuerySELECT (Query,&mysql_res,"can not get request code")) // Request exists
{
/* Get request code */
row = mysql_fetch_row (mysql_res);
ReqCod = Str_ConvertStrCodToLongCod (row[0]);
/* Mark possible notifications as removed */
Ntf_MarkNotifAsRemoved (Ntf_EVENT_ENROLMENT_REQUEST,ReqCod);
}
/* Free structure that stores the query result */
DB_FreeMySQLResult (&mysql_res);
/***** Remove enrolment request *****/
sprintf (Query,"DELETE FROM crs_usr_requests"
" WHERE CrsCod=%ld AND UsrCod=%ld",
CrsCod,UsrCod);
DB_QueryDELETE (Query,"can not remove a request for enrolment");
}
/*****************************************************************************/
/******************* Remove expired requests for enrolment ******************/
/*****************************************************************************/
static void Enr_RemoveExpiredEnrolmentRequests (void)
{
char Query[512];
/***** Mark possible notifications as removed
Important: do this before removing the request *****/
sprintf (Query,"UPDATE notif,crs_usr_requests"
" SET notif.Status=(notif.Status | %u)"
" WHERE notif.NotifyEvent=%u"
" AND notif.Cod=crs_usr_requests.ReqCod"
" AND crs_usr_requests.RequestTime