"
""
"%s:"
" | "
"",
The_ClassForm[Gbl.Prefs.Theme],TxtLabel);
/***** Form with list of options *****/
Act_FormStart (Action);
fprintf (Gbl.F.Out,"");
Act_FormEnd ();
fprintf (Gbl.F.Out," | "
"
");
}
/*****************************************************************************/
/************************ Get visibility from string *************************/
/*****************************************************************************/
Pri_Visibility_t Pri_GetVisibilityFromStr (const char *Str)
{
Pri_Visibility_t Visibility;
for (Visibility = (Pri_Visibility_t) 0;
Visibility < Pri_NUM_OPTIONS_PRIVACY;
Visibility++)
if (!strcasecmp (Str,Pri_VisibilityDB[Visibility]))
return Visibility;
return Pri_VISIBILITY_DEFAULT;
}
/*****************************************************************************/
/**************** Get parameter with visibility from form ********************/
/*****************************************************************************/
bool Pri_GetParamVisibility (void)
{
char UnsignedStr[10+1];
unsigned UnsignedNum;
Par_GetParToText ("Visibility",UnsignedStr,10);
if (UnsignedStr[0])
{
if (sscanf (UnsignedStr,"%u",&UnsignedNum) != 1)
Lay_ShowErrorAndExit ("Visibility is missing.");
if (UnsignedNum >= Pri_NUM_OPTIONS_PRIVACY)
Lay_ShowErrorAndExit ("Visibility is missing.");
return (Pri_Visibility_t) UnsignedNum;
}
return Pri_VISIBILITY_DEFAULT;
}
/*****************************************************************************/
/*********** Check if user's photo of public profile can be shown ************/
/*****************************************************************************/
// Returns true if it can be shown and false if not.
bool Pri_ShowIsAllowed (Pri_Visibility_t Visibility,long OtherUsrCod)
{
/***** System admins always can see others' profiles *****/
if (Gbl.Usrs.Me.LoggedRole == Rol_SYS_ADM)
return true;
/***** Check if I can see the other's photo *****/
switch (Visibility)
{
case Pri_VISIBILITY_USER: // Only visible by me and my teachers if I am a student or me and my students if I am a teacher
if (Gbl.Usrs.Me.UsrDat.UsrCod == OtherUsrCod) // It's me, I always can see my things
return true;
else
return Usr_CheckIfUsrSharesAnyOfMyCrsWithDifferentRole (OtherUsrCod); // Both users share the same course but whit different role
case Pri_VISIBILITY_COURSE: // Visible by users sharing courses with me
return Usr_CheckIfUsrSharesAnyOfMyCrs (OtherUsrCod); // Both users share the same course
case Pri_VISIBILITY_SYSTEM: // Visible by any user logged in platform
return Gbl.Usrs.Me.Logged;
case Pri_VISIBILITY_WORLD: // Public, visible by everyone, even unlogged visitors
return true;
}
return false; // Never reached. To avoid warning
}