function Editar()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     @session_write_close();
     /*
      * Atribui valor para atributos usados em Gerar(), senão o formulário volta
      * a liberar os campos Instituição, Escola e Curso que devem ser read-only
      * quando em modo de edição
      */
     $this->ref_cod_instituicao = $this->ref_cod_instituicao_;
     $this->ref_cod_escola = $this->ref_cod_escola_;
     $this->ref_cod_curso = $this->ref_cod_curso_;
     $this->ref_cod_serie = $this->ref_cod_serie_;
     $anoEscolar = new ComponenteCurricular_Model_AnoEscolarDataMapper();
     $componenteAno = $anoEscolar->findComponentePorSerie($this->ref_cod_serie);
     /**
      * @see indice#Novo();
      */
     if (!is_array($this->disciplinas) && (is_array($componenteAno) && 0 < count($componenteAno))) {
         echo "<script>alert('É necessário adicionar pelo menos um componente curricular.');</script>";
         $this->mensagem = 'Edi&ccedil;&atilde;o n&atilde;o realizada.<br>';
         return FALSE;
     }
     $obj = new clsPmieducarEscolaSerie($this->ref_cod_escola, $this->ref_cod_serie, $this->pessoa_logada, NULL, $this->hora_inicial, $this->hora_final, NULL, NULL, 1, $this->hora_inicio_intervalo, $this->hora_fim_intervalo);
     $editou = $obj->edita();
     $obj = new clsPmieducarEscolaSerieDisciplina($this->ref_cod_serie, $this->ref_cod_escola, $campo, 1);
     $obj->excluirTodos();
     if ($editou) {
         if ($this->disciplinas) {
             foreach ($this->disciplinas as $key => $campo) {
                 if (isset($this->usar_componente[$key])) {
                     $carga_horaria = NULL;
                 } else {
                     $carga_horaria = $this->carga_horaria[$key];
                 }
                 $obj = new clsPmieducarEscolaSerieDisciplina($this->ref_cod_serie, $this->ref_cod_escola, $campo, 1, $carga_horaria);
                 $existe = $obj->existe();
                 if ($existe) {
                     $editou1 = $obj->edita();
                     if (!$editou1) {
                         $this->mensagem = 'Edi&ccedil;&atilde;o n&atilde;o realizada.<br>';
                         echo "<!--\nErro ao editar clsPmieducarEscolaSerieDisciplina\nvalores obrigat&oacute;rios\nis_numeric( {$this->ref_cod_serie_} ) && is_numeric( {$this->ref_cod_escola} ) && is_numeric( {$campo[$i]} ) \n-->";
                         return FALSE;
                     }
                 } else {
                     $cadastrou = $obj->cadastra();
                     if (!$cadastrou) {
                         $this->mensagem = 'Cadastro n&atilde;o realizada.<br>';
                         echo "<!--\nErro ao editar clsPmieducarEscolaSerieDisciplina\nvalores obrigat&oacute;rios\nis_numeric( {$this->ref_cod_serie_} ) && is_numeric( {$this->ref_cod_escola} ) && is_numeric( {$campo[$i]} ) \n-->";
                         return FALSE;
                     }
                 }
             }
         }
         $this->mensagem .= 'Edi&ccedil;&atilde;o efetuada com sucesso.<br>';
         header('Location: educar_escola_serie_lst.php');
         die;
     }
     $this->mensagem = 'Edi&ccedil;&atilde;o n&atilde;o realizada.<br>';
     return FALSE;
 }
