method getRecentFiles documentation in bbn\Appui\Ide
return list files preferences
function(int $limit = 10)
{
$perm = $this->options->fromCode(self::RECENT_FILE, self::IDE_PATH, self::BBN_APPUI);
$all = [];
if (!empty($perm)) {
$pref = $this->pref->getByOption($perm);
if (!empty($pref['id'])) {
$pref_arch = $this->pref->getClassCfg();
$arch = &$pref_arch['arch']['user_options_bits'];
$recents = $this->db->rselectAll(
[
'table' => $pref_arch['tables']['user_options_bits'],
'fields' => [
$arch['id'],
$arch['id_user_option'],
$arch['id_option'],
$arch['cfg'],
$arch['text'],
'date' => 'JSON_UNQUOTE(JSON_EXTRACT('.$this->db->csn($arch['cfg'], true).', "$.last_date"))',
'num' => 'JSON_UNQUOTE(JSON_EXTRACT('.$this->db->csn($arch['cfg'], true).', "$.number"))'
],
'where' => [
'conditions' => [[
'field' => $arch['id_user_option'],
'value' => $pref['id']
]]
],
'limit' => 10,
'order' => ['date' => "DESC"]
]
);
//configure path for link for each recent file
foreach ($recents as $id => $bit) {
//path for link
$arr = explode("/", $bit['text']);
$type = '';
$root = $arr[0] . '/' . $arr[1];
if (!empty($arr[2])) {
$type = $arr[2];
unset($arr[2]);
}
unset($arr[0]);
unset($arr[1]);
if (($type !== 'mvc') && ($type !== 'components')) {
$tab = 'code';
} else {
$tab = array_shift($arr);
$tab = $tab === 'public' ? 'php' : $tab;
}
$arr = implode('/', $arr);
$file = explode('.', $arr)[0];
$path = Str::parsePath('file/' . $root . '/' . $type . '/' . $file . '/_end_/' . $tab);
$value = json_decode($bit['cfg'], true);
$all[] = [
'cfg' => !empty($value['file_json']) ? json_decode($this->fs->getContents(self::$backup_path . $value['file_json']), true) : [],
'file' => Str::parsePath($bit['text']),
'repository' => $root,
'path' => $path,
'type' => $type === '' ? false : $type
];
}
}
}
return !empty($all) ? $all : null;
}
return list files preferences 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-2023
BBN Solutions