"
""
"%s:"
" | "
"",
The_ClassForm[Gbl.Prefs.Theme],TxtLabel);
/***** Form with list of options *****/
if (Action != ActUnk)
Act_FormStart (Action);
fprintf (Gbl.F.Out,"");
if (Action != ActUnk)
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_UNKNOWN;
}
/*****************************************************************************/
/**************** Get parameter with visibility from form ********************/
/*****************************************************************************/
Pri_Visibility_t Pri_GetParamVisibility (const char *ParamName)
{
return (Pri_Visibility_t)
Par_GetParToUnsignedLong (ParamName,
0,
Pri_NUM_OPTIONS_PRIVACY - 1,
(unsigned long) Pri_VISIBILITY_UNKNOWN);
}
/*****************************************************************************/
/*********** Check if user's photo of public profile can be shown ************/
/*****************************************************************************/
// Returns true if it can be shown and false if not.
bool Pri_ShowingIsAllowed (Pri_Visibility_t Visibility,struct UsrData *UsrDat)
{
/***** It's me? I always can see my things *****/
if (UsrDat->UsrCod == Gbl.Usrs.Me.UsrDat.UsrCod)
return true;
/***** System admins always can see others' profiles *****/
if (Gbl.Usrs.Me.Role.Logged == Rol_SYS_ADM)
return true;
/***** Check if I can see the other's photo *****/
switch (Visibility)
{
case Pri_VISIBILITY_UNKNOWN:
return false; // It's not me
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
// Do both users share the same course but whit different role?
return Usr_CheckIfUsrSharesAnyOfMyCrsWithDifferentRole (UsrDat->UsrCod);
case Pri_VISIBILITY_COURSE: // Visible by users sharing courses with me
// Do both users share the same course?
return Usr_CheckIfUsrSharesAnyOfMyCrs (UsrDat);
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
}