Example #1
0
function showData($page, $pageSize = 10, $key = "")
{
    if (empty($page)) {
        $page = 1;
    }
    if (empty($pageSize)) {
        $pageSize = 10;
    }
    if (empty($key)) {
        $key = "";
    }
    $books = BookManager::searchBooksWithRecordInfo($key, $page, $pageSize);
    if ($books === false || count($books["books"]) == 0) {
        echo "<script>history.back();alert('没有数据');</script>";
        return;
    }
    return $books;
}
Example #2
0
 function getInvIDByBarcode($barcode)
 {
     require_once PATH_ACCESS . '/DBConnect.php';
     $bookmanager = new BookManager();
     $barcode = str_replace("-", "/", $barcode);
     // replace - with /
     $barcode = preg_replace("/\\/([0-9])/", "/ \$1", $barcode);
     //add space after / when it's missing
     $barcode = str_replace("  ", " ", $barcode);
     // remove two empty spaces
     $bookData = $bookmanager->getBookDataByBarcode($barcode);
     try {
         $barcode_exploded = explode(' ', $barcode);
     } catch (Exception $e) {
     }
     if (isset($bookData["id"]) && isset($barcode_exploded[5])) {
         $query = sql_prev_inj(sprintf('book_id = %s AND year_of_purchase = %s AND exemplar = %s', $bookData["id"], $barcode_exploded[1], $barcode_exploded[5]));
         $result = parent::searchEntry($query);
         return $result['id'];
     }
 }
 function editBook()
 {
     global $mainframe, $option;
     $db =& JFactory::getDBO();
     $user =& JFactory::getUser();
     $cid = JRequest::getVar('cid', array(0), '', 'array');
     $option = JRequest::getCmd('option');
     $uid = (int) @$cid[0];
     $javascript = ' ';
     $row =& JTable::getInstance('flippingbook', 'Table');
     $row->load($uid);
     if (JRequest::getCmd('task') == 'add_book') {
         //Default values for a new book
         $row->id = "";
         $row->alias = "";
         $row->allow_pages_unload = 0;
         $row->always_opened = 0;
         $row->auto_flip_size = 50;
         $row->background_color = "FFFFFF";
         $row->background_image_placement = "center";
         $row->background_image = "";
         $row->book_height = 400;
         $row->book_width = 300;
         $row->category_id = "";
         $row->center_book = 1;
         $row->checked_out_time = "0000-00-00 00:00:00";
         $row->checked_out = "0";
         $row->created = gmdate('Y-m-d H:i:s');
         $row->description = "";
         $row->download_size = "0 Kb";
         $row->download_title = "Download Book";
         $row->download_url = "";
         $row->dynamic_shadows_depth = 1;
         $row->emailIcon = 1;
         $row->first_last_buttons = 1;
         $row->first_page = 1;
         $row->flash_height = 500;
         $row->flash_width = "100%";
         $row->flip_corner_style = "manually";
         $row->fullscreen_enabled = 1;
         $row->go_to_page_field = 1;
         $row->hardcover = 1;
         $row->hits = 0;
         $row->modified = gmdate('Y-m-d H:i:s');
         $row->navigation_bar_placement = "bottom";
         $row->navigation_bar = "navigation.swf";
         $row->new_window_height = 600;
         $row->new_window_width = 500;
         $row->open_book_in = 1;
         $row->ordering = 0;
         $row->page_background_color = "EEEEEE";
         $row->preview_image = "";
         $row->print_enabled = 1;
         $row->printIcon = 1;
         $row->published = 1;
         $row->scale_content = 1;
         $row->show_book_description = 1;
         $row->show_book_title = 1;
         $row->show_pages_description = 1;
         $row->slideshow_auto_play = 0;
         $row->slideshow_button = 1;
         $row->slideshow_display_duration = 5000;
         $row->static_shadows_depth = 1;
         $row->static_shadows_type = "Asymmetric";
         $row->title = "New Book";
         $row->zoom_enabled = 1;
         $row->zoom_image_height = 800;
         $row->zoom_image_width = 600;
         $row->zoom_ui_color = "8f9ea6";
         $row->zooming_method = 0;
     }
     $query = 'SELECT id FROM #__flippingbook_categories';
     $db->setQuery($query);
     if (count($db->loadObjectList()) < 1) {
         $msg = JText::_('CREATE A CATEGORY FIRST');
         $link = 'index.php?option=com_flippingbook&task=category_manager';
         $mainframe->redirect($link, $msg);
         return;
     }
     $lists['background_image'] = $this->getFilesSelectBox('background_image', $row->background_image, 1, 'jpg|jpeg|gif|png|swf|JPG|JPEG|GIF|PNG|SWF|', '');
     $lists['preview_image'] = $this->getFilesSelectBox('preview_image', $row->preview_image, 1, 'jpg|jpeg|gif|png|JPG|JPEG|GIF|PNG', '');
     $query = 'SELECT id, title FROM #__flippingbook_categories ORDER BY title';
     $db->setQuery($query);
     $book_rows = $db->loadObjectList();
     $book_filter[] = JHTML::_('select.option', -1, '- ' . JText::_('Select Category') . ' -');
     foreach ($book_rows as $book_row) {
         $book_option[] = JHTML::_('select.option', $book_row->id, $book_row->title);
     }
     $lists['categories'] = JHTML::_('select.genericlist', $book_option, 'category_id', 'class="inputbox" size="1"', 'value', 'text', $row->category_id);
     $backgroundImagePlacement[] = JHTML::_('select.option', 'center', JText::_('Center'));
     $backgroundImagePlacement[] = JHTML::_('select.option', 'fit', JText::_('Fit'));
     $backgroundImagePlacement[] = JHTML::_('select.option', 'top left', JText::_('Top Left'));
     $lists['backgroundImagePlacement'] = JHTML::_('select.genericlist', $backgroundImagePlacement, 'background_image_placement', 'class="inputbox" size="1"', 'value', 'text', $row->background_image_placement);
     $flipCornerStyle[] = JHTML::_('select.option', 'first page only', JText::_('First Page Only'));
     $flipCornerStyle[] = JHTML::_('select.option', 'manually', JText::_('Manually'));
     $lists['flipCornerStyle'] = JHTML::_('select.genericlist', $flipCornerStyle, 'flip_corner_style', 'class="inputbox" size="1"', 'value', 'text', $row->flip_corner_style);
     $staticShadowsType[] = JHTML::_('select.option', 'Asymmetric', JText::_('Asymmetric'));
     $staticShadowsType[] = JHTML::_('select.option', 'Symmetric', JText::_('Symmetric'));
     $lists['staticShadowsType'] = JHTML::_('select.genericlist', $staticShadowsType, 'static_shadows_type', 'class="inputbox" size="1"', 'value', 'text', $row->static_shadows_type);
     $navigationBarFolder = JPATH_SITE . DS . 'components' . DS . 'com_flippingbook' . DS . 'navigationbars';
     $navigationBarFiles = JFolder::files($navigationBarFolder, '.swf$');
     if (count($navigationBarFiles) > 0) {
         foreach ($navigationBarFiles as $file) {
             $navigationBarFile[] = JHTML::_('select.option', $file, $file);
         }
     }
     $navigationBarFile[] = JHTML::_('select.option', "", JText::_('None'));
     $lists['navigationBarFiles'] = JHTML::_('select.genericlist', $navigationBarFile, 'navigation_bar', 'class="inputbox" size="1"', 'value', 'text', $row->navigation_bar);
     $navigationBarPlacement[] = JHTML::_('select.option', 'bottom', JText::_('Bottom'));
     $navigationBarPlacement[] = JHTML::_('select.option', 'top', JText::_('Top'));
     $lists['navigationBarPlacement'] = JHTML::_('select.genericlist', $navigationBarPlacement, 'navigation_bar_placement', 'class="inputbox" size="1"', 'value', 'text', $row->navigation_bar_placement);
     $zoomingMethod[] = JHTML::_('select.option', '0', JText::_('Zoom in Flash'));
     $zoomingMethod[] = JHTML::_('select.option', '1', JText::_('AJAX window'));
     $lists['zoomingMethod'] = JHTML::_('select.genericlist', $zoomingMethod, 'zooming_method', 'class="inputbox" size="1" onchange="check_method();"', 'value', 'text', $row->zooming_method);
     require_once JPATH_COMPONENT . DS . 'views' . DS . 'book_manager.php';
     BookManager::editBook($row, $lists);
 }
