Ejemplo n.º 1
0
 /**
  * Método que interrompe a execução de acordo com o modo executado
  */
 protected function close($voltar = FALSE)
 {
     if ((bool) $this->data["shadowbox"]) {
         die(Javascript::shadowboxClose());
         //            echo Javascript::shadowboxClose();
         //            echo Javascript::close();
         //            die(Javascript::history_back());
     } else {
         if ((bool) $voltar) {
             die(Javascript::history_back());
         } else {
             die(Javascript::close());
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Método que faz a edição de um registro
  * @param int $registroCod O código de identificação do registro
  */
 public function edit_registro($registroCod = FALSE)
 {
     $codRegistro = (int) $registroCod;
     if (!$codRegistro && !$this->getFiltros()->shadowbox) {
         echo Javascript::alert('O registro informado é inválido');
         echo Javascript::close();
         echo Javascript::shadowboxClose();
         return;
     }
     $fapRegistro = new Kernel_Models_Fap();
     $fapSubTipo = new Kernel_Models_Fap();
     $registro = $fapRegistro->getObject('pk_fap_registro=' . $codRegistro);
     if (!$registro) {
         echo Javascript::alert('O registro informado é inválido');
         echo Javascript::close();
         echo Javascript::shadowboxClose();
         return;
     }
     $this->setData('tiposRegistros', $fapSubTipo->selectAll("fap.fap_tipo.pk_fap_tipo < 7 " . "or fap.fap_tipo.pk_fap_tipo = 16 or fap.fap_tipo.pk_fap_tipo > 22"))->setData('registro', $registro)->setData('professor', $this->professores->selectUsuarioProfessor($registro->fk_usuario_professor)->fetchObject())->printView();
 }
Ejemplo n.º 3
0
 /**
  * Método que gera a planilha de acompnahamento do livro e disciplinas informadas
  * @param int $livro O código do livro
  * @param int $materia O código da máteria
  */
 public function acompanhamento()
 {
     //Inicializando os filtros usados na página
     $this->filtro->initGets(array("livro", "disciplina"));
     //Inicializando os objeto básicos
     $sqlTopico = new SqlTopico();
     //Buscando os tópicos
     $topicosLista = $sqlTopico->listarTodos($this->filtro);
     //Verificando se o livro é válido
     if (!$topicosLista->rowCount()) {
         echo Javascript::alert("Não foi encontrado conteúdo " . "associado ao livro e disciplina informados");
         die(Javascript::close());
     }
     $topicos = $topicosLista->fetchAll();
     //Array com os contepudos do livro
     //
     $topicoInicia = $topicos[0];
     //Primeiro item do array com os dados básicos
     //Variáveis iniciais básicas
     $xBase = 1;
     //Coluna inicial da impressão
     $yBase = 1;
     //Linha de início da impressão
     $nColunasCapitulos = 5;
     //Número de colunas da culuna inicial
     $nColunasPaginas = 1;
     //Número de colunas da culuna de páginas
     $nColunasAulas = 10;
     //Número de colunas referentes ao número máximo de aulas
     $nColunasMax = 0;
     //Define o número máximo de colunas da planilha
     $indiceUltColuna = 0;
     //Define o indice da ultima coluna da planilha
     $colecao = $topicoInicia->getCapitulo()->getLivro()->getColecao()->getNome();
     //Nome da coleção a qual o livro pertence
     $tituloPlanilha = "PLANILHA DE ACOMPANHAMENTO PROGRAMÁTICO ({$this->data["ano_letivo"]})";
     $textoAula = "Aula ";
     //Define o texto das celulas "aula"
     $textoData = "Data:";
     //Define o texto das celulas "data"
     $alturaLinha = 40;
     //Define a autura minima das linhas
     $larguraLegenda = 5;
     //Define a largura de cada coluna das legendas em pixels
     $textoPaguinas = "PÁGINAS";
     //Define o texto da coluna de páginas
     $textoPaguinasVertical = FALSE;
     //Define se o texto sobre a coluna páginas ficará na vertical ou não
     //Coluna da esquerda
     $arrayExplicativo = array("Preenchimento", "O status do andamento dos assuntos do livro da coleção {$colecao} " . "deve ser atualizado a cada aula ministrada pelo professor, " . "independente se na aula foi utilizado ou não o livro didático.");
     $arrayDadosProfessor = array("PROFESSOR:", "", "", "SÉRIE:", "TURMA:", "UNIDADE:");
     //Coluna da direita
     $arrayDadosLivro = array("", "{$topicoInicia->getCapitulo()->getLivro()->getTitulo()} ({$topicoInicia->getSequencial()} º Bimestre)", $topicoInicia->getCapitulo()->getDisciplina()->getNome(), "Livro Didático: {$topicoInicia->getCapitulo()->getLivro()->getTitulo()}", "");
     $arrayColunaAulaData = array($textoAula, $textoData, "");
     //
     $arrayLegenda = array("A" => "EM ANDAMENTO", "C" => "CONCLUÍDO", "R" => "REVISADO");
     //Início da execução
     //Verificação de erros de configuração
     if (count($arrayExplicativo) + count($arrayDadosProfessor) != count($arrayDadosLivro) + count($arrayColunaAulaData)) {
         //As somas de itens entre os pares de arrays acima devem ser iguais
         die("Planilha mal configurada");
     }
     //Variaveis dinâmicas usadas na execução
     $x = $xBase;
     $y = $yBase + 1;
     $nColunasMax += $xBase + $nColunasCapitulos + $nColunasPaginas + $nColunasAulas * count($arrayLegenda);
     $indiceUltColuna += $xBase + $nColunasMax;
     //Inserindo os dados na planilha
     //
     $this->workSheet->setCellValueByColumnAndRow($x, $y, $tituloPlanilha);
     $this->workSheet->getStyleByColumnAndRow($x, $y)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $this->workSheet->getStyleByColumnAndRow($x, $y)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
     $this->workSheet->getStyleByColumnAndRow($x, $y)->getFont()->setSize(20);
     $this->workSheet->getStyle(ExcelAux::indiceParaColuna($x + 1) . $y . ":" . ExcelAux::indiceParaColuna($indiceUltColuna + 1) . $y)->applyFromArray(array("font" => array("bold" => TRUE), "borders" => array("top" => array("style" => PHPExcel_Style_Border::BORDER_MEDIUM, "color" => array("argb" => "000000")), "left" => array("style" => PHPExcel_Style_Border::BORDER_MEDIUM, "color" => array("argb" => "000000")), "right" => array("style" => PHPExcel_Style_Border::BORDER_MEDIUM, "color" => array("argb" => "000000")), "bottom" => array("style" => PHPExcel_Style_Border::BORDER_THIN, "color" => array("argb" => "000000")))));
     $this->workSheet->mergeCellsByColumnAndRow($x, $y, $indiceUltColuna, $y);
     $this->workSheet->getRowDimension($y++)->setRowHeight($alturaLinha);
     //Variaveis de indices e contadores
     $linhaExpl = 0;
     $linhaProf = 0;
     $linhaLivro = 0;
     $linhaAulaData = 0;
     $colunaLegenda = 0;
     $colunaLegendaChave = array_keys($arrayLegenda);
     foreach (range(0, count($arrayExplicativo) + count($arrayDadosProfessor) - 1) as $value) {
         $x = $xBase;
         //Preenchendo a coluna da esquerda
         if (isset($arrayExplicativo[$linhaExpl])) {
             $this->workSheet->setCellValueByColumnAndRow($x, $y, $arrayExplicativo[$linhaExpl++]);
             $this->workSheet->getStyleByColumnAndRow($x, $y)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
             $this->workSheet->getStyleByColumnAndRow($x, $y)->getAlignment()->setWrapText(TRUE);
             $this->workSheet->getStyleByColumnAndRow($x, $y)->getFont()->setSize(12);
             if ($linhaExpl == count($arrayExplicativo)) {
                 $this->workSheet->getRowDimension($y)->setRowHeight($alturaLinha + 25);
                 $this->workSheet->getStyle(ExcelAux::indiceParaColuna($xBase + 1) . $y . ":" . ExcelAux::indiceParaColuna($xBase + $nColunasCapitulos + 2) . $y)->applyFromArray(array("borders" => array("bottom" => array("style" => PHPExcel_Style_Border::BORDER_THIN, "color" => array("rgb" => "000000")))));
             }
         } else {
             $this->workSheet->setCellValueByColumnAndRow($x, $y, $arrayDadosProfessor[$linhaProf++]);
             $this->workSheet->getStyleByColumnAndRow($x, $y)->getFont()->setSize(14);
         }
         $this->workSheet->getStyleByColumnAndRow($x, $y)->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => "FFFFFF"))));
         $this->workSheet->getStyleByColumnAndRow($xBase + $nColunasCapitulos + 1, $y)->applyFromArray(array("borders" => array("right" => array("style" => PHPExcel_Style_Border::BORDER_THIN, "color" => array("rgb" => "000000")))));
         $this->workSheet->mergeCellsByColumnAndRow($xBase, $y, $nColunasCapitulos + $xBase + 1, $y);
         //Preenchendo as colunas das legendas
         if (isset($colunaLegendaChave[$colunaLegenda])) {
             $x += $nColunasCapitulos + $nColunasPaginas + $colunaLegenda + $xBase;
             $this->workSheet->setCellValueByColumnAndRow($x, $y, $textoPaguinas);
             $this->workSheet->getStyleByColumnAndRow($x, $y)->getFont()->setSize(14);
             if ((bool) $textoPaguinasVertical) {
                 $this->workSheet->getStyleByColumnAndRow($x, $y)->getAlignment()->setTextRotation(90);
                 $this->workSheet->getStyleByColumnAndRow($x, $y)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             } else {
                 $this->workSheet->getColumnDimensionByColumn($x)->setWidth(13);
                 $this->workSheet->getStyleByColumnAndRow($x, $y)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_BOTTOM)->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             }
             $this->workSheet->getStyleByColumnAndRow($x, $y)->applyFromArray(array("font" => array("italic" => TRUE, "bold" => TRUE)));
             $this->workSheet->mergeCellsByColumnAndRow($x, $y, $x, $y + count($arrayExplicativo) + count($arrayDadosProfessor) - 1);
             foreach ($arrayLegenda as $legenda) {
                 $x = $xBase + $nColunasCapitulos + $nColunasPaginas + $colunaLegenda + 2;
                 $this->workSheet->setCellValueByColumnAndRow($x, $y, $arrayLegenda[$colunaLegendaChave[$colunaLegenda]]);
                 $this->workSheet->getStyleByColumnAndRow($x, $y)->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => "EFAC86"))));
                 $this->workSheet->getStyle(ExcelAux::indiceParaColuna($x) . $y . ":" . ExcelAux::indiceParaColuna($x) . ($y + count($arrayDadosLivro) - 1))->applyFromArray(array("borders" => array("right" => array("style" => PHPExcel_Style_Border::BORDER_THIN, "color" => array("rgb" => "000000"))), "font" => array("italic" => TRUE)));
                 $this->workSheet->getStyleByColumnAndRow($x, $y)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                 $this->workSheet->getStyleByColumnAndRow($x, $y)->getAlignment()->setTextRotation(90);
                 $this->workSheet->mergeCellsByColumnAndRow($x, $y, $x, $y + count($arrayDadosLivro) - 1);
                 $colunaLegenda++;
             }
         }
         //Preenchendo a coluna da direita
         $x = $xBase;
         if (isset($arrayDadosLivro[$linhaLivro])) {
             $x += $nColunasCapitulos + $nColunasPaginas + count($arrayLegenda) + 2;
             $this->workSheet->setCellValueByColumnAndRow($x, $y, $arrayDadosLivro[$linhaLivro++]);
             $this->workSheet->getStyleByColumnAndRow($x, $y)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             $this->workSheet->getStyleByColumnAndRow($x, $y)->getAlignment()->setWrapText(TRUE);
             $this->workSheet->getStyleByColumnAndRow($x, $y)->getFont()->setSize(18);
             $this->workSheet->getStyleByColumnAndRow($x, $y)->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => "FFFFFF")), "borders" => array("left" => array("style" => PHPExcel_Style_Border::BORDER_THIN, "color" => array("rgb" => "000000"))), "font" => array("bold" => TRUE)));
             $this->workSheet->mergeCellsByColumnAndRow($x, $y, $indiceUltColuna, $y);
         } else {
             $x = $xBase + $nColunasCapitulos + $nColunasPaginas - (count($arrayLegenda) - 2);
             $colorir = FALSE;
             foreach (range(1, $nColunasAulas) as $value) {
                 $this->workSheet->setCellValueByColumnAndRow($x += count($arrayLegenda), $y, $arrayColunaAulaData[$linhaAulaData] . (!$linhaAulaData ? str_pad($value, 2, 0, STR_PAD_LEFT) : ""));
                 $this->workSheet->getStyleByColumnAndRow($x, $y)->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => ($colorir = !$colorir) ? "EFAC86" : "FFFFFF")), "borders" => array("left" => array("style" => PHPExcel_Style_Border::BORDER_THIN, "color" => array("rgb" => "000000"))), "font" => array("underline" => TRUE)));
                 if (!$linhaAulaData) {
                     //Centralizando a primeira palavra do bloco
                     $this->workSheet->getStyleByColumnAndRow($x, $y)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                     $this->workSheet->getStyleByColumnAndRow($x, $y)->getFont()->setSize(16);
                     $this->workSheet->getStyle(ExcelAux::indiceParaColuna($x) . $y . ":" . ExcelAux::indiceParaColuna($x + count($arrayLegenda)) . $y)->applyFromArray(array('borders' => array('top' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 'color' => array('argb' => '000000'))), "font" => array("bold" => TRUE, "underline" => FALSE)));
                 }
                 $this->workSheet->mergeCellsByColumnAndRow($x, $y, $x + count($arrayLegenda) - 1, $y);
             }
             $linhaAulaData++;
         }
         $y++;
     }
     //Preenchendo o resto da planilha
     $capituloTitulo = "";
     foreach ($topicos as $topico) {
         $x = $xBase;
         if ($capituloTitulo != $topico->getCapitulo()->getSequencial()) {
             $capituloTitulo = $topico->getCapitulo()->getSequencial();
             $tituloCapitulo = "{$topico->getCapitulo()->getSequencial()}: {$topico->getCapitulo()->getNome()}";
             $this->workSheet->setCellValueByColumnAndRow($x, $y, $tituloCapitulo);
             $this->workSheet->getRowDimension($y)->setRowHeight($alturaLinha);
             $this->workSheet->getStyleByColumnAndRow($x, $y)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
             $this->workSheet->getStyleByColumnAndRow($x, $y)->getFont()->setSize(16);
             $this->workSheet->getStyleByColumnAndRow($x, $y)->getAlignment()->setWrapText(TRUE);
             $this->workSheet->getStyle(ExcelAux::indiceParaColuna($xBase + 1) . $y . ":" . ExcelAux::indiceParaColuna($xBase + $nColunasCapitulos + $nColunasPaginas + 2) . $y)->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => "9BC2E6")), 'font' => array('bold' => true), "borders" => array("top" => array("style" => PHPExcel_Style_Border::BORDER_THIN, "color" => array("rgb" => "000000")))));
             $this->workSheet->getStyle(ExcelAux::indiceParaColuna($xBase + 1) . $y . ":" . ExcelAux::indiceParaColuna($indiceUltColuna + 1) . $y)->applyFromArray(array("borders" => array("top" => array("style" => PHPExcel_Style_Border::BORDER_THIN, "color" => array("rgb" => "000000")))));
             $this->workSheet->mergeCellsByColumnAndRow($xBase, $y, $nColunasCapitulos + $xBase + 1, $y);
             $this->workSheet->mergeCellsByColumnAndRow($xBase + $nColunasCapitulos + 2, $y, $indiceUltColuna, $y++);
         }
         $topicoDesc = "Tópico {$topico->getSequencial()} : {$topico->getNome()}";
         $pagina = "{$topico->getPaginaInicial()} a {$topico->getPaginaFinal()}";
         $this->workSheet->setCellValueByColumnAndRow($x, $y, $topicoDesc);
         $this->workSheet->getStyleByColumnAndRow($x, $y)->getFont()->setSize(14);
         $this->workSheet->getStyle(ExcelAux::indiceParaColuna($xBase + 1) . $y . ":" . ExcelAux::indiceParaColuna($xBase + $nColunasCapitulos + $nColunasPaginas + 2) . $y)->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => "F2F2F2")), 'font' => array("italic" => TRUE), "borders" => array("top" => array("style" => PHPExcel_Style_Border::BORDER_THIN, "color" => array("rgb" => "000000")))));
         $this->workSheet->getRowDimension($y)->setRowHeight($alturaLinha);
         $this->workSheet->getStyleByColumnAndRow($x, $y)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
         $this->workSheet->getStyleByColumnAndRow($x, $y)->getAlignment()->setWrapText(TRUE);
         $this->workSheet->setCellValueByColumnAndRow($x += $nColunasCapitulos + $xBase + 1, $y, $pagina);
         $this->workSheet->getStyleByColumnAndRow($x, $y)->getFont()->setSize(14);
         $this->workSheet->getStyleByColumnAndRow($x, $y)->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => "FFFFFF")), 'borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 'color' => array('argb' => '000000')))));
         $this->workSheet->getStyleByColumnAndRow($x, $y)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER)->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         $this->workSheet->mergeCellsByColumnAndRow($xBase, $y, $nColunasCapitulos + $xBase + 1, $y);
         //            $x++;
         $colorir = TRUE;
         foreach (range(1, $nColunasAulas) as $colAula) {
             foreach ($colunaLegendaChave as $value) {
                 $this->workSheet->setCellValueByColumnAndRow($x + 1, $y, $value);
                 $this->workSheet->getStyleByColumnAndRow($x + 1, $y)->getFont()->setSize(14);
                 $this->workSheet->getStyleByColumnAndRow($x + 1, $y)->applyFromArray(array('borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 'color' => array('argb' => '000000'))), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => $colorir ? "EFAC86" : "FFFFFF"))));
                 $this->workSheet->getStyleByColumnAndRow(++$x, $y)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER)->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
             }
             $colorir = !$colorir;
         }
         $y++;
     }
     //Definindo a largura das páginas como autosize
     //        $this->workSheet
     //                ->getColumnDimensionByColumn($xBase + $nColunasCapitulos + $nColunasPaginas)
     //                ->setAutoSize(TRUE);
     //Definindo a largura das colunas das legendas
     foreach (range($xBase + $nColunasCapitulos + $nColunasPaginas + 2, $indiceUltColuna) as $value) {
         $this->workSheet->getColumnDimensionByColumn($value)->setWidth($larguraLegenda);
     }
     //Definindo as bordas em volta da planilha
     $this->workSheet->getStyle(ExcelAux::indiceParaColuna($xBase + 1) . --$y . ":" . ExcelAux::indiceParaColuna($indiceUltColuna + 1) . $y)->applyFromArray(array("borders" => array("bottom" => array("style" => PHPExcel_Style_Border::BORDER_MEDIUM, "color" => array("argb" => "000000")))));
     $this->workSheet->getStyle(ExcelAux::indiceParaColuna($xBase + 1) . ($yBase + 1) . ":" . ExcelAux::indiceParaColuna($xBase + 1) . $y)->applyFromArray(array("borders" => array("left" => array("style" => PHPExcel_Style_Border::BORDER_MEDIUM, "color" => array("argb" => "000000")))));
     $this->workSheet->getStyle(ExcelAux::indiceParaColuna($indiceUltColuna + 1) . ($yBase + 1) . ":" . ExcelAux::indiceParaColuna($indiceUltColuna + 1) . $y)->applyFromArray(array("borders" => array("right" => array("style" => PHPExcel_Style_Border::BORDER_MEDIUM, "color" => array("argb" => "000000")))));
     //Imprimindo a planilha
     $this->printPlanilha($colecao);
 }
