Exemple #1
0
 public function getNewUser($limit = 9)
 {
     $sql = "SELECT * FROM " . get_table("customers") . " ORDER BY id DESC LIMIT " . $limit;
     $rs = $this->mDb->getAll($sql);
     if ($rs) {
         foreach ($rs as $key => $val) {
             $rs[$key]["expiration"] = diffDate($val["date_added"], date("Y-m-d H:i:s"));
         }
     }
     return $rs;
 }
Exemple #2
0
function showDate($status, $submit_date, $promote_date)
{
    $date;
    if (!strcmp($status, "popular")) {
        echo "made popular ";
        $date = $promote_date;
    } elseif (!strcmp($status, "upcoming")) {
        echo "submitted ";
        $date = $submit_date;
    }
    //"2008-04-03 15:14:54"
    echo "<span class=\"d\" property=\"dc:date\" content=\"" . date("Y-m-d H:m:s", $date) . "\"> <span class=\"d\">" . diffDate($date, time()) . " ago</span></span>";
}
{
    $d1 = explode($sep, $d1);
    $d2 = explode($sep, $d2);
    switch ($type) {
        case 'A':
            $X = 31536000;
            break;
        case 'M':
            $X = 2592000;
            break;
        case 'D':
            $X = 86400;
            break;
        case 'H':
            $X = 3600;
            break;
        case 'MI':
            $X = 60;
            break;
        default:
            $X = 1;
    }
    echo $d2[1];
    echo $d2[2];
    echo $d2[0];
    return floor((mktime(0, 0, 0, $d2[1], $d2[2], $d2[0]) - mktime(0, 0, 0, $d1[1], $d1[2], $d1[0])) / $X);
}
$d1 = "2011-01-01";
$d2 = "2011-01-10";
echo diffDate($d1, $d2, 'D');
Exemple #4
0
 static function leftDate($createDate, $period)
 {
     $beginToNow = diffDate($createDate);
     $result = $period - $beginToNow['days'];
     return $result;
 }
Exemple #5
0
function timePast($date)
{
    $timePast = diffDate($date, date("Y-m-d H:i:s"));
    $tiempo = "";
    if ($timePast[2] > 29) {
        $t = explode(" ", dateField($date));
        $tiempo = $t[0];
    } else {
        if ($timePast[2] > 0) {
            $tiempo .= $timePast[2] . "d ";
        }
        $tiempo .= $timePast[3] . "h ";
        $tiempo .= $timePast[4] . "m ";
    }
    return $tiempo;
}
        ?>
</span> <?php 
        echo diffDate($value['date_creation']);
        ?>
 »</p>
        <hr class="hr-post">
        <p class="contenu"><?php 
        echo $value['texte'];
        ?>
</p>
        <?php 
        if (isset($value['date_modification'])) {
            ?>
          <p class="modification" style="display:inline-block;">
            « Modifié: <?php 
            echo diffDate($value['date_modification']);
            ?>
 par <?php 
            echo $pseudouser[$value['id_user_modification']];
            ?>
 »
          </p>
        <?php 
        }
        ?>

        <?php 
        if ($_SESSION['user']['id'] == $value['id_utilisateur']) {
            ?>
          <form action="" method="post" style="display:inline-block; float:right;">
            <input type="hidden" name="id" value="<?php 
Exemple #7
0
                $estadoPro = "Adjudicado";
            } else {
                if ($rs_proj->pro_status == "F") {
                    $adju = "";
                    $estadoPro = "Finalizado";
                } else {
                    if ($rs_proj->pro_status == "C") {
                        $adju = "";
                        $estadoPro = "Cancelado";
                    } else {
                        $adju = "No has adjudicado el proyecto aún, ¡hazlo ya!";
                    }
                }
            }
        }
        $diasRest = diffDate(date("Y-m-d H:i:s"), $rs_proj->pro_date_end);
        ?>
	 <div class="listProyectos">
			 <div class="left listProyectosLeft alignCenter">
			 	<div class="listProyectosOfertas">
				 	<div class="numOfertas"><?php 
        echo getNumOfertas($rs_proj->pro_id);
        ?>
</div>
				 	<div class="txtOfertas">Ofertas</div>
			 	</div>
			 	<div class="proStatus"> <?php 
        if ($rs_proj->pro_status == "A") {
            echo $diasRest[2];
            ?>
 d&iacute;as para adjudicar<?php 
              <form action="" method="post">
                <input type="hidden" name="id_publication" value="<?php 
                    echo $value['id'];
                    ?>
">
                <input class="deletebutton" type="submit" name="deletePub" value="&#10006;">
              </form>
            <?php 
                }
                ?>
            <h1><?php 
                echo $value['titre'];
                ?>
</h1>
            <h2><?php 
                echo diffDate($value['date']);
                ?>
</h2>
            <p><?php 
                echo $value['texte'];
                ?>
</p>
            <h5 class="posteurPub"><?php 
                echo lang('Publié par');
                ?>
