Пример #1
0
 public function __construct()
 {
     $this->bs = new DisciplineBS(null);
     $qbuilder = new QueryBuilder('discipline');
     $qbuilder->addOrder("dsc_name", QueryBuilder::$ASC);
     $qbuilder->addOrder("dsc_code", QueryBuilder::$ASC);
     $this->disciplines = $this->bs->findNotDeleted($qbuilder);
 }
Пример #2
0
 public function __construct($user)
 {
     $this->user = $user;
     $today = new DateTime("now");
     $ttrialBS = new TestTrialBS(null);
     $qbuilder = new QueryBuilder('testtrial');
     $qbuilder->addEqual("ttl_usr_id", $this->user->get('usr_id'));
     $qbuilder->addLess("tst_openUntil", $today->format(Model::$SQL_DATE_FORMAT), "test");
     $qbuilder->addOrder("ttl_tst_id", QueryBuilder::$DESC);
     $qbuilder->addOrder("prb_title", QueryBuilder::$ASC, 'problem');
     $qbuilder->addOrder("ttl_score", QueryBuilder::$DESC);
     $this->trials = $ttrialBS->findNotDeleted($qbuilder);
 }
Пример #3
0
 public function findAll($qbuilder)
 {
     if (UserSession::getInstance()->getAccessLevel() < 3) {
         die("<h1>Forbidden resource for you.</h1>");
     }
     @($dao = new DAO(TestLog));
     if (!isset($qbuilder)) {
         $qbuilder = new QueryBuilder('testlog');
         $qbuilder->addOrder("tsl_tst_id", QueryBuilder::$DESC);
         $qbuilder->addOrder("usr_name", QueryBuilder::$ASC, 'user');
         $qbuilder->addOrder("tsl_time", QueryBuilder::$DESC);
         $qbuilder->addOrder("tsl_remoteAddr", QueryBuilder::$ASC);
     }
     $qbuilder->addJoin("user", "tsl_usr_id", "usr_id");
     $qbuilder->addJoin("test", "tsl_tst_id", "tst_id");
     $tlogs = $dao->findByQuery($qbuilder);
     return $tlogs;
 }
Пример #4
0
 public function __construct($testId, $password)
 {
     $this->user = UserSession::getInstance()->getUser();
     $this->testId = $testId;
     $this->password = $password;
     $tprbBS = new TestProblemsBS(null);
     $qbuilder = new QueryBuilder('testproblems');
     $qbuilder->addEqual("tpb_tst_id", $testId);
     $qbuilder->addOrder("tpb_questionNumber", QueryBuilder::$ASC);
     $this->problems = $tprbBS->findNotDeleted($qbuilder);
     $testBS = new TestBS(null);
     $qbuilder = new QueryBuilder('test');
     $qbuilder->addEqual("tst_id", $testId);
     $qbuilder->addEqual("tst_password", $password);
     $tests = $testBS->findNotDeleted($qbuilder);
     if (count($tests) < 1) {
         die("<h3>ACESSO NEGADO</h3>");
     }
     $this->test = $tests[0];
     $ttrialBS = new TestTrialBS(null);
     $ttrialBS->createUserTrials($this->problems);
     $qbuilder = new QueryBuilder('testtrial');
     $qbuilder->addEqual("ttl_tst_id", $testId);
     $qbuilder->addEqual("ttl_usr_id", $this->user->get('usr_id'));
     $trials = $ttrialBS->findNotDeleted($qbuilder);
     $this->trials = array();
     if (count($trials) > 0) {
         foreach ($trials as $t => $trial) {
             $this->trials[$trial->get('ttl_prb_id')] = $trial;
         }
     }
     // Gravando log
     if ($this->test->get("tst_enableLogging") != 0) {
         $testBS->logAction($this->user->get('usr_id'), $this->testId, "Usuário abriu a prova.");
     }
 }
Пример #5
0
 public function findAll($qbuilder)
 {
     if (UserSession::getInstance()->getAccessLevel() < 5) {
         die("<h1>Forbidden resource for you.</h1>");
     }
     @($dao = new DAO(Discipline));
     if (!isset($qbuilder)) {
         $qbuilder = new QueryBuilder('discipline');
         $qbuilder->addOrder("dsc_code", QueryBuilder::$ASC);
         $qbuilder->addOrder("dsc_name", QueryBuilder::$ASC);
     }
     $disciplines = $dao->findByQuery($qbuilder);
     return $disciplines;
 }
