Ejemplo n.º 1
0
function getTransmision()
{
    $sql = "SELECT *, COUNT(*) AS SEN_Number\r\n            FROM camSeminuevos sen\r\n            GROUP BY SEN_Transmision\r\n            ORDER BY SEN_Id ASC\r\n            ";
    /*$structure = array(
          'id_mdo' => 'MDO_Id',
          'nombre_mdo' => 'MDO_Nombre',
          'id_marc' => 'MAR_Id',
          'nombre_marc' => 'MAR_Nombre',
          'cantidad' => 'MAR_Number',
      );*/
    $structure = array("modelo" => array("transmision" => "SEN_Transmision", "id_sen" => "SEN_Id", "cantidad" => "SEN_Number"));
    $params = array();
    $orderBy = array();
    $result = generalQuery(getConnection(), $sql, $params, 0, PDO::FETCH_ASSOC);
    $detail = array();
    $detail = multiLevelJSON($result, $structure, $orderBy);
    echo changeArrayIntoJSON('campa', $detail);
    //echo changeQueryIntoJSON('campa', $structure, getConnection(), $sql, $params, 0, PDO::FETCH_ASSOC);
}
Ejemplo n.º 2
0
function getLogosAgenciesNews()
{
    $sql = "SELECT *\r\n                FROM camAgenciasPrincipales agp\r\n                INNER JOIN (\r\n                    SELECT *\r\n                    FROM camMarcasLogosAgencias\r\n                ) mla\r\n                ON agp.AGP_Id = mla.MLA_AGP_Id\r\n                ORDER BY AGP_Id, MLA_Logo\r\n                ";
    $params = array();
    $structure = array('agencia_principal' => array('agpid' => 'AGP_Id', 'agpnombre' => 'AGP_Agencia', 'agpshort' => 'AGP_Short', 'logo' => 'AGP_Logo'), 'marcas' => array('mlaid' => 'MLA_Id', 'brand' => 'MLA_Logo', 'mlastatus' => 'MLA_Status'));
    $orderBy = array();
    $result = generalQuery(getConnection(), $sql, $params, 0, PDO::FETCH_ASSOC);
    $result = multiLevelJSON($result, $structure, $orderBy);
    $counter = 1;
    for ($i = 0; $i < count($result); $i++) {
        $tltip = $counter <= 6 ? 'top' : 'down';
        $result[$i]['tltip'] = $tltip;
        $animate = $counter <= 6 ? 'animation-slideUp' : 'animation-slideDown';
        $result[$i]['animate'] = $animate;
        $longmarcas = count($result[$i]['marcas']);
        $longcount = 0;
        foreach ($result[$i]['marcas'] as $marca) {
            if ($marca['mlastatus'] == 0) {
                $longcount++;
            }
        }
        if ($longcount == $longmarcas) {
            $result[$i]['marcas'] = array();
        }
        $counter++;
    }
    echo changeArrayIntoJSON('campa', $result);
}
Ejemplo n.º 3
0
function getLogosAgenciesTrucks()
{
    $sql = "SELECT *\n                FROM camAgenciasPrincipales agp\n                INNER JOIN (\n                    SELECT *\n                    FROM camAgencias\n                    WHERE AGN_IsAgencieTrucks = 1\n                    AND AGN_Tipo = 1\n                    AND AGN_Status = 1\n                ) agn\n                ON agp.AGP_Id = agn.AGN_AGP_Id\n                INNER JOIN (\n                    SELECT *\n                    FROM camMarcasLogosAgencias\n                    WHERE MLA_IsTrucks = 1\n                ) mla\n                ON agp.AGP_Id = mla.MLA_AGP_Id\n                ORDER BY AGP_Index\n                ";
    $params = array();
    $structure = array('agencia_principal' => array('agnid' => 'AGN_Id', 'agpid' => 'AGP_Id', 'agpindex' => 'AGP_Index', 'agpnombre' => 'AGP_Agencia', 'agpshort' => 'AGP_Short', 'logo' => 'AGN_Logo1', 'agpagencia' => 'AGP_Agencia', 'agpshort' => 'AGP_Short', 'agnnombre' => 'AGN_Nombre', 'agnurl' => 'AGN_Url'), 'marcas' => array('mlaid' => 'MLA_Id', 'brand' => 'MLA_Logo', 'mlastatus' => 'MLA_Status'));
    $orderBy = array();
    $result = generalQuery(getConnection(), $sql, $params, 0, PDO::FETCH_ASSOC);
    $result = multiLevelJSON($result, $structure, $orderBy);
    $counter = 1;
    for ($i = 0; $i < count($result); $i++) {
        $tltip = $counter <= 1 ? 'top' : 'none';
        $result[$i]['tltip'] = $tltip;
        $animate = $counter <= 1 ? 'animation-slideUp' : 'animation-none';
        $result[$i]['animate'] = $animate;
        $longmarcas = count($result[$i]['marcas']);
        $longcount = 0;
        foreach ($result[$i]['marcas'] as $marca) {
            if ($marca['mlastatus'] == 0) {
                $longcount++;
            }
        }
        if ($longcount == $longmarcas) {
            $result[$i]['marcas'] = array();
        }
        $counter++;
    }
    echo changeArrayIntoJSON('campa', $result);
}