"
""
""
" ",
The_ClassFormul[Gbl.Prefs.Theme]);
/***** Title of top level *****/
fprintf (Gbl.F.Out,"- "
""
" %s"
"
",
Gbl.Prefs.IconsURL,Txt_Chat_rooms);
/***** Link to chat available for all the users *****/
IsLastItemInLevel[1] = (Gbl.Usrs.Me.LoggedRole != Rol_ROLE_STUDENT &&
Gbl.Usrs.Me.LoggedRole != Rol_ROLE_TEACHER &&
!Gbl.Usrs.Me.MyDegrees.Num);
sprintf (ThisRoomFullName,"%s (%s)",Txt_General,Txt_SEX_PLURAL_abc[Usr_SEX_ALL]);
Cht_WriteLinkToChat1 ("GBL_USR",Txt_SEX_PLURAL_Abc[Usr_SEX_ALL],ThisRoomFullName,1,IsLastItemInLevel);
fprintf (Gbl.F.Out,"",
Gbl.Prefs.IconsURL);
Cht_WriteLinkToChat2 ("GBL_USR",ThisRoomFullName);
IsLastItemInLevel[1] = !Gbl.Usrs.Me.MyDegrees.Num;
switch (Gbl.Usrs.Me.LoggedRole)
{
case Rol_ROLE_STUDENT:
sprintf (ThisRoomFullName,"%s (%s)",Txt_General,Txt_ROLES_PLURAL_abc[Rol_ROLE_STUDENT][Usr_SEX_ALL]);
Cht_WriteLinkToChat1 ("GBL_STD",Txt_Students_ABBREVIATION,ThisRoomFullName,1,IsLastItemInLevel);
fprintf (Gbl.F.Out,"",
Gbl.Prefs.IconsURL);
Cht_WriteLinkToChat2 ("GBL_STD",ThisRoomFullName);
break;
case Rol_ROLE_TEACHER:
sprintf (ThisRoomFullName,"%s (%s)",Txt_General,Txt_ROLES_PLURAL_abc[Rol_ROLE_TEACHER][Usr_SEX_ALL]);
Cht_WriteLinkToChat1 ("GBL_TCH",Txt_Teachers_ABBREVIATION,ThisRoomFullName,1,IsLastItemInLevel);
fprintf (Gbl.F.Out,"",
Gbl.Prefs.IconsURL);
Cht_WriteLinkToChat2 ("GBL_TCH",ThisRoomFullName);
break;
default:
break;
}
/***** Link to chat of users from my degrees *****/
for (NumMyDeg = 0;
NumMyDeg < Gbl.Usrs.Me.MyDegrees.Num;
NumMyDeg++)
{
/* Get data of this degree */
Deg.DegCod = Gbl.Usrs.Me.MyDegrees.Degs[NumMyDeg].DegCod;
if (!Deg_GetDataOfDegreeByCod (&Deg))
Lay_ShowErrorAndExit ("Degree not found.");
/* Link to the room of this degree */
IsLastItemInLevel[1] = (NumMyDeg == Gbl.Usrs.Me.MyDegrees.Num - 1);
sprintf (ThisRoomCode,"DEG_%ld",Deg.DegCod);
sprintf (ThisRoomShortName,"%s",Deg.ShortName);
sprintf (ThisRoomFullName,"%s %s",Txt_Degree,Deg.ShortName);
Cht_WriteLinkToChat1 (ThisRoomCode,ThisRoomShortName,ThisRoomFullName,1,IsLastItemInLevel);
Log_DrawLogo (Sco_SCOPE_DEGREE,Deg.DegCod,Deg.ShortName,16,NULL,true);
Cht_WriteLinkToChat2 (ThisRoomCode,ThisRoomFullName);
/* Get my courses in this degree from database */
if ((NumRows = Usr_GetCrssFromUsr (Gbl.Usrs.Me.UsrDat.UsrCod,Deg.DegCod,&mysql_res)) > 0) // Courses found in this degree
for (NumRow = 0;
NumRow < NumRows;
NumRow++)
{
/* Get next course */
row = mysql_fetch_row (mysql_res);
/* Get course code */
if ((Crs.CrsCod = Str_ConvertStrCodToLongCod (row[0])) > 0)
{
/* Get data of this course */
Crs_GetDataOfCourseByCod (&Crs);
/* Link to the room of this course */
IsLastItemInLevel[2] = (NumRow == NumRows - 1);
sprintf (ThisRoomCode,"CRS_%ld",Crs.CrsCod);
sprintf (ThisRoomShortName,"%s",Crs.ShortName);
sprintf (ThisRoomFullName,"%s %s",Txt_Course,Crs.ShortName);
Cht_WriteLinkToChat1 (ThisRoomCode,ThisRoomShortName,ThisRoomFullName,2,IsLastItemInLevel);
fprintf (Gbl.F.Out,"",
Gbl.Prefs.IconsURL);
Cht_WriteLinkToChat2 (ThisRoomCode,ThisRoomFullName);
}
}
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
}
/***** End table *****/
fprintf (Gbl.F.Out," "
" "
" | "
"
");
Lay_EndRoundFrameTable10 ();
}
/*****************************************************************************/
/********************** Show list of chat rooms with users *******************/
/*****************************************************************************/
void Cht_ShowListOfChatRoomsWithUsrs (void)
{
extern const char *Txt_Rooms_with_users;
extern const char *Txt_CHAT_Room_code;
extern const char *Txt_No_of_users;
char Query[512];
MYSQL_RES *mysql_res;
MYSQL_ROW row;
unsigned long NumRow,NumRows;
/***** Get chat rooms with connected users from database *****/
sprintf (Query,"SELECT RoomCode,NumUsrs FROM chat"
" WHERE NumUsrs>'0' ORDER BY NumUsrs DESC,RoomCode");
NumRows = DB_QuerySELECT (Query,&mysql_res,"can not get chat rooms with connected users");
if (NumRows > 0) // If not empty chat rooms found
{
/***** Table start *****/
Lay_WriteTitle (Txt_Rooms_with_users);
Lay_StartRoundFrameTable10 (NULL,0,NULL);
fprintf (Gbl.F.Out,"