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


PHP Book::getBookById方法代码示例

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


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

示例1: testGetFullBookContentArray

 public function testGetFullBookContentArray()
 {
     $book = Book::getBookById(17);
     $test = JSONRenderer::getFullBookContentArray($book);
     $this->assertCount(1, $test["authors"]);
     $this->assertCount(3, $test["tags"]);
     $this->assertCount(3, $test["datas"]);
 }
开发者ID:BreizhCat,项目名称:cops,代码行数:8,代码来源:jsonTest.php

示例2: testGetMimeType_Finfo

 public function testGetMimeType_Finfo()
 {
     $book = Book::getBookById(17);
     // Get Alice MOBI=>17, PDF=>19, EPUB=>20
     $data = $book->getDataFormat("PDF");
     $this->assertEquals("application/pdf", $data->getMimeType());
     // Alter a data to make a test for finfo_file if enabled
     $data->extension = "ico";
     $data->format = "ICO";
     $data->name = "favicon";
     $data->book->path = realpath(dirname(__FILE__) . "/../");
     if (function_exists('finfo_open') === true) {
         $this->assertEquals("image/x-icon", $data->getMimeType());
     } else {
         $this->assertEquals("application/octet-stream", $data->getMimeType());
     }
 }
开发者ID:horus68,项目名称:cops,代码行数:17,代码来源:bookTest.php

示例3: InitializeContent

 public function InitializeContent()
 {
     $this->book = Book::getBookById($this->idGet);
     $this->title = $this->book->title;
 }
开发者ID:Klemart3D,项目名称:COPS,代码行数:5,代码来源:base.php

示例4: notFound

    if (!isset($_SESSION['connected'])) {
        notFound();
        return;
    }
}
$expires = 60 * 60 * 24 * 14;
header("Pragma: public");
header("Cache-Control: maxage=" . $expires);
header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT');
$bookId = getURLParam("id", NULL);
$type = getURLParam("type", "jpg");
$idData = getURLParam("data", NULL);
if (is_null($bookId)) {
    $book = Book::getBookByDataId($idData);
} else {
    $book = Book::getBookById($bookId);
}
if (!$book) {
    notFound();
    return;
}
if ($book && ($type == "jpg" || empty($config['calibre_internal_directory']))) {
    if ($type == "jpg") {
        $file = $book->getFilePath($type);
    } else {
        $file = $book->getFilePath($type, $idData);
    }
    if (!$file || !file_exists($file)) {
        notFound();
        return;
    }
开发者ID:BreizhCat,项目名称:cops,代码行数:31,代码来源:fetch.php

示例5: testRenderCustomColumns

 public function testRenderCustomColumns()
 {
     global $config;
     $_SERVER["HTTP_USER_AGENT"] = "Firefox";
     $config['calibre_directory'] = dirname(__FILE__) . "/BaseWithCustomColumns/";
     $_GET["custom"] = "11";
     $config['cops_calibre_custom_column'] = array("custom_01", "custom_02", "custom_03", "custom_04", "custom_05", "custom_06", "custom_07", "custom_08", "custom_09", "custom_10", "custom_11");
     $config['cops_calibre_custom_column_list'] = array("custom_01", "custom_02", "custom_03", "custom_04", "custom_05", "custom_06", "custom_07", "custom_08", "custom_09", "custom_10", "custom_11");
     $config['cops_calibre_custom_column_preview'] = array("custom_01", "custom_02", "custom_03", "custom_04", "custom_05", "custom_06", "custom_07", "custom_08", "custom_09", "custom_10", "custom_11");
     Base::clearDb();
     $book = Book::getBookById(223);
     $json = JSONRenderer::getBookContentArray($book);
     /* @var CustomColumn[] $custom */
     $custom = $json["customcolumns_list"];
     $this->assertEquals("custom_01", $custom[0]['customColumnType']['columnTitle']);
     $this->assertEquals("text_2", $custom[0]['htmlvalue']);
     $this->assertEquals("custom_02", $custom[1]['customColumnType']['columnTitle']);
     $this->assertEquals("a", $custom[1]['htmlvalue']);
     $this->assertEquals("custom_03", $custom[2]['customColumnType']['columnTitle']);
     $this->assertEquals("<div>Not Set</div>", $custom[2]['htmlvalue']);
     $this->assertEquals("custom_04", $custom[3]['customColumnType']['columnTitle']);
     $this->assertEquals("", $custom[3]['htmlvalue']);
     $this->assertEquals("custom_05", $custom[4]['customColumnType']['columnTitle']);
     $this->assertEquals("val05", $custom[4]['htmlvalue']);
     $this->assertEquals("custom_06", $custom[5]['customColumnType']['columnTitle']);
     $this->assertEquals("Not Set", $custom[5]['htmlvalue']);
     $this->assertEquals("custom_07", $custom[6]['customColumnType']['columnTitle']);
     $this->assertEquals("100000.0", $custom[6]['htmlvalue']);
     $this->assertEquals("custom_08", $custom[7]['customColumnType']['columnTitle']);
     $this->assertEquals("Not Set", $custom[7]['htmlvalue']);
     $this->assertEquals("custom_09", $custom[8]['customColumnType']['columnTitle']);
     $this->assertEquals("Not Set", $custom[8]['htmlvalue']);
     $this->assertEquals("custom_10", $custom[9]['customColumnType']['columnTitle']);
     $this->assertEquals("No", $custom[9]['htmlvalue']);
     $_SERVER["HTTP_USER_AGENT"] = "";
     $_GET["custom"] = NULL;
     $config['cops_calibre_custom_column'] = array();
     $config['cops_calibre_custom_column_list'] = array();
     $config['cops_calibre_custom_column_preview'] = array();
     $config['calibre_directory'] = dirname(__FILE__) . "/BaseWithSomeBooks/";
     Base::clearDb();
 }
开发者ID:horus68,项目名称:cops,代码行数:42,代码来源:customColumnsTest.php


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