コード例 #1
0
 function finalizarAnoLetivo()
 {
     /**
      * VERIFICA se n�o existem matriculas em andamento
      */
     $obj_matriculas = new clsPmieducarMatricula();
     $existe_matricula_andamento_com_curso = $obj_matriculas->lista(null, null, $this->ref_cod_escola, null, null, null, null, 3, null, null, null, null, 1, $this->ano, null, null, 1, null, null, null, null, null, null, null, null, false);
     if ($existe_matricula_andamento_com_curso) {
         echo "<script>\n\t\t\t\t\talert('Não foi possível finalizar o ano letivo existem matrículas em andamento!');\n\t\t\t\t\twindow.location = 'educar_escola_det.php?cod_escola={$this->ref_cod_escola}';\n\t\t\t\t  </script>";
     }
     $obj_matriculas = new clsPmieducarMatricula(null, null, $this->ref_cod_escola, null, $this->pessoa_logada, null, null, null, null, null, 1, $this->ano);
     $existe_matricula_andamento = $obj_matriculas->lista(null, null, $this->ref_cod_escola, null, null, null, null, 3, null, null, null, null, 1, $this->ano, null, null, 1, null, null, null, null, null, null, null, null, true);
     if ($existe_matricula_andamento) {
         $editou = $obj_matriculas->aprova_matricula_andamento_curso_sem_avaliacao();
         if (!editou) {
             echo "<script>\n\t\t\t\t\t\talert('Não foi possível finalizar o ano letivo.\\nErro ao editar matriculas de curso sem avaliação!');\n\t\t\t\t\t\twindow.location = 'educar_escola_det.php?cod_escola={$this->ref_cod_escola}';\n\t\t\t\t\t  </script>";
         }
     }
     /**
      *  FINALIZA ano letivo
      */
     $obj_ano_letivo = new clsPmieducarEscolaAnoLetivo($this->ref_cod_escola, $this->ano, $this->pessoa_logada, $this->pessoa_logada, 2, null, null, 1);
     if (!$obj_ano_letivo->edita()) {
         echo "<script>\n\t\t\t\t\talert('Erro ao finalizar o ano letivo!');\n\t\t\t\t\twindow.location = 'educar_escola_det.php?cod_escola={$this->ref_cod_escola}#ano_letivo';\n\t\t\t\t  </script>";
     } else {
         echo "<script>\n\t\t\t\t\talert('Ano letivo finalizado com sucesso!');\n\t\t\t\t\twindow.location = 'educar_escola_det.php?cod_escola={$this->ref_cod_escola}#ano_letivo';\n\t\t\t\t  </script>";
     }
 }
コード例 #2
0
 /**
  * Cria um novo registro
  *
  * @return bool
  */
 function cadastra()
 {
     if (is_numeric($this->ref_ano) && is_numeric($this->ref_ref_cod_escola) && is_numeric($this->sequencial) && is_numeric($this->ref_cod_modulo) && is_string($this->data_inicio) && is_string($this->data_fim)) {
         $db = new clsBanco();
         $campos = "";
         $valores = "";
         $gruda = "";
         if (is_numeric($this->ref_ano)) {
             $campos .= "{$gruda}ref_ano";
             $valores .= "{$gruda}'{$this->ref_ano}'";
             $gruda = ", ";
         }
         if (is_numeric($this->ref_ref_cod_escola)) {
             $campos .= "{$gruda}ref_ref_cod_escola";
             $valores .= "{$gruda}'{$this->ref_ref_cod_escola}'";
             $gruda = ", ";
         }
         if (is_numeric($this->sequencial)) {
             $campos .= "{$gruda}sequencial";
             $valores .= "{$gruda}'{$this->sequencial}'";
             $gruda = ", ";
         }
         if (is_numeric($this->ref_cod_modulo)) {
             $campos .= "{$gruda}ref_cod_modulo";
             $valores .= "{$gruda}'{$this->ref_cod_modulo}'";
             $gruda = ", ";
         }
         if (is_string($this->data_inicio)) {
             $campos .= "{$gruda}data_inicio";
             $valores .= "{$gruda}'{$this->data_inicio}'";
             $gruda = ", ";
         }
         if (is_string($this->data_fim)) {
             $campos .= "{$gruda}data_fim";
             $valores .= "{$gruda}'{$this->data_fim}'";
             $gruda = ", ";
         }
         // ativa escolaAnoLetivo se estiver desativado
         // (quando o escolaAnoLetivo é 'excluido' o registro não é removido)
         $escolaAnoLetivo = new clsPmieducarEscolaAnoLetivo($this->ref_ref_cod_escola, $this->ref_ano, null, $_SESSION['id_pessoa'], null, null, null, 1);
         $escolaAnoLetivoDetalhe = $escolaAnoLetivo->detalhe();
         if (isset($escolaAnoLetivoDetalhe['ativo']) and $escolaAnoLetivoDetalhe['ativo'] != '1') {
             $escolaAnoLetivo->edita();
         }
         $db->Consulta("INSERT INTO {$this->_tabela} ( {$campos} ) VALUES( {$valores} )");
         return true;
     }
     return false;
 }