if ($nProblems <= 0) {
    die("Nenhum problema nesta prova.");
} else {
    $test = $tproblems[0]->getForeignModel('tpb_tst_id');
    $problemWeights = array();
    $maxGradeSum = 0.0;
    foreach ($tproblems as $tp => $tproblem) {
        if (!isset($problemWeights[$tproblem->get('tpb_prb_id')])) {
            $problemWeights[$tproblem->get('tpb_prb_id')] = 0;
        }
        $problemWeights[$tproblem->get('tpb_prb_id')] += $tproblem->get('tpb_weight');
        $maxGradeSum += 100.0 * $tproblem->get('tpb_weight');
    }
    $qbuilder = new QueryBuilder('testtrial');
    $qbuilder->addEqual('ttl_tst_id', $testSelected);
    $qbuilder->addOrder('usr_name', QueryBuilder::$ASC, "user");
    $qbuilder->addOrder('usr_matricula', QueryBuilder::$ASC, "user");
    $qbuilder->addOrder('ttl_usr_id', QueryBuilder::$ASC);
    $bs = new TestTrialBS(null);
    $ttrials = $bs->findNotDeleted($qbuilder);
    $userGrades = array();
    $lastId = -1;
    $lastPos = -1;
    $averageScore = 0.0;
    foreach ($ttrials as $tt => $ttrial) {
        if ($lastId != $ttrial->get('ttl_usr_id')) {
            $lastId = $ttrial->get('ttl_usr_id');
            $lastPos++;
        }
        if (!isset($userGrades[$lastPos])) {
            $userGrades[$lastPos] = array();
Пример #7
0
        public function render($testSelected = null)
        {
            $bs = new TestLogBS(null);
            if (!isset($testSelected) || $testSelected == "") {
                echo "<i>Nenhuma prova selecionada.</i>";
                return;
            } else {
                $qbuilder = new QueryBuilder('testlog');
                $qbuilder->addEqual('tsl_tst_id', $testSelected);
                $qbuilder->addOrder("usr_name", QueryBuilder::$ASC, 'user');
                $qbuilder->addOrder("tsl_time", QueryBuilder::$DESC);
                $qbuilder->addOrder("tsl_remoteAddr", QueryBuilder::$ASC);
                $tlogs = $bs->findAll($qbuilder);
            }
            $nLogs = count($tlogs);
            if ($nLogs <= 0) {
                ?>
					<br/><i>Nenhum log recuperado referente à esta prova.</i><br />
				<?php 
            } else {
                $test = $tlogs[0]->getForeignModel('tsl_tst_id');
                ?>
					<h2><?php 
                echo $test->get('tst_title');
                ?>
</h2><br /><br />
					<?php 
                $first = true;
                $prevUser = -1;
                foreach ($tlogs as $tl => $tlog) {
                    if ($prevUser != $tlog->get('tsl_usr_id')) {
                        $user = $tlog->getForeignModel('tsl_usr_id');
                        $prevUser = $tlog->get('tsl_usr_id');
                        if ($first == true) {
                            $first = false;
                        } else {
                            ?>
								</table>
							<?php 
                        }
                        ?>
							<br /><h3><?php 
                        echo $user->get("usr_name");
                        ?>
</h3>
							<table class="dataView">
							<tr>
								<th style="min-width:150px;width:150px;max-width:150px;">Horário</th>
								<th style="min-width:130px;width:130px;max-width:130px;">IP</th>
								<th style="min-width:150px;width:150px;max-width:150px;">Hostname</th>
                                                                <th style="min-width:150px;width:150px;max-width:150px;">Questão</th>
                                                                <th style="min-width:150px;width:150px;max-width:150px;">Nota</th>
								<th>Mensagem</th>
							</tr>
						<?php 
                    }
                    ?>
						<tr class="color<?php 
                    echo $tl % 2;
                    ?>
">
							<td><?php 
                    echo Model::parseSQLToInputDate($tlog->get('tsl_time'));
                    ?>
</td>
							<td><?php 
                    echo $tlog->get('tsl_remoteAddr');
                    ?>
</td>
							<td><?php 
                    echo $tlog->get('tsl_hostname');
                    ?>
</td>
                                                        <td><?php 
                    echo $tlog->get('tsl_questNumber');
                    ?>
</td>
                                                        <td><?php 
                    echo $tlog->get('tsl_score');
                    ?>
</td>
							<td style="cursor:pointer" onClick="openDivAsDialog('logmessagediv-<?php 
                    echo $tl;
                    ?>
');">
								<?php 
                    echo substr($tlog->get('tsl_message'), 0, 50);
                    ?>
...
								<div style='display:none;' id='logmessagediv-<?php 
                    echo $tl;
                    ?>
'>
									<textarea class="cpp-code-view"><?php 
                    echo $tlog->get('tsl_message');
                    ?>
</textarea>
								</div>
							</td>
						</tr>
						<?php 
                }
                ?>
</table><?php 
            }
        }
Пример #8
0
 /**
  * Sort the results by descending order.
  *
  * @param string $column
  *
  * @return static
  */
 public function orderDesc($column)
 {
     $this->init();
     $this->queryBuilder->addOrder($column, 'DESC');
     return $this;
 }
Пример #9
0
 public function findAll($qbuilder)
 {
     if (UserSession::getInstance()->getAccessLevel() < 3) {
         die("<h1>Forbidden resource for you.</h1>");
     }
     @($dao = new DAO(Test));
     if (!isset($qbuilder)) {
         $qbuilder = new QueryBuilder('test');
         $qbuilder->addOrder("dsc_code", QueryBuilder::$ASC, 'discipline');
         $qbuilder->addOrder("tst_title", QueryBuilder::$ASC);
     }
     $qbuilder->addJoin("discipline", "tst_dsc_id", "dsc_id");
     $qbuilder->addLeftJoin("testproblems", "tst_id", "tpb_tst_id");
     $qbuilder->addGroupBy("tst_id", "test");
     $tests = $dao->findByQueryWithMetaFields($qbuilder);
     return $tests;
 }
Пример #10
0
 public function findAll($qbuilder)
 {
     if (UserSession::getInstance()->getAccessLevel() < 3) {
         die("<h1>Forbidden resource for you.</h1>");
     }
     @($dao = new DAO(TestTrial));
     if (!isset($qbuilder)) {
         $qbuilder = new QueryBuilder('testtrial');
         $qbuilder->addOrder("tst_title", QueryBuilder::$ASC, 'test');
         $qbuilder->addOrder("prb_difficultyLevel", QueryBuilder::$ASC, 'problem');
         $qbuilder->addOrder("prb_title", QueryBuilder::$ASC, 'problem');
         $qbuilder->addOrder("ttl_score", QueryBuilder::$DESC);
     }
     $qbuilder->addJoin("user", "ttl_usr_id", "usr_id");
     $qbuilder->addJoin("test", "ttl_tst_id", "tst_id");
     $qbuilder->addJoin("problem", "ttl_prb_id", "prb_id");
     $ttrials = $dao->findByQuery($qbuilder);
     return $ttrials;
 }
Пример #11
0
        public function renderNotDeleted($disciplineSelected = null, $titleFilter = null)
        {
            $bs = new ProblemBS(null);
            $ecaseBS = new EvaluationCaseBS(null);
            $qbuilder = new QueryBuilder('problem');
            if (isset($titleFilter) && $titleFilter != "") {
                $qbuilder->addLike("prb_title", "%" . $titleFilter . "%");
            }
            if (isset($disciplineSelected) && $disciplineSelected != "") {
                $qbuilder->addEqual('prb_dsc_id', $disciplineSelected);
            }
            $qbuilder->addOrder('prb_difficultyLevel', QueryBuilder::$ASC);
            $qbuilder->addOrder('prb_title', QueryBuilder::$ASC);
            $problems = $bs->findNotDeleted($qbuilder);
            if (count($problems) <= 0) {
                ?>
					<br/><i>Nenhum problema cadastrada ainda.</i><br />
				<?php 
            } else {
                ?>
					<script type="text/javascript">
					function deleteProblem(id) {
						if (confirm("Deseja realmente excluir este problema?")) {
							$("#problem-action-form input[name='_action']").val("delete");
							$("#problem-action-form input[name='prb_id']").val(id);
							$("#problem-action-form").submit();
						}
					}
					</script>
					<form method="POST" action="./controller/ProblemController.php" style="display:none;"
					id="problem-action-form">
						<input type="hidden" name="_action" />
						<input type="hidden" name="prb_id" />
					</form>
					<table class="dataView">
					<tr>
						<th>Disciplina</th>
						<th>Título</th>
						<th>Nível de Dificuldade</th>
						<th>Casos de Teste</th>
						<th style="min-width: 80px;width: 80px;max-width: 80px;">Ações</th>
					</tr>
					<?php 
                foreach ($problems as $p => $problem) {
                    ?>
						<tr class="color<?php 
                    echo $p % 2;
                    ?>
">
							<td><?php 
                    echo $problem->getForeignModel('prb_dsc_id')->get('dsc_code');
                    ?>
</td>
							<td><?php 
                    echo $problem->get('prb_title');
                    ?>
</td>
							<td><?php 
                    echo $problem->get('prb_difficultyLevel');
                    ?>
</td>
							<?php 
                    $nECases = $problem->getMetaField("prb_numberOfTestCases");
                    if (!isset($nECases) || $nECases < 1) {
                        ?>
									<td style="background:#ff8888;"><?php 
                    } else {
                        ?>
									<td><?php 
                    }
                    echo $nECases;
                    ?>
</td>
							<td class="actions">
								<span class="ui-state-default ui-corner-all" title="Editar Problema"
								onClick="location.assign('./problemEdit.php?prb_id=<?php 
                    echo $problem->get("prb_id");
                    ?>
');">
									<span class="ui-icon ui-icon-pencil"></span>
								</span>
								<span class="ui-state-default ui-corner-all" title="Configurar Casos de Teste"
								onClick="location.assign('./evaluationCases.php?evc_prb_id=<?php 
                    echo $problem->get("prb_id");
                    ?>
');">
									<span class="ui-icon ui-icon-gear"></span>
								</span>
								<span class="ui-state-default ui-corner-all" title="Excluir Problema"
								onClick="deleteProblem(<?php 
                    echo $problem->get('prb_id');
                    ?>
)">
									<span class="ui-icon ui-icon-trash"></span>
								</span>
							</td>
						</tr>
					<?php 
                }
                ?>
				</table>
				<?php 
            }
        }
Пример #12
0
        public function renderNotDeleted($problemSelected = null)
        {
            $bs = new EvaluationCaseBS(null);
            if (!isset($problemSelected) || $problemSelected == "") {
                $ecases = $bs->findNotDeleted(null);
            } else {
                $qbuilder = new QueryBuilder('evaluationcase');
                $qbuilder->addEqual('evc_prb_id', $problemSelected);
                $qbuilder->addOrder('evc_id', QueryBuilder::$ASC);
                $ecases = $bs->findNotDeleted($qbuilder);
            }
            if (count($ecases) <= 0) {
                ?>
					<br/><i>Nenhum caso de teste cadastrado ainda.</i><br />
				<?php 
            } else {
                ?>
					<script type="text/javascript">
					function deleteECase(id, probId) {
						if (confirm("Deseja realmente excluir este caso de teste?")) {
							$("#ecase-action-form input[name='_action']").val("delete");
							$("#ecase-action-form input[name='evc_id']").val(id);
							$("#ecase-action-form input[name='evc_prb_id']").val(probId);
							$("#ecase-action-form").submit();
						}
					}
					</script>
					<form method="POST" action="./controller/EvaluationCaseController.php" style="display:none;"
					id="ecase-action-form">
						<input type="hidden" name="_action" />
						<input type="hidden" name="evc_id" />
						<input type="hidden" name="evc_prb_id" />
					</form>
					<table class="dataView">
					<tr>
						<th>Problema</th>
						<th>Entradas</th>
						<th>Tipos das Entradas</th>
						<th>Saídas</th>
						<th>Tipos das Saídas</th>
						<th style="min-width: 60px;width: 60px;max-width: 60px;">Ações</th>
					</tr>
					<?php 
                foreach ($ecases as $ec => $ecase) {
                    ?>
						<tr class="color<?php 
                    echo $ec % 2;
                    ?>
">
							<td><?php 
                    echo $ecase->getForeignModel('evc_prb_id')->get('prb_title');
                    ?>
</td>
							<td><?php 
                    echo $ecase->get('evc_inputs');
                    ?>
</td>
							<td><?php 
                    echo $ecase->get('evc_inputsDataTypes');
                    ?>
</td>
							<td><?php 
                    echo $ecase->get('evc_outputs');
                    ?>
</td>
							<td><?php 
                    echo $ecase->get('evc_outputsDataTypes');
                    ?>
</td>
							<td class="actions">
								<span class="ui-state-default ui-corner-all" title="Editar Caso de Teste"
								onClick="location.assign('./evaluationCaseEdit.php?evc_id=<?php 
                    echo $ecase->get("evc_id");
                    ?>
&evc_prb_id=<?php 
                    echo $ecase->get('evc_prb_id');
                    ?>
');">
									<span class="ui-icon ui-icon-pencil"></span>
								</span>
								<span class="ui-state-default ui-corner-all" title="Excluir Problema"
								onClick="deleteECase(<?php 
                    echo $ecase->get('evc_id');
                    ?>
, <?php 
                    echo $ecase->get('evc_prb_id');
                    ?>
)">
									<span class="ui-icon ui-icon-trash"></span>
								</span>
							</td>
						</tr>
					<?php 
                }
                ?>
				</table>
				<?php 
            }
        }
Пример #13
0
        public function renderNotDeleted($testSelected = null)
        {
            $bs = new TestProblemsBS(null);
            if (!isset($testSelected) || $testSelected == "") {
                $tproblems = $bs->findNotDeleted(null);
            } else {
                $qbuilder = new QueryBuilder('testproblems');
                $qbuilder->addEqual('tpb_tst_id', $testSelected);
                $qbuilder->addOrder('tpb_questionNumber', QueryBuilder::$ASC);
                $qbuilder->addOrder('prb_title', QueryBuilder::$ASC, "problem");
                $tproblems = $bs->findNotDeleted($qbuilder);
            }
            if (count($tproblems) <= 0) {
                ?>
					<br/><i>Nenhum problema anexado à esta prova ainda.</i><br />
				<?php 
            } else {
                ?>
					<script type="text/javascript">
					function deleteTestProblem(testId, probId) {
						if (confirm("Deseja realmente desanexar este problema?")) {
							$("#tproblems-action-form input[name='_action']").val("delete");
							$("#tproblems-action-form input[name='tpb_tst_id']").val(testId);
							$("#tproblems-action-form input[name='tpb_prb_id']").val(probId);
							$("#tproblems-action-form").submit();
						}
					}
					</script>
					<form method="POST" action="./controller/TestProblemsController.php" style="display:none;"
					id="tproblems-action-form">
						<input type="hidden" name="_action" />
						<input type="hidden" name="tpb_tst_id" />
						<input type="hidden" name="tpb_prb_id" />
					</form>
					<table class="dataView">
					<tr>
						<th>Prova</th>
						<th>Nº da Questão</th>
						<th>Problema</th>
						<th>Nível de Dificuldade</th>
						<th>Peso</th>
						<th style="min-width: 60px;width: 60px;max-width: 60px;">Ações</th>
					</tr>
					<?php 
                foreach ($tproblems as $tp => $tproblem) {
                    ?>
						<tr class="color<?php 
                    echo $tp % 2;
                    ?>
">
							<td><?php 
                    echo $tproblem->getForeignModel('tpb_tst_id')->get('tst_title');
                    ?>
</td>
							<td><?php 
                    echo $tproblem->get('tpb_questionNumber');
                    ?>
</td>
							<td><?php 
                    echo $tproblem->getForeignModel('tpb_prb_id')->get('prb_title');
                    ?>
</td>
							<td><?php 
                    echo $tproblem->getForeignModel('tpb_prb_id')->get('prb_difficultyLevel');
                    ?>
</td>
							<td><?php 
                    echo $tproblem->get('tpb_weight');
                    ?>
</td>
							<td class="actions">
								<span class="ui-state-default ui-corner-all" title="Editar Anexo de Questão"
								onClick="location.assign('./testProblemsEdit.php?tpb_tst_id=<?php 
                    echo $tproblem->get("tpb_tst_id");
                    ?>
&tpb_prb_id=<?php 
                    echo $tproblem->get('tpb_prb_id');
                    ?>
');">
									<span class="ui-icon ui-icon-pencil"></span>
								</span>
								<span class="ui-state-default ui-corner-all" title="Desanexar Problema"
								onClick="deleteTestProblem(<?php 
                    echo $tproblem->get('tpb_tst_id');
                    ?>
, <?php 
                    echo $tproblem->get('tpb_prb_id');
                    ?>
)">
									<span class="ui-icon ui-icon-trash"></span>
								</span>
							</td>
						</tr>
					<?php 
                }
                ?>
				</table>
				<?php 
            }
        }