Ejemplo n.º 4
0
 /**
  * Método auxiliar usado na centralização das exceções
  * 
  * @param Exception $exc A exceção a ser tratada
  */
 protected function close(Exception $exc)
 {
     //A exibição de erros esta ativa, exibe o erro e para a execução
     if ((bool) ini_get("display_errors")) {
         die(TratarErros::exibeException($exc));
     }
     //Exibe a mensagem de acordo com a exceção
     if ($exc instanceof SqlException) {
         echo Javascript::alert("Ocorreu um erro interno. " . "Tente novamente mais tarde");
     } elseif ($exc instanceof SqlException) {
         echo Javascript::alert("Ocorreu um erro interno. " . "Por favor, tente novamente mais tarde");
     } else {
         echo Javascript::alert($exc->getMessage());
     }
     //Definindo se a janela será fechada o irá voltar
     if ($this->data["shadowbox"]) {
         echo Javascript::shadowboxClose();
         die(Javascript::close());
     } else {
         die(Javascript::history_back());
     }
 }
Ejemplo n.º 5
0
 /**
  * Método que gera a página de detalhes de cada professor
  */
 public function listar_ranking_uso_sap_detalhes()
 {
     //Determina o código de identificação do proferros
     $pk_professor = filter_input(INPUT_GET, 'professor', FILTER_VALIDATE_INT);
     if (!$pk_professor) {
         header('Content-Type: text/html; charset=UTF-8');
         echo Javascript::alert('O professor informado é inválido');
         echo Javascript::history_back();
         exit;
     }
     $data = $this->getParametroVisao();
     $data['page'] = 'home';
     $data['tema'] != '' ? $this->load->setTheme($data['tema']) : '';
     $data['msg'] = $this->getMsg();
     $data['abaAtiva'] = 8;
     $data['abaPage'] = __FUNCTION__;
     //Buscando dados referentes ao professor
     $sqlranking = new SqlRankingProfessor();
     $data['professor_dados'] = $sqlranking->dadosUsoSap($pk_professor);
     if (!$data['professor_dados']) {
         header('Content-Type: text/html; charset=UTF-8');
         echo Javascript::alert('Não há dados a serem exibidos para este professor');
         echo Javascript::close();
         exit;
     }
     //Montando os dados javascript para exibir os graficos
     $data['js'][] = 'https://www.google.com/jsapi';
     //Exibindo a view
     $this->load->view($this->load->getUrlTema(), $data);
 }
