@@ -102,7 +102,7 @@ class JSONRenderer | |||
$out ["book"] = self::getBookContentArray ($entry->book); | |||
return $out; | |||
} | |||
return array ( "title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink () ); | |||
return array ( "title" => $entry->title, "content" => $entry->content, "navlink" => $entry->getNavLink (), "number" => $entry->numberOfElement ); | |||
} | |||
public static function getContentArrayTypeahead ($page) { | |||
@@ -390,6 +390,7 @@ class Entry | |||
public $title; | |||
public $id; | |||
public $content; | |||
public $numberOfElement; | |||
public $contentType; | |||
public $linkArray; | |||
public $localUpdated; | |||
@@ -427,7 +428,7 @@ class Entry | |||
return "#"; | |||
} | |||
public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pclass = "") { | |||
public function __construct($ptitle, $pid, $pcontent, $pcontentType, $plinkArray, $pclass = "", $pcount = 0) { | |||
global $config; | |||
$this->title = $ptitle; | |||
$this->id = $pid; | |||
@@ -435,6 +436,7 @@ class Entry | |||
$this->contentType = $pcontentType; | |||
$this->linkArray = $plinkArray; | |||
$this->className = $pclass; | |||
$this->numberOfElement = $pcount; | |||
if ($config['cops_show_icons'] == 1) | |||
{ | |||
@@ -571,7 +573,7 @@ class Page | |||
$nBooks = Book::getBookCount ($i); | |||
array_push ($this->entryArray, new Entry ($key, "cops:{$i}:catalog", | |||
str_format (localize ("bookword", $nBooks), $nBooks), "text", | |||
array ( new LinkNavigation ("?" . DB . "={$i}")))); | |||
array ( new LinkNavigation ("?" . DB . "={$i}")), "", $nBooks)); | |||
$i++; | |||
Base::clearDb (); | |||
} | |||
@@ -1260,7 +1262,7 @@ abstract class Base | |||
if ($count == 0) return NULL; | |||
$entry = new Entry (localize($table . ".title"), $id, | |||
str_format (localize($numberOfString, $count), $count), "text", | |||
array ( new LinkNavigation ("?page=".$pageId))); | |||
array ( new LinkNavigation ("?page=".$pageId)), "", $count); | |||
return $entry; | |||
} | |||
@@ -438,13 +438,13 @@ class Book extends Base { | |||
$entry = new Entry (localize ("allbooks.title"), | |||
self::ALL_BOOKS_ID, | |||
str_format (localize ("allbooks.alphabetical", $nBooks), $nBooks), "text", | |||
array ( new LinkNavigation ("?page=".parent::PAGE_ALL_BOOKS))); | |||
array ( new LinkNavigation ("?page=".parent::PAGE_ALL_BOOKS)), "", $nBooks); | |||
array_push ($result, $entry); | |||
if ($config['cops_recentbooks_limit'] > 0) { | |||
$entry = new Entry (localize ("recent.title"), | |||
self::ALL_RECENT_BOOKS_ID, | |||
str_format (localize ("recent.list"), $config['cops_recentbooks_limit']), "text", | |||
array ( new LinkNavigation ("?page=".parent::PAGE_ALL_RECENT_BOOKS))); | |||
array ( new LinkNavigation ("?page=".parent::PAGE_ALL_RECENT_BOOKS)), "", $config['cops_recentbooks_limit']); | |||
array_push ($result, $entry); | |||
} | |||
return $result; | |||
@@ -66,10 +66,10 @@ class CustomColumn extends Base { | |||
} | |||
public static function getCount($customId) { | |||
$nCustoms = parent::getDb ()->query('select count(*) from ' . self::getTableName ($customId))->fetchColumn(); | |||
$nCustoms = parent::executeQuerySingle ('select count(*) from ' . self::getTableName ($customId)); | |||
$entry = new Entry (self::getAllTitle ($customId), self::getAllCustomsId ($customId), | |||
str_format (localize("tags.alphabetical", $nCustoms), $nCustoms), "text", | |||
array ( new LinkNavigation (self::getUriAllCustoms ($customId)))); | |||
array ( new LinkNavigation (self::getUriAllCustoms ($customId))), "", $nCustoms); | |||
return $entry; | |||
} | |||
@@ -1,8 +1,4 @@ | |||
{{? it.containsBook == 0}} | |||
<div class="container"> | |||
{{??}} | |||
<div class="container-fluid"> | |||
{{?}} | |||
{{? it.page == 13 || it.page == 16}} | |||
{{? it.page == 13}} | |||
{{#def.bookdetail}} | |||
@@ -10,18 +6,21 @@ | |||
{{= it.fullhtml}} | |||
{{?}} | |||
{{??}} | |||
{{? it.containsBook == 1}} | |||
<div class="row"> | |||
{{??}} | |||
<div class="list-group"> | |||
{{?}} | |||
{{~it.entries:entry:i}} | |||
{{? it.containsBook == 0}} | |||
<a class="list-group-item" href="{{=entry.navlink}}"> | |||
{{=htmlspecialchars (entry.title)}} | |||
<span class="glyphicon glyphicon-chevron-right"></span> | |||
<span class="badge">{{=entry.content}}</span> | |||
</a> | |||
<div class="col-lg-2 col-md-4 col-sm-6 col-xs-12"> | |||
<div class="panel panel-default" style="height: 70px;"> | |||
<div class="panel-heading"> | |||
<h3 class="panel-title"> | |||
<a href="{{=entry.navlink}}" style="display: block;">{{=htmlspecialchars (entry.title)}}</a> | |||
</h3> | |||
</div> | |||
<div class="panel-body"> | |||
<span class="badge bottomright">{{=entry.number}}</span> | |||
</div> | |||
</div> | |||
</div> | |||
{{??}} | |||
<div class="col-lg-2 col-md-4 col-sm-6 col-xs-12"> | |||
<div class="panel panel-default" style="height: 320px;"> | |||
@@ -28,8 +28,10 @@ class PageMultiDatabaseTest extends PHPUnit_Framework_TestCase | |||
$this->assertCount (2, $currentPage->entryArray); | |||
$this->assertEquals ("Some books", $currentPage->entryArray [0]->title); | |||
$this->assertEquals ("15 books", $currentPage->entryArray [0]->content); | |||
$this->assertEquals (15, $currentPage->entryArray [0]->numberOfElement); | |||
$this->assertEquals ("One book", $currentPage->entryArray [1]->title); | |||
$this->assertEquals ("1 book", $currentPage->entryArray [1]->content); | |||
$this->assertEquals (1, $currentPage->entryArray [1]->numberOfElement); | |||
$this->assertFalse ($currentPage->ContainsBook ()); | |||
} | |||
@@ -60,7 +62,7 @@ class PageMultiDatabaseTest extends PHPUnit_Framework_TestCase | |||
$this->assertEquals ("1 book", $currentPage->entryArray [1]->content); | |||
$this->assertFalse ($currentPage->ContainsBook ()); | |||
} | |||
public function providerSearch () | |||
{ | |||
return array ( | |||
@@ -26,20 +26,28 @@ class PageTest extends PHPUnit_Framework_TestCase | |||
$this->assertCount (8, $currentPage->entryArray); | |||
$this->assertEquals ("Authors", $currentPage->entryArray [0]->title); | |||
$this->assertEquals ("Alphabetical index of the 6 authors", $currentPage->entryArray [0]->content); | |||
$this->assertEquals (6, $currentPage->entryArray [0]->numberOfElement); | |||
$this->assertEquals ("Series", $currentPage->entryArray [1]->title); | |||
$this->assertEquals ("Alphabetical index of the 4 series", $currentPage->entryArray [1]->content); | |||
$this->assertEquals (4, $currentPage->entryArray [1]->numberOfElement); | |||
$this->assertEquals ("Publishers", $currentPage->entryArray [2]->title); | |||
$this->assertEquals ("Alphabetical index of the 6 publishers", $currentPage->entryArray [2]->content); | |||
$this->assertEquals (6, $currentPage->entryArray [2]->numberOfElement); | |||
$this->assertEquals ("Tags", $currentPage->entryArray [3]->title); | |||
$this->assertEquals ("Alphabetical index of the 11 tags", $currentPage->entryArray [3]->content); | |||
$this->assertEquals (11, $currentPage->entryArray [3]->numberOfElement); | |||
$this->assertEquals ("Ratings", $currentPage->entryArray [4]->title); | |||
$this->assertEquals ("3 ratings", $currentPage->entryArray [4]->content); | |||
$this->assertEquals (3, $currentPage->entryArray [4]->numberOfElement); | |||
$this->assertEquals ("Languages", $currentPage->entryArray [5]->title); | |||
$this->assertEquals ("Alphabetical index of the 2 languages", $currentPage->entryArray [5]->content); | |||
$this->assertEquals (2, $currentPage->entryArray [5]->numberOfElement); | |||
$this->assertEquals ("All books", $currentPage->entryArray [6]->title); | |||
$this->assertEquals ("Alphabetical index of the 15 books", $currentPage->entryArray [6]->content); | |||
$this->assertEquals (15, $currentPage->entryArray [6]->numberOfElement); | |||
$this->assertEquals ("Recent additions", $currentPage->entryArray [7]->title); | |||
$this->assertEquals ("50 most recent books", $currentPage->entryArray [7]->content); | |||
$this->assertEquals (50, $currentPage->entryArray [7]->numberOfElement); | |||
$this->assertFalse ($currentPage->ContainsBook ()); | |||
} | |||