Example #1
0
function getPowerHTMLforLens($lens)
{
    global $mysqli;
    $powerSQL = "SELECT variation,\tbaseCurve,\tdiameter, sphere, cylinder,\taxis, addPwr, colors_enh, colors_opq FROM pn_lenses_powers WHERE lensID = " . $lens['tid'];
    $powerResult = $mysqli->query($powerSQL);
    $pwrCount = $powerResult->num_rows;
    $html = "";
    $variation = 1;
    while ($powerRow = $powerResult->fetch_assoc()) {
        $array[0] = $powerRow;
        //the formatNumberText function expects a 2D array
        $power = formatNumberText($array);
        $power = $power[0];
        //change it back to a 1D array
        $html .= "<p><table border='1' cellspacing='0' style='margin:7px; width:90%;' bordercolor='#f1f6fa'>";
        $variationLabel = $power['variation'] != "" ? $power['variation'] : $variation;
        if ($pwrCount > 1) {
            $html .= "<tr><td>Variation:</td><td>  " . $variationLabel . "</td></tr>";
        }
        $html .= "<tr><td width='25%'>Base Curve:</td><td>" . $power['baseCurve'] . "</td></tr>";
        $html .= "<tr><td>Diameter:</td><td>" . $power['diameter'] . "</td></tr>";
        $html .= "<tr><td>Sphere:</td><td>" . $power['sphere'] . "</td></tr>";
        if ($lens['toric'] == 1) {
            $html .= "<tr><td>Cyl Power:</td><td>" . $power['cylinder'] . "</td></tr>";
            $html .= "<tr><td>Cyl Axis:</td><td>  " . $power['axis'] . "</td></tr>";
        }
        if ($lens['bifocal'] == 1) {
            $html .= "<tr><td>Add power:</td><td>  " . $power['addPwr'] . " </td></tr>";
        }
        if ($lens['cosmetic'] == 1) {
            $html .= "<tr><td>Colors (enhancers):</td><td>  " . $power['colors_enh'] . "</td></tr>";
            $html .= "<tr><td>Colors (opaque): </td><td> " . $power['colors_opq'] . "</td></tr>";
        }
        $html .= "</table></p>";
        $variation++;
    }
    return $html;
}
Example #2
0
function getPowerHTMLforLens($lens)
{
    $mysqli = DBAccess::getConnection();
    $powerSQL = "SELECT variation,\tbaseCurve,\tdiameter, sphere, cylinder,\taxis, addPwr, colors_enh, colors_opq FROM pn_lenses_powers WHERE lensID = " . $lens['tid'];
    $result = $mysqli->selectQuery($powerSQL);
    $pwrCount = $result->num_rows;
    $html = "";
    $variation = 1;
    while ($powerRow = $result->fetch_assoc()) {
        $array[0] = $powerRow;
        //the formatNumberText function expects a 2D array
        $power = formatNumberText($array);
        $power = $power[0];
        //change it back to a 1D array
        //$variationLabel = ($power['variation'] !="")?$power['variation'] :$variation;
        if ($pwrCount > 1) {
            $html .= "\n -- Variation " . $variation . " --\n";
        }
        $html .= " -Base Curve: " . $power['baseCurve'] . "\n";
        $html .= " -Diameter: " . $power['diameter'] . "\n";
        $html .= " -Sphere: \n" . $power['sphere'] . "\n\n";
        if ($lens['toric'] == 1) {
            $html .= " -Cyl Power: " . $power['cylinder'] . "\n";
            $html .= " -Cyl Axis: " . $power['axis'] . "\n";
        }
        if ($lens['bifocal'] == 1) {
            $html .= " -Add power:  " . $power['addPwr'] . " \n";
        }
        if ($lens['cosmetic'] == 1) {
            $html .= " -Colors (enhancers):  " . $power['colors_enh'] . "\n";
            $html .= " -Colors (opaque):  " . $power['colors_opq'] . "\n";
        }
        //$html .= "\n";
        $variation++;
    }
    return $html;
}
Example #3
0
 function getLensDetails($id)
 {
     $id = abs(intval($id));
     $query = "select pnl.pn_tid as id, \n\t\tpnl.pn_name as name, \n\t\tpnl.pn_image as image, \n\t\tpnlc.pn_comp_name as company,\n\t\tpnlc.pn_logo as comp_logo,\n\t\tpnlp.pn_poly_name as polymer,\n\t\tpnl.pn_dk as dk,\n\t\tIF(pnl.pn_dk > 0 and pnl.pn_ct > 0,(pnl.pn_dk / ( pnl.pn_ct * 10 ) ),'') as dkt, \n\t\tpnlp.pn_fda_grp as fda_group,\n\t\tpnlp.pn_h2o as water,\n\t\tpnl.pn_ct as ct,\n\t\tpnl.pn_oz as oz,\n\t\tpnl.pn_process_text as man_process,\n\t\tpnl.pn_wear as wear,\n\t\tIF(pnl.pn_ew = 0,'no','yes') as ew,\n\t\tpnl.pn_qty as quantity,\n\t\tpnl.pn_replace_text as replacement,\n\t\tIF(pnl.pn_visitint > 0,'yes','no') as visitint,\n\t\tpnl.pn_other_info as comments,\n\t\tpnl.pn_toric as toric,\n\t\tpnl.pn_toric_type as toric_type,\n\t\tpnl.pn_bifocal as bifocal,\n\t\tpnl.pn_bifocal_type as bifocal_type,\n\t\tpnl.pn_cosmetic as cosmetic,\n\t\tpnl.pn_sph_notes as sph_notes,\n\t\tpnl.pn_cyl_notes as cyl_notes,\n\t\tpnl.pn_price as prices,\n\t\tpnl.pn_markings as appearance,\n\t\tpnl.pn_website as website,\n\t\tpnl.pn_fitting_guide as fitting_guide, \n\t\tpnl.pn_discontinued as discontinued, \n\t\tpnlc.pn_comp_desc as company_description,\n\t\tpnlc.pn_phone as company_phone,\n\t\tpnlc.pn_address as company_address,\n\t\tpnlc.pn_city as company_city,\n\t\tpnlc.pn_state as company_state,\n\t\tpnlc.pn_zip as company_zip,\n\t\tpnlc.pn_url as company_url,\n\t\tpnlc.pn_email as company_email, \n\t\tufav.favorite, \n\t\tpop.score\n\t\tfrom \n\t\tpn_lenses pnl \n\t\tLEFT JOIN pn_lenses_companies pnlc ON (pnl.pn_comp_id = pnlc.pn_comp_tid) \n\t\tLEFT JOIN pn_lenses_polymers pnlp ON (pnl.pn_poly_id = pnlp.pn_poly_tid) \n\t\tLEFT JOIN pn_lenses_user_favorites ufav ON (ufav.item_id = pnl.pn_tid)\n\t\tLEFT JOIN pn_lenses_popularity pop ON (pop.itemID = pnl.pn_tid)\n\t\twhere \n\t\tpnl.pn_tid = {$id}";
     //echo $query;
     $db = databaseObj();
     $db->setQuery($query);
     $lens = $db->loadAssoc();
     if ($lens === null) {
         JError::raiseError(500, 'Error reading db');
     }
     if (!empty($lens)) {
         if (strstr($lens['image'], ',')) {
             $images = explode(',', $lens['image']);
             $lens['image'] = trim($images[0]);
             if (count($images) > 1) {
                 $lens['images'] = array_map('trim', $images);
             }
         }
         if ($lens['image'] != '') {
             $size = @getimagesize('http://www.eyedock.com/modules/Lenses/pnimages/lens_images/' . $lens['image']);
             if ($size) {
                 $lens['image_width'] = $size[0];
             }
         }
         if ($lens['comp_logo'] != '') {
             $sizeL = @getimagesize('http://www.eyedock.com/modules/Lenses/pnimages/comp_logos/' . $lens['comp_logo']);
             if ($sizeL) {
                 $lens['logo_image_width'] = $sizeL[0];
             }
         }
         if ($lens['website'] != '' && !preg_match('/^http[s]?:/i', $lens['website'])) {
             $lens['website'] = 'http://www.eyedock.com/' . $lens['website'];
         }
         if ($lens['fitting_guide'] != '' && !preg_match('/^http[s]?:/i', $lens['fitting_guide'])) {
             $lens['fitting_guide'] = 'http://www.eyedock.com/' . $lens['fitting_guide'];
         }
         if ($lens['dkt'] != '') {
             $lens['dkt'] = round($lens['dkt'], 1);
         }
         if ($lens['comments'] != '') {
             if ($lens['comments'] == strip_tags($lens['comments'])) {
                 $lens['comments'] = nl2br($lens['comments']);
             }
         }
     }
     $powerquery = "SELECT * FROM pn_lenses_powers WHERE lensID = {$id}";
     //echo $powerquery;
     //$db = databaseObj();
     $db->setQuery($powerquery);
     $powers = $db->loadAssocList();
     //print_r($powers);
     if ($powers === null) {
         JError::raiseError(500, 'Error reading db');
     }
     if (!empty($powers)) {
         $lens['lensPowers'] = formatNumberText($powers);
     }
     //print_r($lens);
     return $lens;
 }