Example #4
0
            if ($type == 0) {
                $persons = PersonManager::searchPersons($query, 1, -1);
            } else {
                $persons = PersonManager::searchPersonsBySunccoNo($query, 1, -1);
            }
            if ($persons === false) {
                return;
            }
            $personNames = array();
            $personCount = count($persons['persons']);
            for ($i = 0; $i < $personCount; $i++) {
                $person = $persons['persons'][$i];
                $personNames[$i] = $person->name . "_" . $person->personId . "_" . $person->sunccoNo;
            }
            echo JSON($personNames);
            return;
            break;
        case 'getBorrowerInfo':
            if (strlen($query) != 0) {
                $person = BookManager::getPerson($query);
                if ($person === false) {
                    echo "";
                } else {
                    echo $person->name . "_" . $person->personId . "_" . $person->sunccoNo;
                }
            }
            break;
        default:
            break;
    }
}
Example #5
0
        //获取书籍对象
        $bookName = split("_", $bookName);
        if (count($bookName) != 3) {
            $errorInfo = "无效的书名";
            throw new Exception($errorInfo);
        }
        $book = BookManager::getBook($bookName[1]);
        if ($book === false) {
            $errorInfo = "无效的书名";
            throw new Exception($errorInfo);
        }
        if ($book->status != 0) {
            $errorInfo = "该书不在库中";
            throw new Exception($errorInfo);
        }
        $ok = BookManager::borrowBookWithDate($book->bookId, $person->personId, $date);
        if ($ok === false) {
            $errorInfo = "操作失败";
            throw new Exception($errorInfo);
        } else {
            $js = "<script>alert('借书成功');</script>";
            echo "{$js}";
        }
    } catch (Exception $e) {
        $js = "<script>history.back();alert('借书失败:" . $e->getMessage() . "');</script>";
        echo "{$js}";
    }
}
?>
<!DOCTYPE html>
<html lang="en">
Example #6
0
<?php

