$hdlTpl->setVariable("footer", $strFooter); //Assigns footer $hdlTpl->setVariable("menu", $strLmenu); //Assigns left menu $hdlTpl->setVariable("uname", ucfirst($_SESSION["UNAME"])); //Assigns user name $arrQuizzesTopic = $hldGlobal->fnFetchCourse(); if (is_array($arrQuizzesTopic) && count($arrQuizzesTopic) > 0) { foreach ($arrQuizzesTopic as $key => $value) { $hdlTpl->setVariable("topic", $value["cname"]); //Assigns topic $hdlTpl->setVariable("qid", $value["id"]); //Assigns id $hdlTpl->setVariable("site_name", SITE_NAME); //Assigns site name $intCheckQuiz = $hldGlobal->fnCheckQuizExist($value["id"], 0, $_SESSION["UID"]); $strTake = ""; if ($intCheckQuiz) { $arrResult = $hldGlobal->fnFetchQuizResult($value["id"], 0, $_SESSION["UID"]); $arrAvg = explode(",", $arrResult[0]["percent"]); $arrDate = explode(",", $arrResult[0]["takendate"]); $intPercent = MAX($arrAvg); $arrKey = array_keys($arrAvg, $intPercent); $strTake .= "<table><tr><td>"; $strTake .= number_format($intPercent) . "%"; $strTake .= "</td></tr><tr><td>"; $strTake .= $arrDate[$arrKey[0]]; $strTake .= "</td></tr></table>"; $hdlTpl->setVariable("quiz_take", "Re-take!"); } else { $hdlTpl->setVariable("quiz_take", "Take now!");