method getAll documentation in bbn\Appui\Cms
Returns all the notes of type 'pages'.
function(bool $with_content = false, array $filter = [], array $order = [], int $limit = 50, int $start = 0, string $type = NULL, bool $published = false)
{
$cfg = $this->getLastVersionCfg($with_content, $published, $filter);
$type_cond = [];
foreach ($this->getTypes() as $t) {
if (!$type || ($type === $t['value'])) {
$type_cond[] = [
'field' => 'bbn_notes.id_type',
'value' => $t['value']
];
}
}
if (empty($type_cond)) {
if (!($opt = Note::getOptionsObject()->option($type))) {
throw new \Exception(X::_("Impossible to find a type %s", $type));
}
$type_cond[] = [
'field' => 'bbn_notes.id_type',
'value' => $type
];
}
$cfg['where']['conditions'][] = [
'logic' => 'OR',
'conditions' => $type_cond
];
$cfg['limit'] = $limit;
$cfg['start'] = $start >= 0 ? $start : 0;
if (!empty($order)) {
$cfg['order'] = $order;
}
$db =& $this->db;
$idx = md5(json_encode($filter));
$total = $this->cacheGetSet(function() use (&$db, $cfg) {
return $db->count($cfg);
}, $idx, 'total', 20);
$data = $this->db->rselectAll($cfg);
foreach ($data as &$d) {
$d['front_img'] = $d['id_media'] ? $this->media->getMedia($d['id_media'], true) : null;
}
return [
'query' => $this->db->last(),
'data' => $data,
'total' => $total
];
}
Returns all the notes of type 'pages'. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2024
BBN Solutions