Example #1
0
 public function acompanhamento_turma_detalhe()
 {
     $data = $this->getParametroVisao();
     $data['page'] = 'home';
     $data['tema'] != '' ? $this->load->setTheme($data['tema']) : '';
     $data['msg'] = $this->getMsg();
     $data['abaAtiva'] = 7;
     $data['abaPage'] = 'acompanhamento_turma_detalhe';
     $data['total'] = 0;
     $config['base_url'] = base_url() . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/' . $this->uri->segment(3) . '/';
     $sqlAula = new SqlAula();
     $data['livro'] = $sqlAula->get_livros($data['ano_letivo']);
     $livro = explode("&pk_livro=", $_SERVER['QUERY_STRING']);
     $data['livro_url'] = $config['base_url'] . '?' . $livro[0];
     $pk_unidade = isset($_GET['pk_unidade']) && $_GET['pk_unidade'] != '' ? $_GET['pk_unidade'] : 0;
     $ano_letivo = isset($_GET['ano']) ? $_GET['ano'] : $data['ano_letivo'];
     if (isset($_GET['pk_livro'])) {
         if ($_GET['pk_livro'] != $_SESSION['pk_livro'] || !isset($_SESSION['media_geral_professores'])) {
             $sqlAula = new SqlAula();
             $result = $sqlAula->get_serie_livro($_GET['pk_livro']);
             $_SESSION['pk_serie_cadastro_aula'] = $result[0]['fk_serie'];
             $_SESSION['serie_nome_cadastro_aula'] = $result[0]['serie_nome'];
             $_SESSION['pk_livro'] = $result[0]['pk_livro'];
             $sqlAula = new SqlAula();
             $result = $sqlAula->get_media_geral($data['ano_letivo'], $_SESSION['pk_livro']);
             $_SESSION['media_geral_professores'] = !empty($result) ? number_format($result[0]['media_geral'], 1) : '';
             $sqlAula = new SqlAula();
             $result = $sqlAula->get_percentual($_GET['pk_livro'], date('Y-m-d'));
             $_SESSION['percentual'] = $result[0]['percentual'];
         }
         // Select filtro de turmas
         $sqlGrade = new SqlGrade();
         $data['turma'] = $sqlGrade->filtro_turmas($pk_unidade, $_SESSION['pk_serie_cadastro_aula'], $ano_letivo);
         $turma = explode("&pk_turma=", $_SERVER['QUERY_STRING']);
         $data['turma_url'] = $config['base_url'] . '?' . $turma[0];
         $status = explode("&status=", $_SERVER['QUERY_STRING']);
         $data['status_url'] = $config['base_url'] . '?' . $status[0];
         if (isset($_GET['pk_turma'])) {
             $sqlAula = new SqlAula();
             $result = $sqlAula->get_materias_apostilas_turma($_SESSION['pk_livro']);
             $data['total'] = count($result);
             if ($data['total'] > 0) {
                 $count = 0;
                 $html = '<table class="tabela_relatorio mt20"><tr>
                     <td class="titulo_relatorio w80 tcenter"  nowrap="nowrap"><strong>Disciplinas</strong></td>
                     <td class="titulo_relatorio tcenter"><strong>Conteúdos</strong></td>
                     <td class="titulo_relatorio tcenter"><strong>%</strong></td>
                     <td class="titulo_relatorio tcenter"><strong>Aula</strong></td>
                     <td class="titulo_relatorio tcenter"><strong>Data</strong></td>
                     <td class="titulo_relatorio tcenter"><strong>Professor</strong></td>';
                 $cor = '';
                 foreach ($result as $row) {
                     $sqlAula = new SqlAula();
                     $result = $sqlAula->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/>Assunto: ' . $result[0]['conteudo_nome'] . ' - página(s) ' . $result[0]['paginas_trabalhadas'] : '';
                     $percentual = !empty($result) != '' ? number_format($result[0]['percentual'], 1) . '%' : '';
                     $aula = !empty($result) != '' ? $result[0]['aula'] : '';
                     $data_aula = !empty($result) != '' ? View::converteDataBr($result[0]['data_aula']) : '';
                     $nome = !empty($result) != '' ? '<a rel="shadowbox" class="link" href="' . base_url() . 'aula/conteudo/acompanhamento_professor_detalhe/?&pk_livro=' . $_GET['pk_livro'] . '&pk_turma=' . $_GET['pk_turma'] . '&pk_usuario_professor=' . $result[0]['fk_usuario_professor'] . '&pk_materia_vin=' . $result[0]['fk_materia_vin'] . '&shadowbox=1">' . $result[0]['nome'] . '</a>' : '';
                     if (!empty($result)) {
                         $percent_media_geral = $result[0]['percentual'] / $_SESSION['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">' . $conteudo . '</td>';
                             $html .= '<td class="status ' . $cor . '">' . $percentual . '</td>';
                             $html .= '<td class="tcenter status">' . $aula . '</td>';
                             $html .= '<td class="tcenter status">' . $data_aula . '</td>';
                             $html .= '<td class="status">' . $nome . '</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">' . $conteudo . '</td>';
                                 $html .= '<td class="status ' . $cor . '">' . $percentual . '</td>';
                                 $html .= '<td class="tcenter status">' . $aula . '</td>';
                                 $html .= '<td class="tcenter status">' . $data_aula . '</td>';
                                 $html .= '<td class="status">' . $nome . '</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">' . $conteudo . '</td>';
                                     $html .= '<td class="status ' . $cor . '">' . $percentual . '</td>';
                                     $html .= '<td class="tcenter status">' . $aula . '</td>';
                                     $html .= '<td class="tcenter status">' . $data_aula . '</td>';
                                     $html .= '<td class="status">' . $nome . '</td>';
                                 }
                             }
                         }
                     } else {
                         $html .= '<tr><td class="status">' . $row['materia_nome'] . '</td>';
                         $html .= '<td class="status">' . $conteudo . '</td>';
                         $html .= '<td class="status ' . $cor . '">' . $percentual . '</td>';
                         $html .= '<td class="tcenter status">' . $aula . '</td>';
                         $html .= '<td class="tcenter status">' . $data_aula . '</td>';
                         $html .= '<td class="status">' . $nome . '</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);
     }
 }