Пример #14
0
        public function render($testSelected = null)
        {
            $bs = new TestProblemsBS(null);
            if (!isset($testSelected) || $testSelected == "") {
                echo "<i>Nenhuma prova selecionada.</i>";
                return;
            } else {
                $qbuilder = new QueryBuilder('testproblems');
                $qbuilder->addEqual('tpb_tst_id', $testSelected);
                $qbuilder->addOrder('tpb_questionNumber', QueryBuilder::$ASC);
                $qbuilder->addOrder('prb_title', QueryBuilder::$ASC, "problem");
                $tproblems = $bs->findNotDeleted($qbuilder);
            }
            $nProblems = count($tproblems);
            if ($nProblems <= 0) {
                ?>
					<br/><i>Nenhum problema anexado à esta prova ainda.</i><br />
				<?php 
            } else {
                $test = $tproblems[0]->getForeignModel('tpb_tst_id');
                $problemWeights = array();
                $maxGradeSum = 0.0;
                foreach ($tproblems as $tp => $tproblem) {
                    if (!isset($problemWeights[$tproblem->get('tpb_prb_id')])) {
                        $problemWeights[$tproblem->get('tpb_prb_id')] = 0;
                    }
                    $problemWeights[$tproblem->get('tpb_prb_id')] += $tproblem->get('tpb_weight');
                    $maxGradeSum += 100.0 * $tproblem->get('tpb_weight');
                }
                $qbuilder = new QueryBuilder('testtrial');
                $qbuilder->addEqual('ttl_tst_id', $testSelected);
                $qbuilder->addOrder('usr_name', QueryBuilder::$ASC, "user");
                $qbuilder->addOrder('usr_matricula', QueryBuilder::$ASC, "user");
                $qbuilder->addOrder('ttl_usr_id', QueryBuilder::$ASC);
                $bs = new TestTrialBS(null);
                $ttrials = $bs->findNotDeleted($qbuilder);
                $userGrades = array();
                $lastId = -1;
                $lastPos = -1;
                $averageScore = 0.0;
                foreach ($ttrials as $tt => $ttrial) {
                    if ($lastId != $ttrial->get('ttl_usr_id')) {
                        $lastId = $ttrial->get('ttl_usr_id');
                        $lastPos++;
                    }
                    if (!isset($userGrades[$lastPos])) {
                        $userGrades[$lastPos] = array();
                        $userGrades[$lastPos]['matricula'] = $ttrial->getForeignModel("ttl_usr_id")->get("usr_matricula");
                        $userGrades[$lastPos]['name'] = $ttrial->getForeignModel("ttl_usr_id")->get("usr_name");
                        $userGrades[$lastPos]['totalScore'] = 0.0;
                        $userGrades[$lastPos]['totalSubmitted'] = 0;
                    }
                    if (strlen($ttrial->get("ttl_sourcefile")) > 50) {
                        $userGrades[$lastPos]['totalSubmitted']++;
                    }
                    $userGrades[$lastPos]['totalScore'] += $ttrial->get('ttl_score') * $problemWeights[$ttrial->get('ttl_prb_id')];
                    $averageScore += $ttrial->get('ttl_score') * $problemWeights[$ttrial->get('ttl_prb_id')];
                }
                $nAlunos = count($userGrades);
                if ($nAlunos > 0) {
                    $averageScore /= $nAlunos;
                }
                ?>
					<br />
					<h3><?php 
                echo $test->get('tst_title');
                ?>
</h3>
					<b>Número de Questões:</b> <?php 
                echo $nProblems;
                ?>
<br />
					<b>Acumulado Máximo:</b> <?php 
                echo $maxGradeSum;
                ?>
<br />
					<b>Média do Acumulado:</b> <?php 
                echo $averageScore;
                ?>
<br />
					<b>Média da Nota Final:</b> <?php 
                echo 100 * $averageScore / $maxGradeSum;
                ?>
<br />
					<b>Número de Alunos:</b> <?php 
                echo $nAlunos;
                ?>
<br />
					<table class="dataView">
					<tr>
						<th>Matrícula</th>
						<th>Nome do Aluno</th>
						<th>Nota Acumulada</th>
						<th>Nota Final</th>
						<th>Questões Entregues</th>
						<th>Nota pela Entrega</th>
					</tr>
					<?php 
                foreach ($userGrades as $ug => $userGrade) {
                    ?>
						<tr class="color<?php 
                    echo $ug % 2;
                    ?>
">
							<td><?php 
                    echo $userGrade['matricula'];
                    ?>
</td>
							<td><?php 
                    echo $userGrade['name'];
                    ?>
</td>
							<td><?php 
                    echo $userGrade['totalScore'];
                    ?>
</td>
							<td><?php 
                    echo 100 * $userGrade['totalScore'] / $maxGradeSum;
                    ?>
%</td>
							<td><?php 
                    echo $userGrade["totalSubmitted"];
                    ?>
</td>
							<td><?php 
                    echo 100.0 * $userGrade["totalSubmitted"] / $nProblems;
                    ?>
%</td>
						</tr>
					<?php 
                }
                ?>
				</table>
				<?php 
            }
        }
