public function cadastrar_registros_turma() { $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_turma'; $data['alias'] = 'cadastrar_registros_turma'; if ($_SERVER['REQUEST_METHOD'] == "POST") { try { // View::validarFormAntInjection($alias); $sqlAgenda = new SqlAgenda(); $sqlAgenda->reset_atividades($this->input->post('pk_age_aula')); if ($this->input->post('pk_age_atividade') != false) { foreach ($this->input->post('pk_age_atividade') as $row) { $sqlAgenda = new SqlAgenda(); $pk_atividade_vin = $sqlAgenda->insert_atividade($this->input->post('pk_age_aula'), $row); $_SESSION['pk_age_aula'] = $this->input->post('pk_age_aula'); if ($row == 6) { $sqlAgenda = new SqlAgenda(); $pk_atividade_vin = $sqlAgenda->insert_atividade_obs($pk_atividade_vin, $this->input->post('outro')); } } } $tarefas = $this->input->post('tarefas') != '' ? $this->input->post('tarefas') : ''; $recados = $this->input->post('recados') != '' ? $this->input->post('recados') : ''; $oficinas = $this->input->post('oficinas') != '' ? $this->input->post('oficinas') : ''; $sqlAgenda = new SqlAgenda(); $sqlAgenda->update_aula($this->input->post('pk_age_aula'), $tarefas, $recados, $oficinas); $sqlAgenda = new SqlAgenda(); $sqlAgenda->reset_conteudos($this->input->post('pk_age_aula')); for ($i = 1; $i <= $this->input->post('materias_total'); $i++) { if ($this->input->post('pk_materia_' . $i) != false) { $sqlAgenda = new SqlAgenda(); $sqlAgenda->insert_materia_conteudo($this->input->post('pk_age_aula'), $this->input->post('pk_materia_' . $i), $this->input->post('conteudo_' . $i)); } } $sqlAgenda = new SqlAgenda(); $sqlAgenda->update_passo($this->input->post('pk_age_aula'), 12); redirect(base_url() . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/cadastrar_fotos?tipo_registro=' . $this->input->post('tipo_registro') . '&pk_age_aula=' . $this->input->post('pk_age_aula')); return false; } catch (Exception $e) { $msg = '<p class="alert erro">' . $e->getMessage() . '</p>'; } } // listar atividades $sqlAgenda = new SqlAgenda(); $result = $sqlAgenda->listar_atividades_vin($_SESSION['age_pk_aula'], $_GET['tipo_registro']); $data['total'] = count($result); $table = '<table class="table mt10">'; $table .= '<tr><th colspan="2">Atividades que os alunos participaram</th></tr>'; $count = 0; foreach ($result as $row) { $count++; $tmpl = Util::zebrar($count, $data['total']); $row_start = $tmpl['row_start']; $checked = $row['pk_atividade_vin'] != '' ? 'checked="checked"' : ''; $outro = $row['age_atividade_nome'] == 'Outro' ? '<input type="text" name="outro" value="' . $row['atividade_outro'] . '" class="w150" maxlength="150" ' . $checked . ' />' : ''; $table .= $row_start . '<td class="tcenter"><input type="checkbox" name="pk_age_atividade[]" value="' . $row['pk_age_atividade'] . '" ' . $checked . ' /></td> <td>' . $row['age_atividade_nome'] . ' ' . $outro . '</td></tr>'; } $table .= '</table>'; $data['atividades'] = $table; // listar aula $sqlAgenda = new SqlAgenda(); $result = $sqlAgenda->get_aula($_SESSION['age_pk_aula']); $tarefas = $result[0]['tarefas']; $recados = $result[0]['recados']; $oficinas = $result[0]['oficinas']; if (isset($_GET['tipo_registro']) && $_GET['tipo_registro'] == 1) { // materias $sqlAgenda = new SqlAgenda(); $result = $sqlAgenda->listar_materias_turma($_SESSION['age_pk_turma'], $_SESSION['age_pk_aula'], $data['ano_letivo']); $data['materias_total'] = $result['total']; $table = '<table class="table mt10">'; $table .= '<tr><th></th><th>Aulas</th><th>Conteúdos</th></tr>'; $count = 0; foreach ($result['registros'] as $row) { $count++; $tmpl = Util::zebrar($count, $data['total']); $row_start = $tmpl['row_start']; $checked = $row['fk_materia'] != '' ? 'checked="checked"' : ''; $table .= $row_start . '<td class="tcenter"><input type="checkbox" name="pk_materia_' . $count . '" value="' . $row['pk_materia'] . '" ' . $checked . ' /></td> <td>' . $row['materia_nome'] . '</td> <td><input type="text" name="conteudo_' . $count . '" value="' . $row['conteudo'] . '" class="w500" maxlength="255" /></td></tr>'; } $table .= '</table>'; $data['materias'] = $table; // tarefas de casa $table = '<table class="table mt10">'; $table .= '<tr><th>Tarefas de casa</th></tr>'; $table .= '<tr><td><textarea name="tarefas" class="w500 h50" maxlength="255">' . $tarefas . '</textarea></td></tr>'; $table .= '</table>'; $data['tarefas'] = $table; } else { // Campo descritivo do professor (oficinas) $table = '<table class="table mt10">'; $table .= '<tr><th>Campo descritivo do professor (oficinas)</th></tr>'; $table .= '<tr><td><textarea name="oficinas" class="w500 h50" maxlength="255">' . $oficinas . '</textarea></td></tr>'; $table .= '</table>'; $data['oficinas'] = $table; } // recados para a turma $table = '<table class="table mt10">'; $table .= '<tr><th>Recados para a turma</th></tr>'; $table .= '<tr><td><textarea name="recados" class="w500 h50" maxlength="255">' . $recados . '</textarea></td></tr>'; $table .= '</table>'; $data['recados'] = $table; $data['title'] = isset($_GET['tipo_registro']) && $_GET['tipo_registro'] == 1 ? 'Inclusão de registros - Educação Infantil - Passo 12 de 15' : 'Inclusão de registros - Educação Integral - Passo 12 de 15'; $data['cabecalho'] = $_SESSION['cabecalho']; $this->load->view($this->load->getUrlTema(), $data); }