当前位置: 首页>>代码示例>>PHP>>正文


PHP Book类代码示例

本文整理汇总了PHP中Book的典型用法代码示例。如果您正苦于以下问题:PHP Book类的具体用法?PHP Book怎么用?PHP Book使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Book类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: procGetIDNum

 private function procGetIDNum($session)
 {
     $queryType = @$_GET['type'];
     shell_exec("java PHPHandler requestRFIDTagId");
     $idNum = (string) shell_exec("java PHPHandler downloadRFID");
     if ($queryType == "add") {
         $session->form->setValue("rfid", $idNum);
         $_SESSION['value_array'] = $session->form->getValueArray();
         session_write_close();
         header("Location: bookProcess.php?submitBookChanges&type=" . $queryType);
     } else {
         if ($queryType == "change" || $queryType == "remove") {
             $book = new Book();
             $result = $book->getBookCallNo($idNum);
             $callNo = $result['CallNo'];
             header("Location: bookProcess.php?setupChangeList&type=" . $queryType . "&callNo=" . $callNo . "");
         } else {
             if ($queryType == "checkinout") {
                 $book = new Book();
                 $result = $book->getBookCallNo($idNum);
                 $callNo = $result['CallNo'];
                 header("Location: librarianProcess.php?checkinout&s=1&callNo=" . $callNo . "");
             }
         }
     }
 }
开发者ID:jpoon,项目名称:RFID-Library-Management-System,代码行数:26,代码来源:serialProcess.php

示例2: books

 function books()
 {
     $objs = new Book();
     $objs->get();
     $data = array('books' => $objs);
     $this->load->view('backend/books', $data);
 }
开发者ID:pojok-webdev,项目名称:pattimura,代码行数:7,代码来源:adm.php

示例3: testFormatALotOfResults

 public function testFormatALotOfResults()
 {
     $nbBooks = 50;
     $con = Propel::getConnection(BookPeer::DATABASE_NAME);
     Propel::disableInstancePooling();
     $book = new Book();
     for ($i = 0; $i < $nbBooks; $i++) {
         $book->clear();
         $book->setTitle('BookTest' . $i);
         $book->save($con);
     }
     $stmt = $con->query('SELECT * FROM book');
     $formatter = new PropelOnDemandFormatter();
     $formatter->init(new ModelCriteria('bookstore', 'Book'));
     $books = $formatter->format($stmt);
     $this->assertTrue($books instanceof PropelOnDemandCollection, 'PropelOnDemandFormatter::format() returns a PropelOnDemandCollection');
     $this->assertEquals($nbBooks, count($books), 'PropelOnDemandFormatter::format() returns a collection that counts as many rows as the results in the query');
     $i = 0;
     foreach ($books as $book) {
         $this->assertTrue($book instanceof Book, 'PropelOnDemandFormatter::format() returns a collection of Model objects');
         $this->assertEquals('BookTest' . $i, $book->getTitle(), 'PropelOnDemandFormatter::format() returns the model objects matching the query');
         $i++;
     }
     Propel::enableInstancePooling();
 }
开发者ID:kcornejo,项目名称:estadistica,代码行数:25,代码来源:PropelOnDemandFormatterTest.php

示例4: testGetId

 function testGetId()
 {
     $name = "Randy Mclure";
     $test_patron = new Book($name);
     $result = $test_patron->getId();
     $this->assertEquals(null, $result);
 }
开发者ID:umamiMike,项目名称:Library,代码行数:7,代码来源:PatronTest.php

示例5: update

 function update()
 {
     $params = $this->input->post();
     $obj = new Book();
     $obj->where('id', $params['id'])->update($params);
     echo $obj->check_last_query();
 }
开发者ID:pojok-webdev,项目名称:pattimura,代码行数:7,代码来源:books.php

示例6: bookInsertion

 function bookInsertion($title, $ISBN, $author)
 {
     $book = new \Book(['title' => $title, 'isbn' => $ISBN]);
     $book->link('author', $author);
     $book->save();
     return $book;
 }
开发者ID:githubjeka,项目名称:php-orm-benchmark,代码行数:7,代码来源:TestDefault.php

示例7: __construct

 /**
  * __construct method
  */
 public function __construct(View $view, $settings = array())
 {
     parent::__construct($view, $settings);
     App::import("Model", 'Book');
     $Book = new Book();
     $this->calibrePath = $Book->getCalibrePath();
 }
开发者ID:cc2i,项目名称:calibrephp,代码行数:10,代码来源:ImageHelper.php

示例8: hallAction

 public function hallAction()
 {
     $this->view->loginuser = $_SESSION['loginuser'];
     $book = new Book();
     $res = $book->fetchAll()->toArray();
     $this->view->res = $res;
 }
