Example #1
0
 public function listar_assuntos($pk_livro, $pk_capitulo)
 {
     $data = $this->getParametroVisao();
     $data['page'] = 'home';
     $data['tema'] != '' ? $this->load->setTheme($data['tema']) : '';
     $data['msg'] = $this->getMsg();
     $data['abaAtiva'] = 7;
     $data['abaPage'] = 'listar_assuntos';
     $data['total'] = 0;
     $sqlAula = new SqlAula();
     $result = $sqlAula->get_capitulo_chave($pk_capitulo);
     $data['pk_livro'] = $result[0]['pk_livro'];
     $data['livro_desc'] = $result[0]['livro_desc'];
     $data['capitulo_sequencial'] = $result[0]['capitulo_sequencial'];
     $data['capitulo_nome'] = $result[0]['capitulo_nome'];
     $sqlAula = new SqlAula();
     $result = $sqlAula->get_materia($_GET['pk_materia_vin']);
     $data['materia_nome'] = $result[0]['materia_nome'];
     $sqlAula = new SqlAula();
     $result = $sqlAula->listar_assuntos($pk_capitulo);
     $data['total'] = $result['total'];
     if ($result['total'] > 0) {
         $this->load->library('table');
         $arrHead[] = 'Cod.';
         $arrHead[] = 'Conteúdo';
         $arrHead[] = 'Páginas';
         $arrHead[] = 'Página final';
         if ($data['idTipoUsuario'] == 1) {
             $arrHead[] = '';
             $arrHead[] = '';
             $arrHead[] = '';
         }
         $this->table->set_heading($arrHead);
         $count = 0;
         foreach ($result['registros'] as $row) {
             $count++;
             $this->load->library('util');
             $tmpl = $this->util->zebrar($count, count($result['registros']));
             $cod = array('data' => $row['pk_conteudo'], 'class' => 'tright');
             $paginas = array('data' => $row['pagina'], 'class' => 'tcenter');
             $this->table->add_row($cod, $row['conteudo_nome'], $row['paginas_trabalhadas'], $paginas, '<a class="link" href="' . base_url() . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/cadastrar_anexo/' . $this->uri->segment(4) . '/' . $this->uri->segment(5) . '/' . $row['pk_conteudo'] . '/' . $_GET['pk_materia_vin'] . '">Links</div></a>', '<a href="' . base_url() . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/editar_assunto/' . $this->uri->segment(4) . '/' . $this->uri->segment(5) . '/' . $row['pk_conteudo'] . '?pk_materia_vin=' . $_GET['pk_materia_vin'] . '"><div class="tooltip icon_edit" data-tooltip="Edição de assunto"></div></a>', '<a href="' . base_url() . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/excluir_assunto" ' . View::getParamExcluirItemTabela($row['pk_conteudo'], 0, 0, '', 'Excluir assunto', 'Deseja excluir o assunto ' . $row['conteudo_nome'] . '') . '   class="excluirItemTabela"><div class="tooltip icon_delete" data-tooltip="Exclusão"></div></a>');
         }
         $this->table->set_template($tmpl);
     } 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);
     }
 }