function import_Books($file) { set_include_path(get_include_path() . PATH_SEPARATOR . 'Classes/'); include 'PHPExcel/IOFactory.php'; require_once 'private/LMS_Engine.php'; $engine = new LMS_Engine(); try { $objPHPExcel = PHPExcel_IOFactory::load($file); $Total_Sheet = $objPHPExcel->getSheetCount(); for ($num = 0; $num < $Total_Sheet; $num++) { $Sheet = $objPHPExcel->getSheet($num)->toArray(null, true, true, true); $Row = count($Sheet); for ($pos = 3; $pos < $Row; $pos++) { $Title = trim($Sheet[$pos]['B']); $Author = trim($Sheet[$pos]['C']); $Publisher = trim($Sheet[$pos]['D']); $Pub_Year = trim($Sheet[$pos]['E']); $Pub_Add = trim($Sheet[$pos]['F']); $Call_ID = trim($Sheet[$pos]['G']); $Copy_Num = trim($Sheet[$pos]['H']); $Category = trim($Sheet[$pos]['I']); $Shelf_Store = trim($Sheet[$pos]['J']); $engine->add_new_book($Title, 1, $Author, $Publisher, $Pub_Year, $Pub_Add, $Call_ID, $Copy_Num, $Shelf_Store); } } } catch (Exception $e) { die('Error loading file "' . pathinfo($file, PATHINFO_BASENAME) . '": ' . $e->getMessage()); } }
<?php require_once 'private/LMS_Engine.php'; $engine = new LMS_Engine(); if (isset($_POST['add_new_book'])) { $engine->add_new_book($_POST['title'], $_POST['cat_id'], $_POST['author'], $_POST['publisher'], $_POST['publish_year'], $_POST['publish_address'], $_POST['call_id'], $_POST['copy_number'], 'store'); } $page_num = null; $from = "All"; $hint = ""; $cat_id = 1; if (!isset($_GET['page_num'])) { $page_num = 0; if (isset($_POST['Search_Items'])) { $from = $_POST['from']; $hint = $_POST['hint']; $cat_id = $_POST['cat_id']; } } else { $page_num = $_GET['page_num']; $from = $_GET['from']; $hint = $_GET['hint']; $cat_id = $_GET['cat_id']; } ?> <div class="container" id="main"> <div class="row" id="contact"> <hr> <div class="page-header"> <h3>Manage Library Books </h3> </div>