Exemple #1
0
    function display($tpl = null)
    {
        global $mainframe, $option;
        $mainframe = JFactory::getApplication();
        $db = JFactory::getDBO();
        $search = $mainframe->getUserStateFromRequest("{$option}.search", 'search', '', 'string');
        if (strpos($search, '"') !== false) {
            $search = str_replace(array('=', '<'), '', $search);
        }
        $search = JString::strtolower($search);
        $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
        $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
        //	echo $limitstart;
        //	echo $limit;
        $where = array();
        if ($search) {
            $where[] = 'LOWER(pn_poly_name) LIKE ' . $db->Quote('%' . $db->getEscaped($search, true) . '%', false);
        }
        $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
        //	if($limiter || $limit) {
        $limiter = ' LIMIT ' . $limitstart . ', ' . $limit;
        //	}
        $mysqli = DBAccess::getConnection();
        $query = 'SELECT * from pn_lenses_polymers';
        $result = $mysqli->selectQuery($query);
        $total = $result->num_rows;
        //	echo $total;
        jimport('joomla.html.pagination');
        $pagination = new JPagination($total, $limitstart, $limit);
        //$mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
        $query = 'SELECT * from pn_lenses_polymers ' . $where . ' ORDER BY pn_poly_name' . $limiter;
        $result = $mysqli->selectQuery($query);
        while ($obj = $result->fetch_object()) {
            $polymers[] = $obj;
        }
        foreach ($polymers as $poly) {
            switch ($poly->pn_fda_grp) {
                case 1:
                    $poly->pn_fda_grp = 'Low Water (<50 percent water content), Nonionic Polymers.<br />This group has the greatest resistance to protein deposition due
to its lower water content and nonionic nature. Heat, chemical, and hydrogen peroxide care regimens can be used.';
                    break;
                case 2:
                    $poly->pn_fda_grp = 'High Water (greater than 50 percent water content), Nonionic Polymers.<br />The higher water content of this group results in g
reater protein attraction than with group 1. However, the nonionic polymers reduce the potential for further attraction. Heat disinfection should be a
voided because of the high water content. In addition, sorbic acid and potassium sorbate preservatives can discolor the lenses.';
                    break;
                case 3:
                    $poly->pn_fda_grp = 'Low Water (less then 50 percent water content), Ionic Polymers.<br />The lower water content but ionic nature of these polymers
 results in intermediate protein resistance. Heat, chemical and hydrogen peroxide care systems may be used.';
                    break;
                case 4:
                    $poly->pn_fda_grp = 'High Water (greater then 50 percent water content), Ionic Polymers.<br />Because of the high water content and ionic nature of
these polymers they attract more proteins than any other group. It is best to avoid heat disinfection and sorbic acid preservatives.';
                    break;
            }
        }
        $this->assignRef('polymers', $polymers);
        $this->assignRef('pagination', $pagination);
        parent::display($tpl);
    }
Exemple #2
0
 function deletePolymer($id)
 {
     $mysqli = DBAccess::getConnection();
     //$mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
     $query = 'DELETE from pn_lenses_polymers where pn_poly_tid = ' . $id;
     echo $query;
     if ($result = $mysqli->selectQuery($query)) {
         return true;
     } else {
         return false;
     }
 }
Exemple #3
0
 function display($tpl = null)
 {
     global $mainframe, $option;
     $mainframe = JFactory::getApplication();
     $db = JFactory::getDBO();
     $search = $mainframe->getUserStateFromRequest("{$option}.search", 'search', '', 'string');
     if (strpos($search, '"') !== false) {
         $search = str_replace(array('=', '<'), '', $search);
     }
     $search = JString::strtolower($search);
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
     //	echo $limitstart;
     //	echo $limit;
     $where = array();
     if ($search) {
         //echo $search;
         $where[] = 'LOWER(name) LIKE ' . $db->Quote('%' . $db->getEscaped($search, true) . '%', false);
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     //	if($limiter || $limit) {
     $limiter = ' LIMIT ' . $limitstart . ', ' . $limit;
     //	}
     $mysqli = DBAccess::getConnection();
     $query = 'SELECT * from pn_lenses_companies';
     $result = $mysqli->selectQuery($query);
     $total = $result->num_rows;
     //	echo $total;
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit);
     //$mysqli = getSQLI();
     $query = 'SELECT * from pn_lenses_companies ' . $where . ' ORDER BY pn_comp_name' . $limiter;
     //echo $query;
     $result = $mysqli->selectQuery($query);
     if ($result) {
         while ($obj = $result->fetch_object()) {
             $companies[] = $obj;
         }
     }
     $this->assignRef('search', $search);
     $this->assignRef('companies', $companies);
     $this->assignRef('pagination', $pagination);
     $this->addToolBar();
     parent::display($tpl);
 }
