koblog/bl-kernel/kinds.class.php
2025-06-26 12:42:53 +02:00

45 lines
No EOL
913 B
PHP

<?php defined('KOBLOG') or die('Koblog CMS.');
class Kinds extends dbList {
function __construct()
{
parent::__construct(DB_KINDS);
}
function numberOfPages($key)
{
return $this->countItems($key);
}
public function reindex()
{
global $pages;
global $L;
$kindArray = array();
foreach ($GLOBALS['POST_KINDS'] as $kind) {
$kindArray[$kind]['name'] = $GLOBALS['POST_KINDS_EMOJI'][$kind]." ".$L->g($kind);
$kindArray[$kind]['list'] = array();
}
$db = $pages->getDB($onlyKeys=false);
foreach ($db as $pageKey=>$pageFields) {
if ($pageFields['type'] == "published" && isset($pageFields['kind']) && $pageFields !== '') {
$kind = $pageFields['kind'];
// Index by years
if (isset($kindArray[$kind])) {
array_push($kindArray[$kind]['list'], $pageKey);
}
}
}
$this->db = $kindArray;
return $this->save();
}
}