method browse documentation in bbn\Appui\Medias

Gets an array of medias.

function(array $cfg, int $limit = 20, int $start = 0) { if ($user = User::getInstance()) { $cf = $this->getClassCfg(); $ct = $cf['arch']['medias']; $filters = []; if (isset($cfg['filters'], $cfg['filters']['conditions'])) { $filters = $cfg['filters']['conditions']; if ((count($filters) === 1) && ($filters[0]['field'] === $cf['arch']['medias']['title'])) { unset($cfg['filters']); return $this->search($filters[0]['value'], $cfg, $limit, $start); } } if (($pvtIdx = X::find($filters, ['field' => $ct['private']])) === null) { $filters[] = [ 'field' => $ct['private'], 'value' => 0 ]; } else { $userIdx = X::find($filters, ['field' => $ct['id_user']]); $id_user = $user->getId(); if (!empty($filters[$pvtIdx]['value'])) { if ($userIdx === null) { $filters[] = [ 'field' => $ct['id_user'], 'value' => $id_user ]; } else { $filters[$userIdx]['value'] = $id_user; } } else if ($userIdx !== null) { unset($filters[$userIdx]); } } if (isset($cfg['filters'], $cfg['filters']['conditions'])) { $cfg['filters']['conditions'] = $filters; } else { $cfg['filters'] = [ 'logic' => 'AND', 'conditions' => $filters ]; } $grid = new Grid($this->db, $cfg, [ 'table' => $cf['table'], 'fields' => array_merge($ct, ['last_mod' => "IFNULL(edited, created)"]), 'join' => $cfg['join'] ?? null, 'limit' => $cfg['limit'] ?? $limit, 'start' => $cfg['start'] ?? $start ]); if ($data = $grid->getDatatable()) { foreach ($data['data'] as &$d) { $this->transformMedia($d); } return $data; } } return null; }

Gets an array of medias. 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.