当前位置: 首页>>代码示例>>PHP>>正文


PHP QueryBuilder::addOrder方法代码示例

本文整理汇总了PHP中QueryBuilder::addOrder方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryBuilder::addOrder方法的具体用法?PHP QueryBuilder::addOrder怎么用?PHP QueryBuilder::addOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QueryBuilder的用法示例。


在下文中一共展示了QueryBuilder::addOrder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 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);
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:8,代码来源:DisciplineSelect.php

示例2: __construct

 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);
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:13,代码来源:UserTestsList.php

示例3: findAll

 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;
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:18,代码来源:TestLogBS.php

示例4: __construct

 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.");
     }
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:36,代码来源:TestTryView.php

示例5: findAll

 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;
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:14,代码来源:DisciplineBS.php

示例6: die

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();
开发者ID:renatorroliveira,项目名称:algod,代码行数:31,代码来源:testReportCSVExport.php

示例7: render

        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>
//.........这里部分代码省略.........
开发者ID:renatorroliveira,项目名称:algod,代码行数:101,代码来源:TestLogsList.php

示例8: orderDesc

 /**
  * Sort the results by descending order.
  *
  * @param string $column
  *
  * @return static
  */
 public function orderDesc($column)
 {
     $this->init();
     $this->queryBuilder->addOrder($column, 'DESC');
     return $this;
 }
开发者ID:fastpress,项目名称:arrow,代码行数:13,代码来源:FluentBuilderTrait.php

示例9: findAll

 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;
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:17,代码来源:TestBS.php

示例10: findAll

 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;
 }
开发者ID:renatorroliveira,项目名称:algod,代码行数:19,代码来源:TestTrialBS.php

示例11: renderNotDeleted

        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 
                }
                ?>
//.........这里部分代码省略.........
开发者ID:renatorroliveira,项目名称:algod,代码行数:101,代码来源:ProblemList.php

示例12: renderNotDeleted

        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 
            }
        }
开发者ID:renatorroliveira,项目名称:algod,代码行数:99,代码来源:EvaluationCaseList.php

示例13: renderNotDeleted

        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 
            }
        }
开发者ID:renatorroliveira,项目名称:algod,代码行数:100,代码来源:TestProblemsList.php

示例14: render

        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) {
                    ?>
//.........这里部分代码省略.........
开发者ID:renatorroliveira,项目名称:algod,代码行数:101,代码来源:TestReportList.php

示例15: renderNotDeleted

        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 
//.........这里部分代码省略.........
开发者ID:renatorroliveira,项目名称:algod,代码行数:101,代码来源:TestList.php


注:本文中的QueryBuilder::addOrder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。