Exemplo n.º 2
0
 function Gerar()
 {
     if ($_POST) {
         foreach ($_POST as $campo => $val) {
             $this->{$campo} = $this->{$campo} ? $this->{$campo} : $val;
         }
     }
     $this->campoOculto('cod_turma', $this->cod_turma);
     // foreign keys
     $obrigatorio = FALSE;
     $instituicao_obrigatorio = TRUE;
     $escola_curso_obrigatorio = TRUE;
     $curso_obrigatorio = TRUE;
     $get_escola = TRUE;
     $get_escola_curso_serie = FALSE;
     $sem_padrao = TRUE;
     $get_curso = TRUE;
     $bloqueia = false;
     $anoVisivel = false;
     if (isset($this->ano) || !is_numeric($this->cod_turma)) {
         $anoVisivel = true;
     }
     if (!isset($this->cod_turma)) {
         $bloqueia = false;
     } else {
         if (is_numeric($this->cod_turma)) {
             $obj_matriculas_turma = new clsPmieducarMatriculaTurma();
             $obj_matriculas_turma->setOrderby('nome_aluno');
             $lst_matriculas_turma = $obj_matriculas_turma->lista(NULL, $this->cod_turma, NULL, NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, array(1, 2, 3), NULL, NULL, NULL, NULL, TRUE, NULL, 1, TRUE);
             if (is_array($lst_matriculas_turma) && count($lst_matriculas_turma) > 0) {
                 $bloqueia = true;
             }
         }
     }
     $desabilitado = $bloqueia;
     include 'include/pmieducar/educar_campo_lista.php';
     if ($this->ref_cod_escola) {
         $this->ref_ref_cod_escola = $this->ref_cod_escola;
     }
     $opcoes_serie = array('' => 'Selecione');
     // Editar
     if ($this->ref_cod_curso) {
         $obj_serie = new clsPmieducarSerie();
         $obj_serie->setOrderby('nm_serie ASC');
         $lst_serie = $obj_serie->lista(NULL, NULL, NULL, $this->ref_cod_curso, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);
         if (is_array($lst_serie) && count($lst_serie)) {
             foreach ($lst_serie as $serie) {
                 $opcoes_serie[$serie['cod_serie']] = $serie['nm_serie'];
             }
         }
     }
     if ($bloqueia) {
         $this->campoOculto('serie_param', $this->serie_param = $this->ref_ref_cod_serie);
         $this->campoOculto('escola_param', $this->escola_param = $this->ref_cod_escola);
     }
     $this->campoLista('ref_ref_cod_serie', 'Série', $opcoes_serie, $this->ref_ref_cod_serie, '', FALSE, '', NULL, $bloqueia);
     // o campo ano somente é exibido para turmas novas  ou cadastradas após inclusão deste campo.
     if ($anoVisivel) {
         $this->inputsHelper()->dynamic('anoLetivo', array('disabled' => $bloqueia));
         if ($bloqueia) {
             $this->inputsHelper()->hidden('ano_hidden', array('value' => $this->ano));
         }
     }
     // Infra prédio cômodo
     $opcoes = array('' => 'Selecione');
     // Editar
     if ($this->ref_ref_cod_escola) {
         $obj_infra_predio = new clsPmieducarInfraPredio();
         $obj_infra_predio->setOrderby('nm_predio ASC');
         $lst_infra_predio = $obj_infra_predio->lista(NULL, NULL, NULL, $this->ref_ref_cod_escola, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);
         if (is_array($lst_infra_predio) && count($lst_infra_predio)) {
             foreach ($lst_infra_predio as $predio) {
                 $obj_infra_predio_comodo = new clsPmieducarInfraPredioComodo();
                 $lst_infra_predio_comodo = $obj_infra_predio_comodo->lista(NULL, NULL, NULL, NULL, $predio['cod_infra_predio'], NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1);
                 if (is_array($lst_infra_predio_comodo) && count($lst_infra_predio_comodo)) {
                     foreach ($lst_infra_predio_comodo as $comodo) {
                         $opcoes[$comodo['cod_infra_predio_comodo']] = $comodo['nm_comodo'];
                     }
                 }
             }
         }
     }
     $this->campoLista('ref_cod_infra_predio_comodo', 'Sala', $opcoes, $this->ref_cod_infra_predio_comodo, NULL, NULL, NULL, NULL, NULL, FALSE);
     $array_servidor = array('' => 'Selecione um servidor');
     if ($this->ref_cod_regente) {
         $obj_pessoa = new clsPessoa_($this->ref_cod_regente);
         $det = $obj_pessoa->detalhe();
         $array_servidor[$this->ref_cod_regente] = $det['nome'];
     }
     $this->campoListaPesq('ref_cod_regente', 'Professor/Regente', $array_servidor, $this->ref_cod_regente, '', '', FALSE, '', '', NULL, NULL, '', TRUE, FALSE, FALSE);
     // Turma tipo
     $opcoes = array('' => 'Selecione');
     // Editar
     if ($this->ref_cod_instituicao) {
         $objTemp = new clsPmieducarTurmaTipo();
         $objTemp->setOrderby('nm_tipo ASC');
         $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_instituicao);
         if (is_array($lista) && count($lista)) {
             foreach ($lista as $registro) {
                 $opcoes[$registro['cod_turma_tipo']] = $registro['nm_tipo'];
             }
         }
     }
     $this->campoLista('ref_cod_turma_tipo', 'Tipo de Turma', $opcoes, $this->ref_cod_turma_tipo, '', FALSE, '', NULL);
     $this->campoTexto('nm_turma', 'Turma', $this->nm_turma, 30, 255, TRUE);
     $this->campoTexto('sgl_turma', 'Sigla', $this->sgl_turma, 15, 15, FALSE);
     $this->campoNumero('max_aluno', 'Máximo de Alunos', $this->max_aluno, 3, 3, TRUE);
     $this->inputsHelper()->date('data_fechamento', array('required' => false, 'label' => 'Data de fechamento', 'value' => Portabilis_Date_Utils::pgSQLToBr($this->data_fechamento)));
     $ativo = isset($this->cod_turma) ? dbBool($this->visivel) : true;
     $this->campoCheck('visivel', 'Ativo', $ativo);
     $this->campoCheck('multiseriada', 'Multi-Seriada', $this->multiseriada, '', FALSE, FALSE);
     $this->campoLista('ref_ref_cod_serie_mult', 'Série', array('' => 'Selecione'), '', '', FALSE, '', '', '', FALSE);
     $this->campoOculto('ref_ref_cod_serie_mult_', $this->ref_ref_cod_serie_mult);
     $this->campoQuebra2();
     // hora
     $this->campoHora('hora_inicial', 'Hora Inicial', $this->hora_inicial, FALSE);
     $this->campoHora('hora_final', 'Hora Final', $this->hora_final, FALSE);
     $this->campoHora('hora_inicio_intervalo', Portabilis_String_Utils::toLatin1('Hora Início Intervalo'), $this->hora_inicio_intervalo, FALSE);
     $this->campoHora('hora_fim_intervalo', 'Hora Fim Intervalo', $this->hora_fim_intervalo, FALSE);
     $this->inputsHelper()->turmaTurno();
     // modelos boletim
     require_once 'Portabilis/Model/Report/TipoBoletim.php';
     require_once 'Portabilis/Array/Utils.php';
     $tiposBoletim = Portabilis_Model_Report_TipoBoletim::getInstance()->getEnums();
     $tiposBoletim = Portabilis_Array_Utils::insertIn(null, "Selecione um modelo", $tiposBoletim);
     $this->campoLista('tipo_boletim', Portabilis_String_Utils::toLatin1('Modelo relatório boletim'), $tiposBoletim, $this->tipo_boletim);
     $this->campoQuebra2();
     if ($this->ref_ref_cod_serie) {
         require_once 'ComponenteCurricular/Model/ComponenteDataMapper.php';
         require_once 'ComponenteCurricular/Model/AnoEscolarDataMapper.php';
         require_once 'ComponenteCurricular/Model/TurmaDataMapper.php';
         $disciplinas = '';
         $conteudo = '';
         // Instancia o mapper de componente curricular
         $mapper = new ComponenteCurricular_Model_ComponenteDataMapper();
         // Instancia o mapper de ano escolar
         $anoEscolar = new ComponenteCurricular_Model_AnoEscolarDataMapper();
         $lista = $anoEscolar->findComponentePorSerie($this->ref_ref_cod_serie);
         // Instancia o mapper de turma
         $componenteTurmaMapper = new ComponenteCurricular_Model_TurmaDataMapper();
         $componentesTurma = array();
         if (isset($this->cod_turma) && is_numeric($this->cod_turma)) {
             $componentesTurma = $componenteTurmaMapper->findAll(array(), array('turma' => $this->cod_turma));
         }
         $componentes = array();
         foreach ($componentesTurma as $componenteTurma) {
             $componentes[$componenteTurma->get('componenteCurricular')] = $componenteTurma;
         }
         unset($componentesTurma);
         $this->escola_serie_disciplina = array();
         if (is_array($lista) && count($lista)) {
             $conteudo .= '<div style="margin-bottom: 10px;">';
             $conteudo .= '  <span style="display: block; float: left; width: 250px;">Nome</span>';
             $conteudo .= '  <span style="display: block; float: left; width: 100px;">' . Portabilis_String_Utils::toLatin1('Carga horária') . '</span>';
             $conteudo .= '  <span style="display: block; float: left">' . Portabilis_String_Utils::toLatin1('Usar padrão do componente?') . '</span>';
             $conteudo .= '</div>';
             $conteudo .= '<br style="clear: left" />';
             foreach ($lista as $registro) {
                 $checked = '';
                 $usarComponente = FALSE;
                 if (isset($componentes[$registro->id])) {
                     $checked = 'checked="checked"';
                 }
                 if (is_null($componentes[$registro->id]->cargaHoraria) || 0 == $componentes[$registro->id]->cargaHoraria) {
                     $usarComponente = TRUE;
                 } else {
                     $cargaHoraria = $componentes[$registro->id]->cargaHoraria;
                 }
                 $cargaComponente = $registro->cargaHoraria;
                 $conteudo .= '<div style="margin-bottom: 10px; float: left">';
                 $conteudo .= "  <label style='display: block; float: left; width: 250px'><input type=\"checkbox\" {$checked} name=\"disciplinas[{$registro->id}]\" id=\"disciplinas[]\" value=\"{$registro->id}\">{$registro}</label>";
                 $conteudo .= "  <label style='display: block; float: left; width: 100px;'><input type='text' name='carga_horaria[{$registro->id}]' value='{$cargaHoraria}' size='5' maxlength='7'></label>";
                 $conteudo .= "  <label style='display: block; float: left'><input type='checkbox' name='usar_componente[{$registro->id}]' value='1' " . ($usarComponente == TRUE ? $checked : '') . ">({$cargaComponente} h)</label>";
                 $conteudo .= '</div>';
                 $conteudo .= '<br style="clear: left" />';
                 $cargaHoraria = '';
             }
             $disciplinas = '<table cellspacing="0" cellpadding="0" border="0">';
             $disciplinas .= sprintf('<tr align="left"><td>%s</td></tr>', $conteudo);
             $disciplinas .= '</table>';
         } else {
             $disciplinas = Portabilis_String_Utils::toLatin1('A série/ano escolar não possui componentes curriculares cadastrados.');
         }
     }
     $componentes = $help = array();
     try {
         $componentes = App_Model_IedFinder::getEscolaSerieDisciplina($this->ref_ref_cod_serie, $this->ref_cod_escola);
     } catch (Exception $e) {
     }
     foreach ($componentes as $componente) {
         $help[] = sprintf('%s (%.0f h)', $componente->nome, $componente->cargaHoraria);
     }
     if (count($componentes)) {
         $help = '<ul><li>' . implode('</li><li>', $help) . '</li></ul>';
     } else {
         $help = '';
     }
     $label = 'Componentes curriculares:<br />' . '<strong>Observa&ccedil;&atilde;o:</strong> caso n&atilde;o defina os componentes<br />' . 'curriculares para a turma, esta usar&aacute; a defini&ccedil;&atilde;o<br />' . 'da s&eacute;rie/ano escolar da escola:' . '<span id="_escola_serie_componentes">%s</span>';
     $label = sprintf($label, $help);
     $this->campoRotulo('disciplinas_', $label, "<div id='disciplinas'>{$disciplinas}</div>");
     $this->campoQuebra2();
     if ($_POST['turma_modulo']) {
         $this->turma_modulo = unserialize(urldecode($_POST['turma_modulo']));
     }
     $qtd_modulo = count($this->turma_modulo) == 0 ? 1 : count($this->turma_modulo) + 1;
     if (is_numeric($this->cod_turma) && !$_POST) {
         $obj = new clsPmieducarTurmaModulo();
         $registros = $obj->lista($this->cod_turma);
         if ($registros) {
             foreach ($registros as $campo) {
                 $this->turma_modulo[$campo[$qtd_modulo]]['sequencial_'] = $campo['sequencial'];
                 $this->turma_modulo[$campo[$qtd_modulo]]['ref_cod_modulo_'] = $campo['ref_cod_modulo'];
                 $this->turma_modulo[$campo[$qtd_modulo]]['data_inicio_'] = dataFromPgToBr($campo['data_inicio']);
                 $this->turma_modulo[$campo[$qtd_modulo]]['data_fim_'] = dataFromPgToBr($campo['data_fim']);
                 $qtd_modulo++;
             }
         }
     }
     if ($_POST["ref_cod_modulo"] && $_POST["data_inicio"] && $_POST["data_fim"]) {
         $this->turma_modulo[$qtd_modulo]["sequencial_"] = $qtd_modulo;
         $this->turma_modulo[$qtd_modulo]["ref_cod_modulo_"] = $_POST["ref_cod_modulo"];
         $this->turma_modulo[$qtd_modulo]["data_inicio_"] = $_POST["data_inicio"];
         $this->turma_modulo[$qtd_modulo]["data_fim_"] = $_POST["data_fim"];
         $qtd_modulo++;
         unset($this->ref_cod_modulo);
         unset($this->data_inicio);
         unset($this->data_fim);
     }
     $this->campoOculto("excluir_modulo", "");
     $qtd_modulo = 1;
     unset($aux);
     if ($this->turma_modulo) {
         foreach ($this->turma_modulo as $campo) {
             if ($this->excluir_modulo == $campo['sequencial_']) {
                 $this->turma_modulo[$campo['sequencial']] = NULL;
                 $this->excluir_modulo = NULL;
             } else {
                 $obj_modulo = new clsPmieducarModulo($campo['ref_cod_modulo_']);
                 $det_modulo = $obj_modulo->detalhe();
                 $nm_tipo_modulo = $det_modulo['nm_tipo'];
                 $this->campoTextoInv('ref_cod_modulo_' . $campo['sequencial_'], '', $nm_tipo_modulo, 30, 255, FALSE, FALSE, TRUE, '', '', '', '', 'ref_cod_modulo');
                 $this->campoTextoInv('data_inicio_' . $campo['sequencial_'], '', $campo['data_inicio_'], 10, 10, FALSE, FALSE, TRUE, '', '', '', '', '');
                 $this->campoTextoInv('data_fim_' . $campo['sequencial_'], '', $campo['data_fim_'], 10, 10, FALSE, FALSE, FALSE, '', "<a href='#' onclick=\"document.getElementById('excluir_modulo').value = '{$campo["sequencial_"]}'; document.getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bola_xis.gif' title='Excluir' border=0></a>", '', '', '');
                 $aux[$qtd_modulo]['sequencial_'] = $qtd_modulo;
                 $aux[$qtd_modulo]['ref_cod_modulo_'] = $campo['ref_cod_modulo_'];
                 $aux[$qtd_modulo]['data_inicio_'] = $campo['data_inicio_'];
                 $aux[$qtd_modulo]['data_fim_'] = $campo['data_fim_'];
                 $qtd_modulo++;
             }
         }
         unset($this->turma_modulo);
         $this->turma_modulo = $aux;
     }
     $this->campoOculto('turma_modulo', serialize($this->turma_modulo));
     // Módulo
     // foreign keys
     $opcoes = array('' => 'Selecione');
     // Editar
     if ($this->ref_cod_instituicao) {
         $objTemp = new clsPmieducarModulo();
         $objTemp->setOrderby('nm_tipo ASC');
         $lista = $objTemp->lista(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, $this->ref_cod_instituicao);
         if (is_array($lista) && count($lista)) {
             foreach ($lista as $registro) {
                 $opcoes[$registro['cod_modulo']] = $registro['nm_tipo'];
             }
         }
     }
     $this->campoLista('ref_cod_modulo', Portabilis_String_utils::toLatin1('Módulo'), $opcoes, $this->ref_cod_modulo, NULL, NULL, NULL, NULL, NULL, FALSE);
     $this->campoData('data_inicio', Portabilis_String_utils::toLatin1('Data Início'), $this->data_inicio, FALSE);
     $this->campoData('data_fim', 'Data Fim', $this->data_fim, FALSE);
     $this->campoOculto('incluir_modulo', '');
     $this->campoRotulo('bt_incluir_modulo', Portabilis_String_utils::toLatin1('Módulo'), "<a href='#' onclick=\"document.getElementById('incluir_modulo').value = 'S'; document.getElementById('tipoacao').value = ''; acao();\"><img src='imagens/nvp_bot_adiciona.gif' alt='adicionar' title='Incluir' border=0></a>");
     $this->campoQuebra2();
     if ($_POST['turma_dia_semana']) {
         $this->turma_dia_semana = unserialize(urldecode($_POST['turma_dia_semana']));
     }
     if (is_numeric($this->cod_turma) && !$_POST) {
         $obj = new clsPmieducarTurmaDiaSemana();
         $registros = $obj->lista(NULL, $this->cod_turma);
         if ($registros) {
             foreach ($registros as $campo) {
                 $aux['dia_semana_'] = $campo['dia_semana'];
                 $aux['hora_inicial_'] = $campo['hora_inicial'];
                 $aux['hora_final_'] = $campo['hora_final'];
                 $this->turma_dia_semana[] = $aux;
             }
         }
     }
     unset($aux);
     if ($_POST['dia_semana'] && $_POST['ds_hora_inicial'] && $_POST['ds_hora_final']) {
         $aux['dia_semana_'] = $_POST['dia_semana'];
         $aux['hora_inicial_'] = $_POST['ds_hora_inicial'];
         $aux['hora_final_'] = $_POST['ds_hora_final'];
         $this->turma_dia_semana[] = $aux;
         unset($this->dia_semana);
         unset($this->ds_hora_inicial);
         unset($this->ds_hora_final);
     }
     $this->campoOculto('excluir_dia_semana', '');
     unset($aux);
     if ($this->turma_dia_semana) {
         foreach ($this->turma_dia_semana as $key => $dias_semana) {
             if ($this->excluir_dia_semana == $dias_semana['dia_semana_']) {
                 unset($this->turma_dia_semana[$key]);
                 unset($this->excluir_dia_semana);
             } else {
                 $nm_dia_semana = $this->dias_da_semana[$dias_semana['dia_semana_']];
                 $this->campoTextoInv('dia_semana_' . $dias_semana['dia_semana_'], '', $nm_dia_semana, 8, 8, FALSE, FALSE, TRUE, '', '', '', '', 'dia_semana');
                 $this->campoTextoInv('hora_inicial_' . $dias_semana['dia_semana_'], '', $dias_semana['hora_inicial_'], 5, 5, FALSE, FALSE, TRUE, '', '', '', '', 'ds_hora_inicial_');
                 $this->campoTextoInv('hora_final_' . $dias_semana['dia_semana_'], '', $dias_semana['hora_final_'], 5, 5, FALSE, FALSE, FALSE, '', "<a href='#' onclick=\"document.getElementById('excluir_dia_semana').value = '{$dias_semana["dia_semana_"]}'; document.getElementById('tipoacao').value = ''; {$this->__nome}.submit();\"><img src='imagens/nvp_bola_xis.gif' title='Excluir' border=0></a>", '', '', 'ds_hora_final_');
                 $aux['dia_semana_'] = $dias_semana['dia_semana_'];
                 $aux['hora_inicial_'] = $dias_semana['hora_inicial_'];
                 $aux['hora_final_'] = $dias_semana['hora_final_'];
             }
         }
     }
     $this->campoOculto('turma_dia_semana', serialize($this->turma_dia_semana));
     if (class_exists('clsPmieducarTurmaDiaSemana')) {
         $opcoes = $this->dias_da_semana;
     } else {
         echo '<!--\\nErro\\nClasse clsPmieducarTurmaDiaSemana não encontrada\\n-->';
         $opcoes = array('' => Portabilis_String_utils::toLatin1('Erro na geração'));
     }
     $this->campoLista('dia_semana', 'Dia Semana', $opcoes, $this->dia_semana, NULL, false, '', '', false, false);
     $this->campoHora('ds_hora_inicial', 'Hora Inicial', $this->ds_hora_inicial, FALSE);
     $this->campoHora('ds_hora_final', 'Hora Final', $this->ds_hora_final, FALSE);
     $this->campoOculto('incluir_dia_semana', '');
     $this->campoRotulo('bt_incluir_dia_semana', 'Dia Semana', "<a href='#' onclick=\"document.getElementById('incluir_dia_semana').value = 'S'; document.getElementById('tipoacao').value = ''; acao();\"><img src='imagens/nvp_bot_adiciona.gif' alt='adicionar' title='Incluir' border=0></a>");
     $this->campoOculto('padrao_ano_escolar', $this->padrao_ano_escolar);
     $this->acao_enviar = 'valida()';
 }