Пример #15
0
        public function renderNotDeleted($disciplineSelected = null)
        {
            $bs = new TestBS(null);
            if (!isset($disciplineSelected) || $disciplineSelected == "") {
                $tests = $bs->findNotDeleted(null);
            } else {
                $qbuilder = new QueryBuilder('test');
                $qbuilder->addEqual('tst_dsc_id', $disciplineSelected);
                $qbuilder->addOrder('tst_openUntil', QueryBuilder::$DESC);
                $qbuilder->addOrder('tst_visibleUntil', QueryBuilder::$DESC);
                $qbuilder->addOrder('tst_createdAt', QueryBuilder::$DESC);
                $qbuilder->addOrder('tst_title', QueryBuilder::$ASC);
                $qbuilder->addOrder('tst_openSince', QueryBuilder::$DESC);
                $qbuilder->addOrder('tst_visibleSince', QueryBuilder::$DESC);
                $tests = $bs->findNotDeleted($qbuilder);
            }
            if (count($tests) <= 0) {
                ?>
					<br/><i>Nenhuma prova cadastrada ainda.</i><br />
				<?php 
            } else {
                ?>
					<script type="text/javascript">
					function deleteTest(id) {
						if (confirm("Deseja realmente excluir esta prova?")) {
							$("#test-action-form input[name='_action']").val("delete");
							$("#test-action-form input[name='tst_id']").val(id);
							$("#test-action-form").submit();
						}
					}
					</script>
					<form method="POST" action="./controller/TestController.php" style="display:none;"
					id="test-action-form">
						<input type="hidden" name="_action" />
						<input type="hidden" name="tst_id" />
					</form>
					<table class="dataView">
					<tr>
						<th>Disciplina</th>
						<th>Título</th>
						<th>Visível de</th>
						<th>Visível até</th>
						<th>Aberta de</th>
						<th>Aberta até</th>
						<th>Nº de Questões</th>
						<th style="min-width:140px;width:140px;max-width:140px;">Ações</th>
					</tr>
					<?php 
                foreach ($tests as $t => $test) {
                    ?>
						<tr class="color<?php 
                    echo $t % 2;
                    ?>
">
							<td><?php 
                    echo $test->getForeignModel('tst_dsc_id')->get('dsc_code');
                    ?>
</td>
							<td><?php 
                    echo $test->get('tst_title');
                    ?>
</td>
							<td><?php 
                    echo Model::parseSQLToInputDate($test->get('tst_visibleSince'));
                    ?>
</td>
							<td><?php 
                    echo Model::parseSQLToInputDate($test->get('tst_visibleUntil'));
                    ?>
</td>
							<td><?php 
                    echo Model::parseSQLToInputDate($test->get('tst_openSince'));
                    ?>
</td>
							<td><?php 
                    echo Model::parseSQLToInputDate($test->get('tst_openUntil'));
                    ?>
</td>
							<?php 
                    $questions = $test->getMetaField("tst_numberOfQuestions");
                    if (!isset($questions) || $questions < 1) {
                        ?>
									<td style="background:#ff8888;"><?php 
                    } else {
                        ?>
									<td><?php 
                    }
                    echo $questions;
                    ?>
</td>
							<td class="actions">
								<span class="ui-state-default ui-corner-all" title="Editar Prova"
								onClick="location.assign('./testEdit.php?tst_id=<?php 
                    echo $test->get("tst_id");
                    ?>
');">
									<span class="ui-icon ui-icon-pencil"></span>
								</span>
								<span class="ui-state-default ui-corner-all" title="Configurar Problemas/Questões da Prova"
								onClick="location.assign('./testProblems.php?tpb_tst_id=<?php 
                    echo $test->get("tst_id");
                    ?>
');">
									<span class="ui-icon ui-icon-gear"></span>
								</span>
								<span class="ui-state-default ui-corner-all"
								title="Baixar ProblemBundleInit.hpp para o módulo AlGod Corretor (C++)."
								onClick="location.assign('./problemBundleInit.php?tpb_tst_id=<?php 
                    echo $test->get("tst_id");
                    ?>
');">
									<span class="ui-icon ui-icon-arrowthickstop-1-s"></span>
								</span>
								<span class="ui-state-default ui-corner-all"
								title="Visualizar logs da Prova."
								onClick="location.assign('./testLogs.php?tsl_tst_id=<?php 
                    echo $test->get("tst_id");
                    ?>
');">
									<span class="ui-icon ui-icon-note"></span>
								</span>
								<span class="ui-state-default ui-corner-all"
								title="Gerar relatório de notas."
								onClick="location.assign('./testReport.php?tpb_tst_id=<?php 
                    echo $test->get("tst_id");
                    ?>
');">
									<span class="ui-icon ui-icon-document"></span>
								</span>
								<span class="ui-state-default ui-corner-all" title="Excluir Prova"
								onClick="deleteTest(<?php 
                    echo $test->get('tst_id');
                    ?>
)">
									<span class="ui-icon ui-icon-trash"></span>
								</span>
							</td>
						</tr>
					<?php 
                }
                ?>
				</table>
				<?php 
            }
        }
