<?php /** * @version fetchquestion.php 2009-08-07 $ * @copyright Copyright (C) icrs.com. All rights reserved. * * @author Amol Divalkar * @Modified By * @version 1.0 * @desc This is main file (fetchquestion) which is used to show the question for the quiz */ //Includes config file include "../includes/config.inc.php"; //Includes global class file include DIR_ADMIN_CLASSES . "/clsGlobal.php"; //Checks if session is set for admin login or not if ($_SESSION["UsErId"] == "" && $_SESSION["UnAmE"] == "") { header("Location:index.php"); } $hldGlobal = new clsGlobal($hdlDb); if ($_SESSION["InTlAsTiD"]) { $intLastId = $_SESSION["InTlAsTiD"]; } else { $intLastId = $_GET["qid"]; } $strTab = $hldGlobal->fnFetchQuestionQuiz($intLastId); echo $strTab;
$hdlTpl->setVariable("leftmenu", $strLeftMenu); //Assigns left menu $intError = 1; //print_r($arrQuizzes); if (is_array($arrQuizzes) && count($arrQuizzes) > 0) { //$arrMname = $hldGlobal->fnFetchModule($arrQuizzes[0]["course_id"]); $arrMname = $hldGlobal->fnFetchCources($arrQuizzes[0]["course_id"]); $mcname = $arrMname[0]["cname"]; $hdlTpl->setVariable("cname", $mcname); //Assigns module cource name $hdlTpl->setVariable("cid", $arrQuizzes[0]["course_id"]); //Assign course id $hdlTpl->setVariable("quiztitle", $arrQuizzes[0]["quiz_title"]); //Assigns quiz title $hdlTpl->setVariable("mid", $arrQuizzes[0]["module_id"]); //Assigns module id $hdlTpl->setVariable("id", $arrQuizzes[0]["id"]); //Assigns id $hdlTpl->setVariable("return", $_GET["return"]); //Assigns return $strTab = $hldGlobal->fnFetchQuestionQuiz($arrQuizzes[0]["id"], 0); $hdlTpl->setVariable("question", $strTab); //Assigns question } if ($intError) { $arrDuplicate = $hldGlobal->fnInsertDuplicate($arrQuizzes[0]["id"]); } unset($_SESSION["InTlAsTiD"]); $hdlTpl->parse("ADMIN_INNER_PAGE"); $hdlTpl->parse("INNER_PAGE"); echo $hdlTpl->get();
if ($_GET["eid"]) { // This will edit the question $intCheck = $hldGlobal->fnCheckQuestionQuiz($_GET["mid"], $_POST["question"], $_GET["qqid"], 1, $_GET["qtid"]); if (!$intCheck) { $hldGlobal->fnInsQuestionQuiz(0, 0, $_POST["question"], $_GET["qqid"], 1); } else { $strErrormessage = 'ErrorMess~Question already added'; echo $strErrormessage . "~2~" . $_GET["qqid"]; exit; } if ($_SESSION["InTlAsTiD"]) { $qqqid = $_SESSION["InTlAsTiD"]; } else { $qqqid = $_GET["qtid"]; } $strTab = $hldGlobal->fnFetchQuestionQuiz($qqqid, $_GET["eid"]); $strResposeText = "EditQuestion~" . $strTab . "~2~" . $_GET["qqid"]; echo $strResposeText; } else { //This will add the question if (!$_SESSION["InTlAsTiD"] && !$_POST["editid"]) { $intLastId = $hldGlobal->fnInsTemp($_POST["cid"], $_POST["qtitle"]); } else { if ($_POST["editid"]) { $intLastId = $_POST["editid"]; } else { $intLastId = $_SESSION["InTlAsTiD"]; } } $strErrormessage = ''; if ($_POST["module_id"] == "--") {