Example #1
0
 public function acompanhamento_turma_detalhe()
 {
     $data = $this->getParametroVisao();
     $data['abaAtiva'] = 7;
     $data['abaPage'] = $data['alias'] = $data['page'] = __FUNCTION__;
     $data['page'] = 'home';
     $data['tema'] != '' ? $this->load->setTheme($data['tema']) : '';
     $data['msg'] = $this->getMsg();
     $data['total'] = 0;
     $data['pk_livro'] = (int) filter_input(INPUT_GET, 'pk_livro', FILTER_VALIDATE_INT);
     $data['pk_turma'] = (int) filter_input(INPUT_GET, 'pk_turma', FILTER_VALIDATE_INT);
     $data['pk_serie'] = (int) filter_input(INPUT_GET, 'pk_serie', FILTER_VALIDATE_INT);
     $data['pk_unidade'] = (int) filter_input(INPUT_GET, 'pk_unidade', FILTER_VALIDATE_INT);
     $data['ano_letivo'] = isset($_GET['ano']) ? (int) filter_input(INPUT_GET, 'ano_letivo', FILTER_VALIDATE_INT) : $data['ano_letivo'];
     $data['get_shadowbox'] = View::shadowbox($data['shadowbox']);
     $config['base_url'] = base_url() . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/' . $this->uri->segment(3) . '?' . $data['get_shadowbox'];
     $sqlAulas = new SqlAulas();
     $data['livro'] = $sqlAulas->get_livros_geral($data['ano_letivo'], $data['pk_serie']);
     $livro = explode("&pk_livro=", $_SERVER['QUERY_STRING']);
     $data['livro_url'] = $config['base_url'] . substr($livro[0], 12);
     if (isset($_GET['pk_livro'])) {
         $sqlAulas = new SqlAulas();
         $result = $sqlAulas->get_percentual($data['pk_livro'], date('Y-m-d'));
         $percentual = !empty($result[0]['percentual']) ? $result[0]['percentual'] : 0;
         if ($data['idTipoUsuario'] == 1 || $data['idTipoUsuario'] == 2 || $data['idTipoUsuario'] == 3 || $data['idTipoUsuario'] == 15) {
             $sqlGrade = new SqlGrade();
             $data['turma'] = $sqlGrade->filtro_turmas($data['pk_unidade'], $data['pk_serie'], $data['ano_letivo']);
             $turma = explode("&pk_turma=", $_SERVER['QUERY_STRING']);
             $data['turma_url'] = $config['base_url'] . substr($turma[0], 12);
         }
         $status = explode("&status=", $_SERVER['QUERY_STRING']);
         $data['status_url'] = $config['base_url'] . substr($status[0], 12);
         if (isset($_GET['pk_turma'])) {
             $sqlLivro = new SqlLivro();
             $result = $sqlLivro->get_materias_apostilas_turma($data['pk_livro']);
             $data['total'] = count($result);
             if ($data['total'] > 0) {
                 $count = 0;
                 $html = '<table class="tabela_relatorio mt20"><tr>
                     <td class="titulo_relatorio tcenter" nowrap="nowrap"><strong>Disciplina</strong></td>
                     <td class="titulo_relatorio tcenter"><strong>Professor(a)</strong></td>
                     <td class="titulo_relatorio tcenter"><strong>Aulas dadas</strong></td>
                     <td class="titulo_relatorio tcenter"><strong>Última aula</strong></td>
                     <td class="titulo_relatorio tcenter"><strong>Conteúdos programáticos em andamento na última aula</strong></td>
                     <td class="titulo_relatorio tcenter w100"><strong>Planejamento executado</strong></td>';
                 $cor = '';
                 foreach ($result as $row) {
                     $sqlLivro = new SqlLivro();
                     $result = $sqlLivro->get_apostila_acompanhamento($row['fk_materia_vin'], $_GET['pk_turma'], $_GET['pk_livro']);
                     $conteudo = !empty($result) != '' ? $result[0]['capitulo_sequencial'] . ': ' . $result[0]['capitulo_nome'] . '<br/>Tópico ' . $result[0]['topico'] . ': ' . $result[0]['conteudo_nome'] . ' - pag(s): ' . $result[0]['paginas_trabalhadas'] : '';
                     $percentual = !empty($result) != '' ? number_format($result[0]['percentual_professor'], 1) . '%' : '';
                     $aula = !empty($result) != '' ? $result[0]['aula'] : '';
                     $data_aula = !empty($result) != '' ? View::converteDataBr($result[0]['data_aula']) : '';
                     if ($data['idTipoUsuario'] == 1 || $data['idTipoUsuario'] == 2 || $data['idTipoUsuario'] == 3 || $data['idTipoUsuario'] == 15) {
                         $nome = !empty($result) != '' ? '<a rel="shadowbox" class="link" href="' . base_url() . 'aula/conteudos/edicao_conteudos' . '?shadowbox=1' . '&pk_materia_vin=' . $result[0]['fk_materia_vin'] . '&pk_usuario_professor=' . $result[0]['fk_usuario_professor'] . '&pk_turma=' . $data['pk_turma'] . '&pk_livro=' . $data['pk_livro'] . '">' . $result[0]['nome'] . '</a>' : '';
                     } else {
                         $nome = !empty($result) != '' ? $result[0]['nome'] : '';
                     }
                     if (!empty($result)) {
                         $percent_media_geral = Matematica::divisao($result[0]['percentual_professor'], $percentual);
                         if ($percent_media_geral < 0.8) {
                             $cor = 'vermelho';
                         } else {
                             if ($percent_media_geral > 1.2) {
                                 $cor = 'azul';
                             } else {
                                 $cor = 'verde';
                             }
                         }
                     }
                     $statusCor = '';
                     $status = '';
                     if (!empty($result)) {
                         if ($result[0]['status'] == 1) {
                             $status = "Em andamento";
                             $statusCor = "status1";
                         } else {
                             if ($result[0]['status'] == 2) {
                                 $status = "Concluído";
                                 $statusCor = "status2";
                             } else {
                                 if ($result[0]['status'] == 3) {
                                     $status = "Revisado";
                                     $statusCor = "status3";
                                 } else {
                                     $status = "";
                                     $statusCor = "";
                                 }
                             }
                         }
                     }
                     if (isset($_GET['status'])) {
                         if ($_GET['status'] == 1 && isset($percent_media_geral) && $percent_media_geral < 0.8 && $conteudo != '') {
                             $html .= '<tr><td class="status">' . $row['materia_nome'] . '</td>';
                             $html .= '<td class="status">' . $nome . '</td>';
                             $html .= '<td class="tcenter status">' . $aula . '</td>';
                             $html .= '<td class="tcenter status">' . $data_aula . '</td>';
                             $html .= '<td class="status">' . $conteudo . '</td>';
                             $html .= '<td class="status ' . $cor . '">' . $percentual . '</td>';
                         } else {
                             if ($_GET['status'] == 2 && isset($percent_media_geral) && $percent_media_geral >= 0.8 && $percent_media_geral <= 1.2 && $conteudo != '') {
                                 $html .= '<tr><td class="status">' . $row['materia_nome'] . '</td>';
                                 $html .= '<td class="status">' . $nome . '</td>';
                                 $html .= '<td class="tcenter status">' . $aula . '</td>';
                                 $html .= '<td class="tcenter status">' . $data_aula . '</td>';
                                 $html .= '<td class="status">' . $conteudo . '</td>';
                                 $html .= '<td class="status ' . $cor . '">' . $percentual . '</td>';
                             } else {
                                 if ($_GET['status'] == 3 && isset($percent_media_geral) && $percent_media_geral > 1.2 && $conteudo != '') {
                                     $html .= '<tr><td class="status">' . $row['materia_nome'] . '</td>';
                                     $html .= '<td class="status">' . $nome . '</td>';
                                     $html .= '<td class="tcenter status">' . $aula . '</td>';
                                     $html .= '<td class="tcenter status">' . $data_aula . '</td>';
                                     $html .= '<td class="status">' . $conteudo . '</td>';
                                     $html .= '<td class="status ' . $cor . '">' . $percentual . '</td>';
                                 }
                             }
                         }
                     } else {
                         $html .= '<tr><td class="status">' . $row['materia_nome'] . '</td>';
                         $html .= '<td class="status">' . $nome . '</td>';
                         $html .= '<td class="tcenter status">' . $aula . '</td>';
                         $html .= '<td class="tcenter status">' . $data_aula . '</td>';
                         $html .= '<td class="status">' . $conteudo . '</td>';
                         $html .= '<td class="status tcenter ' . $cor . '">' . $percentual . '</td>';
                     }
                 }
                 $html .= '</tr></table>';
                 $data['html'] = $html;
             } else {
                 $data['msg'] = '<div class="alert atencao">Não há registros com o parâmetro selecionado.</div>';
             }
         }
     }
     if ($this->input->is_ajax_request()) {
         $this->load->view($this->uri->segment(3), $data);
     } else {
         $this->load->view($this->load->getUrlTema(), $data);
     }
 }