Example #1
0
 public function listar_cursos()
 {
     $data = $this->getParametroVisao();
     $data['page'] = 'home';
     $data['tema'] != '' ? $this->load->setTheme($data['tema']) : '';
     $data['msg'] = $this->getMsg();
     $data['abaAtiva'] = 1;
     $data['abaPage'] = 'listar_cursos';
     $sqlGrade = new SqlGrade();
     $result = $sqlGrade->listar_cursos();
     $this->load->library('table');
     $arrHead[] = 'Cod.';
     $arrHead[] = 'Cursos';
     $arrHead[] = 'Séries';
     $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']));
         $cell_1 = array('data' => $row['pk_curso'], 'class' => 'tright');
         if ($row['total'] > 0) {
             $cell_3 = array('data' => '<a class="link" href="' . base_url() . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/listar_series/' . $row['pk_curso'] . '">' . $row['total'] . '</a>', 'class' => 'tright');
         } else {
             $cell_3 = array('data' => $row['total'], 'class' => 'tright');
         }
         $this->table->add_row($cell_1, $row['curso_nome'], $cell_3);
     }
     $this->table->set_template($tmpl);
     if ($this->input->is_ajax_request()) {
         $this->load->view($this->uri->segment(3), $data);
     } else {
         $this->load->view($this->load->getUrlTema(), $data);
     }
 }