Пример #16
0
        public function renderNotDeleted()
        {
            $bs = new TestBS(null);
            $qbuilder = new QueryBuilder('test');
            $today = new DateTime('now');
            $qbuilder->addLessEqual("tst_visibleSince", $today->format(Model::$SQL_DATE_FORMAT));
            $qbuilder->addGreaterEqual("tst_visibleUntil", $today->format(Model::$SQL_DATE_FORMAT));
            $qbuilder->addOrder('tst_openSince', QueryBuilder::$DESC);
            $qbuilder->addOrder('tst_visibleSince', QueryBuilder::$DESC);
            $qbuilder->addOrder('tst_title', QueryBuilder::$ASC);
            $qbuilder->addOrder('tst_createdAt', QueryBuilder::$DESC);
            $tests = $bs->findNotDeleted($qbuilder);
            if (count($tests) <= 0) {
                ?>
					<br/><i>Nenhuma prova aberta no momento.</i><br />
				<?php 
            } else {
                foreach ($tests as $t => $test) {
                    ?>
						<div class="data-view-box">
							<h3><?php 
                    echo $test->getForeignModel('tst_dsc_id')->get('dsc_code');
                    ?>
 -
							<?php 
                    echo $test->get('tst_title');
                    ?>
</h3>
							<p><b>INFORMAÇÕES:</b><br />
							<b>Visível de:</b>
							<?php 
                    echo Model::parseSQLToInputDate($test->get('tst_visibleSince'));
                    ?>
<br />
							<b>Visível até:</b>
							<?php 
                    echo Model::parseSQLToInputDate($test->get('tst_visibleUntil'));
                    ?>
<br />
							<b>Aberta de:</b>
							<?php 
                    echo Model::parseSQLToInputDate($test->get('tst_openSince'));
                    ?>
<br />
							<b>Aberta até:</b>
							<?php 
                    echo Model::parseSQLToInputDate($test->get('tst_openUntil'));
                    ?>
<br />
							<b>Descrição:</b><br />
							<?php 
                    echo $test->get('tst_description');
                    ?>
</p>
							<form method="POST" class="centering" action="encodePassword.php">
								<table class="formTable">
									<tr>
										<td>Senha de Acesso:</td>
										<td><input type="password" name="tst_password" size=40 /></td>
									</tr>
								</table>
								<input type="hidden" value="<?php 
                    echo $test->get("tst_id");
                    ?>
" name="tst_id" />
								<input type="submit" value="Abrir Prova" />
							</form>
						</div><br />
				<?php 
                }
            }
        }