: <span><?php 
                echo $user[$value['id']];
                ?>
 </span></h5>
          </div>
Exemple #9
0
                $usuario->cod_prof = $dados_usuario_nativo->getCodProf();
                $usuario->nome = $dados_usuario_nativo->getNome();
                $usuario->cpf = $dados_usuario_nativo->getCpf();
            }
            echo json_encode($usuario);
        } else {
            FachadaUtilidades::getInstancia()->removerToken($token);
            echo "session expired!";
        }
    }
});
$app->get('/visitas/:token', function ($token) {
    //recuperar codigo do usuario pelo token recebido do app
    $dados_usuario = FachadaUtilidades::getInstancia()->recuperarCodigoUsuario($token);
    if ($dados_usuario->getCodProf() != null) {
        if (diffDate($dados_usuario->getDataHora(), 'MI')) {
            $dados_visita_nativo = FachadaProfissional::getInstancia()->listarVisitasPorUsuario($dados_usuario->getCodProf());
            if (!is_null($dados_visita_nativo)) {
                $visitas = NULL;
                foreach ($dados_visita_nativo as $visita) {
                    $std = new Visita();
                    $std->cod_visita = $visita->getCodVisita();
                    $std->cod_prof = $visita->getCodProf();
                    $std->cod_paciente = $visita->getCodPaciente();
                    $std->nome = $visita->getNome();
                    $std->nascimento = $visita->getNascimento();
                    $std->sexo = $visita->getSexo();
                    $std->rua = $visita->getRua();
                    $std->numero = $visita->getNumero();
                    $std->bairro = $visita->getBairro();
                    $std->cidade = $visita->getCidade();
Exemple #10
0
.</p>
          </div>
            <div class="nombre-reponses">
              <?php 
    echo $nbreponses[$value['id']];
    ?>
 Réponse(s)<br> <?php 
    echo !empty($nbvues[$value['id']]) ? $nbvues[$value['id']] . ' Vue(s)' : 'Aucune Vue';
    ?>
            </div>
          <?php 
    if ($nbreponses[$value['id']] != 0) {
        ?>
            <div class="dernier-message">
              <br><?php 
        echo diffDate($lastMessage[$value['id']]['date_creation']);
        ?>
<br>par <span style="color:blue;"><?php 
        echo $lastMessage[$value['id']]['pseudo'];
        ?>
</span>
            </div>
          <?php 
    } else {
        ?>
            <div class="dernier-message">
              <?php 
        echo lang('Aucune réponse encore postée');
        ?>
.
            </div>
 $mes1 = $arr[1];
 $ano1 = $arr[2];
 $dia2 = $arr2[0];
 $mes2 = $arr2[1];
 $ano2 = $arr2[2];
 $a1 = ($ano2 - $ano1) * 12;
 $m1 = $mes2 - $mes1 + 1;
 $m3 = $m1 + $a1;
 $m3;
 //Calcula a média do mes
 @($media_mes = number_format($dados_conta['total'] / ($m3 - 1), 2, ',', '.'));
 $hoje = date('Y-m-d', mktime());
 $fim_ano = $ano . "-12-31";
 $ini_ano = $ano . "-01-01";
 $dias_restante = diffDate($hoje, $fim_ano);
 $dias_passado = diffDate($ini_ano, $hoje);
 //Calcula a média diaria dos gastos executados
 $media_dia = $dados_conta['total'] / $dias_passado;
 $media_dia_formata = number_format($media_dia, 2, ',', '.');
 //Calcula a projecao dos gastos baseado na media por dia X dias restantes no ano
 $projecao = $media_dia * $dias_restante + $dados_conta['total'];
 $projecao_formata = number_format($projecao, 2, ',', '.');
 //Cacula o percentual projetado
 $percentual_projetado = number_format($projecao / $dados['valor'] * 100, 2);
 //Ajusta as formatacoes caso passe do previsto
 if ($dados_conta['total'] > $dados['valor']) {
     $formata_executado = 'color: #990000';
 }
 if ($projecao > $dados['valor']) {
     $formata_projecao = 'color: #990000';
 }
Exemple #12
0
 /**
  * Check if session ID is valid, not expired, & update timestamp to now
  *
  *@access private
  *@param string $idsession Session ID to validate
  *@return int 0 if error, else return 1
  */
 function checkidsession($idsession)
 {
     global $db, $l;
     $query = "SELECT userid,date FROM dns_session\n    WHERE sessionID='" . mysql_real_escape_string($idsession) . "'";
     $res = $db->query($query);
     $line = $db->fetch_row($res);
     if ($db->error()) {
         $this->error = $l['str_trouble_with_db'];
         return 0;
     }
     $date = $line[1];
     if ($date) {
         // check if $date - now <= 30mn
         if (diffDate($date) > 30 * 60) {
             // session expired
             // delete session
             $query = "DELETE FROM dns_session WHERE sessionID='" . $idsession . "'";
             $db->query($query);
             $this->error = $l['str_session_expired'];
             return 0;
         }
         // update DB with new date
         $query = "UPDATE dns_session SET date=now()\n      WHERE sessionID='" . $idsession . "'";
         $db->query($query);
         $this->userid = $line[0];
         $this->idsession = $idsession;
     } else {
         // date empty == no such id in DB
         $this->error = $l['str_session_expired'];
         return 0;
     }
     return 1;
 }
Exemple #13
0
 $filter = $_GET['filtro'];
 $campos = "";
 if ($filter == "rechazadas") {
     $projects = $rejected_projects;
 } elseif ($filter == "adjudicados") {
     $projects = $adjudicated_projects;
 } elseif ($filter == "finalizados") {
     $projects = $closed_projects;
 } else {
     //$projects = $my_projects;  //TODO aclarar esta parte con paulo ofertas o proyectos??
     $projects = $opened_projects;
     $filter = "enviadas";
 }
 $project_list = array();
 while ($rs_proj = mysql_fetch_object($projects)) {
     $rs_proj->days_left = diffDate(date("Y-m-d H:i:s"), $rs_proj->pro_date_end);
     //$diasRest
     $rs_proj->pro_tit = ucfirst($rs_proj->pro_tit);
     $rs_proj->mensaje = substr($rs_proj->mensaje, "0", "1000");
     //Get proyect owner
     $pro_user = listAll("proyectos", "WHERE pro_id = '{$rs_proj->pro_id}'");
     $pro_user = mysql_fetch_object($pro_user);
     //$rs_pro_user
     $rs_proj->project_owner = getUserInfo($pro_user->user_id);
     //$user_crea
     $rs_proj->project_owner_ratings = ratings($pro_user->user_id);
     //TODO mejorar esto, al ejecutar los queries de arriba sobre project view no hay necesidad de hacer esto
     $proView = Project_View::loadProjectById($rs_proj->pro_id);
     $rs_proj->total_ofertas = $proView->total_ofertas;
     $project_list[] = $rs_proj;
 }
Exemple #14
0
 public function ListarFinalizados($query = null)
 {
     try {
         $permissoes = listarAcesso();
         if ($query == null) {
             /*$stmt = $this->p->query(" SELECT C.id as id_chamada , C.assunto, C.prioridade, C.dat_solicitacao ,P.nome_completo as usuario_solicitou FROM ".MYSQL_BASE_CHAMADAS." C
             		INNER JOIN ".MYSQL_BASE_PESSOAS." P ON C.id_usuario = P.id
             		INNER JOIN ".MYSQL_BASE_CHAMADAS_ATENDIMENTO." CA ON CA.id_chamada = C.id
             		WHERE C.dat_finalizar IS NULL AND C.dat_excluido IS NULL AND CA.dat_final IS NULL AND CA.id_usuario = ".userId());*/
             $stmt = $this->p->query(" SELECT DISTINCT C.id as id_chamada , C.assunto, C.prioridade, C.dat_solicitacao ,P.nome_completo as usuario_solicitou, CA.status, CA.dat_inicial , CA.dat_final FROM " . MYSQL_BASE_CHAMADAS . " C\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_PESSOAS . " P ON C.id_usuario = P.id\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . MYSQL_BASE_CHAMADAS_ATENDIMENTO . " CA ON CA.id_chamada = C.id\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE C.dat_finalizar IS NOT NULL AND C.dat_excluido IS NULL AND CA.dat_final IS NOT NULL AND CA.status = 'F' ORDER BY dat_final  ;");
             $confirm = "return confirm('Deseja remover esse registro?');";
             foreach ($stmt as $item) {
                 $query = mysql_query("SELECT * FROM tb_chamadas_atendimento WHERE id_chamada = " . $item['id_chamada'] . " AND dat_final IS NOT NULL");
                 $tempo = NULL;
                 while ($row = mysql_fetch_array($query)) {
                     $tempo += diffDate($row['dat_final'], $row['dat_inicial'], 'H');
                 }
                 if ($item['prioridade'] == 'A') {
                     $prioridade = "Alta";
                 } elseif ($item['prioridade'] == 'M') {
                     $prioridade = utf8_encode("M�dia");
                 } else {
                     $prioridade = "Baixa";
                 }
                 echo '<tr>';
                 echo '	<td>' . $item['id_chamada'] . '</td>';
                 echo '	<td>' . $item['usuario_solicitou'] . '</td>';
                 echo '	<td>' . $item['assunto'] . '</td>';
                 echo '	<td>' . dataBrasil($item['dat_solicitacao']) . '</td>';
                 echo '	<td>' . dataBrasil($item['dat_final']) . '</td>';
                 echo '	<td>' . round($tempo, 2) . ' h</td>';
                 echo '	<td>' . $prioridade . '</td>';
                 //Verifica se pode editar
                 echo '</tr>';
             }
         } else {
             $stmt = $this->p->query($query);
         }
         $this->p->__destruct();
         return $stmt;
     } catch (PDOException $ex) {
         echo "Erro: " . $ex->getMessage();
     }
 }