$_SESSION['cart'] = []; break; } // Page is generating here // caption generation require_once 'topbar.php'; // Main part // or body of the page depends of action which come // from probably GET or POST // category list will be shown in most cases // default action is browsing default category // default category is defined in constants.php switch ($action) { case 'detail': showCategories($mode); showDetail($ASIN, $mode); break; case 'addtocart': case 'deletefromcart': case 'emptycart': case 'showcart': echo "<hr /><h1>Your shopping cart</h1>"; showCart($_SESSION['cart'], $mode); break; case 'image': showCategories($mode); echo "<h1>Large Product Image</h1>"; showImage($ASIN, $mode); break; case 'search': showCategories($mode);
function showDetails($name, $values, $changes) { foreach ($values as $rd_id => $rd_val) { showDetail($name, getCurrentValString($rd_val), getChangedValString($rd_id, $changes)); } }
$objPHPExcel = showDetail_4($list); break; case 5: $objPHPExcel = showDetail_5($list); break; case 6: $objPHPExcel = showDetail_6($list); break; case 7: $objPHPExcel = showDetail_7($list); break; case 8: $objPHPExcel = showDetail_8($list); break; case 9: $objPHPExcel = showDetail_9($list); break; } return $objPHPExcel; } $objPHPExcel = showDetail($item); // $objPHPExcel->setActiveSheetIndex(0); /* redirect output to a client web browser (Excel2007) */ header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); header('Content-Disposition: attachment;filename="Export_Patient_' . $item . '.xlsx"'); header('Cache-Control: max-age=0'); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); // $objWriter->setUseDiskCaching(true, '../../wimage'); $objWriter->save('php://output'); $objPHPExcel->disconnectWorksheets(); exit;
} else { $docLibrary = test_input($_GET["doc_library"]); } if (empty($_GET["doc_number"])) { $nameErr = "doc_number is required"; return; } else { $docNumber = test_input($_GET["doc_number"]); } } else { return; } $urlStr = $urlStr . "&doc_library=" . $docLibrary . "&doc_number=" . $docNumber; $allText = file_get_contents($urlStr); $bookArray = fileStr2Array($allText); $storeDetail = showDetail($bookArray); echo urldecode(json_encode($storeDetail)); function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } function fileStr2Array($text) { $startStr = '<table border=0 cellspacing=2 width=96%>'; $startPostion = strpos($text, $startStr); $endStr = "<!-- item-global-body-tail -->"; $endPostion = strpos($text, $endStr); $text2 = substr($text, $startPostion, $endPostion - $startPostion);
{ return $this->classes; } private function setFName($name) { $this->fname = $name . ' - ' . get_class($this); } } // Prove the polymorphism by calling a member function function setName(Person $person, $name) { $person->setFirstName($name); } function showDetail(Person $person) { $name = $person->getFirstName(); return "This person's name is {$name}"; } // Test the inheritance/polymorphism $s1 = new Student('Dave', array('English' => 74, 'Maths' => 46, 'Science' => 65)); $t1 = new Tutor('Mike', array('Maths', 'Science')); $t2 = new Tutor('Chris', array('English', 'History')); setName($s1, 'Peter'); setName($t2, 'Mike'); echo '<br />'; echo showDetail($s1); echo '<br />'; echo showDetail($t1); echo '<br />'; echo showDetail($t2);