Пример #17
0
 public function findAll($qbuilder)
 {
     if (UserSession::getInstance()->getAccessLevel() < 3) {
         die("<h1>Forbidden resource for you.</h1>");
     }
     @($dao = new DAO(TestProblems));
     if (!isset($qbuilder)) {
         $qbuilder = new QueryBuilder('testproblems');
         $qbuilder->addOrder("tst_title", QueryBuilder::$ASC, 'test');
         $qbuilder->addOrder("tpb_questionNumber", QueryBuilder::$ASC);
         $qbuilder->addOrder("prb_title", QueryBuilder::$ASC, 'problem');
     }
     $qbuilder->addJoin("test", "tpb_tst_id", "tst_id");
     $qbuilder->addJoin("problem", "tpb_prb_id", "prb_id");
     $tproblems = $dao->findByQuery($qbuilder);
     return $tproblems;
 }
Пример #18
0
 public function findAll($qbuilder)
 {
     if (UserSession::getInstance()->getAccessLevel() < 3) {
         die("<h1>Forbidden resource for you.</h1>");
     }
     @($dao = new DAO(Problem));
     if (!isset($qbuilder)) {
         $qbuilder = new QueryBuilder('problem');
         $qbuilder->addOrder("dsc_code", QueryBuilder::$ASC, 'discipline');
         $qbuilder->addOrder("prb_difficultyLevel", QueryBuilder::$ASC);
         $qbuilder->addOrder("prb_title", QueryBuilder::$ASC);
     }
     $qbuilder->addJoin("discipline", "prb_dsc_id", "dsc_id");
     $qbuilder->addLeftJoin("evaluationcase", "prb_id", "evc_prb_id");
     $qbuilder->addGroupBy("prb_id", "problem");
     $problems = $dao->findByQueryWithMetaFields($qbuilder);
     return $problems;
 }
