Ir para conteúdo
Fórum Script Brasil

Johnbsb

Membros
  • Total de itens

    5
  • Registro em

  • Última visita

Sobre Johnbsb

Johnbsb's Achievements

0

Reputação

  1. Prezados, da uma olhada como pensei... Esse código monta as horas como preciso, até ai eu sei fazer tranquilo <?php $inicio_trabalho = "08:00"; $finaliza_trabalho = "18:00"; $period = new DatePeriod( new DateTime($inicio_trabalho), new DateInterval('PT1H'), new DateTime($finaliza_trabalho) ); foreach ($period as $date) { $new .= "<div>".$date->format("H:i")."</div>"; } echo $new; Agora a parte de verificar se a hora está entre os horários específicos e riscar se estiver, se não, exibe normal. $agendado = "12:59"; $data1 = DateTime::createFromFormat('H:i', $agendado); $data2 = DateTime::createFromFormat('H:i', $inicio_trabalho); $data3 = DateTime::createFromFormat('H:i', $finaliza_trabalho); if ($data1 > $data2 && $data1 < $data3) { echo '<div class="risco">'.$agendado.'</div>'; }else{ echo $agendado; } Agora a dúvida, como eu faço para juntar estas duas funções? a de listar e a de riscar. Precisava ter mais horas agendadas e no momento não sei fazer algo como array para riscar outras horas, a função que montei só risca uma... Precisava juntar estes códigos ou uma outra forma para formatar como publiquei no início do post. Abraço e grato! Abraço!
  2. Prezados, Estou quebrando a cabeça para uma solução e não sei como resolver. Preciso listar as horas de X a Y e verificar se determinadas horas e minutos estão dentro de X e Y e riscar. essas hora_marcada vou pegar do banco, mas precisava de uma ajuda para esta lógica... Por exemplo $X = "08:00" $Y = "18:00" $hora_marcada = array("13:15", "14:02", "16:27", "19:00"); Agora verifica se estas horas do array estão dentro de X e Y resultado 08:00 09:00 10:00 11:00 12:00 13:00 14:00 15:00 16:00 ... alguém sabe como posso criar essa função em PHP? Obrigado!!!
  3. Bom dia galera, Eu estou com uma pequena dúvida quando a este script de upload de arquivos, estou adaptando o JqUploader. Estou tentando colocar a função " $geranomequalquer= md5(uniqid(time())) . strrchr($name, "."); " nos códigos abaixo, mas o formulário não funciona, aparece que foi enviado com sucesso mas o arquivo não aparece na pasta de uploads, alguém tem uma luz? :blush: Grato pela atenção, segue o código abaixo <?php /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ jqUploader serverside example: (author : pixeline, http://www.pixeline.be) when javascript is available, a variable is automatically created that you can use to dispatch all the possible actions This file examplifies this usage: javascript available, or non available. 1/ a form is submitted 1.a javascript is off, so jquploader could not be used, therefore the file needs to be uploaded the old way 1.b javascript is on, so the file, by now is already uploaded and its filename is available in the $_POST array sent by the form 2/ a form is not submitted, and jqUploader is on jqUploader flash file is calling home! process the upload. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ $uploadDir = dirname(__FILE__) . '/zips/'; $uploadFile = $uploadDir . basename($_FILES['Filedata']['name']); if ($_POST['submit'] != '') { // 1. submitting the html form if (!isset($_GET['jqUploader'])) { // Troca o nome do arquivo // 1.a javascript off, we need to upload the file if (move_uploaded_file ($_FILES[0]['tmp_name'], $uploadFile)) { // delete the file // @unlink ($uploadFile); $html_body = '<h1>File successfully uploaded!</h1><pre>'; $html_body .= print_r($_FILES, true); $html_body .= '</pre>'; } else { $html_body = '<h1>File upload error!</h1>'; switch ($_FILES[0]['error']) { case 1: $html_body .= 'The file is bigger than this PHP installation allows'; break; case 2: $html_body .= 'The file is bigger than this form allows'; break; case 3: $html_body .= 'Only part of the file was uploaded'; break; case 4: $html_body .= 'No file was uploaded'; break; default: $html_body .= 'unknown errror'; } $html_body .= 'File data received: <pre>'; $html_body .= print_r($_FILES, true); $html_body .= '</pre>'; } $html_body = '<h1>Full form</h1><pre>'; $html_body .= print_r($_POST, true); $html_body .= '</pre>'; } else { // 1.b javascript on, so the file has been uploaded and its filename is in the POST array $html_body = '<h1>Form posted!</h1><p>Error:<pre>'; $html_body .= print_r($_POST, false); $html_body .= '</pre>'; } myHtml($html_body); } else { if ($_GET['jqUploader'] == 1) { // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // 2. performing jqUploader flash upload if ($_FILES['Filedata']['name']) { if (move_uploaded_file ($_FILES['Filedata']['tmp_name'], $uploadFile)) { // delete the file // @unlink ($uploadFile); return $uploadFile; } } else { if ($_FILES['Filedata']['error']) { return $_FILES['Filedata']['error']; } } } } // /////////////////// HELPER FUNCTIONS function myHtml($bodyHtml) { ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>jqUploader demo - Result</title> <link rel="stylesheet" type="text/css" media="screen" href="style.css"/> </head> <body> <?php echo $bodyHtml; ?> </body> </html> <?php } ?> Abraço a todos!
  4. Boa tarde amigos, Estou desenvolvendo uma função de cadastro em ajax e estou com uma dúvida na montagem de um link ao terminar de cadastrar o conteúdo: Como que eu faço para o link imprimirOs.php pegar a variavel do protocolo que é gerado no formulário? assim ficaria como exemplo: imprimirOs.php?protocolo=784984989 na realidade neste momento está ficando ao clicar: imprimirOs.php?protocolo=+protocolo+ Se alguém der essa ajudinha para fazer funcionar, fico muito grato! Abraços a todos
  5. Olá amigos, estou desenvolvendo um projeto em ajax e estou tendo algumas dificuldades em um pequeno detalhe. Como dentro da div de carregamento os links não funcionavam, eu usei a função .live do jquery, os links funcionaram tranquilamente a partir do .live mas aquele texto de mensagem "carregando..." que aparece e some, parou de funcionar, alguém sabe como posso arrumar este JS? Se alguém der uma luz fico muito agradecido! / $.fn.betterLoader = function(settings) { var defaults = { loading: "#mainContent", fire: ".menu", message: "Carregando...", target: "#mainContent", url: "teste.php" } settings = $.extend(defaults, settings); $this = $(this); /* * * Hide the loading content * */ if(settings.loading != settings.target) $("" + settings.loading + "").hide(); else $("" + settings.loading + "").show(); /* * * Show initial content, like body onload's attribute * */ $.get("" + settings.url + "", {}, function(data){$("" + settings.target + "").empty().html(data);}); /* * * Click function * */ $("" + settings.fire + "").live('click', function() { /* * * Ajax Start: Shows loading message and hide the target element * */ $("" + settings.loading + "").live('ajaxStart', function() { $(this).html("" + settings.message + ""); $("" + settings.target + "").hide(); }); /* * * Ajax Stop: Hide loading message and shows the target element * */ $("" + settings.loading + "").live('ajaxStop', function() { $(this).hide(); $("" + settings.target + "").show(); }); $.get("" + $(this).attr("rel") + "", {}, function(data){$("" + settings.target + "").empty().html(data);}); $.get("" + $(this).attr("action") + "", {}, function(data){$("" + settings.target + "").empty().html(data);}); $.get("" + $(this).attr("onclick") + "", {}, function(data){$("" + settings.target + "").empty().html(data);}); $.get("" + $(this).attr("href") + "", {}, function(data){$("" + settings.target + "").empty().html(data);}); }); return $this; } A parte que estou tendo problemas é esta * Click function * */ $("" + settings.fire + "").live('click', function() { /* * * Ajax Start: Shows loading message and hide the target element * */ $("" + settings.loading + "").live('ajaxStart', function() { $(this).html("" + settings.message + ""); $("" + settings.target + "").hide(); }); /* * * Ajax Stop: Hide loading message and shows the target element * */ $("" + settings.loading + "").live('ajaxStop', function() { $(this).hide(); $("" + settings.target + "").show(); }); Os links abrem em void(0) <td height="26" class="verdana_menu"><a href="java script: void(0)" class="menu" rel="PCI_cad_cliente.php?url=<?=$url;?>">Cadastrar</a><img src="img/icone.png" width="20" height="20" align="absmiddle" /></td>
×
×
  • Criar Novo...