Exemple #1
0
 public function acompanhamento_turmas_novo()
 {
     $data = $this->getParametroVisao();
     $data['page'] = 'home';
     $data['tema'] != '' ? $this->load->setTheme($data['tema']) : '';
     $data['msg'] = $this->getMsg();
     $data['abaAtiva'] = 7;
     $data['abaPage'] = 'acompanhamento_turmas';
     $data['total'] = 0;
     $data['css'] = array(0 => 'css/fap.css?' . date('Y-m-d'));
     $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];
     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_primeiro_dia($_GET['pk_livro']);
             $data1 = $result[0]['dia_aula'];
             $data2 = date('Y-m-d');
             if (strtotime($data1) > strtotime($data2)) {
                 $_SESSION['percentual'] = 0;
             } else {
                 $sqlAula = new SqlAula();
                 $result = $sqlAula->get_percentual($_GET['pk_livro'], date('Y-m-d'));
                 $_SESSION['percentual'] = !empty($result) ? $result[0]['percentual'] : 100;
             }
             $sqlAula = new SqlAula();
             $result = $sqlAula->get_media_geral_novo($_GET['pk_livro']);
             $_SESSION['media_geral_professores'] = !empty($result) ? number_format($result[0]['media_geral'], 1) : '';
         }
         //            // Select filtro de unidade
         //            $sqlUsuario = new SqlUsuario();
         //            $data['unidade'] = $sqlUsuario->unidade();
         $unidade = explode("&pk_unidade=", $_SERVER['QUERY_STRING']);
         $data['unidade_url'] = $config['base_url'] . '?' . $unidade[0];
         $pk_unidade = isset($_GET['pk_unidade']) ? $_GET['pk_unidade'] : '';
         $sqlAula = new SqlAula();
         $result = $sqlAula->get_materias_apostilas($_SESSION['pk_livro']);
         $data['total'] = count($result);
         if ($data['total'] > 0) {
             $count = 0;
             $html = View::indicesGeraisApostilas($_SESSION['percentual'], $_SESSION['media_geral_professores']);
             $html .= '<table class="tabela_relatorio"><tr><td class="titulo_relatorio tcenter w80" nowrap="nowrap">Disciplinas</td>';
             $sqlAula = new SqlAula();
             $turmas = $sqlAula->get_turmas_apostila($_SESSION['pk_serie_cadastro_aula'], $data['ano_letivo'], $pk_unidade, $_GET['pk_livro']);
             foreach ($turmas as $item) {
                 if (substr($item['tmacod'], 2, 2) == '11') {
                     $turma_serie = '1º ano';
                 } else {
                     if (substr($item['tmacod'], 2, 2) == '12') {
                         $turma_serie = '2º ano';
                     } else {
                         if (substr($item['tmacod'], 2, 2) == '13') {
                             $turma_serie = '3º ano';
                         }
                     }
                 }
                 $html .= '<td class="titulo_relatorio">
                             <a class="link tooltip" data-tooltip="Assuntos em Andamento por Turma" rel="shadowbox" href="' . base_url() . 'aula/conteudo/acompanhamento_turma_detalhe?pk_livro=' . $_SESSION['pk_livro'] . '&pk_turma=' . $item['pk_turma'] . '&shadowbox=1">' . str_replace('do Ens. Médio', '', $item['turma_nome']) . '</a>
                           </td>';
                 $arr_turmas[] = $item['pk_turma'];
             }
             $html .= '</tr>';
             foreach ($result as $row) {
                 $html .= '<tr><td>
                                 <a class="link tooltip" data-tooltip="Andamento dos Conteúdos" rel="shadowbox" href="' . base_url() . 'aula/conteudo/acompanhamento?pk_livro=' . $_SESSION['pk_livro'] . '&pk_materia_vin=' . $row['fk_materia_vin'] . '&shadowbox=1">' . $row['materia_nome'] . '</a>
                           </td>';
                 $sqlAula = new SqlAula();
                 $result = $sqlAula->get_dados_process($row['fk_materia_vin'], $_GET['pk_livro']);
                 foreach ($result as $nota) {
                     if (!empty($result)) {
                         if ($nota['percentual'] < $_SESSION['media_geral_professores'] * 0.8) {
                             $status = 'link_vermelho';
                         } else {
                             if ($nota['percentual'] > $_SESSION['media_geral_professores'] * 1.2) {
                                 $status = 'link_azul';
                             } else {
                                 $status = 'link_verde';
                             }
                         }
                     } else {
                         $status = '';
                     }
                     $percent = $nota['percentual'] != NULL ? '<a rel="shadowbox" class="' . $status . ' tooltip"  data-tooltip="Histórico de Aulas por Professor" href="' . base_url() . 'aula/conteudo/acompanhamento_professor?pk_livro=' . $_GET['pk_livro'] . '&pk_turma=' . $nota['fk_turma'] . '&pk_materia_vin=' . $nota['fk_materia_vin'] . '&shadowbox=1" />' . number_format($nota['percentual'], 1) . '%</a>' : '';
                     $html .= '<td class="tcenter borderCinza">' . $percent . '</td>';
                 }
                 $html .= '</tr>';
             }
             $html .= '</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);
     }
 }