Exemple #4
0
 function display($tpl = null)
 {
     global $mainframe;
     $id = JRequest::getVar('cid', array(0), '', 'array');
     //	$boxchecked = JRequest::getVar( 'boxchecked' );
     //	echo $boxchecked;
     $uid = (int) @$id[0];
     $edit = JRequest::getVar('edit', true);
     if ($edit) {
         //$mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
         $mysqli = DBAccess::getConnection();
         $query = 'SELECT * from pn_lenses_polymers where pn_poly_tid = ' . $uid;
         $result = $mysqli->selectQuery($query);
         $polymer = $result->fetch_object();
     }
     $this->assignRef('polymer', $polymer);
     parent::display($tpl);
 }
Exemple #5
0
 function display($tpl = null)
 {
     global $mainframe, $option;
     $db = JFactory::getDBO();
     $mainframe = JFactory::getApplication();
     $search = $mainframe->getUserStateFromRequest("{$option}.search", 'search', '', 'string');
     if (strpos($search, '"') !== false) {
         $search = str_replace(array('=', '<'), '', $search);
     }
     $search = JString::strtolower($search);
     $limit = $mainframe->getUserStateFromRequest('global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int');
     $limitstart = $mainframe->getUserStateFromRequest($option . '.limitstart', 'limitstart', 0, 'int');
     //	echo $limitstart;
     //	echo $limit;
     $where = array();
     if ($search) {
         $where[] = 'LOWER(l.pn_name) LIKE ' . $db->Quote('%' . $db->getEscaped($search, true) . '%', false);
     }
     $where = count($where) ? ' WHERE ' . implode(' AND ', $where) : '';
     //	if($limiter || $limit) {
     $limiter = ' LIMIT ' . $limitstart . ', ' . $limit;
     //	}
     $mysqli = DBAccess::getConnection();
     //$mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
     $query = 'SELECT pn_tid from pn_lenses';
     $result = $mysqli->selectQuery($query);
     $total = $result->num_rows;
     //	echo $total;
     jimport('joomla.html.pagination');
     $pagination = new JPagination($total, $limitstart, $limit);
     $query = 'SELECT l.*, comp.pn_comp_name as companyname, pn_updated as updated, pn_discontinued as discontinued, pn_display as display, pn_bifocal as bifocal, pn_toric as toric, pn_cosmetic as cosmetic, poly.pn_poly_name as polymername from pn_lenses l left join pn_lenses_companies comp on (l.pn_comp_id = comp.pn_comp_tid) left join pn_lenses_polymers poly on (l.pn_poly_id = poly.pn_poly_tid)' . $where . ' ORDER BY l.pn_name' . $limiter;
     //	echo $query;
     $result = $mysqli->selectQuery($query);
     while ($obj = $result->fetch_object()) {
         $lenses[] = $obj;
     }
     $this->assignRef('lenses', $lenses);
     $this->assignRef('pagination', $pagination);
     parent::display($tpl);
 }
Exemple #6
0
 function display($tpl = null)
 {
     global $mainframe;
     $id = JRequest::getVar('cid', array(0), '', 'array');
     $boxchecked = JRequest::getVar('boxchecked');
     //echo $boxchecked;
     $uid = (int) @$id[0];
     $data['company'] = nl2br(getCompanyReport($uid));
     //$date['company'] = str_replace("\n", "<br/>");
     $data['lenses'] = nl2br(getCompanyLensesReport($uid));
     $mysqli = DBAccess::getConnection();
     $sql = "SELECT * from pn_lenses_companies WHERE pn_comp_tid = {$uid}";
     $result = $mysqli->selectQuery($sql);
     $row = $result->fetch_assoc();
     //massage the data for the email
     if ($row['pn_contact_email'] == "") {
         $row['pn_contact_email'] = $row['pn_email'];
     }
     if ($row['pn_comp_name_short'] == "") {
         $row['pn_comp_name_short'] = $row['pn_comp_name'];
     }
     //get the email intro content
     $row['content'] = makeEmailIntro($row);
     //pass along the contact person
     $row['contact'] = $row['pn_contact_nameF'] . " " . $row['pn_contact_nameL'];
     if ($row['pn_contact_nameF'] == "") {
         $row['contact'] = $row['pn_comp_name_short'];
     }
     //echo $data['lenses'];
     //had to reset the database, otherwise joomla was looking for the component in the 'eyedock_data' database and causing an error (I assume the function above was causing this database switch)
     //$connect =mysql_connect('mysql.eyedock.com', 'eyedockdatauser', 'kvBS^VQR');
     //mysql_connect('localhost', 'root', 'root');
     $connect = getCONNECT();
     $database = mysql_select_db("eyedockjoomla", $connect);
     $this->assignRef('data', $data);
     $this->assignRef('companyData', $row);
     parent::display($tpl);
 }
