$val) { $stoneLink = "stones/{$val['clean_url']}"; //$stoneLink = "individualstones.php?stone={$val['clean_url']}"; $class = ($key%2) ? 'row2' : 'row1'; $str .= "    {$val['title']} {$val['country_of_origin']} {$val['type_of_stone']} "; } return $str; } // return an array of CAD details given a type function get_cad($type) { $condition = !empty($type) ? "WHERE `type` = '$type'" : ""; $sql = "SELECT * FROM `cad` $condition ORDER BY `filename`"; $result = mysql_query($sql); $info = array(); if(mysql_num_rows($result)) { while($row = mysql_fetch_assoc($result)) { $info[] = $row; } } return $info; } // returns an HTML code to display CAD details given a type function generate_cad($type) { $data = get_cad($type); $str = ''; foreach($data as $key=>$val) { $class = ($key%2) ? 'row2' : 'row1'; $str .= " {$val['filename']} {$val['description']} \"StonePly \"PDF \"AutoCAD "; } return $str; } function generate_extra_cad() { $data = array(); $data[] = array( 'filename' => 'SLP-001', 'description' => 'Floor Mounted Lavatory Partition Mounting Details' ); $data[] = array( 'filename' => 'SLP-002', 'description' => 'Floor and Ceiling Mounted Lavatory Partition Mounting Details' ); $data[] = array( 'filename' => 'SLP-003', 'description' => 'Wall Hung Urinal Screen Mounting Details' ); $data[] = array( 'filename' => 'SLP-004', 'description' => 'Lavatory Partition Dimension Details' ); $data[] = array( 'filename' => 'SLP-005', 'description' => 'Urinal Screen Dimension Details' ); $data[] = array( 'filename' => 'SLP-006', 'description' => 'Shower Partition Dimension Details' ); $data[] = array( 'filename' => 'SLP-007', 'description' => 'Changing Room Partition Dimension Details' ); $str = ''; foreach($data as $key=>$val) { $class = ($key%2) ? 'row2' : 'row1'; $str .= " {$val['filename']} {$val['description']} \"StonePly \"PDF "; } return $str; } // returns an array of stones as shown in Stone Options page function get_stones() { $maxRows_sOptions = 20; $pageNum_sOptions = (isset($_REQUEST['pageNum_sOptions'])) ? $_REQUEST['pageNum_sOptions'] : 0; $startRow_sOptions = $pageNum_sOptions * $maxRows_sOptions; $condition = (isset($_REQUEST['letter'])) ? "WHERE `title` LIKE '{$_REQUEST['letter']}%'" : ""; $sql = " SELECT `ID`, `title`, `picture`, `country_of_origin`, `type_of_stone`, `clean_url` FROM `stones` $condition GROUP BY `title` LIMIT $startRow_sOptions, $maxRows_sOptions "; $result = mysql_query($sql); $info = array(); if(mysql_num_rows($result)) { while($row = mysql_fetch_assoc($result)) { $info[] = $row; } } return $info; } // returns an HTML code to display stone results function generate_stones() { $data = get_stones(); $str = ''; if(!empty($data)) { foreach($data as $key=>$val) { $stoneLink = "stones/{$val['clean_url']}"; //$stoneLink = "individualstones.php?stone={$val['clean_url']}"; $class = ($key%2) ? 'row2' : 'row1'; $str .= "    {$val['title']} {$val['country_of_origin']} "; } } else { $str .= " No record found! "; } return $str; } // returns an array to display page navigation and records counter function generate_navigation() { $condition = (isset($_REQUEST['letter'])) ? "WHERE `title` LIKE '{$_REQUEST['letter']}%'" : ""; $sql = " SELECT `ID`, `title`, `picture`, `country_of_origin`, `type_of_stone`, `clean_url` FROM `stones` $condition GROUP BY `title` "; $result = mysql_query($sql); $maxRows = 20; $pageNum = (isset($_REQUEST['pageNum_sOptions'])) ? $_REQUEST['pageNum_sOptions'] : 0; $totalRows = mysql_num_rows($result); $startRow = ($pageNum * $maxRows) + 1; $startRow = ($startRow > $totalRows) ? 0 : $startRow; $endRow = ($pageNum * $maxRows) + $maxRows; $endRow = ($endRow > $totalRows) ? $totalRows : $endRow; $totalPages = ceil($totalRows/$maxRows) - 1; // << grab counter $prev = $pageNum - 1; $next = $pageNum + 1; $letterFilter = (isset($_REQUEST['letter'])) ? "[beginning with the letter '{$_REQUEST['letter']}']" : ""; $letterParam = (isset($_REQUEST['letter'])) ? "&letter={$_REQUEST['letter']}" : ""; $pageNavigator = array(); if($pageNum > 0) { $pageNavigator[] = 'First'; $pageNavigator[] = 'Previous'; } if($pageNum < $totalPages) { $pageNavigator[] = 'Next'; $pageNavigator[] = 'Last'; } $info = array(); $info['result_counter'] = "Stones $startRow through $endRow of $totalRows $letterFilter"; $info['page_navigator'] = implode(" | ", $pageNavigator); return $info; } // returns an HTML code useful for option list function generate_option($info) { $str = ''; foreach($info as $val) { $str .= "\r\n"; } return $str; } // returns an HTML code for banner function load_banner($type='image', $project='') { switch($type) { case 'rotate': return ''; break; case 'flash': return ''; break; case 'project': return ''; default: return ''; } } ?>