Ejemplo n.º 6
0
 public function acompanhamento_professor_detalhe()
 {
     $data = $this->getParametroVisao();
     if ($data['idTipoUsuario'] == 15) {
         $pkUsuarioProfessor = filter_input(INPUT_GET, 'pk_usuario_professor', FILTER_VALIDATE_INT);
         $professorTmp = new Kernel_Models_Professor();
         $professorTmp = $professorTmp->selectUsuarioProfessor($pkUsuarioProfessor);
         if ($data['idUsuarioProfessor'] != $pkUsuarioProfessor || !$professorTmp) {
             ini_set('default_charset', 'utf8');
             echo Javascript::alert('Desculpe, você não tem acesso a este relátorio');
             echo Javascript::history_back();
             echo Javascript::close();
             echo Javascript::shadowboxClose();
             return;
         }
         $professor = $professorTmp->fetchObject('public_usuario_professor');
         $data['professorObj'] = $professor;
     }
     $data['abaAtiva'] = 7;
     $data['abaPage'] = $data['alias'] = $data['page'] = __FUNCTION__;
     $data['page'] = 'home';
     $data['msg'] = $this->getMsg();
     $data['total'] = 0;
     $data['pk_livro'] = isset($_GET['pk_livro']) ? (int) $_GET['pk_livro'] : 0;
     $data['pk_turma'] = isset($_GET['pk_turma']) ? (int) $_GET['pk_turma'] : 0;
     $data['pk_unidade'] = isset($_GET['pk_unidade']) ? (int) $_GET['pk_unidade'] : 0;
     $ano_letivo = isset($_GET['ano']) ? $_GET['ano'] : $data['ano_letivo'];
     $_SESSION['relat_data_aula'] = '';
     $_SESSION['relat_back'] = '';
     $config['base_url'] = base_url() . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/' . $this->uri->segment(3) . '/';
     $sqlAulas = new SqlAulas();
     $result = $sqlAulas->get_serie_livro($_GET['pk_livro']);
     $data['pk_serie'] = $result[0]['fk_serie'];
     $data['serie_nome'] = $result[0]['serie_nome'];
     $data['livro'] = $sqlAulas->get_livros($data['pk_serie'], $ano_letivo);
     $livro = explode("&pk_livro=", $_SERVER['QUERY_STRING']);
     $data['livro_url'] = $config['base_url'] . '?' . $livro[0];
     if (isset($_GET['pk_livro'])) {
         $result = $sqlAulas->get_media_geral($data['ano_letivo'], $data['pk_livro']);
         $data['media_geral_professores'] = !empty($result) ? number_format($result[0]['media_geral'], 1) : '';
         $data['turma'] = $sqlAulas->get_turmas_apostila($data['pk_serie'], $ano_letivo);
         var_dump($data['turma']);
         die;
         $turma = explode("&pk_turma=", $_SERVER['QUERY_STRING']);
         $data['turma_url'] = $config['base_url'] . '?' . $turma[0];
         if (isset($_GET['pk_turma'])) {
             $sqlAula = new SqlAula();
             $data['professor'] = $sqlAula->get_professores_apostila_turma($_SESSION['pk_livro'], $_GET['pk_turma']);
             $professor = explode("&pk_usuario_professor=", $_SERVER['QUERY_STRING']);
             $data['professor_url'] = $config['base_url'] . '?' . $professor[0];
             if (isset($_GET['pk_usuario_professor'])) {
                 $sqlAula = new SqlAula();
                 $result = $sqlAula->get_conteudos_apostila_professor($_SESSION['pk_livro'], $_GET['pk_materia_vin'], $_GET['pk_usuario_professor'], $_GET['pk_turma']);
                 $data['total'] = count($result);
                 if ($data['total'] > 0) {
                     $count = 0;
                     $html = '<table class="tabela_relatorio mt20"><tr>
                         <td class="titulo_relatorio tcenter"><strong>Data</strong></td>
                         <td class="titulo_relatorio tcenter"><strong>Aula</strong></td>
                         <td class="titulo_relatorio tcenter"><strong>Assunto</strong></td>
                         <td class="titulo_relatorio tcenter"><strong>%</strong></td>
                         <td class="titulo_relatorio tcenter"><strong>Status</strong></td>
                         <td class="titulo_relatorio tcenter"><strong>Tarefas de casa</strong></td>';
                     if ($data['idTipoUsuario'] != 15) {
                         //Ajuste para um melhor controle de acesso
                         $html .= '<td></td>' . '<td></td>' . '<td></td>';
                     }
                     $i = 0;
                     foreach ($result as $row) {
                         $statusCor = '';
                         if ($row['status'] == 1) {
                             $status = "Em andamento";
                             $statusCor = "status1";
                         } else {
                             if ($row['status'] == 2) {
                                 $status = "Concluído";
                                 $statusCor = "status2";
                             } else {
                                 if ($row['status'] == 3) {
                                     $status = "Revisado";
                                     $statusCor = "status3";
                                 }
                             }
                         }
                         $sqlAula = new SqlAula();
                         $result = $sqlAula->get_grade_aula($_SESSION['pk_livro'], $_GET['pk_materia_vin'], $_GET['pk_usuario_professor'], $_GET['pk_turma'], $row['data_aula']);
                         $editar = !empty($result) ? '<a class="link" href="' . base_url() . 'aula/conteudo/cadastrar_conteudo_form_apostila/' . $result[0]['fk_materia_vin'] . '/' . $result[0]['fk_usuario_professor'] . '/' . $result[0]['fk_grade'] . '/0/' . $result[0]['data_aula'] . '/' . $result[0]['pk_aula'] . '/' . $row['aula'] . '?pk_livro=' . $_GET['pk_livro'] . '"><div class="tooltip icon_edit" data-tooltip="Edição"></div></a>' : '';
                         $excluir = !empty($result) ? '<a href="' . base_url() . 'aula/conteudo/excluir_conteudo_professor_aula"  ' . View::getParamExcluirItemTabela($result[0]['fk_materia_vin'] . '/' . $result[0]['fk_usuario_professor'] . '/' . $result[0]['fk_grade'] . '/' . $result[0]['data_aula'] . '/' . $result[0]['pk_aula'] . '/' . $row['aula'] . '/' . $_GET['pk_livro'] . '/' . $row['pk_conteudo'] . '/' . $_GET['pk_turma'] . '/' . $row['status'], 0, 0, '', 'Excluir registro', 'Deseja excluir o registro ' . $row['capitulo_sequencial'] . ': ' . $row['capitulo_nome'] . '<br />Tópico: ' . $row['conteudo_nome'] . '') . '   class="excluirItemTabela"><div class="tooltip icon_delete" data-tooltip="Exclusão"></div></a>' : '<a href="' . base_url() . 'aula/conteudo/excluir_conteudo_professor_aula_cod"  ' . View::getParamExcluirItemTabela($row['cod'], 0, 0, '', 'Excluir registro', 'Deseja excluir o registro ' . $row['capitulo_sequencial'] . ': ' . $row['capitulo_nome'] . '<br />Tópico: ' . $row['conteudo_nome'] . '') . '   class="excluirItemTabela"><div class="tooltip icon_delete" data-tooltip="Exclusão"></div></a>';
                         if ($_SESSION['relat_data_aula'] != $row['data_aula'] . $row['aula']) {
                             $data_aula = View::converteDataBr($row['data_aula']);
                             $aula = 'Aula ' . $row['aula'];
                             $excluir_aula = !empty($result) ? '<a href="' . base_url() . 'aula/conteudo/excluir_aula"  ' . View::getParamExcluirItemTabela($result[0]['fk_materia_vin'] . '/' . $result[0]['fk_usuario_professor'] . '/' . $result[0]['fk_grade'] . '/' . $result[0]['data_aula'] . '/' . $result[0]['pk_aula'] . '/' . $row['aula'] . '/' . $_GET['pk_livro'] . '/' . $_GET['pk_turma'], 0, 0, '', 'Excluir aula', 'Deseja excluir todos os conteúdos da aula ' . $row['aula'] . ' do dia ' . View::converteDataBr($result[0]['data_aula']) . ' do(a) professor(a) ' . $result[0]['nome']) . '   class="excluirItemTabela link">Excluir aula</a>' : '';
                             $i++;
                         } else {
                             $data_aula = '';
                             $aula = '';
                             $excluir_aula = '';
                         }
                         $background = Util::zebrarGeralClass($i, $data['total']);
                         $html .= '<tr>
                                     <td class="' . $background . '" nowrap="nowrap">' . $data_aula . '</td>
                                     <td class="' . $background . ' w40" nowrap="nowrap">' . $aula . '</td>
                                     <td class="' . $background . '">' . $row['capitulo_sequencial'] . ': ' . $row['capitulo_nome'] . '<br />Tópico: ' . $row['conteudo_nome'] . ' - Página(s): ' . $row['paginas_trabalhadas'] . '</td>
                                     <td class="' . $background . '">' . number_format($row['percentual'], 1) . '%</td>
                                     <td class="' . $statusCor . '">' . $status . '</td>
                                     <td class="' . $background . '">' . $row['exercicios_casa'] . '</td>';
                         if ($data['idTipoUsuario'] != 15) {
                             //Ajuste para um melhor controle de acesso
                             $html .= '<td class="' . $background . '">' . $editar . '</td>
                                     <td class="' . $background . '">' . $excluir . '</td>
                                     <td class="' . $background . '">' . $excluir_aula . '</td>';
                         }
                         $_SESSION['relat_data_aula'] = $row['data_aula'] . $row['aula'];
                     }
                     $html .= '</tr></table>';
                     $data['html'] = $html;
                     $_SESSION['redirect'] = base_url() . $this->uri->segment(1) . '/' . $this->uri->segment(2) . '/' . $this->uri->segment(3) . '?&pk_livro=' . $_GET['pk_livro'] . '&pk_turma=' . $_GET['pk_turma'] . '&pk_usuario_professor=' . $_GET['pk_usuario_professor'] . '&pk_materia_vin=' . $_GET['pk_materia_vin'];
                 } else {
                     $data['msg'] = '<div class="alert atencao">Não há registros com o parâmetro selecionado.</div>';
                 }
             }
         }
     }
     if ($this->input->is_ajax_request()) {
         $this->load->view($this->uri->segment(3), $data);
     } else {
         $this->load->view($this->load->getUrlTema(), $data);
     }
 }
Ejemplo n.º 7
0
include dirname(__FILE__) . '/../application/libraries/Javascript.php';
include dirname(__FILE__) . '/../application/modules/fap/models/dao/SqlRankingProfessor.php';
include dirname(__FILE__) . '/../application/models/Materias.php';
/**
 * @var int Variavel que determina qual a unidade
 */
$unidade = filter_input(INPUT_GET, 'unidade', FILTER_VALIDATE_INT);
/**
 * @var int Variavel que determina o ano
 */
$ano = filter_input(INPUT_GET, 'ano', FILTER_VALIDATE_INT);
//Verificando se os dados básicos foram informados
if (!$unidade) {
    header('Content-Type: text/html; charset=UTF-8');
    echo Javascript::alert('A unidade informada é inválida');
    echo Javascript::close();
    exit;
}
//Validando o ano
if (!$ano) {
    $ano = date('Y');
}
//Funções auxiliares
/**
 * Função que verifica se uma váriavel esta setada, caso nao, retorna um valor default
 * @param void $value O valor a ser testado
 * @param void $chave A chave do array
 * @param type $default Um valor padrão
 * @return void
 */
function valueIsSet($value, $chave, $default = 0.0)