Exemple #7
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;
}
Exemple #8
0
 function display($tpl = null)
 {
     global $mainframe;
     $mysqli = DBAccess::getConnection();
     $id = JRequest::getVar('cid', array(0), '', 'array');
     //	$boxchecked = JRequest::getVar( 'boxchecked' );
     //	echo $boxchecked;
     $uid = (int) @$id[0];
     $edit = JRequest::getVar('edit', true);
     if ($edit) {
         /*if($boxchecked != 0){
         			$uid = $boxchecked;
         		}*/
         //$mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
         $query = 'SELECT * from pn_lenses where pn_tid = ' . $uid;
         $result = $mysqli->selectQuery($query);
         $lens = $result->fetch_object();
         $query = 'SELECT * from pn_lenses_powers where lensID = ' . $uid;
         $result = $mysqli->selectQuery($query);
         while ($obj = $result->fetch_object()) {
             $lenspowers[] = $obj;
         }
     }
     //$mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
     $query = 'SELECT pn_comp_tid, pn_comp_name from pn_lenses_companies ORDER BY  pn_comp_name ASC ';
     $result = $mysqli->selectQuery($query);
     while ($obj = $result->fetch_object()) {
         $companies[] = $obj;
     }
     $query = 'SELECT * from pn_lenses_polymers ORDER BY pn_poly_name ASC';
     $result = $mysqli->selectQuery($query);
     while ($obj = $result->fetch_object()) {
         $polymers[] = $obj;
     }
     if ($edit) {
         $bcsimples = explode(',', $lens->pn_bc_simple);
         $bcsimples = array_filter(array_map('trim', $bcsimples));
         //remove whitespace
         $enhsimples = explode(',', $lens->pn_enh_names_simple);
         $enhsimples = array_filter(array_map('trim', $enhsimples));
         //remove whitespace
         $opqsimples = explode(',', $lens->pn_opaque_names_simple);
         $opqsimples = array_filter(array_map('trim', $opqsimples));
         //remove whitespace
     } else {
         // needed to avoid an error on the template
         $bcsimples = array();
         $enhsimples = array();
         $opqsimples = array();
     }
     $this->assignRef('edit', $edit);
     $this->assignRef('polymers', $polymers);
     $this->assignRef('companies', $companies);
     $this->assignRef('lens', $lens);
     $this->assignRef('bcsimples', $bcsimples);
     $this->assignRef('enhsimples', $enhsimples);
     $this->assignRef('opaquesimples', $opqsimples);
     if ($edit) {
         $this->assignRef('lenspowers', $lenspowers);
     }
     parent::display($tpl);
 }
Exemple #9
0
    $pwrRow['id'] = $rxString;
    $pwrRow['label'] = $rxString . " (CL power)";
    $pwrRow['type'] = "power";
    $pwrRow['rx'] = $rxString;
    array_push($return, $mrRow);
    array_push($return, $pwrRow);
}
if ($which == "scl" && $onlyRx != 1) {
    //break all the words into a single array
    $phrase_array = explode(" ", $q);
    foreach ($phrase_array as $value) {
        $name[] = " pn_name LIKE '%{$value}%' ";
        $alias[] = " pn_aliases LIKE '%{$value}%' ";
        $company[] = " pn_comp_name LIKE '%{$value}%' ";
    }
    $nameString = implode(" AND ", $name);
    $aliasString = implode(" AND ", $alias);
    $companyString = implode(" AND ", $company);
    $where[] = "   ( ({$nameString}) OR ({$aliasString}) OR ({$companyString}) ) ";
    $where = implode(" AND ", $where);
    $sql = "SELECT pn_tid as id, pn_name as label, '{$which}' as type\n\t\tFROM pn_lenses \n\t\tLEFT JOIN pn_lenses_companies ON pn_comp_tid = pn_comp_id\n\t\tWHERE\n\t\t{$where} \n\t\tORDER BY pn_name";
    //echo($sql);
    //$db = databaseObj();
    //$db->setQuery($sql);
    $mysqli = DBAccess::getConnection();
    $result = $mysqli->selectQuery($sql);
    while ($row = $result->fetch_assoc()) {
        array_push($return, $row);
    }
}
echo json_encode($return);
Exemple #10
0
 function deleteCompany($id)
 {
     $mysqli = DBAccess::getConnection();
     $query = 'DELETE from pn_lenses_companies where pn_comp_tid = ' . $id;
     //echo $query;
     if ($result = $mysqli->selectQuery($query)) {
         return true;
     } else {
         return false;
     }
 }
Exemple #11
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
        $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;
}
Exemple #12
0
 function deleteLens($id)
 {
     $mysqli = DBAccess::getConnection();
     //$mysqli = new mysqli(self::GPHOST, self::GPUSER, self::GPPASS, self::GPDB);
     $query = 'DELETE from pn_lenses where pn_tid = ' . $id;
     //echo $query;
     //TMZ added: now we need to delete the rows in the pn_lenses_powers table assoc with this lens.
     $resultarr[] = $mysqli->selectQuery($query);
     $query = 'DELETE from pn_lenses_powers where lensID = ' . $id;
     //also delete the corresponding pn_lenses_power_lists table
     $query2 = 'DELETE from pn_lenses_power_lists where id = ' . $id;
     $resultarr[] = $mysqli->selectQuery($query2);
     //echo $query;
     $resultarr[] = $mysqli->selectQuery($query);
     return !in_array(false, $resultarr) ? true : false;
 }