diff --git a/swad_attendance.c b/swad_attendance.c
index 9341e27e..5745216c 100644
--- a/swad_attendance.c
+++ b/swad_attendance.c
@@ -3589,13 +3589,12 @@ static void Att_ListAttEventsForAStd (unsigned NumUsr,struct UsrData *UsrDat)
Gbl.AttEvents.Lst[NumAttEvent].CommentTchVisible);
/***** Write a row for this event *****/
- fprintf (Gbl.F.Out,"
");
+ Tbl_PutEmptyCells (1);
+ fprintf (Gbl.F.Out,""
"%u:"
" | "
"",
- Gbl.RowEvenOdd,
Present ? "DAT_GREEN" :
"DAT_RED",
Gbl.RowEvenOdd,
@@ -3622,15 +3621,12 @@ static void Att_ListAttEventsForAStd (unsigned NumUsr,struct UsrData *UsrDat)
/***** Write comments for this student *****/
if (ShowCommentStd || ShowCommentTch)
{
- fprintf (Gbl.F.Out," |
");
+ Tbl_PutEmptyCells (2);
+ fprintf (Gbl.F.Out," | "
""
"",
Gbl.RowEvenOdd,
- Gbl.RowEvenOdd,
- Gbl.RowEvenOdd,
Gbl.RowEvenOdd);
if (ShowCommentStd)
{
diff --git a/swad_changelog.h b/swad_changelog.h
index a8b8ef5d..e7a6e47d 100644
--- a/swad_changelog.h
+++ b/swad_changelog.h
@@ -468,10 +468,11 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - *
En OpenSWAD:
ps2pdf source.ps destination.pdf
*/
-#define Log_PLATFORM_VERSION "SWAD 19.9.2 (2019-09-23)"
+#define Log_PLATFORM_VERSION "SWAD 19.9.3 (2019-09-23)"
#define CSS_FILE "swad19.3.css"
#define JS_FILE "swad18.130.2.js"
/*
+ Version 19.9.3: Sep 23, 2019 Code refactoring in tables. (245597 lines)
Version 19.9.2: Sep 23, 2019 View matches results. Not finished. (245598 lines)
2 changes necessary in database:
DROP TABLE IF EXISTS mch_results;
diff --git a/swad_mark.c b/swad_mark.c
index e5765f44..9e00dd37 100644
--- a/swad_mark.c
+++ b/swad_mark.c
@@ -113,10 +113,7 @@ void Mrk_GetAndWriteNumRowsHeaderAndFooter (void)
struct MarksProperties Marks;
if (Gbl.FileBrowser.FilFolLnk.Type == Brw_IS_FOLDER)
- fprintf (Gbl.F.Out," | "
- " | ",
- Gbl.RowEvenOdd,
- Gbl.RowEvenOdd);
+ Tbl_PutEmptyCells (2);
else // File or link
{
/***** Get number of rows in header or footer *****/
diff --git a/swad_match.c b/swad_match.c
index 20661f6c..d282ec85 100644
--- a/swad_match.c
+++ b/swad_match.c
@@ -47,6 +47,7 @@
#include "swad_setting.h"
#include "swad_table.h"
#include "swad_test.h"
+#include "swad_user.h"
/*****************************************************************************/
/************** External global variables from others modules ****************/
@@ -199,7 +200,7 @@ static unsigned Mch_GetNumUsrsWhoHaveAnswerMch (long MchCod);
static void Mch_DrawBarNumUsrs (unsigned NumAnswerersAns,unsigned NumAnswerersQst,bool Correct);
static void Mch_ShowHeaderMchResults (void);
-static void Mch_ShowMchResults (struct UsrData *UsrDat);
+static void Mch_ShowMchResults (Usr_MeOrOther_t MeOrOther);
static void Mch_GetMatchResultDataByMchCod (long MchCod,long UsrCod,
time_t TimeUTC[Dat_NUM_START_END_TIME],
unsigned *NumQsts,
@@ -2662,9 +2663,8 @@ void Mch_ShowMyMchResults (void)
/***** Header of the table with the list of users *****/
Mch_ShowHeaderMchResults ();
- /***** List my test results *****/
- // Tst_GetConfigTstFromDB (); // To get feedback type // TODO: Change to matches results
- Mch_ShowMchResults (&Gbl.Usrs.Me.UsrDat);
+ /***** List my matches results *****/
+ Mch_ShowMchResults (Usr_ME);
/***** End table and box *****/
Box_EndBoxTable ();
@@ -2809,7 +2809,7 @@ void Mch_ShowUsrsMchResults (void)
if (Usr_ChkUsrCodAndGetAllUsrDataFromUsrCod (&Gbl.Usrs.Other.UsrDat,Usr_DONT_GET_PREFS)) // Get of the database the data of the user
if (Usr_CheckIfICanViewMch (&Gbl.Usrs.Other.UsrDat))
/***** Show matches results *****/
- Mch_ShowMchResults (&Gbl.Usrs.Other.UsrDat);
+ Mch_ShowMchResults (Usr_OTHER);
}
/***** End table and box *****/
@@ -2883,12 +2883,13 @@ static void Mch_ShowHeaderMchResults (void)
/*********** Show the test results of a user in the current course ***********/
/*****************************************************************************/
-static void Mch_ShowMchResults (struct UsrData *UsrDat)
+static void Mch_ShowMchResults (Usr_MeOrOther_t MeOrOther)
{
extern const char *Txt_Today;
extern const char *Txt_View_test;
MYSQL_RES *mysql_res;
MYSQL_ROW row;
+ struct UsrData *UsrDat;
unsigned NumResults;
unsigned NumResult;
static unsigned UniqueId = 0;
@@ -2903,6 +2904,10 @@ static void Mch_ShowMchResults (struct UsrData *UsrDat)
time_t TimeUTC[Dat_NUM_START_END_TIME];
char *ClassDat;
+ /***** Set user *****/
+ UsrDat = (MeOrOther == Usr_ME) ? &Gbl.Usrs.Me.UsrDat :
+ &Gbl.Usrs.Other.UsrDat;
+
/***** Make database query *****/
NumResults =
(unsigned) DB_QuerySELECT (&mysql_res,"can not get matches results of a user",
@@ -3012,9 +3017,18 @@ static void Mch_ShowMchResults (struct UsrData *UsrDat)
/* Link to show this result */
fprintf (Gbl.F.Out,"",
Gbl.RowEvenOdd);
- Frm_StartForm (Gbl.Action.Act == ActSeeMyMchRes ? ActSeeOneMchResMe :
- ActSeeOneMchResOth);
- // Tst_PutParamTstCod (TstCod); // TODO: Change to matches results
+ switch (MeOrOther)
+ {
+ case Usr_ME:
+ Frm_StartForm (ActSeeOneMchResMe);
+ Mch_PutParamMchCod (MchCod);
+ break;
+ case Usr_OTHER:
+ Frm_StartForm (ActSeeOneMchResOth);
+ Mch_PutParamMchCod (MchCod);
+ Usr_PutParamOtherUsrCodEncrypted ();
+ break;
+ }
Ico_PutIconLink ("tasks.svg",Txt_View_test);
Frm_EndForm ();
fprintf (Gbl.F.Out," | "
@@ -3027,21 +3041,10 @@ static void Mch_ShowMchResults (struct UsrData *UsrDat)
// TotalScoreOfAllTests); // TODO: Change to matches results
}
else
- fprintf (Gbl.F.Out," | "
- " | "
- " | "
- " | "
- " | "
- " | "
- " | "
- " |
",
- Gbl.RowEvenOdd,
- Gbl.RowEvenOdd,
- Gbl.RowEvenOdd,
- Gbl.RowEvenOdd,
- Gbl.RowEvenOdd,
- Gbl.RowEvenOdd,
- Gbl.RowEvenOdd);
+ {
+ Tbl_PutEmptyCells (8);
+ fprintf (Gbl.F.Out,"");
+ }
/***** Free structure that stores the query result *****/
DB_FreeMySQLResult (&mysql_res);
diff --git a/swad_table.c b/swad_table.c
index 6368e5c3..5d4ff2b1 100644
--- a/swad_table.c
+++ b/swad_table.c
@@ -92,3 +92,14 @@ void Tbl_EndTable (void)
{
fprintf (Gbl.F.Out,"");
}
+
+void Tbl_PutEmptyCells (unsigned NumColumns)
+ {
+ unsigned NumCol;
+
+ for (NumCol = 0;
+ NumCol < NumColumns;
+ NumCol++)
+ fprintf (Gbl.F.Out,"