D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
html
/
rosario
/
adm
/
app
/
gre
/
Models
/
Filename :
ModCtEnviaPrecoListar.php
back
Copy
<?php namespace App\gre\Models\Cotacao; if (!defined('URL')) { header("Location: /"); exit(); } /** * Description of GrsListarPsaudemedico * * @copyright (c) year, Carlos Marques - CM */ class ModCtEnviaPrecoListar { private $Dados; private $Resultado; private $Arquivo; private $Envia; private $PageId; private $DadosExcel; public function listarEnvia($PageId = null, $Dados = null) { $this->PageId = (int) $PageId; $this->DadosExcel = filter_input_array(INPUT_GET, FILTER_DEFAULT); if(isset($this->DadosExcel['opcao'])){ unset($this->DadosExcel['url']); unset($this->DadosExcel['opcao']); $this->Dados = $this->DadosExcel; }else{ $this->Dados = $Dados; } echo '<pre>'; var_dump($this->Dados); echo '</pre>'; if(!empty($this->Dados['data'])){ $this->pesquisarCotacao(); return $this->Resultado; }else{ $this->listarCadastrar(); } } public function enviarPlan($Dados = null) { $this->Dados = $Dados; var_dump($this->Dados); $path = getcwd(); $Dados = $_POST; $anomes = $Dados['anomes']; $data = $anomes.'-01'; setlocale(LC_TIME, 'pt_BR', 'pt_BR.utf-8', 'pt_BR.utf-8', 'portuguese'); date_default_timezone_set('America/Sao_Paulo'); $Date = '<b>'.strftime('%B/%Y', strtotime($data)).'</b>'; $arquivo = $Dados['id_arquivo']; $url =URLLOCAL ; include_once("conecta.php"); //if(is_DIR($url)){ // var_dump('existe'); //}else{ // var_dump('NÃO existe'); //} include_once("conecta.php"); //$sqlw = "truncate table w_agenda"; //mysqli_query($link,$sqlw); $dir = $_SERVER['DOCUMENT_ROOT']."/rosario/upload/"; // if(is_DIR($dir)){ // var_dump('existe no www'); //}else{ // var_dump('NÃO existe no www'); //} $nome = $url. $arquivo ; $uploadfile = $dir.$_FILES['arquivo']['name']; $inipath = php_ini_loaded_file(); $mv = move_uploaded_file($_FILES['arquivo']['tmp_name'], $uploadfile); $sql= ""; } public function listarCadastrar() { $path = "C:/Cotacao_Rosario/"; $diretorio = dir($path); //echo "Lista de Arquivos do diretório '<strong>".$path."</strong>'<br />"; $this->Arquivo = ''; while($arquivo = $diretorio -> read()){ //echo "<a href='".$path.$arquivo."'>".$arquivo."</a><br />"; if($arquivo <> '.') { if($arquivo <> '..') { $this->Arquivo = $arquivo; $this->Envia = $arquivo; } } } var_dump('linha 113 mo'); var_dump($this->Arquivo); if($this->Arquivo == '') { $_SESSION['msg'] = "<div class='alert alert-danger' role='alert'> Erro: Nenhum Arquivo Encontrado para envio! <button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span></button> </div>"; $this->Resultado = false; } $extension = pathinfo($path.$this->Arquivo, PATHINFO_EXTENSION); if($extension <> 'xls') { $_SESSION['msg'] = "<div class='alert alert-danger' role='alert'> Erro: Arquivo não é extensão csv !! <button type='button' class='close' data-dismiss='alert' aria-label='Close'> <span aria-hidden='true'>×</span></button> </div>"; $this->Arquivo = ''; $this->Resultado = false; } //var_dump("The extension is $extension."); $diretorio -> close(); $this->Resultado = ['arq_base'=> $this->Envia]; var_dump($this->Resultado); return $this->Resultado; } }