Centralize the getCount function.
This commit is contained in:
parent
70611e5c50
commit
4be0366a0a
7 changed files with 24 additions and 34 deletions
12
base.php
12
base.php
|
@ -1252,6 +1252,18 @@ abstract class Base
|
|||
return self::getDb ($database)->query($query)->fetchColumn();
|
||||
}
|
||||
|
||||
public static function getCountGeneric($table, $id, $pageId, $numberOfString = NULL) {
|
||||
if (!$numberOfString) {
|
||||
$numberOfString = $table . ".alphabetical";
|
||||
}
|
||||
$count = self::executeQuerySingle ('select count(*) from ' . $table);
|
||||
if ($count == 0) return NULL;
|
||||
$entry = new Entry (localize($table . ".title"), $id,
|
||||
str_format (localize($numberOfString, $count), $count), "text",
|
||||
array ( new LinkNavigation ("?page=".$pageId)));
|
||||
return $entry;
|
||||
}
|
||||
|
||||
public static function executeQuery($query, $columns, $filter, $params, $n, $database = NULL, $numberPerPage = NULL) {
|
||||
$totalResult = -1;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue