Exemple #1
0
 public function studentEnrollment($courseId, $userId)
 {
     $this->load->model('request_model');
     $semester = new Semester();
     $currentSemester = $semester->getCurrentSemester();
     $temporaryRequest = new TemporaryRequest();
     $disciplinesToRequest = $temporaryRequest->getUserTempRequest($userId, $courseId, $currentSemester['id_semester']);
     $thereIsDisciplinesToRequest = $disciplinesToRequest !== FALSE;
     $data = array('semester' => $currentSemester, 'courseId' => $courseId, 'userId' => $userId, 'disciplinesToRequest' => $disciplinesToRequest, 'thereIsDisciplinesToRequest' => $thereIsDisciplinesToRequest);
     $requestForSemester = $this->getUserRequestDisciplines($userId, $courseId, $currentSemester['id_semester']);
     if ($requestForSemester !== FALSE) {
         $data['requestDisciplinesClasses'] = $requestForSemester['requestDisciplinesClasses'];
         switch ($requestForSemester['requestStatus']) {
             case EnrollmentConstants::REQUEST_INCOMPLETE_STATUS:
                 $requestStatus = "Incompleta (Aguardar aprovação do coordenador)";
                 break;
             case EnrollmentConstants::REQUEST_ALL_APPROVED_STATUS:
                 $requestStatus = "Aprovada";
                 break;
             case EnrollmentConstants::REQUEST_ALL_REFUSED_STATUS:
                 $requestStatus = "Recusada";
                 break;
             case EnrollmentConstants::REQUEST_PARTIALLY_APPROVED_STATUS:
                 $requestStatus = "Parcialmente aprovada";
                 break;
             default:
                 $requestStatus = "-";
                 break;
         }
         $data['requestStatus'] = $requestStatus;
         $request = $this->getRequest(array('id_student' => $userId, 'id_course' => $courseId, 'id_semester' => $currentSemester['id_semester']));
         $requestId = $request['id_request'];
         $mastermind = new MasterMind();
         $mastermindId = $mastermind->getMastermindByStudent($userId);
         $mastermindMessage = $mastermind->getMastermindMessage($mastermindId, $requestId);
         $data['mastermindMessage'] = $mastermindMessage;
     } else {
         $data['requestDisciplinesClasses'] = FALSE;
         $data['requestStatus'] = FALSE;
     }
     loadTemplateSafelyByGroup("estudante", 'request/enrollment_request', $data);
 }
Exemple #2
0
function displayMastermindStudentRequest($requests, $idMastermind)
{
    $user = new Usuario();
    echo "<br>";
    echo "<h3>Solicitações dos alunos orientados:</h3>";
    echo "<br>";
    echo "<div class=\"table-responsive no-padding\">";
    echo "<table class=\"table table-bordered table-hover\">";
    echo "<tbody>";
    echo "<tr>";
    echo "<th class=\"text-center\">Código da requisição</th>";
    echo "<th class=\"text-center\">Aluno requerente</th>";
    echo "<th class=\"text-center\">Matrícula aluno</th>";
    echo "<th class=\"text-center\">Status da solicitação</th>";
    echo "<th class=\"text-center\">Ações</th>";
    echo "<th class=\"text-center\">Finalizar</th>";
    echo "</tr>";
    if ($requests !== FALSE) {
        foreach ($requests as $request) {
            if ($request !== FALSE) {
                foreach ($request as $studentRequest) {
                    $requestId = $studentRequest['id_request'];
                    $requestIsApprovedByMastermind = $studentRequest['mastermind_approval'] == EnrollmentConstants::REQUEST_APPROVED_BY_MASTERMIND;
                    echo "<tr>";
                    echo "<td>";
                    echo $requestId;
                    echo "</td>";
                    $foundUser = $user->getUserById($studentRequest['id_student']);
                    echo "<td>";
                    echo $foundUser['name'];
                    echo "</td>";
                    echo "<td>";
                    echo $foundUser['id'];
                    echo "</td>";
                    echo "<td>";
                    $status = switchRequestGeneralStatus($studentRequest['request_status']);
                    if ($requestIsApprovedByMastermind) {
                        $status = $status . "<h4><span class='label label-primary'>Finalizada pelo orientador</span></h4>";
                        echo $status;
                    } else {
                        echo $status;
                    }
                    echo "</td>";
                    echo "<td>";
                    echo anchor("#solicitation_details_" . $requestId, "Visualizar solicitação", "class='btn btn-info'\n\t\t\t\t\t    \t\t\t\tdata-toggle='collapse'\n\t\t\t\t\t    \t\t\t\taria-expanded='false'\n\t\t\t\t\t    \t\t\t\taria-controls='solicitation_details" . $requestId . "'");
                    if ($requestIsApprovedByMastermind) {
                        // Disable buttons
                        echo anchor("", "Aprovar toda solicitação", "class='btn btn-success' style='margin-top:5%;' disabled='true'");
                        echo "<br>";
                        echo anchor("", "Recusar toda solicitação", "class='btn btn-danger' style='margin-top:5%;' disabled='true'");
                    } else {
                        echo "<br>";
                        echo anchor("request/approveAllStudentRequestsByMastermind/{$requestId}/{$studentRequest['id_student']}", "Aprovar toda solicitação", "class='btn btn-success' style='margin-top:5%;'");
                        echo "<br>";
                        echo anchor("request/refuseAllStudentRequestsByMastermind/{$requestId}/{$studentRequest['id_student']}", "Recusar toda solicitação", "class='btn btn-danger' style='margin-top:5%;'");
                    }
                    echo "</td>";
                    echo "<td rowspan=2>";
                    if ($requestIsApprovedByMastermind) {
                        $mastermind = new MasterMind();
                        $message = $mastermind->getMastermindMessage($idMastermind, $requestId);
                        $isFinalized = TRUE;
                        echo "<div class=\"callout callout-warning\">";
                        mastermindMessageForm($requestId, $idMastermind, $isFinalized, $message);
                        echo "<p><i>Solicitação finalizada. É possível alterar a mensagem deixada para o aluno.</i></p>";
                        echo "</div>";
                    } else {
                        $isFinalized = FALSE;
                        echo "<div class=\"callout callout-info\">";
                        mastermindMessageForm($requestId, $idMastermind, $isFinalized);
                        echo "<p><i>Finaliza a solicitação com o status atual das disciplinas.</i></p>";
                        echo "</div>";
                    }
                    echo "</td>";
                    echo "</tr>";
                    echo "<tr>";
                    echo "<td colspan=5>";
                    echo "<div class='collapse' id='solicitation_details_" . $requestId . "'>";
                    requestedDisciplineClasses($requestId, EnrollmentConstants::REQUESTING_AREA_MASTERMIND);
                    echo "</div>";
                    echo "</td>";
                    echo "</tr>";
                }
            }
        }
    } else {
        echo "<tr>";
        echo "<td colspan=9>";
        echo "<div class=\"callout callout-info\">";
        echo "<h4>Nenhuma solicitação encontrada.</h4>";
        echo "</div>";
        echo "</td>";
        echo "</tr>";
    }
    echo "</tbody>";
    echo "</table>";
    echo "</div>";
}