开发者ID:yuxujian,项目名称:YuNote,代码行数:7,代码来源:HallController.php

示例9: test_create_from_array

 public function test_create_from_array()
 {
     $data = array('title' => 'New Book', 'author_id' => '1', 'quantity' => '500', 'price' => '7.77');
     // 'New Book' doesn't exist
     // i.e. test may be invalid
     $book = new Book();
     $book = $book->find_by_title('New Book');
     if (count($book) != 0) {
         $this->errors['create_from_array'][] = 'pre-exists';
     }
     $new_book = new Book();
     $new_book->create($data);
     // 'New Book' was created
     // e.g. create() isn't working
     if (is_null($new_book->id)) {
         $this->errors['create_from_array'][] = 'new_book_id';
     }
     // 'New Book' can be fetched
     // e.g. update() isn't working
     $fetch_book = new Book();
     $fetch_book = $fetch_book->find_by_title('New Book');
     if (count($fetch_book) != 1) {
         $this->errors['create_from_array'][] = 'fetch_count';
     }
     if ($fetch_book[0]->id != $new_book->id) {
         $this->errors['create_from_array'][] = 'fetch_id_match';
     }
 }
开发者ID:TheOddLinguist,项目名称:toolbox,代码行数:28,代码来源:tester.norm.create.php

示例10: test_update_from_array

 public function test_update_from_array()
 {
     $data = array('title' => 'New Book', 'author_id' => '1', 'quantity' => '500', 'price' => '7.77');
     // Create Book to test
     $new_book = new Book();
     $new_book->create($data);
     // 'New Book' exists
     // i.e. test may be invalid
     $book = new Book();
     $book = $book->find_by_title('New Book');
     if (count($book) == 0) {
         $this->errors['update_from_array'][] = 'non-existent';
     }
     if (count($book) > 1) {
         $this->errors['update_from_array'][] = 'too_many';
     }
     $new_data = array('author_id' => '2', 'quantity' => '600', 'price' => '8.88');
     $update_book = new Book();
     $update_book = $update_book->first_by_title('New Book');
     $update_book->update($new_data);
     // Fetch book
     // e.g. update() isn't working
     $fetch_book = new Book();
     $fetch_book = $fetch_book->first_by_title('New Book');
     if ($fetch_book->author_id != 2) {
         $this->errors['update_from_array'][] = 'author_id';
     }
     if ($fetch_book->quantity != 600) {
         $this->errors['update_from_array'][] = 'quantity';
     }
     if ($fetch_book->price != '8.88') {
         $this->errors['update_from_array'][] = 'price';
     }
 }
开发者ID:TheOddLinguist,项目名称:toolbox,代码行数:34,代码来源:tester.norm.update.php

示例11: testTicket2

 public function testTicket2()
 {
     $obj = new Book();
     $obj->set('name', 'yes2');
     $obj->save();
     $this->assertEqual($obj->get('name'), 'yes2');
     $obj->save();
 }
开发者ID:dennybrandes,项目名称:doctrine1,代码行数:8,代码来源:381TestCase.php

示例12: process

 /**
  * @return bool
  * @throws Exception
  */
 public function process()
 {
     $bookModel = new Book();
     if (!$bookModel->load($this->data) || !$bookModel->validate()) {
         throw new Exception('Invalid data!');
     }
     return $bookModel->delete();
 }
开发者ID:alfytu,项目名称:booklibrary,代码行数:12,代码来源:Delete.php

示例13: testWeCanCreateABookWithInformation

 public function testWeCanCreateABookWithInformation()
 {
     $title = 'New Title';
     $author = "Author";
     $book = new Book($title, $author);
     $this->assertEquals($title, $book->getTitle());
     $this->assertEquals($author, $book->getAuthor());
 }
开发者ID:Witoso,项目名称:learningphp,代码行数:8,代码来源:BookTest.php

示例14: removeBook

 public function removeBook(Book $bookToRemove)
 {
     foreach ($this->books as $key => $book) {
         /** @var Book $book */
         if ($book->getAuthorAndTitle() === $bookToRemove->getAuthorAndTitle()) {
             unset($this->books[$key]);
         }
     }
 }
开发者ID:miaokuan,项目名称:DesignPatternsPHP,代码行数:9,代码来源:BookList.php

示例15: bookInsertion

 function bookInsertion($title, $ISBN, $author)
 {
     $book = new \Book();
     $book->title = $title;
     $book->isbn = $ISBN;
     $book->author()->associate($author);
     $book->save();
     return $book;
 }
开发者ID:Big-Shark,项目名称:php-orm-benchmark,代码行数:9,代码来源:TestDefault.php


注:本文中的Book类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。