Commit 4cb18fe22fd81e6d48386d215c83a83a867dec61
1 parent
f769b724
Exists in
master
#24 Listando somente turmas do ano atual nas listas de enturmações
Showing
3 changed files
with
260 additions
and
4 deletions
Show diff stats
ieducar/intranet/educar_matricula_turma_lst.php
... | ... | @@ -138,7 +138,7 @@ class indice extends clsListagem |
138 | 138 | |
139 | 139 | // Opções de turma |
140 | 140 | $objTemp = new clsPmieducarTurma(); |
141 | - $lista = $objTemp->lista(NULL, NULL, NULL, $this->ref_cod_serie, | |
141 | + $lista = $objTemp->lista3(NULL, NULL, NULL, $this->ref_cod_serie, | |
142 | 142 | $this->ref_cod_escola, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
143 | 143 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
144 | 144 | $this->ref_cod_curso); |
... | ... | @@ -169,7 +169,7 @@ class indice extends clsListagem |
169 | 169 | $obj_matricula_turma->setOrderby('data_cadastro ASC'); |
170 | 170 | $obj_matricula_turma->setLimite($this->limite, $this->offset); |
171 | 171 | |
172 | - $lista = $obj_matricula_turma->lista($this->ref_cod_turma, NULL, NULL, | |
172 | + $lista = $obj_matricula_turma->lista3($this->ref_cod_turma, NULL, NULL, | |
173 | 173 | $this->ref_cod_serie,$this->ref_cod_escola, NULL, NULL, NULL, NULL, NULL, |
174 | 174 | NULL, NULL, NULL, NULL,1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
175 | 175 | NULL,$this->ref_cod_curso, NULL, NULL, NULL, NULL, NULL, NULL, TRUE); |
... | ... | @@ -216,7 +216,7 @@ WHERE |
216 | 216 | } |
217 | 217 | |
218 | 218 | $enturmacoesMatricula = new clsPmieducarMatriculaTurma(); |
219 | - $enturmacoesMatricula = $enturmacoesMatricula->lista($this->ref_cod_matricula, NULL, NULL, | |
219 | + $enturmacoesMatricula = $enturmacoesMatricula->lista3($this->ref_cod_matricula, NULL, NULL, | |
220 | 220 | NULL, NULL, NULL, NULL, NULL, 1); |
221 | 221 | |
222 | 222 | $turmasThisSerie = $lista; | ... | ... |
ieducar/intranet/educar_matriculas_turma_lst.php
... | ... | @@ -128,7 +128,7 @@ class indice extends clsListagem |
128 | 128 | $obj_turma->setOrderby( "nm_turma ASC" ); |
129 | 129 | $obj_turma->setLimite( $this->limite, $this->offset ); |
130 | 130 | |
131 | - $lista = $obj_turma->lista2( | |
131 | + $lista = $obj_turma->lista3( | |
132 | 132 | $this->ref_cod_turma, |
133 | 133 | null, |
134 | 134 | null, | ... | ... |
ieducar/intranet/include/pmieducar/clsPmieducarTurma.inc.php
... | ... | @@ -1690,6 +1690,262 @@ and e.cod_escola = t.ref_ref_cod_escola |
1690 | 1690 | } |
1691 | 1691 | |
1692 | 1692 | /** |
1693 | + * Retorna uma lista filtrados de acordo com os parametros | |
1694 | + * (Modificação da lista2, agora trazendo somente turmas do ano atual) | |
1695 | + * @return array | |
1696 | + */ | |
1697 | + function lista3( $int_cod_turma = null, $int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $int_ref_ref_cod_serie = null, $int_ref_ref_cod_escola = null, $int_ref_cod_infra_predio_comodo = null, $str_nm_turma = null, $str_sgl_turma = null, $int_max_aluno = null, $int_multiseriada = null, $date_data_cadastro_ini = null, $date_data_cadastro_fim = null, $date_data_exclusao_ini = null, $date_data_exclusao_fim = null, $int_ativo = null, $int_ref_cod_turma_tipo = null, $time_hora_inicial_ini = null, $time_hora_inicial_fim = null, $time_hora_final_ini = null, $time_hora_final_fim = null, $time_hora_inicio_intervalo_ini = null, $time_hora_inicio_intervalo_fim = null, $time_hora_fim_intervalo_ini = null, $time_hora_fim_intervalo_fim = null, $int_ref_cod_curso = null, $int_ref_cod_instituicao = null, $int_ref_cod_regente = null, $int_ref_cod_instituicao_regente = null, $int_ref_ref_cod_escola_mult = null, $int_ref_ref_cod_serie_mult = null, $int_qtd_min_alunos_matriculados = null, $visivel = null, $turma_turno_id = null, $tipo_boletim = null, $ano = null ) | |
1698 | + { | |
1699 | + | |
1700 | + | |
1701 | + $sql = "SELECT {$this->_campos_lista},c.nm_curso,s.nm_serie,i.nm_instituicao FROM {$this->_tabela} t left outer join {$this->_schema}serie s on (t.ref_ref_cod_serie = s.cod_serie), {$this->_schema}curso c, {$this->_schema}instituicao i "; | |
1702 | + $filtros = ""; | |
1703 | + | |
1704 | + $whereAnd = " WHERE t.ref_cod_curso = c.cod_curso AND c.ref_cod_instituicao = i.cod_instituicao AND "; | |
1705 | + | |
1706 | + if( is_numeric( $int_cod_turma ) ) | |
1707 | + { | |
1708 | + $filtros .= "{$whereAnd} t.cod_turma = '{$int_cod_turma}'"; | |
1709 | + $whereAnd = " AND "; | |
1710 | + } | |
1711 | + if( is_numeric( $int_ref_usuario_exc ) ) | |
1712 | + { | |
1713 | + $filtros .= "{$whereAnd} t.ref_usuario_exc = '{$int_ref_usuario_exc}'"; | |
1714 | + $whereAnd = " AND "; | |
1715 | + } | |
1716 | + if( is_numeric( $int_ref_usuario_cad ) ) | |
1717 | + { | |
1718 | + $filtros .= "{$whereAnd} t.ref_usuario_cad = '{$int_ref_usuario_cad}'"; | |
1719 | + $whereAnd = " AND "; | |
1720 | + } | |
1721 | + if( is_numeric( $int_ref_ref_cod_serie ) ) | |
1722 | + { | |
1723 | + $filtros .= "{$whereAnd} t.ref_ref_cod_serie = '{$int_ref_ref_cod_serie}'"; | |
1724 | + $whereAnd = " AND "; | |
1725 | + } | |
1726 | + if( is_numeric( $int_ref_ref_cod_escola ) ) | |
1727 | + { | |
1728 | + $filtros .= "{$whereAnd} t.ref_ref_cod_escola = '{$int_ref_ref_cod_escola}'"; | |
1729 | + $whereAnd = " AND "; | |
1730 | + } | |
1731 | + if( is_numeric( $int_ref_cod_infra_predio_comodo ) ) | |
1732 | + { | |
1733 | + $filtros .= "{$whereAnd} t.ref_cod_infra_predio_comodo = '{$int_ref_cod_infra_predio_comodo}'"; | |
1734 | + $whereAnd = " AND "; | |
1735 | + } | |
1736 | + if( is_string( $str_nm_turma ) ) | |
1737 | + { | |
1738 | + $filtros .= "{$whereAnd} t.nm_turma LIKE '%{$str_nm_turma}%'"; | |
1739 | + $whereAnd = " AND "; | |
1740 | + } | |
1741 | + if( is_string( $str_sgl_turma ) ) | |
1742 | + { | |
1743 | + $filtros .= "{$whereAnd} t.sgl_turma LIKE '%{$str_sgl_turma}%'"; | |
1744 | + $whereAnd = " AND "; | |
1745 | + } | |
1746 | + if( is_numeric( $int_max_aluno ) ) | |
1747 | + { | |
1748 | + $filtros .= "{$whereAnd} t.max_aluno = '{$int_max_aluno}'"; | |
1749 | + $whereAnd = " AND "; | |
1750 | + } | |
1751 | + if( is_numeric( $int_multiseriada ) ) | |
1752 | + { | |
1753 | + $filtros .= "{$whereAnd} t.multiseriada = '{$int_multiseriada}'"; | |
1754 | + $whereAnd = " AND "; | |
1755 | + } | |
1756 | + if( is_string( $date_data_cadastro_ini ) ) | |
1757 | + { | |
1758 | + $filtros .= "{$whereAnd} t.data_cadastro >= '{$date_data_cadastro_ini}'"; | |
1759 | + $whereAnd = " AND "; | |
1760 | + } | |
1761 | + if( is_string( $date_data_cadastro_fim ) ) | |
1762 | + { | |
1763 | + $filtros .= "{$whereAnd} t.data_cadastro <= '{$date_data_cadastro_fim}'"; | |
1764 | + $whereAnd = " AND "; | |
1765 | + } | |
1766 | + if( is_string( $date_data_exclusao_ini ) ) | |
1767 | + { | |
1768 | + $filtros .= "{$whereAnd} t.data_exclusao >= '{$date_data_exclusao_ini}'"; | |
1769 | + $whereAnd = " AND "; | |
1770 | + } | |
1771 | + if( is_string( $date_data_exclusao_fim ) ) | |
1772 | + { | |
1773 | + $filtros .= "{$whereAnd} t.data_exclusao <= '{$date_data_exclusao_fim}'"; | |
1774 | + $whereAnd = " AND "; | |
1775 | + } | |
1776 | + if( is_null( $int_ativo ) || $int_ativo ) | |
1777 | + { | |
1778 | + $filtros .= "{$whereAnd} t.ativo = '1'"; | |
1779 | + $whereAnd = " AND "; | |
1780 | + } | |
1781 | + else | |
1782 | + { | |
1783 | + $filtros .= "{$whereAnd} t.ativo = '0'"; | |
1784 | + $whereAnd = " AND "; | |
1785 | + } | |
1786 | + if( is_numeric( $int_ref_cod_turma_tipo ) ) | |
1787 | + { | |
1788 | + $filtros .= "{$whereAnd} t.ref_cod_turma_tipo = '{$int_ref_cod_turma_tipo}'"; | |
1789 | + $whereAnd = " AND "; | |
1790 | + } | |
1791 | + if( ( $time_hora_inicial_ini ) ) | |
1792 | + { | |
1793 | + $filtros .= "{$whereAnd} t.hora_inicial >= '{$time_hora_inicial_ini}'"; | |
1794 | + $whereAnd = " AND "; | |
1795 | + } | |
1796 | + if( ( $time_hora_inicial_fim ) ) | |
1797 | + { | |
1798 | + $filtros .= "{$whereAnd} t.hora_inicial <= '{$time_hora_inicial_fim}'"; | |
1799 | + $whereAnd = " AND "; | |
1800 | + } | |
1801 | + if( ( $time_hora_final_ini ) ) | |
1802 | + { | |
1803 | + $filtros .= "{$whereAnd} t.hora_final >= '{$time_hora_final_ini}'"; | |
1804 | + $whereAnd = " AND "; | |
1805 | + } | |
1806 | + if( ( $time_hora_final_fim ) ) | |
1807 | + { | |
1808 | + $filtros .= "{$whereAnd} t.hora_final <= '{$time_hora_final_fim}'"; | |
1809 | + $whereAnd = " AND "; | |
1810 | + } | |
1811 | + if( ( $time_hora_inicio_intervalo_ini ) ) | |
1812 | + { | |
1813 | + $filtros .= "{$whereAnd} t.hora_inicio_intervalo >= '{$time_hora_inicio_intervalo_ini}'"; | |
1814 | + $whereAnd = " AND "; | |
1815 | + } | |
1816 | + if( ( $time_hora_inicio_intervalo_fim ) ) | |
1817 | + { | |
1818 | + $filtros .= "{$whereAnd} t.hora_inicio_intervalo <= '{$time_hora_inicio_intervalo_fim}'"; | |
1819 | + $whereAnd = " AND "; | |
1820 | + } | |
1821 | + if( ( $time_hora_fim_intervalo_ini ) ) | |
1822 | + { | |
1823 | + $filtros .= "{$whereAnd} t.hora_fim_intervalo >= '{$time_hora_fim_intervalo_ini}'"; | |
1824 | + $whereAnd = " AND "; | |
1825 | + } | |
1826 | + if( ( $time_hora_fim_intervalo_fim ) ) | |
1827 | + { | |
1828 | + $filtros .= "{$whereAnd} t.hora_fim_intervalo <= '{$time_hora_fim_intervalo_fim}'"; | |
1829 | + $whereAnd = " AND "; | |
1830 | + } | |
1831 | + if( is_numeric( $int_ref_cod_regente ) ) | |
1832 | + { | |
1833 | + $filtros .= "{$whereAnd} t.ref_cod_regente = '{$int_ref_cod_regente}'"; | |
1834 | + $whereAnd = " AND "; | |
1835 | + } | |
1836 | + if( is_numeric( $int_ref_cod_instituicao_regente ) ) | |
1837 | + { | |
1838 | + $filtros .= "{$whereAnd} t.ref_cod_instituicao_regente = '{$int_ref_cod_instituicao_regente}'"; | |
1839 | + $whereAnd = " AND "; | |
1840 | + } | |
1841 | + if( is_numeric( $int_ref_cod_instituicao ) ) | |
1842 | + { | |
1843 | + $filtros .= "{$whereAnd} t.ref_cod_instituicao = '{$int_ref_cod_instituicao}'"; | |
1844 | + $whereAnd = " AND "; | |
1845 | + } | |
1846 | + if( is_numeric( $int_ref_cod_curso ) ) | |
1847 | + { | |
1848 | + $filtros .= "{$whereAnd} t.ref_cod_curso = '{$int_ref_cod_curso}'"; | |
1849 | + $whereAnd = " AND "; | |
1850 | + } | |
1851 | + if( is_numeric( $int_ref_ref_cod_escola_mult ) ) | |
1852 | + { | |
1853 | + $filtros .= "{$whereAnd} t.ref_ref_cod_escola_mult = '{$int_ref_ref_cod_escola_mult}'"; | |
1854 | + $whereAnd = " AND "; | |
1855 | + } | |
1856 | + if( is_numeric( $int_ref_ref_cod_serie_mult ) ) | |
1857 | + { | |
1858 | + $filtros .= "{$whereAnd} t.int_ref_ref_cod_serie_mult = '{$int_ref_ref_cod_serie_mult}'"; | |
1859 | + $whereAnd = " AND "; | |
1860 | + } | |
1861 | + if( is_numeric($int_qtd_min_alunos_matriculados) ) | |
1862 | + { | |
1863 | + $filtros .= "{$whereAnd} (SELECT COUNT(0) FROM pmieducar.matricula_turma WHERE ref_cod_turma = t.cod_turma) >= '{$int_qtd_min_alunos_matriculados}' "; | |
1864 | + $whereAnd = " AND "; | |
1865 | + } | |
1866 | + if (is_bool($visivel)) | |
1867 | + { | |
1868 | + if ($visivel) | |
1869 | + { | |
1870 | + $filtros .= "{$whereAnd} t.visivel = TRUE"; | |
1871 | + $whereAnd = " AND "; | |
1872 | + } | |
1873 | + else | |
1874 | + { | |
1875 | + $filtros .= "{$whereAnd} t.visivel = FALSE"; | |
1876 | + $whereAnd = " AND "; | |
1877 | + } | |
1878 | + } | |
1879 | + elseif (is_array($visivel) && count($visivel)) | |
1880 | + { | |
1881 | + $filtros .= "{$whereAnd} t.visivel IN (".implode(",", $visivel).")"; | |
1882 | + $whereAnd = " AND "; | |
1883 | + } | |
1884 | + else | |
1885 | + { | |
1886 | + $filtros .= "{$whereAnd} t.visivel = TRUE"; | |
1887 | + $whereAnd = " AND "; | |
1888 | + } | |
1889 | + | |
1890 | + if( is_numeric( $turma_turno_id ) ) { | |
1891 | + $filtros .= "{$whereAnd} t.turma_turno_id = '{$turma_turno_id}'"; | |
1892 | + $whereAnd = " AND "; | |
1893 | + } | |
1894 | + | |
1895 | + if( is_numeric( $tipo_boletim ) ) { | |
1896 | + $filtros .= "{$whereAnd} t.tipo_boletim = '{$tipo_boletim}'"; | |
1897 | + $whereAnd = " AND "; | |
1898 | + } | |
1899 | + | |
1900 | + if( is_numeric( $ano ) ) { | |
1901 | + $filtros .= "{$whereAnd} t.ano = '{$ano}'"; | |
1902 | + $whereAnd = " AND "; | |
1903 | + } | |
1904 | + | |
1905 | + $filtros .= "{$whereAnd} (ano = (SELECT max(ano) | |
1906 | + FROM pmieducar.escola_ano_letivo mat | |
1907 | + WHERE ativo = 1 and mat.andamento = 1) or ((t.ano is null) AND (select 1 from pmieducar.matricula_turma | |
1908 | + where ativo = 1 and date_part('year',data_cadastro) = (SELECT max(ano) | |
1909 | + FROM pmieducar.escola_ano_letivo | |
1910 | + WHERE ativo = 1 and andamento = 1) and t.cod_turma = ref_cod_turma limit 1) is not null))"; | |
1911 | + | |
1912 | + $db = new clsBanco(); | |
1913 | + $countCampos = count( explode( ",", $this->_campos_lista ) ); | |
1914 | + $resultado = array(); | |
1915 | + | |
1916 | + $sql .= $filtros . $this->getOrderby() . $this->getLimite(); | |
1917 | + | |
1918 | + $this->_total = $db->CampoUnico( "SELECT COUNT(0) FROM {$this->_tabela} t left outer join {$this->_schema}serie s on (t.ref_ref_cod_serie = s.cod_serie), {$this->_schema}curso c , {$this->_schema}instituicao i {$filtros}" ); | |
1919 | + | |
1920 | + | |
1921 | + $db->Consulta( $sql); | |
1922 | + | |
1923 | + if( $countCampos > 1 ) | |
1924 | + { | |
1925 | + while ( $db->ProximoRegistro() ) | |
1926 | + { | |
1927 | + $tupla = $db->Tupla(); | |
1928 | + | |
1929 | + $tupla["_total"] = $this->_total; | |
1930 | + $resultado[] = $tupla; | |
1931 | + } | |
1932 | + } | |
1933 | + else | |
1934 | + { | |
1935 | + while ( $db->ProximoRegistro() ) | |
1936 | + { | |
1937 | + $tupla = $db->Tupla(); | |
1938 | + $resultado[] = $tupla[$this->_campos_lista]; | |
1939 | + } | |
1940 | + } | |
1941 | + if( count( $resultado ) ) | |
1942 | + { | |
1943 | + return $resultado; | |
1944 | + } | |
1945 | + return false; | |
1946 | + } | |
1947 | + | |
1948 | + /** | |
1693 | 1949 | * Retorna um array com os dados de um registro |
1694 | 1950 | * |
1695 | 1951 | * @return array | ... | ... |