Ejemplo n.º 1
0
 public function cadastrar_registros_alunos()
 {
     $msg = null;
     $data = $this->getParametroVisao();
     $data['page'] = 'home';
     $data['tema'] != '' ? $this->load->setTheme($data['tema']) : '';
     $data['msg'] = $msg;
     $data['abaAtiva'] = 23;
     $data['abaPage'] = 'cadastrar_registros_alunos';
     $data['alias'] = 'cadastrar_registros_alunos';
     $data['js'] = array('js/modules/aula/check.js');
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         try {
             // View::validarFormAntInjection($alias);
             for ($i = 1; $i < $this->input->post('total_alunos') + 1; $i++) {
                 if ($this->input->post('passo') == 1) {
                     $sqlAgenda = new SqlAgenda();
                     $sqlAgenda->update_registro_dia($this->input->post('pk_age_aula'), $this->input->post('pk_usuario_aluno_' . $i), $this->input->post('dia_' . $i));
                     $sqlAgenda = new SqlAgenda();
                     $sqlAgenda->update_passo($this->input->post('pk_age_aula'), $this->input->post('passo'));
                     $passo = 2;
                 } else {
                     if ($this->input->post('passo') == 2) {
                         $sqlAgenda = new SqlAgenda();
                         $sqlAgenda->update_registro_banho($this->input->post('pk_age_aula'), $this->input->post('pk_usuario_aluno_' . $i), $this->input->post('banho_' . $i));
                         $sqlAgenda = new SqlAgenda();
                         $sqlAgenda->update_passo($this->input->post('pk_age_aula'), $this->input->post('passo'));
                         $passo = 3;
                     } else {
                         if ($this->input->post('passo') == 3) {
                             $sqlAgenda = new SqlAgenda();
                             $sqlAgenda->update_registro_evacuou($this->input->post('pk_age_aula'), $this->input->post('pk_usuario_aluno_' . $i), $this->input->post('evacuou_' . $i));
                             $sqlAgenda = new SqlAgenda();
                             $sqlAgenda->update_passo($this->input->post('pk_age_aula'), $this->input->post('passo'));
                             $passo = 4;
                         } else {
                             if ($this->input->post('passo') == 4) {
                                 $sqlAgenda = new SqlAgenda();
                                 $sqlAgenda->update_registro_dormiu($this->input->post('pk_age_aula'), $this->input->post('pk_usuario_aluno_' . $i), $this->input->post('dormiu_' . $i));
                                 $sqlAgenda = new SqlAgenda();
                                 $sqlAgenda->update_passo($this->input->post('pk_age_aula'), $this->input->post('passo'));
                                 $passo = 5;
                             } else {
                                 if ($this->input->post('passo') == 5) {
                                     $sqlAgenda = new SqlAgenda();
                                     $sqlAgenda->update_registro_agua($this->input->post('pk_age_aula'), $this->input->post('pk_usuario_aluno_' . $i), $this->input->post('agua_' . $i));
                                     $sqlAgenda = new SqlAgenda();
                                     $sqlAgenda->update_passo($this->input->post('pk_age_aula'), $this->input->post('passo'));
                                     $passo = 6;
                                 } else {
                                     if ($this->input->post('passo') == 6) {
                                         $sqlAgenda = new SqlAgenda();
                                         $sqlAgenda->update_registro_suco($this->input->post('pk_age_aula'), $this->input->post('pk_usuario_aluno_' . $i), $this->input->post('suco_' . $i));
                                         $sqlAgenda = new SqlAgenda();
                                         $sqlAgenda->update_passo($this->input->post('pk_age_aula'), $this->input->post('passo'));
                                         $passo = $this->input->post('tipo_registro') == 1 ? 8 : 7;
                                     } else {
                                         if ($this->input->post('passo') == 7) {
                                             $sqlAgenda = new SqlAgenda();
                                             $sqlAgenda->update_registro_lanche($this->input->post('pk_age_aula'), $this->input->post('pk_usuario_aluno_' . $i), $this->input->post('lanche_' . $i));
                                             $sqlAgenda = new SqlAgenda();
                                             $sqlAgenda->update_passo($this->input->post('pk_age_aula'), $this->input->post('passo'));
                                             $passo = 8;
                                         } else {
                                             if ($this->input->post('passo') == 8) {
                                                 $sqlAgenda = new SqlAgenda();
                                                 $sqlAgenda->update_registro_medicacao($this->input->post('pk_age_aula'), $this->input->post('pk_usuario_aluno_' . $i), $this->input->post('medicacao_' . $i), $this->input->post('medicacao_horario_' . $i), $this->input->post('medicacao_dosagem_' . $i), $this->input->post('medicacao_autorizacao_' . $i));
                                                 $sqlAgenda = new SqlAgenda();
                                                 $sqlAgenda->update_passo($this->input->post('pk_age_aula'), $this->input->post('passo'));
                                                 $passo = 9;
                                             } else {
                                                 if ($this->input->post('passo') == 9) {
                                                     $sqlAgenda = new SqlAgenda();
                                                     $sqlAgenda->update_registro_ocorrencias($this->input->post('pk_age_aula'), $this->input->post('pk_usuario_aluno_' . $i), $this->input->post('ocorrencia_tropecou_' . $i), $this->input->post('ocorrencia_arranhou_' . $i), $this->input->post('ocorrencia_caiu_' . $i), $this->input->post('ocorrencia_mordido_' . $i), $this->input->post('ocorrencia_vomitou_' . $i), $this->input->post('ocorrencia_dor_' . $i));
                                                     $sqlAgenda = new SqlAgenda();
                                                     $sqlAgenda->update_passo($this->input->post('pk_age_aula'), $this->input->post('passo'));
                                                     $passo = 10;
                                                 } else {
                                                     if ($this->input->post('passo') == 10) {
                                                         $sqlAgenda = new SqlAgenda();
                                                         $sqlAgenda->update_registro_providencias($this->input->post('pk_age_aula'), $this->input->post('pk_usuario_aluno_' . $i), $this->input->post('providencia_lavou_' . $i), $this->input->post('providencia_gelo_' . $i), $this->input->post('providencia_observacao_' . $i), $this->input->post('providencia_curativo_' . $i));
                                                         $sqlAgenda = new SqlAgenda();
                                                         $sqlAgenda->update_passo($this->input->post('pk_age_aula'), $this->input->post('passo'));
                                                         $passo = 11;
                                                     } else {
                                                         if ($this->input->post('passo') == 11) {
                                                             if ($this->input->post('obs_' . $i) != '') {
                                                                 $sqlAgenda = new SqlAgenda();
                                                                 $result = $sqlAgenda->checa_obs($this->input->post('pk_age_aula'), $this->input->post('pk_usuario_aluno_' . $i));
                                                                 if ($result['registros'][0]['fk_age_registro'] == null) {
                                                                     // inclui
                                                                     $sqlAgenda = new SqlAgenda();
                                                                     $sqlAgenda->insert_obs($result['registros'][0]['pk_age_registro'], $this->input->post('obs_' . $i));
                                                                 }
                                                                 $passo = 12;
                                                             }
                                                             $sqlAgenda = new SqlAgenda();
                                                             $sqlAgenda->update_passo($this->input->post('pk_age_aula'), $this->input->post('passo'));
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             if ($this->input->post('passo') == 11) {
                 $passo = 12;
                 redirect(base_url() . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/cadastrar_registros_turma/' . $this->input->post('pk_age_aula') . '?tipo_registro=' . $this->input->post('tipo_registro') . '&passo=' . $passo);
             } else {
                 redirect(base_url() . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/cadastrar_registros_alunos/' . $this->input->post('pk_age_aula') . '?tipo_registro=' . $this->input->post('tipo_registro') . '&passo=' . $passo);
             }
             return false;
         } catch (Exception $e) {
             $msg = '<p class="alert erro">' . $e->getMessage() . '</p>';
         }
     }
     if ($_GET['tipo_registro'] == 1) {
         // pega os alunos da turma
         $sqlAgenda = new SqlAgenda();
         $result = $sqlAgenda->listar_alunos($_SESSION['age_pk_turma'], $_SESSION['age_pk_aula']);
         $data['total_alunos'] = count($result);
     } else {
         // pega as turmas e alunos do integral que tem aula no dia selecionado
         $sqlAgenda = new SqlAgenda();
         $result = $sqlAgenda->listar_alunos_integral($_SESSION['series_juncao'], $_SESSION['age_pk_aula']);
         $data['total_alunos'] = count($result);
     }
     $table = '<table class="table mt10">';
     // Passo 1
     if (!isset($_GET['passo'])) {
         $passo = 1;
         $titulo_passo = 'Como passaram o dia?';
         $header = '<th colspan="7">' . $titulo_passo . '</th></tr><tr><th>Tranquilo</th><th>Agitado</th><th>Calmo</th><th>Chorou</th><th>Brincou</th><th>Alegre</th><th>Triste</th></tr>';
         $table .= '<tr><th rowspan="2">Alunos</th>' . $header;
     } else {
         if (isset($_GET['passo']) && $_GET['passo'] == 2) {
             $passo = 2;
             $titulo_passo = 'Tomaram banho?';
             $header = '<th colspan="7">' . $titulo_passo . '</th></tr><tr><th>Sim</th><th>Não</th></tr>';
             $table .= '<tr><th rowspan="2">Alunos</th>' . $header;
         } else {
             if (isset($_GET['passo']) && $_GET['passo'] == 3) {
                 $passo = 3;
                 $titulo_passo = 'Evacuaram?';
                 $header = '<th colspan="7">' . $titulo_passo . '</th></tr><tr><th>Sim</th><th>Não</th></tr>';
                 $table .= '<tr><th rowspan="2">Alunos</th>' . $header;
             } else {
                 if (isset($_GET['passo']) && $_GET['passo'] == 4) {
                     $passo = 4;
                     $titulo_passo = 'Dormiram?';
                     $header = '<th colspan="7">' . $titulo_passo . '</th></tr><tr><th>Sim</th><th>Não</th></tr>';
                     $table .= '<tr><th rowspan="2">Alunos</th>' . $header;
                 } else {
                     if (isset($_GET['passo']) && $_GET['passo'] == 5) {
                         $passo = 5;
                         $titulo_passo = 'Tomaram água?';
                         $header = '<th colspan="7">' . $titulo_passo . '</th></tr><tr><th>Bastante</th><th>Pouco</th><th>Nada</th></tr>';
                         $table .= '<tr><th rowspan="2">Alunos</th>' . $header;
                     } else {
                         if (isset($_GET['passo']) && $_GET['passo'] == 6) {
                             $passo = 6;
                             $titulo_passo = 'Lancharam?';
                             $header = '<th colspan="7">' . $titulo_passo . '</th></tr><tr><th>Tudo</th><th>Quase tudo</th><th>Pouco</th><th>Nada</th></tr>';
                             $table .= '<tr><th rowspan="2">Alunos</th>' . $header;
                         } else {
                             if (isset($_GET['passo']) && $_GET['passo'] == 7) {
                                 $passo = 7;
                                 $titulo_passo = 'Almoçaram?';
                                 $header = '<th colspan="7">' . $titulo_passo . '</th></tr><tr><th>Tudo</th><th>Quase tudo</th><th>Pouco</th><th>Nada</th></tr>';
                                 $table .= '<tr><th rowspan="2">Alunos</th>' . $header;
                             } else {
                                 if (isset($_GET['passo']) && $_GET['passo'] == 8) {
                                     $passo = 8;
                                     $titulo_passo = 'Tomaram alguma medicação?';
                                     $header = '<th colspan="7">' . $titulo_passo . '</th></tr><tr><th>Qual?</th><th>Horário</th><th>Dosagem</th><th>Autorizado por</th></tr>';
                                     $table .= '<tr><th rowspan="2">Alunos</th>' . $header;
                                 } else {
                                     if (isset($_GET['passo']) && $_GET['passo'] == 9) {
                                         $passo = 9;
                                         $titulo_passo = 'Ocorrências';
                                         $header = '<th colspan="7">' . $titulo_passo . '</th></tr><tr><th>Tropeçou</th><th>Arranhou-se</th><th>Caiu</th><th>Foi mordido</th><th>Vomitou</th><th>Dor de cabeça</th></tr>';
                                         $table .= '<tr><th rowspan="2">Alunos</th>' . $header;
                                     } else {
                                         if (isset($_GET['passo']) && $_GET['passo'] == 10) {
                                             $passo = 10;
                                             $titulo_passo = 'Providências';
                                             $header = '<th colspan="7">' . $titulo_passo . '</th></tr><tr><th>Lavou com água e sabão</th><th>Colocou-se gelo</th><th>Ficou em observação</th><th>Foi feito curativo</th></tr>';
                                             $table .= '<tr><th rowspan="2">Alunos</th>' . $header;
                                         } else {
                                             if (isset($_GET['passo']) && $_GET['passo'] == 11) {
                                                 $passo = 11;
                                                 $titulo_passo = 'Observações';
                                                 $header = '<th colspan="7">' . $titulo_passo . '</th></tr>';
                                                 $table .= '<tr><th>Alunos</th>' . $header;
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $count = 0;
     foreach ($result as $row) {
         $count++;
         $tmpl = Util::zebrar($count, $data['total_alunos']);
         $row_start = $tmpl['row_start'];
         // Passo 1
         if (!isset($_GET['passo'])) {
             $checked_traquilo = '';
             $checked_agitado = '';
             $checked_calmo = '';
             $checked_chorou = '';
             $checked_brincou = '';
             $checked_alegre = '';
             $checked_triste = '';
             if ($row['dia'] == 1) {
                 $checked_traquilo = 'checked="checked"';
             } else {
                 if ($row['dia'] == 2) {
                     $checked_agitado = 'checked="checked"';
                 } else {
                     if ($row['dia'] == 3) {
                         $checked_calmo = 'checked="checked"';
                     } else {
                         if ($row['dia'] == 4) {
                             $checked_chorou = 'checked="checked"';
                         } else {
                             if ($row['dia'] == 5) {
                                 $checked_brincou = 'checked="checked"';
                             } else {
                                 if ($row['dia'] == 6) {
                                     $checked_alegre = 'checked="checked"';
                                 } else {
                                     if ($row['dia'] == 7) {
                                         $checked_triste = 'checked="checked"';
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
             $checked = '';
             if ($checked_traquilo == '' && $checked_agitado == '' && $checked_calmo == '' && $checked_chorou == '' && $checked_brincou == '' && $checked_alegre == '' && $checked_triste == '') {
                 $checked = 'checked="checked"';
             }
             $questao = '<td class="tcenter"><input type="radio" name="dia_' . $count . '" value="1" class="opcao1" ' . $checked_traquilo . $checked . ' /></td>
                         <td class="tcenter"><input type="radio" name="dia_' . $count . '" value="2" class="opcao2" ' . $checked_agitado . ' /></td>
                         <td class="tcenter"><input type="radio" name="dia_' . $count . '" value="3" class="opcao3" ' . $checked_calmo . ' /></td>
                         <td class="tcenter"><input type="radio" name="dia_' . $count . '" value="4" class="opcao4" ' . $checked_chorou . ' /></td>
                         <td class="tcenter"><input type="radio" name="dia_' . $count . '" value="5" class="opcao5" ' . $checked_brincou . ' /></td>
                         <td class="tcenter"><input type="radio" name="dia_' . $count . '" value="6" class="opcao6" ' . $checked_alegre . ' /></td>
                         <td class="tcenter"><input type="radio" name="dia_' . $count . '" value="7" class="opcao7" ' . $checked_triste . ' />
                         <input type="hidden" name="pk_usuario_aluno_' . $count . '" value="' . $row['pk_usuario_aluno'] . '"></td>';
         }
         // Passo 2
         if (isset($_GET['passo']) && $_GET['passo'] == 2) {
             $checked_banho_sim = '';
             $checked_banho_nao = '';
             if ($row['banho'] == 1) {
                 $checked_banho_sim = 'checked="checked"';
             } else {
                 $checked_banho_nao = 'checked="checked"';
             }
             $questao = '<td class="tcenter"><input class="opcao1" type="radio" name="banho_' . $count . '" value="1" ' . $checked_banho_sim . ' /></td>
                         <td class="tcenter"><input class="opcao2" type="radio" name="banho_' . $count . '" value="0" ' . $checked_banho_nao . ' />
                         <input type="hidden" name="pk_usuario_aluno_' . $count . '" value="' . $row['pk_usuario_aluno'] . '"></td>';
         }
         // Passo 3
         if (isset($_GET['passo']) && $_GET['passo'] == 3) {
             $checked_evacuou_sim = '';
             $checked_evacuou_nao = '';
             if ($row['evacuou'] == 1) {
                 $checked_evacuou_sim = 'checked="checked"';
             } else {
                 $checked_evacuou_nao = 'checked="checked"';
             }
             $questao = '<td class="tcenter"><input class="opcao1" type="radio" name="evacuou_' . $count . '" value="1" ' . $checked_evacuou_sim . ' /></td>
                         <td class="tcenter"><input class="opcao2" type="radio" name="evacuou_' . $count . '" value="0" ' . $checked_evacuou_nao . ' />
                         <input type="hidden" name="pk_usuario_aluno_' . $count . '" value="' . $row['pk_usuario_aluno'] . '"></td>';
         }
         // Passo 4
         if (isset($_GET['passo']) && $_GET['passo'] == 4) {
             $checked_dormiu_sim = '';
             $checked_dormiu_nao = '';
             if ($row['dormiu'] == 1) {
                 $checked_dormiu_sim = 'checked="checked"';
             } else {
                 $checked_dormiu_nao = 'checked="checked"';
             }
             $questao = '<td class="tcenter"><input class="opcao1" type="radio" name="dormiu_' . $count . '" value="1" ' . $checked_dormiu_sim . ' /></td>
                         <td class="tcenter"><input class="opcao2" type="radio" name="dormiu_' . $count . '" value="0" ' . $checked_dormiu_nao . ' />
                         <input type="hidden" name="pk_usuario_aluno_' . $count . '" value="' . $row['pk_usuario_aluno'] . '"></td>';
         }
         // Passo 5
         if (isset($_GET['passo']) && $_GET['passo'] == 5) {
             $checked_agua_nada = '';
             $checked_agua_pouco = '';
             $checked_agua_bastante = '';
             if ($row['agua'] == 1) {
                 $checked_agua_nada = 'checked="checked"';
             } else {
                 if ($row['agua'] == 2) {
                     $checked_agua_pouco = 'checked="checked"';
                 } else {
                     if ($row['agua'] == 3) {
                         $checked_agua_bastante = 'checked="checked"';
                     }
                 }
             }
             $checked = '';
             if ($checked_agua_nada == '' && $checked_agua_pouco == '' && $checked_agua_bastante == '') {
                 $checked = 'checked="checked"';
             }
             $questao = '<td class="tcenter"><input class="opcao1" type="radio" name="agua_' . $count . '" value="3" ' . $checked_agua_bastante . $checked . ' /></td>
                         <td class="tcenter"><input class="opcao2" type="radio" name="agua_' . $count . '" value="2" ' . $checked_agua_pouco . ' /></td>
                         <td class="tcenter"><input class="opcao3" type="radio" name="agua_' . $count . '" value="1" ' . $checked_agua_nada . ' />
                         <input type="hidden" name="pk_usuario_aluno_' . $count . '" value="' . $row['pk_usuario_aluno'] . '"></td>';
         }
         // Passo 6
         if (isset($_GET['passo']) && $_GET['passo'] == 6) {
             $checked_suco_tudo = '';
             $checked_suco_quase_tudo = '';
             $checked_suco_pouco = '';
             $checked_suco_nada = '';
             if ($row['suco'] == 4) {
                 $checked_suco_tudo = 'checked="checked"';
             } else {
                 if ($row['suco'] == 3) {
                     $checked_suco_quase_tudo = 'checked="checked"';
                 } else {
                     if ($row['suco'] == 2) {
                         $checked_suco_pouco = 'checked="checked"';
                     } else {
                         $checked_suco_nada = 'checked="checked"';
                     }
                 }
             }
             $checked = '';
             if ($checked_suco_tudo == '' && $checked_suco_quase_tudo == '' && $checked_suco_pouco == '' && $checked_suco_nada == '') {
                 $checked = 'checked="checked"';
             }
             $questao = '<td class="tcenter"><input class="opcao1" type="radio" name="suco_' . $count . '" value="4" ' . $checked_suco_tudo . $checked . ' /></td>
                         <td class="tcenter"><input class="opcao2" type="radio" name="suco_' . $count . '" value="3" ' . $checked_suco_quase_tudo . '/></td>
                         <td class="tcenter"><input class="opcao3" type="radio" name="suco_' . $count . '" value="2" ' . $checked_suco_pouco . ' /></td>
                         <td class="tcenter"><input class="opcao4" type="radio" name="suco_' . $count . '" value="1" ' . $checked_suco_nada . ' />
                         <input type="hidden" name="pk_usuario_aluno_' . $count . '" value="' . $row['pk_usuario_aluno'] . '"></td>';
         }
         // Passo 7
         if (isset($_GET['passo']) && $_GET['passo'] == 7) {
             $checked_lanche_tudo = '';
             $checked_lanche_quase_tudo = '';
             $checked_lanche_pouco = '';
             $checked_lanche_nada = '';
             if ($row['lanche'] == 4) {
                 $checked_lanche_tudo = 'checked="checked"';
             } else {
                 if ($row['lanche'] == 3) {
                     $checked_lanche_quase_tudo = 'checked="checked"';
                 } else {
                     if ($row['lanche'] == 2) {
                         $checked_lanche_pouco = 'checked="checked"';
                     } else {
                         if ($row['lanche'] == 1) {
                             $checked_lanche_nada = 'checked="checked"';
                         }
                     }
                 }
             }
             $checked = '';
             if ($checked_lanche_tudo == '' && $checked_lanche_quase_tudo == '' && $checked_lanche_pouco == '' && $checked_lanche_nada == '') {
                 $checked = 'checked="checked"';
             }
             $questao = '<td class="tcenter"><input class="opcao1" type="radio" name="lanche_' . $count . '" value="4" ' . $checked_lanche_tudo . $checked . ' /></td>
                         <td class="tcenter"><input class="opcao2" type="radio" name="lanche_' . $count . '" value="3" ' . $checked_lanche_quase_tudo . ' /></td>
                         <td class="tcenter"><input class="opcao3" type="radio" name="lanche_' . $count . '" value="2" ' . $checked_lanche_pouco . ' /></td>
                         <td class="tcenter"><input class="opcao4" type="radio" name="lanche_' . $count . '" value="1" ' . $checked_lanche_nada . ' />
                         <input type="hidden" name="pk_usuario_aluno_' . $count . '" value="' . $row['pk_usuario_aluno'] . '"></td>';
         }
         // Passo 8
         if (isset($_GET['passo']) && $_GET['passo'] == 8) {
             $questao = '<td class="tcenter"><input class="opcao1" type="text" name="medicacao_' . $count . '" value="' . $row['medicacao'] . '" maxlength="40" class="w120" /></td>
                         <td class="tcenter"><input class="opcao2" type="text" name="medicacao_horario_' . $count . '" value="' . $row['medicacao_horario'] . '" maxlength="5" class="w50" /></td>
                         <td class="tcenter"><input class="opcao3" type="text" name="medicacao_dosagem_' . $count . '" value="' . $row['medicacao_dosagem'] . '" maxlength="10" class="w50" /></td>
                         <td class="tcenter"><input class="opcao4" type="text" name="medicacao_autorizacao_' . $count . '" value="' . $row['medicacao_autorizacao'] . '" maxlength="10" class="w120" />
                         <input type="hidden" name="pk_usuario_aluno_' . $count . '" value="' . $row['pk_usuario_aluno'] . '"></td>';
         }
         // Passo 9
         if (isset($_GET['passo']) && $_GET['passo'] == 9) {
             $ocorrencia_tropecou = $row['ocorrencia_tropecou'] == 1 ? 'checked="checked"' : '';
             $ocorrencia_arranhou = $row['ocorrencia_arranhou'] == 1 ? 'checked="checked"' : '';
             $ocorrencia_caiu = $row['ocorrencia_caiu'] == 1 ? 'checked="checked"' : '';
             $ocorrencia_mordido = $row['ocorrencia_mordido'] == 1 ? 'checked="checked"' : '';
             $ocorrencia_vomitou = $row['ocorrencia_vomitou'] == 1 ? 'checked="checked"' : '';
             $ocorrencia_dor = $row['ocorrencia_dor'] == 1 ? 'checked="checked"' : '';
             $questao = '<td class="tcenter"><input class="opcao1" type="checkbox" name="ocorrencia_tropecou_' . $count . '" value="1" ' . $ocorrencia_tropecou . ' /></td>
                         <td class="tcenter"><input class="opcao2" type="checkbox" name="ocorrencia_arranhou_' . $count . '" value="1" ' . $ocorrencia_arranhou . ' /></td>
                         <td class="tcenter"><input class="opcao3" type="checkbox" name="ocorrencia_caiu_' . $count . '" value="1" ' . $ocorrencia_caiu . ' /></td>
                         <td class="tcenter"><input class="opcao4" type="checkbox" name="ocorrencia_mordido_' . $count . '" value="1" ' . $ocorrencia_mordido . ' /></td>
                         <td class="tcenter"><input class="opcao5" type="checkbox" name="ocorrencia_vomitou_' . $count . '" value="1" ' . $ocorrencia_vomitou . ' /></td>
                         <td class="tcenter"><input class="opcao6" type="checkbox" name="ocorrencia_dor_' . $count . '" value="1" ' . $ocorrencia_dor . ' />
                         <input type="hidden" name="pk_usuario_aluno_' . $count . '" value="' . $row['pk_usuario_aluno'] . '"></td>';
         }
         // Passo 10
         if (isset($_GET['passo']) && $_GET['passo'] == 10) {
             $providencia_lavou = $row['providencia_lavou'] == 1 ? 'checked="checked"' : '';
             $providencia_gelo = $row['providencia_gelo'] == 1 ? 'checked="checked"' : '';
             $providencia_observacao = $row['providencia_observacao'] == 1 ? 'checked="checked"' : '';
             $providencia_curativo = $row['providencia_curativo'] == 1 ? 'checked="checked"' : '';
             $questao = '<td class="tcenter"><input class="opcao1" type="checkbox" name="providencia_lavou_' . $count . '" value="1" ' . $providencia_lavou . ' /></td>
                         <td class="tcenter"><input class="opcao2" type="checkbox" name="providencia_gelo_' . $count . '" value="1" ' . $providencia_gelo . ' /></td>
                         <td class="tcenter"><input class="opcao3" type="checkbox" name="providencia_observacao_' . $count . '" value="1" ' . $providencia_observacao . ' /></td>
                         <td class="tcenter"><input class="opcao4" type="checkbox" name="providencia_curativo_' . $count . '" value="1" ' . $providencia_curativo . ' />
                         <input type="hidden" name="pk_usuario_aluno_' . $count . '" value="' . $row['pk_usuario_aluno'] . '"></td>';
         }
         // Passo 11
         if (isset($_GET['passo']) && $_GET['passo'] == 11) {
             $questao = '<td class="tcenter">
                         <input class="opcao1" type="text" name="obs_' . $count . '" value="' . $row['age_obs'] . '" class="w500" />
                         <input class="opcao1" type="hidden" name="pk_usuario_aluno_' . $count . '" value="' . $row['pk_usuario_aluno'] . '"></td>';
         }
         $table .= $row_start . '<td>' . $row['nome'] . '</td>' . $questao . '</tr>';
     }
     // Passo 1
     if (!isset($_GET['passo'])) {
         $table .= '</tr><tr><td></td>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox1()" /></th>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox2()" /></th>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox3()" /></th>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox4()" /></th>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox5()" /></th>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox6()" /></th>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox7()" /></th>';
     } else {
         if (isset($_GET['passo']) && $_GET['passo'] == 2) {
             $table .= '</tr><tr><td></td>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox1()" /></th>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox2()" /></th>';
         } else {
             if (isset($_GET['passo']) && $_GET['passo'] == 3) {
                 $table .= '</tr><tr><td></td>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox1()" /></th>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox2()" /></th>';
             } else {
                 if (isset($_GET['passo']) && $_GET['passo'] == 4) {
                     $table .= '</tr><tr><td></td>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox1()" /></th>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox2()" /></th>';
                 } else {
                     if (isset($_GET['passo']) && $_GET['passo'] == 5) {
                         $table .= '</tr><tr><td></td>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox1()" /></th>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox2()" /></th>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox3()" /></th>';
                     } else {
                         if (isset($_GET['passo']) && $_GET['passo'] == 6) {
                             $table .= '</tr><tr><td></td>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox1()" /></th>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox2()" /></th>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox3()" /></th>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox4()" /></th>';
                         } else {
                             if (isset($_GET['passo']) && $_GET['passo'] == 7) {
                                 $table .= '</tr><tr><td></td>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox1()" /></th>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox2()" /></th>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox3()" /></th>
             <th class="tcenter"><input type="radio" name="opcao" onClick="MarcarTodosCheckbox4()" /></th>';
                             }
                         }
                     }
                 }
             }
         }
     }
     $table .= '</table>';
     $data['alunos'] = $table;
     $data['title'] = isset($_GET['tipo_registro']) && $_GET['tipo_registro'] == 1 ? 'Inclusão de registros - Educação Infantil - Passo ' . $passo . ' de 15' : 'Inclusão de registros - Educação Integral - Passo ' . $passo . ' de 15';
     $data['cabecalho'] = $_SESSION['cabecalho'];
     $this->load->view($this->load->getUrlTema(), $data);
 }