Exemplo n.º 3
0
 * @author    Prefeitura Municipal de Itajaí <*****@*****.**>
 * @category  i-Educar
 * @license   @@license@@
 * @package   iEd_Pmieducar
 * @since     Arquivo disponível desde a versão 1.0.0
 * @version   $Id$
 */
header('Content-type: text/xml; charset=ISO-8859-1');
require_once 'include/clsBanco.inc.php';
require_once 'include/funcoes.inc.php';
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-15\"?>\n<query xmlns=\"sugestoes\">\n";
$componentes = array();
// Seleciona os componentes de um curso ou série
if (is_numeric($_GET['cur']) || is_numeric($_GET['ser'])) {
    require_once 'ComponenteCurricular/Model/AnoEscolarDataMapper.php';
    $mapper = new ComponenteCurricular_Model_AnoEscolarDataMapper();
    if (is_numeric($_GET['cur'])) {
        $componentes = $mapper->findComponentePorCurso($_GET['cur']);
    } elseif (is_numeric($_GET['ser'])) {
        $componentes = $mapper->findComponentePorSerie($_GET['ser']);
    }
}
// Seleciona os componentes de uma escola-série
if (is_numeric($_GET['esc']) && is_numeric($_GET['ser'])) {
    require_once 'App/Model/IedFinder.php';
    $componentes = App_Model_IedFinder::getEscolaSerieDisciplina($_GET['ser'], $_GET['esc']);
}
foreach ($componentes as $componente) {
    print sprintf(' <disciplina cod_disciplina="%d" carga_horaria="%d">%s</disciplina>%s', $componente->id, $componente->cargaHoraria, $componente, PHP_EOL);
}
echo "</query>";