require_once '../../models/book.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $book = new Book();
    $book->name = $_POST['name'];
    $book->ISBN = $_POST['ISBN'];
    $book->sunccoNo = $_POST['sunccoNo'];
    $book->price = $_POST['price'];
    $ok = BookManager::addBook($book);
    if ($ok === false) {
        echo "添加失败";
    } else {
        $js = "<script>alert('添加成功');</script>";
        echo "{$js}";
    }
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
  <?php 
require_once "../adminHead.php";
?>
</head>

<body>

  <?php 
require_once "../adminNav.html";
Example #7
0
        $renewBooks = $_POST['renew'];
        $falseCount = 0;
        foreach ($renewBooks as $value) {
            $info = split("_", $value);
            $bookId = $info[0];
            $personId = $info[1];
            $result = BookManager::renewBook($bookId, $personId);
            if ($result === false) {
                $falseCount++;
            }
        }
        $showInfo = "成功:" . (count($renewBooks) - $falseCount);
        echo '<script>history.back();alert("' . $showInfo . '");</script>';
    }
}
$books = BookManager::expiredBooksWithRecordInfo();
if ($books === false) {
    echo "<script>history.back();alert('获取数据失败');</script>";
    return;
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
  <?php 
require_once "../adminHead.php";
?>
</head>

<body>
Example #8
0
        //获取书籍对象
        $bookName = split("_", $bookName);
        if (count($bookName) != 3) {
            $errorInfo = "无效的书名";
            throw new Exception($errorInfo);
        }
        $book = BookManager::getBook($bookName[1]);
        if ($book === false) {
            $errorInfo = "无效的书名";
            throw new Exception($errorInfo);
        }
        if ($book->status != 1) {
            $errorInfo = "该书没有被借出";
            throw new Exception($errorInfo);
        }
        $ok = BookManager::remandBook($book->bookId, $person->personId);
        if ($ok === false) {
            $errorInfo = "操作失败";
            throw new Exception($errorInfo);
        } else {
            $js = "<script>alert('还书成功');</script>";
            echo "{$js}";
        }
    } catch (Exception $e) {
        $js = "<script>history.back();alert('还书失败:" . $e->getMessage() . "');</script>";
        echo "{$js}";
    }
}
?>

