示例#1
0
    public function inscritos($pk_sim_concurso = '', $pk_sim_bloco = '', $pk_sim_area = '', $pk_sim_prova = '')
    {
        $msg = null;
        $data = $this->getParametroVisao();
        $data['page'] = 'home';
        $data['msg'] = $msg;
        $data['abaAtiva'] = 18;
        $data['abaPage'] = 'inscritos';
        $data['alias'] = 'inscritos';
        $data['tema'] = '../../themes/admin/default';
        if ($this->uri->segment(7) != '') {
            $pk_sim_prova = $this->uri->segment(7);
        } else {
            if ($this->uri->segment(6) != '') {
                $pk_sim_area = $this->uri->segment(6);
            } else {
                if ($this->uri->segment(5) != '') {
                    $pk_sim_bloco = $this->uri->segment(5);
                } else {
                    $pk_sim_concurso = $this->uri->segment(4);
                }
            }
        }
        $prova_nome = '';
        if ($pk_sim_prova != '') {
            $sqlAdministracao = new SqlAdministracao();
            $result = $sqlAdministracao->get_prova_nome($pk_sim_prova);
            $prova_nome = $result[0]['prova_nome'] != '' && $result[0]['prova_nome'] != 'geral' ? $result[0]['prova_nome'] : '';
        }
        $area_nome = '';
        if ($pk_sim_area != '') {
            $sqlAdministracao = new SqlAdministracao();
            $result = $sqlAdministracao->get_area_nome($pk_sim_area);
            $area_nome = $result[0]['area_nome'] != '' && $result[0]['area_nome'] != 'geral' ? $result[0]['area_nome'] : '';
        }
        $data['data_realizacao'] = '';
        $bloco_nome = '';
        if ($pk_sim_bloco != '') {
            $sqlAdministracao = new SqlAdministracao();
            $result = $sqlAdministracao->get_bloco_nome($pk_sim_bloco);
            $bloco_nome = $result[0]['bloco_nome'] != '' && $result[0]['bloco_nome'] != 'geral' ? $result[0]['bloco_nome'] : '';
            $data['data_realizacao'] = $result[0]['data_realizacao'];
        }
        $concurso_nome = '';
        if ($pk_sim_concurso != '') {
            $sqlAdministracao = new SqlAdministracao();
            $result = $sqlAdministracao->get_concurso_nome($pk_sim_concurso);
            $concurso_nome = $result[0]['concurso_nome'] != '' && $result[0]['concurso_nome'] != 'geral' ? $result[0]['concurso_nome'] : '';
            $concurso_tipo_nome = $result[0]['concurso_tipo_nome'] != '' && $result[0]['concurso_tipo_nome'] != 'geral' ? $result[0]['concurso_tipo_nome'] : '';
        }
        $titulo1 = $concurso_nome . ' / ' . $bloco_nome . ' / ' . $area_nome . ' / ' . $prova_nome;
        $titulo2 = str_replace("/  /", "/", $titulo1);
        $contaCaracteres = strlen($titulo2);
        if (substr(trim($titulo2), $contaCaracteres - 2, 2) == '/') {
            $titulo_final = $concurso_tipo_nome . ' / ' . substr(trim($titulo2), 0, $contaCaracteres - 2);
        } else {
            $titulo_final = $concurso_tipo_nome . ' / ' . $titulo2;
        }
        $data['titulo_concurso'] = $titulo_final;
        if ($this->uri->segment(4) != '' && $this->uri->segment(5) == '' && $this->uri->segment(6) == '' && $this->uri->segment(7) == '') {
            $sqlAdministracao = new SqlAdministracao();
            $result = $sqlAdministracao->get_prova_concurso($pk_sim_concurso);
            $arrProvas = array();
            foreach ($result as $row) {
                $arrProvas[] = $row['pk_sim_prova'];
            }
        } else {
            if ($this->uri->segment(5) != '' && $this->uri->segment(6) == '' && $this->uri->segment(7) == '') {
                $sqlAdministracao = new SqlAdministracao();
                $result = $sqlAdministracao->get_prova_bloco($this->uri->segment(5));
                $arrProvas = array();
                foreach ($result as $row) {
                    $arrProvas[] = $row['pk_sim_prova'];
                }
            } else {
                if ($this->uri->segment(6) != '' && $this->uri->segment(7) == '') {
                    $sqlAdministracao = new SqlAdministracao();
                    $result = $sqlAdministracao->get_prova_area($this->uri->segment(6));
                    $arrProvas = array();
                    foreach ($result as $row) {
                        $arrProvas[] = $row['pk_sim_prova'];
                    }
                } else {
                    if ($this->uri->segment(7) != '') {
                        $arrProvas = array($this->uri->segment(7));
                    }
                }
            }
        }
        $sqlAdministracao = new SqlAdministracao();
        $result = $sqlAdministracao->listar_inscritos($arrProvas);
        $data['total'] = $result['total'];
        if (isset($_GET['print']) && $_GET['print'] != '') {
            $data['tema'] = '../../themes/cartoes/default';
            if ($result['total'] > 0) {
                $count = 0;
                $coluna = 1;
                $tabela = '<div class="pagina"><table><tr>';
                foreach ($result['registros'] as $row) {
                    $binario = decbin($row['fk_usuario_aluno']);
                    $nCaracteres = strlen($binario);
                    $nome_coluna = $coluna % 2 == 0 ? 'coluna2' : 'coluna1';
                    $tabela .= '<td class="' . $nome_coluna . ' altura_pagina" valign="top">
                                    <div class="cabecalho">' . $row['nome'] . '<br/>
                                        Matrícula: ' . $row['matricula'] . ' - Id: ' . $row['fk_usuario_aluno'] . ' (' . $nCaracteres . ') ' . $binario . '<br />
                                        ' . $row['turma_nome'] . '<br />
                                        ' . $titulo_final . '<br />
                                        Data: ' . View::converteDataBr($data['data_realizacao']) . '<br /> 
                                    </div>        

                                    <table class="codigos">
                                      <tr>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                      </tr>
                                      <tr>
                                       <td class="separador_vertical" colspan="23"></td>
                                      </tr>
                                      <tr>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                      </tr>
                                      <tr>
                                       <td class="separador_vertical" colspan="23"></td>
                                      </tr>
                                      <tr>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/branco.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/' . View::trataCodigoBinario($binario, $nCaracteres, 16) . '.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/' . View::trataCodigoBinario($binario, $nCaracteres, 15) . '.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/' . View::trataCodigoBinario($binario, $nCaracteres, 14) . '.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/' . View::trataCodigoBinario($binario, $nCaracteres, 13) . '.jpg" /></td>
                                      </tr>
                                      <tr>
                                       <td class="separador_vertical" colspan="23"></td>
                                      </tr>
                                      <tr>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/' . View::trataCodigoBinario($binario, $nCaracteres, 12) . '.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/' . View::trataCodigoBinario($binario, $nCaracteres, 11) . '.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/' . View::trataCodigoBinario($binario, $nCaracteres, 10) . '.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/' . View::trataCodigoBinario($binario, $nCaracteres, 9) . '.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/' . View::trataCodigoBinario($binario, $nCaracteres, 8) . '.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/' . View::trataCodigoBinario($binario, $nCaracteres, 7) . '.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/' . View::trataCodigoBinario($binario, $nCaracteres, 6) . '.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/' . View::trataCodigoBinario($binario, $nCaracteres, 5) . '.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/' . View::trataCodigoBinario($binario, $nCaracteres, 4) . '.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/' . View::trataCodigoBinario($binario, $nCaracteres, 3) . '.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/' . View::trataCodigoBinario($binario, $nCaracteres, 2) . '.jpg" /></td>
                                       <td class="separador_horizontal"></td>
                                       <td class="retangulo"><img src="' . base_url() . 'themes/cartoes/images/' . View::trataCodigoBinario($binario, $nCaracteres, 1) . '.jpg" /></td>
                                      </tr>
                                      <tr>
                                       <td class="separador_vertical" colspan="23"></td>
                                      </tr>
                                    </table>  


                                </td>';
                    if ($coluna % 2 == 0) {
                        $tabela .= '</tr><tr>';
                    }
                    $coluna++;
                }
                $tabela .= '<table></div>';
            }
            $data['tabela'] = $tabela;
        } else {
            if ($result['total'] > 0) {
                $this->load->library('table');
                $arrHead[] = 'Código';
                $arrHead[] = 'Cod. Aluno';
                $arrHead[] = 'Matricula';
                $arrHead[] = 'Aluno';
                $arrHead[] = 'Turma';
                $this->table->set_heading($arrHead);
                $count = 0;
                foreach ($result['registros'] as $row) {
                    $count++;
                    $tmpl = Util::zebrar($count, count($result['registros']));
                    $cell_1 = array('data' => $row['pk_usuario'], 'class' => 'tright');
                    $cell_2 = array('data' => $row['fk_usuario_aluno'], 'class' => 'tright');
                    $cell_3 = array('data' => $row['matricula'], 'class' => 'tright');
                    $cell_4 = array('data' => $row['nome'], 'class' => 'tleft');
                    $cell_5 = array('data' => $row['turma_nome'], 'class' => 'tleft');
                    $this->table->add_row($cell_1, $cell_2, $cell_3, $cell_4, $cell_5);
                }
                $this->table->set_template($tmpl);
                $sqlAdministracao = new SqlAdministracao();
                $result = $sqlAdministracao->get_unidades($this->uri->segment(7));
                $unidade = explode("&pk_unidade=", $_SERVER['QUERY_STRING']);
                $unidade_url = base_url() . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/' . $this->uri->segment(3) . '/' . $this->uri->segment(4) . '/' . $this->uri->segment(5) . '/' . $this->uri->segment(6) . '/' . $this->uri->segment(7) . '?' . $unidade[0];
                $select = '<select name="jumpMenu" id="jumpMenu" class="w250 right mr20 mb20" onchange="MM_jumpMenu(\'parent\',this,0)">';
                $label_default = isset($_GET['pk_unidade']) ? 'Retirar filtro de escola' : 'Filtrar por escola';
                $select .= '<option value="' . $unidade_url . '">' . $label_default . '</option>';
                foreach ($result as $row) {
                    $checked = isset($_GET['pk_unidade']) && $_GET['pk_unidade'] == $row['fk_unidade'] ? 'selected' : '';
                    $select .= '<option value="' . $unidade_url . '&pk_unidade=' . $row['fk_unidade'] . '" ' . $checked . '>' . $row['unidade_nome'] . '</option>';
                }
                $select .= '</select>';
                $data['filtro_unidades'] = $select;
            } else {
                $data['msg'] = '<div class="alert atencao">Nenhum aluno incluído. Para cadastrar, clique no botão acima.</div>';
            }
        }
        $_SESSION['redirect'] = $data['urlAtual'];
        $this->load->view($data['tema'], $data);
    }