Пример #19
0
/** Generated by AlGod Web Module
<?php 
$today = new DateTime('now');
?>
  * Generated at: <?php 
echo $today->format("d/m/Y H:i:s");
?>
 *
 * @author AlGod Web Module by Renato R. R. de Oliveira
<?php 
include "controller/TestProblemsBS.php";
include "controller/EvaluationCaseBS.php";
$bs = new TestProblemsBS(null);
$qbuilder = new QueryBuilder("testproblems");
$qbuilder->addEqual('tpb_tst_id', $testId);
$qbuilder->addOrder('tpb_questionNumber', QueryBuilder::$ASC);
$qbuilder->addOrder('prb_title', QueryBuilder::$ASC, 'problem');
$problems = $bs->findNotDeleted($qbuilder);
?>
 */
name = "<?php 
echo $problems[0]->getForeignModel("tpb_tst_id")->get("tst_title");
?>
";
cout << "Carregando conjunto de problemas: " << name << endl;
Problem *problem;
TestCase *testCase;
<?php 
foreach ($problems as $p => $tproblem) {
    ?>
/*<?php 
Пример #20
0
 public function findAll($qbuilder)
 {
     if (UserSession::getInstance()->getAccessLevel() < 3) {
         die("<h1>Forbidden resource for you.</h1>");
     }
     @($dao = new DAO(EvaluationCase));
     if (!isset($qbuilder)) {
         $qbuilder = new QueryBuilder('evaluationcase');
         $qbuilder->addOrder("prb_title", QueryBuilder::$ASC, 'discipline');
         $qbuilder->addOrder("evc_id", QueryBuilder::$ASC);
     }
     $qbuilder->addJoin("problem", "evc_prb_id", "prb_id");
     $ecases = $dao->findByQuery($qbuilder);
     return $ecases;
 }