<!DOCTYPE html>
Example #9
0
<?php

require_once '../adminHeader.html';
?>

<?php 
require_once '../../models/book.php';
require_once '../../models/record.php';
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    $bookId = $_GET['bookId'];
    $book = BookManager::getBook($bookId);
    if ($books === false) {
        echo "<script>history.back();alert('没有数据');</script>";
        return;
    }
    $records = RecordManager::searchRecordsWithPersonName($bookId);
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
  <?php 
require_once "../adminHead.php";
?>
</head>

<body>

  <?php 
require_once "../adminNav.html";
Example #10
0
#!/usr/bin/php
<?php 
require_once "email.php";
require_once "book.php";
$result = BookManager::needSendEmailBooks();
foreach ($result as $book) {
    Email::sendExpiredEmail($book->currentRecord->personName, $book->currentRecord->personEmail, $book->name);
}
 /**
  * Returns the book ID by a given ISBN
  */
 function getBookIdByISBN($isbn_search)
 {
     require_once PATH_ACCESS . '/BookManager.php';
     $bookManager = new BookManager();
     try {
         $book_id = $bookManager->getBookIDByISBN($isbn_search);
     } catch (Exception $e) {
         $this->BookInterface->dieError($this->messages['error']['notFound'] . $e->getMessage());
     }
     return $book_id['id'];
 }
Example #12
0
$secondReservation = new Reservation("20-10-2014", "25-10-2014", $secondGuest);
$thirdReservation = new Reservation("18-10-2014", "26-10-2014", $thirdGuest);
$fourReservation = new Reservation("01-10-2014", "17-10-2014", $thirdGuest);
$rooms[201] = new SingleRoom(201, 40);
BookManager::bookRoom($rooms[201], $firstReservation);
BookManager::bookRoom($rooms[201], $fourReservation);
$rooms[305] = new SingleRoom(305, 60);
BookManager::bookRoom($rooms[305], $firstReservation);
BookManager::bookRoom($rooms[305], $secondReservation);
$rooms[401] = new SingleRoom(401, 40);
$rooms[412] = new Bedroom(412, 70);
$rooms[302] = new Bedroom(302, 80);
$rooms[202] = new Bedroom(202, 70);
$rooms[410] = new Bedroom(410, 80);
$rooms[501] = new Apartment(501, 200);
BookManager::bookRoom($rooms[501], $secondReservation);
$rooms[502] = new Apartment(502, 300);
$rooms[601] = new Apartment(601, 350);
echo PHP_EOL;
echo "Bedrooms and apartments with a price less or equal to 250.00";
echo PHP_EOL;
$filteredRooms = array_filter($rooms, "getBedroomsAndApartmentsByPrice");
function getBedroomsAndApartmentsByPrice(Room $room)
{
    if ($room instanceof Bedroom || $room instanceof Apartment) {
        if ($room->getPrice() <= 250) {
            return true;
        }
    }
    return false;
}
Example #13
0
require_once './models/book.php';
require_once './models/record.php';
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    $page = $_GET['page'];
    $pageSize = $_GET['pageSize'];
    $key = $_GET['searchKey'];
    if (empty($page)) {
        $page = 1;
    }
    if (empty($pageSize)) {
        $pageSize = 10;
    }
    if (empty($key)) {
        $key = "";
    }
    $books = BookManager::searchBooksWithRecordInfo($key, $page, $pageSize);
    if ($books === false || count($books["books"]) == 0) {
        echo "<script>history.back();alert('没有数据');</script>";
        return;
    }
}
?>

<div class="container-fluid">
    <div class="row-fluid">

      <div id="content">
        <h3 id="store_h3">图书列表</h3>
        <form id="tab" class="form-horizontal " method="GET" action="index.php">
      <div class="control-group">
          <input type="text" name="searchKey" class="input-xlarge">