mirror of https://github.com/acanas/swad-core.git
Version18.136.2
This commit is contained in:
parent
cfe0560b60
commit
c9f3337c67
|
@ -2568,41 +2568,41 @@ a:hover img.CENTRE_PHOTO_SHOW
|
||||||
{
|
{
|
||||||
box-sizing:border-box;
|
box-sizing:border-box;
|
||||||
display:table;
|
display:table;
|
||||||
margin:5%;
|
margin:4%;
|
||||||
width:90%;
|
width:92%;
|
||||||
}
|
}
|
||||||
.MATCH_TOP
|
.MATCH_TOP
|
||||||
{
|
{
|
||||||
box-sizing:border-box;
|
box-sizing:border-box;
|
||||||
display:table;
|
display:table;
|
||||||
width:100%;
|
width:100%;
|
||||||
padding-bottom:12pt;
|
|
||||||
font-size:18pt;
|
font-size:18pt;
|
||||||
border:1px solid pink;
|
padding-bottom:18pt;
|
||||||
|
/* border:1px solid pink; */
|
||||||
}
|
}
|
||||||
.MATCH_TOP_LEFT
|
.MATCH_TOP_LEFT
|
||||||
{
|
{
|
||||||
box-sizing:border-box;
|
box-sizing:border-box;
|
||||||
float:left;
|
float:left;
|
||||||
width:80%;
|
width:60%;
|
||||||
white-space:nowrap;
|
white-space:nowrap;
|
||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
text-overflow:ellipsis;
|
text-overflow:ellipsis;
|
||||||
border:1px solid red;
|
/* border:1px solid red; */
|
||||||
}
|
}
|
||||||
.MATCH_TOP_RIGHT
|
.MATCH_TOP_RIGHT
|
||||||
{
|
{
|
||||||
box-sizing:border-box;
|
box-sizing:border-box;
|
||||||
float:left;
|
float:left;
|
||||||
width:20%;
|
width:40%;
|
||||||
text-align:right;
|
text-align:right;
|
||||||
border:1px solid blue;
|
/* border:1px solid blue; */
|
||||||
}
|
}
|
||||||
.MATCH_BOTTOM
|
.MATCH_BOTTOM
|
||||||
{
|
{
|
||||||
box-sizing:border-box;
|
box-sizing:border-box;
|
||||||
width:100%;
|
width:100%;
|
||||||
border:1px solid pink;
|
/* border:1px solid pink; */
|
||||||
}
|
}
|
||||||
.MATCH_BOTTOM_LEFT
|
.MATCH_BOTTOM_LEFT
|
||||||
{
|
{
|
||||||
|
@ -2612,14 +2612,14 @@ a:hover img.CENTRE_PHOTO_SHOW
|
||||||
white-space:nowrap;
|
white-space:nowrap;
|
||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
text-overflow:ellipsis;
|
text-overflow:ellipsis;
|
||||||
border:1px solid red;
|
/* border:1px solid red; */
|
||||||
}
|
}
|
||||||
.MATCH_BOTTOM_RIGHT
|
.MATCH_BOTTOM_RIGHT
|
||||||
{
|
{
|
||||||
box-sizing:border-box;
|
box-sizing:border-box;
|
||||||
float:left;
|
float:left;
|
||||||
width:80%;
|
width:80%;
|
||||||
border:1px solid blue;
|
/* border:1px solid blue; */
|
||||||
}
|
}
|
||||||
|
|
||||||
.MATCH_TCH_NUM_QST
|
.MATCH_TCH_NUM_QST
|
||||||
|
@ -2627,7 +2627,7 @@ a:hover img.CENTRE_PHOTO_SHOW
|
||||||
text-align:center;
|
text-align:center;
|
||||||
padding-bottom:24pt;
|
padding-bottom:24pt;
|
||||||
color:#808080;
|
color:#808080;
|
||||||
font-size:48pt;
|
font-size:36pt;
|
||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
}
|
}
|
||||||
.MATCH_TCH_NXT_CONTAINER
|
.MATCH_TCH_NXT_CONTAINER
|
||||||
|
@ -2670,7 +2670,7 @@ a:hover img.CENTRE_PHOTO_SHOW
|
||||||
float:left;
|
float:left;
|
||||||
padding-bottom:24pt;
|
padding-bottom:24pt;
|
||||||
color:#808080;
|
color:#808080;
|
||||||
font-size:48pt;
|
font-size:36pt;
|
||||||
font-weight:bold;
|
font-weight:bold;
|
||||||
}
|
}
|
||||||
.MATCH_STD_QST_CONTAINER
|
.MATCH_STD_QST_CONTAINER
|
||||||
|
|
|
@ -149,7 +149,7 @@ void Btn_PutRemoveButtonInline (const char *TxtButton)
|
||||||
"</button>",
|
"</button>",
|
||||||
TxtButton);
|
TxtButton);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
void Btn_PutCloseTabButton (const char *TxtButton)
|
void Btn_PutCloseTabButton (const char *TxtButton)
|
||||||
{
|
{
|
||||||
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">"
|
fprintf (Gbl.F.Out,"<div class=\"CENTER_MIDDLE\">"
|
||||||
|
@ -160,3 +160,4 @@ void Btn_PutCloseTabButton (const char *TxtButton)
|
||||||
"</div>",
|
"</div>",
|
||||||
TxtButton);
|
TxtButton);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
|
@ -55,6 +55,6 @@ void Btn_PutConfirmButton (const char *TxtButton);
|
||||||
void Btn_PutConfirmButtonInline (const char *TxtButton);
|
void Btn_PutConfirmButtonInline (const char *TxtButton);
|
||||||
void Btn_PutRemoveButton (const char *TxtButton);
|
void Btn_PutRemoveButton (const char *TxtButton);
|
||||||
void Btn_PutRemoveButtonInline (const char *TxtButton);
|
void Btn_PutRemoveButtonInline (const char *TxtButton);
|
||||||
void Btn_PutCloseTabButton (const char *TxtButton);
|
// void Btn_PutCloseTabButton (const char *TxtButton);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -458,10 +458,11 @@ En OpenSWAD:
|
||||||
ps2pdf source.ps destination.pdf
|
ps2pdf source.ps destination.pdf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define Log_PLATFORM_VERSION "SWAD 18.136.1 (2019-07-18)"
|
#define Log_PLATFORM_VERSION "SWAD 18.136.2 (2019-07-18)"
|
||||||
#define CSS_FILE "swad18.136.css"
|
#define CSS_FILE "swad18.136.css"
|
||||||
#define JS_FILE "swad18.130.2.js"
|
#define JS_FILE "swad18.130.2.js"
|
||||||
/*
|
/*
|
||||||
|
Version 18.136.2: Jul 18, 2019 Changes in layout of match. (243895 lines)
|
||||||
Version 18.136.1: Jul 18, 2019 Changes in layout of match. (243853 lines)
|
Version 18.136.1: Jul 18, 2019 Changes in layout of match. (243853 lines)
|
||||||
Version 18.136: Jul 18, 2019 Changes in layout of match. (243767 lines)
|
Version 18.136: Jul 18, 2019 Changes in layout of match. (243767 lines)
|
||||||
Version 18.135.7: Jul 17, 2019 CSS refactoring and translation in match playing. (243699 lines)
|
Version 18.135.7: Jul 17, 2019 CSS refactoring and translation in match playing. (243699 lines)
|
||||||
|
|
368
swad_game.c
368
swad_game.c
|
@ -187,9 +187,12 @@ static void Gam_UpdateMatchStatusInDB (struct Match *Match);
|
||||||
|
|
||||||
static void Gam_SetMatchStatusToNextQuestion (struct Match *Match);
|
static void Gam_SetMatchStatusToNextQuestion (struct Match *Match);
|
||||||
static void Gam_ShowMatchStatusForTch (struct Match *Match);
|
static void Gam_ShowMatchStatusForTch (struct Match *Match);
|
||||||
static void Gam_ShowAlertFinishedMatch (void);
|
static void Gam_ShowMatchStatusForStd (struct Match *Match);
|
||||||
static void Gam_ShowBottonLeftColumnTch (struct Match *Match);
|
static void Gam_ShowBottonLeftColumnTch (struct Match *Match);
|
||||||
|
static void Gam_ShowBottonLeftColumnStd (struct Match *Match);
|
||||||
static void Gam_ShowQuestionAndAnswersTch (struct Match *Match);
|
static void Gam_ShowQuestionAndAnswersTch (struct Match *Match);
|
||||||
|
static void Gam_ShowQuestionAndAnswersStd (struct Match *Match);
|
||||||
|
|
||||||
static void Gam_PutBigButton (Act_Action_t NextAction,long MchCod,
|
static void Gam_PutBigButton (Act_Action_t NextAction,long MchCod,
|
||||||
const char *Icon,const char *Txt);
|
const char *Icon,const char *Txt);
|
||||||
static void Gam_PutBigButtonClose (void);
|
static void Gam_PutBigButtonClose (void);
|
||||||
|
@ -2781,7 +2784,7 @@ static void Gam_ListOneOrMoreMatches (struct Game *Game,
|
||||||
extern const char *Txt_Match;
|
extern const char *Txt_Match;
|
||||||
extern const char *Txt_Status;
|
extern const char *Txt_Status;
|
||||||
extern const char *Txt_Play;
|
extern const char *Txt_Play;
|
||||||
extern const char *Txt_Resume_match;
|
extern const char *Txt_Resume;
|
||||||
extern const char *Txt_Today;
|
extern const char *Txt_Today;
|
||||||
extern const char *Txt_View_game_results;
|
extern const char *Txt_View_game_results;
|
||||||
unsigned NumMatch;
|
unsigned NumMatch;
|
||||||
|
@ -2929,7 +2932,7 @@ static void Gam_ListOneOrMoreMatches (struct Game *Game,
|
||||||
Lay_PutContextualLinkOnlyIcon (ActResMchTch,NULL,
|
Lay_PutContextualLinkOnlyIcon (ActResMchTch,NULL,
|
||||||
Gam_PutParamCurrentMchCod,
|
Gam_PutParamCurrentMchCod,
|
||||||
"play.svg",
|
"play.svg",
|
||||||
Txt_Resume_match);
|
Txt_Resume);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -3496,19 +3499,51 @@ static void Gam_ShowMatchStatusForTch (struct Match *Match)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/********************* Show alert about finished match ***********************/
|
/************ Show current question being played for a student ***************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static void Gam_ShowAlertFinishedMatch (void)
|
static void Gam_ShowMatchStatusForStd (struct Match *Match)
|
||||||
{
|
{
|
||||||
extern const char *Txt_Finished_match;
|
extern const char *Txt_Please_wait_;
|
||||||
extern const char *Txt_Close;
|
bool IBelongToGroups;
|
||||||
|
|
||||||
/***** Show alert *****/
|
/***** Do I belong to valid groups to play this match? *****/
|
||||||
Ale_ShowAlert (Ale_INFO,Txt_Finished_match);
|
IBelongToGroups = Gbl.Usrs.Me.IBelongToCurrentCrs &&
|
||||||
|
Gam_CheckIfIPlayThisMatchBasedOnGrps (Match->MchCod);
|
||||||
|
if (!IBelongToGroups)
|
||||||
|
Lay_ShowErrorAndExit ("You can not play this match!");
|
||||||
|
|
||||||
/***** Button to close browser tab *****/
|
/***** Bottom row *****/
|
||||||
Btn_PutCloseTabButton (Txt_Close);
|
/* Start bottom container */
|
||||||
|
fprintf (Gbl.F.Out,"<div class=\"MATCH_BOTTOM\">");
|
||||||
|
|
||||||
|
/* Show left column */
|
||||||
|
Gam_ShowBottonLeftColumnStd (Match);
|
||||||
|
|
||||||
|
/* Show right column */
|
||||||
|
fprintf (Gbl.F.Out,"<div class=\"MATCH_BOTTOM_RIGHT\">");
|
||||||
|
if (!Match->Status.Finished)
|
||||||
|
{
|
||||||
|
/***** Update players ******/
|
||||||
|
Gam_RegisterMeAsPlayerInMatch (Match->MchCod);
|
||||||
|
|
||||||
|
if (Match->Status.BeingPlayed)
|
||||||
|
/* Show current question and possible answers */
|
||||||
|
Gam_ShowQuestionAndAnswersStd (Match);
|
||||||
|
else // Not being played
|
||||||
|
fprintf (Gbl.F.Out,"<div class=\"MATCH_STD_WAIT_CONTAINER\">"
|
||||||
|
"<img src=\"%s/wait.gif\""
|
||||||
|
" alt=\"%s\" title=\"%s\""
|
||||||
|
" class=\"MATCH_STD_WAIT_IMAGE\" />"
|
||||||
|
"</div>",
|
||||||
|
Cfg_URL_ICON_PUBLIC,
|
||||||
|
Txt_Please_wait_,
|
||||||
|
Txt_Please_wait_);
|
||||||
|
}
|
||||||
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
|
|
||||||
|
/* End bottom container */
|
||||||
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -3521,8 +3556,8 @@ static void Gam_ShowBottonLeftColumnTch (struct Match *Match)
|
||||||
extern const char *Txt_Next_QUESTION;
|
extern const char *Txt_Next_QUESTION;
|
||||||
extern const char *Txt_Finish;
|
extern const char *Txt_Finish;
|
||||||
extern const char *Txt_Answers;
|
extern const char *Txt_Answers;
|
||||||
extern const char *Txt_Start_match;
|
extern const char *Txt_Start;
|
||||||
extern const char *Txt_Resume_match;
|
extern const char *Txt_Resume;
|
||||||
unsigned NxtQstInd;
|
unsigned NxtQstInd;
|
||||||
unsigned NumQsts;
|
unsigned NumQsts;
|
||||||
|
|
||||||
|
@ -3571,8 +3606,42 @@ static void Gam_ShowBottonLeftColumnTch (struct Match *Match)
|
||||||
Gam_PutBigButton (ActCurMchTch,
|
Gam_PutBigButton (ActCurMchTch,
|
||||||
Match->MchCod,
|
Match->MchCod,
|
||||||
"play.svg",
|
"play.svg",
|
||||||
Match->Status.QstInd == 0 ? Txt_Start_match :
|
Match->Status.QstInd == 0 ? Txt_Start :
|
||||||
Txt_Resume_match);
|
Txt_Resume);
|
||||||
|
fprintf (Gbl.F.Out,"</div>"
|
||||||
|
"</div>");
|
||||||
|
|
||||||
|
/***** End bottom left container *****/
|
||||||
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/******** Show left botton column when playing a match (as a student) ********/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void Gam_ShowBottonLeftColumnStd (struct Match *Match)
|
||||||
|
{
|
||||||
|
extern const char *Txt_End;
|
||||||
|
unsigned NumQsts;
|
||||||
|
|
||||||
|
/***** Start bottom left container *****/
|
||||||
|
fprintf (Gbl.F.Out,"<div class=\"MATCH_BOTTOM_LEFT\">");
|
||||||
|
|
||||||
|
/***** Write number of question *****/
|
||||||
|
NumQsts = Gam_GetNumQstsGame (Match->GamCod);
|
||||||
|
fprintf (Gbl.F.Out,"<div class=\"MATCH_TCH_NUM_QST\">");
|
||||||
|
if (Match->Status.Finished)
|
||||||
|
fprintf (Gbl.F.Out,"%s",Txt_End);
|
||||||
|
else
|
||||||
|
fprintf (Gbl.F.Out,"%u/%u",Match->Status.QstInd,NumQsts);
|
||||||
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
|
|
||||||
|
/***** Button *****/
|
||||||
|
fprintf (Gbl.F.Out,"<div class=\"MATCH_TCH_NXT_CONTAINER\">"
|
||||||
|
"<div class=\"MATCH_TCH_CONTINUE_CONTAINER\">");
|
||||||
|
if (Match->Status.Finished)
|
||||||
|
/* Put button to close browser tab */
|
||||||
|
Gam_PutBigButtonClose ();
|
||||||
fprintf (Gbl.F.Out,"</div>"
|
fprintf (Gbl.F.Out,"</div>"
|
||||||
"</div>");
|
"</div>");
|
||||||
|
|
||||||
|
@ -3630,6 +3699,118 @@ static void Gam_ShowQuestionAndAnswersTch (struct Match *Match)
|
||||||
"MATCH_TCH_QST",false); // Don't show result
|
"MATCH_TCH_QST",false); // Don't show result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/***** Show question and its answers when playing a match (as a student) *****/
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void Gam_ShowQuestionAndAnswersStd (struct Match *Match)
|
||||||
|
{
|
||||||
|
bool Shuffle = false; // TODO: Read shuffle from question
|
||||||
|
MYSQL_RES *mysql_res;
|
||||||
|
MYSQL_ROW row;
|
||||||
|
int StdAnsInd;
|
||||||
|
unsigned NumOptions;
|
||||||
|
unsigned NumOpt;
|
||||||
|
unsigned Index;
|
||||||
|
bool ErrorInIndex = false;
|
||||||
|
|
||||||
|
/***** Show question *****/
|
||||||
|
fprintf (Gbl.F.Out,"<div class=\"MATCH_STD_QST_CONTAINER\">");
|
||||||
|
|
||||||
|
/* Write buttons for answers? */
|
||||||
|
if (Match->Status.ShowingAnswers)
|
||||||
|
{
|
||||||
|
if (Tst_CheckIfQuestionIsValidForGame (Match->Status.QstCod))
|
||||||
|
{
|
||||||
|
/***** Get student's answer to this question
|
||||||
|
(<0 ==> no answer) *****/
|
||||||
|
StdAnsInd = Gam_GetQstAnsFromDB (Match->MchCod,
|
||||||
|
Match->Status.QstInd);
|
||||||
|
|
||||||
|
/***** Get number of options in this question *****/
|
||||||
|
NumOptions = Tst_GetNumAnswersQst (Match->Status.QstCod);
|
||||||
|
|
||||||
|
/***** Get answers of question from database *****/
|
||||||
|
Shuffle = false;
|
||||||
|
NumOptions = Tst_GetAnswersQst (Match->Status.QstCod,&mysql_res,Shuffle);
|
||||||
|
/*
|
||||||
|
row[0] AnsInd
|
||||||
|
row[1] Answer
|
||||||
|
row[2] Feedback
|
||||||
|
row[3] MedCod
|
||||||
|
row[4] Correct
|
||||||
|
*/
|
||||||
|
|
||||||
|
/***** Start table *****/
|
||||||
|
Tbl_StartTableWide (8);
|
||||||
|
|
||||||
|
for (NumOpt = 0;
|
||||||
|
NumOpt < NumOptions;
|
||||||
|
NumOpt++)
|
||||||
|
{
|
||||||
|
/***** Get next answer *****/
|
||||||
|
row = mysql_fetch_row (mysql_res);
|
||||||
|
|
||||||
|
/***** Assign index (row[0]).
|
||||||
|
Index is 0,1,2,3... if no shuffle
|
||||||
|
or 1,3,0,2... (example) if shuffle *****/
|
||||||
|
if (sscanf (row[0],"%u",&Index) == 1)
|
||||||
|
{
|
||||||
|
if (Index >= Tst_MAX_OPTIONS_PER_QUESTION)
|
||||||
|
ErrorInIndex = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ErrorInIndex = true;
|
||||||
|
if (ErrorInIndex)
|
||||||
|
Lay_ShowErrorAndExit ("Wrong index of answer when showing a test.");
|
||||||
|
|
||||||
|
/***** Start row *****/
|
||||||
|
// if (NumOpt % 2 == 0)
|
||||||
|
fprintf (Gbl.F.Out,"<tr>");
|
||||||
|
|
||||||
|
/***** Write letter for this option *****/
|
||||||
|
/* Start table cell */
|
||||||
|
fprintf (Gbl.F.Out,"<td class=\"MATCH_STD_CELL\">");
|
||||||
|
|
||||||
|
/* Form with button.
|
||||||
|
Sumitting onmousedown instead of default onclick
|
||||||
|
is necessary in order to be fast
|
||||||
|
and not lose clicks due to refresh */
|
||||||
|
Frm_StartForm (ActAnsMchQstStd);
|
||||||
|
Gam_PutParamMatchCod (Match->MchCod); // Current match being played
|
||||||
|
Gam_PutParamQstInd (Match->Status.QstInd); // Current question index shown
|
||||||
|
Gam_PutParamAnswer (Index); // Index for this option
|
||||||
|
fprintf (Gbl.F.Out,"<button type=\"submit\""
|
||||||
|
" onmousedown=\"document.getElementById('%s').submit();"
|
||||||
|
"return false;\" class=\"",
|
||||||
|
Gbl.Form.Id);
|
||||||
|
if (StdAnsInd == (int) NumOpt) // Student's answer
|
||||||
|
fprintf (Gbl.F.Out,"MATCH_STD_ANSWER_SELECTED ");
|
||||||
|
fprintf (Gbl.F.Out,"MATCH_STD_BUTTON BT_%c\">"
|
||||||
|
"%c"
|
||||||
|
"</button>",
|
||||||
|
'A' + (char) NumOpt,
|
||||||
|
'a' + (char) NumOpt);
|
||||||
|
Frm_EndForm ();
|
||||||
|
|
||||||
|
/* End table cell */
|
||||||
|
fprintf (Gbl.F.Out,"</td>");
|
||||||
|
|
||||||
|
/***** End row *****/
|
||||||
|
// if (NumOpt % 2 == 1)
|
||||||
|
fprintf (Gbl.F.Out,"</tr>");
|
||||||
|
}
|
||||||
|
|
||||||
|
/***** End table *****/
|
||||||
|
Tbl_EndTable ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Ale_ShowAlert (Ale_ERROR,"Type of answer not valid in a game.");
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf (Gbl.F.Out,"</div>");
|
||||||
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/*********************** Put a big button to do action ***********************/
|
/*********************** Put a big button to do action ***********************/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -3797,6 +3978,10 @@ void Gam_ShowMatchToMeAsStd (void)
|
||||||
{
|
{
|
||||||
struct Match Match;
|
struct Match Match;
|
||||||
|
|
||||||
|
/***** Remove old players.
|
||||||
|
This function must be called before getting match status. *****/
|
||||||
|
Gam_RemoveOldPlayers ();
|
||||||
|
|
||||||
/***** Get data of the match from database *****/
|
/***** Get data of the match from database *****/
|
||||||
Match.MchCod = Gbl.Games.MchCodBeingPlayed;
|
Match.MchCod = Gbl.Games.MchCodBeingPlayed;
|
||||||
Gam_GetDataOfMatchByCod (&Match);
|
Gam_GetDataOfMatchByCod (&Match);
|
||||||
|
@ -3845,6 +4030,10 @@ void Gam_RefreshMatchStd (void)
|
||||||
if (!Gbl.Session.IsOpen) // If session has been closed, do not write anything
|
if (!Gbl.Session.IsOpen) // If session has been closed, do not write anything
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/***** Remove old players.
|
||||||
|
This function must be called before getting match status. *****/
|
||||||
|
Gam_RemoveOldPlayers ();
|
||||||
|
|
||||||
/***** Get data of the match from database *****/
|
/***** Get data of the match from database *****/
|
||||||
Match.MchCod = Gbl.Games.MchCodBeingPlayed;
|
Match.MchCod = Gbl.Games.MchCodBeingPlayed;
|
||||||
Gam_GetDataOfMatchByCod (&Match);
|
Gam_GetDataOfMatchByCod (&Match);
|
||||||
|
@ -3853,151 +4042,6 @@ void Gam_RefreshMatchStd (void)
|
||||||
Gam_ShowMatchStatusForStd (&Match);
|
Gam_ShowMatchStatusForStd (&Match);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/************ Show current question being played for a student ***************/
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void Gam_ShowMatchStatusForStd (struct Match *Match)
|
|
||||||
{
|
|
||||||
extern const char *Txt_Please_wait_;
|
|
||||||
bool IBelongToGroups;
|
|
||||||
bool Shuffle = false; // TODO: Read shuffle from question
|
|
||||||
MYSQL_RES *mysql_res;
|
|
||||||
MYSQL_ROW row;
|
|
||||||
int StdAnsInd;
|
|
||||||
unsigned NumOptions;
|
|
||||||
unsigned NumOpt;
|
|
||||||
unsigned Index;
|
|
||||||
bool ErrorInIndex = false;
|
|
||||||
|
|
||||||
/***** Do I belong to valid groups to play this match? *****/
|
|
||||||
IBelongToGroups = Gbl.Usrs.Me.IBelongToCurrentCrs &&
|
|
||||||
Gam_CheckIfIPlayThisMatchBasedOnGrps (Match->MchCod);
|
|
||||||
if (!IBelongToGroups)
|
|
||||||
Lay_ShowErrorAndExit ("You can not play this match!");
|
|
||||||
|
|
||||||
/***** Show current match status *****/
|
|
||||||
if (Match->Status.Finished)
|
|
||||||
Gam_ShowAlertFinishedMatch ();
|
|
||||||
else // Unfinished match
|
|
||||||
{
|
|
||||||
/***** Update players ******/
|
|
||||||
Gam_RegisterMeAsPlayerInMatch (Match->MchCod);
|
|
||||||
|
|
||||||
if (Match->Status.BeingPlayed)
|
|
||||||
{
|
|
||||||
/***** Show question *****/
|
|
||||||
/* Write number of question */
|
|
||||||
fprintf (Gbl.F.Out,"<div class=\"MATCH_STD_NUM_QST\">%u</div>",
|
|
||||||
Match->Status.QstInd);
|
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"<div class=\"MATCH_STD_QST_CONTAINER\">");
|
|
||||||
|
|
||||||
/* Write buttons for answers? */
|
|
||||||
if (Match->Status.ShowingAnswers)
|
|
||||||
{
|
|
||||||
if (Tst_CheckIfQuestionIsValidForGame (Match->Status.QstCod))
|
|
||||||
{
|
|
||||||
/***** Get student's answer to this question
|
|
||||||
(<0 ==> no answer) *****/
|
|
||||||
StdAnsInd = Gam_GetQstAnsFromDB (Match->MchCod,
|
|
||||||
Match->Status.QstInd);
|
|
||||||
|
|
||||||
/***** Get number of options in this question *****/
|
|
||||||
NumOptions = Tst_GetNumAnswersQst (Match->Status.QstCod);
|
|
||||||
|
|
||||||
/***** Get answers of question from database *****/
|
|
||||||
Shuffle = false;
|
|
||||||
NumOptions = Tst_GetAnswersQst (Match->Status.QstCod,&mysql_res,Shuffle);
|
|
||||||
/*
|
|
||||||
row[0] AnsInd
|
|
||||||
row[1] Answer
|
|
||||||
row[2] Feedback
|
|
||||||
row[3] MedCod
|
|
||||||
row[4] Correct
|
|
||||||
*/
|
|
||||||
|
|
||||||
/***** Start table *****/
|
|
||||||
Tbl_StartTableWide (8);
|
|
||||||
|
|
||||||
for (NumOpt = 0;
|
|
||||||
NumOpt < NumOptions;
|
|
||||||
NumOpt++)
|
|
||||||
{
|
|
||||||
/***** Get next answer *****/
|
|
||||||
row = mysql_fetch_row (mysql_res);
|
|
||||||
|
|
||||||
/***** Assign index (row[0]).
|
|
||||||
Index is 0,1,2,3... if no shuffle
|
|
||||||
or 1,3,0,2... (example) if shuffle *****/
|
|
||||||
if (sscanf (row[0],"%u",&Index) == 1)
|
|
||||||
{
|
|
||||||
if (Index >= Tst_MAX_OPTIONS_PER_QUESTION)
|
|
||||||
ErrorInIndex = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ErrorInIndex = true;
|
|
||||||
if (ErrorInIndex)
|
|
||||||
Lay_ShowErrorAndExit ("Wrong index of answer when showing a test.");
|
|
||||||
|
|
||||||
/***** Start row *****/
|
|
||||||
// if (NumOpt % 2 == 0)
|
|
||||||
fprintf (Gbl.F.Out,"<tr>");
|
|
||||||
|
|
||||||
/***** Write letter for this option *****/
|
|
||||||
/* Start table cell */
|
|
||||||
fprintf (Gbl.F.Out,"<td class=\"MATCH_STD_CELL\">");
|
|
||||||
|
|
||||||
/* Form with button.
|
|
||||||
Sumitting onmousedown instead of default onclick
|
|
||||||
is necessary in order to be fast
|
|
||||||
and not lose clicks due to refresh */
|
|
||||||
Frm_StartForm (ActAnsMchQstStd);
|
|
||||||
Gam_PutParamMatchCod (Match->MchCod); // Current match being played
|
|
||||||
Gam_PutParamQstInd (Match->Status.QstInd); // Current question index shown
|
|
||||||
Gam_PutParamAnswer (Index); // Index for this option
|
|
||||||
fprintf (Gbl.F.Out,"<button type=\"submit\""
|
|
||||||
" onmousedown=\"document.getElementById('%s').submit();"
|
|
||||||
"return false;\" class=\"",
|
|
||||||
Gbl.Form.Id);
|
|
||||||
if (StdAnsInd == (int) NumOpt) // Student's answer
|
|
||||||
fprintf (Gbl.F.Out,"MATCH_STD_ANSWER_SELECTED ");
|
|
||||||
fprintf (Gbl.F.Out,"MATCH_STD_BUTTON BT_%c\">"
|
|
||||||
"%c"
|
|
||||||
"</button>",
|
|
||||||
'A' + (char) NumOpt,
|
|
||||||
'a' + (char) NumOpt);
|
|
||||||
Frm_EndForm ();
|
|
||||||
|
|
||||||
/* End table cell */
|
|
||||||
fprintf (Gbl.F.Out,"</td>");
|
|
||||||
|
|
||||||
/***** End row *****/
|
|
||||||
// if (NumOpt % 2 == 1)
|
|
||||||
fprintf (Gbl.F.Out,"</tr>");
|
|
||||||
}
|
|
||||||
|
|
||||||
/***** End table *****/
|
|
||||||
Tbl_EndTable ();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Ale_ShowAlert (Ale_ERROR,"Type of answer not valid in a game.");
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf (Gbl.F.Out,"</div>");
|
|
||||||
}
|
|
||||||
else // Not being played
|
|
||||||
fprintf (Gbl.F.Out,"<div class=\"MATCH_STD_WAIT_CONTAINER\">"
|
|
||||||
"<img src=\"%s/wait.gif\""
|
|
||||||
" alt=\"%s\" title=\"%s\""
|
|
||||||
" class=\"MATCH_STD_WAIT_IMAGE\" />"
|
|
||||||
"</div>",
|
|
||||||
Cfg_URL_ICON_PUBLIC,
|
|
||||||
Txt_Please_wait_,
|
|
||||||
Txt_Please_wait_);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/**** Receive previous question answer in a match question from database *****/
|
/**** Receive previous question answer in a match question from database *****/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -4041,6 +4085,10 @@ void Gam_ReceiveQstAnsFromStd (void)
|
||||||
unsigned StdAnsInd;
|
unsigned StdAnsInd;
|
||||||
int PreviousStdAnsInd;
|
int PreviousStdAnsInd;
|
||||||
|
|
||||||
|
/***** Remove old players.
|
||||||
|
This function must be called before getting match status. *****/
|
||||||
|
Gam_RemoveOldPlayers ();
|
||||||
|
|
||||||
/***** Get data of the match from database *****/
|
/***** Get data of the match from database *****/
|
||||||
Match.MchCod = Gbl.Games.MchCodBeingPlayed;
|
Match.MchCod = Gbl.Games.MchCodBeingPlayed;
|
||||||
Gam_GetDataOfMatchByCod (&Match);
|
Gam_GetDataOfMatchByCod (&Match);
|
||||||
|
|
44
swad_text.c
44
swad_text.c
|
@ -12267,7 +12267,7 @@ const char *Txt_Finish =
|
||||||
#elif L==9 // pt
|
#elif L==9 // pt
|
||||||
"Terminar";
|
"Terminar";
|
||||||
#endif
|
#endif
|
||||||
|
/*
|
||||||
const char *Txt_Finished_match =
|
const char *Txt_Finished_match =
|
||||||
#if L==1 // ca
|
#if L==1 // ca
|
||||||
"Partida finalitzada";
|
"Partida finalitzada";
|
||||||
|
@ -12288,7 +12288,7 @@ const char *Txt_Finished_match =
|
||||||
#elif L==9 // pt
|
#elif L==9 // pt
|
||||||
"Jogo terminado";
|
"Jogo terminado";
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
const char *Txt_First_day_of_the_week =
|
const char *Txt_First_day_of_the_week =
|
||||||
#if L==1 // ca
|
#if L==1 // ca
|
||||||
"Primer dia de la setmana";
|
"Primer dia de la setmana";
|
||||||
|
@ -33193,25 +33193,25 @@ const char *Txt_results_per_page =
|
||||||
"resultados por página";
|
"resultados por página";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *Txt_Resume_match =
|
const char *Txt_Resume =
|
||||||
#if L==1 // ca
|
#if L==1 // ca
|
||||||
"Reprendre partida";
|
"Reprendre";
|
||||||
#elif L==2 // de
|
#elif L==2 // de
|
||||||
"Spiel fortsetzen";
|
"Fortsetzen";
|
||||||
#elif L==3 // en
|
#elif L==3 // en
|
||||||
"Resume match";
|
"Resume";
|
||||||
#elif L==4 // es
|
#elif L==4 // es
|
||||||
"Reanudar partida";
|
"Reanudar";
|
||||||
#elif L==5 // fr
|
#elif L==5 // fr
|
||||||
"Reprendre le match";
|
"Reprendre";
|
||||||
#elif L==6 // gn
|
#elif L==6 // gn
|
||||||
"Reanudar partida"; // Okoteve traducción
|
"Reanudar"; // Okoteve traducción
|
||||||
#elif L==7 // it
|
#elif L==7 // it
|
||||||
"Riprendi la partita";
|
"Riprendi";
|
||||||
#elif L==8 // pl
|
#elif L==8 // pl
|
||||||
"Wznów mecz";
|
"Wznów";
|
||||||
#elif L==9 // pt
|
#elif L==9 // pt
|
||||||
"Retomar o jogo";
|
"Retomar";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *Txt_Retype_new_password =
|
const char *Txt_Retype_new_password =
|
||||||
|
@ -41245,25 +41245,25 @@ const char *Txt_FIGURE_TYPES[Fig_NUM_FIGURES] =
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *Txt_Start_match =
|
const char *Txt_Start =
|
||||||
#if L==1 // ca
|
#if L==1 // ca
|
||||||
"Començar partida";
|
"Començar";
|
||||||
#elif L==2 // de
|
#elif L==2 // de
|
||||||
"Spiel starten";
|
"Starten";
|
||||||
#elif L==3 // en
|
#elif L==3 // en
|
||||||
"Start match";
|
"Start";
|
||||||
#elif L==4 // es
|
#elif L==4 // es
|
||||||
"Comenzar partida";
|
"Comenzar";
|
||||||
#elif L==5 // fr
|
#elif L==5 // fr
|
||||||
"Commencer le match";
|
"Commencer";
|
||||||
#elif L==6 // gn
|
#elif L==6 // gn
|
||||||
"Ñepyrũ ñembosarái";
|
"Ñepyrũ";
|
||||||
#elif L==7 // it
|
#elif L==7 // it
|
||||||
"Inizia la partita";
|
"Inizia";
|
||||||
#elif L==8 // pl
|
#elif L==8 // pl
|
||||||
"Rozpocznij mecz";
|
"Rozpocznij";
|
||||||
#elif L==9 // pt
|
#elif L==9 // pt
|
||||||
"Começar o jogo";
|
"Começar";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *Txt_Statistic =
|
const char *Txt_Statistic =
|
||||||
|
|
Loading…
Reference in New Issue